Class: DropboxApi::Endpoints::Files::ListFolder

Inherits:
Rpc
  • Object
show all
Includes:
OptionsValidator
Defined in:
lib/dropbox_api/endpoints/files/list_folder.rb

Constant Summary collapse

Method =
:post
Path =
"/2/files/list_folder".freeze
ResultType =
DropboxApi::Results::ListFolderResult
ErrorType =
DropboxApi::Errors::ListFolderError

Instance Method Summary collapse

Methods included from OptionsValidator

#validate_options

Methods inherited from Rpc

#build_request, #initialize, #request_body

Methods inherited from Base

add_endpoint

Constructor Details

This class inherits a constructor from DropboxApi::Endpoints::Rpc

Instance Method Details

#list_folder(path, options = {}) ⇒ Object

Returns the contents of a folder.

Parameters:

  • path (String)

    The path to the folder you want to read.

Options Hash (options):

  • recursive (Boolean)

    If true, the list folder operation will be applied recursively to all subfolders and the response will contain contents of all subfolders. The default for this field is false.

  • include_media_info (Boolean)

    If true, media_info is set for photo and video. The default for this field is false.

  • include_deleted (Boolean)

    If true, Metadata::Deleted will be returned for deleted file or folder, otherwise DropboxApi::Errors::NotFoundError will be raised. The default for this field is false.

  • limit (Numeric)

    If present, will specify max number of results per request (Note: Dropbox docs indicate this is "approximate", and more may be returned)


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/dropbox_api/endpoints/files/list_folder.rb', line 28

add_endpoint :list_folder do |path, options = {}|
  validate_options([
    :recursive,
    :include_media_info,
    :include_deleted,
    :shared_link,
    :include_has_explicit_shared_members,
    :limit
  ], options)
  options[:recursive] ||= false
  options[:include_media_info] ||= false
  options[:include_deleted] ||= false
  options[:shared_link] = build_shared_link_param(options[:shared_link]) if options[:shared_link]
  options[:limit] = options[:limit] if options[:limit]
  
  perform_request options.merge({
    :path => path
  })
end