Interface IDeviceService
- Namespace
- Signal.Application.Abstractions
- Assembly
- Signal.Application.dll
Manages the devices linked to an account that is registered in the container (/v1/devices/{number}), i.e.
the container acts as the primary device. To link the container itself to another account, use
GetLinkQrCodeAsync(string, CancellationToken) instead.
public interface IDeviceService
Methods
LinkAsync(PhoneNumber, string, CancellationToken)
Links a new device to the account (POST /v1/devices/{number}), like scanning its QR code in the Signal app.
Task LinkAsync(PhoneNumber account, string deviceLinkUri, CancellationToken cancellationToken = default)
Parameters
accountPhoneNumberThe account.
deviceLinkUristringThe URI encoded in the new device's QR code (
sgnl://linkdevice?…).cancellationTokenCancellationTokenCancels the request.
Returns
- Task
A task that completes when the device was linked.
Exceptions
- ArgumentException
deviceLinkUriis empty.
ListAsync(PhoneNumber, CancellationToken)
Lists the account's devices (GET /v1/devices/{number}).
Task<IReadOnlyList<LinkedDevice>> ListAsync(PhoneNumber account, CancellationToken cancellationToken = default)
Parameters
accountPhoneNumberThe account.
cancellationTokenCancellationTokenCancels the request.
Returns
- Task<IReadOnlyList<LinkedDevice>>
The devices, including the primary device.
RemoveAsync(PhoneNumber, long, CancellationToken)
Unlinks a device from the account (DELETE /v1/devices/{number}/{deviceId}).
Task RemoveAsync(PhoneNumber account, long deviceId, CancellationToken cancellationToken = default)
Parameters
accountPhoneNumberThe account.
deviceIdlongThe id of the device to remove, from ListAsync(PhoneNumber, CancellationToken).
cancellationTokenCancellationTokenCancels the request.
Returns
- Task
A task that completes when the device was removed.
Exceptions
- ArgumentOutOfRangeException
deviceIdis the primary device or not positive.