slack-api 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2891cd4a06dfc68f65ba2ad8628980ddc008ddba
4
- data.tar.gz: ff8a862175ad65f0a76d18a1d46f07470f07fa49
3
+ metadata.gz: d733fd2e54c01346b1bf784ee5a840708b04a27a
4
+ data.tar.gz: 29d36932c6af2272be8af07c1bb4246332070759
5
5
  SHA512:
6
- metadata.gz: 07de10a285ece0080aa4b47309c0432298da56d942c96cdb6407b3c0007525e95fd2f97ff6e08fee6894fa04cbed2fb3dc1c70915fff043763be5b918d3e90d7
7
- data.tar.gz: 2611525bec9c74a89b939bf6ecc7b9fa6757f83054345b818b9b28c48b73c7b6b5caf2118cb257f3caa28d0884e89d7b1e7326a8169fc27925a963b849768e93
6
+ metadata.gz: 515445957b4cf4cab76231b70ca9bd0b94461ba7c3a0b24fd94b468f6ca7518f493b290ad3e7794b44fd281c9c92c538a0d346cf4c65f930b0d7ed13f7aa6f8a
7
+ data.tar.gz: fb4a93bfb759610fb23b27a27abd4b69c142e4232bb478c08b6573bdba7bcfb5bc361cb6009174305ade1bc07122670e4d0d2f1396cae42a612a6bda7534636b
@@ -1,10 +1,13 @@
1
1
  # This file was auto-generated by lib/generators/tasks/generate.rb
2
2
  #
3
3
  require_relative 'endpoint/api'
4
+ require_relative 'endpoint/apps'
4
5
  require_relative 'endpoint/auth'
5
6
  require_relative 'endpoint/bots'
6
7
  require_relative 'endpoint/channels'
7
8
  require_relative 'endpoint/chat'
9
+ require_relative 'endpoint/conversations'
10
+ require_relative 'endpoint/dialog'
8
11
  require_relative 'endpoint/discovery'
9
12
  require_relative 'endpoint/dnd'
10
13
  require_relative 'endpoint/emoji'
@@ -12,6 +15,7 @@ require_relative 'endpoint/files'
12
15
  require_relative 'endpoint/groups'
13
16
  require_relative 'endpoint/idpgroups'
14
17
  require_relative 'endpoint/im'
18
+ require_relative 'endpoint/migration'
15
19
  require_relative 'endpoint/mpim'
16
20
  require_relative 'endpoint/oauth'
17
21
  require_relative 'endpoint/pins'
@@ -27,10 +31,13 @@ require_relative 'endpoint/users'
27
31
  module Slack
28
32
  module Endpoint
29
33
  include Api
34
+ include Apps
30
35
  include Auth
31
36
  include Bots
32
37
  include Channels
33
38
  include Chat
39
+ include Conversations
40
+ include Dialog
34
41
  include Discovery
35
42
  include Dnd
36
43
  include Emoji
@@ -38,6 +45,7 @@ module Slack
38
45
  include Groups
39
46
  include Idpgroups
40
47
  include Im
48
+ include Migration
41
49
  include Mpim
42
50
  include Oauth
43
51
  include Pins
@@ -4,7 +4,7 @@ module Slack
4
4
  module Endpoint
5
5
  module Api
6
6
  #
7
- # This method helps you test your calling code.
7
+ # Checks API calling code.
8
8
  #
9
9
  # @option options [Object] :error
10
10
  # Error response to return
@@ -0,0 +1,34 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Apps
6
+ #
7
+ # Returns list of permissions this app has on a team.
8
+ #
9
+ # @see https://api.slack.com/methods/apps.permissions.info
10
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/apps.permissions.info.md
11
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/apps.permissions.info.json
12
+ def apps_permissions_info(options={})
13
+ post("apps.permissions.info", options)
14
+ end
15
+
16
+ #
17
+ # Allows an app to request additional scopes
18
+ #
19
+ # @option options [Object] :scopes
20
+ # A comma separated list of scopes to request for
21
+ # @option options [Object] :trigger_id
22
+ # Token used to trigger the permissions API
23
+ # @see https://api.slack.com/methods/apps.permissions.request
24
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/apps.permissions.request.md
25
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/apps.permissions.request.json
26
+ def apps_permissions_request(options={})
27
+ throw ArgumentError.new("Required arguments :scopes missing") if options[:scopes].nil?
28
+ throw ArgumentError.new("Required arguments :trigger_id missing") if options[:trigger_id].nil?
29
+ post("apps.permissions.request", options)
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -4,7 +4,7 @@ module Slack
4
4
  module Endpoint
5
5
  module Auth
6
6
  #
7
- # 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.
7
+ # Revokes a token.
8
8
  #
9
9
  # @option options [Object] :test
10
10
  # Setting this parameter to 1 triggers a testing mode where the specified token will not actually be revoked.
@@ -16,7 +16,7 @@ module Slack
16
16
  end
17
17
 
18
18
  #
19
- # This method checks authentication and tells you who you are.
19
+ # Checks authentication & identity.
20
20
  #
21
21
  # @see https://api.slack.com/methods/auth.test
22
22
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/auth.test.md
@@ -4,7 +4,7 @@ module Slack
4
4
  module Endpoint
5
5
  module Bots
6
6
  #
7
- # This method returns information about a bot user.
7
+ # Gets information about a bot user.
8
8
  #
9
9
  # @option options [Object] :bot
10
10
  # Bot user to get info on
@@ -4,7 +4,7 @@ module Slack
4
4
  module Endpoint
5
5
  module Channels
6
6
  #
7
- # This method archives a channel.
7
+ # Archives a channel.
8
8
  #
9
9
  # @option options [Object] :channel
10
10
  # Channel to archive
@@ -17,7 +17,7 @@ module Slack
17
17
  end
18
18
 
19
19
  #
20
- # This method is used to create a channel.
20
+ # Creates a channel.
21
21
  #
22
22
  # @option options [Object] :name
23
23
  # Name of channel to create
@@ -32,18 +32,18 @@ module Slack
32
32
  end
33
33
 
34
34
  #
35
- # This method returns a portion of message events from the specified public channel.
35
+ # Fetches history of messages and events from a channel.
36
36
  #
37
37
  # @option options [Object] :channel
38
38
  # Channel to fetch history for.
39
+ # @option options [Object] :count
40
+ # Number of messages to return, between 1 and 1000.
41
+ # @option options [Object] :inclusive
42
+ # Include messages with latest or oldest timestamp in results.
39
43
  # @option options [Object] :latest
40
44
  # End of time range of messages to include in results.
41
45
  # @option options [Object] :oldest
42
46
  # Start of time range of messages to include in results.
43
- # @option options [Object] :inclusive
44
- # Include messages with latest or oldest timestamp in results.
45
- # @option options [Object] :count
46
- # Number of messages to return, between 1 and 1000.
47
47
  # @option options [Object] :unreads
48
48
  # Include unread_count_display in the output?
49
49
  # @see https://api.slack.com/methods/channels.history
@@ -55,10 +55,12 @@ module Slack
55
55
  end
56
56
 
57
57
  #
58
- # This method returns information about a team channel.
58
+ # Gets information about a channel.
59
59
  #
60
60
  # @option options [Object] :channel
61
61
  # Channel to get info on
62
+ # @option options [Object] :include_locale
63
+ # Set this to true to receive the locale for this channel. Defaults to false
62
64
  # @see https://api.slack.com/methods/channels.info
63
65
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.info.md
64
66
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.info.json
@@ -68,7 +70,7 @@ module Slack
68
70
  end
69
71
 
70
72
  #
71
- # This method is used to invite a user to a channel. The calling user must be a member of the channel.
73
+ # Invites a user to a channel.
72
74
  #
73
75
  # @option options [Object] :channel
74
76
  # Channel to invite user to.
@@ -84,8 +86,7 @@ module Slack
84
86
  end
85
87
 
86
88
  #
87
- # This method is used to join a channel. If the channel does not exist, it is
88
- # created.
89
+ # Joins a channel, creating it if needed.
89
90
  #
90
91
  # @option options [Object] :name
91
92
  # Name of channel to join
@@ -100,7 +101,7 @@ module Slack
100
101
  end
101
102
 
102
103
  #
103
- # This method allows a user to remove another member from a team channel.
104
+ # Removes a user from a channel.
104
105
  #
105
106
  # @option options [Object] :channel
106
107
  # Channel to remove user from.
@@ -116,7 +117,7 @@ module Slack
116
117
  end
117
118
 
118
119
  #
119
- # This method is used to leave a channel.
120
+ # Leaves a channel.
120
121
  #
121
122
  # @option options [Object] :channel
122
123
  # Channel to leave
@@ -129,12 +130,16 @@ module Slack
129
130
  end
130
131
 
131
132
  #
132
- # 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.
133
+ # Lists all channels in a Slack team.
133
134
  #
135
+ # @option options [Object] :cursor
136
+ # 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.
134
137
  # @option options [Object] :exclude_archived
135
138
  # Exclude archived channels from the list
136
139
  # @option options [Object] :exclude_members
137
140
  # Exclude the members collection from each channel
141
+ # @option options [Object] :limit
142
+ # 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.
138
143
  # @see https://api.slack.com/methods/channels.list
139
144
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.list.md
140
145
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/channels.list.json
@@ -143,7 +148,7 @@ module Slack
143
148
  end
144
149
 
145
150
  #
146
- # This method moves the read cursor in a channel.
151
+ # Sets the read cursor in a channel.
147
152
  #
148
153
  # @option options [Object] :channel
149
154
  # Channel to set reading cursor in.
@@ -159,7 +164,7 @@ module Slack
159
164
  end
160
165
 
161
166
  #
162
- # This method renames a team channel.
167
+ # Renames a channel.
163
168
  #
164
169
  # @option options [Object] :channel
165
170
  # Channel to rename
@@ -177,7 +182,7 @@ module Slack
177
182
  end
178
183
 
179
184
  #
180
- # This method returns an entire thread (a message plus all the messages in reply to it).
185
+ # Retrieve a thread of messages posted to a channel
181
186
  #
182
187
  # @option options [Object] :channel
183
188
  # Channel to fetch thread from
@@ -193,7 +198,7 @@ module Slack
193
198
  end
194
199
 
195
200
  #
196
- # This method is used to change the purpose of a channel. The calling user must be a member of the channel.
201
+ # Sets the purpose for a channel.
197
202
  #
198
203
  # @option options [Object] :channel
199
204
  # Channel to set the purpose of
@@ -209,7 +214,7 @@ module Slack
209
214
  end
210
215
 
211
216
  #
212
- # This method is used to change the topic of a channel. The calling user must be a member of the channel.
217
+ # Sets the topic for a channel.
213
218
  #
214
219
  # @option options [Object] :channel
215
220
  # Channel to set the topic of
@@ -225,7 +230,7 @@ module Slack
225
230
  end
226
231
 
227
232
  #
228
- # This method unarchives a channel. The calling user is added to the channel.
233
+ # Unarchives a channel.
229
234
  #
230
235
  # @option options [Object] :channel
231
236
  # Channel to unarchive
@@ -4,25 +4,41 @@ module Slack
4
4
  module Endpoint
5
5
  module Chat
6
6
  #
7
- # This method deletes a message from a channel.
7
+ # Deletes a message.
8
8
  #
9
- # @option options [Object] :ts
10
- # Timestamp of the message to be deleted.
11
9
  # @option options [Object] :channel
12
10
  # Channel containing the message to be deleted.
11
+ # @option options [Object] :ts
12
+ # Timestamp of the message to be deleted.
13
13
  # @option options [Object] :as_user
14
- # Pass true to delete the message as the authed user. Bot users in this context are considered authed users.
14
+ # 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.
15
15
  # @see https://api.slack.com/methods/chat.delete
16
16
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.delete.md
17
17
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.delete.json
18
18
  def chat_delete(options={})
19
- throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
20
19
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
20
+ throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
21
21
  post("chat.delete", options)
22
22
  end
23
23
 
24
24
  #
25
- # This method sends a me message to a channel from the calling user.
25
+ # Retrieve a permalink URL for a specific extant message
26
+ #
27
+ # @option options [Object] :channel
28
+ # The ID of the conversation or channel containing the message
29
+ # @option options [Object] :message_ts
30
+ # A message's ts value, uniquely identifying it within a channel
31
+ # @see https://api.slack.com/methods/chat.getPermalink
32
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.getPermalink.md
33
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.getPermalink.json
34
+ def chat_getPermalink(options={})
35
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
36
+ throw ArgumentError.new("Required arguments :message_ts missing") if options[:message_ts].nil?
37
+ post("chat.getPermalink", options)
38
+ end
39
+
40
+ #
41
+ # Share a me message into a channel.
26
42
  #
27
43
  # @option options [Object] :channel
28
44
  # Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.
@@ -38,34 +54,62 @@ module Slack
38
54
  end
39
55
 
40
56
  #
41
- # This method posts a message to a public channel, private channel, or direct message/IM channel.
57
+ # Sends an ephemeral message to a user in a channel.
42
58
  #
43
59
  # @option options [Object] :channel
44
- # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
60
+ # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
45
61
  # @option options [Object] :text
46
62
  # 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.
63
+ # @option options [Object] :user
64
+ # id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.
65
+ # @option options [Object] :as_user
66
+ # Pass true to post the message as the authed bot. Defaults to false.
67
+ # @option options [Object] :attachments
68
+ # A JSON-based array of structured attachments, presented as a URL-encoded string.
69
+ # @option options [Object] :link_names
70
+ # Find and link channel names and usernames.
47
71
  # @option options [Object] :parse
48
72
  # Change how messages are treated. Defaults to none. See below.
73
+ # @see https://api.slack.com/methods/chat.postEphemeral
74
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.postEphemeral.md
75
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.postEphemeral.json
76
+ def chat_postEphemeral(options={})
77
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
78
+ throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
79
+ throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
80
+ options[:attachments] = options[:attachments].to_json if options[:attachments].is_a?(Array) || options[:attachments].is_a?(Hash)
81
+ post("chat.postEphemeral", options)
82
+ end
83
+
84
+ #
85
+ # Sends a message to a channel.
86
+ #
87
+ # @option options [Object] :channel
88
+ # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
89
+ # @option options [Object] :text
90
+ # 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.
91
+ # @option options [Object] :as_user
92
+ # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
93
+ # @option options [Object] :attachments
94
+ # A JSON-based array of structured attachments, presented as a URL-encoded string.
95
+ # @option options [Object] :icon_emoji
96
+ # 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.
97
+ # @option options [Object] :icon_url
98
+ # URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
49
99
  # @option options [Object] :link_names
50
100
  # Find and link channel names and usernames.
51
- # @option options [Object] :attachments
52
- # Structured message attachments.
101
+ # @option options [Object] :parse
102
+ # Change how messages are treated. Defaults to none. See below.
103
+ # @option options [Object] :reply_broadcast
104
+ # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
105
+ # @option options [Object] :thread_ts
106
+ # Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
53
107
  # @option options [Object] :unfurl_links
54
108
  # Pass true to enable unfurling of primarily text-based content.
55
109
  # @option options [Object] :unfurl_media
56
110
  # Pass false to disable unfurling of media content.
57
111
  # @option options [Object] :username
58
112
  # Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
59
- # @option options [Object] :as_user
60
- # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
61
- # @option options [Object] :icon_url
62
- # URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
63
- # @option options [Object] :icon_emoji
64
- # 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.
65
- # @option options [Object] :thread_ts
66
- # Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
67
- # @option options [Object] :reply_broadcast
68
- # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
69
113
  # @see https://api.slack.com/methods/chat.postMessage
70
114
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.postMessage.md
71
115
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.postMessage.json
@@ -77,16 +121,20 @@ module Slack
77
121
  end
78
122
 
79
123
  #
80
- # 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.
124
+ # Provide custom unfurl behavior for user-posted URLs
81
125
  #
82
126
  # @option options [Object] :channel
83
127
  # Channel ID of the message
84
128
  # @option options [Object] :ts
85
- # Timestamp of the message to add unfurl behavior to
129
+ # Timestamp of the message to add unfurl behavior to.
86
130
  # @option options [Object] :unfurls
87
- # JSON mapping a set of URLs from the message to their unfurl attachments
131
+ # URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl message attachments.
132
+ # @option options [Object] :user_auth_message
133
+ # Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior
88
134
  # @option options [Object] :user_auth_required
89
135
  # Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain
136
+ # @option options [Object] :user_auth_url
137
+ # Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.
90
138
  # @see https://api.slack.com/methods/chat.unfurl
91
139
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.unfurl.md
92
140
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.unfurl.json
@@ -98,29 +146,29 @@ module Slack
98
146
  end
99
147
 
100
148
  #
101
- # This method updates a message in a channel. Though related to chat.postMessage, some parameters of chat.update are handled differently.
149
+ # Updates a message.
102
150
  #
103
- # @option options [Object] :ts
104
- # Timestamp of the message to be updated.
105
151
  # @option options [Object] :channel
106
152
  # Channel containing the message to be updated.
107
153
  # @option options [Object] :text
108
- # New text for the message, using the default formatting rules.
154
+ # New text for the message, using the default formatting rules. It's not required when presenting attachments.
155
+ # @option options [Object] :ts
156
+ # Timestamp of the message to be updated.
157
+ # @option options [Object] :as_user
158
+ # Pass true to update the message as the authed user. Bot users in this context are considered authed users.
109
159
  # @option options [Object] :attachments
110
- # Structured message attachments.
111
- # @option options [Object] :parse
112
- # Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.
160
+ # A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text.
113
161
  # @option options [Object] :link_names
114
162
  # 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.
115
- # @option options [Object] :as_user
116
- # Pass true to update the message as the authed user. Bot users in this context are considered authed users.
163
+ # @option options [Object] :parse
164
+ # Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.
117
165
  # @see https://api.slack.com/methods/chat.update
118
166
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.update.md
119
167
  # @see https://github.com/aki017/slack-api-docs/blob/master/methods/chat.update.json
120
168
  def chat_update(options={})
121
- throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
122
169
  throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
123
170
  throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
171
+ throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
124
172
  options[:attachments] = options[:attachments].to_json if options[:attachments].is_a?(Array) || options[:attachments].is_a?(Hash)
125
173
  post("chat.update", options)
126
174
  end