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 reactions.remove support. #309

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
14 changes: 14 additions & 0 deletions SlackAPI/ReactionRemovedResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SlackAPI
{
[RequestPath("reactions.remove")]
public class ReactionRemovedResponse : Response
{

}
}
20 changes: 20 additions & 0 deletions SlackAPI/SlackClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,26 @@ public void AddReaction(
APIRequestWithToken(callback, parameters.ToArray());
}

public void RemoveReaction(
Action<ReactionRemovedResponse> callback,
string name = null,
string channel = null,
string timestamp = null)
{
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();

if (!string.IsNullOrEmpty(name))
parameters.Add(new Tuple<string, string>("name", name));

if (!string.IsNullOrEmpty(channel))
parameters.Add(new Tuple<string, string>("channel", channel));

if (!string.IsNullOrEmpty(timestamp))
parameters.Add(new Tuple<string, string>("timestamp", timestamp));

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

public void UploadFile(Action<FileUploadResponse> callback, byte[] fileData, string fileName, string[] channelIds, string title = null, string initialComment = null, bool useAsync = false, string fileType = null)
{
Uri target = new Uri(Path.Combine(APIBaseLocation, useAsync ? "files.uploadAsync" : "files.upload"));
Expand Down
19 changes: 19 additions & 0 deletions SlackAPI/SlackTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,25 @@ public Task<ReactionAddedResponse> AddReactionAsync(
return APIRequestWithTokenAsync<ReactionAddedResponse>(parameters.ToArray());
}

public Task<ReactionRemovedResponse> RemoveReactionAsync(
string name = null,
string channel = null,
string timestamp = null)
{
List<Tuple<string, string>> parameters = new List<Tuple<string, string>>();

if (!string.IsNullOrEmpty(name))
parameters.Add(new Tuple<string, string>("name", name));

if (!string.IsNullOrEmpty(channel))
parameters.Add(new Tuple<string, string>("channel", channel));

if (!string.IsNullOrEmpty(timestamp))
parameters.Add(new Tuple<string, string>("timestamp", timestamp));

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

public Task<DialogOpenResponse> DialogOpenAsync(
string triggerId,
Dialog dialog)
Expand Down