ImmutableDeviceImplementation

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

Implementation of the ImmutableDevice protocol for managing devices that only support retrieval and deletion.

  • Initializes a new instance of ImmutableDeviceImplementation.

    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.