Skip to content

Commit

Permalink
Merge pull request #295 from CosX/master
Browse files Browse the repository at this point in the history
Add conversations.members #294
  • Loading branch information
Inumedia authored Aug 29, 2022
2 parents bb5dba8 + 7b4f650 commit bf04a45
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions SlackAPI/RPCMessages/ConversationsMembersResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace SlackAPI.RPCMessages
{
[RequestPath("conversations.members")]
public class ConversationsMembersResponse : Response
{
public string[] members;
}
}
14 changes: 14 additions & 0 deletions SlackAPI/SlackClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,20 @@ public void GetConversationsList(Action<ConversationsListResponse> callback, str

APIRequestWithToken(callback, parameters.ToArray());
}

public void GetConversationsMembers(Action<ConversationsMembersResponse> callback, string channelId, string cursor = "", int limit = 100)
{
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
{
new Tuple<string, string>("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<ChannelListResponse> callback, bool ExcludeArchived = true)
{
Expand Down
14 changes: 14 additions & 0 deletions SlackAPI/SlackTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,20 @@ public Task<ConversationsListResponse> GetConversationsListAsync(string cursor =

return APIRequestWithTokenAsync<ConversationsListResponse>(parameters.ToArray());
}

public Task<ConversationsMembersResponse> GetConversationsMembersAsync(string channelId, string cursor = "", int limit = 100)
{
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
{
new Tuple<string, string>("channel", channelId)
};
if (limit > 0)
parameters.Add(Tuple.Create("limit", limit.ToString()));
if (!string.IsNullOrEmpty(cursor))
parameters.Add(new Tuple<string, string>("cursor", cursor));

return APIRequestWithTokenAsync<ConversationsMembersResponse>(parameters.ToArray());
}

public Task<ChannelListResponse> GetChannelListAsync(bool ExcludeArchived = true)
{
Expand Down

0 comments on commit bf04a45

Please sign in to comment.