User Device Management (UDM)

The User Device Management (UDM) module provides functionality to manage and track user devices, including registration, monitoring, and removal of devices.

Table of Contents

  1. registerDevice

  2. getLinkDevices

  3. getLinkDevice

  4. updateLastOnline

  5. updateDeviceName

  6. removeDevice

  7. getLinkDevicesHistory

Methods

registerDevice

Registers a new device with the system.

Returns: A LinkDevice object containing the registered device information.

Throws: An error if registration fails or device identifier cannot be retrieved.

Example:

func main() async {
    do {
        let udmRepository = UDMRepositoryImpl(api: UDMNetworkImpl(client: NetworkClient()))
        let device = try await udmRepository.registerDevice()
        print("Registered device: \(device)")
    } catch {
        print("Error registering device: \(error)")
    }
}

getLinkDevices

Retrieves a list of all linked devices for the current user.

Returns: An array of LinkDevice objects.

Throws: An error if the fetch fails.

Example:

getLinkDevice

Retrieves details of a specific linked device.

Parameters:

  • uniqueId: The unique identifier of the device

Returns: A LinkDevice object containing the device details.

Throws: An error if the fetch fails.

Example:

updateLastOnline

Updates the last online timestamp for a specific device.

Parameters:

  • uniqueId: The unique identifier of the device

Throws: An error if the update fails.

Example:

updateDeviceName

Updates the display name of a specific device.

Parameters:

  • uniqueId: The unique identifier of the device

  • name: The new name for the device

Throws: An error if the update fails.

Example:

removeDevice

Removes a device from the linked devices list.

Parameters:

  • uniqueId: The unique identifier of the device

Throws: An error if the removal fails.

Example:

getLinkDevicesHistory

Retrieves the history of device linking and unlinking events.

Returns: An array of LinkDevicesHistory objects.

Throws: An error if the fetch fails.

Example:

Complete Example

Here's a complete example of how to use the UDM features:

Last updated