dropbox_sdk/generated/sync_routes/files.rs
1// DO NOT EDIT
2// This file was @generated by Stone
3
4#![allow(
5 clippy::too_many_arguments,
6 clippy::large_enum_variant,
7 clippy::result_large_err,
8 clippy::doc_markdown,
9 clippy::doc_lazy_continuation,
10)]
11
12#[allow(unused_imports)]
13pub use crate::generated::types::files::*;
14
15/// Returns the metadata for a file or folder. This is an alpha endpoint compatible with the
16/// properties API. Note: Metadata for the root folder is unsupported.
17///
18/// # Stability
19/// *PREVIEW*: This function may change or disappear without notice.
20#[cfg(feature = "unstable")]
21#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
22#[deprecated]
23pub fn alpha_get_metadata(
24 client: &impl crate::client_trait::UserAuthClient,
25 arg: &AlphaGetMetadataArg,
26) -> Result<Metadata, crate::Error<AlphaGetMetadataError>> {
27 crate::client_helpers::unwrap_async(
28 crate::client_helpers::request(
29 client,
30 crate::client_trait_common::Endpoint::Api,
31 crate::client_trait_common::Style::Rpc,
32 "files/alpha/get_metadata",
33 arg,
34 None)
35 )
36}
37
38/// Create a new file with the contents provided in the request. Note that the behavior of this
39/// alpha endpoint is unstable and subject to change. Do not use this to upload a file larger than
40/// 150 MiB. Instead, create an upload session with
41/// [`upload_session_start()`](crate::files::upload_session_start).
42///
43/// # Stability
44/// *PREVIEW*: This function may change or disappear without notice.
45#[cfg(feature = "unstable")]
46#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
47#[deprecated]
48pub fn alpha_upload(
49 client: &impl crate::client_trait::UserAuthClient,
50 arg: &UploadArg,
51 body: &[u8],
52) -> Result<FileMetadata, crate::Error<UploadError>> {
53 crate::client_helpers::unwrap_async(
54 crate::client_helpers::request(
55 client,
56 crate::client_trait_common::Endpoint::Content,
57 crate::client_trait_common::Style::Upload,
58 "files/alpha/upload",
59 arg,
60 Some(crate::client_helpers::Body::from(body)))
61 )
62}
63
64/// Copy a file or folder to a different location in the user's Dropbox. If the source path is a
65/// folder all its contents will be copied.
66#[deprecated]
67pub fn copy(
68 client: &impl crate::client_trait::UserAuthClient,
69 arg: &RelocationArg,
70) -> Result<Metadata, crate::Error<RelocationError>> {
71 crate::client_helpers::unwrap_async(
72 crate::client_helpers::request(
73 client,
74 crate::client_trait_common::Endpoint::Api,
75 crate::client_trait_common::Style::Rpc,
76 "files/copy",
77 arg,
78 None)
79 )
80}
81
82/// Copy a file or folder to a different location in the user's Dropbox. If the source path is a
83/// folder all its contents will be copied.
84pub fn copy_v2(
85 client: &impl crate::client_trait::UserAuthClient,
86 arg: &RelocationArg,
87) -> Result<RelocationResult, crate::Error<RelocationError>> {
88 crate::client_helpers::unwrap_async(
89 crate::client_helpers::request(
90 client,
91 crate::client_trait_common::Endpoint::Api,
92 crate::client_trait_common::Style::Rpc,
93 "files/copy_v2",
94 arg,
95 None)
96 )
97}
98
99/// Copy multiple files or folders to different locations at once in the user's Dropbox. This route
100/// will return job ID immediately and do the async copy job in background. Please use
101/// [`copy_batch_check()`](crate::files::copy_batch_check) to check the job status.
102#[deprecated]
103pub fn copy_batch(
104 client: &impl crate::client_trait::UserAuthClient,
105 arg: &RelocationBatchArg,
106) -> Result<RelocationBatchLaunch, crate::Error<crate::NoError>> {
107 crate::client_helpers::unwrap_async(
108 crate::client_helpers::request(
109 client,
110 crate::client_trait_common::Endpoint::Api,
111 crate::client_trait_common::Style::Rpc,
112 "files/copy_batch",
113 arg,
114 None)
115 )
116}
117
118/// Copy multiple files or folders to different locations at once in the user's Dropbox. This route
119/// will replace [`copy_batch()`](crate::files::copy_batch). The main difference is this route will
120/// return status for each entry, while [`copy_batch()`](crate::files::copy_batch) raises failure if
121/// any entry fails. This route will either finish synchronously, or return a job ID and do the
122/// async copy job in background. Please use
123/// [`copy_batch_check_v2()`](crate::files::copy_batch_check_v2) to check the job status.
124pub fn copy_batch_v2(
125 client: &impl crate::client_trait::UserAuthClient,
126 arg: &CopyBatchArg,
127) -> Result<RelocationBatchV2Launch, crate::Error<crate::NoError>> {
128 crate::client_helpers::unwrap_async(
129 crate::client_helpers::request(
130 client,
131 crate::client_trait_common::Endpoint::Api,
132 crate::client_trait_common::Style::Rpc,
133 "files/copy_batch_v2",
134 arg,
135 None)
136 )
137}
138
139/// Returns the status of an asynchronous job for [`copy_batch()`](crate::files::copy_batch). If
140/// success, it returns list of results for each entry.
141#[deprecated]
142pub fn copy_batch_check(
143 client: &impl crate::client_trait::UserAuthClient,
144 arg: &crate::types::dbx_async::PollArg,
145) -> Result<RelocationBatchJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
146 crate::client_helpers::unwrap_async(
147 crate::client_helpers::request(
148 client,
149 crate::client_trait_common::Endpoint::Api,
150 crate::client_trait_common::Style::Rpc,
151 "files/copy_batch/check",
152 arg,
153 None)
154 )
155}
156
157/// Returns the status of an asynchronous job for [`copy_batch_v2()`](crate::files::copy_batch_v2).
158/// It returns list of results for each entry.
159pub fn copy_batch_check_v2(
160 client: &impl crate::client_trait::UserAuthClient,
161 arg: &crate::types::dbx_async::PollArg,
162) -> Result<RelocationBatchV2JobStatus, crate::Error<crate::types::dbx_async::PollError>> {
163 crate::client_helpers::unwrap_async(
164 crate::client_helpers::request(
165 client,
166 crate::client_trait_common::Endpoint::Api,
167 crate::client_trait_common::Style::Rpc,
168 "files/copy_batch/check_v2",
169 arg,
170 None)
171 )
172}
173
174/// Get a copy reference to a file or folder. This reference string can be used to save that file or
175/// folder to another user's Dropbox by passing it to
176/// [`copy_reference_save()`](crate::files::copy_reference_save).
177pub fn copy_reference_get(
178 client: &impl crate::client_trait::UserAuthClient,
179 arg: &GetCopyReferenceArg,
180) -> Result<GetCopyReferenceResult, crate::Error<GetCopyReferenceError>> {
181 crate::client_helpers::unwrap_async(
182 crate::client_helpers::request(
183 client,
184 crate::client_trait_common::Endpoint::Api,
185 crate::client_trait_common::Style::Rpc,
186 "files/copy_reference/get",
187 arg,
188 None)
189 )
190}
191
192/// Save a copy reference returned by [`copy_reference_get()`](crate::files::copy_reference_get) to
193/// the user's Dropbox.
194pub fn copy_reference_save(
195 client: &impl crate::client_trait::UserAuthClient,
196 arg: &SaveCopyReferenceArg,
197) -> Result<SaveCopyReferenceResult, crate::Error<SaveCopyReferenceError>> {
198 crate::client_helpers::unwrap_async(
199 crate::client_helpers::request(
200 client,
201 crate::client_trait_common::Endpoint::Api,
202 crate::client_trait_common::Style::Rpc,
203 "files/copy_reference/save",
204 arg,
205 None)
206 )
207}
208
209/// Create a folder at a given path.
210#[deprecated]
211pub fn create_folder(
212 client: &impl crate::client_trait::UserAuthClient,
213 arg: &CreateFolderArg,
214) -> Result<FolderMetadata, crate::Error<CreateFolderError>> {
215 crate::client_helpers::unwrap_async(
216 crate::client_helpers::request(
217 client,
218 crate::client_trait_common::Endpoint::Api,
219 crate::client_trait_common::Style::Rpc,
220 "files/create_folder",
221 arg,
222 None)
223 )
224}
225
226/// Create a folder at a given path.
227pub fn create_folder_v2(
228 client: &impl crate::client_trait::UserAuthClient,
229 arg: &CreateFolderArg,
230) -> Result<CreateFolderResult, crate::Error<CreateFolderError>> {
231 crate::client_helpers::unwrap_async(
232 crate::client_helpers::request(
233 client,
234 crate::client_trait_common::Endpoint::Api,
235 crate::client_trait_common::Style::Rpc,
236 "files/create_folder_v2",
237 arg,
238 None)
239 )
240}
241
242/// Create multiple folders at once. This route is asynchronous for large batches, which returns a
243/// job ID immediately and runs the create folder batch asynchronously. Otherwise, creates the
244/// folders and returns the result synchronously for smaller inputs. You can force asynchronous
245/// behaviour by using the CreateFolderBatchArg.force_async flag. Use
246/// [`create_folder_batch_check()`](crate::files::create_folder_batch_check) to check the job
247/// status.
248pub fn create_folder_batch(
249 client: &impl crate::client_trait::UserAuthClient,
250 arg: &CreateFolderBatchArg,
251) -> Result<CreateFolderBatchLaunch, crate::Error<crate::NoError>> {
252 crate::client_helpers::unwrap_async(
253 crate::client_helpers::request(
254 client,
255 crate::client_trait_common::Endpoint::Api,
256 crate::client_trait_common::Style::Rpc,
257 "files/create_folder_batch",
258 arg,
259 None)
260 )
261}
262
263/// Returns the status of an asynchronous job for
264/// [`create_folder_batch()`](crate::files::create_folder_batch). If success, it returns list of
265/// result for each entry.
266pub fn create_folder_batch_check(
267 client: &impl crate::client_trait::UserAuthClient,
268 arg: &crate::types::dbx_async::PollArg,
269) -> Result<CreateFolderBatchJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
270 crate::client_helpers::unwrap_async(
271 crate::client_helpers::request(
272 client,
273 crate::client_trait_common::Endpoint::Api,
274 crate::client_trait_common::Style::Rpc,
275 "files/create_folder_batch/check",
276 arg,
277 None)
278 )
279}
280
281/// Delete the file or folder at a given path. If the path is a folder, all its contents will be
282/// deleted too. A successful response indicates that the file or folder was deleted. The returned
283/// metadata will be the corresponding FileMetadata or FolderMetadata for the item at time of
284/// deletion, and not a DeletedMetadata object.
285#[deprecated]
286pub fn delete(
287 client: &impl crate::client_trait::UserAuthClient,
288 arg: &DeleteArg,
289) -> Result<Metadata, crate::Error<DeleteError>> {
290 crate::client_helpers::unwrap_async(
291 crate::client_helpers::request(
292 client,
293 crate::client_trait_common::Endpoint::Api,
294 crate::client_trait_common::Style::Rpc,
295 "files/delete",
296 arg,
297 None)
298 )
299}
300
301/// Delete the file or folder at a given path. If the path is a folder, all its contents will be
302/// deleted too. A successful response indicates that the file or folder was deleted. The returned
303/// metadata will be the corresponding FileMetadata or FolderMetadata for the item at time of
304/// deletion, and not a DeletedMetadata object.
305pub fn delete_v2(
306 client: &impl crate::client_trait::UserAuthClient,
307 arg: &DeleteArg,
308) -> Result<DeleteResult, crate::Error<DeleteError>> {
309 crate::client_helpers::unwrap_async(
310 crate::client_helpers::request(
311 client,
312 crate::client_trait_common::Endpoint::Api,
313 crate::client_trait_common::Style::Rpc,
314 "files/delete_v2",
315 arg,
316 None)
317 )
318}
319
320/// Delete multiple files/folders at once. This route is asynchronous, which returns a job ID
321/// immediately and runs the delete batch asynchronously. Use
322/// [`delete_batch_check()`](crate::files::delete_batch_check) to check the job status.
323pub fn delete_batch(
324 client: &impl crate::client_trait::UserAuthClient,
325 arg: &DeleteBatchArg,
326) -> Result<DeleteBatchLaunch, crate::Error<crate::NoError>> {
327 crate::client_helpers::unwrap_async(
328 crate::client_helpers::request(
329 client,
330 crate::client_trait_common::Endpoint::Api,
331 crate::client_trait_common::Style::Rpc,
332 "files/delete_batch",
333 arg,
334 None)
335 )
336}
337
338/// Returns the status of an asynchronous job for [`delete_batch()`](crate::files::delete_batch). If
339/// success, it returns list of result for each entry.
340pub fn delete_batch_check(
341 client: &impl crate::client_trait::UserAuthClient,
342 arg: &crate::types::dbx_async::PollArg,
343) -> Result<DeleteBatchJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
344 crate::client_helpers::unwrap_async(
345 crate::client_helpers::request(
346 client,
347 crate::client_trait_common::Endpoint::Api,
348 crate::client_trait_common::Style::Rpc,
349 "files/delete_batch/check",
350 arg,
351 None)
352 )
353}
354
355/// Download a file from a user's Dropbox.
356pub fn download(
357 client: &impl crate::client_trait::UserAuthClient,
358 arg: &DownloadArg,
359 range_start: Option<u64>,
360 range_end: Option<u64>,
361) -> Result<crate::client_trait::HttpRequestResult<FileMetadata>, crate::Error<DownloadError>> {
362 crate::client_helpers::unwrap_async_body(
363 crate::client_helpers::request_with_body(
364 client,
365 crate::client_trait_common::Endpoint::Content,
366 crate::client_trait_common::Style::Download,
367 "files/download",
368 arg,
369 None,
370 range_start,
371 range_end),
372 client,
373 )
374}
375
376/// Download a folder from the user's Dropbox, as a zip file. The folder must be less than 20 GB in
377/// size and any single file within must be less than 4 GB in size. The resulting zip must have
378/// fewer than 10,000 total file and folder entries, including the top level folder. The input
379/// cannot be a single file. Note: this endpoint does not support HTTP range requests.
380pub fn download_zip(
381 client: &impl crate::client_trait::UserAuthClient,
382 arg: &DownloadZipArg,
383 range_start: Option<u64>,
384 range_end: Option<u64>,
385) -> Result<crate::client_trait::HttpRequestResult<DownloadZipResult>, crate::Error<DownloadZipError>> {
386 crate::client_helpers::unwrap_async_body(
387 crate::client_helpers::request_with_body(
388 client,
389 crate::client_trait_common::Endpoint::Content,
390 crate::client_trait_common::Style::Download,
391 "files/download_zip",
392 arg,
393 None,
394 range_start,
395 range_end),
396 client,
397 )
398}
399
400/// Export a file from a user's Dropbox. This route only supports exporting files that cannot be
401/// downloaded directly and whose ExportResult.file_metadata has ExportInfo.export_as populated.
402///
403/// # Stability
404/// *PREVIEW*: This function may change or disappear without notice.
405#[cfg(feature = "unstable")]
406#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
407pub fn export(
408 client: &impl crate::client_trait::UserAuthClient,
409 arg: &ExportArg,
410 range_start: Option<u64>,
411 range_end: Option<u64>,
412) -> Result<crate::client_trait::HttpRequestResult<ExportResult>, crate::Error<ExportError>> {
413 crate::client_helpers::unwrap_async_body(
414 crate::client_helpers::request_with_body(
415 client,
416 crate::client_trait_common::Endpoint::Content,
417 crate::client_trait_common::Style::Download,
418 "files/export",
419 arg,
420 None,
421 range_start,
422 range_end),
423 client,
424 )
425}
426
427/// Return the lock metadata for the given list of paths.
428pub fn get_file_lock_batch(
429 client: &impl crate::client_trait::UserAuthClient,
430 arg: &LockFileBatchArg,
431) -> Result<LockFileBatchResult, crate::Error<LockFileError>> {
432 crate::client_helpers::unwrap_async(
433 crate::client_helpers::request(
434 client,
435 crate::client_trait_common::Endpoint::Api,
436 crate::client_trait_common::Style::Rpc,
437 "files/get_file_lock_batch",
438 arg,
439 None)
440 )
441}
442
443/// Returns the metadata for a file or folder. Note: Metadata for the root folder is unsupported.
444pub fn get_metadata(
445 client: &impl crate::client_trait::UserAuthClient,
446 arg: &GetMetadataArg,
447) -> Result<Metadata, crate::Error<GetMetadataError>> {
448 crate::client_helpers::unwrap_async(
449 crate::client_helpers::request(
450 client,
451 crate::client_trait_common::Endpoint::Api,
452 crate::client_trait_common::Style::Rpc,
453 "files/get_metadata",
454 arg,
455 None)
456 )
457}
458
459/// Get a preview for a file. Currently, PDF previews are generated for files with the following
460/// extensions: .ai, .doc, .docm, .docx, .eps, .gdoc, .gslides, .odp, .odt, .pps, .ppsm, .ppsx,
461/// .ppt, .pptm, .pptx, .rtf. HTML previews are generated for .csv, .ods, .xls, .xlsm, .gsheet,
462/// .xlsx. Other formats will return an unsupported extension error.
463pub fn get_preview(
464 client: &impl crate::client_trait::UserAuthClient,
465 arg: &PreviewArg,
466 range_start: Option<u64>,
467 range_end: Option<u64>,
468) -> Result<crate::client_trait::HttpRequestResult<FileMetadata>, crate::Error<PreviewError>> {
469 crate::client_helpers::unwrap_async_body(
470 crate::client_helpers::request_with_body(
471 client,
472 crate::client_trait_common::Endpoint::Content,
473 crate::client_trait_common::Style::Download,
474 "files/get_preview",
475 arg,
476 None,
477 range_start,
478 range_end),
479 client,
480 )
481}
482
483/// Get a temporary link to stream content of a file. This link will expire in four hours and
484/// afterwards you will get 410 Gone. This URL should not be used to display content directly in the
485/// browser. The Content-Type of the link is determined automatically by the file's mime type.
486pub fn get_temporary_link(
487 client: &impl crate::client_trait::UserAuthClient,
488 arg: &GetTemporaryLinkArg,
489) -> Result<GetTemporaryLinkResult, crate::Error<GetTemporaryLinkError>> {
490 crate::client_helpers::unwrap_async(
491 crate::client_helpers::request(
492 client,
493 crate::client_trait_common::Endpoint::Api,
494 crate::client_trait_common::Style::Rpc,
495 "files/get_temporary_link",
496 arg,
497 None)
498 )
499}
500
501/// Get a one-time use temporary upload link to upload a file to a Dropbox location. This endpoint
502/// acts as a delayed upload(). The returned temporary upload link may be used to make a POST
503/// request with the data to be uploaded. The upload will then be perfomed with the CommitInfo
504/// previously provided to getTemporaryUploadLink() but evaluated only upon consumption. Hence,
505/// errors stemming from invalid CommitInfo with respect to the state of the user's Dropbox will
506/// only be communicated at consumption time. Additionally, these errors are surfaced as generic
507/// HTTP 409 Conflict responses, potentially hiding issue details. The maximum temporary upload link
508/// duration is 4 hours. Upon consumption or expiration, a new link will have to be generated.
509/// Multiple links may exist for a specific upload path at any given time. The POST request on the
510/// temporary upload link must have its Content-Type set to "application/octet-stream". Example
511/// temporary upload link consumption request: curl -X POST
512/// https://content.dropboxapi.com/apitul/1/bNi2uIYF51cVBND --header "Content-Type:
513/// application/octet-stream" --data-binary @local_file.txt A successful temporary upload link
514/// consumption request returns the content hash of the uploaded data in JSON format. Example
515/// successful temporary upload link consumption response: {"content-hash":
516/// "599d71033d700ac892a0e48fa61b125d2f5994"} An unsuccessful temporary upload link consumption
517/// request returns any of the following status codes: HTTP 400 Bad Request: Content-Type is not
518/// one of application/octet-stream and text/plain or request is invalid. HTTP 409 Conflict: The
519/// temporary upload link does not exist or is currently unavailable, the upload failed, or another
520/// error happened. HTTP 410 Gone: The temporary upload link is expired or consumed. Example
521/// unsuccessful temporary upload link consumption response: Temporary upload link has been recently
522/// consumed.
523pub fn get_temporary_upload_link(
524 client: &impl crate::client_trait::UserAuthClient,
525 arg: &GetTemporaryUploadLinkArg,
526) -> Result<GetTemporaryUploadLinkResult, crate::Error<crate::NoError>> {
527 crate::client_helpers::unwrap_async(
528 crate::client_helpers::request(
529 client,
530 crate::client_trait_common::Endpoint::Api,
531 crate::client_trait_common::Style::Rpc,
532 "files/get_temporary_upload_link",
533 arg,
534 None)
535 )
536}
537
538/// Get a thumbnail for an image. This method currently supports files with the following file
539/// extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB
540/// in size won't be converted to a thumbnail.
541pub fn get_thumbnail(
542 client: &impl crate::client_trait::UserAuthClient,
543 arg: &ThumbnailArg,
544 range_start: Option<u64>,
545 range_end: Option<u64>,
546) -> Result<crate::client_trait::HttpRequestResult<FileMetadata>, crate::Error<ThumbnailError>> {
547 crate::client_helpers::unwrap_async_body(
548 crate::client_helpers::request_with_body(
549 client,
550 crate::client_trait_common::Endpoint::Content,
551 crate::client_trait_common::Style::Download,
552 "files/get_thumbnail",
553 arg,
554 None,
555 range_start,
556 range_end),
557 client,
558 )
559}
560
561/// Get a thumbnail for an image. This method currently supports files with the following file
562/// extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB
563/// in size won't be converted to a thumbnail.
564pub fn get_thumbnail_v2(
565 client: &impl crate::client_trait::UserAuthClient,
566 arg: &ThumbnailV2Arg,
567 range_start: Option<u64>,
568 range_end: Option<u64>,
569) -> Result<crate::client_trait::HttpRequestResult<PreviewResult>, crate::Error<ThumbnailV2Error>> {
570 crate::client_helpers::unwrap_async_body(
571 crate::client_helpers::request_with_body(
572 client,
573 crate::client_trait_common::Endpoint::Content,
574 crate::client_trait_common::Style::Download,
575 "files/get_thumbnail_v2",
576 arg,
577 None,
578 range_start,
579 range_end),
580 client,
581 )
582}
583
584/// Get a thumbnail for an image. This method currently supports files with the following file
585/// extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB
586/// in size won't be converted to a thumbnail.
587pub fn get_thumbnail_v2_app_auth(
588 client: &impl crate::client_trait::AppAuthClient,
589 arg: &ThumbnailV2Arg,
590 range_start: Option<u64>,
591 range_end: Option<u64>,
592) -> Result<crate::client_trait::HttpRequestResult<PreviewResult>, crate::Error<ThumbnailV2Error>> {
593 crate::client_helpers::unwrap_async_body(
594 crate::client_helpers::request_with_body(
595 client,
596 crate::client_trait_common::Endpoint::Content,
597 crate::client_trait_common::Style::Download,
598 "files/get_thumbnail_v2",
599 arg,
600 None,
601 range_start,
602 range_end),
603 client,
604 )
605}
606
607/// Get thumbnails for a list of images. We allow up to 25 thumbnails in a single batch. This method
608/// currently supports files with the following file extensions: jpg, jpeg, png, tiff, tif, gif,
609/// webp, ppm and bmp. Photos that are larger than 20MB in size won't be converted to a thumbnail.
610pub fn get_thumbnail_batch(
611 client: &impl crate::client_trait::UserAuthClient,
612 arg: &GetThumbnailBatchArg,
613) -> Result<GetThumbnailBatchResult, crate::Error<GetThumbnailBatchError>> {
614 crate::client_helpers::unwrap_async(
615 crate::client_helpers::request(
616 client,
617 crate::client_trait_common::Endpoint::Content,
618 crate::client_trait_common::Style::Rpc,
619 "files/get_thumbnail_batch",
620 arg,
621 None)
622 )
623}
624
625/// Starts returning the contents of a folder. If the result's
626/// [`ListFolderResult::has_more`](ListFolderResult) field is true, call
627/// [`list_folder_continue()`](crate::files::list_folder_continue) with the returned
628/// ListFolderResult.cursor to retrieve more entries. If you're using ListFolderArg.recursive set to
629/// true to keep a local cache of the contents of a Dropbox account, iterate through each entry in
630/// order and process them as follows to keep your local state in sync: For each FileMetadata, store
631/// the new entry at the given path in your local state. If the required parent folders don't exist
632/// yet, create them. If there's already something else at the given path, replace it and remove all
633/// its children. For each FolderMetadata, store the new entry at the given path in your local
634/// state. If the required parent folders don't exist yet, create them. If there's already something
635/// else at the given path, replace it but leave the children as they are. Check the new entry's
636/// FolderSharingInfo.read_only and set all its children's read-only statuses to match. For each
637/// DeletedMetadata, if your local state has something at the given path, remove it and all its
638/// children. If there's nothing at the given path, ignore this entry. Note: auth.RateLimitError may
639/// be returned if multiple [`list_folder()`](crate::files::list_folder) or
640/// [`list_folder_continue()`](crate::files::list_folder_continue) calls with same parameters are
641/// made simultaneously by same API app for same user. If your app implements retry logic, please
642/// hold off the retry until the previous request finishes.
643pub fn list_folder(
644 client: &impl crate::client_trait::UserAuthClient,
645 arg: &ListFolderArg,
646) -> Result<ListFolderResult, crate::Error<ListFolderError>> {
647 crate::client_helpers::unwrap_async(
648 crate::client_helpers::request(
649 client,
650 crate::client_trait_common::Endpoint::Api,
651 crate::client_trait_common::Style::Rpc,
652 "files/list_folder",
653 arg,
654 None)
655 )
656}
657
658/// Starts returning the contents of a folder. If the result's
659/// [`ListFolderResult::has_more`](ListFolderResult) field is true, call
660/// [`list_folder_continue()`](crate::files::list_folder_continue) with the returned
661/// ListFolderResult.cursor to retrieve more entries. If you're using ListFolderArg.recursive set to
662/// true to keep a local cache of the contents of a Dropbox account, iterate through each entry in
663/// order and process them as follows to keep your local state in sync: For each FileMetadata, store
664/// the new entry at the given path in your local state. If the required parent folders don't exist
665/// yet, create them. If there's already something else at the given path, replace it and remove all
666/// its children. For each FolderMetadata, store the new entry at the given path in your local
667/// state. If the required parent folders don't exist yet, create them. If there's already something
668/// else at the given path, replace it but leave the children as they are. Check the new entry's
669/// FolderSharingInfo.read_only and set all its children's read-only statuses to match. For each
670/// DeletedMetadata, if your local state has something at the given path, remove it and all its
671/// children. If there's nothing at the given path, ignore this entry. Note: auth.RateLimitError may
672/// be returned if multiple [`list_folder()`](crate::files::list_folder) or
673/// [`list_folder_continue()`](crate::files::list_folder_continue) calls with same parameters are
674/// made simultaneously by same API app for same user. If your app implements retry logic, please
675/// hold off the retry until the previous request finishes.
676pub fn list_folder_app_auth(
677 client: &impl crate::client_trait::AppAuthClient,
678 arg: &ListFolderArg,
679) -> Result<ListFolderResult, crate::Error<ListFolderError>> {
680 crate::client_helpers::unwrap_async(
681 crate::client_helpers::request(
682 client,
683 crate::client_trait_common::Endpoint::Api,
684 crate::client_trait_common::Style::Rpc,
685 "files/list_folder",
686 arg,
687 None)
688 )
689}
690
691/// Once a cursor has been retrieved from [`list_folder()`](crate::files::list_folder), use this to
692/// paginate through all files and retrieve updates to the folder, following the same rules as
693/// documented for [`list_folder()`](crate::files::list_folder).
694pub fn list_folder_continue(
695 client: &impl crate::client_trait::UserAuthClient,
696 arg: &ListFolderContinueArg,
697) -> Result<ListFolderResult, crate::Error<ListFolderContinueError>> {
698 crate::client_helpers::unwrap_async(
699 crate::client_helpers::request(
700 client,
701 crate::client_trait_common::Endpoint::Api,
702 crate::client_trait_common::Style::Rpc,
703 "files/list_folder/continue",
704 arg,
705 None)
706 )
707}
708
709/// Once a cursor has been retrieved from [`list_folder()`](crate::files::list_folder), use this to
710/// paginate through all files and retrieve updates to the folder, following the same rules as
711/// documented for [`list_folder()`](crate::files::list_folder).
712pub fn list_folder_continue_app_auth(
713 client: &impl crate::client_trait::AppAuthClient,
714 arg: &ListFolderContinueArg,
715) -> Result<ListFolderResult, crate::Error<ListFolderContinueError>> {
716 crate::client_helpers::unwrap_async(
717 crate::client_helpers::request(
718 client,
719 crate::client_trait_common::Endpoint::Api,
720 crate::client_trait_common::Style::Rpc,
721 "files/list_folder/continue",
722 arg,
723 None)
724 )
725}
726
727/// A way to quickly get a cursor for the folder's state. Unlike
728/// [`list_folder()`](crate::files::list_folder),
729/// [`list_folder_get_latest_cursor()`](crate::files::list_folder_get_latest_cursor) doesn't return
730/// any entries. This endpoint is for app which only needs to know about new files and modifications
731/// and doesn't need to know about files that already exist in Dropbox.
732pub fn list_folder_get_latest_cursor(
733 client: &impl crate::client_trait::UserAuthClient,
734 arg: &ListFolderArg,
735) -> Result<ListFolderGetLatestCursorResult, crate::Error<ListFolderError>> {
736 crate::client_helpers::unwrap_async(
737 crate::client_helpers::request(
738 client,
739 crate::client_trait_common::Endpoint::Api,
740 crate::client_trait_common::Style::Rpc,
741 "files/list_folder/get_latest_cursor",
742 arg,
743 None)
744 )
745}
746
747/// A longpoll endpoint to wait for changes on an account. In conjunction with
748/// [`list_folder_continue()`](crate::files::list_folder_continue), this call gives you a
749/// low-latency way to monitor an account for file changes. The connection will block until there
750/// are changes available or a timeout occurs. This endpoint is useful mostly for client-side apps.
751pub fn list_folder_longpoll(
752 client: &impl crate::client_trait::NoauthClient,
753 arg: &ListFolderLongpollArg,
754) -> Result<ListFolderLongpollResult, crate::Error<ListFolderLongpollError>> {
755 crate::client_helpers::unwrap_async(
756 crate::client_helpers::request(
757 client,
758 crate::client_trait_common::Endpoint::Notify,
759 crate::client_trait_common::Style::Rpc,
760 "files/list_folder/longpoll",
761 arg,
762 None)
763 )
764}
765
766/// Returns revisions for files based on a file path or a file id. The file path or file id is
767/// identified from the latest file entry at the given file path or id. This end point allows your
768/// app to query either by file path or file id by setting the mode parameter appropriately. In the
769/// ListRevisionsMode.path (default) mode, all revisions at the same file path as the latest file
770/// entry are returned. If revisions with the same file id are desired, then mode must be set to
771/// ListRevisionsMode.id. The ListRevisionsMode.id mode is useful to retrieve revisions for a given
772/// file across moves or renames.
773pub fn list_revisions(
774 client: &impl crate::client_trait::UserAuthClient,
775 arg: &ListRevisionsArg,
776) -> Result<ListRevisionsResult, crate::Error<ListRevisionsError>> {
777 crate::client_helpers::unwrap_async(
778 crate::client_helpers::request(
779 client,
780 crate::client_trait_common::Endpoint::Api,
781 crate::client_trait_common::Style::Rpc,
782 "files/list_revisions",
783 arg,
784 None)
785 )
786}
787
788/// Lock the files at the given paths. A locked file will be writable only by the lock holder. A
789/// successful response indicates that the file has been locked. Returns a list of the locked file
790/// paths and their metadata after this operation.
791pub fn lock_file_batch(
792 client: &impl crate::client_trait::UserAuthClient,
793 arg: &LockFileBatchArg,
794) -> Result<LockFileBatchResult, crate::Error<LockFileError>> {
795 crate::client_helpers::unwrap_async(
796 crate::client_helpers::request(
797 client,
798 crate::client_trait_common::Endpoint::Api,
799 crate::client_trait_common::Style::Rpc,
800 "files/lock_file_batch",
801 arg,
802 None)
803 )
804}
805
806/// Move a file or folder to a different location in the user's Dropbox. If the source path is a
807/// folder all its contents will be moved.
808#[deprecated]
809pub fn do_move(
810 client: &impl crate::client_trait::UserAuthClient,
811 arg: &RelocationArg,
812) -> Result<Metadata, crate::Error<RelocationError>> {
813 crate::client_helpers::unwrap_async(
814 crate::client_helpers::request(
815 client,
816 crate::client_trait_common::Endpoint::Api,
817 crate::client_trait_common::Style::Rpc,
818 "files/move",
819 arg,
820 None)
821 )
822}
823
824/// Move a file or folder to a different location in the user's Dropbox. If the source path is a
825/// folder all its contents will be moved. Note that we do not currently support case-only renaming.
826pub fn move_v2(
827 client: &impl crate::client_trait::UserAuthClient,
828 arg: &RelocationArg,
829) -> Result<RelocationResult, crate::Error<RelocationError>> {
830 crate::client_helpers::unwrap_async(
831 crate::client_helpers::request(
832 client,
833 crate::client_trait_common::Endpoint::Api,
834 crate::client_trait_common::Style::Rpc,
835 "files/move_v2",
836 arg,
837 None)
838 )
839}
840
841/// Move multiple files or folders to different locations at once in the user's Dropbox. This route
842/// will return job ID immediately and do the async moving job in background. Please use
843/// [`move_batch_check()`](crate::files::move_batch_check) to check the job status.
844#[deprecated]
845pub fn move_batch(
846 client: &impl crate::client_trait::UserAuthClient,
847 arg: &RelocationBatchArg,
848) -> Result<RelocationBatchLaunch, crate::Error<crate::NoError>> {
849 crate::client_helpers::unwrap_async(
850 crate::client_helpers::request(
851 client,
852 crate::client_trait_common::Endpoint::Api,
853 crate::client_trait_common::Style::Rpc,
854 "files/move_batch",
855 arg,
856 None)
857 )
858}
859
860/// Move multiple files or folders to different locations at once in the user's Dropbox. Note that
861/// we do not currently support case-only renaming. This route will replace
862/// [`move_batch()`](crate::files::move_batch). The main difference is this route will return status
863/// for each entry, while [`move_batch()`](crate::files::move_batch) raises failure if any entry
864/// fails. This route will either finish synchronously, or return a job ID and do the async move job
865/// in background. Please use [`move_batch_check_v2()`](crate::files::move_batch_check_v2) to check
866/// the job status.
867pub fn move_batch_v2(
868 client: &impl crate::client_trait::UserAuthClient,
869 arg: &MoveBatchArg,
870) -> Result<RelocationBatchV2Launch, crate::Error<crate::NoError>> {
871 crate::client_helpers::unwrap_async(
872 crate::client_helpers::request(
873 client,
874 crate::client_trait_common::Endpoint::Api,
875 crate::client_trait_common::Style::Rpc,
876 "files/move_batch_v2",
877 arg,
878 None)
879 )
880}
881
882/// Returns the status of an asynchronous job for [`move_batch()`](crate::files::move_batch). If
883/// success, it returns list of results for each entry.
884#[deprecated]
885pub fn move_batch_check(
886 client: &impl crate::client_trait::UserAuthClient,
887 arg: &crate::types::dbx_async::PollArg,
888) -> Result<RelocationBatchJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
889 crate::client_helpers::unwrap_async(
890 crate::client_helpers::request(
891 client,
892 crate::client_trait_common::Endpoint::Api,
893 crate::client_trait_common::Style::Rpc,
894 "files/move_batch/check",
895 arg,
896 None)
897 )
898}
899
900/// Returns the status of an asynchronous job for [`move_batch_v2()`](crate::files::move_batch_v2).
901/// It returns list of results for each entry.
902pub fn move_batch_check_v2(
903 client: &impl crate::client_trait::UserAuthClient,
904 arg: &crate::types::dbx_async::PollArg,
905) -> Result<RelocationBatchV2JobStatus, crate::Error<crate::types::dbx_async::PollError>> {
906 crate::client_helpers::unwrap_async(
907 crate::client_helpers::request(
908 client,
909 crate::client_trait_common::Endpoint::Api,
910 crate::client_trait_common::Style::Rpc,
911 "files/move_batch/check_v2",
912 arg,
913 None)
914 )
915}
916
917/// Creates a new Paper doc with the provided content.
918///
919/// # Stability
920/// *PREVIEW*: This function may change or disappear without notice.
921#[cfg(feature = "unstable")]
922#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
923pub fn paper_create(
924 client: &impl crate::client_trait::UserAuthClient,
925 arg: &PaperCreateArg,
926 body: &[u8],
927) -> Result<PaperCreateResult, crate::Error<PaperCreateError>> {
928 crate::client_helpers::unwrap_async(
929 crate::client_helpers::request(
930 client,
931 crate::client_trait_common::Endpoint::Api,
932 crate::client_trait_common::Style::Upload,
933 "files/paper/create",
934 arg,
935 Some(crate::client_helpers::Body::from(body)))
936 )
937}
938
939/// Updates an existing Paper doc with the provided content.
940///
941/// # Stability
942/// *PREVIEW*: This function may change or disappear without notice.
943#[cfg(feature = "unstable")]
944#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
945pub fn paper_update(
946 client: &impl crate::client_trait::UserAuthClient,
947 arg: &PaperUpdateArg,
948 body: &[u8],
949) -> Result<PaperUpdateResult, crate::Error<PaperUpdateError>> {
950 crate::client_helpers::unwrap_async(
951 crate::client_helpers::request(
952 client,
953 crate::client_trait_common::Endpoint::Api,
954 crate::client_trait_common::Style::Upload,
955 "files/paper/update",
956 arg,
957 Some(crate::client_helpers::Body::from(body)))
958 )
959}
960
961/// Permanently delete the file or folder at a given path (see https://www.dropbox.com/en/help/40).
962/// If the given file or folder is not yet deleted, this route will first delete it. It is possible
963/// for this route to successfully delete, then fail to permanently delete. Note: This endpoint is
964/// only available for Dropbox Business apps.
965pub fn permanently_delete(
966 client: &impl crate::client_trait::UserAuthClient,
967 arg: &DeleteArg,
968) -> Result<(), crate::Error<DeleteError>> {
969 crate::client_helpers::unwrap_async(
970 crate::client_helpers::request(
971 client,
972 crate::client_trait_common::Endpoint::Api,
973 crate::client_trait_common::Style::Rpc,
974 "files/permanently_delete",
975 arg,
976 None)
977 )
978}
979
980/// Add property groups to a Dropbox file. See templates/add_for_user or templates/add_for_team to
981/// create new templates.
982#[deprecated]
983pub fn properties_add(
984 client: &impl crate::client_trait::UserAuthClient,
985 arg: &crate::types::file_properties::AddPropertiesArg,
986) -> Result<(), crate::Error<crate::types::file_properties::AddPropertiesError>> {
987 crate::client_helpers::unwrap_async(
988 crate::client_helpers::request(
989 client,
990 crate::client_trait_common::Endpoint::Api,
991 crate::client_trait_common::Style::Rpc,
992 "files/properties/add",
993 arg,
994 None)
995 )
996}
997
998/// Overwrite property groups associated with a file. This endpoint should be used instead of
999/// properties/update when property groups are being overwritten rather than updated via a "delta".
1000#[deprecated]
1001pub fn properties_overwrite(
1002 client: &impl crate::client_trait::UserAuthClient,
1003 arg: &crate::types::file_properties::OverwritePropertyGroupArg,
1004) -> Result<(), crate::Error<crate::types::file_properties::InvalidPropertyGroupError>> {
1005 crate::client_helpers::unwrap_async(
1006 crate::client_helpers::request(
1007 client,
1008 crate::client_trait_common::Endpoint::Api,
1009 crate::client_trait_common::Style::Rpc,
1010 "files/properties/overwrite",
1011 arg,
1012 None)
1013 )
1014}
1015
1016/// Add, update or remove properties associated with the supplied file and templates. This endpoint
1017/// should be used instead of properties/overwrite when property groups are being updated via a
1018/// "delta" instead of overwriting all properties of a file.
1019#[deprecated]
1020pub fn properties_update(
1021 client: &impl crate::client_trait::UserAuthClient,
1022 arg: &crate::types::file_properties::UpdatePropertiesArg,
1023) -> Result<(), crate::Error<crate::types::file_properties::UpdatePropertiesError>> {
1024 crate::client_helpers::unwrap_async(
1025 crate::client_helpers::request(
1026 client,
1027 crate::client_trait_common::Endpoint::Api,
1028 crate::client_trait_common::Style::Rpc,
1029 "files/properties/update",
1030 arg,
1031 None)
1032 )
1033}
1034
1035/// Restore a specific revision of a file to the given path.
1036pub fn restore(
1037 client: &impl crate::client_trait::UserAuthClient,
1038 arg: &RestoreArg,
1039) -> Result<FileMetadata, crate::Error<RestoreError>> {
1040 crate::client_helpers::unwrap_async(
1041 crate::client_helpers::request(
1042 client,
1043 crate::client_trait_common::Endpoint::Api,
1044 crate::client_trait_common::Style::Rpc,
1045 "files/restore",
1046 arg,
1047 None)
1048 )
1049}
1050
1051/// Save the data from a specified URL into a file in user's Dropbox. Note that the transfer from
1052/// the URL must complete within 15 minutes, or the operation will time out and the job will fail.
1053pub fn save_url(
1054 client: &impl crate::client_trait::UserAuthClient,
1055 arg: &SaveUrlArg,
1056) -> Result<SaveUrlResult, crate::Error<SaveUrlError>> {
1057 crate::client_helpers::unwrap_async(
1058 crate::client_helpers::request(
1059 client,
1060 crate::client_trait_common::Endpoint::Api,
1061 crate::client_trait_common::Style::Rpc,
1062 "files/save_url",
1063 arg,
1064 None)
1065 )
1066}
1067
1068/// Check the status of a [`save_url()`](crate::files::save_url) job.
1069pub fn save_url_check_job_status(
1070 client: &impl crate::client_trait::UserAuthClient,
1071 arg: &crate::types::dbx_async::PollArg,
1072) -> Result<SaveUrlJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
1073 crate::client_helpers::unwrap_async(
1074 crate::client_helpers::request(
1075 client,
1076 crate::client_trait_common::Endpoint::Api,
1077 crate::client_trait_common::Style::Rpc,
1078 "files/save_url/check_job_status",
1079 arg,
1080 None)
1081 )
1082}
1083
1084/// Searches for files and folders. Note: Recent changes will be reflected in search results within
1085/// a few seconds and older revisions of existing files may still match your query for up to a few
1086/// days.
1087#[deprecated]
1088pub fn search(
1089 client: &impl crate::client_trait::UserAuthClient,
1090 arg: &SearchArg,
1091) -> Result<SearchResult, crate::Error<SearchError>> {
1092 crate::client_helpers::unwrap_async(
1093 crate::client_helpers::request(
1094 client,
1095 crate::client_trait_common::Endpoint::Api,
1096 crate::client_trait_common::Style::Rpc,
1097 "files/search",
1098 arg,
1099 None)
1100 )
1101}
1102
1103/// Searches for files and folders. Note: [`search_v2()`](crate::files::search_v2) along with
1104/// [`search_continue_v2()`](crate::files::search_continue_v2) can only be used to retrieve a
1105/// maximum of 10,000 matches. Recent changes may not immediately be reflected in search results due
1106/// to a short delay in indexing. Duplicate results may be returned across pages. Some results may
1107/// not be returned.
1108pub fn search_v2(
1109 client: &impl crate::client_trait::UserAuthClient,
1110 arg: &SearchV2Arg,
1111) -> Result<SearchV2Result, crate::Error<SearchError>> {
1112 crate::client_helpers::unwrap_async(
1113 crate::client_helpers::request(
1114 client,
1115 crate::client_trait_common::Endpoint::Api,
1116 crate::client_trait_common::Style::Rpc,
1117 "files/search_v2",
1118 arg,
1119 None)
1120 )
1121}
1122
1123/// Fetches the next page of search results returned from [`search_v2()`](crate::files::search_v2).
1124/// Note: [`search_v2()`](crate::files::search_v2) along with
1125/// [`search_continue_v2()`](crate::files::search_continue_v2) can only be used to retrieve a
1126/// maximum of 10,000 matches. Recent changes may not immediately be reflected in search results due
1127/// to a short delay in indexing. Duplicate results may be returned across pages. Some results may
1128/// not be returned.
1129pub fn search_continue_v2(
1130 client: &impl crate::client_trait::UserAuthClient,
1131 arg: &SearchV2ContinueArg,
1132) -> Result<SearchV2Result, crate::Error<SearchError>> {
1133 crate::client_helpers::unwrap_async(
1134 crate::client_helpers::request(
1135 client,
1136 crate::client_trait_common::Endpoint::Api,
1137 crate::client_trait_common::Style::Rpc,
1138 "files/search/continue_v2",
1139 arg,
1140 None)
1141 )
1142}
1143
1144/// Add a tag to an item. A tag is a string. The strings are automatically converted to lowercase
1145/// letters. No more than 20 tags can be added to a given item.
1146///
1147/// # Stability
1148/// *PREVIEW*: This function may change or disappear without notice.
1149#[cfg(feature = "unstable")]
1150#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
1151pub fn tags_add(
1152 client: &impl crate::client_trait::UserAuthClient,
1153 arg: &AddTagArg,
1154) -> Result<(), crate::Error<AddTagError>> {
1155 crate::client_helpers::unwrap_async(
1156 crate::client_helpers::request(
1157 client,
1158 crate::client_trait_common::Endpoint::Api,
1159 crate::client_trait_common::Style::Rpc,
1160 "files/tags/add",
1161 arg,
1162 None)
1163 )
1164}
1165
1166/// Get list of tags assigned to items.
1167///
1168/// # Stability
1169/// *PREVIEW*: This function may change or disappear without notice.
1170#[cfg(feature = "unstable")]
1171#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
1172pub fn tags_get(
1173 client: &impl crate::client_trait::UserAuthClient,
1174 arg: &GetTagsArg,
1175) -> Result<GetTagsResult, crate::Error<BaseTagError>> {
1176 crate::client_helpers::unwrap_async(
1177 crate::client_helpers::request(
1178 client,
1179 crate::client_trait_common::Endpoint::Api,
1180 crate::client_trait_common::Style::Rpc,
1181 "files/tags/get",
1182 arg,
1183 None)
1184 )
1185}
1186
1187/// Remove a tag from an item.
1188///
1189/// # Stability
1190/// *PREVIEW*: This function may change or disappear without notice.
1191#[cfg(feature = "unstable")]
1192#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
1193pub fn tags_remove(
1194 client: &impl crate::client_trait::UserAuthClient,
1195 arg: &RemoveTagArg,
1196) -> Result<(), crate::Error<RemoveTagError>> {
1197 crate::client_helpers::unwrap_async(
1198 crate::client_helpers::request(
1199 client,
1200 crate::client_trait_common::Endpoint::Api,
1201 crate::client_trait_common::Style::Rpc,
1202 "files/tags/remove",
1203 arg,
1204 None)
1205 )
1206}
1207
1208/// Unlock the files at the given paths. A locked file can only be unlocked by the lock holder or,
1209/// if a business account, a team admin. A successful response indicates that the file has been
1210/// unlocked. Returns a list of the unlocked file paths and their metadata after this operation.
1211pub fn unlock_file_batch(
1212 client: &impl crate::client_trait::UserAuthClient,
1213 arg: &UnlockFileBatchArg,
1214) -> Result<LockFileBatchResult, crate::Error<LockFileError>> {
1215 crate::client_helpers::unwrap_async(
1216 crate::client_helpers::request(
1217 client,
1218 crate::client_trait_common::Endpoint::Api,
1219 crate::client_trait_common::Style::Rpc,
1220 "files/unlock_file_batch",
1221 arg,
1222 None)
1223 )
1224}
1225
1226/// Create a new file with the contents provided in the request. Do not use this to upload a file
1227/// larger than 150 MiB. Instead, create an upload session with
1228/// [`upload_session_start()`](crate::files::upload_session_start). Calls to this endpoint will
1229/// count as data transport calls for any Dropbox Business teams with a limit on the number of data
1230/// transport calls allowed per month. For more information, see the Data transport limit page
1231/// https://www.dropbox.com/developers/reference/data-transport-limit.
1232pub fn upload(
1233 client: &impl crate::client_trait::UserAuthClient,
1234 arg: &UploadArg,
1235 body: &[u8],
1236) -> Result<FileMetadata, crate::Error<UploadError>> {
1237 crate::client_helpers::unwrap_async(
1238 crate::client_helpers::request(
1239 client,
1240 crate::client_trait_common::Endpoint::Content,
1241 crate::client_trait_common::Style::Upload,
1242 "files/upload",
1243 arg,
1244 Some(crate::client_helpers::Body::from(body)))
1245 )
1246}
1247
1248/// Append more data to an upload session. A single request should not upload more than 150 MiB. The
1249/// maximum size of a file one can upload to an upload session is 2^41 - 2^22 (2,199,019,061,248)
1250/// bytes. Calls to this endpoint will count as data transport calls for any Dropbox Business teams
1251/// with a limit on the number of data transport calls allowed per month. For more information, see
1252/// the Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit.
1253#[deprecated]
1254pub fn upload_session_append(
1255 client: &impl crate::client_trait::UserAuthClient,
1256 arg: &UploadSessionCursor,
1257 body: &[u8],
1258) -> Result<(), crate::Error<UploadSessionAppendError>> {
1259 crate::client_helpers::unwrap_async(
1260 crate::client_helpers::request(
1261 client,
1262 crate::client_trait_common::Endpoint::Content,
1263 crate::client_trait_common::Style::Upload,
1264 "files/upload_session/append",
1265 arg,
1266 Some(crate::client_helpers::Body::from(body)))
1267 )
1268}
1269
1270/// Append more data to an upload session. When the parameter close is set, this call will close the
1271/// session. A single request should not upload more than 150 MiB. The maximum size of a file one
1272/// can upload to an upload session is 2^41 - 2^22 (2,199,019,061,248) bytes. Calls to this endpoint
1273/// will count as data transport calls for any Dropbox Business teams with a limit on the number of
1274/// data transport calls allowed per month. For more information, see the Data transport limit page
1275/// https://www.dropbox.com/developers/reference/data-transport-limit.
1276pub fn upload_session_append_v2(
1277 client: &impl crate::client_trait::UserAuthClient,
1278 arg: &UploadSessionAppendArg,
1279 body: &[u8],
1280) -> Result<(), crate::Error<UploadSessionAppendError>> {
1281 crate::client_helpers::unwrap_async(
1282 crate::client_helpers::request(
1283 client,
1284 crate::client_trait_common::Endpoint::Content,
1285 crate::client_trait_common::Style::Upload,
1286 "files/upload_session/append_v2",
1287 arg,
1288 Some(crate::client_helpers::Body::from(body)))
1289 )
1290}
1291
1292/// Append more data to multiple upload sessions. Each piece of file content to append to each
1293/// upload session should be concatenated in the request body, in the order delineated by
1294/// [`UploadSessionAppendBatchArg::entries`](UploadSessionAppendBatchArg) and their individual
1295/// lengths indicated by
1296/// [`UploadSessionAppendBatchArgEntry::length`](UploadSessionAppendBatchArgEntry). A single request
1297/// should not upload more than 150 MiB. The maximum size of a file one can upload to an upload
1298/// session is 2^41 - 2^22 (2,199,019,061,248) bytes. Calls to this endpoint will count as data
1299/// transport calls for any Dropbox Business teams with a limit on the number of data transport
1300/// calls allowed per month. For more information, see the Data transport limit page
1301/// https://www.dropbox.com/developers/reference/data-transport-limit.
1302pub fn upload_session_append_batch(
1303 client: &impl crate::client_trait::UserAuthClient,
1304 arg: &UploadSessionAppendBatchArg,
1305 body: &[u8],
1306) -> Result<UploadSessionAppendBatchResult, crate::Error<UploadSessionAppendBatchError>> {
1307 crate::client_helpers::unwrap_async(
1308 crate::client_helpers::request(
1309 client,
1310 crate::client_trait_common::Endpoint::Content,
1311 crate::client_trait_common::Style::Upload,
1312 "files/upload_session/append_batch",
1313 arg,
1314 Some(crate::client_helpers::Body::from(body)))
1315 )
1316}
1317
1318/// Finish an upload session and save the uploaded data to the given file path. A single request
1319/// should not upload more than 150 MiB. The maximum size of a file one can upload to an upload
1320/// session is 2^41 - 2^22 (2,199,019,061,248) bytes. Calls to this endpoint will count as data
1321/// transport calls for any Dropbox Business teams with a limit on the number of data transport
1322/// calls allowed per month. For more information, see the Data transport limit page
1323/// https://www.dropbox.com/developers/reference/data-transport-limit.
1324pub fn upload_session_finish(
1325 client: &impl crate::client_trait::UserAuthClient,
1326 arg: &UploadSessionFinishArg,
1327 body: &[u8],
1328) -> Result<FileMetadata, crate::Error<UploadSessionFinishError>> {
1329 crate::client_helpers::unwrap_async(
1330 crate::client_helpers::request(
1331 client,
1332 crate::client_trait_common::Endpoint::Content,
1333 crate::client_trait_common::Style::Upload,
1334 "files/upload_session/finish",
1335 arg,
1336 Some(crate::client_helpers::Body::from(body)))
1337 )
1338}
1339
1340/// This route helps you commit many files at once into a user's Dropbox. Use
1341/// [`upload_session_start()`](crate::files::upload_session_start) and
1342/// [`upload_session_append_v2()`](crate::files::upload_session_append_v2) to upload file contents.
1343/// We recommend uploading many files in parallel to increase throughput. Once the file contents
1344/// have been uploaded, rather than calling
1345/// [`upload_session_finish()`](crate::files::upload_session_finish), use this route to finish all
1346/// your upload sessions in a single request.
1347/// [`UploadSessionStartArg::close`](UploadSessionStartArg) or
1348/// [`UploadSessionAppendArg::close`](UploadSessionAppendArg) needs to be true for the last
1349/// [`upload_session_start()`](crate::files::upload_session_start) or
1350/// [`upload_session_append_v2()`](crate::files::upload_session_append_v2) call. The maximum size of
1351/// a file one can upload to an upload session is 2^41 - 2^22 (2,199,019,061,248) bytes. This route
1352/// will return a job_id immediately and do the async commit job in background. Use
1353/// [`upload_session_finish_batch_check()`](crate::files::upload_session_finish_batch_check) to
1354/// check the job status. For the same account, this route should be executed serially. That means
1355/// you should not start the next job before current job finishes. We allow up to 1000 entries in a
1356/// single request. Calls to this endpoint will count as data transport calls for any Dropbox
1357/// Business teams with a limit on the number of data transport calls allowed per month. For more
1358/// information, see the Data transport limit page
1359/// https://www.dropbox.com/developers/reference/data-transport-limit.
1360#[deprecated]
1361pub fn upload_session_finish_batch(
1362 client: &impl crate::client_trait::UserAuthClient,
1363 arg: &UploadSessionFinishBatchArg,
1364) -> Result<UploadSessionFinishBatchLaunch, crate::Error<crate::NoError>> {
1365 crate::client_helpers::unwrap_async(
1366 crate::client_helpers::request(
1367 client,
1368 crate::client_trait_common::Endpoint::Api,
1369 crate::client_trait_common::Style::Rpc,
1370 "files/upload_session/finish_batch",
1371 arg,
1372 None)
1373 )
1374}
1375
1376/// This route helps you commit many files at once into a user's Dropbox. Use
1377/// [`upload_session_start()`](crate::files::upload_session_start) and
1378/// [`upload_session_append_v2()`](crate::files::upload_session_append_v2) to upload file contents.
1379/// We recommend uploading many files in parallel to increase throughput. Once the file contents
1380/// have been uploaded, rather than calling
1381/// [`upload_session_finish()`](crate::files::upload_session_finish), use this route to finish all
1382/// your upload sessions in a single request.
1383/// [`UploadSessionStartArg::close`](UploadSessionStartArg) or
1384/// [`UploadSessionAppendArg::close`](UploadSessionAppendArg) needs to be true for the last
1385/// [`upload_session_start()`](crate::files::upload_session_start) or
1386/// [`upload_session_append_v2()`](crate::files::upload_session_append_v2) call of each upload
1387/// session. The maximum size of a file one can upload to an upload session is 2^41 - 2^22
1388/// (2,199,019,061,248) bytes. We allow up to 1000 entries in a single request. Calls to this
1389/// endpoint will count as data transport calls for any Dropbox Business teams with a limit on the
1390/// number of data transport calls allowed per month. For more information, see the Data transport
1391/// limit page https://www.dropbox.com/developers/reference/data-transport-limit.
1392pub fn upload_session_finish_batch_v2(
1393 client: &impl crate::client_trait::UserAuthClient,
1394 arg: &UploadSessionFinishBatchArg,
1395) -> Result<UploadSessionFinishBatchResult, crate::Error<crate::NoError>> {
1396 crate::client_helpers::unwrap_async(
1397 crate::client_helpers::request(
1398 client,
1399 crate::client_trait_common::Endpoint::Api,
1400 crate::client_trait_common::Style::Rpc,
1401 "files/upload_session/finish_batch_v2",
1402 arg,
1403 None)
1404 )
1405}
1406
1407/// Returns the status of an asynchronous job for
1408/// [`upload_session_finish_batch()`](crate::files::upload_session_finish_batch). If success, it
1409/// returns list of result for each entry.
1410pub fn upload_session_finish_batch_check(
1411 client: &impl crate::client_trait::UserAuthClient,
1412 arg: &crate::types::dbx_async::PollArg,
1413) -> Result<UploadSessionFinishBatchJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
1414 crate::client_helpers::unwrap_async(
1415 crate::client_helpers::request(
1416 client,
1417 crate::client_trait_common::Endpoint::Api,
1418 crate::client_trait_common::Style::Rpc,
1419 "files/upload_session/finish_batch/check",
1420 arg,
1421 None)
1422 )
1423}
1424
1425/// Upload sessions allow you to upload a single file in one or more requests, for example where the
1426/// size of the file is greater than 150 MiB. This call starts a new upload session with the given
1427/// data. You can then use [`upload_session_append_v2()`](crate::files::upload_session_append_v2) or
1428/// [`upload_session_append_batch()`](crate::files::upload_session_append_batch) to add more data,
1429/// then [`upload_session_finish()`](crate::files::upload_session_finish) or
1430/// [`upload_session_finish_batch_v2()`](crate::files::upload_session_finish_batch_v2) to save all
1431/// the data to a file in Dropbox. A single request should not upload more than 150 MiB. The maximum
1432/// size of a file one can upload to an upload session is 2^41 - 2^22 (2,199,019,061,248) bytes. An
1433/// upload session can be used for a maximum of 7 days. Attempting to use a
1434/// [`UploadSessionStartResult::session_id`](UploadSessionStartResult) with
1435/// [`upload_session_append_v2()`](crate::files::upload_session_append_v2) or other upload session
1436/// routes more than 7 days after its creation will return [`UploadSessionLookupError::NotFound`].
1437/// Calls to this endpoint will count as data transport calls for any Dropbox Business teams with a
1438/// limit on the number of data transport calls allowed per month. For more information, see the
1439/// Data transport limit page https://www.dropbox.com/developers/reference/data-transport-limit. By
1440/// default, upload sessions require you to send content of the file in sequential order via
1441/// consecutive [`upload_session_start()`](crate::files::upload_session_start),
1442/// [`upload_session_append_v2()`](crate::files::upload_session_append_v2), and
1443/// [`upload_session_finish()`](crate::files::upload_session_finish) calls (or their batch
1444/// variants). For better performance, you can optionally set
1445/// [`UploadSessionStartArg::session_type`](UploadSessionStartArg) to
1446/// [`UploadSessionType::Concurrent`] to start a concurrent upload session. Concurrent upload
1447/// sessions may upload file data in concurrent
1448/// [`upload_session_append_v2()`](crate::files::upload_session_append_v2) requests, with a few
1449/// caveats. After all of the requests are complete, finish the session with
1450/// [`upload_session_finish()`](crate::files::upload_session_finish) as normal. You can not send
1451/// data in a [`upload_session_start()`](crate::files::upload_session_start) or
1452/// [`upload_session_finish()`](crate::files::upload_session_finish) call, only with
1453/// [`upload_session_append_v2()`](crate::files::upload_session_append_v2) or
1454/// [`upload_session_append_batch()`](crate::files::upload_session_append_batch). Also, the length
1455/// of the uploaded data in a call to
1456/// [`upload_session_append_v2()`](crate::files::upload_session_append_v2) or
1457/// [`upload_session_append_batch()`](crate::files::upload_session_append_batch) must be a multiple
1458/// of 2^22 (4,194,304) bytes, except for the final append request with
1459/// [`UploadSessionAppendArg::close`](UploadSessionAppendArg) or
1460/// [`UploadSessionAppendBatchArgEntry::close`](UploadSessionAppendBatchArgEntry) set to true that
1461/// may contain any remaining data.
1462pub fn upload_session_start(
1463 client: &impl crate::client_trait::UserAuthClient,
1464 arg: &UploadSessionStartArg,
1465 body: &[u8],
1466) -> Result<UploadSessionStartResult, crate::Error<UploadSessionStartError>> {
1467 crate::client_helpers::unwrap_async(
1468 crate::client_helpers::request(
1469 client,
1470 crate::client_trait_common::Endpoint::Content,
1471 crate::client_trait_common::Style::Upload,
1472 "files/upload_session/start",
1473 arg,
1474 Some(crate::client_helpers::Body::from(body)))
1475 )
1476}
1477
1478/// Start a batch of upload sessions. See
1479/// [`upload_session_start()`](crate::files::upload_session_start). Calls to this endpoint will
1480/// count as data transport calls for any Dropbox Business teams with a limit on the number of data
1481/// transport calls allowed per month. For more information, see the Data transport limit page
1482/// https://www.dropbox.com/developers/reference/data-transport-limit.
1483pub fn upload_session_start_batch(
1484 client: &impl crate::client_trait::UserAuthClient,
1485 arg: &UploadSessionStartBatchArg,
1486) -> Result<UploadSessionStartBatchResult, crate::Error<crate::NoError>> {
1487 crate::client_helpers::unwrap_async(
1488 crate::client_helpers::request(
1489 client,
1490 crate::client_trait_common::Endpoint::Api,
1491 crate::client_trait_common::Style::Rpc,
1492 "files/upload_session/start_batch",
1493 arg,
1494 None)
1495 )
1496}
1497