MutableDeviceImplementation

@available(iOS 13.0.0, *)
public struct MutableDeviceImplementation<R> : MutableDevice where R : Device

Implementation of the MutableDevice protocol for managing devices that support retrieval, deletion, and updates.

  • Initializes a new instance of MutableDeviceImplementation.

    Declaration

    Swift

    public init(endpoint: String, deviceClient: DeviceClient)

    Parameters

    endpoint

    The endpoint for retrieving and managing devices.

    deviceClient

    The DeviceClient instance used for performing network operations.

  • get() Asynchronous

    Retrieves a list of devices from the server.

    Throws

    An error if the request fails or the response cannot be decoded.

    Declaration

    Swift

    public func get() async throws -> [R]

    Return Value

    An array of devices of type R.

  • delete(_:) Asynchronous

    Deletes the specified device from the server.

    Throws

    An error if the request fails or the server response indicates failure.

    Declaration

    Swift

    public func delete(_ device: R) async throws

    Parameters

    device

    The device to delete.

  • update(_:) Asynchronous

    Updates the specified device on the server.

    Throws

    An error if the request fails or the server response indicates failure.

    Declaration

    Swift

    public func update(_ device: R) async throws

    Parameters

    device

    The device to update.