dropbox-sdk 0.19.1

Rust bindings to the Dropbox API, generated by Stone from the official spec.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
// DO NOT EDIT
// This file was @generated by Stone

#![allow(
    clippy::too_many_arguments,
    clippy::large_enum_variant,
    clippy::result_large_err,
    clippy::doc_markdown,
)]

#[allow(unused_imports)]
pub use crate::generated::types::sharing::*;

/// Adds specified members to a file.
pub fn add_file_member(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &AddFileMemberArgs,
) -> Result<Vec<FileMemberActionResult>, crate::Error<AddFileMemberError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/add_file_member",
            arg,
            None)
    )
}

/// Allows an owner or editor (if the ACL update policy allows) of a shared folder to add another
/// member. For the new member to get access to all the functionality for this folder, you will need
/// to call [`mount_folder()`](crate::sharing::mount_folder) on their behalf.
pub fn add_folder_member(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &AddFolderMemberArg,
) -> Result<(), crate::Error<AddFolderMemberError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/add_folder_member",
            arg,
            None)
    )
}

/// Returns the status of an asynchronous job.
pub fn check_job_status(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &crate::types::dbx_async::PollArg,
) -> Result<JobStatus, crate::Error<crate::types::dbx_async::PollError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/check_job_status",
            arg,
            None)
    )
}

/// Returns the status of an asynchronous job for sharing a folder.
pub fn check_remove_member_job_status(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &crate::types::dbx_async::PollArg,
) -> Result<RemoveMemberJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/check_remove_member_job_status",
            arg,
            None)
    )
}

/// Returns the status of an asynchronous job for sharing a folder.
pub fn check_share_job_status(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &crate::types::dbx_async::PollArg,
) -> Result<ShareFolderJobStatus, crate::Error<crate::types::dbx_async::PollError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/check_share_job_status",
            arg,
            None)
    )
}

/// Create a shared link. If a shared link already exists for the given path, that link is returned.
/// Previously, it was technically possible to break a shared link by moving or renaming the
/// corresponding file or folder. In the future, this will no longer be the case, so your app
/// shouldn't rely on this behavior. Instead, if your app needs to revoke a shared link, use
/// [`revoke_shared_link()`](crate::sharing::revoke_shared_link).
#[deprecated(note = "replaced by create_shared_link_with_settings")]
pub fn create_shared_link(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &CreateSharedLinkArg,
) -> Result<PathLinkMetadata, crate::Error<CreateSharedLinkError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/create_shared_link",
            arg,
            None)
    )
}

/// Create a shared link with custom settings. If no settings are given then the default visibility
/// is [`RequestedVisibility::Public`] (The resolved visibility, though, may depend on other aspects
/// such as team and shared folder settings).
pub fn create_shared_link_with_settings(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &CreateSharedLinkWithSettingsArg,
) -> Result<SharedLinkMetadata, crate::Error<CreateSharedLinkWithSettingsError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/create_shared_link_with_settings",
            arg,
            None)
    )
}

/// Returns shared file metadata.
pub fn get_file_metadata(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &GetFileMetadataArg,
) -> Result<SharedFileMetadata, crate::Error<GetFileMetadataError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/get_file_metadata",
            arg,
            None)
    )
}

/// Returns shared file metadata.
pub fn get_file_metadata_batch(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &GetFileMetadataBatchArg,
) -> Result<Vec<GetFileMetadataBatchResult>, crate::Error<SharingUserError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/get_file_metadata/batch",
            arg,
            None)
    )
}

/// Returns shared folder metadata by its folder ID.
pub fn get_folder_metadata(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &GetMetadataArgs,
) -> Result<SharedFolderMetadata, crate::Error<SharedFolderAccessError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/get_folder_metadata",
            arg,
            None)
    )
}

/// Download the shared link's file from a user's Dropbox.
pub fn get_shared_link_file(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &GetSharedLinkFileArg,
    range_start: Option<u64>,
    range_end: Option<u64>,
) -> Result<crate::client_trait::HttpRequestResult<SharedLinkMetadata>, crate::Error<GetSharedLinkFileError>> {
    crate::client_helpers::unwrap_async_body(
        crate::client_helpers::request_with_body(
            client,
            crate::client_trait_common::Endpoint::Content,
            crate::client_trait_common::Style::Download,
            "sharing/get_shared_link_file",
            arg,
            None,
            range_start,
            range_end),
        client,
    )
}

/// Get the shared link's metadata.
pub fn get_shared_link_metadata(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &GetSharedLinkMetadataArg,
) -> Result<SharedLinkMetadata, crate::Error<SharedLinkError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/get_shared_link_metadata",
            arg,
            None)
    )
}

/// Get the shared link's metadata.
pub fn get_shared_link_metadata_app_auth(
    client: &impl crate::client_trait::AppAuthClient,
    arg: &GetSharedLinkMetadataArg,
) -> Result<SharedLinkMetadata, crate::Error<SharedLinkError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/get_shared_link_metadata",
            arg,
            None)
    )
}

/// Returns a list of [`LinkMetadata`] objects for this user, including collection links. If no path
/// is given, returns a list of all shared links for the current user, including collection links,
/// up to a maximum of 1000 links. If a non-empty path is given, returns a list of all shared links
/// that allow access to the given path.  Collection links are never returned in this case.
#[deprecated(note = "replaced by list_shared_links")]
pub fn get_shared_links(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &GetSharedLinksArg,
) -> Result<GetSharedLinksResult, crate::Error<GetSharedLinksError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/get_shared_links",
            arg,
            None)
    )
}

/// Use to obtain the members who have been invited to a file, both inherited and uninherited
/// members.
pub fn list_file_members(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFileMembersArg,
) -> Result<SharedFileMembers, crate::Error<ListFileMembersError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_file_members",
            arg,
            None)
    )
}

/// Get members of multiple files at once. The arguments to this route are more limited, and the
/// limit on query result size per file is more strict. To customize the results more, use the
/// individual file endpoint. Inherited users and groups are not included in the result, and
/// permissions are not returned for this endpoint.
pub fn list_file_members_batch(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFileMembersBatchArg,
) -> Result<Vec<ListFileMembersBatchResult>, crate::Error<SharingUserError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_file_members/batch",
            arg,
            None)
    )
}

/// Once a cursor has been retrieved from [`list_file_members()`](crate::sharing::list_file_members)
/// or [`list_file_members_batch()`](crate::sharing::list_file_members_batch), use this to paginate
/// through all shared file members.
pub fn list_file_members_continue(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFileMembersContinueArg,
) -> Result<SharedFileMembers, crate::Error<ListFileMembersContinueError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_file_members/continue",
            arg,
            None)
    )
}

/// Returns shared folder membership by its folder ID.
pub fn list_folder_members(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFolderMembersArgs,
) -> Result<SharedFolderMembers, crate::Error<SharedFolderAccessError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_folder_members",
            arg,
            None)
    )
}

/// Once a cursor has been retrieved from
/// [`list_folder_members()`](crate::sharing::list_folder_members), use this to paginate through all
/// shared folder members.
pub fn list_folder_members_continue(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFolderMembersContinueArg,
) -> Result<SharedFolderMembers, crate::Error<ListFolderMembersContinueError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_folder_members/continue",
            arg,
            None)
    )
}

/// Return the list of all shared folders the current user has access to.
pub fn list_folders(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFoldersArgs,
) -> Result<ListFoldersResult, crate::Error<crate::NoError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_folders",
            arg,
            None)
    )
}

/// Once a cursor has been retrieved from [`list_folders()`](crate::sharing::list_folders), use this
/// to paginate through all shared folders. The cursor must come from a previous call to
/// [`list_folders()`](crate::sharing::list_folders) or
/// [`list_folders_continue()`](crate::sharing::list_folders_continue).
pub fn list_folders_continue(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFoldersContinueArg,
) -> Result<ListFoldersResult, crate::Error<ListFoldersContinueError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_folders/continue",
            arg,
            None)
    )
}

/// Return the list of all shared folders the current user can mount or unmount.
pub fn list_mountable_folders(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFoldersArgs,
) -> Result<ListFoldersResult, crate::Error<crate::NoError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_mountable_folders",
            arg,
            None)
    )
}

/// Once a cursor has been retrieved from
/// [`list_mountable_folders()`](crate::sharing::list_mountable_folders), use this to paginate
/// through all mountable shared folders. The cursor must come from a previous call to
/// [`list_mountable_folders()`](crate::sharing::list_mountable_folders) or
/// [`list_mountable_folders_continue()`](crate::sharing::list_mountable_folders_continue).
pub fn list_mountable_folders_continue(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFoldersContinueArg,
) -> Result<ListFoldersResult, crate::Error<ListFoldersContinueError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_mountable_folders/continue",
            arg,
            None)
    )
}

/// Returns a list of all files shared with current user.  Does not include files the user has
/// received via shared folders, and does  not include unclaimed invitations.
pub fn list_received_files(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFilesArg,
) -> Result<ListFilesResult, crate::Error<SharingUserError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_received_files",
            arg,
            None)
    )
}

/// Get more results with a cursor from
/// [`list_received_files()`](crate::sharing::list_received_files).
pub fn list_received_files_continue(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListFilesContinueArg,
) -> Result<ListFilesResult, crate::Error<ListFilesContinueError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_received_files/continue",
            arg,
            None)
    )
}

/// List shared links of this user. If no path is given, returns a list of all shared links for the
/// current user. For members of business teams using team space and member folders, returns all
/// shared links in the team member's home folder unless the team space ID is specified in the
/// request header. For more information, refer to the [Namespace
/// Guide](https://www.dropbox.com/developers/reference/namespace-guide). If a non-empty path is
/// given, returns a list of all shared links that allow access to the given path - direct links to
/// the given path and links to parent folders of the given path. Links to parent folders can be
/// suppressed by setting direct_only to true.
pub fn list_shared_links(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ListSharedLinksArg,
) -> Result<ListSharedLinksResult, crate::Error<ListSharedLinksError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/list_shared_links",
            arg,
            None)
    )
}

/// Modify the shared link's settings. If the requested visibility conflict with the shared links
/// policy of the team or the shared folder (in case the linked file is part of a shared folder)
/// then the [`LinkPermissions::resolved_visibility`](LinkPermissions) of the returned
/// [`SharedLinkMetadata`] will reflect the actual visibility of the shared link and the
/// [`LinkPermissions::requested_visibility`](LinkPermissions) will reflect the requested
/// visibility.
pub fn modify_shared_link_settings(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ModifySharedLinkSettingsArgs,
) -> Result<SharedLinkMetadata, crate::Error<ModifySharedLinkSettingsError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/modify_shared_link_settings",
            arg,
            None)
    )
}

/// The current user mounts the designated folder. Mount a shared folder for a user after they have
/// been added as a member. Once mounted, the shared folder will appear in their Dropbox.
pub fn mount_folder(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &MountFolderArg,
) -> Result<SharedFolderMetadata, crate::Error<MountFolderError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/mount_folder",
            arg,
            None)
    )
}

/// The current user relinquishes their membership in the designated file. Note that the current
/// user may still have inherited access to this file through the parent folder.
pub fn relinquish_file_membership(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RelinquishFileMembershipArg,
) -> Result<(), crate::Error<RelinquishFileMembershipError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/relinquish_file_membership",
            arg,
            None)
    )
}

/// The current user relinquishes their membership in the designated shared folder and will no
/// longer have access to the folder.  A folder owner cannot relinquish membership in their own
/// folder. This will run synchronously if leave_a_copy is false, and asynchronously if leave_a_copy
/// is true.
pub fn relinquish_folder_membership(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RelinquishFolderMembershipArg,
) -> Result<crate::types::dbx_async::LaunchEmptyResult, crate::Error<RelinquishFolderMembershipError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/relinquish_folder_membership",
            arg,
            None)
    )
}

/// Identical to remove_file_member_2 but with less information returned.
#[deprecated(note = "replaced by remove_file_member_2")]
pub fn remove_file_member(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RemoveFileMemberArg,
) -> Result<FileMemberActionIndividualResult, crate::Error<RemoveFileMemberError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/remove_file_member",
            arg,
            None)
    )
}

/// Removes a specified member from the file.
pub fn remove_file_member_2(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RemoveFileMemberArg,
) -> Result<FileMemberRemoveActionResult, crate::Error<RemoveFileMemberError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/remove_file_member_2",
            arg,
            None)
    )
}

/// Allows an owner or editor (if the ACL update policy allows) of a shared folder to remove another
/// member.
pub fn remove_folder_member(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RemoveFolderMemberArg,
) -> Result<crate::types::dbx_async::LaunchResultBase, crate::Error<RemoveFolderMemberError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/remove_folder_member",
            arg,
            None)
    )
}

/// Revoke a shared link. Note that even after revoking a shared link to a file, the file may be
/// accessible if there are shared links leading to any of the file parent folders. To list all
/// shared links that enable access to a specific file, you can use the
/// [`list_shared_links()`](crate::sharing::list_shared_links) with the file as the
/// [`ListSharedLinksArg::path`](ListSharedLinksArg) argument.
pub fn revoke_shared_link(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &RevokeSharedLinkArg,
) -> Result<(), crate::Error<RevokeSharedLinkError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/revoke_shared_link",
            arg,
            None)
    )
}

/// Change the inheritance policy of an existing Shared Folder. Only permitted for shared folders in
/// a shared team root. If a [`ShareFolderLaunch::AsyncJobId`] is returned, you'll need to call
/// [`check_share_job_status()`](crate::sharing::check_share_job_status) until the action completes
/// to get the metadata for the folder.
pub fn set_access_inheritance(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &SetAccessInheritanceArg,
) -> Result<ShareFolderLaunch, crate::Error<SetAccessInheritanceError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/set_access_inheritance",
            arg,
            None)
    )
}

/// Share a folder with collaborators. Most sharing will be completed synchronously. Large folders
/// will be completed asynchronously. To make testing the async case repeatable, set
/// `ShareFolderArg.force_async`. If a [`ShareFolderLaunch::AsyncJobId`] is returned, you'll need to
/// call [`check_share_job_status()`](crate::sharing::check_share_job_status) until the action
/// completes to get the metadata for the folder.
pub fn share_folder(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &ShareFolderArg,
) -> Result<ShareFolderLaunch, crate::Error<ShareFolderError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/share_folder",
            arg,
            None)
    )
}

/// Transfer ownership of a shared folder to a member of the shared folder. User must have
/// [`AccessLevel::Owner`] access to the shared folder to perform a transfer.
pub fn transfer_folder(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &TransferFolderArg,
) -> Result<(), crate::Error<TransferFolderError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/transfer_folder",
            arg,
            None)
    )
}

/// The current user unmounts the designated folder. They can re-mount the folder at a later time
/// using [`mount_folder()`](crate::sharing::mount_folder).
pub fn unmount_folder(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &UnmountFolderArg,
) -> Result<(), crate::Error<UnmountFolderError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/unmount_folder",
            arg,
            None)
    )
}

/// Remove all members from this file. Does not remove inherited members.
pub fn unshare_file(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &UnshareFileArg,
) -> Result<(), crate::Error<UnshareFileError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/unshare_file",
            arg,
            None)
    )
}

/// Allows a shared folder owner to unshare the folder. You'll need to call
/// [`check_job_status()`](crate::sharing::check_job_status) to determine if the action has
/// completed successfully.
pub fn unshare_folder(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &UnshareFolderArg,
) -> Result<crate::types::dbx_async::LaunchEmptyResult, crate::Error<UnshareFolderError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/unshare_folder",
            arg,
            None)
    )
}

/// Changes a member's access on a shared file.
pub fn update_file_member(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &UpdateFileMemberArgs,
) -> Result<MemberAccessLevelResult, crate::Error<FileMemberActionError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/update_file_member",
            arg,
            None)
    )
}

/// Allows an owner or editor of a shared folder to update another member's permissions.
pub fn update_folder_member(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &UpdateFolderMemberArg,
) -> Result<MemberAccessLevelResult, crate::Error<UpdateFolderMemberError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/update_folder_member",
            arg,
            None)
    )
}

/// Update the sharing policies for a shared folder. User must have [`AccessLevel::Owner`] access to
/// the shared folder to update its policies.
pub fn update_folder_policy(
    client: &impl crate::client_trait::UserAuthClient,
    arg: &UpdateFolderPolicyArg,
) -> Result<SharedFolderMetadata, crate::Error<UpdateFolderPolicyError>> {
    crate::client_helpers::unwrap_async(
        crate::client_helpers::request(
            client,
            crate::client_trait_common::Endpoint::Api,
            crate::client_trait_common::Style::Rpc,
            "sharing/update_folder_policy",
            arg,
            None)
    )
}