-
Notifications
You must be signed in to change notification settings - Fork 207
/
FilesRoutes.swift
2294 lines (2201 loc) · 130 KB
/
FilesRoutes.swift
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
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///
/// Copyright (c) 2016 Dropbox, Inc. All rights reserved.
///
/// Auto-generated by Stone, do not modify.
///
import Foundation
/// Routes for the files namespace
/// For Objective-C compatible routes see DBFilesRoutes
public class FilesRoutes: DropboxTransportClientOwning {
public let client: DropboxTransportClient
required init(client: DropboxTransportClient) {
self.client = client
}
/// Returns the metadata for a file or folder. This is an alpha endpoint compatible with the properties API. Note:
/// Metadata for the root folder is unsupported.
///
/// - scope: files.metadata.read
///
/// - parameter includePropertyTemplates: If set to a valid list of template IDs, propertyGroups in FileMetadata is
/// set for files with custom properties.
///
/// - returns: Through the response callback, the caller will receive a `Files.Metadata` object on success or a
/// `Files.AlphaGetMetadataError` object on failure.
@available(*, unavailable, message: "alphaGetMetadata is deprecated. Use getMetadata.")
@discardableResult public func alphaGetMetadata(
path: String,
includeMediaInfo: Bool = false,
includeDeleted: Bool = false,
includeHasExplicitSharedMembers: Bool = false,
includePropertyGroups: FileProperties.TemplateFilterBase? = nil,
includePropertyTemplates: [String]? = nil
) -> RpcRequest<Files.MetadataSerializer, Files.AlphaGetMetadataErrorSerializer> {
let route = Files.alphaGetMetadata
let serverArgs = Files.AlphaGetMetadataArg(
path: path,
includeMediaInfo: includeMediaInfo,
includeDeleted: includeDeleted,
includeHasExplicitSharedMembers: includeHasExplicitSharedMembers,
includePropertyGroups: includePropertyGroups,
includePropertyTemplates: includePropertyTemplates
)
return client.request(route, serverArgs: serverArgs)
}
/// Create a new file with the contents provided in the request. Note that the behavior of this alpha endpoint is
/// unstable and subject to change. Do not use this to upload a file larger than 150 MB. Instead, create an
/// upload session with uploadSessionStart.
///
/// - scope: files.content.write
///
/// - parameter contentHash: A hash of the file content uploaded in this call. If provided and the uploaded content
/// does not match this hash, an error will be returned. For more information see our Content hash
/// https://www.dropbox.com/developers/reference/content-hash page.
/// - parameter input: The file to upload, as an Data object.
///
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
/// `Files.UploadError` object on failure.
@available(*, unavailable, message: "alphaUpload is deprecated. Use upload.")
@discardableResult public func alphaUpload(
path: String,
mode: Files.WriteMode = .add,
autorename: Bool = false,
clientModified: Date? = nil,
mute: Bool = false,
propertyGroups: [FileProperties.PropertyGroup]? = nil,
strictConflict: Bool = false,
contentHash: String? = nil,
input: Data
) -> UploadRequest<Files.FileMetadataSerializer, Files.UploadErrorSerializer> {
let route = Files.alphaUpload
let serverArgs = Files.UploadArg(
path: path,
mode: mode,
autorename: autorename,
clientModified: clientModified,
mute: mute,
propertyGroups: propertyGroups,
strictConflict: strictConflict,
contentHash: contentHash
)
return client.request(route, serverArgs: serverArgs, input: .data(input))
}
/// Create a new file with the contents provided in the request. Note that the behavior of this alpha endpoint is
/// unstable and subject to change. Do not use this to upload a file larger than 150 MB. Instead, create an
/// upload session with uploadSessionStart.
///
/// - scope: files.content.write
///
/// - parameter contentHash: A hash of the file content uploaded in this call. If provided and the uploaded content
/// does not match this hash, an error will be returned. For more information see our Content hash
/// https://www.dropbox.com/developers/reference/content-hash page.
/// - parameter input: The file to upload, as an URL object.
///
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
/// `Files.UploadError` object on failure.
@available(*, unavailable, message: "alphaUpload is deprecated. Use upload.")
@discardableResult public func alphaUpload(
path: String,
mode: Files.WriteMode = .add,
autorename: Bool = false,
clientModified: Date? = nil,
mute: Bool = false,
propertyGroups: [FileProperties.PropertyGroup]? = nil,
strictConflict: Bool = false,
contentHash: String? = nil,
input: URL
) -> UploadRequest<Files.FileMetadataSerializer, Files.UploadErrorSerializer> {
let route = Files.alphaUpload
let serverArgs = Files.UploadArg(
path: path,
mode: mode,
autorename: autorename,
clientModified: clientModified,
mute: mute,
propertyGroups: propertyGroups,
strictConflict: strictConflict,
contentHash: contentHash
)
return client.request(route, serverArgs: serverArgs, input: .file(input))
}
/// Create a new file with the contents provided in the request. Note that the behavior of this alpha endpoint is
/// unstable and subject to change. Do not use this to upload a file larger than 150 MB. Instead, create an
/// upload session with uploadSessionStart.
///
/// - scope: files.content.write
///
/// - parameter contentHash: A hash of the file content uploaded in this call. If provided and the uploaded content
/// does not match this hash, an error will be returned. For more information see our Content hash
/// https://www.dropbox.com/developers/reference/content-hash page.
/// - parameter input: The file to upload, as an InputStream object.
///
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
/// `Files.UploadError` object on failure.
@available(*, unavailable, message: "alphaUpload is deprecated. Use upload.")
@discardableResult public func alphaUpload(
path: String,
mode: Files.WriteMode = .add,
autorename: Bool = false,
clientModified: Date? = nil,
mute: Bool = false,
propertyGroups: [FileProperties.PropertyGroup]? = nil,
strictConflict: Bool = false,
contentHash: String? = nil,
input: InputStream
) -> UploadRequest<Files.FileMetadataSerializer, Files.UploadErrorSerializer> {
let route = Files.alphaUpload
let serverArgs = Files.UploadArg(
path: path,
mode: mode,
autorename: autorename,
clientModified: clientModified,
mute: mute,
propertyGroups: propertyGroups,
strictConflict: strictConflict,
contentHash: contentHash
)
return client.request(route, serverArgs: serverArgs, input: .stream(input))
}
/// Copy a file or folder to a different location in the user's Dropbox. If the source path is a folder all its
/// contents will be copied.
///
/// - scope: files.content.write
///
/// - parameter allowSharedFolder: This flag has no effect.
/// - parameter autorename: If there's a conflict, have the Dropbox server try to autorename the file to avoid the
/// conflict.
/// - parameter allowOwnershipTransfer: Allow moves by owner even if it would result in an ownership transfer for
/// the content being moved. This does not apply to copies.
///
/// - returns: Through the response callback, the caller will receive a `Files.RelocationResult` object on success
/// or a `Files.RelocationError` object on failure.
@discardableResult public func copyV2(
fromPath: String,
toPath: String,
allowSharedFolder: Bool = false,
autorename: Bool = false,
allowOwnershipTransfer: Bool = false
) -> RpcRequest<Files.RelocationResultSerializer, Files.RelocationErrorSerializer> {
let route = Files.copyV2
let serverArgs = Files.RelocationArg(
fromPath: fromPath,
toPath: toPath,
allowSharedFolder: allowSharedFolder,
autorename: autorename,
allowOwnershipTransfer: allowOwnershipTransfer
)
return client.request(route, serverArgs: serverArgs)
}
/// Copy a file or folder to a different location in the user's Dropbox. If the source path is a folder all its
/// contents will be copied.
///
/// - scope: files.content.write
///
/// - parameter allowSharedFolder: This flag has no effect.
/// - parameter autorename: If there's a conflict, have the Dropbox server try to autorename the file to avoid the
/// conflict.
/// - parameter allowOwnershipTransfer: Allow moves by owner even if it would result in an ownership transfer for
/// the content being moved. This does not apply to copies.
///
/// - returns: Through the response callback, the caller will receive a `Files.Metadata` object on success or a
/// `Files.RelocationError` object on failure.
@available(*, unavailable, message: "copy is deprecated. Use copyV2.")
@discardableResult public func copy(
fromPath: String,
toPath: String,
allowSharedFolder: Bool = false,
autorename: Bool = false,
allowOwnershipTransfer: Bool = false
) -> RpcRequest<Files.MetadataSerializer, Files.RelocationErrorSerializer> {
let route = Files.copy
let serverArgs = Files.RelocationArg(
fromPath: fromPath,
toPath: toPath,
allowSharedFolder: allowSharedFolder,
autorename: autorename,
allowOwnershipTransfer: allowOwnershipTransfer
)
return client.request(route, serverArgs: serverArgs)
}
/// Copy multiple files or folders to different locations at once in the user's Dropbox. This route will replace
/// copyBatch. The main difference is this route will return status for each entry, while copyBatch raises
/// failure if any entry fails. This route will either finish synchronously, or return a job ID and do the async
/// copy job in background. Please use copyBatchCheckV2 to check the job status.
///
/// - scope: files.content.write
///
/// - parameter entries: List of entries to be moved or copied. Each entry is RelocationPath.
/// - parameter autorename: If there's a conflict with any file, have the Dropbox server try to autorename that file
/// to avoid the conflict.
///
/// - returns: Through the response callback, the caller will receive a `Files.RelocationBatchV2Launch` object on
/// success or a `Void` object on failure.
@discardableResult public func copyBatchV2(
entries: [Files.RelocationPath],
autorename: Bool = false
) -> RpcRequest<Files.RelocationBatchV2LaunchSerializer, VoidSerializer> {
let route = Files.copyBatchV2
let serverArgs = Files.RelocationBatchArgBase(entries: entries, autorename: autorename)
return client.request(route, serverArgs: serverArgs)
}
/// Copy multiple files or folders to different locations at once in the user's Dropbox. This route will return job
/// ID immediately and do the async copy job in background. Please use copyBatchCheck to check the job status.
///
/// - scope: files.content.write
///
/// - parameter allowSharedFolder: This flag has no effect.
/// - parameter allowOwnershipTransfer: Allow moves by owner even if it would result in an ownership transfer for
/// the content being moved. This does not apply to copies.
///
/// - returns: Through the response callback, the caller will receive a `Files.RelocationBatchLaunch` object on
/// success or a `Void` object on failure.
@available(*, unavailable, message: "copyBatch is deprecated. Use copyBatchV2.")
@discardableResult public func copyBatch(
entries: [Files.RelocationPath],
autorename: Bool = false,
allowSharedFolder: Bool = false,
allowOwnershipTransfer: Bool = false
) -> RpcRequest<Files.RelocationBatchLaunchSerializer, VoidSerializer> {
let route = Files.copyBatch
let serverArgs = Files.RelocationBatchArg(
entries: entries,
autorename: autorename,
allowSharedFolder: allowSharedFolder,
allowOwnershipTransfer: allowOwnershipTransfer
)
return client.request(route, serverArgs: serverArgs)
}
/// Returns the status of an asynchronous job for copyBatchV2. It returns list of results for each entry.
///
/// - scope: files.content.write
///
/// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method
/// that launched the job.
///
/// - returns: Through the response callback, the caller will receive a `Files.RelocationBatchV2JobStatus` object on
/// success or a `Async.PollError` object on failure.
@discardableResult public func copyBatchCheckV2(asyncJobId: String) -> RpcRequest<Files.RelocationBatchV2JobStatusSerializer, Async.PollErrorSerializer> {
let route = Files.copyBatchCheckV2
let serverArgs = Async.PollArg(asyncJobId: asyncJobId)
return client.request(route, serverArgs: serverArgs)
}
/// Returns the status of an asynchronous job for copyBatch. If success, it returns list of results for each entry.
///
/// - scope: files.content.write
///
/// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method
/// that launched the job.
///
/// - returns: Through the response callback, the caller will receive a `Files.RelocationBatchJobStatus` object on
/// success or a `Async.PollError` object on failure.
@available(*, unavailable, message: "copyBatchCheck is deprecated. Use copyBatchCheckV2.")
@discardableResult public func copyBatchCheck(asyncJobId: String) -> RpcRequest<Files.RelocationBatchJobStatusSerializer, Async.PollErrorSerializer> {
let route = Files.copyBatchCheck
let serverArgs = Async.PollArg(asyncJobId: asyncJobId)
return client.request(route, serverArgs: serverArgs)
}
/// Get a copy reference to a file or folder. This reference string can be used to save that file or folder to
/// another user's Dropbox by passing it to copyReferenceSave.
///
/// - scope: files.content.write
///
/// - parameter path: The path to the file or folder you want to get a copy reference to.
///
/// - returns: Through the response callback, the caller will receive a `Files.GetCopyReferenceResult` object on
/// success or a `Files.GetCopyReferenceError` object on failure.
@discardableResult public func copyReferenceGet(path: String) -> RpcRequest<Files.GetCopyReferenceResultSerializer, Files.GetCopyReferenceErrorSerializer> {
let route = Files.copyReferenceGet
let serverArgs = Files.GetCopyReferenceArg(path: path)
return client.request(route, serverArgs: serverArgs)
}
/// Save a copy reference returned by copyReferenceGet to the user's Dropbox.
///
/// - scope: files.content.write
///
/// - parameter copyReference: A copy reference returned by copyReferenceGet.
/// - parameter path: Path in the user's Dropbox that is the destination.
///
/// - returns: Through the response callback, the caller will receive a `Files.SaveCopyReferenceResult` object on
/// success or a `Files.SaveCopyReferenceError` object on failure.
@discardableResult public func copyReferenceSave(
copyReference: String,
path: String
) -> RpcRequest<Files.SaveCopyReferenceResultSerializer, Files.SaveCopyReferenceErrorSerializer> {
let route = Files.copyReferenceSave
let serverArgs = Files.SaveCopyReferenceArg(copyReference: copyReference, path: path)
return client.request(route, serverArgs: serverArgs)
}
/// Create a folder at a given path.
///
/// - scope: files.content.write
///
/// - parameter path: Path in the user's Dropbox to create.
/// - parameter autorename: If there's a conflict, have the Dropbox server try to autorename the folder to avoid the
/// conflict.
///
/// - returns: Through the response callback, the caller will receive a `Files.CreateFolderResult` object on success
/// or a `Files.CreateFolderError` object on failure.
@discardableResult public func createFolderV2(
path: String,
autorename: Bool = false
) -> RpcRequest<Files.CreateFolderResultSerializer, Files.CreateFolderErrorSerializer> {
let route = Files.createFolderV2
let serverArgs = Files.CreateFolderArg(path: path, autorename: autorename)
return client.request(route, serverArgs: serverArgs)
}
/// Create a folder at a given path.
///
/// - scope: files.content.write
///
/// - parameter path: Path in the user's Dropbox to create.
/// - parameter autorename: If there's a conflict, have the Dropbox server try to autorename the folder to avoid the
/// conflict.
///
/// - returns: Through the response callback, the caller will receive a `Files.FolderMetadata` object on success or
/// a `Files.CreateFolderError` object on failure.
@available(*, unavailable, message: "createFolder is deprecated. Use createFolderV2.")
@discardableResult public func createFolder(
path: String,
autorename: Bool = false
) -> RpcRequest<Files.FolderMetadataSerializer, Files.CreateFolderErrorSerializer> {
let route = Files.createFolder
let serverArgs = Files.CreateFolderArg(path: path, autorename: autorename)
return client.request(route, serverArgs: serverArgs)
}
/// Create multiple folders at once. This route is asynchronous for large batches, which returns a job ID
/// immediately and runs the create folder batch asynchronously. Otherwise, creates the folders and returns the
/// result synchronously for smaller inputs. You can force asynchronous behaviour by using the forceAsync in
/// CreateFolderBatchArg flag. Use createFolderBatchCheck to check the job status.
///
/// - scope: files.content.write
///
/// - parameter paths: List of paths to be created in the user's Dropbox. Duplicate path arguments in the batch are
/// considered only once.
/// - parameter autorename: If there's a conflict, have the Dropbox server try to autorename the folder to avoid the
/// conflict.
/// - parameter forceAsync: Whether to force the create to happen asynchronously.
///
/// - returns: Through the response callback, the caller will receive a `Files.CreateFolderBatchLaunch` object on
/// success or a `Void` object on failure.
@discardableResult public func createFolderBatch(
paths: [String],
autorename: Bool = false,
forceAsync: Bool = false
) -> RpcRequest<Files.CreateFolderBatchLaunchSerializer, VoidSerializer> {
let route = Files.createFolderBatch
let serverArgs = Files.CreateFolderBatchArg(paths: paths, autorename: autorename, forceAsync: forceAsync)
return client.request(route, serverArgs: serverArgs)
}
/// Returns the status of an asynchronous job for createFolderBatch. If success, it returns list of result for each
/// entry.
///
/// - scope: files.content.write
///
/// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method
/// that launched the job.
///
/// - returns: Through the response callback, the caller will receive a `Files.CreateFolderBatchJobStatus` object on
/// success or a `Async.PollError` object on failure.
@discardableResult public func createFolderBatchCheck(asyncJobId: String)
-> RpcRequest<Files.CreateFolderBatchJobStatusSerializer, Async.PollErrorSerializer> {
let route = Files.createFolderBatchCheck
let serverArgs = Async.PollArg(asyncJobId: asyncJobId)
return client.request(route, serverArgs: serverArgs)
}
/// Delete the file or folder at a given path. If the path is a folder, all its contents will be deleted too. A
/// successful response indicates that the file or folder was deleted. The returned metadata will be the
/// corresponding FileMetadata or FolderMetadata for the item at time of deletion, and not a DeletedMetadata
/// object.
///
/// - scope: files.content.write
///
/// - parameter path: Path in the user's Dropbox to delete.
/// - parameter parentRev: Perform delete if given "rev" matches the existing file's latest "rev". This field does
/// not support deleting a folder.
///
/// - returns: Through the response callback, the caller will receive a `Files.DeleteResult` object on success or a
/// `Files.DeleteError` object on failure.
@discardableResult public func deleteV2(path: String, parentRev: String? = nil) -> RpcRequest<Files.DeleteResultSerializer, Files.DeleteErrorSerializer> {
let route = Files.deleteV2
let serverArgs = Files.DeleteArg(path: path, parentRev: parentRev)
return client.request(route, serverArgs: serverArgs)
}
/// Delete the file or folder at a given path. If the path is a folder, all its contents will be deleted too. A
/// successful response indicates that the file or folder was deleted. The returned metadata will be the
/// corresponding FileMetadata or FolderMetadata for the item at time of deletion, and not a DeletedMetadata
/// object.
///
/// - scope: files.content.write
///
/// - parameter path: Path in the user's Dropbox to delete.
/// - parameter parentRev: Perform delete if given "rev" matches the existing file's latest "rev". This field does
/// not support deleting a folder.
///
/// - returns: Through the response callback, the caller will receive a `Files.Metadata` object on success or a
/// `Files.DeleteError` object on failure.
@available(*, unavailable, message: "delete is deprecated. Use deleteV2.")
@discardableResult public func delete(path: String, parentRev: String? = nil) -> RpcRequest<Files.MetadataSerializer, Files.DeleteErrorSerializer> {
let route = Files.delete
let serverArgs = Files.DeleteArg(path: path, parentRev: parentRev)
return client.request(route, serverArgs: serverArgs)
}
/// Delete multiple files/folders at once. This route is asynchronous, which returns a job ID immediately and runs
/// the delete batch asynchronously. Use deleteBatchCheck to check the job status.
///
/// - scope: files.content.write
///
///
/// - returns: Through the response callback, the caller will receive a `Files.DeleteBatchLaunch` object on success
/// or a `Void` object on failure.
@discardableResult public func deleteBatch(entries: [Files.DeleteArg]) -> RpcRequest<Files.DeleteBatchLaunchSerializer, VoidSerializer> {
let route = Files.deleteBatch
let serverArgs = Files.DeleteBatchArg(entries: entries)
return client.request(route, serverArgs: serverArgs)
}
/// Returns the status of an asynchronous job for deleteBatch. If success, it returns list of result for each entry.
///
/// - scope: files.content.write
///
/// - parameter asyncJobId: Id of the asynchronous job. This is the value of a response returned from the method
/// that launched the job.
///
/// - returns: Through the response callback, the caller will receive a `Files.DeleteBatchJobStatus` object on
/// success or a `Async.PollError` object on failure.
@discardableResult public func deleteBatchCheck(asyncJobId: String) -> RpcRequest<Files.DeleteBatchJobStatusSerializer, Async.PollErrorSerializer> {
let route = Files.deleteBatchCheck
let serverArgs = Async.PollArg(asyncJobId: asyncJobId)
return client.request(route, serverArgs: serverArgs)
}
/// Download a file from a user's Dropbox.
///
/// - scope: files.content.read
///
/// - parameter path: The path of the file to download.
/// - parameter rev: Please specify revision in path instead.
/// - parameter overwrite: A boolean to set behavior in the event of a naming conflict. `True` will overwrite
/// conflicting file at destination. `False` will take no action (but if left unhandled in destination closure,
/// an NSError will be thrown).
/// - parameter destination: The location to write the download to.
///
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
/// `Files.DownloadError` object on failure.
@discardableResult public func download(
path: String,
rev: String? = nil,
overwrite: Bool = false,
destination: URL
) -> DownloadRequestFile<Files.FileMetadataSerializer, Files.DownloadErrorSerializer> {
let route = Files.download
let serverArgs = Files.DownloadArg(path: path, rev: rev)
return client.request(route, serverArgs: serverArgs, overwrite: overwrite, destination: destination)
}
/// Download a file from a user's Dropbox.
///
/// - scope: files.content.read
///
/// - parameter path: The path of the file to download.
/// - parameter rev: Please specify revision in path instead.
///
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
/// `Files.DownloadError` object on failure.
@discardableResult public func download(
path: String,
rev: String? = nil
) -> DownloadRequestMemory<Files.FileMetadataSerializer, Files.DownloadErrorSerializer> {
let route = Files.download
let serverArgs = Files.DownloadArg(path: path, rev: rev)
return client.request(route, serverArgs: serverArgs)
}
/// Download a folder from the user's Dropbox, as a zip file. The folder must be less than 20 GB in size and any
/// single file within must be less than 4 GB in size. The resulting zip must have fewer than 10,000 total file
/// and folder entries, including the top level folder. The input cannot be a single file. Note: this endpoint
/// does not support HTTP range requests.
///
/// - scope: files.content.read
///
/// - parameter path: The path of the folder to download.
/// - parameter overwrite: A boolean to set behavior in the event of a naming conflict. `True` will overwrite
/// conflicting file at destination. `False` will take no action (but if left unhandled in destination closure,
/// an NSError will be thrown).
/// - parameter destination: The location to write the download to.
///
/// - returns: Through the response callback, the caller will receive a `Files.DownloadZipResult` object on success
/// or a `Files.DownloadZipError` object on failure.
@discardableResult public func downloadZip(
path: String,
overwrite: Bool = false,
destination: URL
) -> DownloadRequestFile<Files.DownloadZipResultSerializer, Files.DownloadZipErrorSerializer> {
let route = Files.downloadZip
let serverArgs = Files.DownloadZipArg(path: path)
return client.request(route, serverArgs: serverArgs, overwrite: overwrite, destination: destination)
}
/// Download a folder from the user's Dropbox, as a zip file. The folder must be less than 20 GB in size and any
/// single file within must be less than 4 GB in size. The resulting zip must have fewer than 10,000 total file
/// and folder entries, including the top level folder. The input cannot be a single file. Note: this endpoint
/// does not support HTTP range requests.
///
/// - scope: files.content.read
///
/// - parameter path: The path of the folder to download.
///
/// - returns: Through the response callback, the caller will receive a `Files.DownloadZipResult` object on success
/// or a `Files.DownloadZipError` object on failure.
@discardableResult public func downloadZip(path: String) -> DownloadRequestMemory<Files.DownloadZipResultSerializer, Files.DownloadZipErrorSerializer> {
let route = Files.downloadZip
let serverArgs = Files.DownloadZipArg(path: path)
return client.request(route, serverArgs: serverArgs)
}
/// Export a file from a user's Dropbox. This route only supports exporting files that cannot be downloaded directly
/// and whose fileMetadata in ExportResult has exportAs in ExportInfo populated.
///
/// - scope: files.content.read
///
/// - parameter path: The path of the file to be exported.
/// - parameter exportFormat: The file format to which the file should be exported. This must be one of the formats
/// listed in the file's export_options returned by getMetadata. If none is specified, the default format
/// (specified in export_as in file metadata) will be used.
/// - parameter overwrite: A boolean to set behavior in the event of a naming conflict. `True` will overwrite
/// conflicting file at destination. `False` will take no action (but if left unhandled in destination closure,
/// an NSError will be thrown).
/// - parameter destination: The location to write the download to.
///
/// - returns: Through the response callback, the caller will receive a `Files.ExportResult` object on success or a
/// `Files.ExportError` object on failure.
@discardableResult public func export(
path: String,
exportFormat: String? = nil,
overwrite: Bool = false,
destination: URL
) -> DownloadRequestFile<Files.ExportResultSerializer, Files.ExportErrorSerializer> {
let route = Files.export
let serverArgs = Files.ExportArg(path: path, exportFormat: exportFormat)
return client.request(route, serverArgs: serverArgs, overwrite: overwrite, destination: destination)
}
/// Export a file from a user's Dropbox. This route only supports exporting files that cannot be downloaded directly
/// and whose fileMetadata in ExportResult has exportAs in ExportInfo populated.
///
/// - scope: files.content.read
///
/// - parameter path: The path of the file to be exported.
/// - parameter exportFormat: The file format to which the file should be exported. This must be one of the formats
/// listed in the file's export_options returned by getMetadata. If none is specified, the default format
/// (specified in export_as in file metadata) will be used.
///
/// - returns: Through the response callback, the caller will receive a `Files.ExportResult` object on success or a
/// `Files.ExportError` object on failure.
@discardableResult public func export(
path: String,
exportFormat: String? = nil
) -> DownloadRequestMemory<Files.ExportResultSerializer, Files.ExportErrorSerializer> {
let route = Files.export
let serverArgs = Files.ExportArg(path: path, exportFormat: exportFormat)
return client.request(route, serverArgs: serverArgs)
}
/// Return the lock metadata for the given list of paths.
///
/// - scope: files.content.read
///
/// - parameter entries: List of 'entries'. Each 'entry' contains a path of the file which will be locked or
/// queried. Duplicate path arguments in the batch are considered only once.
///
/// - returns: Through the response callback, the caller will receive a `Files.LockFileBatchResult` object on
/// success or a `Files.LockFileError` object on failure.
@discardableResult public func getFileLockBatch(entries: [Files.LockFileArg])
-> RpcRequest<Files.LockFileBatchResultSerializer, Files.LockFileErrorSerializer> {
let route = Files.getFileLockBatch
let serverArgs = Files.LockFileBatchArg(entries: entries)
return client.request(route, serverArgs: serverArgs)
}
/// Returns the metadata for a file or folder. Note: Metadata for the root folder is unsupported.
///
/// - scope: files.metadata.read
///
/// - parameter path: The path of a file or folder on Dropbox.
/// - parameter includeMediaInfo: If true, mediaInfo in FileMetadata is set for photo and video.
/// - parameter includeDeleted: If true, DeletedMetadata will be returned for deleted file or folder, otherwise
/// notFound in LookupError will be returned.
/// - parameter includeHasExplicitSharedMembers: If true, the results will include a flag for each file indicating
/// whether or not that file has any explicit members.
/// - parameter includePropertyGroups: If set to a valid list of template IDs, propertyGroups in FileMetadata is set
/// if there exists property data associated with the file and each of the listed templates.
///
/// - returns: Through the response callback, the caller will receive a `Files.Metadata` object on success or a
/// `Files.GetMetadataError` object on failure.
@discardableResult public func getMetadata(
path: String,
includeMediaInfo: Bool = false,
includeDeleted: Bool = false,
includeHasExplicitSharedMembers: Bool = false,
includePropertyGroups: FileProperties.TemplateFilterBase? = nil
) -> RpcRequest<Files.MetadataSerializer, Files.GetMetadataErrorSerializer> {
let route = Files.getMetadata
let serverArgs = Files.GetMetadataArg(
path: path,
includeMediaInfo: includeMediaInfo,
includeDeleted: includeDeleted,
includeHasExplicitSharedMembers: includeHasExplicitSharedMembers,
includePropertyGroups: includePropertyGroups
)
return client.request(route, serverArgs: serverArgs)
}
/// Get a preview for a file. Currently, PDF previews are generated for files with the following extensions: .ai,
/// .doc, .docm, .docx, .eps, .gdoc, .gslides, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf. HTML
/// previews are generated for files with the following extensions: .csv, .ods, .xls, .xlsm, .gsheet, .xlsx.
/// Other formats will return an unsupported extension error.
///
/// - scope: files.content.read
///
/// - parameter path: The path of the file to preview.
/// - parameter rev: Please specify revision in path instead.
/// - parameter overwrite: A boolean to set behavior in the event of a naming conflict. `True` will overwrite
/// conflicting file at destination. `False` will take no action (but if left unhandled in destination closure,
/// an NSError will be thrown).
/// - parameter destination: The location to write the download to.
///
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
/// `Files.PreviewError` object on failure.
@discardableResult public func getPreview(
path: String,
rev: String? = nil,
overwrite: Bool = false,
destination: URL
) -> DownloadRequestFile<Files.FileMetadataSerializer, Files.PreviewErrorSerializer> {
let route = Files.getPreview
let serverArgs = Files.PreviewArg(path: path, rev: rev)
return client.request(route, serverArgs: serverArgs, overwrite: overwrite, destination: destination)
}
/// Get a preview for a file. Currently, PDF previews are generated for files with the following extensions: .ai,
/// .doc, .docm, .docx, .eps, .gdoc, .gslides, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf. HTML
/// previews are generated for files with the following extensions: .csv, .ods, .xls, .xlsm, .gsheet, .xlsx.
/// Other formats will return an unsupported extension error.
///
/// - scope: files.content.read
///
/// - parameter path: The path of the file to preview.
/// - parameter rev: Please specify revision in path instead.
///
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
/// `Files.PreviewError` object on failure.
@discardableResult public func getPreview(
path: String,
rev: String? = nil
) -> DownloadRequestMemory<Files.FileMetadataSerializer, Files.PreviewErrorSerializer> {
let route = Files.getPreview
let serverArgs = Files.PreviewArg(path: path, rev: rev)
return client.request(route, serverArgs: serverArgs)
}
/// Get a temporary link to stream content of a file. This link will expire in four hours and afterwards you will
/// get 410 Gone. This URL should not be used to display content directly in the browser. The Content-Type of
/// the link is determined automatically by the file's mime type.
///
/// - scope: files.content.read
///
/// - parameter path: The path to the file you want a temporary link to.
///
/// - returns: Through the response callback, the caller will receive a `Files.GetTemporaryLinkResult` object on
/// success or a `Files.GetTemporaryLinkError` object on failure.
@discardableResult public func getTemporaryLink(path: String) -> RpcRequest<Files.GetTemporaryLinkResultSerializer, Files.GetTemporaryLinkErrorSerializer> {
let route = Files.getTemporaryLink
let serverArgs = Files.GetTemporaryLinkArg(path: path)
return client.request(route, serverArgs: serverArgs)
}
/// Get a one-time use temporary upload link to upload a file to a Dropbox location. This endpoint acts as a
/// delayed upload. The returned temporary upload link may be used to make a POST request with the data to be
/// uploaded. The upload will then be perfomed with the CommitInfo previously provided to getTemporaryUploadLink
/// but evaluated only upon consumption. Hence, errors stemming from invalid CommitInfo with respect to the
/// state of the user's Dropbox will only be communicated at consumption time. Additionally, these errors are
/// surfaced as generic HTTP 409 Conflict responses, potentially hiding issue details. The maximum temporary
/// upload link duration is 4 hours. Upon consumption or expiration, a new link will have to be generated.
/// Multiple links may exist for a specific upload path at any given time. The POST request on the temporary
/// upload link must have its Content-Type set to "application/octet-stream". Example temporary upload link
/// consumption request: curl -X POST https://content.dropboxapi.com/apitul/1/bNi2uIYF51cVBND --header
/// "Content-Type: application/octet-stream" --data-binary @local_file.txt A successful temporary upload link
/// consumption request returns the content hash of the uploaded data in JSON format. Example successful
/// temporary upload link consumption response: {"content-hash": "599d71033d700ac892a0e48fa61b125d2f5994"} An
/// unsuccessful temporary upload link consumption request returns any of the following status codes: HTTP 400
/// Bad Request: Content-Type is not one of application/octet-stream and text/plain or request is invalid. HTTP
/// 409 Conflict: The temporary upload link does not exist or is currently unavailable, the upload failed, or
/// another error happened. HTTP 410 Gone: The temporary upload link is expired or consumed. Example
/// unsuccessful temporary upload link consumption response: Temporary upload link has been recently consumed.
///
/// - scope: files.content.write
///
/// - parameter commitInfo: Contains the path and other optional modifiers for the future upload commit. Equivalent
/// to the parameters provided to upload.
/// - parameter duration: How long before this link expires, in seconds. Attempting to start an upload with this
/// link longer than this period of time after link creation will result in an error.
///
/// - returns: Through the response callback, the caller will receive a `Files.GetTemporaryUploadLinkResult` object
/// on success or a `Void` object on failure.
@discardableResult public func getTemporaryUploadLink(
commitInfo: Files.CommitInfo,
duration: Double = 14_400.0
) -> RpcRequest<Files.GetTemporaryUploadLinkResultSerializer, VoidSerializer> {
let route = Files.getTemporaryUploadLink
let serverArgs = Files.GetTemporaryUploadLinkArg(commitInfo: commitInfo, duration: duration)
return client.request(route, serverArgs: serverArgs)
}
/// Get a thumbnail for an image. This method currently supports files with the following file extensions: jpg,
/// jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB in size won't be converted to
/// a thumbnail.
///
/// - scope: files.content.read
///
/// - parameter path: The path to the image file you want to thumbnail.
/// - parameter format: The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg
/// should be preferred, while png is better for screenshots and digital arts.
/// - parameter size: The size for the thumbnail image.
/// - parameter mode: How to resize and crop the image to achieve the desired size.
/// - parameter overwrite: A boolean to set behavior in the event of a naming conflict. `True` will overwrite
/// conflicting file at destination. `False` will take no action (but if left unhandled in destination closure,
/// an NSError will be thrown).
/// - parameter destination: The location to write the download to.
///
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
/// `Files.ThumbnailError` object on failure.
@discardableResult public func getThumbnail(
path: String,
format: Files.ThumbnailFormat = .jpeg,
size: Files.ThumbnailSize = .w64h64,
mode: Files.ThumbnailMode = .strict,
overwrite: Bool = false,
destination: URL
) -> DownloadRequestFile<Files.FileMetadataSerializer, Files.ThumbnailErrorSerializer> {
let route = Files.getThumbnail
let serverArgs = Files.ThumbnailArg(path: path, format: format, size: size, mode: mode)
return client.request(route, serverArgs: serverArgs, overwrite: overwrite, destination: destination)
}
/// Get a thumbnail for an image. This method currently supports files with the following file extensions: jpg,
/// jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB in size won't be converted to
/// a thumbnail.
///
/// - scope: files.content.read
///
/// - parameter path: The path to the image file you want to thumbnail.
/// - parameter format: The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg
/// should be preferred, while png is better for screenshots and digital arts.
/// - parameter size: The size for the thumbnail image.
/// - parameter mode: How to resize and crop the image to achieve the desired size.
///
/// - returns: Through the response callback, the caller will receive a `Files.FileMetadata` object on success or a
/// `Files.ThumbnailError` object on failure.
@discardableResult public func getThumbnail(
path: String,
format: Files.ThumbnailFormat = .jpeg,
size: Files.ThumbnailSize = .w64h64,
mode: Files.ThumbnailMode = .strict
) -> DownloadRequestMemory<Files.FileMetadataSerializer, Files.ThumbnailErrorSerializer> {
let route = Files.getThumbnail
let serverArgs = Files.ThumbnailArg(path: path, format: format, size: size, mode: mode)
return client.request(route, serverArgs: serverArgs)
}
/// Get a thumbnail for an image. This method currently supports files with the following file extensions: jpg,
/// jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB in size won't be converted to
/// a thumbnail.
///
/// - scope: files.content.read
///
/// - parameter resource: Information specifying which file to preview. This could be a path to a file, a shared
/// link pointing to a file, or a shared link pointing to a folder, with a relative path.
/// - parameter format: The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg
/// should be preferred, while png is better for screenshots and digital arts.
/// - parameter size: The size for the thumbnail image.
/// - parameter mode: How to resize and crop the image to achieve the desired size.
/// - parameter overwrite: A boolean to set behavior in the event of a naming conflict. `True` will overwrite
/// conflicting file at destination. `False` will take no action (but if left unhandled in destination closure,
/// an NSError will be thrown).
/// - parameter destination: The location to write the download to.
///
/// - returns: Through the response callback, the caller will receive a `Files.PreviewResult` object on success or a
/// `Files.ThumbnailV2Error` object on failure.
@discardableResult public func getThumbnailV2(
resource: Files.PathOrLink,
format: Files.ThumbnailFormat = .jpeg,
size: Files.ThumbnailSize = .w64h64,
mode: Files.ThumbnailMode = .strict,
overwrite: Bool = false,
destination: URL
) -> DownloadRequestFile<Files.PreviewResultSerializer, Files.ThumbnailV2ErrorSerializer> {
let route = Files.getThumbnailV2
let serverArgs = Files.ThumbnailV2Arg(resource: resource, format: format, size: size, mode: mode)
return client.request(route, serverArgs: serverArgs, overwrite: overwrite, destination: destination)
}
/// Get a thumbnail for an image. This method currently supports files with the following file extensions: jpg,
/// jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos that are larger than 20MB in size won't be converted to
/// a thumbnail.
///
/// - scope: files.content.read
///
/// - parameter resource: Information specifying which file to preview. This could be a path to a file, a shared
/// link pointing to a file, or a shared link pointing to a folder, with a relative path.
/// - parameter format: The format for the thumbnail image, jpeg (default) or png. For images that are photos, jpeg
/// should be preferred, while png is better for screenshots and digital arts.
/// - parameter size: The size for the thumbnail image.
/// - parameter mode: How to resize and crop the image to achieve the desired size.
///
/// - returns: Through the response callback, the caller will receive a `Files.PreviewResult` object on success or a
/// `Files.ThumbnailV2Error` object on failure.
@discardableResult public func getThumbnailV2(
resource: Files.PathOrLink,
format: Files.ThumbnailFormat = .jpeg,
size: Files.ThumbnailSize = .w64h64,
mode: Files.ThumbnailMode = .strict
) -> DownloadRequestMemory<Files.PreviewResultSerializer, Files.ThumbnailV2ErrorSerializer> {
let route = Files.getThumbnailV2
let serverArgs = Files.ThumbnailV2Arg(resource: resource, format: format, size: size, mode: mode)
return client.request(route, serverArgs: serverArgs)
}
/// Get thumbnails for a list of images. We allow up to 25 thumbnails in a single batch. This method currently
/// supports files with the following file extensions: jpg, jpeg, png, tiff, tif, gif, webp, ppm and bmp. Photos
/// that are larger than 20MB in size won't be converted to a thumbnail.
///
/// - scope: files.content.read
///
/// - parameter entries: List of files to get thumbnails.
///
/// - returns: Through the response callback, the caller will receive a `Files.GetThumbnailBatchResult` object on
/// success or a `Files.GetThumbnailBatchError` object on failure.
@discardableResult public func getThumbnailBatch(entries: [Files.ThumbnailArg])
-> RpcRequest<Files.GetThumbnailBatchResultSerializer, Files.GetThumbnailBatchErrorSerializer> {
let route = Files.getThumbnailBatch
let serverArgs = Files.GetThumbnailBatchArg(entries: entries)
return client.request(route, serverArgs: serverArgs)
}
/// Starts returning the contents of a folder. If the result's hasMore in ListFolderResult field is true, call
/// listFolderContinue with the returned cursor in ListFolderResult to retrieve more entries. If you're using
/// recursive in ListFolderArg set to true to keep a local cache of the contents of a Dropbox account, iterate
/// through each entry in order and process them as follows to keep your local state in sync: For each
/// FileMetadata, store the new entry at the given path in your local state. If the required parent folders
/// don't exist yet, create them. If there's already something else at the given path, replace it and remove all
/// its children. For each FolderMetadata, store the new entry at the given path in your local state. If the
/// required parent folders don't exist yet, create them. If there's already something else at the given path,
/// replace it but leave the children as they are. Check the new entry's readOnly in FolderSharingInfo and set
/// all its children's read-only statuses to match. For each DeletedMetadata, if your local state has something
/// at the given path, remove it and all its children. If there's nothing at the given path, ignore this entry.
/// Note: auth.RateLimitError may be returned if multiple listFolder or listFolderContinue calls with same
/// parameters are made simultaneously by same API app for same user. If your app implements retry logic, please
/// hold off the retry until the previous request finishes.
///
/// - scope: files.metadata.read
///
/// - parameter path: A unique identifier for the file.
/// - parameter recursive: If true, the list folder operation will be applied recursively to all subfolders and the
/// response will contain contents of all subfolders.
/// - parameter includeMediaInfo: If true, mediaInfo in FileMetadata is set for photo and video. This parameter will
/// no longer have an effect starting December 2, 2019.
/// - parameter includeDeleted: If true, the results will include entries for files and folders that used to exist
/// but were deleted.
/// - parameter includeHasExplicitSharedMembers: If true, the results will include a flag for each file indicating
/// whether or not that file has any explicit members.
/// - parameter includeMountedFolders: If true, the results will include entries under mounted folders which
/// includes app folder, shared folder and team folder.
/// - parameter limit: The maximum number of results to return per request. Note: This is an approximate number and
/// there can be slightly more entries returned in some cases.
/// - parameter sharedLink: A shared link to list the contents of. If the link is password-protected, the password
/// must be provided. If this field is present, path in ListFolderArg will be relative to root of the shared
/// link. Only non-recursive mode is supported for shared link.
/// - parameter includePropertyGroups: If set to a valid list of template IDs, propertyGroups in FileMetadata is set
/// if there exists property data associated with the file and each of the listed templates.
/// - parameter includeNonDownloadableFiles: If true, include files that are not downloadable, i.e. Google Docs.
///
/// - returns: Through the response callback, the caller will receive a `Files.ListFolderResult` object on success
/// or a `Files.ListFolderError` object on failure.
@discardableResult public func listFolder(
path: String,
recursive: Bool = false,
includeMediaInfo: Bool = false,
includeDeleted: Bool = false,
includeHasExplicitSharedMembers: Bool = false,
includeMountedFolders: Bool = true,
limit: UInt32? = nil,
sharedLink: Files.SharedLink? = nil,
includePropertyGroups: FileProperties.TemplateFilterBase? = nil,
includeNonDownloadableFiles: Bool = true
) -> RpcRequest<Files.ListFolderResultSerializer, Files.ListFolderErrorSerializer> {
let route = Files.listFolder
let serverArgs = Files.ListFolderArg(
path: path,
recursive: recursive,
includeMediaInfo: includeMediaInfo,
includeDeleted: includeDeleted,
includeHasExplicitSharedMembers: includeHasExplicitSharedMembers,
includeMountedFolders: includeMountedFolders,
limit: limit,
sharedLink: sharedLink,
includePropertyGroups: includePropertyGroups,
includeNonDownloadableFiles: includeNonDownloadableFiles
)
return client.request(route, serverArgs: serverArgs)
}
/// Once a cursor has been retrieved from listFolder, use this to paginate through all files and retrieve updates to
/// the folder, following the same rules as documented for listFolder.
///
/// - scope: files.metadata.read
///
/// - parameter cursor: The cursor returned by your last call to listFolder or listFolderContinue.
///
/// - returns: Through the response callback, the caller will receive a `Files.ListFolderResult` object on success
/// or a `Files.ListFolderContinueError` object on failure.
@discardableResult public func listFolderContinue(cursor: String) -> RpcRequest<Files.ListFolderResultSerializer, Files.ListFolderContinueErrorSerializer> {
let route = Files.listFolderContinue
let serverArgs = Files.ListFolderContinueArg(cursor: cursor)
return client.request(route, serverArgs: serverArgs)
}
/// A way to quickly get a cursor for the folder's state. Unlike listFolder, listFolderGetLatestCursor doesn't
/// return any entries. This endpoint is for app which only needs to know about new files and modifications and
/// doesn't need to know about files that already exist in Dropbox.
///
/// - scope: files.metadata.read
///
/// - parameter path: A unique identifier for the file.
/// - parameter recursive: If true, the list folder operation will be applied recursively to all subfolders and the
/// response will contain contents of all subfolders.
/// - parameter includeMediaInfo: If true, mediaInfo in FileMetadata is set for photo and video. This parameter will
/// no longer have an effect starting December 2, 2019.
/// - parameter includeDeleted: If true, the results will include entries for files and folders that used to exist
/// but were deleted.
/// - parameter includeHasExplicitSharedMembers: If true, the results will include a flag for each file indicating
/// whether or not that file has any explicit members.