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