GroupManagementTrait

struct GroupManagementTrait

API for the GroupManagement trait, which is used to create, delete, and modify groups.

  • 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
  • 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.GroupManagementTrait, rhs: Google.GroupManagementTrait) -> 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)
  • Create a group with the option to specify members by device id.

    Declaration

    Swift

    func createGroup(name: String? = nil, memberDeviceObjectIdsArray: [String], policyId: String? = nil) async throws -> Google.GroupManagementTrait.CreateGroupResponse

    Parameters

    name

    The user-given name for the group

    memberDeviceObjectIdsArray

    The IDs of devices to add at time of creation.

    policyId

  • Create a user-defined group with the option to specify members by device id.

    Declaration

    Swift

    func createUserDefinedGroup(name: String? = nil, memberDeviceObjectIdsArray: [String]) async throws -> Google.GroupManagementTrait.CreateUserDefinedGroupResponse

    Parameters

    name

    The user-given name for the group

    memberDeviceObjectIdsArray

    The IDs of devices to add at time of creation.

  • Create a speaker group (CastSpeakerGroup) with the option to specify members by device id.

    Declaration

    Swift

    func createCastSpeakerGroup(name: String? = nil, memberDeviceObjectIdsArray: [String]) async throws -> Google.GroupManagementTrait.CreateCastSpeakerGroupResponse

    Parameters

    name

    The user-given name for the group

    memberDeviceObjectIdsArray

    The IDs of devices to add at time of creation.

  • Delete a device group.

    Declaration

    Swift

    func deleteGroup(groupObjectId: String? = nil) async throws -> Google.GroupManagementTrait.DeleteGroupResponse

    Parameters

    groupObjectId

    The ID of the group to delete.

  • Add members to a device group.

    Declaration

    Swift

    func addGroupMembers(groupObjectId: String? = nil, memberDeviceObjectIdsArray: [String]) async throws -> Google.GroupManagementTrait.AddGroupMembersResponse

    Parameters

    groupObjectId

    The ID of the group to add members to.

    memberDeviceObjectIdsArray

    The IDs of devices to add to the group.

  • Command to remove members from a device group.

    Declaration

    Swift

    func removeGroupMembers(groupObjectId: String? = nil, memberDeviceObjectIdsArray: [String]) async throws -> Google.GroupManagementTrait.RemoveGroupMembersResponse

    Parameters

    groupObjectId

    The ID of the group to remove members from.

    memberDeviceObjectIdsArray

    The IDs of devices to remove from the group.

  • Command to remove all members from a device group.

    Declaration

    Swift

    func removeAllGroupMembers(groupObjectId: String? = nil) async throws -> Google.GroupManagementTrait.RemoveAllGroupMembersResponse

    Parameters

    groupObjectId

    The ID of the group to remove all members from.