DeviceRepositoryImplementation

public struct DeviceRepositoryImplementation<R> : DeviceRepository, @unchecked Sendable where R : Device

Implementation of the DeviceRepository protocol for full CRUD devices

Provides GET, UPDATE, and DELETE operations for devices that support modification. Used by Oath, Push, Bound, Profile, and WebAuthn device types.

Note

This implementation is generic and can work with any device type conforming to Device
  • Initializes a new mutable device implementation

    Declaration

    Swift

    public init(endpoint: String, deviceClient: DeviceClient)

    Parameters

    endpoint

    The API endpoint for this device type

    deviceClient

    The DeviceClient instance to use for operations

  • get() Asynchronous

    Retrieves all devices of this type for the user

    Declaration

    Swift

    public func get() async -> Result<[R], DeviceError>

    Return Value

    A Result containing either the array of devices or an error

  • delete(_:) Asynchronous

    Deletes the specified device from the server

    Declaration

    Swift

    public func delete(_ device: R) async -> Result<R, DeviceError>

    Parameters

    device

    The device to delete

    Return Value

    A Result containing either success (true) or an error

  • update(_:) Asynchronous

    Updates the specified device on the server

    Declaration

    Swift

    public func update(_ device: R) async -> Result<R, DeviceError>

    Parameters

    device

    The device with updated properties

    Return Value

    A Result containing either success (true) or an error