Module: Slack::Web::Api::Endpoints::Stars

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

Instance Method Summary collapse

Instance Method Details

#stars_add(options = {}) ⇒ Object

Save an item for later. Formerly known as adding a star.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to add star to, or channel where the message to add star to was posted (used with timestamp).

  • :file (file)

    File to add star to.

  • :file_comment (string)

    File comment to add star to.

  • :timestamp (string)

    Timestamp of the message to add star to.

See Also:



22
23
24
25
# File 'lib/slack/web/api/endpoints/stars.rb', line 22

def stars_add(options = {})
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  post('stars.add', options)
end

#stars_list(options = {}) ⇒ Object

Listed a user’s saved items, formerly known as stars.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :cursor (string)

    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.

  • :limit (integer)

    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 (string)

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

See Also:



38
39
40
41
42
43
44
45
46
# File 'lib/slack/web/api/endpoints/stars.rb', line 38

def stars_list(options = {})
  if block_given?
    Pagination::Cursor.new(self, :stars_list, options).each do |page|
      yield page
    end
  else
    post('stars.list', options)
  end
end

#stars_remove(options = {}) ⇒ Object

Removes a saved item (star) from an item.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :channel (channel)

    Channel to remove star from, or channel where the message to remove star from was posted (used with timestamp).

  • :file (file)

    File to remove star from.

  • :file_comment (string)

    File comment to remove star from.

  • :timestamp (string)

    Timestamp of the message to remove star from.

See Also:



61
62
63
64
# File 'lib/slack/web/api/endpoints/stars.rb', line 61

def stars_remove(options = {})
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
  post('stars.remove', options)
end