slack-api 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,75 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Chat
6
+ #
7
+ # Deletes a message.
8
+ #
9
+ # @option options [Object] :ts
10
+ # Timestamp of the message to be deleted.
11
+ # @option options [channel] :channel
12
+ # Channel containing the message to be deleted.
13
+ # @see https://api.slack.com/methods/chat.delete
14
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.delete.md
15
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.delete.json
16
+ def chat_delete(options={})
17
+ throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
18
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
19
+ post("chat.delete", options)
20
+ end
21
+
22
+ #
23
+ # Sends a message to a channel.
24
+ #
25
+ # @option options [channel] :channel
26
+ # Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.
27
+ # @option options [Object] :text
28
+ # Text of the message to send. See below for an explanation of formatting.
29
+ # @option options [Object] :username
30
+ # Name of bot.
31
+ # @option options [Object] :parse
32
+ # Change how messages are treated. See below.
33
+ # @option options [Object] :link_names
34
+ # Find and link channel names and usernames.
35
+ # @option options [Object] :attachments
36
+ # Structured message attachments.
37
+ # @option options [Object] :unfurl_links
38
+ # Pass true to enable unfurling of primarily text-based content.
39
+ # @option options [Object] :unfurl_media
40
+ # Pass false to disable unfurling of media content.
41
+ # @option options [Object] :icon_url
42
+ # URL to an image to use as the icon for this message
43
+ # @option options [Object] :icon_emoji
44
+ # emoji to use as the icon for this message. Overrides `icon_url`.
45
+ # @see https://api.slack.com/methods/chat.postMessage
46
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.postMessage.md
47
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.postMessage.json
48
+ def chat_postMessage(options={})
49
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
50
+ throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
51
+ post("chat.postMessage", options)
52
+ end
53
+
54
+ #
55
+ # Updates a message.
56
+ #
57
+ # @option options [Object] :ts
58
+ # Timestamp of the message to be updated.
59
+ # @option options [channel] :channel
60
+ # Channel containing the message to be updated.
61
+ # @option options [Object] :text
62
+ # New text for the message, using the [default formatting rules](/docs/formatting).
63
+ # @see https://api.slack.com/methods/chat.update
64
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.update.md
65
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/chat.update.json
66
+ def chat_update(options={})
67
+ throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
68
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
69
+ throw ArgumentError.new("Required arguments :text missing") if options[:text].nil?
70
+ post("chat.update", options)
71
+ end
72
+
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,18 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Emoji
6
+ #
7
+ # Lists custom emoji for a team.
8
+ #
9
+ # @see https://api.slack.com/methods/emoji.list
10
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/emoji.list.md
11
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/emoji.list.json
12
+ def emoji_list(options={})
13
+ post("emoji.list", options)
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,73 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Files
6
+ #
7
+ # Gets information about a team file.
8
+ #
9
+ # @option options [file] :file
10
+ # File to fetch info for
11
+ # @see https://api.slack.com/methods/files.info
12
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.info.md
13
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.info.json
14
+ def files_info(options={})
15
+ throw ArgumentError.new("Required arguments :file missing") if options[:file].nil?
16
+ post("files.info", options)
17
+ end
18
+
19
+ #
20
+ # Lists & filters team files.
21
+ #
22
+ # @option options [user] :user
23
+ # Filter files created by a single user.
24
+ # @option options [Object] :ts_from
25
+ # Filter files created after this timestamp (inclusive).
26
+ # @option options [Object] :ts_to
27
+ # Filter files created before this timestamp (inclusive).
28
+ # @option options [Object] :types
29
+ # Filter files by type:
30
+ #
31
+ # * `all` - All files
32
+ # * `posts` - Posts
33
+ # * `snippets` - Snippets
34
+ # * `images` - Image files
35
+ # * `gdocs` - Google docs
36
+ # * `zips` - Zip files
37
+ # * `pdfs` - PDF files
38
+ #
39
+ # You can pass multiple values in the types argument, like `types=posts,snippets`.The default value is `all`, which does not filter the list.
40
+ # @see https://api.slack.com/methods/files.list
41
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.list.md
42
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.list.json
43
+ def files_list(options={})
44
+ post("files.list", options)
45
+ end
46
+
47
+ #
48
+ # Uploads or creates a file.
49
+ #
50
+ # @option options [Object] :file
51
+ # File contents via `multipart/form-data`.
52
+ # @option options [Object] :content
53
+ # File contents via a POST var.
54
+ # @option options [Object] :filetype
55
+ # Slack-internal file type identifier.
56
+ # @option options [Object] :filename
57
+ # Filename of file.
58
+ # @option options [Object] :title
59
+ # Title of file.
60
+ # @option options [Object] :initial_comment
61
+ # Initial comment to add to file.
62
+ # @option options [channel] :channels
63
+ # Comma separated list of channels to share the file into.
64
+ # @see https://api.slack.com/methods/files.upload
65
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.upload.md
66
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/files.upload.json
67
+ def files_upload(options={})
68
+ post("files.upload", options)
69
+ end
70
+
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,226 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Groups
6
+ #
7
+ # Archives a private group.
8
+ #
9
+ # @option options [group] :channel
10
+ # Private group to archive
11
+ # @see https://api.slack.com/methods/groups.archive
12
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.archive.md
13
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.archive.json
14
+ def groups_archive(options={})
15
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
16
+ post("groups.archive", options)
17
+ end
18
+
19
+ #
20
+ # Closes a private group.
21
+ #
22
+ # @option options [group] :channel
23
+ # Group to open.
24
+ # @see https://api.slack.com/methods/groups.close
25
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.close.md
26
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.close.json
27
+ def groups_close(options={})
28
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
29
+ post("groups.close", options)
30
+ end
31
+
32
+ #
33
+ # Creates a private group.
34
+ #
35
+ # @option options [Object] :name
36
+ # Name of group to create
37
+ # @see https://api.slack.com/methods/groups.create
38
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.create.md
39
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.create.json
40
+ def groups_create(options={})
41
+ throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
42
+ post("groups.create", options)
43
+ end
44
+
45
+ #
46
+ # Clones and archives a private group.
47
+ #
48
+ # @option options [group] :channel
49
+ # Group to clone and archive.
50
+ # @see https://api.slack.com/methods/groups.createChild
51
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.createChild.md
52
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.createChild.json
53
+ def groups_createChild(options={})
54
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
55
+ post("groups.createChild", options)
56
+ end
57
+
58
+ #
59
+ # Fetches history of messages and events from a private group.
60
+ #
61
+ # @option options [group] :channel
62
+ # Group to fetch history for.
63
+ # @option options [timestamp] :latest
64
+ # Latest message timestamp to include in results.
65
+ # @option options [timestamp] :oldest
66
+ # Oldest message timestamp to include in results.
67
+ # @option options [Object] :count
68
+ # Number of messages to return, between 1 and 1000.
69
+ # @see https://api.slack.com/methods/groups.history
70
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.history.md
71
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.history.json
72
+ def groups_history(options={})
73
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
74
+ post("groups.history", options)
75
+ end
76
+
77
+ #
78
+ # Invites a user to a private group.
79
+ #
80
+ # @option options [group] :channel
81
+ # Private group to invite user to.
82
+ # @option options [user] :user
83
+ # User to invite.
84
+ # @see https://api.slack.com/methods/groups.invite
85
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.invite.md
86
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.invite.json
87
+ def groups_invite(options={})
88
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
89
+ throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
90
+ post("groups.invite", options)
91
+ end
92
+
93
+ #
94
+ # Removes a user from a private group.
95
+ #
96
+ # @option options [group] :channel
97
+ # Group to remove user from.
98
+ # @option options [user] :user
99
+ # User to remove from group.
100
+ # @see https://api.slack.com/methods/groups.kick
101
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.kick.md
102
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.kick.json
103
+ def groups_kick(options={})
104
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
105
+ throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
106
+ post("groups.kick", options)
107
+ end
108
+
109
+ #
110
+ # Leaves a private group.
111
+ #
112
+ # @option options [group] :channel
113
+ # Group to leave
114
+ # @see https://api.slack.com/methods/groups.leave
115
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.leave.md
116
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.leave.json
117
+ def groups_leave(options={})
118
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
119
+ post("groups.leave", options)
120
+ end
121
+
122
+ #
123
+ # Lists private groups that the calling user has access to.
124
+ #
125
+ # @option options [Object] :exclude_archived
126
+ # Don't return archived groups.
127
+ # @see https://api.slack.com/methods/groups.list
128
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.list.md
129
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.list.json
130
+ def groups_list(options={})
131
+ post("groups.list", options)
132
+ end
133
+
134
+ #
135
+ # Sets the read cursor in a private group.
136
+ #
137
+ # @option options [group] :channel
138
+ # Group to set reading cursor in.
139
+ # @option options [timestamp] :ts
140
+ # Timestamp of the most recently seen message.
141
+ # @see https://api.slack.com/methods/groups.mark
142
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.mark.md
143
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.mark.json
144
+ def groups_mark(options={})
145
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
146
+ throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
147
+ post("groups.mark", options)
148
+ end
149
+
150
+ #
151
+ # Opens a private group.
152
+ #
153
+ # @option options [group] :channel
154
+ # Group to open.
155
+ # @see https://api.slack.com/methods/groups.open
156
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.open.md
157
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.open.json
158
+ def groups_open(options={})
159
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
160
+ post("groups.open", options)
161
+ end
162
+
163
+ #
164
+ # Renames a private group.
165
+ #
166
+ # @option options [channel] :channel
167
+ # Group to rename
168
+ # @option options [Object] :name
169
+ # New name for group.
170
+ # @see https://api.slack.com/methods/groups.rename
171
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.rename.md
172
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.rename.json
173
+ def groups_rename(options={})
174
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
175
+ throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
176
+ post("groups.rename", options)
177
+ end
178
+
179
+ #
180
+ # Sets the purpose for a private group.
181
+ #
182
+ # @option options [channel] :channel
183
+ # Private group to set the purpose of
184
+ # @option options [Object] :purpose
185
+ # The new purpose
186
+ # @see https://api.slack.com/methods/groups.setPurpose
187
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.setPurpose.md
188
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.setPurpose.json
189
+ def groups_setPurpose(options={})
190
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
191
+ throw ArgumentError.new("Required arguments :purpose missing") if options[:purpose].nil?
192
+ post("groups.setPurpose", options)
193
+ end
194
+
195
+ #
196
+ # Sets the topic for a private group.
197
+ #
198
+ # @option options [channel] :channel
199
+ # Private group to set the topic of
200
+ # @option options [Object] :topic
201
+ # The new topic
202
+ # @see https://api.slack.com/methods/groups.setTopic
203
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.setTopic.md
204
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.setTopic.json
205
+ def groups_setTopic(options={})
206
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
207
+ throw ArgumentError.new("Required arguments :topic missing") if options[:topic].nil?
208
+ post("groups.setTopic", options)
209
+ end
210
+
211
+ #
212
+ # Unarchives a private group.
213
+ #
214
+ # @option options [group] :channel
215
+ # Group to unarchive
216
+ # @see https://api.slack.com/methods/groups.unarchive
217
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.unarchive.md
218
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/groups.unarchive.json
219
+ def groups_unarchive(options={})
220
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
221
+ post("groups.unarchive", options)
222
+ end
223
+
224
+ end
225
+ end
226
+ end
@@ -0,0 +1,79 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Im
6
+ #
7
+ # Close a direct message channel.
8
+ #
9
+ # @option options [im] :channel
10
+ # Direct message channel to close.
11
+ # @see https://api.slack.com/methods/im.close
12
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.close.md
13
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.close.json
14
+ def im_close(options={})
15
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
16
+ post("im.close", options)
17
+ end
18
+
19
+ #
20
+ # Fetches history of messages and events from direct message channel.
21
+ #
22
+ # @option options [im] :channel
23
+ # Direct message channel to fetch history for.
24
+ # @option options [timestamp] :latest
25
+ # Latest message timestamp to include in results.
26
+ # @option options [timestamp] :oldest
27
+ # Oldest message timestamp to include in results.
28
+ # @option options [Object] :count
29
+ # Number of messages to return, between 1 and 1000.
30
+ # @see https://api.slack.com/methods/im.history
31
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.history.md
32
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.history.json
33
+ def im_history(options={})
34
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
35
+ post("im.history", options)
36
+ end
37
+
38
+ #
39
+ # Lists direct message channels for the calling user.
40
+ #
41
+ # @see https://api.slack.com/methods/im.list
42
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.list.md
43
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.list.json
44
+ def im_list(options={})
45
+ post("im.list", options)
46
+ end
47
+
48
+ #
49
+ # Sets the read cursor in a direct message channel.
50
+ #
51
+ # @option options [im] :channel
52
+ # Direct message channel to set reading cursor in.
53
+ # @option options [timestamp] :ts
54
+ # Timestamp of the most recently seen message.
55
+ # @see https://api.slack.com/methods/im.mark
56
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.mark.md
57
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.mark.json
58
+ def im_mark(options={})
59
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
60
+ throw ArgumentError.new("Required arguments :ts missing") if options[:ts].nil?
61
+ post("im.mark", options)
62
+ end
63
+
64
+ #
65
+ # Opens a direct message channel.
66
+ #
67
+ # @option options [user] :user
68
+ # User to open a direct message channel with.
69
+ # @see https://api.slack.com/methods/im.open
70
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.open.md
71
+ # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/im.open.json
72
+ def im_open(options={})
73
+ throw ArgumentError.new("Required arguments :user missing") if options[:user].nil?
74
+ post("im.open", options)
75
+ end
76
+
77
+ end
78
+ end
79
+ end