Module: Slack::Web::Api::Endpoints::Conversations
- Included in:
- Slack::Web::Api::Endpoints
- Defined in:
- lib/slack/web/api/endpoints/conversations.rb
Instance Method Summary collapse
-
#conversations_archive(options = {}) ⇒ Object
Archives a conversation.
-
#conversations_close(options = {}) ⇒ Object
Closes a direct message or multi-person direct message.
-
#conversations_create(options = {}) ⇒ Object
Initiates a public or private channel-based conversation.
-
#conversations_history(options = {}) ⇒ Object
Fetches a conversation’s history of messages and events.
-
#conversations_info(options = {}) ⇒ Object
Retrieve information about a conversation.
-
#conversations_invite(options = {}) ⇒ Object
Invites users to a channel.
-
#conversations_join(options = {}) ⇒ Object
Joins an existing conversation.
-
#conversations_kick(options = {}) ⇒ Object
Removes a user from a conversation.
-
#conversations_leave(options = {}) ⇒ Object
Leaves a conversation.
-
#conversations_list(options = {}) ⇒ Object
Lists all channels in a Slack team.
-
#conversations_members(options = {}) ⇒ Object
Retrieve members of a conversation.
-
#conversations_open(options = {}) ⇒ Object
Opens or resumes a direct message or multi-person direct message.
-
#conversations_rename(options = {}) ⇒ Object
Renames a conversation.
-
#conversations_replies(options = {}) ⇒ Object
Retrieve a thread of messages posted to a conversation.
-
#conversations_setPurpose(options = {}) ⇒ Object
Sets the purpose for a conversation.
-
#conversations_setTopic(options = {}) ⇒ Object
Sets the topic for a conversation.
-
#conversations_unarchive(options = {}) ⇒ Object
Reverses conversation archival.
Instance Method Details
#conversations_archive(options = {}) ⇒ Object
Archives a conversation.
15 16 17 18 19 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 15 def conversations_archive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.archive', ) end |
#conversations_close(options = {}) ⇒ Object
Closes a direct message or multi-person direct message.
28 29 30 31 32 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 28 def conversations_close( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.close', ) end |
#conversations_create(options = {}) ⇒ Object
Initiates a public or private channel-based conversation
43 44 45 46 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 43 def conversations_create( = {}) throw ArgumentError.new('Required arguments :name missing') if [:name].nil? post('conversations.create', ) end |
#conversations_history(options = {}) ⇒ Object
Fetches a conversation’s history of messages and events.
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 65 def conversations_history( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] if block_given? Pagination::Cursor.new(self, :conversations_history, ).each do |page| yield page end else post('conversations.history', ) end end |
#conversations_info(options = {}) ⇒ Object
Retrieve information about a conversation.
86 87 88 89 90 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 86 def conversations_info( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.info', ) end |
#conversations_invite(options = {}) ⇒ Object
Invites users to a channel.
101 102 103 104 105 106 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 101 def conversations_invite( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :users missing') if [:users].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.invite', ) end |
#conversations_join(options = {}) ⇒ Object
Joins an existing conversation.
115 116 117 118 119 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 115 def conversations_join( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.join', ) end |
#conversations_kick(options = {}) ⇒ Object
Removes a user from a conversation.
130 131 132 133 134 135 136 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 130 def conversations_kick( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] = .merge(user: users_id()['user']['id']) if [:user] post('conversations.kick', ) end |
#conversations_leave(options = {}) ⇒ Object
Leaves a conversation.
145 146 147 148 149 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 145 def conversations_leave( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.leave', ) end |
#conversations_list(options = {}) ⇒ Object
Lists all channels in a Slack team.
164 165 166 167 168 169 170 171 172 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 164 def conversations_list( = {}) if block_given? Pagination::Cursor.new(self, :conversations_list, ).each do |page| yield page end else post('conversations.list', ) end end |
#conversations_members(options = {}) ⇒ Object
Retrieve members of a conversation.
185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 185 def conversations_members( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] if block_given? Pagination::Cursor.new(self, :conversations_members, ).each do |page| yield page end else post('conversations.members', ) end end |
#conversations_open(options = {}) ⇒ Object
Opens or resumes a direct message or multi-person direct message.
208 209 210 211 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 208 def conversations_open( = {}) = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.open', ) end |
#conversations_rename(options = {}) ⇒ Object
Renames a conversation.
222 223 224 225 226 227 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 222 def conversations_rename( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :name missing') if [:name].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.rename', ) end |
#conversations_replies(options = {}) ⇒ Object
Retrieve a thread of messages posted to a conversation
248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 248 def conversations_replies( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] if block_given? Pagination::Cursor.new(self, :conversations_replies, ).each do |page| yield page end else post('conversations.replies', ) end end |
#conversations_setPurpose(options = {}) ⇒ Object
Sets the purpose for a conversation.
270 271 272 273 274 275 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 270 def conversations_setPurpose( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :purpose missing') if [:purpose].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.setPurpose', ) end |
#conversations_setTopic(options = {}) ⇒ Object
Sets the topic for a conversation.
286 287 288 289 290 291 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 286 def conversations_setTopic( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :topic missing') if [:topic].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.setTopic', ) end |
#conversations_unarchive(options = {}) ⇒ Object
Reverses conversation archival.
300 301 302 303 304 |
# File 'lib/slack/web/api/endpoints/conversations.rb', line 300 def conversations_unarchive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('conversations.unarchive', ) end |