Table of Contents

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

account PhoneNumber

The account.

deviceLinkUri string

The URI encoded in the new device's QR code (sgnl://linkdevice?…).

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the device was linked.

Exceptions

ArgumentException

deviceLinkUri is empty.

ListAsync(PhoneNumber, CancellationToken)

Lists the account's devices (GET /v1/devices/{number}).

Task<IReadOnlyList<LinkedDevice>> ListAsync(PhoneNumber account, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

cancellationToken CancellationToken

Cancels 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

account PhoneNumber

The account.

deviceId long

The id of the device to remove, from ListAsync(PhoneNumber, CancellationToken).

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the device was removed.

Exceptions

ArgumentOutOfRangeException

deviceId is the primary device or not positive.