From f4e0380b0aacdac9569af7f79902b331d6aec100 Mon Sep 17 00:00:00 2001 From: "zzymyn@gmail.com" Date: Mon, 21 Nov 2022 13:48:25 +1100 Subject: [PATCH] Add reactions.remove support. --- SlackAPI/ReactionRemovedResponse.cs | 14 ++++++++++++++ SlackAPI/SlackClient.cs | 20 ++++++++++++++++++++ SlackAPI/SlackTaskClient.cs | 19 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 SlackAPI/ReactionRemovedResponse.cs diff --git a/SlackAPI/ReactionRemovedResponse.cs b/SlackAPI/ReactionRemovedResponse.cs new file mode 100644 index 0000000..8cf983d --- /dev/null +++ b/SlackAPI/ReactionRemovedResponse.cs @@ -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 + { + + } +} diff --git a/SlackAPI/SlackClient.cs b/SlackAPI/SlackClient.cs index e81a55c..f944a26 100644 --- a/SlackAPI/SlackClient.cs +++ b/SlackAPI/SlackClient.cs @@ -879,6 +879,26 @@ public void AddReaction( APIRequestWithToken(callback, parameters.ToArray()); } + public void RemoveReaction( + Action callback, + string name = null, + string channel = null, + string timestamp = null) + { + List> parameters = new List>(); + + if (!string.IsNullOrEmpty(name)) + parameters.Add(new Tuple("name", name)); + + if (!string.IsNullOrEmpty(channel)) + parameters.Add(new Tuple("channel", channel)); + + if (!string.IsNullOrEmpty(timestamp)) + parameters.Add(new Tuple("timestamp", timestamp)); + + APIRequestWithToken(callback, parameters.ToArray()); + } + public void UploadFile(Action 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")); diff --git a/SlackAPI/SlackTaskClient.cs b/SlackAPI/SlackTaskClient.cs index fd65669..b37aa06 100644 --- a/SlackAPI/SlackTaskClient.cs +++ b/SlackAPI/SlackTaskClient.cs @@ -829,6 +829,25 @@ public Task AddReactionAsync( return APIRequestWithTokenAsync(parameters.ToArray()); } + public Task RemoveReactionAsync( + string name = null, + string channel = null, + string timestamp = null) + { + List> parameters = new List>(); + + if (!string.IsNullOrEmpty(name)) + parameters.Add(new Tuple("name", name)); + + if (!string.IsNullOrEmpty(channel)) + parameters.Add(new Tuple("channel", channel)); + + if (!string.IsNullOrEmpty(timestamp)) + parameters.Add(new Tuple("timestamp", timestamp)); + + return APIRequestWithTokenAsync(parameters.ToArray()); + } + public Task DialogOpenAsync( string triggerId, Dialog dialog)