Module: Slack::Web::Api::Endpoints::Search

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

Instance Method Summary collapse

Instance Method Details

#search_all(options = {}) ⇒ Object

This method allows users and applications to search both messages and files in a single call.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :query (Object)

    Search query. May contains booleans, etc.

  • :highlight (Object)

    Pass a value of true to enable query highlight markers (see below).

  • :sort (Object)

    Return matches sorted by either score or timestamp.

  • :sort_dir (Object)

    Change sort direction to ascending (asc) or descending (desc).

See Also:


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

def search_all(options = {})
  throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
  post('search.all', options)
end

#search_files(options = {}) ⇒ Object

This method returns files matching a search query.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :query (Object)

    Search query.

  • :highlight (Object)

    Pass a value of true to enable query highlight markers (see below).

  • :sort (Object)

    Return matches sorted by either score or timestamp.

  • :sort_dir (Object)

    Change sort direction to ascending (asc) or descending (desc).

See Also:


39
40
41
42
# File 'lib/slack/web/api/endpoints/search.rb', line 39

def search_files(options = {})
  throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
  post('search.files', options)
end

#search_messages(options = {}) ⇒ Object

This method returns messages matching a search query.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :query (Object)

    Search query.

  • :highlight (Object)

    Pass a value of true to enable query highlight markers (see below).

  • :sort (Object)

    Return matches sorted by either score or timestamp.

  • :sort_dir (Object)

    Change sort direction to ascending (asc) or descending (desc).

See Also:


57
58
59
60
# File 'lib/slack/web/api/endpoints/search.rb', line 57

def search_messages(options = {})
  throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
  post('search.messages', options)
end