Skip to main content

dropbox_sdk/generated/sync_routes/
sharing.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::sharing::*;
14
15/// Adds specified members to a file.
16pub fn add_file_member(
17    client: &impl crate::client_trait::UserAuthClient,
18    arg: &AddFileMemberArgs,
19) -> Result<Vec<FileMemberActionResult>, crate::Error<AddFileMemberError>> {
20    crate::client_helpers::unwrap_async(
21        crate::client_helpers::request(
22            client,
23            crate::client_trait_common::Endpoint::Api,
24            crate::client_trait_common::Style::Rpc,
25            "sharing/add_file_member",
26            arg,
27            None)
28    )
29}
30
31/// Allows an owner or editor (if the ACL update policy allows) of a shared folder to add another
32/// member. For the new member to get access to all the functionality for this folder, you will need
33/// to call [`mount_folder()`](crate::sharing::mount_folder) on their behalf.
34pub fn add_folder_member(
35    client: &impl crate::client_trait::UserAuthClient,
36    arg: &AddFolderMemberArg,
37) -> Result<(), crate::Error<AddFolderMemberError>> {
38    crate::client_helpers::unwrap_async(
39        crate::client_helpers::request(
40            client,
41            crate::client_trait_common::Endpoint::Api,
42            crate::client_trait_common::Style::Rpc,
43            "sharing/add_folder_member",
44            arg,
45            None)
46    )
47}
48
49/// Returns the status of an asynchronous job.
50pub fn check_job_status(
51    client: &impl crate::client_trait::UserAuthClient,
52    arg: &crate::types::dbx_async::PollArg,
53) -> Result<JobStatus, crate::Error<crate::types::dbx_async::PollError>> {
54    crate::client_helpers::unwrap_async(
55        crate::client_helpers::request(
56            client,
57            crate::client_trait_common::Endpoint::Api,
58            crate::client_trait_common::Style::Rpc,
59            "sharing/check_job_status",
60            arg,
61            None)
62    )
63}
64
65/// Returns the status of an asynchronous job for sharing a folder.
66pub fn check_remove_member_job_status(
67    client: &impl crate::client_trait::UserAuthClient,
68    arg: &crate::types::dbx_async::PollArg,
69) -> Result<RemoveMemberJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
70    crate::client_helpers::unwrap_async(
71        crate::client_helpers::request(
72            client,
73            crate::client_trait_common::Endpoint::Api,
74            crate::client_trait_common::Style::Rpc,
75            "sharing/check_remove_member_job_status",
76            arg,
77            None)
78    )
79}
80
81/// Returns the status of an asynchronous job for sharing a folder.
82pub fn check_share_job_status(
83    client: &impl crate::client_trait::UserAuthClient,
84    arg: &crate::types::dbx_async::PollArg,
85) -> Result<ShareFolderJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
86    crate::client_helpers::unwrap_async(
87        crate::client_helpers::request(
88            client,
89            crate::client_trait_common::Endpoint::Api,
90            crate::client_trait_common::Style::Rpc,
91            "sharing/check_share_job_status",
92            arg,
93            None)
94    )
95}
96
97/// Create a shared link. If a shared link already exists for the given path, that link is returned.
98/// Previously, it was technically possible to break a shared link by moving or renaming the
99/// corresponding file or folder. In the future, this will no longer be the case, so your app
100/// shouldn't rely on this behavior. Instead, if your app needs to revoke a shared link, use
101/// revoke_shared_link. DEPRECATED: Use create_shared_link_with_settings instead.
102#[deprecated]
103pub fn create_shared_link(
104    client: &impl crate::client_trait::UserAuthClient,
105    arg: &CreateSharedLinkArg,
106) -> Result<PathLinkMetadata, crate::Error<CreateSharedLinkError>> {
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            "sharing/create_shared_link",
113            arg,
114            None)
115    )
116}
117
118/// Create a shared link with custom settings. If no settings are given then the default visibility
119/// is RequestedVisibility.public (The resolved visibility, though, may depend on other aspects such
120/// as team and shared folder settings).
121pub fn create_shared_link_with_settings(
122    client: &impl crate::client_trait::UserAuthClient,
123    arg: &CreateSharedLinkWithSettingsArg,
124) -> Result<SharedLinkMetadata, crate::Error<CreateSharedLinkWithSettingsError>> {
125    crate::client_helpers::unwrap_async(
126        crate::client_helpers::request(
127            client,
128            crate::client_trait_common::Endpoint::Api,
129            crate::client_trait_common::Style::Rpc,
130            "sharing/create_shared_link_with_settings",
131            arg,
132            None)
133    )
134}
135
136/// Returns shared file metadata.
137pub fn get_file_metadata(
138    client: &impl crate::client_trait::UserAuthClient,
139    arg: &GetFileMetadataArg,
140) -> Result<SharedFileMetadata, crate::Error<GetFileMetadataError>> {
141    crate::client_helpers::unwrap_async(
142        crate::client_helpers::request(
143            client,
144            crate::client_trait_common::Endpoint::Api,
145            crate::client_trait_common::Style::Rpc,
146            "sharing/get_file_metadata",
147            arg,
148            None)
149    )
150}
151
152/// Returns shared file metadata.
153pub fn get_file_metadata_batch(
154    client: &impl crate::client_trait::UserAuthClient,
155    arg: &GetFileMetadataBatchArg,
156) -> Result<Vec<GetFileMetadataBatchResult>, crate::Error<SharingUserError>> {
157    crate::client_helpers::unwrap_async(
158        crate::client_helpers::request(
159            client,
160            crate::client_trait_common::Endpoint::Api,
161            crate::client_trait_common::Style::Rpc,
162            "sharing/get_file_metadata/batch",
163            arg,
164            None)
165    )
166}
167
168/// Returns shared folder metadata by its folder ID.
169pub fn get_folder_metadata(
170    client: &impl crate::client_trait::UserAuthClient,
171    arg: &GetMetadataArgs,
172) -> Result<SharedFolderMetadata, crate::Error<SharedFolderAccessError>> {
173    crate::client_helpers::unwrap_async(
174        crate::client_helpers::request(
175            client,
176            crate::client_trait_common::Endpoint::Api,
177            crate::client_trait_common::Style::Rpc,
178            "sharing/get_folder_metadata",
179            arg,
180            None)
181    )
182}
183
184/// Download the shared link's file from a user's Dropbox. This is a download-style endpoint that
185/// returns the file content.
186pub fn get_shared_link_file(
187    client: &impl crate::client_trait::UserAuthClient,
188    arg: &GetSharedLinkFileArg,
189    range_start: Option<u64>,
190    range_end: Option<u64>,
191) -> Result<crate::client_trait::HttpRequestResult<SharedLinkMetadata>, crate::Error<GetSharedLinkFileError>> {
192    crate::client_helpers::unwrap_async_body(
193        crate::client_helpers::request_with_body(
194            client,
195            crate::client_trait_common::Endpoint::Content,
196            crate::client_trait_common::Style::Download,
197            "sharing/get_shared_link_file",
198            arg,
199            None,
200            range_start,
201            range_end),
202        client,
203    )
204}
205
206/// Download the shared link's file from a user's Dropbox. This is a download-style endpoint that
207/// returns the file content.
208pub fn get_shared_link_file_app_auth(
209    client: &impl crate::client_trait::AppAuthClient,
210    arg: &GetSharedLinkFileArg,
211    range_start: Option<u64>,
212    range_end: Option<u64>,
213) -> Result<crate::client_trait::HttpRequestResult<SharedLinkMetadata>, crate::Error<GetSharedLinkFileError>> {
214    crate::client_helpers::unwrap_async_body(
215        crate::client_helpers::request_with_body(
216            client,
217            crate::client_trait_common::Endpoint::Content,
218            crate::client_trait_common::Style::Download,
219            "sharing/get_shared_link_file",
220            arg,
221            None,
222            range_start,
223            range_end),
224        client,
225    )
226}
227
228/// Get the shared link's metadata.
229pub fn get_shared_link_metadata(
230    client: &impl crate::client_trait::UserAuthClient,
231    arg: &GetSharedLinkMetadataArg,
232) -> Result<SharedLinkMetadata, crate::Error<SharedLinkMetadataError>> {
233    crate::client_helpers::unwrap_async(
234        crate::client_helpers::request(
235            client,
236            crate::client_trait_common::Endpoint::Api,
237            crate::client_trait_common::Style::Rpc,
238            "sharing/get_shared_link_metadata",
239            arg,
240            None)
241    )
242}
243
244/// Get the shared link's metadata.
245pub fn get_shared_link_metadata_app_auth(
246    client: &impl crate::client_trait::AppAuthClient,
247    arg: &GetSharedLinkMetadataArg,
248) -> Result<SharedLinkMetadata, crate::Error<SharedLinkMetadataError>> {
249    crate::client_helpers::unwrap_async(
250        crate::client_helpers::request(
251            client,
252            crate::client_trait_common::Endpoint::Api,
253            crate::client_trait_common::Style::Rpc,
254            "sharing/get_shared_link_metadata",
255            arg,
256            None)
257    )
258}
259
260/// DEPRECATED: Use list_shared_links instead. This endpoint will be retired in October 2026.
261/// Returns a list of [`LinkMetadata`] objects for this user, including collection links. If no path
262/// is given, returns a list of all shared links for the current user, including collection links,
263/// up to a maximum of 1000 links. If a non-empty path is given, returns a list of all shared links
264/// that allow access to the given path. Collection links are never returned in this case.
265#[deprecated]
266pub fn get_shared_links(
267    client: &impl crate::client_trait::UserAuthClient,
268    arg: &GetSharedLinksArg,
269) -> Result<GetSharedLinksResult, crate::Error<GetSharedLinksError>> {
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            "sharing/get_shared_links",
276            arg,
277            None)
278    )
279}
280
281/// Use to obtain the members who have been invited to a file, both inherited and uninherited
282/// members.
283pub fn list_file_members(
284    client: &impl crate::client_trait::UserAuthClient,
285    arg: &ListFileMembersArg,
286) -> Result<SharedFileMembers, crate::Error<ListFileMembersError>> {
287    crate::client_helpers::unwrap_async(
288        crate::client_helpers::request(
289            client,
290            crate::client_trait_common::Endpoint::Api,
291            crate::client_trait_common::Style::Rpc,
292            "sharing/list_file_members",
293            arg,
294            None)
295    )
296}
297
298/// Get members of multiple files at once. The arguments to this route are more limited, and the
299/// limit on query result size per file is more strict. To customize the results more, use the
300/// individual file endpoint. Inherited users and groups are not included in the result, and
301/// permissions are not returned for this endpoint.
302pub fn list_file_members_batch(
303    client: &impl crate::client_trait::UserAuthClient,
304    arg: &ListFileMembersBatchArg,
305) -> Result<Vec<ListFileMembersBatchResult>, crate::Error<SharingUserError>> {
306    crate::client_helpers::unwrap_async(
307        crate::client_helpers::request(
308            client,
309            crate::client_trait_common::Endpoint::Api,
310            crate::client_trait_common::Style::Rpc,
311            "sharing/list_file_members/batch",
312            arg,
313            None)
314    )
315}
316
317/// Once a cursor has been retrieved from [`list_file_members()`](crate::sharing::list_file_members)
318/// or [`list_file_members_batch()`](crate::sharing::list_file_members_batch), use this to paginate
319/// through all shared file members.
320pub fn list_file_members_continue(
321    client: &impl crate::client_trait::UserAuthClient,
322    arg: &ListFileMembersContinueArg,
323) -> Result<SharedFileMembers, crate::Error<ListFileMembersContinueError>> {
324    crate::client_helpers::unwrap_async(
325        crate::client_helpers::request(
326            client,
327            crate::client_trait_common::Endpoint::Api,
328            crate::client_trait_common::Style::Rpc,
329            "sharing/list_file_members/continue",
330            arg,
331            None)
332    )
333}
334
335/// Returns shared folder membership by its folder ID.
336pub fn list_folder_members(
337    client: &impl crate::client_trait::UserAuthClient,
338    arg: &ListFolderMembersArgs,
339) -> Result<SharedFolderMembers, crate::Error<SharedFolderAccessError>> {
340    crate::client_helpers::unwrap_async(
341        crate::client_helpers::request(
342            client,
343            crate::client_trait_common::Endpoint::Api,
344            crate::client_trait_common::Style::Rpc,
345            "sharing/list_folder_members",
346            arg,
347            None)
348    )
349}
350
351/// Once a cursor has been retrieved from
352/// [`list_folder_members()`](crate::sharing::list_folder_members), use this to paginate through all
353/// shared folder members.
354pub fn list_folder_members_continue(
355    client: &impl crate::client_trait::UserAuthClient,
356    arg: &ListFolderMembersContinueArg,
357) -> Result<SharedFolderMembers, crate::Error<ListFolderMembersContinueError>> {
358    crate::client_helpers::unwrap_async(
359        crate::client_helpers::request(
360            client,
361            crate::client_trait_common::Endpoint::Api,
362            crate::client_trait_common::Style::Rpc,
363            "sharing/list_folder_members/continue",
364            arg,
365            None)
366    )
367}
368
369/// Return the list of all shared folders the current user has access to.
370pub fn list_folders(
371    client: &impl crate::client_trait::UserAuthClient,
372    arg: &ListFoldersArgs,
373) -> Result<ListFoldersResult, crate::Error<crate::NoError>> {
374    crate::client_helpers::unwrap_async(
375        crate::client_helpers::request(
376            client,
377            crate::client_trait_common::Endpoint::Api,
378            crate::client_trait_common::Style::Rpc,
379            "sharing/list_folders",
380            arg,
381            None)
382    )
383}
384
385/// Once a cursor has been retrieved from [`list_folders()`](crate::sharing::list_folders), use this
386/// to paginate through all shared folders. The cursor must come from a previous call to
387/// [`list_folders()`](crate::sharing::list_folders) or
388/// [`list_folders_continue()`](crate::sharing::list_folders_continue).
389pub fn list_folders_continue(
390    client: &impl crate::client_trait::UserAuthClient,
391    arg: &ListFoldersContinueArg,
392) -> Result<ListFoldersResult, crate::Error<ListFoldersContinueError>> {
393    crate::client_helpers::unwrap_async(
394        crate::client_helpers::request(
395            client,
396            crate::client_trait_common::Endpoint::Api,
397            crate::client_trait_common::Style::Rpc,
398            "sharing/list_folders/continue",
399            arg,
400            None)
401    )
402}
403
404/// Return the list of all shared folders the current user can mount or unmount.
405pub fn list_mountable_folders(
406    client: &impl crate::client_trait::UserAuthClient,
407    arg: &ListFoldersArgs,
408) -> Result<ListFoldersResult, crate::Error<crate::NoError>> {
409    crate::client_helpers::unwrap_async(
410        crate::client_helpers::request(
411            client,
412            crate::client_trait_common::Endpoint::Api,
413            crate::client_trait_common::Style::Rpc,
414            "sharing/list_mountable_folders",
415            arg,
416            None)
417    )
418}
419
420/// Once a cursor has been retrieved from
421/// [`list_mountable_folders()`](crate::sharing::list_mountable_folders), use this to paginate
422/// through all mountable shared folders. The cursor must come from a previous call to
423/// [`list_mountable_folders()`](crate::sharing::list_mountable_folders) or
424/// [`list_mountable_folders_continue()`](crate::sharing::list_mountable_folders_continue).
425pub fn list_mountable_folders_continue(
426    client: &impl crate::client_trait::UserAuthClient,
427    arg: &ListFoldersContinueArg,
428) -> Result<ListFoldersResult, crate::Error<ListFoldersContinueError>> {
429    crate::client_helpers::unwrap_async(
430        crate::client_helpers::request(
431            client,
432            crate::client_trait_common::Endpoint::Api,
433            crate::client_trait_common::Style::Rpc,
434            "sharing/list_mountable_folders/continue",
435            arg,
436            None)
437    )
438}
439
440/// Returns a list of all files shared with current user.
441pub fn list_received_files(
442    client: &impl crate::client_trait::UserAuthClient,
443    arg: &ListFilesArg,
444) -> Result<ListFilesResult, crate::Error<SharingUserError>> {
445    crate::client_helpers::unwrap_async(
446        crate::client_helpers::request(
447            client,
448            crate::client_trait_common::Endpoint::Api,
449            crate::client_trait_common::Style::Rpc,
450            "sharing/list_received_files",
451            arg,
452            None)
453    )
454}
455
456/// Get more results with a cursor from
457/// [`list_received_files()`](crate::sharing::list_received_files).
458pub fn list_received_files_continue(
459    client: &impl crate::client_trait::UserAuthClient,
460    arg: &ListFilesContinueArg,
461) -> Result<ListFilesResult, crate::Error<ListFilesContinueError>> {
462    crate::client_helpers::unwrap_async(
463        crate::client_helpers::request(
464            client,
465            crate::client_trait_common::Endpoint::Api,
466            crate::client_trait_common::Style::Rpc,
467            "sharing/list_received_files/continue",
468            arg,
469            None)
470    )
471}
472
473/// List shared links of this user. If no path is given, returns a list of all shared links for the
474/// current user. For members of business teams using team space and member folders, returns all
475/// shared links in the team member's home folder unless the team space ID is specified in the
476/// request header. If a non-empty path is given, returns a list of all shared links that allow
477/// access to the given path - direct links to the given path and links to parent folders of the
478/// given path. Links to parent folders can be suppressed by setting direct_only to true.
479pub fn list_shared_links(
480    client: &impl crate::client_trait::UserAuthClient,
481    arg: &ListSharedLinksArg,
482) -> Result<ListSharedLinksResult, crate::Error<ListSharedLinksError>> {
483    crate::client_helpers::unwrap_async(
484        crate::client_helpers::request(
485            client,
486            crate::client_trait_common::Endpoint::Api,
487            crate::client_trait_common::Style::Rpc,
488            "sharing/list_shared_links",
489            arg,
490            None)
491    )
492}
493
494/// Modify the shared link's settings. If the requested visibility conflict with the shared links
495/// policy of the team or the shared folder (in case the linked file is part of a shared folder)
496/// then the LinkPermissions.resolved_visibility of the returned SharedLinkMetadata will reflect the
497/// actual visibility of the shared link and the LinkPermissions.requested_visibility will reflect
498/// the requested visibility.
499pub fn modify_shared_link_settings(
500    client: &impl crate::client_trait::UserAuthClient,
501    arg: &ModifySharedLinkSettingsArgs,
502) -> Result<SharedLinkMetadata, crate::Error<ModifySharedLinkSettingsError>> {
503    crate::client_helpers::unwrap_async(
504        crate::client_helpers::request(
505            client,
506            crate::client_trait_common::Endpoint::Api,
507            crate::client_trait_common::Style::Rpc,
508            "sharing/modify_shared_link_settings",
509            arg,
510            None)
511    )
512}
513
514/// The current user mounts the designated folder. Mount a shared folder for a user after they have
515/// been added as a member. Once mounted, the shared folder will appear in their Dropbox.
516pub fn mount_folder(
517    client: &impl crate::client_trait::UserAuthClient,
518    arg: &MountFolderArg,
519) -> Result<SharedFolderMetadata, crate::Error<MountFolderError>> {
520    crate::client_helpers::unwrap_async(
521        crate::client_helpers::request(
522            client,
523            crate::client_trait_common::Endpoint::Api,
524            crate::client_trait_common::Style::Rpc,
525            "sharing/mount_folder",
526            arg,
527            None)
528    )
529}
530
531/// Removes all self-removable access from a file or folder for the current user. Best-effort and
532/// idempotent: attempts to drop link-visitor associations and explicit ACL membership.
533pub fn relinquish_access(
534    client: &impl crate::client_trait::UserAuthClient,
535    arg: &RelinquishAccessArg,
536) -> Result<RelinquishAccessResult, crate::Error<RelinquishAccessError>> {
537    crate::client_helpers::unwrap_async(
538        crate::client_helpers::request(
539            client,
540            crate::client_trait_common::Endpoint::Api,
541            crate::client_trait_common::Style::Rpc,
542            "sharing/relinquish_access",
543            arg,
544            None)
545    )
546}
547
548/// The current user relinquishes their membership in the designated file.
549pub fn relinquish_file_membership(
550    client: &impl crate::client_trait::UserAuthClient,
551    arg: &RelinquishFileMembershipArg,
552) -> Result<(), crate::Error<RelinquishFileMembershipError>> {
553    crate::client_helpers::unwrap_async(
554        crate::client_helpers::request(
555            client,
556            crate::client_trait_common::Endpoint::Api,
557            crate::client_trait_common::Style::Rpc,
558            "sharing/relinquish_file_membership",
559            arg,
560            None)
561    )
562}
563
564/// The current user relinquishes their membership in the designated shared folder and will no
565/// longer have access to the folder.  A folder owner cannot relinquish membership in their own
566/// folder. This will run synchronously if leave_a_copy is false, and asynchronously if leave_a_copy
567/// is true.
568pub fn relinquish_folder_membership(
569    client: &impl crate::client_trait::UserAuthClient,
570    arg: &RelinquishFolderMembershipArg,
571) -> Result<crate::types::dbx_async::LaunchEmptyResult, crate::Error<RelinquishFolderMembershipError>> {
572    crate::client_helpers::unwrap_async(
573        crate::client_helpers::request(
574            client,
575            crate::client_trait_common::Endpoint::Api,
576            crate::client_trait_common::Style::Rpc,
577            "sharing/relinquish_folder_membership",
578            arg,
579            None)
580    )
581}
582
583/// Identical to remove_file_member_2 but with less information returned.
584#[deprecated]
585pub fn remove_file_member(
586    client: &impl crate::client_trait::UserAuthClient,
587    arg: &RemoveFileMemberArg,
588) -> Result<FileMemberActionIndividualResult, crate::Error<RemoveFileMemberError>> {
589    crate::client_helpers::unwrap_async(
590        crate::client_helpers::request(
591            client,
592            crate::client_trait_common::Endpoint::Api,
593            crate::client_trait_common::Style::Rpc,
594            "sharing/remove_file_member",
595            arg,
596            None)
597    )
598}
599
600/// Removes a specified member from the file.
601pub fn remove_file_member_2(
602    client: &impl crate::client_trait::UserAuthClient,
603    arg: &RemoveFileMemberArg,
604) -> Result<FileMemberRemoveActionResult, crate::Error<RemoveFileMemberError>> {
605    crate::client_helpers::unwrap_async(
606        crate::client_helpers::request(
607            client,
608            crate::client_trait_common::Endpoint::Api,
609            crate::client_trait_common::Style::Rpc,
610            "sharing/remove_file_member_2",
611            arg,
612            None)
613    )
614}
615
616/// Allows an owner or editor (if the ACL update policy allows) of a shared folder to remove another
617/// member.
618pub fn remove_folder_member(
619    client: &impl crate::client_trait::UserAuthClient,
620    arg: &RemoveFolderMemberArg,
621) -> Result<crate::types::dbx_async::LaunchResultBase, crate::Error<RemoveFolderMemberError>> {
622    crate::client_helpers::unwrap_async(
623        crate::client_helpers::request(
624            client,
625            crate::client_trait_common::Endpoint::Api,
626            crate::client_trait_common::Style::Rpc,
627            "sharing/remove_folder_member",
628            arg,
629            None)
630    )
631}
632
633/// Revoke a shared link. Note that even after revoking a shared link to a file, the file may be
634/// accessible if there are shared links leading to any of the file parent folders. To list all
635/// shared links that enable access to a specific file, you can use the list_shared_links with the
636/// file as the ListSharedLinksArg.path argument.
637pub fn revoke_shared_link(
638    client: &impl crate::client_trait::UserAuthClient,
639    arg: &RevokeSharedLinkArg,
640) -> Result<(), crate::Error<RevokeSharedLinkError>> {
641    crate::client_helpers::unwrap_async(
642        crate::client_helpers::request(
643            client,
644            crate::client_trait_common::Endpoint::Api,
645            crate::client_trait_common::Style::Rpc,
646            "sharing/revoke_shared_link",
647            arg,
648            None)
649    )
650}
651
652/// Change the inheritance policy of an existing Shared Folder. Only permitted for shared folders in
653/// a shared team root. If a [`ShareFolderLaunch::AsyncJobId`] is returned, you'll need to call
654/// [`check_share_job_status()`](crate::sharing::check_share_job_status) until the action completes
655/// to get the metadata for the folder.
656pub fn set_access_inheritance(
657    client: &impl crate::client_trait::UserAuthClient,
658    arg: &SetAccessInheritanceArg,
659) -> Result<ShareFolderLaunch, crate::Error<SetAccessInheritanceError>> {
660    crate::client_helpers::unwrap_async(
661        crate::client_helpers::request(
662            client,
663            crate::client_trait_common::Endpoint::Api,
664            crate::client_trait_common::Style::Rpc,
665            "sharing/set_access_inheritance",
666            arg,
667            None)
668    )
669}
670
671/// Share a folder with collaborators. Most sharing will be completed synchronously. Large folders
672/// will be completed asynchronously. To make testing the async case repeatable, set
673/// `ShareFolderArg.force_async`. If a [`ShareFolderLaunch::AsyncJobId`] is returned, you'll need to
674/// call [`check_share_job_status()`](crate::sharing::check_share_job_status) until the action
675/// completes to get the metadata for the folder.
676pub fn share_folder(
677    client: &impl crate::client_trait::UserAuthClient,
678    arg: &ShareFolderArg,
679) -> Result<ShareFolderLaunch, crate::Error<ShareFolderError>> {
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            "sharing/share_folder",
686            arg,
687            None)
688    )
689}
690
691/// Transfer ownership of a shared folder to a member of the shared folder. User must have
692/// [`AccessLevel::Owner`] access to the shared folder to perform a transfer.
693pub fn transfer_folder(
694    client: &impl crate::client_trait::UserAuthClient,
695    arg: &TransferFolderArg,
696) -> Result<(), crate::Error<TransferFolderError>> {
697    crate::client_helpers::unwrap_async(
698        crate::client_helpers::request(
699            client,
700            crate::client_trait_common::Endpoint::Api,
701            crate::client_trait_common::Style::Rpc,
702            "sharing/transfer_folder",
703            arg,
704            None)
705    )
706}
707
708/// The current user unmounts the designated folder. They can re-mount the folder at a later time
709/// using [`mount_folder()`](crate::sharing::mount_folder).
710pub fn unmount_folder(
711    client: &impl crate::client_trait::UserAuthClient,
712    arg: &UnmountFolderArg,
713) -> Result<(), crate::Error<UnmountFolderError>> {
714    crate::client_helpers::unwrap_async(
715        crate::client_helpers::request(
716            client,
717            crate::client_trait_common::Endpoint::Api,
718            crate::client_trait_common::Style::Rpc,
719            "sharing/unmount_folder",
720            arg,
721            None)
722    )
723}
724
725/// Remove all members from this file. Does not remove inherited members.
726pub fn unshare_file(
727    client: &impl crate::client_trait::UserAuthClient,
728    arg: &UnshareFileArg,
729) -> Result<(), crate::Error<UnshareFileError>> {
730    crate::client_helpers::unwrap_async(
731        crate::client_helpers::request(
732            client,
733            crate::client_trait_common::Endpoint::Api,
734            crate::client_trait_common::Style::Rpc,
735            "sharing/unshare_file",
736            arg,
737            None)
738    )
739}
740
741/// Allows a shared folder owner to unshare the folder. Unshare will not work in following cases:
742/// The shared folder contains shared folders OR the shared folder is inside another shared folder.
743/// You'll need to call [`check_job_status()`](crate::sharing::check_job_status) to determine if the
744/// action has completed successfully.
745pub fn unshare_folder(
746    client: &impl crate::client_trait::UserAuthClient,
747    arg: &UnshareFolderArg,
748) -> Result<crate::types::dbx_async::LaunchEmptyResult, crate::Error<UnshareFolderError>> {
749    crate::client_helpers::unwrap_async(
750        crate::client_helpers::request(
751            client,
752            crate::client_trait_common::Endpoint::Api,
753            crate::client_trait_common::Style::Rpc,
754            "sharing/unshare_folder",
755            arg,
756            None)
757    )
758}
759
760/// Changes a member's access on a shared file.
761pub fn update_file_member(
762    client: &impl crate::client_trait::UserAuthClient,
763    arg: &UpdateFileMemberArgs,
764) -> Result<MemberAccessLevelResult, crate::Error<FileMemberActionError>> {
765    crate::client_helpers::unwrap_async(
766        crate::client_helpers::request(
767            client,
768            crate::client_trait_common::Endpoint::Api,
769            crate::client_trait_common::Style::Rpc,
770            "sharing/update_file_member",
771            arg,
772            None)
773    )
774}
775
776/// Update the viewer info policy of a file.
777pub fn update_file_policy(
778    client: &impl crate::client_trait::UserAuthClient,
779    arg: &UpdateFilePolicyArg,
780) -> Result<SharedFileMetadata, crate::Error<UpdateFilePolicyError>> {
781    crate::client_helpers::unwrap_async(
782        crate::client_helpers::request(
783            client,
784            crate::client_trait_common::Endpoint::Api,
785            crate::client_trait_common::Style::Rpc,
786            "sharing/update_file_policy",
787            arg,
788            None)
789    )
790}
791
792/// Allows an owner or editor of a shared folder to update another member's permissions.
793pub fn update_folder_member(
794    client: &impl crate::client_trait::UserAuthClient,
795    arg: &UpdateFolderMemberArg,
796) -> Result<MemberAccessLevelResult, crate::Error<UpdateFolderMemberError>> {
797    crate::client_helpers::unwrap_async(
798        crate::client_helpers::request(
799            client,
800            crate::client_trait_common::Endpoint::Api,
801            crate::client_trait_common::Style::Rpc,
802            "sharing/update_folder_member",
803            arg,
804            None)
805    )
806}
807
808/// Update the sharing policies for a shared folder. User must have [`AccessLevel::Owner`] access to
809/// the shared folder to update its policies.
810pub fn update_folder_policy(
811    client: &impl crate::client_trait::UserAuthClient,
812    arg: &UpdateFolderPolicyArg,
813) -> Result<SharedFolderMetadata, crate::Error<UpdateFolderPolicyError>> {
814    crate::client_helpers::unwrap_async(
815        crate::client_helpers::request(
816            client,
817            crate::client_trait_common::Endpoint::Api,
818            crate::client_trait_common::Style::Rpc,
819            "sharing/update_folder_policy",
820            arg,
821            None)
822    )
823}
824