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