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
accountPhoneNumberThe account (must be a group admin).
groupGroupIdThe group id.
adminsIEnumerable<string>Members to promote.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account (must be allowed to add members).
groupGroupIdThe group id.
membersIEnumerable<string>Members to add (phone numbers or UUIDs).
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
groupGroupIdThe group id.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe creating account (becomes admin).
namestringThe group name.
membersIEnumerable<string>Initial members (phone numbers or UUIDs).
descriptionstringOptional description.
cancellationTokenCancellationTokenCancels the request.
Returns
DeleteAsync(PhoneNumber, GroupId, CancellationToken)
Deletes the group from the account's local storage.
Task DeleteAsync(PhoneNumber account, GroupId group, CancellationToken cancellationToken = default)
Parameters
accountPhoneNumberThe account.
groupGroupIdThe group id.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
groupGroupIdThe group id.
cancellationTokenCancellationTokenCancels the request.
Returns
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
accountPhoneNumberThe invited account.
groupGroupIdThe group id.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
groupGroupIdThe group id.
targetAuthorstringPhone number or UUID of the pinned message's author.
targetTimestamplongTimestamp of the pinned message.
durationTimeSpan?How long the message stays pinned (whole seconds), or null for the API default.
cancellationTokenCancellationTokenCancels the request.
Returns
- Task
A task that completes when the message was pinned.
Exceptions
- ArgumentException
targetAuthoris empty.- ArgumentOutOfRangeException
durationis shorter than one second.
QuitAsync(PhoneNumber, GroupId, CancellationToken)
Leaves the group.
Task QuitAsync(PhoneNumber account, GroupId group, CancellationToken cancellationToken = default)
Parameters
accountPhoneNumberThe leaving account.
groupGroupIdThe group id.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account (must be a group admin).
groupGroupIdThe group id.
adminsIEnumerable<string>Admins to demote.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account (must be a group admin).
groupGroupIdThe group id.
membersIEnumerable<string>Members to remove (phone numbers or UUIDs).
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account.
groupGroupIdThe group id.
targetAuthorstringPhone number or UUID of the pinned message's author.
targetTimestamplongTimestamp of the pinned message.
cancellationTokenCancellationTokenCancels the request.
Returns
- Task
A task that completes when the message was unpinned.
Exceptions
- ArgumentException
targetAuthoris 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
accountPhoneNumberThe account (must be allowed to edit the group).
groupGroupIdThe group id.
namestringNew name, or null.
descriptionstringNew description, or null.
base64AvatarstringNew avatar image as base64, or null.
cancellationTokenCancellationTokenCancels 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
accountPhoneNumberThe account (usually must be a group admin).
groupGroupIdThe group id.
settingsGroupSettingsThe settings to change.
cancellationTokenCancellationTokenCancels the request.
Returns
- Task
A task that completes when the group was updated.