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
accountPhoneNumberThe account performing the lookup.
numbersIEnumerable<PhoneNumber>The numbers to check. Duplicates are checked once; an empty list makes no request.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
contactRecipientThe contact to update.
namestringThe name to store for the contact.
expirationInSecondsint?Disappearing-messages timer for the conversation, or null to keep it.
cancellationTokenCancellationTokenCancels the request.
Returns
- Task
A task that completes when the contact was updated.