Class: DropboxApi::Endpoints::Files::CopyBatch

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

Constant Summary collapse

Method =
:post
Path =
"/2/files/copy_batch_v2".freeze
ResultType =
DropboxApi::Results::CopyBatchResult

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

#copy_batch(entries, options = {}) ⇒ String, Array

Copy multiple files or folders to different locations at once in the user's Dropbox.

This will either finish synchronously, or return a job ID and do the async copy job in background. Please use Client#copy_batch_check to check the job status.

Note: No errors are returned by this endpoint.

Parameters:

  • entries (Array<Hash>)

    List of entries to be moved or copied. Each entry must be a hash with two keys: :from_path & :to_path.

Options Hash (options):

  • autorename (Boolean)

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

Returns:

  • (String, Array)

    Either the job id or the list of job statuses.



24
25
26
27
28
29
30
31
32
33
# File 'lib/dropbox_api/endpoints/files/copy_batch.rb', line 24

add_endpoint :copy_batch do |entries, options = {}|
  validate_options([
    :autorename
  ], options)
  options[:autorename] ||= false

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