Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

Commit

Permalink
rake api:update
Browse files Browse the repository at this point in the history
  • Loading branch information
aki017 committed Jan 20, 2018
1 parent 40ea0ba commit fca8643
Show file tree
Hide file tree
Showing 26 changed files with 590 additions and 134 deletions.
8 changes: 8 additions & 0 deletions lib/slack/endpoint.rb
@@ -1,17 +1,21 @@
# 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'
require_relative 'endpoint/files'
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'
Expand All @@ -27,17 +31,21 @@
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
include Files
include Groups
include Idpgroups
include Im
include Migration
include Mpim
include Oauth
include Pins
Expand Down
2 changes: 1 addition & 1 deletion lib/slack/endpoint/api.rb
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions 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
4 changes: 2 additions & 2 deletions lib/slack/endpoint/auth.rb
Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/slack/endpoint/bots.rb
Expand Up @@ -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
Expand Down
37 changes: 21 additions & 16 deletions lib/slack/endpoint/channels.rb
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
70 changes: 59 additions & 11 deletions lib/slack/endpoint/chat.rb
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit fca8643

Please sign in to comment.