Skip to content

Alternative to pr/251. That method uses an enum with a function to tr… #258

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion SlackAPI/Conversation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ namespace SlackAPI
{
public class Conversation
{
public enum Type
{
public_channel,
private_channel,
mpim,
im
}

public string id;
public DateTime created;
public DateTime last_read;
Expand All @@ -16,4 +24,4 @@ public class Conversation
public int unread_count;
public Message latest;
}
}
}
4 changes: 2 additions & 2 deletions SlackAPI/SlackClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ public void ChannelsInvite(Action<ChannelInviteResponse> callback, string userId
APIRequestWithToken(callback, parameters.ToArray());
}

public void GetConversationsList(Action<ConversationsListResponse> callback, string cursor = "", bool ExcludeArchived = true, int limit = 100, string[] types = null)
public void GetConversationsList(Action<ConversationsListResponse> callback, string cursor = "", bool ExcludeArchived = true, int limit = 100, Conversation.Type[] types = null)
{
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>()
{
Tuple.Create("exclude_archived", ExcludeArchived ? "1" : "0")
};
if (limit > 0)
parameters.Add(Tuple.Create("limit", limit.ToString()));
if (types.Any())
if (types != null && types.Any())
parameters.Add(Tuple.Create("types", string.Join(",", types)));
if (!string.IsNullOrEmpty(cursor))
parameters.Add(Tuple.Create("cursor", cursor));
Expand Down
2 changes: 1 addition & 1 deletion SlackAPI/SlackTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public Task<ChannelInviteResponse> ChannelsInviteAsync(string userId, string cha
return APIRequestWithTokenAsync<ChannelInviteResponse>(parameters.ToArray());
}

public Task<ConversationsListResponse> GetConversationsListAsync(string cursor = "", bool ExcludeArchived = true, int limit = 100, string[] types = null)
public Task<ConversationsListResponse> GetConversationsListAsync(string cursor = "", bool ExcludeArchived = true, int limit = 100, Conversation.Type[] types = null)
{
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>()
{
Expand Down