lib/slack/web/api/endpoints/reactions.rb
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake
module Slack
module Web
module Api
module Endpoints
module Reactions
#
# Adds a reaction to an item.
#
# @option options [channel] :channel
# Channel where the message to add reaction to was posted.
# @option options [string] :name
# Reaction (emoji) name.
# @option options [string] :timestamp
# Timestamp of the message to add reaction to.
# @see https://api.slack.com/methods/reactions.add
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.add.json
def reactions_add(options = {})
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
raise ArgumentError, 'Required arguments :timestamp missing' if options[:timestamp].nil?
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
post('reactions.add', options)
end
#
# Gets reactions for an item.
#
# @option options [channel] :channel
# Channel where the message to get reactions for was posted.
# @option options [file] :file
# File to get reactions for.
# @option options [string] :file_comment
# File comment to get reactions for.
# @option options [boolean] :full
# If true always return the complete reaction list.
# @option options [string] :timestamp
# Timestamp of the message to get reactions for.
# @see https://api.slack.com/methods/reactions.get
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.get.json
def reactions_get(options = {})
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
post('reactions.get', options)
end
#
# Lists reactions made by a user.
#
# @option options [string] :cursor
# Parameter for pagination. Set cursor equal to the next_cursor attribute returned by the previous request's response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first "page" of the collection. See pagination for more details.
# @option options [boolean] :full
# If true always return the complete reaction list.
# @option options [integer] :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.
# @option options [string] :team_id
# encoded team id to list reactions in, required if org token is used.
# @option options [user] :user
# Show reactions made by this user. Defaults to the authed user.
# @see https://api.slack.com/methods/reactions.list
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.list.json
def reactions_list(options = {})
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
if block_given?
Pagination::Cursor.new(self, :reactions_list, options).each do |page|
yield page
end
else
post('reactions.list', options)
end
end
#
# Removes a reaction from an item.
#
# @option options [string] :name
# Reaction (emoji) name.
# @option options [channel] :channel
# Channel where the message to remove reaction from was posted.
# @option options [file] :file
# File to remove reaction from.
# @option options [string] :file_comment
# File comment to remove reaction from.
# @option options [string] :timestamp
# Timestamp of the message to remove reaction from.
# @see https://api.slack.com/methods/reactions.remove
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.remove.json
def reactions_remove(options = {})
raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
post('reactions.remove', options)
end
end
end
end
end
end