Sha256: 0190a4d87d3ff34857493984d5b8fff4f2e9bb8604e1cc26494be82cd98e2591

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

module DropboxApi::Endpoints::Files
  class Search < DropboxApi::Endpoints::Rpc
    Method      = :post
    Path        = "/2/files/search".freeze
    ResultType  = DropboxApi::Results::SearchResult
    ErrorType   = DropboxApi::Errors::SearchError

    include DropboxApi::OptionsValidator

    # Searches for files and folders.
    #
    # Note: Recent changes may not immediately be reflected in search results
    # due to a short delay in indexing.
    #
    # @param query [String] The string to search for. The search string is
    #   split on spaces into multiple tokens. For file name searching, the last
    #   token is used for prefix matching (i.e. "bat c" matches "bat cave" but
    #   not "batman car").
    # @param path [String] The path in the user's Dropbox to search.
    # @option start [Numeric] The starting index within the search results
    #   (used for paging). The default for this field is 0.
    # @option max_results [Numeric] The maximum number of search results to
    #   return. The default for this field is 100.
    # @option mode [:filename, :filename_and_content, :deleted_filename] The
    #   search mode. Note that searching file content is only available for
    #   Dropbox Business accounts. The default is filename.
    add_endpoint :search do |query, path = "", options = {}|
      validate_options([
        :start,
        :max_results,
        :mode
      ], options)
      options[:start] ||= 0
      options[:max_results] ||= 100
      options[:mode] ||= :filename

      perform_request options.merge({
        :query => query,
        :path => path
      })
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dropbox_api-0.1.11 lib/dropbox_api/endpoints/files/search.rb