Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add conversations.members #294 #295

Merged
merged 2 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -138,6 +138,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