From 21384736408ee4aa0b6a306c8f3c0ddfb02620f9 Mon Sep 17 00:00:00 2001 From: mrmurb Date: Mon, 26 Aug 2019 10:18:05 +0200 Subject: [PATCH] Implements new Post in ISlackApiClient --- SlackNet.Tests/ApiLintTest.cs | 3 +++ SlackNet/SlackApiClient.cs | 36 +++++++++++++++++++++-------- SlackNet/WebApi/ChannelsApi.cs | 10 ++++---- SlackNet/WebApi/ChatApi.cs | 2 +- SlackNet/WebApi/ConversationsApi.cs | 10 ++++---- SlackNet/WebApi/DialogApi.cs | 2 +- SlackNet/WebApi/DndApi.cs | 2 +- SlackNet/WebApi/FileCommentsApi.cs | 2 +- SlackNet/WebApi/FilesApi.cs | 2 +- SlackNet/WebApi/GroupsApi.cs | 12 +++++----- SlackNet/WebApi/ImApi.cs | 4 ++-- SlackNet/WebApi/MpimApi.cs | 4 ++-- SlackNet/WebApi/PinsApi.cs | 12 +++++----- SlackNet/WebApi/ReactionsApi.cs | 12 +++++----- SlackNet/WebApi/RemindersApi.cs | 4 ++-- SlackNet/WebApi/StarsApi.cs | 16 ++++++------- SlackNet/WebApi/UsersApi.cs | 2 +- 17 files changed, 77 insertions(+), 58 deletions(-) diff --git a/SlackNet.Tests/ApiLintTest.cs b/SlackNet.Tests/ApiLintTest.cs index d559ee2..4131632 100644 --- a/SlackNet.Tests/ApiLintTest.cs +++ b/SlackNet.Tests/ApiLintTest.cs @@ -140,6 +140,9 @@ public Task Post(string apiMethod, Args args, HttpContent content, CancellationT return Task.FromResult(0); } + public Task Post(string apiMethod, Args args, CancellationToken? cancellationToken) => + Post(apiMethod, args, cancellationToken); + public Task Post(string apiMethod, Args args, CancellationToken? cancellationToken) where T : class { HttpMethod = "POST"; diff --git a/SlackNet/SlackApiClient.cs b/SlackNet/SlackApiClient.cs index afd9379..d6e709e 100644 --- a/SlackNet/SlackApiClient.cs +++ b/SlackNet/SlackApiClient.cs @@ -62,20 +62,28 @@ public interface ISlackApiClient /// Calls a Slack API that requires POST content. /// /// Name of Slack method. - /// Arguments to send to Slack. The "token" parameter will be filled in automatically. - /// POST body content. Should be either or . + /// Arguments to send to Slack. Authorization headers will be added automatically. /// - Task Post(string apiMethod, Args args, HttpContent content, CancellationToken? cancellationToken); - + Task Post(string apiMethod, Args args, CancellationToken? cancellationToken); + /// /// Calls a Slack API that requires POST content. /// /// Type of response expected. /// Name of Slack method. - /// Arguments to send to Slack. Authorization headers will be added automagically. + /// Arguments to send to Slack. Authorization headers will be added automatically. /// Task Post(string apiMethod, Args args, CancellationToken? cancellationToken) where T : class; + /// + /// Calls a Slack API that requires POST content. + /// + /// Name of Slack method. + /// Arguments to send to Slack. The "token" parameter will be filled in automatically. + /// POST body content. Should be either or . + /// + Task Post(string apiMethod, Args args, HttpContent content, CancellationToken? cancellationToken); + /// /// Calls a Slack API that requires POST content. /// @@ -161,17 +169,15 @@ public async Task Get(string apiMethod, Args args, CancellationToken? canc var requestMessage = new HttpRequestMessage(HttpMethod.Get, Url(apiMethod, args)); return Deserialize(await _http.Execute(requestMessage, cancellationToken ?? CancellationToken.None).ConfigureAwait(false)); } - - + /// /// Calls a Slack API that requires POST content. /// /// Name of Slack method. /// Arguments to send to Slack. The "token" parameter will be filled in automatically. - /// POST body content. Should be either or . /// - public Task Post(string apiMethod, Args args, HttpContent content, CancellationToken? cancellationToken) => - Post(apiMethod, args, content, cancellationToken); + public Task Post(string apiMethod, Args args, CancellationToken? cancellationToken) => + Post(apiMethod, args, cancellationToken); /// /// Calls a Slack API that requires POST content. @@ -190,6 +196,16 @@ public async Task Post(string apiMethod, Args args, CancellationToken? can return Deserialize(response); } + /// + /// Calls a Slack API that requires POST content. + /// + /// Name of Slack method. + /// Arguments to send to Slack. The "token" parameter will be filled in automatically. + /// POST body content. Should be either or . + /// + public Task Post(string apiMethod, Args args, HttpContent content, CancellationToken? cancellationToken) => + Post(apiMethod, args, content, cancellationToken); + /// /// Calls a Slack API that requires POST content. /// diff --git a/SlackNet/WebApi/ChannelsApi.cs b/SlackNet/WebApi/ChannelsApi.cs index ee4656f..bdd985b 100644 --- a/SlackNet/WebApi/ChannelsApi.cs +++ b/SlackNet/WebApi/ChannelsApi.cs @@ -162,7 +162,7 @@ public class ChannelsApi : IChannelsApi /// /// public Task Archive(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("channels.archive", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("channels.archive", new Args { { "channel", channelId } }, cancellationToken); /// /// Used to create a channel. @@ -253,7 +253,7 @@ public Task Join(string channelName, bool validate = false, /// User to remove from channel. /// public Task Kick(string channelId, string userId, CancellationToken? cancellationToken = null) => - _client.Post("channels.kick", new Args + _client.Post("channels.kick", new Args { { "channel", channelId }, { "user", userId } @@ -266,7 +266,7 @@ public Task Kick(string channelId, string userId, CancellationToken? cancellatio /// /// public Task Leave(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("channels.leave", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("channels.leave", new Args { { "channel", channelId } }, cancellationToken); /// /// Returns a list of all channels in the team. @@ -292,7 +292,7 @@ public async Task> List(bool excludeArchived = false, boo /// Timestamp of the most recently seen message. /// public Task Mark(string channelId, string ts, CancellationToken? cancellationToken = null) => - _client.Post("channels.mark", new Args + _client.Post("channels.mark", new Args { { "channel", channelId }, { "ts", ts } @@ -366,6 +366,6 @@ public async Task SetTopic(string channelId, string topic, CancellationT /// Channel to unarchive. /// public Task Unarchive(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("channels.unarchive", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("channels.unarchive", new Args { { "channel", channelId } }, cancellationToken); } } \ No newline at end of file diff --git a/SlackNet/WebApi/ChatApi.cs b/SlackNet/WebApi/ChatApi.cs index 1a69eb8..34494da 100644 --- a/SlackNet/WebApi/ChatApi.cs +++ b/SlackNet/WebApi/ChatApi.cs @@ -186,7 +186,7 @@ public Task PostEphemeral(string userId, Message message, C /// Subsequent attempts with the same and values will modify the same attachments, rather than adding more. /// public Task Unfurl(string channelId, string ts, IDictionary unfurls, bool userAuthRequired = false, CancellationToken? cancellationToken = null) => - _client.Post("chat.unfurl", new Args + _client.Post("chat.unfurl", new Args { { "channel", channelId }, { "ts", ts }, diff --git a/SlackNet/WebApi/ConversationsApi.cs b/SlackNet/WebApi/ConversationsApi.cs index 5c7c393..da81237 100644 --- a/SlackNet/WebApi/ConversationsApi.cs +++ b/SlackNet/WebApi/ConversationsApi.cs @@ -207,7 +207,7 @@ public class ConversationsApi : IConversationsApi /// ID of conversation to archive. /// public Task Archive(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("conversations.archive", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("conversations.archive", new Args { { "channel", channelId } }, cancellationToken); /// /// Closes a direct message or multi-person direct message. @@ -216,7 +216,7 @@ public Task Archive(string channelId, CancellationToken? cancellationToken = nul /// /// public Task Close(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("conversations.close", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("conversations.close", new Args { { "channel", channelId } }, cancellationToken); /// /// Initiates a public or private channel-based conversation. @@ -303,7 +303,7 @@ public Task Join(string channelId, CancellationToken? /// User ID to be removed. /// public Task Kick(string channelId, string userId, CancellationToken? cancellationToken = null) => - _client.Post("conversations.kick", new Args + _client.Post("conversations.kick", new Args { { "channel", channelId }, { "user", userId } @@ -315,7 +315,7 @@ public Task Kick(string channelId, string userId, CancellationToken? cancellatio /// Conversation to leave. /// public Task Leave(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("conversations.leave", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("conversations.leave", new Args { { "channel", channelId } }, cancellationToken); /// /// Lists all channels in a Slack team. @@ -478,6 +478,6 @@ public async Task SetTopic(string channelId, string topic, CancellationT /// ID of conversation to unarchive. /// public Task Unarchive(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("conversations.unarchive", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("conversations.unarchive", new Args { { "channel", channelId } }, cancellationToken); } } \ No newline at end of file diff --git a/SlackNet/WebApi/DialogApi.cs b/SlackNet/WebApi/DialogApi.cs index 9c49032..37db3d4 100644 --- a/SlackNet/WebApi/DialogApi.cs +++ b/SlackNet/WebApi/DialogApi.cs @@ -28,7 +28,7 @@ public class DialogApi : IDialogApi /// The dialog definition. /// public Task Open(string triggerId, Dialog dialog, CancellationToken? cancellationToken = null) => - _client.Post("dialog.open", new Args + _client.Post("dialog.open", new Args { { "dialog", dialog }, { "trigger_id", triggerId } diff --git a/SlackNet/WebApi/DndApi.cs b/SlackNet/WebApi/DndApi.cs index fae9021..f3afb65 100644 --- a/SlackNet/WebApi/DndApi.cs +++ b/SlackNet/WebApi/DndApi.cs @@ -59,7 +59,7 @@ public class DndApi : IDndApi /// /// public Task EndDnd(CancellationToken? cancellationToken = null) => - _client.Post("dnd.endDnd", new Args(), cancellationToken); + _client.Post("dnd.endDnd", new Args(), cancellationToken); /// /// Ends the current user's snooze mode immediately. diff --git a/SlackNet/WebApi/FileCommentsApi.cs b/SlackNet/WebApi/FileCommentsApi.cs index 00ec928..1a37722 100644 --- a/SlackNet/WebApi/FileCommentsApi.cs +++ b/SlackNet/WebApi/FileCommentsApi.cs @@ -29,7 +29,7 @@ public class FileCommentsApi : IFileCommentsApi /// The comment to delete. /// public Task Delete(string fileId, string commentId, CancellationToken? cancellationToken = null) => - _client.Post("files.comments.delete", new Args + _client.Post("files.comments.delete", new Args { { "file", fileId }, { "id", commentId } diff --git a/SlackNet/WebApi/FilesApi.cs b/SlackNet/WebApi/FilesApi.cs index 234784a..3a4970e 100644 --- a/SlackNet/WebApi/FilesApi.cs +++ b/SlackNet/WebApi/FilesApi.cs @@ -164,7 +164,7 @@ public class FilesApi : IFilesApi /// ID of file to delete. /// public Task Delete(string fileId, CancellationToken? cancellationToken = null) => - _client.Post("files.delete", new Args { { "file", fileId } }, cancellationToken); + _client.Post("files.delete", new Args { { "file", fileId } }, cancellationToken); /// /// Returns information about a file in your team. diff --git a/SlackNet/WebApi/GroupsApi.cs b/SlackNet/WebApi/GroupsApi.cs index 4514f44..9a8a4b0 100644 --- a/SlackNet/WebApi/GroupsApi.cs +++ b/SlackNet/WebApi/GroupsApi.cs @@ -172,7 +172,7 @@ public class GroupsApi : IGroupsApi /// Private channel to archive. /// public Task Archive(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("groups.archive", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("groups.archive", new Args { { "channel", channelId } }, cancellationToken); /// /// Closes a private channel. @@ -270,7 +270,7 @@ public async Task Invite(string channelId, string userId, CancellationT /// /// public Task Kick(string channelId, string userId, CancellationToken? cancellationToken = null) => - _client.Post("groups.kick", new Args + _client.Post("groups.kick", new Args { { "channel", channelId }, { "user", userId } @@ -282,7 +282,7 @@ public Task Kick(string channelId, string userId, CancellationToken? cancellatio /// Private channel to leave. /// public Task Leave(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("groups.leave", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("groups.leave", new Args { { "channel", channelId } }, cancellationToken); /// /// Returns a list of private channels in the team that the caller is in and archived groups that the caller was in. @@ -300,7 +300,7 @@ public async Task> List(bool excludeArchived = false, Can /// Timestamp of the most recently seen message. /// public Task Mark(string channelId, string ts, CancellationToken? cancellationToken = null) => - _client.Post("groups.mark", new Args { { "channel", channelId }, { "ts", ts } }, cancellationToken); + _client.Post("groups.mark", new Args { { "channel", channelId }, { "ts", ts } }, cancellationToken); /// /// Opens a private channel. @@ -309,7 +309,7 @@ public Task Mark(string channelId, string ts, CancellationToken? cancellationTok /// /// public Task Open(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("groups.open", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("groups.open", new Args { { "channel", channelId } }, cancellationToken); /// /// Renames a private channel. @@ -377,6 +377,6 @@ public async Task SetTopic(string channelId, string topic, CancellationT /// Private channel to unarchive. /// public Task Unarchive(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("groups.unarchive", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("groups.unarchive", new Args { { "channel", channelId } }, cancellationToken); } } \ No newline at end of file diff --git a/SlackNet/WebApi/ImApi.cs b/SlackNet/WebApi/ImApi.cs index cd2655d..f06cc08 100644 --- a/SlackNet/WebApi/ImApi.cs +++ b/SlackNet/WebApi/ImApi.cs @@ -80,7 +80,7 @@ public class ImApi : IImApi /// Direct message channel to close. /// public Task Close(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("im.close", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("im.close", new Args { { "channel", channelId } }, cancellationToken); /// /// Returns a portion of message events from the specified direct message channel. @@ -129,7 +129,7 @@ public async Task> List(CancellationToken? cancellationToken = /// Timestamp of the most recently seen message. /// public Task Mark(string channelId, string ts, CancellationToken? cancellationToken = null) => - _client.Post("im.mark", new Args + _client.Post("im.mark", new Args { { "channel", channelId }, { "ts", ts } diff --git a/SlackNet/WebApi/MpimApi.cs b/SlackNet/WebApi/MpimApi.cs index 3beef15..83a5646 100644 --- a/SlackNet/WebApi/MpimApi.cs +++ b/SlackNet/WebApi/MpimApi.cs @@ -79,7 +79,7 @@ public class MpimApi : IMpimApi /// MPIM to close. /// public Task Close(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("mpim.close", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("mpim.close", new Args { { "channel", channelId } }, cancellationToken); /// /// Returns a portion of message events from the specified multiparty direct message channel. @@ -128,7 +128,7 @@ public async Task> List(CancellationToken? cancellationTo /// Timestamp of the most recently seen message. /// public Task Mark(string channelId, string ts, CancellationToken? cancellationToken = null) => - _client.Post("mpim.mark", new Args + _client.Post("mpim.mark", new Args { { "channel", channelId }, { "ts", ts } diff --git a/SlackNet/WebApi/PinsApi.cs b/SlackNet/WebApi/PinsApi.cs index a81449d..d23e198 100644 --- a/SlackNet/WebApi/PinsApi.cs +++ b/SlackNet/WebApi/PinsApi.cs @@ -80,7 +80,7 @@ public class PinsApi : IPinsApi /// File to pin. /// public Task AddFile(string channelId, string fileId, CancellationToken? cancellationToken = null) => - _client.Post("pins.add", new Args + _client.Post("pins.add", new Args { { "channel", channelId }, { "file", fileId } @@ -93,7 +93,7 @@ public Task AddFile(string channelId, string fileId, CancellationToken? cancella /// File comment to pin. /// public Task AddFileComment(string channelId, string fileCommentId, CancellationToken? cancellationToken = null) => - _client.Post("pins.add", new Args + _client.Post("pins.add", new Args { { "channel", channelId }, { "file_comment", fileCommentId }, @@ -106,7 +106,7 @@ public Task AddFileComment(string channelId, string fileCommentId, CancellationT /// Timestamp of the message to pin. /// public Task AddMessage(string channelId, string ts = null, CancellationToken? cancellationToken = null) => - _client.Post("pins.add", new Args + _client.Post("pins.add", new Args { { "channel", channelId }, { "timestamp", ts } @@ -127,7 +127,7 @@ public async Task> List(string channelId, Cancellation /// File to un-pin. /// public Task RemoveFile(string channelId, string fileId, CancellationToken? cancellationToken = null) => - _client.Post("pins.remove", new Args + _client.Post("pins.remove", new Args { { "channel", channelId }, { "file", fileId } @@ -140,7 +140,7 @@ public Task RemoveFile(string channelId, string fileId, CancellationToken? cance /// File comment to un-pin. /// public Task RemoveFileComment(string channelId, string fileCommentId, CancellationToken? cancellationToken = null) => - _client.Post("pins.remove", new Args + _client.Post("pins.remove", new Args { { "channel", channelId }, { "file_comment", fileCommentId } @@ -153,7 +153,7 @@ public Task RemoveFileComment(string channelId, string fileCommentId, Cancellati /// Timestamp of the message to un-pin. /// public Task RemoveMessage(string channelId, string ts, CancellationToken? cancellationToken = null) => - _client.Post("pins.remove", new Args + _client.Post("pins.remove", new Args { { "channel", channelId }, { "timestamp", ts } diff --git a/SlackNet/WebApi/ReactionsApi.cs b/SlackNet/WebApi/ReactionsApi.cs index 84f67ed..7ff2090 100644 --- a/SlackNet/WebApi/ReactionsApi.cs +++ b/SlackNet/WebApi/ReactionsApi.cs @@ -105,7 +105,7 @@ public class ReactionsApi : IReactionsApi /// File to add reaction to. /// public Task AddToFile(string name, string fileId, CancellationToken? cancellationToken = null) => - _client.Post("reactions.add", new Args + _client.Post("reactions.add", new Args { { "name", name }, { "file", fileId } @@ -118,7 +118,7 @@ public Task AddToFile(string name, string fileId, CancellationToken? cancellatio /// File comment to add reaction to. /// public Task AddToFileComment(string name, string fileCommentId, CancellationToken? cancellationToken = null) => - _client.Post("reactions.add", new Args + _client.Post("reactions.add", new Args { { "name", name }, { "file_comment", fileCommentId } @@ -132,7 +132,7 @@ public Task AddToFileComment(string name, string fileCommentId, CancellationToke /// Timestamp of the message to add reaction to. /// public Task AddToMessage(string name, string channelId, string ts, CancellationToken? cancellationToken = null) => - _client.Post("reactions.add", new Args + _client.Post("reactions.add", new Args { { "name", name }, { "channel", channelId }, @@ -207,7 +207,7 @@ public Task List(string userId = null, bool full = fal /// File to remove reaction from. /// public Task RemoveFromFile(string name, string fileId, CancellationToken? cancellationToken = null) => - _client.Post("reactions.remove", new Args + _client.Post("reactions.remove", new Args { { "name", name }, { "file", fileId } @@ -220,7 +220,7 @@ public Task RemoveFromFile(string name, string fileId, CancellationToken? cancel /// File comment to remove reaction from. /// public Task RemoveFromFileComment(string name, string fileCommentId, CancellationToken? cancellationToken = null) => - _client.Post("reactions.remove", new Args + _client.Post("reactions.remove", new Args { { "name", name }, { "file_comment", fileCommentId } @@ -234,7 +234,7 @@ public Task RemoveFromFileComment(string name, string fileCommentId, Cancellatio /// Timestamp of the message to remove reaction from. /// public Task RemoveFromMessage(string name, string channelId, string ts, CancellationToken? cancellationToken = null) => - _client.Post("reactions.remove", new Args + _client.Post("reactions.remove", new Args { { "name", name }, { "channel", channelId }, diff --git a/SlackNet/WebApi/RemindersApi.cs b/SlackNet/WebApi/RemindersApi.cs index f354573..cc8db8b 100644 --- a/SlackNet/WebApi/RemindersApi.cs +++ b/SlackNet/WebApi/RemindersApi.cs @@ -130,7 +130,7 @@ public async Task Add(string text, string time, string userId = null, /// The ID of the reminder to be marked as complete. /// public Task Complete(string reminderId, CancellationToken? cancellationToken = null) => - _client.Post("reminders.complete", new Args { { "reminder", reminderId } }, cancellationToken); + _client.Post("reminders.complete", new Args { { "reminder", reminderId } }, cancellationToken); /// /// Deletes a reminder. @@ -138,7 +138,7 @@ public Task Complete(string reminderId, CancellationToken? cancellationToken = n /// The ID of the reminder. /// public Task Delete(string reminderId, CancellationToken? cancellationToken = null) => - _client.Post("reminders.delete", new Args { { "reminder", reminderId } }, cancellationToken); + _client.Post("reminders.delete", new Args { { "reminder", reminderId } }, cancellationToken); /// /// Returns information about a reminder. diff --git a/SlackNet/WebApi/StarsApi.cs b/SlackNet/WebApi/StarsApi.cs index 40a653c..19b2d07 100644 --- a/SlackNet/WebApi/StarsApi.cs +++ b/SlackNet/WebApi/StarsApi.cs @@ -85,7 +85,7 @@ public class StarsApi : IStarsApi /// File to add star to. /// public Task AddToFile(string fileId, CancellationToken? cancellationToken = null) => - _client.Post("stars.add", new Args { { "file", fileId } }, cancellationToken); + _client.Post("stars.add", new Args { { "file", fileId } }, cancellationToken); /// /// Adds a star to a file comment. @@ -93,7 +93,7 @@ public Task AddToFile(string fileId, CancellationToken? cancellationToken = null /// File comment to add star to. /// public Task AddToFileComment(string fileCommentId, CancellationToken? cancellationToken = null) => - _client.Post("stars.add", new Args { { "file_comment", fileCommentId } }, cancellationToken); + _client.Post("stars.add", new Args { { "file_comment", fileCommentId } }, cancellationToken); /// /// Adds a star to a channel. @@ -101,7 +101,7 @@ public Task AddToFileComment(string fileCommentId, CancellationToken? cancellati /// Channel, private group, or DM to add star to. /// public Task AddToChannel(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("stars.add", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("stars.add", new Args { { "channel", channelId } }, cancellationToken); /// /// Adds a star to a message. @@ -110,7 +110,7 @@ public Task AddToChannel(string channelId, CancellationToken? cancellationToken /// Timestamp of the message to add star to. /// public Task AddToMessage(string channelId, string ts, CancellationToken? cancellationToken = null) => - _client.Post("stars.add", new Args + _client.Post("stars.add", new Args { { "channel", channelId }, { "timestamp", ts } @@ -136,7 +136,7 @@ public Task List(int count = 100, int page = 1, CancellationTo /// File to remove star from. /// public Task RemoveFromFile(string fileId, CancellationToken? cancellationToken = null) => - _client.Post("stars.remove", new Args { { "file", fileId } }, cancellationToken); + _client.Post("stars.remove", new Args { { "file", fileId } }, cancellationToken); /// /// Removes a star from a file comment. @@ -144,7 +144,7 @@ public Task RemoveFromFile(string fileId, CancellationToken? cancellationToken = /// File comment to remove star from. /// public Task RemoveFromFileComment(string fileCommentId, CancellationToken? cancellationToken = null) => - _client.Post("stars.remove", new Args { { "file_comment", fileCommentId } }, cancellationToken); + _client.Post("stars.remove", new Args { { "file_comment", fileCommentId } }, cancellationToken); /// /// Removes a star from a channel. @@ -152,7 +152,7 @@ public Task RemoveFromFileComment(string fileCommentId, CancellationToken? cance /// Channel, private group, or DM to remove star from. /// public Task RemoveFromChannel(string channelId, CancellationToken? cancellationToken = null) => - _client.Post("stars.remove", new Args { { "channel", channelId } }, cancellationToken); + _client.Post("stars.remove", new Args { { "channel", channelId } }, cancellationToken); /// /// Removes a star from a message. @@ -161,7 +161,7 @@ public Task RemoveFromChannel(string channelId, CancellationToken? cancellationT /// Timestamp of the message to remove star from. /// public Task RemoveFromMessage(string channelId, string ts, CancellationToken? cancellationToken = null) => - _client.Post("stars.remove", new Args + _client.Post("stars.remove", new Args { { "channel", channelId }, { "timestamp", ts } diff --git a/SlackNet/WebApi/UsersApi.cs b/SlackNet/WebApi/UsersApi.cs index e24f8be..107f12e 100644 --- a/SlackNet/WebApi/UsersApi.cs +++ b/SlackNet/WebApi/UsersApi.cs @@ -269,6 +269,6 @@ public Task SetPhoto(Stream image, string contentType, string fileName = "photo" /// User's presence. /// public Task SetPresence(Presence presence, CancellationToken? cancellationToken = null) => - _client.Post("users.setPresence", new Args { { "presence", presence } }, cancellationToken); + _client.Post("users.setPresence", new Args { { "presence", presence } }, cancellationToken); } }