From a393023dd6af10bc3c401e3822705bdd4f8ed259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Solg=C3=A5rd?= Date: Mon, 24 Jan 2022 22:41:05 +0100 Subject: [PATCH] Add conversations.members #294 --- .../RPCMessages/ConversationsMembersResponse.cs | 8 ++++++++ SlackAPI/SlackClient.cs | 14 ++++++++++++++ SlackAPI/SlackTaskClient.cs | 14 ++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 SlackAPI/RPCMessages/ConversationsMembersResponse.cs diff --git a/SlackAPI/RPCMessages/ConversationsMembersResponse.cs b/SlackAPI/RPCMessages/ConversationsMembersResponse.cs new file mode 100644 index 0000000..80fdfdb --- /dev/null +++ b/SlackAPI/RPCMessages/ConversationsMembersResponse.cs @@ -0,0 +1,8 @@ +namespace SlackAPI.RPCMessages +{ + [RequestPath("conversations.members")] + public class ConversationsMembersResponse : Response + { + public string[] channels; + } +} \ No newline at end of file diff --git a/SlackAPI/SlackClient.cs b/SlackAPI/SlackClient.cs index 775db7a..b07fa16 100644 --- a/SlackAPI/SlackClient.cs +++ b/SlackAPI/SlackClient.cs @@ -155,6 +155,20 @@ public void GetConversationsList(Action callback, str APIRequestWithToken(callback, parameters.ToArray()); } + + public void GetConversationsMembers(Action callback, string channelId, string cursor = "", int limit = 100) + { + List> parameters = new List> + { + new Tuple("channel", channelId) + }; + if (limit > 0) + parameters.Add(Tuple.Create("limit", limit.ToString())); + if (!string.IsNullOrEmpty(cursor)) + parameters.Add(Tuple.Create("cursor", cursor)); + + APIRequestWithToken(callback, parameters.ToArray()); + } public void GetChannelList(Action callback, bool ExcludeArchived = true) { diff --git a/SlackAPI/SlackTaskClient.cs b/SlackAPI/SlackTaskClient.cs index 72b83fb..568dab1 100644 --- a/SlackAPI/SlackTaskClient.cs +++ b/SlackAPI/SlackTaskClient.cs @@ -138,6 +138,20 @@ public Task GetConversationsListAsync(string cursor = return APIRequestWithTokenAsync(parameters.ToArray()); } + + public Task GetConversationsMembersAsync(string channelId, string cursor = "", int limit = 100) + { + List> parameters = new List> + { + new Tuple("channel", channelId) + }; + if (limit > 0) + parameters.Add(Tuple.Create("limit", limit.ToString())); + if (!string.IsNullOrEmpty(cursor)) + parameters.Add(new Tuple("cursor", cursor)); + + return APIRequestWithTokenAsync(parameters.ToArray()); + } public Task GetChannelListAsync(bool ExcludeArchived = true) {