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 toDevice
-
Initializes a new mutable device implementation
Declaration
Swift
public init(endpoint: String, deviceClient: DeviceClient)Parameters
endpointThe API endpoint for this device type
deviceClientThe DeviceClient instance to use for operations
-
get()AsynchronousRetrieves 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
deviceThe 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
deviceThe device with updated properties
Return Value
A Result containing either success (true) or an error
View on GitHub