Table of Contents

Interface IGroupService

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

Manages groups (/v1/groups/{number}).

public interface IGroupService

Methods

AddAdminsAsync(PhoneNumber, GroupId, IEnumerable<string>, CancellationToken)

Promotes members to admins.

Task AddAdminsAsync(PhoneNumber account, GroupId group, IEnumerable<string> admins, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account (must be a group admin).

group GroupId

The group id.

admins IEnumerable<string>

Members to promote.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the members were promoted.

AddMembersAsync(PhoneNumber, GroupId, IEnumerable<string>, CancellationToken)

Adds members.

Task AddMembersAsync(PhoneNumber account, GroupId group, IEnumerable<string> members, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account (must be allowed to add members).

group GroupId

The group id.

members IEnumerable<string>

Members to add (phone numbers or UUIDs).

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the members were added.

BlockAsync(PhoneNumber, GroupId, CancellationToken)

Blocks a group, so its messages are no longer received (POST /v1/groups/{number}/{groupid}/block).

Task BlockAsync(PhoneNumber account, GroupId group, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

group GroupId

The group id.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the group was blocked.

CreateAsync(PhoneNumber, string, IEnumerable<string>, string?, CancellationToken)

Creates a group.

Task<GroupId> CreateAsync(PhoneNumber account, string name, IEnumerable<string> members, string? description = null, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The creating account (becomes admin).

name string

The group name.

members IEnumerable<string>

Initial members (phone numbers or UUIDs).

description string

Optional description.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<GroupId>

The id of the new group.

DeleteAsync(PhoneNumber, GroupId, CancellationToken)

Deletes the group from the account's local storage.

Task DeleteAsync(PhoneNumber account, GroupId group, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

group GroupId

The group id.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the group was deleted.

GetAsync(PhoneNumber, GroupId, CancellationToken)

Gets one group.

Task<Group?> GetAsync(PhoneNumber account, GroupId group, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

group GroupId

The group id.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<Group>

The group, or null if it is unknown to the account.

JoinAsync(PhoneNumber, GroupId, CancellationToken)

Accepts an invitation to a group (POST /v1/groups/{number}/{groupid}/join).

Task JoinAsync(PhoneNumber account, GroupId group, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The invited account.

group GroupId

The group id.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the account joined.

ListAsync(PhoneNumber, CancellationToken)

Lists all groups the account is a member of.

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

Parameters

account PhoneNumber

The account.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<IReadOnlyList<Group>>

The groups.

PinMessageAsync(PhoneNumber, GroupId, string, long, TimeSpan?, CancellationToken)

Pins a message in a group (POST /v1/groups/{number}/{groupid}/pin-message).

Task PinMessageAsync(PhoneNumber account, GroupId group, string targetAuthor, long targetTimestamp, TimeSpan? duration = null, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

group GroupId

The group id.

targetAuthor string

Phone number or UUID of the pinned message's author.

targetTimestamp long

Timestamp of the pinned message.

duration TimeSpan?

How long the message stays pinned (whole seconds), or null for the API default.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the message was pinned.

Exceptions

ArgumentException

targetAuthor is empty.

ArgumentOutOfRangeException

duration is shorter than one second.

QuitAsync(PhoneNumber, GroupId, CancellationToken)

Leaves the group.

Task QuitAsync(PhoneNumber account, GroupId group, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The leaving account.

group GroupId

The group id.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the account left.

RemoveAdminsAsync(PhoneNumber, GroupId, IEnumerable<string>, CancellationToken)

Demotes admins to regular members.

Task RemoveAdminsAsync(PhoneNumber account, GroupId group, IEnumerable<string> admins, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account (must be a group admin).

group GroupId

The group id.

admins IEnumerable<string>

Admins to demote.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the admins were demoted.

RemoveMembersAsync(PhoneNumber, GroupId, IEnumerable<string>, CancellationToken)

Removes members.

Task RemoveMembersAsync(PhoneNumber account, GroupId group, IEnumerable<string> members, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account (must be a group admin).

group GroupId

The group id.

members IEnumerable<string>

Members to remove (phone numbers or UUIDs).

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the members were removed.

UnpinMessageAsync(PhoneNumber, GroupId, string, long, CancellationToken)

Unpins a message in a group (DELETE /v1/groups/{number}/{groupid}/pin-message).

Task UnpinMessageAsync(PhoneNumber account, GroupId group, string targetAuthor, long targetTimestamp, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account.

group GroupId

The group id.

targetAuthor string

Phone number or UUID of the pinned message's author.

targetTimestamp long

Timestamp of the pinned message.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the message was unpinned.

Exceptions

ArgumentException

targetAuthor is empty.

UpdateAsync(PhoneNumber, GroupId, string?, string?, string?, CancellationToken)

Updates name, description and/or avatar. null values are left unchanged.

Task UpdateAsync(PhoneNumber account, GroupId group, string? name = null, string? description = null, string? base64Avatar = null, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account (must be allowed to edit the group).

group GroupId

The group id.

name string

New name, or null.

description string

New description, or null.

base64Avatar string

New avatar image as base64, or null.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the group was updated.

UpdateSettingsAsync(PhoneNumber, GroupId, GroupSettings, CancellationToken)

Changes permissions, the invite link mode and/or the disappearing-messages timer (PUT /v1/groups/{number}/{groupid}). null values are left unchanged.

Task UpdateSettingsAsync(PhoneNumber account, GroupId group, GroupSettings settings, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account (usually must be a group admin).

group GroupId

The group id.

settings GroupSettings

The settings to change.

cancellationToken CancellationToken

Cancels the request.

Returns

Task

A task that completes when the group was updated.