14
14
file_requests ,
15
15
files ,
16
16
paper ,
17
+ seen_state ,
17
18
sharing ,
18
19
team ,
19
20
team_common ,
@@ -143,8 +144,9 @@ def file_properties_properties_remove(self,
143
144
remove specific property field key value pairs, see
144
145
:meth:`file_properties_properties_update`. To update a template, see
145
146
:meth:`file_properties_templates_update_for_user` or
146
- :meth:`file_properties_templates_update_for_team`. Templates can't be
147
- removed once created.
147
+ :meth:`file_properties_templates_update_for_team`. To remove a template,
148
+ see :meth:`file_properties_templates_remove_for_user` or
149
+ :meth:`file_properties_templates_remove_for_team`.
148
150
149
151
:param str path: A unique identifier for the file or folder.
150
152
:param list property_template_ids: A list of identifiers for a template
@@ -926,6 +928,61 @@ def files_create_folder(self,
926
928
)
927
929
return r
928
930
931
+ def files_create_folder_batch (self ,
932
+ paths ,
933
+ autorename = False ,
934
+ force_async = False ):
935
+ """
936
+ Create multiple folders at once. This route is asynchronous for large
937
+ batches, which returns a job ID immediately and runs the create folder
938
+ batch asynchronously. Otherwise, creates the folders and returns the
939
+ result synchronously for smaller inputs. You can force asynchronous
940
+ behaviour by using the ``CreateFolderBatchArg.force_async`` flag. Use
941
+ :meth:`files_create_folder_batch_check` to check the job status.
942
+
943
+ :param list paths: List of paths to be created in the user's Dropbox.
944
+ Duplicate path arguments in the batch are considered only once.
945
+ :param bool autorename: If there's a conflict, have the Dropbox server
946
+ try to autorename the folder to avoid the conflict.
947
+ :param bool force_async: Whether to force the create to happen
948
+ asynchronously.
949
+ :rtype: :class:`dropbox.files.CreateFolderBatchLaunch`
950
+ """
951
+ arg = files .CreateFolderBatchArg (paths ,
952
+ autorename ,
953
+ force_async )
954
+ r = self .request (
955
+ files .create_folder_batch ,
956
+ 'files' ,
957
+ arg ,
958
+ None ,
959
+ )
960
+ return r
961
+
962
+ def files_create_folder_batch_check (self ,
963
+ async_job_id ):
964
+ """
965
+ Returns the status of an asynchronous job for
966
+ :meth:`files_create_folder_batch`. If success, it returns list of result
967
+ for each entry.
968
+
969
+ :param str async_job_id: Id of the asynchronous job. This is the value
970
+ of a response returned from the method that launched the job.
971
+ :rtype: :class:`dropbox.files.CreateFolderBatchJobStatus`
972
+ :raises: :class:`.exceptions.ApiError`
973
+
974
+ If this raises, ApiError will contain:
975
+ :class:`dropbox.files.PollError`
976
+ """
977
+ arg = async .PollArg (async_job_id )
978
+ r = self .request (
979
+ files .create_folder_batch_check ,
980
+ 'files' ,
981
+ arg ,
982
+ None ,
983
+ )
984
+ return r
985
+
929
986
def files_create_folder_v2 (self ,
930
987
path ,
931
988
autorename = False ):
@@ -952,7 +1009,8 @@ def files_create_folder_v2(self,
952
1009
return r
953
1010
954
1011
def files_delete (self ,
955
- path ):
1012
+ path ,
1013
+ parent_rev = None ):
956
1014
"""
957
1015
Delete the file or folder at a given path. If the path is a folder, all
958
1016
its contents will be deleted too. A successful response indicates that
@@ -962,6 +1020,9 @@ def files_delete(self,
962
1020
and not a :class:`dropbox.files.DeletedMetadata` object.
963
1021
964
1022
:param str path: Path in the user's Dropbox to delete.
1023
+ :param Nullable parent_rev: Perform delete if given "rev" matches the
1024
+ existing file's latest "rev". This field does not support deleting a
1025
+ folder.
965
1026
:rtype: :class:`dropbox.files.Metadata`
966
1027
:raises: :class:`.exceptions.ApiError`
967
1028
@@ -972,7 +1033,8 @@ def files_delete(self,
972
1033
'delete is deprecated. Use delete_v2.' ,
973
1034
DeprecationWarning ,
974
1035
)
975
- arg = files .DeleteArg (path )
1036
+ arg = files .DeleteArg (path ,
1037
+ parent_rev )
976
1038
r = self .request (
977
1039
files .delete ,
978
1040
'files' ,
@@ -1025,7 +1087,8 @@ def files_delete_batch_check(self,
1025
1087
return r
1026
1088
1027
1089
def files_delete_v2 (self ,
1028
- path ):
1090
+ path ,
1091
+ parent_rev = None ):
1029
1092
"""
1030
1093
Delete the file or folder at a given path. If the path is a folder, all
1031
1094
its contents will be deleted too. A successful response indicates that
@@ -1035,13 +1098,17 @@ def files_delete_v2(self,
1035
1098
and not a :class:`dropbox.files.DeletedMetadata` object.
1036
1099
1037
1100
:param str path: Path in the user's Dropbox to delete.
1101
+ :param Nullable parent_rev: Perform delete if given "rev" matches the
1102
+ existing file's latest "rev". This field does not support deleting a
1103
+ folder.
1038
1104
:rtype: :class:`dropbox.files.DeleteResult`
1039
1105
:raises: :class:`.exceptions.ApiError`
1040
1106
1041
1107
If this raises, ApiError will contain:
1042
1108
:class:`dropbox.files.DeleteError`
1043
1109
"""
1044
- arg = files .DeleteArg (path )
1110
+ arg = files .DeleteArg (path ,
1111
+ parent_rev )
1045
1112
r = self .request (
1046
1113
files .delete_v2 ,
1047
1114
'files' ,
@@ -1299,7 +1366,8 @@ def files_get_temporary_link(self,
1299
1366
def files_get_thumbnail (self ,
1300
1367
path ,
1301
1368
format = files .ThumbnailFormat .jpeg ,
1302
- size = files .ThumbnailSize .w64h64 ):
1369
+ size = files .ThumbnailSize .w64h64 ,
1370
+ mode = files .ThumbnailMode .strict ):
1303
1371
"""
1304
1372
Get a thumbnail for an image. This method currently supports files with
1305
1373
the following file extensions: jpg, jpeg, png, tiff, tif, gif and bmp.
@@ -1313,6 +1381,9 @@ def files_get_thumbnail(self,
1313
1381
:type format: :class:`dropbox.files.ThumbnailFormat`
1314
1382
:param size: The size for the thumbnail image.
1315
1383
:type size: :class:`dropbox.files.ThumbnailSize`
1384
+ :param mode: How to resize and crop the image to achieve the desired
1385
+ size.
1386
+ :type mode: :class:`dropbox.files.ThumbnailMode`
1316
1387
:rtype: (:class:`dropbox.files.FileMetadata`,
1317
1388
:class:`requests.models.Response`)
1318
1389
:raises: :class:`.exceptions.ApiError`
@@ -1328,7 +1399,8 @@ def files_get_thumbnail(self,
1328
1399
"""
1329
1400
arg = files .ThumbnailArg (path ,
1330
1401
format ,
1331
- size )
1402
+ size ,
1403
+ mode )
1332
1404
r = self .request (
1333
1405
files .get_thumbnail ,
1334
1406
'files' ,
@@ -1341,7 +1413,8 @@ def files_get_thumbnail_to_file(self,
1341
1413
download_path ,
1342
1414
path ,
1343
1415
format = files .ThumbnailFormat .jpeg ,
1344
- size = files .ThumbnailSize .w64h64 ):
1416
+ size = files .ThumbnailSize .w64h64 ,
1417
+ mode = files .ThumbnailMode .strict ):
1345
1418
"""
1346
1419
Get a thumbnail for an image. This method currently supports files with
1347
1420
the following file extensions: jpg, jpeg, png, tiff, tif, gif and bmp.
@@ -1356,6 +1429,9 @@ def files_get_thumbnail_to_file(self,
1356
1429
:type format: :class:`dropbox.files.ThumbnailFormat`
1357
1430
:param size: The size for the thumbnail image.
1358
1431
:type size: :class:`dropbox.files.ThumbnailSize`
1432
+ :param mode: How to resize and crop the image to achieve the desired
1433
+ size.
1434
+ :type mode: :class:`dropbox.files.ThumbnailMode`
1359
1435
:rtype: :class:`dropbox.files.FileMetadata`
1360
1436
:raises: :class:`.exceptions.ApiError`
1361
1437
@@ -1364,7 +1440,8 @@ def files_get_thumbnail_to_file(self,
1364
1440
"""
1365
1441
arg = files .ThumbnailArg (path ,
1366
1442
format ,
1367
- size )
1443
+ size ,
1444
+ mode )
1368
1445
r = self .request (
1369
1446
files .get_thumbnail ,
1370
1447
'files' ,
@@ -1790,20 +1867,25 @@ def files_move_v2(self,
1790
1867
return r
1791
1868
1792
1869
def files_permanently_delete (self ,
1793
- path ):
1870
+ path ,
1871
+ parent_rev = None ):
1794
1872
"""
1795
1873
Permanently delete the file or folder at a given path (see
1796
1874
https://www.dropbox.com/en/help/40). Note: This endpoint is only
1797
1875
available for Dropbox Business apps.
1798
1876
1799
1877
:param str path: Path in the user's Dropbox to delete.
1878
+ :param Nullable parent_rev: Perform delete if given "rev" matches the
1879
+ existing file's latest "rev". This field does not support deleting a
1880
+ folder.
1800
1881
:rtype: None
1801
1882
:raises: :class:`.exceptions.ApiError`
1802
1883
1803
1884
If this raises, ApiError will contain:
1804
1885
:class:`dropbox.files.DeleteError`
1805
1886
"""
1806
- arg = files .DeleteArg (path )
1887
+ arg = files .DeleteArg (path ,
1888
+ parent_rev )
1807
1889
r = self .request (
1808
1890
files .permanently_delete ,
1809
1891
'files' ,
@@ -2481,7 +2563,7 @@ def paper_docs_get_folder_info(self,
2481
2563
Retrieves folder information for the given Paper doc. This includes: -
2482
2564
folder sharing policy; permissions for subfolders are set by the
2483
2565
top-level folder. - full 'filepath', i.e. the list of folders (both
2484
- folderId and folderName) from the root folder to the folder directly
2566
+ folderId and folderName) from the root folder to the folder directly
2485
2567
containing the Paper doc. Note: If the Paper doc is not in any folder
2486
2568
(aka unfiled) the response will be empty.
2487
2569
@@ -3815,6 +3897,36 @@ def sharing_revoke_shared_link(self,
3815
3897
)
3816
3898
return None
3817
3899
3900
+ def sharing_set_access_inheritance (self ,
3901
+ shared_folder_id ,
3902
+ access_inheritance = sharing .AccessInheritance .inherit ):
3903
+ """
3904
+ Change the inheritance policy of an existing Shared Folder. Only
3905
+ permitted for shared folders in a shared team root. If a
3906
+ ``ShareFolderLaunch.async_job_id`` is returned, you'll need to call
3907
+ :meth:`sharing_check_share_job_status` until the action completes to get
3908
+ the metadata for the folder.
3909
+
3910
+ :param access_inheritance: The access inheritance settings for the
3911
+ folder.
3912
+ :type access_inheritance: :class:`dropbox.sharing.AccessInheritance`
3913
+ :param str shared_folder_id: The ID for the shared folder.
3914
+ :rtype: :class:`dropbox.sharing.ShareFolderLaunch`
3915
+ :raises: :class:`.exceptions.ApiError`
3916
+
3917
+ If this raises, ApiError will contain:
3918
+ :class:`dropbox.sharing.SetAccessInheritanceError`
3919
+ """
3920
+ arg = sharing .SetAccessInheritanceArg (shared_folder_id ,
3921
+ access_inheritance )
3922
+ r = self .request (
3923
+ sharing .set_access_inheritance ,
3924
+ 'sharing' ,
3925
+ arg ,
3926
+ None ,
3927
+ )
3928
+ return r
3929
+
3818
3930
def sharing_share_folder (self ,
3819
3931
path ,
3820
3932
acl_update_policy = None ,
@@ -4076,7 +4188,9 @@ def team_log_get_events(self,
4076
4188
time = None ,
4077
4189
category = None ):
4078
4190
"""
4079
- Retrieves team events. Permission : Team Auditing.
4191
+ Retrieves team events. Events have a lifespan of two years. Events older
4192
+ than two years will not be returned. Many attributes note 'may be
4193
+ missing due to historical data gap'. Permission : Team Auditing.
4080
4194
4081
4195
:param long limit: Number of results to return per call.
4082
4196
:param Nullable account_id: Filter the events by account ID. Return ony
0 commit comments