FaceLibraryTrait

struct FaceLibraryTrait

Trait for managing the familiar face library of a structure.

  • The trait identifier.

    Declaration

    Swift

    static let identifier: String
  • List of all event types on the given Trait.

    Currently, only MatterTrait traits support any events, but this will likely expand to other traits in the future.

    Declaration

    Swift

    static let supportedEventTypes: [any Event.Type]
  • List of all commands supported by the Trait’s definition. The commands supported by a specific Trait instance may vary.

    Declaration

    Swift

    static var supportedCommandTypes: [any Command.Type] { get }
  • Metadata about this Trait.

    Declaration

    Swift

    let metadata: TraitMetadata
  • List of attributes for the FaceLibraryTrait.

    Declaration

    Swift

    let attributes: Google.FaceLibraryTrait.Attributes
  • Creates a new Trait instance using data read from the given TraitDecoder.

    Throws

    HomeError.parseError when parsing fails.

    Declaration

    Swift

    init(decoder: TraitDecoder, interactionProxy: (any InteractionProxy)?, metadata: TraitMetadata) throws

    Parameters

    decoder

    The raw data representing this Trait.

    interactionProxy

    Proxy to the Interaction Client.

    metadata

    Metadata about this Trait.

  • Writes this object to the given TraitEncoder. Throws HomeError.encodingFailed if the data could not be encoded.

    Declaration

    Swift

    func encode(with encoder: TraitEncoder) throws
  • Returns a Boolean value indicating whether two values are equal.

    Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

    Declaration

    Swift

    static func == (lhs: Google.FaceLibraryTrait, rhs: Google.FaceLibraryTrait) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • Hashes the essential components of this value by feeding them into the given hasher.

    Implement this method to conform to the Hashable protocol. The components used for hashing must be the same as the components compared in your type’s == operator implementation. Call hasher.combine(_:) with each of these components.

    Important

    In your implementation of hash(into:), don’t call finalize() on the hasher instance provided, or replace it with a different instance. Doing so may become a compile-time error in the future.

    Declaration

    Swift

    func hash(into hasher: inout Hasher)
  • The attributes for the FaceLibraryTrait.

    Declaration

    Swift

    struct Attributes
  • Represents a face profile in the face library.

    Declaration

    Swift

    struct Face
  • Represents a single detected instance of a face.

    Declaration

    Swift

    struct FaceInstance
  • Associates a face instance ID with its corresponding face profile.

    Declaration

    Swift

    struct FaceByInstance
  • A list of face IDs.

    Declaration

    Swift

    struct FaceIds
  • A list of face categories.

    Declaration

    Swift

    struct FaceCategories
  • Positive feedback confirming a face instance was correctly matched.

    Declaration

    Swift

    struct FaceInstancePositiveFeedback
  • Negative feedback indicating a face instance was incorrectly matched.

    Declaration

    Swift

    struct FaceInstanceNegativeFeedback
  • The availability status of the face library.

    Declaration

    Swift

    enum FaceLibraryStatus
  • The category assigned to a detected face in the face library.

    Declaration

    Swift

    enum FaceCategory
  • Gets faces from the face library matching the specified filter.

    Declaration

    Swift

    func getFaces(faceIds: Google.FaceLibraryTrait.FaceIds? = nil, faceCategories: Google.FaceLibraryTrait.FaceCategories? = nil) async throws -> Google.FaceLibraryTrait.GetFacesResponse

    Parameters

    faceIds

    The IDs of the faces to return.

    faceCategories

    The categories of the faces to return.

  • Gets faces from the face library by their face instance IDs.

    Declaration

    Swift

    func getFacesByInstances(faceInstanceIdsArray: [String]) async throws -> Google.FaceLibraryTrait.GetFacesByInstancesResponse

    Parameters

    faceInstanceIdsArray

    The instance IDs of the faces to return.

  • Updates a face in the face library.

    Declaration

    Swift

    func updateFace(id: String? = nil, name: String? = nil, category: Google.FaceLibraryTrait.FaceCategory? = nil) async throws -> Google.FaceLibraryTrait.UpdateFaceResponse

    Parameters

    id

    The ID of the face to update.

    name

    The updated name of the face. If omitted, the name is not updated.

    category

    The updated category of the face. If omitted, the category is not updated.

  • Merges multiple faces in the face library.

    Declaration

    Swift

    func mergeFaces(mergedFaceId: String? = nil, faceIdsToMergeArray: [String], name: String? = nil) async throws -> Google.FaceLibraryTrait.MergeFacesResponse

    Parameters

    mergedFaceId

    The ID of the target face to merge into. If omitted, a new face is created.

    faceIdsToMergeArray

    The IDs of the faces to be merged.

    name

    The name of the newly created face. Ignored if merging into an existing face.

  • Removes faces from the face library.

    Declaration

    Swift

    func removeFaces(faceIdsArray: [String]) async throws -> Google.FaceLibraryTrait.RemoveFacesResponse

    Parameters

    faceIdsArray

    The IDs of the faces to remove.

  • Gets all face instances for a given face.

    Declaration

    Swift

    func getFaceInstances(faceId: String? = nil) async throws -> Google.FaceLibraryTrait.GetFaceInstancesResponse

    Parameters

    faceId

    The ID of the face for which to return face instances.

  • Moves face instances from one face to another.

    Declaration

    Swift

    func moveFaceInstances(faceId: String? = nil, faceInstanceIdsArray: [String], name: String? = nil) async throws -> Google.FaceLibraryTrait.MoveFaceInstancesResponse

    Parameters

    faceId

    The ID of the destination face to move the face instances to.

    faceInstanceIdsArray

    The IDs of the face instances to move.

    name

    The name of the face.

  • Removes face instances from the face library.

    Declaration

    Swift

    func removeFaceInstances(faceInstanceIdsArray: [String]) async throws -> Google.FaceLibraryTrait.RemoveFaceInstancesResponse

    Parameters

    faceInstanceIdsArray

    The IDs of the face instances to remove.

  • Removes the entire face library.

    Declaration

    Swift

    func removeLibrary() async throws -> Google.FaceLibraryTrait.RemoveLibraryResponse
  • Submits feedback on a detected face instance.

    Declaration

    Swift

    func giveFaceFeedback(faceInstancePositiveFeedback: Google.FaceLibraryTrait.FaceInstancePositiveFeedback? = nil, faceInstanceNegativeFeedback: Google.FaceLibraryTrait.FaceInstanceNegativeFeedback? = nil) async throws -> Google.FaceLibraryTrait.GiveFaceFeedbackResponse

    Parameters

    faceInstancePositiveFeedback

    Positive feedback for a face instance.

    faceInstanceNegativeFeedback

    Negative feedback for a face instance.