Module: Slack::Web::Api::Endpoints::Reactions

Included in:
Slack::Web::Api::Endpoints
Defined in:
lib/slack/web/api/endpoints/reactions.rb

Instance Method Summary collapse

Instance Method Details

#reactions_add(options = {}) ⇒ Object

Adds a reaction to an item.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel where the message to add reaction to was posted.

  • :name (Object)

    Reaction (emoji) name.

  • :timestamp (Object)

    Timestamp of the message to add reaction to.

See Also:



20
21
22
23
24
25
26
# File 'lib/slack/web/api/endpoints/reactions.rb', line 20

def reactions_add(options = {})
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
  throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
  throw ArgumentError.new('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

#reactions_get(options = {}) ⇒ Object

Gets reactions for an item.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel where the message to get reactions for was posted.

  • :file (file)

    File to get reactions for.

  • :file_comment (Object)

    File comment to get reactions for.

  • :full (Object)

    If true always return the complete reaction list.

  • :timestamp (Object)

    Timestamp of the message to get reactions for.

See Also:



43
44
45
46
# File 'lib/slack/web/api/endpoints/reactions.rb', line 43

def reactions_get(options = {})
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  post('reactions.get', options)
end

#reactions_list(options = {}) ⇒ Object

Lists reactions made by a user.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :cursor (Object)

    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.

  • :full (Object)

    If true always return the complete reaction list.

  • :limit (Object)

    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.

  • :team_id (Object)

    encoded team id to list reactions in, required if org token is used.

  • :user (user)

    Show reactions made by this user. Defaults to the authed user.

See Also:



63
64
65
66
67
68
69
70
71
72
# File 'lib/slack/web/api/endpoints/reactions.rb', line 63

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

#reactions_remove(options = {}) ⇒ Object

Removes a reaction from an item.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :name (Object)

    Reaction (emoji) name.

  • :channel (channel)

    Channel where the message to remove reaction from was posted.

  • :file (file)

    File to remove reaction from.

  • :file_comment (Object)

    File comment to remove reaction from.

  • :timestamp (Object)

    Timestamp of the message to remove reaction from.

See Also:



89
90
91
92
93
# File 'lib/slack/web/api/endpoints/reactions.rb', line 89

def reactions_remove(options = {})
  throw ArgumentError.new('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