From 5aac5533e7c3aa860df6027e803a4d1f06b537d0 Mon Sep 17 00:00:00 2001 From: ceeno2k <50101055+ceeno2k@users.noreply.github.com> Date: Fri, 1 May 2020 03:46:56 +0200 Subject: [PATCH] Added "AddServerGroup" to TeamSpeakClient. (#49) --- .../Specialized/TeamSpeakClient.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/TeamSpeak3QueryApi/Specialized/TeamSpeakClient.cs b/src/TeamSpeak3QueryApi/Specialized/TeamSpeakClient.cs index 89e6499..9af8c16 100644 --- a/src/TeamSpeak3QueryApi/Specialized/TeamSpeakClient.cs +++ b/src/TeamSpeak3QueryApi/Specialized/TeamSpeakClient.cs @@ -259,6 +259,39 @@ public async Task> GetServerGroups(int clientDatab #endregion + #region AddServerGroup + + #region One User + + public Task AddServerGroup(int serverGroupId, int clientDatabaseId) => AddServerGroup(serverGroupId, new int[] { clientDatabaseId }); + + public Task AddServerGroup(int serverGroupId, GetClientInfo clientInfo) => AddServerGroup(serverGroupId, clientInfo.DatabaseId); + + public Task AddServerGroup(GetServerGroup serverGroup, int clientDatabaseId) => AddServerGroup(serverGroup.Id, clientDatabaseId); + + public Task AddServerGroup(GetServerGroup serverGroup, GetClientInfo clientInfo) => AddServerGroup(serverGroup.Id, clientInfo.DatabaseId); + + #endregion + + #region Multiple Users + + public Task AddServerGroup(int serverGroupId, IEnumerable clientInfo) => AddServerGroup(serverGroupId, clientInfo.Select(info => info.DatabaseId)); + + public Task AddServerGroup(GetServerGroup serverGroup, IEnumerable clientDatabaseIds) => AddServerGroup(serverGroup.Id, clientDatabaseIds); + + public Task AddServerGroup(GetServerGroup serverGroup, IEnumerable clientInfo) => AddServerGroup(serverGroup.Id, clientInfo.Select(info => info.DatabaseId)); + + public Task AddServerGroup(int serverGroupId, IEnumerable clientDatabaseIds) + { + return Client.Send("servergroupaddclient", + new Parameter("sgid", serverGroupId), + new Parameter("cldbid", clientDatabaseIds.Select(id => new ParameterValue(id)).ToArray())); + } + + #endregion + + #endregion + #endregion #region Channel Methods