Class NodeGroups
- Namespace
- Nyra
- Assembly
- Nyra.dll
The player groups of a node, NodeLink only.
public sealed class NodeGroups
- Inheritance
-
NodeGroups
- Inherited Members
Methods
AddPlayersAsync(string, IEnumerable<ulong>, CancellationToken)
Adds guilds to a group.
public Task<GroupUpdateResult> AddPlayersAsync(string groupId, IEnumerable<ulong> guildIds, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
guildIdsIEnumerable<ulong>The guilds to add.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<GroupUpdateResult>
The update result, check its errors list.
Remarks
The addition only changes the membership, it does not touch the players.
Exceptions
- ArgumentNullException
groupIdis null or blank, orguildIdsis null.- ArgumentException
groupIdcarries characters the group routes cannot address.- RestException
The group does not exist, the server answers 404.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
CreateAsync(string, IEnumerable<ulong>?, CancellationToken)
Creates a player group.
public Task<Group> CreateAsync(string groupId, IEnumerable<ulong>? guildIds = null, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id, only letters, digits, underscores and dashes are addressable.
guildIdsIEnumerable<ulong>The initial members, optional.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
Remarks
Creating a group records its membership only, it neither creates nor connects any player, the members' players are created by a group update. NodeLink only.
Exceptions
- ArgumentNullException
groupIdis null or blank.- ArgumentException
groupIdcarries characters the group routes cannot address.- RestException
A group with the id already exists, the server answers 409.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
DeleteAsync(string, CancellationToken)
Deletes a player group.
public Task DeleteAsync(string groupId, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes when the group was deleted.
Remarks
The members' players keep playing, a delete only drops the membership record. NodeLink only.
Exceptions
- ArgumentNullException
groupIdis null or blank.- ArgumentException
groupIdcarries characters the group routes cannot address.- RestException
The group does not exist, the server answers 404.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
GetAsync(string, CancellationToken)
Reads one player group.
public Task<Group?> GetAsync(string groupId, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
Remarks
NodeLink only.
Exceptions
- ArgumentNullException
groupIdis null or blank.- ArgumentException
groupIdcarries characters the group routes cannot address.- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
ListAsync(CancellationToken)
Lists the player groups of the node's session.
public Task<IReadOnlyList<Group>> ListAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<IReadOnlyList<Group>>
The groups, empty when the session has none.
Remarks
NodeLink only.
Exceptions
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
PauseAsync(string, CancellationToken)
Pauses every group member.
public Task<GroupUpdateResult> PauseAsync(string groupId, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<GroupUpdateResult>
The update result, check its errors list.
Remarks
NodeLink only.
Exceptions
- ArgumentNullException
groupIdis null or blank.- ArgumentException
groupIdcarries characters the group routes cannot address.- RestException
The group does not exist, the server answers 404.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
PlayTrackAsync(string, Track, TimeSpan?, TimeSpan?, CancellationToken)
Makes every group member play a track.
public Task<GroupUpdateResult> PlayTrackAsync(string groupId, Track track, TimeSpan? position = null, TimeSpan? endTime = null, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
trackTrackThe track every member plays.
positionTimeSpan?Where the track starts, null plays from the beginning.
endTimeTimeSpan?Where the track stops, null plays to the end.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<GroupUpdateResult>
The update result, check its errors list.
Remarks
A group play always replaces the members' current tracks, there is no no-replace for groups. NodeLink only.
Exceptions
- ArgumentNullException
groupIdis null or blank, ortrackis null.- ArgumentException
groupIdcarries characters the group routes cannot address, ortrackcarries a null or blank encoded, the wire stop form.- ArgumentOutOfRangeException
positionis negative, orendTimeis not greater than zero.- RestException
The group does not exist, the server answers 404.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
RemovePlayersAsync(string, IEnumerable<ulong>, CancellationToken)
Removes guilds from a group.
public Task<GroupUpdateResult> RemovePlayersAsync(string groupId, IEnumerable<ulong> guildIds, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
guildIdsIEnumerable<ulong>The guilds to remove.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<GroupUpdateResult>
The update result, check its errors list.
Remarks
The removal only drops the membership, the players keep playing.
Exceptions
- ArgumentNullException
groupIdis null or blank, orguildIdsis null.- ArgumentException
groupIdcarries characters the group routes cannot address.- RestException
The group does not exist, the server answers 404.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
ResumeAsync(string, CancellationToken)
Resumes every group member.
public Task<GroupUpdateResult> ResumeAsync(string groupId, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<GroupUpdateResult>
The update result, check its errors list.
Remarks
NodeLink only.
Exceptions
- ArgumentNullException
groupIdis null or blank.- ArgumentException
groupIdcarries characters the group routes cannot address.- RestException
The group does not exist, the server answers 404.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
SetVolumeAsync(string, int, CancellationToken)
Sets the volume of every group member.
public Task<GroupUpdateResult> SetVolumeAsync(string groupId, int volume, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
volumeintThe volume, 0-1000, 100 is the neutral value.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<GroupUpdateResult>
The update result, check its errors list.
Remarks
NodeLink only.
Exceptions
- ArgumentNullException
groupIdis null or blank.- ArgumentException
groupIdcarries characters the group routes cannot address.- ArgumentOutOfRangeException
volumeis outside 0-1000.- RestException
The group does not exist, the server answers 404.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
StopAsync(string, CancellationToken)
Stops every group member's track.
public Task<GroupUpdateResult> StopAsync(string groupId, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<GroupUpdateResult>
The update result, check its errors list.
Remarks
NodeLink only.
Exceptions
- ArgumentNullException
groupIdis null or blank.- ArgumentException
groupIdcarries characters the group routes cannot address.- RestException
The group does not exist, the server answers 404.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.
UpdateAsync(string, GroupUpdate, CancellationToken)
Applies an update to a group, membership changes first, then the track and player state on every member, 35 ms per guild.
public Task<GroupUpdateResult> UpdateAsync(string groupId, GroupUpdate update, CancellationToken cancellationToken = default)
Parameters
groupIdstringThe group id.
updateGroupUpdateWhat the update changes, only the set members are applied.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<GroupUpdateResult>
The membership, the reached players and the per-guild failures.
Remarks
The server answers 200 even when individual guilds fail, always check the result's errors list. NodeLink only.
Exceptions
- ArgumentNullException
groupIdorupdateis null.- ArgumentException
The group track names both an encoded track and an identifier, or its user data is not a JSON object.
- ArgumentOutOfRangeException
The position or end time is negative, or the volume is outside 0-1000.
- RestException
The group does not exist, the server answers 404.
- NotSupportedException
The node is not NodeLink.
- IncompatibleServerException
The server's /v4/info version is not supported.