struct FaceLibraryTraitTrait 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
MatterTraittraits 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.parseErrorwhen parsing fails.Declaration
Swift
init(decoder: TraitDecoder, interactionProxy: (any InteractionProxy)?, metadata: TraitMetadata) throwsParameters
decoderThe raw data representing this Trait.
interactionProxyProxy to the Interaction Client.
metadataMetadata about this Trait.
-
Writes this object to the given
TraitEncoder. ThrowsHomeError.encodingFailedif 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
aandb,a == bimplies thata != bisfalse.Declaration
Parameters
lhsA value to compare.
rhsAnother value to compare.
-
Hashes the essential components of this value by feeding them into the given hasher.
Implement this method to conform to the
Hashableprotocol. The components used for hashing must be the same as the components compared in your type’s==operator implementation. Callhasher.combine(_:)with each of these components.Important
In your implementation of
hash(into:), don’t callfinalize()on thehasherinstance 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.GetFacesResponseParameters
faceIdsThe IDs of the faces to return.
faceCategoriesThe 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.GetFacesByInstancesResponseParameters
faceInstanceIdsArrayThe 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.UpdateFaceResponseParameters
idThe ID of the face to update.
nameThe updated name of the face. If omitted, the name is not updated.
categoryThe 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.MergeFacesResponseParameters
mergedFaceIdThe ID of the target face to merge into. If omitted, a new face is created.
faceIdsToMergeArrayThe IDs of the faces to be merged.
nameThe 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.RemoveFacesResponseParameters
faceIdsArrayThe 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.GetFaceInstancesResponseParameters
faceIdThe 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.MoveFaceInstancesResponseParameters
faceIdThe ID of the destination face to move the face instances to.
faceInstanceIdsArrayThe IDs of the face instances to move.
nameThe name of the face.
-
Removes face instances from the face library.
Declaration
Swift
func removeFaceInstances(faceInstanceIdsArray: [String]) async throws -> Google.FaceLibraryTrait.RemoveFaceInstancesResponseParameters
faceInstanceIdsArrayThe 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.GiveFaceFeedbackResponseParameters
faceInstancePositiveFeedbackPositive feedback for a face instance.
faceInstanceNegativeFeedbackNegative feedback for a face instance.