Class: DropboxApi::Endpoints::Files::CreateFolderBatch

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

Constant Summary collapse

Method =
:post
Path =
"/2/files/create_folder_batch".freeze
ResultType =
DropboxApi::Results::CreateFolderBatchResult

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

#create_folder_batch(paths, options = {}) ⇒ String, Array

Create multiple folders at once.

This route is asynchronous for large batches, which returns a job ID immediately and runs the create folder batch asynchronously. Otherwise, creates the folders and returns the result synchronously for smaller inputs. You can force asynchronous behaviour by using the :force_async flag. Use Client#create_folder_batch_check to check the job status.

Note: No errors are returned by this endpoint.

Parameters:

  • paths (Array)

    List of paths to be created in the user's Dropbox. Duplicate path arguments in the batch are considered only once.

Options Hash (options):

  • autorename (Boolean)

    If there's a conflict, have the Dropbox server try to autorename the folder to avoid the conflict. The default for this field is false.

  • force_async (Boolean)

    Whether to force the create to happen asynchronously. The default for this field is false.

Returns:

  • (String, Array)

    Either the job id or the list of job statuses.


27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/dropbox_api/endpoints/files/create_folder_batch.rb', line 27

add_endpoint :create_folder_batch do |paths, options = {}|
  validate_options([
    :autorename,
    :force_async
  ], options)
  options[:autorename] ||= false
  options[:force_async] ||= false

  perform_request(options.merge({
    :paths => paths
  }))
end