Skip to content

Commit a393023

Browse files
committed
Add conversations.members #294
1 parent f0084d1 commit a393023

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace SlackAPI.RPCMessages
2+
{
3+
[RequestPath("conversations.members")]
4+
public class ConversationsMembersResponse : Response
5+
{
6+
public string[] channels;
7+
}
8+
}

SlackAPI/SlackClient.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,20 @@ public void GetConversationsList(Action<ConversationsListResponse> callback, str
155155

156156
APIRequestWithToken(callback, parameters.ToArray());
157157
}
158+
159+
public void GetConversationsMembers(Action<ConversationsMembersResponse> callback, string channelId, string cursor = "", int limit = 100)
160+
{
161+
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
162+
{
163+
new Tuple<string, string>("channel", channelId)
164+
};
165+
if (limit > 0)
166+
parameters.Add(Tuple.Create("limit", limit.ToString()));
167+
if (!string.IsNullOrEmpty(cursor))
168+
parameters.Add(Tuple.Create("cursor", cursor));
169+
170+
APIRequestWithToken(callback, parameters.ToArray());
171+
}
158172

159173
public void GetChannelList(Action<ChannelListResponse> callback, bool ExcludeArchived = true)
160174
{

SlackAPI/SlackTaskClient.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,20 @@ public Task<ConversationsListResponse> GetConversationsListAsync(string cursor =
138138

139139
return APIRequestWithTokenAsync<ConversationsListResponse>(parameters.ToArray());
140140
}
141+
142+
public Task<ConversationsMembersResponse> GetConversationsMembersAsync(string channelId, string cursor = "", int limit = 100)
143+
{
144+
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>
145+
{
146+
new Tuple<string, string>("channel", channelId)
147+
};
148+
if (limit > 0)
149+
parameters.Add(Tuple.Create("limit", limit.ToString()));
150+
if (!string.IsNullOrEmpty(cursor))
151+
parameters.Add(new Tuple<string, string>("cursor", cursor));
152+
153+
return APIRequestWithTokenAsync<ConversationsMembersResponse>(parameters.ToArray());
154+
}
141155

142156
public Task<ChannelListResponse> GetChannelListAsync(bool ExcludeArchived = true)
143157
{

0 commit comments

Comments
 (0)