diff --git a/lib/slack/endpoint.rb b/lib/slack/endpoint.rb index 8d422e1..3eab219 100644 --- a/lib/slack/endpoint.rb +++ b/lib/slack/endpoint.rb @@ -1,10 +1,13 @@ # This file was auto-generated by lib/generators/tasks/generate.rb # require_relative 'endpoint/api' +require_relative 'endpoint/apps' require_relative 'endpoint/auth' require_relative 'endpoint/bots' require_relative 'endpoint/channels' require_relative 'endpoint/chat' +require_relative 'endpoint/conversations' +require_relative 'endpoint/dialog' require_relative 'endpoint/discovery' require_relative 'endpoint/dnd' require_relative 'endpoint/emoji' @@ -12,6 +15,7 @@ require_relative 'endpoint/groups' require_relative 'endpoint/idpgroups' require_relative 'endpoint/im' +require_relative 'endpoint/migration' require_relative 'endpoint/mpim' require_relative 'endpoint/oauth' require_relative 'endpoint/pins' @@ -27,10 +31,13 @@ module Slack module Endpoint include Api + include Apps include Auth include Bots include Channels include Chat + include Conversations + include Dialog include Discovery include Dnd include Emoji @@ -38,6 +45,7 @@ module Endpoint include Groups include Idpgroups include Im + include Migration include Mpim include Oauth include Pins diff --git a/lib/slack/endpoint/api.rb b/lib/slack/endpoint/api.rb index 6a87761..01c022f 100644 --- a/lib/slack/endpoint/api.rb +++ b/lib/slack/endpoint/api.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Api # - # This method helps you test your calling code. + # Checks API calling code. # # @option options [Object] :error # Error response to return diff --git a/lib/slack/endpoint/apps.rb b/lib/slack/endpoint/apps.rb new file mode 100644 index 0000000..1702c69 --- /dev/null +++ b/lib/slack/endpoint/apps.rb @@ -0,0 +1,34 @@ +# This file was auto-generated by lib/generators/tasks/generate.rb + +module Slack + module Endpoint + module Apps + # + # Returns list of permissions this app has on a team. + # + # @see https://api.slack.com/methods/apps.permissions.info + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/apps.permissions.info.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/apps.permissions.info.json + def apps_permissions_info(options={}) + post("apps.permissions.info", options) + end + + # + # Allows an app to request additional scopes + # + # @option options [Object] :scopes + # A comma separated list of scopes to request for + # @option options [Object] :trigger_id + # Token used to trigger the permissions API + # @see https://api.slack.com/methods/apps.permissions.request + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/apps.permissions.request.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/apps.permissions.request.json + def apps_permissions_request(options={}) + throw ArgumentError.new("Required arguments :scopes missing") if options[:scopes].nil? + throw ArgumentError.new("Required arguments :trigger_id missing") if options[:trigger_id].nil? + post("apps.permissions.request", options) + end + + end + end +end diff --git a/lib/slack/endpoint/auth.rb b/lib/slack/endpoint/auth.rb index ddf529b..dcf2ec5 100644 --- a/lib/slack/endpoint/auth.rb +++ b/lib/slack/endpoint/auth.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Auth # - # This method revokes an access token. Use it when you no longer need a token. For example, with a Sign In With Slack app, call this to log a user out. + # Revokes a token. # # @option options [Object] :test # Setting this parameter to 1 triggers a testing mode where the specified token will not actually be revoked. @@ -16,7 +16,7 @@ def auth_revoke(options={}) end # - # This method checks authentication and tells you who you are. + # Checks authentication & identity. # # @see https://api.slack.com/methods/auth.test # @see https://github.com/aki017/slack-api-docs/blob/master/methods/auth.test.md diff --git a/lib/slack/endpoint/bots.rb b/lib/slack/endpoint/bots.rb index 962a243..f65bd9e 100644 --- a/lib/slack/endpoint/bots.rb +++ b/lib/slack/endpoint/bots.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Bots # - # This method returns information about a bot user. + # Gets information about a bot user. # # @option options [Object] :bot # Bot user to get info on diff --git a/lib/slack/endpoint/channels.rb b/lib/slack/endpoint/channels.rb index 409f701..d298545 100644 --- a/lib/slack/endpoint/channels.rb +++ b/lib/slack/endpoint/channels.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Channels # - # This method archives a channel. + # Archives a channel. # # @option options [Object] :channel # Channel to archive @@ -17,7 +17,7 @@ def channels_archive(options={}) end # - # This method is used to create a channel. + # Creates a channel. # # @option options [Object] :name # Name of channel to create @@ -32,7 +32,7 @@ def channels_create(options={}) end # - # This method returns a portion of message events from the specified public channel. + # Fetches history of messages and events from a channel. # # @option options [Object] :channel # Channel to fetch history for. @@ -55,10 +55,12 @@ def channels_history(options={}) end # - # This method returns information about a team channel. + # Gets information about a channel. # # @option options [Object] :channel # Channel to get info on + # @option options [Object] :include_locale + # Set this to true to receive the locale for this channel. Defaults to false # @see https://api.slack.com/methods/channels.info # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.info.md # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.info.json @@ -68,7 +70,7 @@ def channels_info(options={}) end # - # This method is used to invite a user to a channel. The calling user must be a member of the channel. + # Invites a user to a channel. # # @option options [Object] :channel # Channel to invite user to. @@ -84,8 +86,7 @@ def channels_invite(options={}) end # - # This method is used to join a channel. If the channel does not exist, it is - # created. + # Joins a channel, creating it if needed. # # @option options [Object] :name # Name of channel to join @@ -100,7 +101,7 @@ def channels_join(options={}) end # - # This method allows a user to remove another member from a team channel. + # Removes a user from a channel. # # @option options [Object] :channel # Channel to remove user from. @@ -116,7 +117,7 @@ def channels_kick(options={}) end # - # This method is used to leave a channel. + # Leaves a channel. # # @option options [Object] :channel # Channel to leave @@ -129,12 +130,16 @@ def channels_leave(options={}) end # - # This method returns a list of all channels in the team. This includes channels the caller is in, channels they are not currently in, and archived channels but does not include private channels. The number of (non-deactivated) members in each channel is also returned. + # Lists all channels in a Slack team. # + # @option options [Object] :cursor + # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. # @option options [Object] :exclude_archived # Exclude archived channels from the list # @option options [Object] :exclude_members # Exclude the members collection from each channel + # @option options [Object] :limit + # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. # @see https://api.slack.com/methods/channels.list # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.list.md # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.list.json @@ -143,7 +148,7 @@ def channels_list(options={}) end # - # This method moves the read cursor in a channel. + # Sets the read cursor in a channel. # # @option options [Object] :channel # Channel to set reading cursor in. @@ -159,7 +164,7 @@ def channels_mark(options={}) end # - # This method renames a team channel. + # Renames a channel. # # @option options [Object] :channel # Channel to rename @@ -177,7 +182,7 @@ def channels_rename(options={}) end # - # This method returns an entire thread (a message plus all the messages in reply to it). + # Retrieve a thread of messages posted to a channel # # @option options [Object] :channel # Channel to fetch thread from @@ -193,7 +198,7 @@ def channels_replies(options={}) end # - # This method is used to change the purpose of a channel. The calling user must be a member of the channel. + # Sets the purpose for a channel. # # @option options [Object] :channel # Channel to set the purpose of @@ -209,7 +214,7 @@ def channels_setPurpose(options={}) end # - # This method is used to change the topic of a channel. The calling user must be a member of the channel. + # Sets the topic for a channel. # # @option options [Object] :channel # Channel to set the topic of @@ -225,7 +230,7 @@ def channels_setTopic(options={}) end # - # This method unarchives a channel. The calling user is added to the channel. + # Unarchives a channel. # # @option options [Object] :channel # Channel to unarchive diff --git a/lib/slack/endpoint/chat.rb b/lib/slack/endpoint/chat.rb index bc88f91..39da941 100644 --- a/lib/slack/endpoint/chat.rb +++ b/lib/slack/endpoint/chat.rb @@ -4,14 +4,14 @@ module Slack module Endpoint module Chat # - # This method deletes a message from a channel. + # Deletes a message. # # @option options [Object] :channel # Channel containing the message to be deleted. # @option options [Object] :ts # Timestamp of the message to be deleted. # @option options [Object] :as_user - # Pass true to delete the message as the authed user. Bot users in this context are considered authed users. + # Pass true to delete the message as the authed user with chat:write:user scope. Bot users in this context are considered authed users. If unused or false, the message will be deleted with chat:write:bot scope. # @see https://api.slack.com/methods/chat.delete # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.delete.md # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.delete.json @@ -22,7 +22,23 @@ def chat_delete(options={}) end # - # This method sends a me message to a channel from the calling user. + # Retrieve a permalink URL for a specific extant message + # + # @option options [Object] :channel + # The ID of the conversation or channel containing the message + # @option options [Object] :message_ts + # A message's ts value, uniquely identifying it within a channel + # @see https://api.slack.com/methods/chat.getPermalink + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.getPermalink.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.getPermalink.json + def chat_getPermalink(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + throw ArgumentError.new("Required arguments :message_ts missing") if options[:message_ts].nil? + post("chat.getPermalink", options) + end + + # + # Share a me message into a channel. # # @option options [Object] :channel # Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name. @@ -38,7 +54,35 @@ def chat_meMessage(options={}) end # - # This method posts a message to a public channel, private channel, or direct message/IM channel. + # Sends an ephemeral message to a user in a channel. + # + # @option options [Object] :channel + # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. + # @option options [Object] :text + # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. + # @option options [Object] :user + # id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument. + # @option options [Object] :as_user + # Pass true to post the message as the authed bot. Defaults to false. + # @option options [Object] :attachments + # A JSON-based array of structured attachments, presented as a URL-encoded string. + # @option options [Object] :link_names + # Find and link channel names and usernames. + # @option options [Object] :parse + # Change how messages are treated. Defaults to none. See below. + # @see https://api.slack.com/methods/chat.postEphemeral + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.postEphemeral.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.postEphemeral.json + def chat_postEphemeral(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + throw ArgumentError.new("Required arguments :text missing") if options[:text].nil? + throw ArgumentError.new("Required arguments :user missing") if options[:user].nil? + options[:attachments] = options[:attachments].to_json if options[:attachments].is_a?(Array) || options[:attachments].is_a?(Hash) + post("chat.postEphemeral", options) + end + + # + # Sends a message to a channel. # # @option options [Object] :channel # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details. @@ -47,7 +91,7 @@ def chat_meMessage(options={}) # @option options [Object] :as_user # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below. # @option options [Object] :attachments - # Structured message attachments. + # A JSON-based array of structured attachments, presented as a URL-encoded string. # @option options [Object] :icon_emoji # Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below. # @option options [Object] :icon_url @@ -77,16 +121,20 @@ def chat_postMessage(options={}) end # - # This method attaches Slack app unfurl behavior to a specified and relevant message. A user token is required as this method does not support bot user tokens. + # Provide custom unfurl behavior for user-posted URLs # # @option options [Object] :channel # Channel ID of the message # @option options [Object] :ts - # Timestamp of the message to add unfurl behavior to + # Timestamp of the message to add unfurl behavior to. # @option options [Object] :unfurls - # JSON mapping a set of URLs from the message to their unfurl attachments + # URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl message attachments. + # @option options [Object] :user_auth_message + # Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior # @option options [Object] :user_auth_required # Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain + # @option options [Object] :user_auth_url + # Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded. # @see https://api.slack.com/methods/chat.unfurl # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.unfurl.md # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.unfurl.json @@ -98,18 +146,18 @@ def chat_unfurl(options={}) end # - # This method updates a message in a channel. Though related to chat.postMessage, some parameters of chat.update are handled differently. + # Updates a message. # # @option options [Object] :channel # Channel containing the message to be updated. # @option options [Object] :text - # New text for the message, using the default formatting rules. + # New text for the message, using the default formatting rules. It's not required when presenting attachments. # @option options [Object] :ts # Timestamp of the message to be updated. # @option options [Object] :as_user # Pass true to update the message as the authed user. Bot users in this context are considered authed users. # @option options [Object] :attachments - # Structured message attachments. + # A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text. # @option options [Object] :link_names # Find and link channel names and usernames. Defaults to none. This parameter should be used in conjunction with parse. To set link_names to 1, specify a parse mode of full. # @option options [Object] :parse diff --git a/lib/slack/endpoint/conversations.rb b/lib/slack/endpoint/conversations.rb new file mode 100644 index 0000000..c70e6e3 --- /dev/null +++ b/lib/slack/endpoint/conversations.rb @@ -0,0 +1,283 @@ +# This file was auto-generated by lib/generators/tasks/generate.rb + +module Slack + module Endpoint + module Conversations + # + # Archives a conversation. + # + # @option options [Object] :channel + # ID of conversation to archive + # @see https://api.slack.com/methods/conversations.archive + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.archive.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.archive.json + def conversations_archive(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + post("conversations.archive", options) + end + + # + # Closes a direct message or multi-person direct message. + # + # @option options [Object] :channel + # Conversation to close. + # @see https://api.slack.com/methods/conversations.close + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.close.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.close.json + def conversations_close(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + post("conversations.close", options) + end + + # + # Initiates a public or private channel-based conversation + # + # @option options [Object] :name + # Name of the public or private channel to create + # @option options [Object] :is_private + # Create a private channel instead of a public one + # @see https://api.slack.com/methods/conversations.create + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.create.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.create.json + def conversations_create(options={}) + throw ArgumentError.new("Required arguments :name missing") if options[:name].nil? + post("conversations.create", options) + end + + # + # Fetches a conversation's history of messages and events. + # + # @option options [Object] :channel + # Conversation ID to fetch history for. + # @option options [Object] :cursor + # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. + # @option options [Object] :inclusive + # Include messages with latest or oldest timestamp in results only when either timestamp is specified. + # @option options [Object] :latest + # End of time range of messages to include in results. + # @option options [Object] :limit + # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. + # @option options [Object] :oldest + # Start of time range of messages to include in results. + # @see https://api.slack.com/methods/conversations.history + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.history.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.history.json + def conversations_history(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + post("conversations.history", options) + end + + # + # Retrieve information about a conversation. + # + # @option options [Object] :channel + # Conversation ID to learn more about + # @option options [Object] :include_locale + # Set this to true to receive the locale for this conversation. Defaults to false + # @see https://api.slack.com/methods/conversations.info + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.info.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.info.json + def conversations_info(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + post("conversations.info", options) + end + + # + # Invites users to a channel. + # + # @option options [Object] :channel + # The ID of the public or private channel to invite user(s) to. + # @option options [Object] :users + # A comma separated list of user IDs. Up to 30 users may be listed. + # @see https://api.slack.com/methods/conversations.invite + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.invite.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.invite.json + def conversations_invite(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + throw ArgumentError.new("Required arguments :users missing") if options[:users].nil? + post("conversations.invite", options) + end + + # + # Joins an existing conversation. + # + # @option options [Object] :channel + # ID of conversation to join + # @see https://api.slack.com/methods/conversations.join + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.join.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.join.json + def conversations_join(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + post("conversations.join", options) + end + + # + # Removes a user from a conversation. + # + # @option options [Object] :channel + # ID of conversation to remove user from. + # @option options [Object] :user + # User ID to be removed. + # @see https://api.slack.com/methods/conversations.kick + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.kick.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.kick.json + def conversations_kick(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + throw ArgumentError.new("Required arguments :user missing") if options[:user].nil? + post("conversations.kick", options) + end + + # + # Leaves a conversation. + # + # @option options [Object] :channel + # Conversation to leave + # @see https://api.slack.com/methods/conversations.leave + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.leave.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.leave.json + def conversations_leave(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + post("conversations.leave", options) + end + + # + # Lists all channels in a Slack team. + # + # @option options [Object] :cursor + # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. + # @option options [Object] :exclude_archived + # Set to true to exclude archived channels from the list + # @option options [Object] :limit + # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached. Must be an integer no larger than 1000. + # @option options [Object] :types + # Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im + # @see https://api.slack.com/methods/conversations.list + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.list.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.list.json + def conversations_list(options={}) + post("conversations.list", options) + end + + # + # Retrieve members of a conversation. + # + # @option options [Object] :channel + # ID of the conversation to retrieve members for + # @option options [Object] :cursor + # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. + # @option options [Object] :limit + # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. + # @see https://api.slack.com/methods/conversations.members + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.members.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.members.json + def conversations_members(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + post("conversations.members", options) + end + + # + # Opens or resumes a direct message or multi-person direct message. + # + # @option options [Object] :channel + # Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead. + # @option options [Object] :return_im + # Boolean, indicates you want the full IM channel definition in the response. + # @option options [Object] :users + # Comma separated lists of users. If only one user is included, this creates a 1:1 DM. The ordering of the users is preserved whenever a multi-person direct message is returned. Supply a channel when not supplying users. + # @see https://api.slack.com/methods/conversations.open + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.open.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.open.json + def conversations_open(options={}) + post("conversations.open", options) + end + + # + # Renames a conversation. + # + # @option options [Object] :channel + # ID of conversation to rename + # @option options [Object] :name + # New name for conversation. + # @see https://api.slack.com/methods/conversations.rename + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.rename.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.rename.json + def conversations_rename(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + throw ArgumentError.new("Required arguments :name missing") if options[:name].nil? + post("conversations.rename", options) + end + + # + # Retrieve a thread of messages posted to a conversation + # + # @option options [Object] :channel + # Conversation ID to fetch thread from. + # @option options [Object] :ts + # Unique identifier of a thread's parent message. + # @option options [Object] :cursor + # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. + # @option options [Object] :inclusive + # Include messages with latest or oldest timestamp in results only when either timestamp is specified. + # @option options [Object] :latest + # End of time range of messages to include in results. + # @option options [Object] :limit + # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. + # @option options [Object] :oldest + # Start of time range of messages to include in results. + # @see https://api.slack.com/methods/conversations.replies + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.replies.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.replies.json + def conversations_replies(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil? + post("conversations.replies", options) + end + + # + # Sets the purpose for a conversation. + # + # @option options [Object] :channel + # Conversation to set the purpose of + # @option options [Object] :purpose + # A new, specialer purpose + # @see https://api.slack.com/methods/conversations.setPurpose + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.setPurpose.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.setPurpose.json + def conversations_setPurpose(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + throw ArgumentError.new("Required arguments :purpose missing") if options[:purpose].nil? + post("conversations.setPurpose", options) + end + + # + # Sets the topic for a conversation. + # + # @option options [Object] :channel + # Conversation to set the topic of + # @option options [Object] :topic + # The new topic string. Does not support formatting or linkification. + # @see https://api.slack.com/methods/conversations.setTopic + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.setTopic.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.setTopic.json + def conversations_setTopic(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + throw ArgumentError.new("Required arguments :topic missing") if options[:topic].nil? + post("conversations.setTopic", options) + end + + # + # Reverses conversation archival. + # + # @option options [Object] :channel + # ID of conversation to unarchive + # @see https://api.slack.com/methods/conversations.unarchive + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.unarchive.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/conversations.unarchive.json + def conversations_unarchive(options={}) + throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil? + post("conversations.unarchive", options) + end + + end + end +end diff --git a/lib/slack/endpoint/dialog.rb b/lib/slack/endpoint/dialog.rb new file mode 100644 index 0000000..240cad4 --- /dev/null +++ b/lib/slack/endpoint/dialog.rb @@ -0,0 +1,24 @@ +# This file was auto-generated by lib/generators/tasks/generate.rb + +module Slack + module Endpoint + module Dialog + # + # Open a dialog with a user + # + # @option options [Object] :dialog + # The dialog definition. This must be a JSON-encoded string. + # @option options [Object] :trigger_id + # Exchange a trigger to post to the user. + # @see https://api.slack.com/methods/dialog.open + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dialog.open.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dialog.open.json + def dialog_open(options={}) + throw ArgumentError.new("Required arguments :dialog missing") if options[:dialog].nil? + throw ArgumentError.new("Required arguments :trigger_id missing") if options[:trigger_id].nil? + post("dialog.open", options) + end + + end + end +end diff --git a/lib/slack/endpoint/dnd.rb b/lib/slack/endpoint/dnd.rb index 98ad5f0..8329e60 100644 --- a/lib/slack/endpoint/dnd.rb +++ b/lib/slack/endpoint/dnd.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Dnd # - # Ends the user's currently scheduled Do Not Disturb session immediately. + # Ends the current user's Do Not Disturb session immediately. # # @see https://api.slack.com/methods/dnd.endDnd # @see https://github.com/aki017/slack-api-docs/blob/master/methods/dnd.endDnd.md @@ -24,7 +24,7 @@ def dnd_endSnooze(options={}) end # - # Provides information about a user's current Do Not Disturb settings. + # Retrieves a user's current Do Not Disturb status. # # @option options [Object] :user # User to fetch status for (defaults to current user) @@ -36,7 +36,7 @@ def dnd_info(options={}) end # - # Adjusts the snooze duration for a user's Do Not Disturb settings. If a snooze session is not already active for the user, invoking this method will begin one for the specified duration. + # Turns on Do Not Disturb mode for the current user, or changes its duration. # # @option options [Object] :num_minutes # Number of minutes, from now, to snooze until. @@ -49,7 +49,7 @@ def dnd_setSnooze(options={}) end # - # Provides information about the current Do Not Disturb settings for users of a Slack team. + # Retrieves the Do Not Disturb status for users on a team. # # @option options [Object] :users # Comma-separated list of users to fetch Do Not Disturb status for diff --git a/lib/slack/endpoint/emoji.rb b/lib/slack/endpoint/emoji.rb index 13cb246..f7405e1 100644 --- a/lib/slack/endpoint/emoji.rb +++ b/lib/slack/endpoint/emoji.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Emoji # - # This method lists the custom emoji for a team. + # Lists custom emoji for a team. # # @see https://api.slack.com/methods/emoji.list # @see https://github.com/aki017/slack-api-docs/blob/master/methods/emoji.list.md diff --git a/lib/slack/endpoint/files.rb b/lib/slack/endpoint/files.rb index d9ac576..cbf1b1e 100644 --- a/lib/slack/endpoint/files.rb +++ b/lib/slack/endpoint/files.rb @@ -20,7 +20,7 @@ def files_comments_add(options={}) end # - # Delete an existing comment on a file. Only the original author of the comment or a Team Administrator may delete a file comment. + # Deletes an existing comment on a file. # # @option options [Object] :file # File to delete a comment from. @@ -36,7 +36,7 @@ def files_comments_delete(options={}) end # - # Edit an existing comment on a file. Only the user who created a comment may make edits. Teams may configure a limited time window during which file comment edits are allowed. + # Edit an existing file comment. # # @option options [Object] :comment # Text of the comment to edit. @@ -55,7 +55,7 @@ def files_comments_edit(options={}) end # - # This method deletes a file from your team. + # Deletes a file. # # @option options [Object] :file # ID of file to delete. @@ -68,7 +68,7 @@ def files_delete(options={}) end # - # This method returns information about a file in your team. + # Gets information about a team file. # # @option options [Object] :file # Specify a file by providing its ID. @@ -85,7 +85,7 @@ def files_info(options={}) end # - # This method returns a list of files within the team. It can be filtered and sliced in various ways. + # Lists & filters team files. # # @option options [Object] :channel # Filter files appearing in a specific channel, indicated by its ID. @@ -121,7 +121,7 @@ def files_list(options={}) end # - # This method disables public/external sharing for a file. + # Revokes public/external sharing access for a file # # @option options [Object] :file # File to revoke @@ -134,7 +134,7 @@ def files_revokePublicURL(options={}) end # - # This method enables public/external sharing for a file. + # Enables a file for public/external sharing. # # @option options [Object] :file # File to share @@ -160,7 +160,7 @@ def files_startPartialUpload(options={}) end # - # This method allows you to create or upload an existing file. + # Uploads or creates a file. # # @option options [Object] :channels # Comma-separated list of channel names or IDs where the file will be shared. diff --git a/lib/slack/endpoint/groups.rb b/lib/slack/endpoint/groups.rb index d4264cd..92e5e08 100644 --- a/lib/slack/endpoint/groups.rb +++ b/lib/slack/endpoint/groups.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Groups # - # This method archives a private channel. + # Archives a private channel. # # @option options [Object] :channel # Private channel to archive @@ -30,7 +30,7 @@ def groups_close(options={}) end # - # This method creates a private channel. + # Creates a private channel. # # @option options [Object] :name # Name of private channel to create @@ -45,7 +45,7 @@ def groups_create(options={}) end # - # This method takes an existing private channel and performs the following steps: + # Clones and archives a private channel. # # @option options [Object] :channel # Private channel to clone and archive. @@ -58,9 +58,7 @@ def groups_createChild(options={}) end # - # This method returns a portion of messages/events from the specified private channel. - # To read the entire history for a private channel, call the method with no latest or - # oldest arguments, and then continue paging using the instructions below. + # Fetches history of messages and events from a private channel. # # @option options [Object] :channel # Private channel to fetch history for. @@ -83,10 +81,12 @@ def groups_history(options={}) end # - # This method returns information about a private channel. + # Gets information about a private channel. # # @option options [Object] :channel # Private channel to get info on + # @option options [Object] :include_locale + # Set this to true to receive the locale for this group. Defaults to false # @see https://api.slack.com/methods/groups.info # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.info.md # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.info.json @@ -96,7 +96,7 @@ def groups_info(options={}) end # - # This method is used to invite a user to a private channel. The calling user must be a member of the private channel. + # Invites a user to a private channel. # # @option options [Object] :channel # Private channel to invite user to. @@ -112,7 +112,7 @@ def groups_invite(options={}) end # - # This method allows a user to remove another member from a private channel. + # Removes a user from a private channel. # # @option options [Object] :channel # Private channel to remove user from. @@ -128,7 +128,7 @@ def groups_kick(options={}) end # - # This method is used to leave a private channel. + # Leaves a private channel. # # @option options [Object] :channel # Private channel to leave @@ -141,11 +141,12 @@ def groups_leave(options={}) end # - # This method returns a list of private channels in the team that the caller is in and archived groups that the caller was in. - # The list of (non-deactivated) members in each private channel is also returned. + # Lists private channels that the calling user has access to. # # @option options [Object] :exclude_archived # Don't return archived private channels. + # @option options [Object] :exclude_members + # Exclude the members from each group # @see https://api.slack.com/methods/groups.list # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.list.md # @see https://github.com/aki017/slack-api-docs/blob/master/methods/groups.list.json @@ -154,7 +155,7 @@ def groups_list(options={}) end # - # This method moves the read cursor in a private channel. + # Sets the read cursor in a private channel. # # @option options [Object] :channel # Private channel to set reading cursor in. @@ -170,7 +171,7 @@ def groups_mark(options={}) end # - # This method opens a private channel. + # Opens a private channel. # # @option options [Object] :channel # Private channel to open. @@ -183,7 +184,7 @@ def groups_open(options={}) end # - # This method renames a private channel. + # Renames a private channel. # # @option options [Object] :channel # Private channel to rename @@ -201,7 +202,7 @@ def groups_rename(options={}) end # - # This method returns an entire thread (a message plus all the messages in reply to it). + # Retrieve a thread of messages posted to a private channel # # @option options [Object] :channel # Private channel to fetch thread from @@ -217,7 +218,7 @@ def groups_replies(options={}) end # - # This method is used to change the purpose of a private channel. The calling user must be a member of the private channel. + # Sets the purpose for a private channel. # # @option options [Object] :channel # Private channel to set the purpose of @@ -233,7 +234,7 @@ def groups_setPurpose(options={}) end # - # This method is used to change the topic of a private channel. The calling user must be a member of the private channel. + # Sets the topic for a private channel. # # @option options [Object] :channel # Private channel to set the topic of @@ -249,7 +250,7 @@ def groups_setTopic(options={}) end # - # This method unarchives a private channel. + # Unarchives a private channel. # # @option options [Object] :channel # Private channel to unarchive diff --git a/lib/slack/endpoint/im.rb b/lib/slack/endpoint/im.rb index 4e084d3..893ae3a 100644 --- a/lib/slack/endpoint/im.rb +++ b/lib/slack/endpoint/im.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Im # - # This method closes a direct message channel. + # Close a direct message channel. # # @option options [Object] :channel # Direct message channel to close. @@ -17,9 +17,7 @@ def im_close(options={}) end # - # This method returns a portion of messages/events from the specified direct message channel. - # To read the entire history for a direct message channel, call the method with no latest or - # oldest arguments, and then continue paging using the instructions below. + # Fetches history of messages and events from direct message channel. # # @option options [Object] :channel # Direct message channel to fetch history for. @@ -42,8 +40,12 @@ def im_history(options={}) end # - # This method returns a list of all im channels that the user has. + # Lists direct message channels for the calling user. # + # @option options [Object] :cursor + # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. + # @option options [Object] :limit + # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. # @see https://api.slack.com/methods/im.list # @see https://github.com/aki017/slack-api-docs/blob/master/methods/im.list.md # @see https://github.com/aki017/slack-api-docs/blob/master/methods/im.list.json @@ -52,7 +54,7 @@ def im_list(options={}) end # - # This method moves the read cursor in a direct message channel. + # Sets the read cursor in a direct message channel. # # @option options [Object] :channel # Direct message channel to set reading cursor in. @@ -68,10 +70,12 @@ def im_mark(options={}) end # - # This method opens a direct message channel with another member of your Slack team. + # Opens a direct message channel. # # @option options [Object] :user # User to open a direct message channel with. + # @option options [Object] :include_locale + # Set this to true to receive the locale for this im. Defaults to false # @option options [Object] :return_im # Boolean, indicates you want the full IM channel definition in the response. # @see https://api.slack.com/methods/im.open @@ -83,7 +87,7 @@ def im_open(options={}) end # - # This method returns an entire thread (a message plus all the messages in reply to it). + # Retrieve a thread of messages posted to a direct message conversation # # @option options [Object] :channel # Direct message channel to fetch thread from diff --git a/lib/slack/endpoint/migration.rb b/lib/slack/endpoint/migration.rb new file mode 100644 index 0000000..d295fde --- /dev/null +++ b/lib/slack/endpoint/migration.rb @@ -0,0 +1,23 @@ +# This file was auto-generated by lib/generators/tasks/generate.rb + +module Slack + module Endpoint + module Migration + # + # For Enterprise Grid workspaces, map local user IDs to global user IDs + # + # @option options [Object] :users + # A comma-separated list of user ids, up to 400 per request + # @option options [Object] :to_old + # Specify true to convert W global user IDs to workspace-specific U IDs. Defaults to false. + # @see https://api.slack.com/methods/migration.exchange + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/migration.exchange.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/migration.exchange.json + def migration_exchange(options={}) + throw ArgumentError.new("Required arguments :users missing") if options[:users].nil? + post("migration.exchange", options) + end + + end + end +end diff --git a/lib/slack/endpoint/mpim.rb b/lib/slack/endpoint/mpim.rb index 7634142..fc4bf1a 100644 --- a/lib/slack/endpoint/mpim.rb +++ b/lib/slack/endpoint/mpim.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Mpim # - # This method closes a multiparty direct message channel. + # Closes a multiparty direct message channel. # # @option options [Object] :channel # MPIM to close. @@ -17,9 +17,7 @@ def mpim_close(options={}) end # - # This method returns a portion of messages/events from the specified multiparty direct message channel. - # To read the entire history for a multiparty direct message, call the method with no latest or - # oldest arguments, and then continue paging using the instructions below. + # Fetches history of messages and events from a multiparty direct message. # # @option options [Object] :channel # Multiparty direct message to fetch history for. @@ -42,7 +40,7 @@ def mpim_history(options={}) end # - # This method returns a list of all multiparty direct message channels that the user has. + # Lists multiparty direct message channels for the calling user. # # @see https://api.slack.com/methods/mpim.list # @see https://github.com/aki017/slack-api-docs/blob/master/methods/mpim.list.md @@ -52,7 +50,7 @@ def mpim_list(options={}) end # - # This method moves the read cursor in a multiparty direct message channel. + # Sets the read cursor in a multiparty direct message channel. # # @option options [Object] :channel # multiparty direct message channel to set reading cursor in. @@ -81,7 +79,7 @@ def mpim_open(options={}) end # - # This method returns an entire thread (a message plus all the messages in reply to it). + # Retrieve a thread of messages posted to a direct message conversation from a multiparty direct message. # # @option options [Object] :channel # Multiparty direct message channel to fetch thread from. diff --git a/lib/slack/endpoint/oauth.rb b/lib/slack/endpoint/oauth.rb index 1294160..1268f68 100644 --- a/lib/slack/endpoint/oauth.rb +++ b/lib/slack/endpoint/oauth.rb @@ -4,8 +4,7 @@ module Slack module Endpoint module Oauth # - # This method allows you to exchange a temporary OAuth code for an API access token. - # This is used as part of the OAuth authentication flow. + # Exchanges a temporary OAuth code for an API token. # # @option options [Object] :client_id # Issued when you created your application. @@ -25,6 +24,29 @@ def oauth_access(options={}) post("oauth.access", options) end + # + # Exchanges a temporary OAuth verifier code for a workspace token. + # + # @option options [Object] :client_id + # Issued when you created your application. + # @option options [Object] :client_secret + # Issued when you created your application. + # @option options [Object] :code + # The code param returned via the OAuth callback. + # @option options [Object] :redirect_uri + # This must match the originally submitted URI (if one was sent). + # @option options [Object] :single_channel + # Request the user to add your app only to a single channel. + # @see https://api.slack.com/methods/oauth.token + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/oauth.token.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/oauth.token.json + def oauth_token(options={}) + throw ArgumentError.new("Required arguments :client_id missing") if options[:client_id].nil? + throw ArgumentError.new("Required arguments :client_secret missing") if options[:client_secret].nil? + throw ArgumentError.new("Required arguments :code missing") if options[:code].nil? + post("oauth.token", options) + end + end end end diff --git a/lib/slack/endpoint/pins.rb b/lib/slack/endpoint/pins.rb index 873ac72..9f0a5a6 100644 --- a/lib/slack/endpoint/pins.rb +++ b/lib/slack/endpoint/pins.rb @@ -4,8 +4,7 @@ module Slack module Endpoint module Pins # - # This method pins an item (file, file comment, channel message, or group message) to a particular channel. - # The channel argument is required and one of file, file_comment, or timestamp must also be specified. + # Pins an item to a channel. # # @option options [Object] :channel # Channel to pin the item in. @@ -24,7 +23,7 @@ def pins_add(options={}) end # - # This method lists the items pinned to a channel. + # Lists items pinned to a channel. # # @option options [Object] :channel # Channel to get pinned items for. @@ -37,8 +36,7 @@ def pins_list(options={}) end # - # This method un-pins an item (file, file comment, channel message, or group message) from a channel. - # The channel argument is required and one of file, file_comment, or timestamp must also be specified. + # Un-pins an item from a channel. # # @option options [Object] :channel # Channel where the item is pinned to. diff --git a/lib/slack/endpoint/reactions.rb b/lib/slack/endpoint/reactions.rb index 56c22f4..5954472 100644 --- a/lib/slack/endpoint/reactions.rb +++ b/lib/slack/endpoint/reactions.rb @@ -4,8 +4,7 @@ module Slack module Endpoint module Reactions # - # This method adds a reaction (emoji) to an item (file, file comment, channel message, group message, or direct message). - # One of file, file_comment, or the combination of channel and timestamp must be specified. + # Adds a reaction to an item. # # @option options [Object] :name # Reaction (emoji) name. @@ -26,7 +25,7 @@ def reactions_add(options={}) end # - # This method returns a list of all reactions for a single item (file, file comment, channel message, group message, or direct message). + # Gets reactions for an item. # # @option options [Object] :channel # Channel where the message to get reactions for was posted. @@ -46,7 +45,7 @@ def reactions_get(options={}) end # - # This method returns a list of all items (file, file comment, channel message, group message, or direct message) reacted to by a user. + # Lists reactions made by a user. # # @option options [Object] :count # Number of items to return per page. @@ -64,8 +63,7 @@ def reactions_list(options={}) end # - # This method removes a reaction (emoji) from an item (file, file comment, channel message, group message, or direct message). - # One of file, file_comment, or the combination of channel and timestamp must be specified. + # Removes a reaction from an item. # # @option options [Object] :name # Reaction (emoji) name. diff --git a/lib/slack/endpoint/reminders.rb b/lib/slack/endpoint/reminders.rb index 06ef0f3..03c05a1 100644 --- a/lib/slack/endpoint/reminders.rb +++ b/lib/slack/endpoint/reminders.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Reminders # - # This method creates a reminder. + # Creates a reminder. # # @option options [Object] :text # The content of the reminder @@ -22,7 +22,7 @@ def reminders_add(options={}) end # - # This method completes a reminder. + # Marks a reminder as complete. # # @option options [Object] :reminder # The ID of the reminder to be marked as complete @@ -35,7 +35,7 @@ def reminders_complete(options={}) end # - # This method deletes a reminder. + # Deletes a reminder. # # @option options [Object] :reminder # The ID of the reminder @@ -48,7 +48,7 @@ def reminders_delete(options={}) end # - # This method returns information about a reminder. + # Gets information about a reminder. # # @option options [Object] :reminder # The ID of the reminder @@ -61,7 +61,7 @@ def reminders_info(options={}) end # - # This method lists all reminders created by or for a given user. + # Lists all reminders created by or for a given user. # # @see https://api.slack.com/methods/reminders.list # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reminders.list.md diff --git a/lib/slack/endpoint/search.rb b/lib/slack/endpoint/search.rb index f6be75c..9d39479 100644 --- a/lib/slack/endpoint/search.rb +++ b/lib/slack/endpoint/search.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Search # - # This method allows users and applications to search both messages and files in a single call. + # Searches for messages and files matching a query. # # @option options [Object] :query # Search query. May contains booleans, etc. @@ -27,7 +27,7 @@ def search_all(options={}) end # - # This method returns files matching a search query. + # Searches for files matching a query. # # @option options [Object] :query # Search query. May contain booleans, etc. @@ -50,12 +50,12 @@ def search_files(options={}) end # - # This method returns messages matching a search query. + # Searches for messages matching a query. # # @option options [Object] :query # Search query. May contains booleans, etc. # @option options [Object] :count - # Number of items to return per page. + # Pass the number of results you want per "page". Maximum of 100. # @option options [Object] :highlight # Pass a value of true to enable query highlight markers (see below). # @option options [Object] :page diff --git a/lib/slack/endpoint/stars.rb b/lib/slack/endpoint/stars.rb index 84f58c2..025efa2 100644 --- a/lib/slack/endpoint/stars.rb +++ b/lib/slack/endpoint/stars.rb @@ -4,8 +4,7 @@ module Slack module Endpoint module Stars # - # This method adds a star to an item (message, file, file comment, channel, private group, or DM) on behalf of the authenticated user. - # One of file, file_comment, channel, or the combination of channel and timestamp must be specified. + # Adds a star to an item. # # @option options [Object] :channel # Channel to add star to, or channel where the message to add star to was posted (used with timestamp). @@ -23,7 +22,7 @@ def stars_add(options={}) end # - # This method lists the items starred by the authed user. + # Lists stars for a user. # # @option options [Object] :count # Number of items to return per page. @@ -37,8 +36,7 @@ def stars_list(options={}) end # - # This method removes a star from an item (message, file, file comment, channel, private group, or DM) on behalf of the authenticated user. - # One of file, file_comment, channel, or the combination of channel and timestamp must be specified. + # Removes a star from an item. # # @option options [Object] :channel # Channel to remove star from, or channel where the message to remove star from was posted (used with timestamp). diff --git a/lib/slack/endpoint/team.rb b/lib/slack/endpoint/team.rb index 3722c6d..a2bded6 100644 --- a/lib/slack/endpoint/team.rb +++ b/lib/slack/endpoint/team.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Team # - # This method is used to get the access logs for users on a team. + # Gets the access logs for the current team. # # @option options [Object] :before # End of time range of logs to include in results (inclusive). @@ -20,8 +20,7 @@ def team_accessLogs(options={}) end # - # This method lists billable information for each user on the team. Currently this consists solely of whether the user is - # subject to billing per Slack's Fair Billing policy. + # Gets billable users information for the current team. # # @option options [Object] :user # A user to retrieve the billable information for. Defaults to all users. @@ -33,7 +32,7 @@ def team_billableInfo(options={}) end # - # This method provides information about your team. + # Gets information about the current team. # # @see https://api.slack.com/methods/team.info # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.info.md @@ -43,7 +42,7 @@ def team_info(options={}) end # - # This method lists the integration activity logs for a team, including when integrations are added, modified and removed. This method can only be called by Admins. + # Gets the integration logs for the current team. # # @option options [Object] :app_id # Filter logs to this Slack app. Defaults to all logs. @@ -65,7 +64,7 @@ def team_integrationLogs(options={}) end # - # This method is used to get the profile field definitions for this team. + # Retrieve a team's profile. # # @option options [Object] :visibility # Filter by visibility. diff --git a/lib/slack/endpoint/usergroups.rb b/lib/slack/endpoint/usergroups.rb index 8fbb9b4..edc381b 100644 --- a/lib/slack/endpoint/usergroups.rb +++ b/lib/slack/endpoint/usergroups.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Usergroups # - # This method is used to create a User Group. + # Create a User Group # # @option options [Object] :name # A name for the User Group. Must be unique among User Groups. @@ -25,7 +25,7 @@ def usergroups_create(options={}) end # - # This method disables an existing User Group. + # Disable an existing User Group # # @option options [Object] :usergroup # The encoded ID of the User Group to disable. @@ -40,7 +40,7 @@ def usergroups_disable(options={}) end # - # This method enables a User Group which was previously disabled. + # Enable a User Group # # @option options [Object] :usergroup # The encoded ID of the User Group to enable. @@ -55,7 +55,7 @@ def usergroups_enable(options={}) end # - # This method returns a list of all User Groups in the team. This can optionally include disabled User Groups. + # List all User Groups for a team # # @option options [Object] :include_count # Include the number of users in each User Group. @@ -71,7 +71,7 @@ def usergroups_list(options={}) end # - # This method updates the properties of an existing User Group. + # Update an existing User Group # # @option options [Object] :usergroup # The encoded ID of the User Group to update. @@ -94,7 +94,7 @@ def usergroups_update(options={}) end # - # This method returns a list of all users within a User Group. + # List all users in a User Group # # @option options [Object] :usergroup # The encoded ID of the User Group to update. @@ -109,7 +109,7 @@ def usergroups_users_list(options={}) end # - # This method updates the list of users that belong to a User Group. This method replaces all users in a User Group with the list of users provided in the users parameter. + # Update the list of users for a User Group # # @option options [Object] :usergroup # The encoded ID of the User Group to update. diff --git a/lib/slack/endpoint/users.rb b/lib/slack/endpoint/users.rb index 2d53bfe..12c3641 100644 --- a/lib/slack/endpoint/users.rb +++ b/lib/slack/endpoint/users.rb @@ -4,7 +4,7 @@ module Slack module Endpoint module Users # - # This method allows the user to delete their profile image. It will clear whatever image is currently set. + # Delete the user profile photo # # @see https://api.slack.com/methods/users.deletePhoto # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.deletePhoto.md @@ -14,8 +14,7 @@ def users_deletePhoto(options={}) end # - # This method lets you find out information about a user's presence. - # Consult the presence documentation for more details. + # Gets user presence information. # # @option options [Object] :user # User to get presence info on. Defaults to the authed user. @@ -28,7 +27,7 @@ def users_getPresence(options={}) end # - # After your Slack app is awarded an identity token through Sign in with Slack, use this method to retrieve a user's identity. + # Get a user's identity. # # @see https://api.slack.com/methods/users.identity # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.identity.md @@ -38,10 +37,12 @@ def users_identity(options={}) end # - # This method returns information about a team member. + # Gets information about a user. # # @option options [Object] :user # User to get info on + # @option options [Object] :include_locale + # Set this to true to receive the locale for this user. Defaults to false # @see https://api.slack.com/methods/users.info # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.info.md # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.info.json @@ -51,14 +52,16 @@ def users_info(options={}) end # - # This method returns a list of all users in the team. This includes deleted/deactivated users. + # Lists all users in a Slack team. # # @option options [Object] :cursor # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail. + # @option options [Object] :include_locale + # Set this to true to receive the locale for users. Defaults to false # @option options [Object] :limit # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. # @option options [Object] :presence - # Whether to include presence data in the output. Setting this to false improves performance, especially with large teams. + # Whether to include presence data in the output. Defaults to false. Setting this to true reduces performance, especially with large teams. # @see https://api.slack.com/methods/users.list # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.list.md # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.list.json @@ -67,7 +70,20 @@ def users_list(options={}) end # - # Use this method to retrieve a user's profile information. + # Find a user with an email address. + # + # @option options [Object] :email + # An email address belonging to a user in the workspace + # @see https://api.slack.com/methods/users.lookupByEmail + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.lookupByEmail.md + # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.lookupByEmail.json + def users_lookupByEmail(options={}) + throw ArgumentError.new("Required arguments :email missing") if options[:email].nil? + post("users.lookupByEmail", options) + end + + # + # Retrieves a user's profile information. # # @option options [Object] :include_labels # Include labels for each ID in custom profile fields @@ -81,7 +97,7 @@ def users_profile_get(options={}) end # - # Use this method to set a user's profile information, including name, email, current status, and other attributes. + # Set the profile information for a user. # # @option options [Object] :name # Name of a single key to set. Usable only if profile is not passed. @@ -99,9 +115,7 @@ def users_profile_set(options={}) end # - # This method lets the slack messaging server know that the authenticated user - # is currently active. Consult the presence documentation for - # more details. + # Marks a user as active. # # @see https://api.slack.com/methods/users.setActive # @see https://github.com/aki017/slack-api-docs/blob/master/methods/users.setActive.md @@ -111,7 +125,7 @@ def users_setActive(options={}) end # - # This method allows the user to set their profile image. The caller can pass image data via image. + # Set the user profile photo # # @option options [Object] :image # File contents via multipart/form-data. @@ -130,8 +144,7 @@ def users_setPhoto(options={}) end # - # This method lets you set the calling user's manual presence. - # Consult the presence documentation for more details. + # Manually sets user presence. # # @option options [Object] :presence # Either auto or away diff --git a/slack-api-docs b/slack-api-docs index 098ffde..bc0a62c 160000 --- a/slack-api-docs +++ b/slack-api-docs @@ -1 +1 @@ -Subproject commit 098ffdeb0792f09f88802c52795dafb08af30942 +Subproject commit bc0a62c4df021e7ad56408bc12903fd10cc2389d