Module: Notion::Api::Endpoints::Search

Included in:
Notion::Api::Endpoints
Defined in:
lib/notion/api/endpoints/search.rb

Instance Method Summary collapse

Instance Method Details

#search(options = {}) ⇒ Object

Searches all pages and child pages that are shared with the integration. The results may include databases.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :query (string)

    When supplied, limits which pages are returned by comparing the query to the page title.

  • :filter (Object)

    When supplied, filters the results based on the provided criteria.

  • :sorts ([Object])

    When supplied, sorts the results based on the provided criteria. Limitation: Currently only a single sort is allowed and is limited to last_edited_time.

  • :start_cursor (UUID)

    Paginate through collections of data by setting the cursor parameter to a start_cursor attribute returned by a previous request’s next_cursor. Default value fetches the first “page” of the collection. See pagination for more detail.

  • :page_size (integer)

    The number of items from the full list desired in the response. Maximum: 100



29
30
31
32
33
34
35
36
37
# File 'lib/notion/api/endpoints/search.rb', line 29

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