Table of Contents

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

groupId string

The group id.

guildIds IEnumerable<ulong>

The guilds to add.

cancellationToken CancellationToken

A 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

groupId is null or blank, or guildIds is null.

ArgumentException

groupId carries 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

groupId string

The group id, only letters, digits, underscores and dashes are addressable.

guildIds IEnumerable<ulong>

The initial members, optional.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<Group>

The created group.

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

groupId is null or blank.

ArgumentException

groupId carries 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

groupId string

The group id.

cancellationToken CancellationToken

A 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

groupId is null or blank.

ArgumentException

groupId carries 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

groupId string

The group id.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<Group>

The group, null when it does not exist.

Remarks

NodeLink only.

Exceptions

ArgumentNullException

groupId is null or blank.

ArgumentException

groupId carries 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

cancellationToken CancellationToken

A 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

groupId string

The group id.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<GroupUpdateResult>

The update result, check its errors list.

Remarks

NodeLink only.

Exceptions

ArgumentNullException

groupId is null or blank.

ArgumentException

groupId carries 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

groupId string

The group id.

track Track

The track every member plays.

position TimeSpan?

Where the track starts, null plays from the beginning.

endTime TimeSpan?

Where the track stops, null plays to the end.

cancellationToken CancellationToken

A 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

groupId is null or blank, or track is null.

ArgumentException

groupId carries characters the group routes cannot address, or track carries a null or blank encoded, the wire stop form.

ArgumentOutOfRangeException

position is negative, or endTime is 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

groupId string

The group id.

guildIds IEnumerable<ulong>

The guilds to remove.

cancellationToken CancellationToken

A 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

groupId is null or blank, or guildIds is null.

ArgumentException

groupId carries 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

groupId string

The group id.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<GroupUpdateResult>

The update result, check its errors list.

Remarks

NodeLink only.

Exceptions

ArgumentNullException

groupId is null or blank.

ArgumentException

groupId carries 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

groupId string

The group id.

volume int

The volume, 0-1000, 100 is the neutral value.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<GroupUpdateResult>

The update result, check its errors list.

Remarks

NodeLink only.

Exceptions

ArgumentNullException

groupId is null or blank.

ArgumentException

groupId carries characters the group routes cannot address.

ArgumentOutOfRangeException

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.

StopAsync(string, CancellationToken)

Stops every group member's track.

public Task<GroupUpdateResult> StopAsync(string groupId, CancellationToken cancellationToken = default)

Parameters

groupId string

The group id.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<GroupUpdateResult>

The update result, check its errors list.

Remarks

NodeLink only.

Exceptions

ArgumentNullException

groupId is null or blank.

ArgumentException

groupId carries 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

groupId string

The group id.

update GroupUpdate

What the update changes, only the set members are applied.

cancellationToken CancellationToken

A 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

groupId or update is 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.