Table of Contents

Interface IContactService

Namespace
Signal.Application.Abstractions
Assembly
Signal.Application.dll

Reads and updates the account's contacts (/v1/contacts/{number}).

public interface IContactService

Methods

CheckRegisteredAsync(PhoneNumber, IEnumerable<PhoneNumber>, CancellationToken)

Checks which phone numbers are registered with Signal (GET /v1/search/{number}).

Task<IReadOnlyList<NumberRegistration>> CheckRegisteredAsync(PhoneNumber account, IEnumerable<PhoneNumber> numbers, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account performing the lookup.

numbers IEnumerable<PhoneNumber>

The numbers to check. Duplicates are checked once; an empty list makes no request.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<IReadOnlyList<NumberRegistration>>

One entry per number the API reported on.

ListAsync(PhoneNumber, CancellationToken)

Lists the account's contacts.

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

Parameters

account PhoneNumber

The account.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<IReadOnlyList<Contact>>

The contacts.

SyncAsync(PhoneNumber, CancellationToken)

Sends the account's contact list to its linked devices (POST /v1/contacts/{number}/sync).

Task SyncAsync(PhoneNumber account, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the sync message was sent.

UpdateAsync(PhoneNumber, Recipient, string?, int?, CancellationToken)

Creates or updates a contact.

Task UpdateAsync(PhoneNumber account, Recipient contact, string? name, int? expirationInSeconds = null, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

contact Recipient

The contact to update.

name string

The name to store for the contact.

expirationInSeconds int?

Disappearing-messages timer for the conversation, or null to keep it.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the contact was updated.