Skip to content

Commit bf0d3af

Browse files
committed
Backwards-incompatible changes!
- /check_job_status groups errors by routes. - Shared Folder ID format has changed to match API v1. Backwards-compatible changes: - ID is now a required field in Metadata. - Added `path_display` to Metadata. - /sharing/list_mountable_folders[/continue] - Set max length on names and e-mails. - Added `direct_only` flag to /sharing/list_shared_links
1 parent 28c2588 commit bf0d3af

File tree

11 files changed

+1177
-411
lines changed

11 files changed

+1177
-411
lines changed

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
# built documents.
6060
#
6161
# The short X.Y version.
62-
version = '5.2.2'
62+
version = '6.0'
6363
# The full version, including alpha/beta/rc tags.
64-
release = '5.2.2'
64+
release = '6.0'
6565

6666
# The language for content autogenerated by Sphinx. Refer to documentation
6767
# for a list of supported languages.

dropbox/base.py

Lines changed: 97 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def files_download(self,
111111
Download a file from a user's Dropbox.
112112
113113
:param str path: The path of the file to download.
114-
:param Nullable rev: Deprecated. Please specify revision in
115-
:field:'path' instead
114+
:param Nullable rev: Deprecated. Please specify revision in ``path``
115+
instead
116116
:rtype: (:class:`dropbox.files.FileMetadata`,
117117
:class:`requests.models.Response`)
118118
:raises: :class:`dropbox.exceptions.ApiError`
@@ -149,8 +149,8 @@ def files_download_to_file(self,
149149
150150
:param str download_path: Path on local machine to save file.
151151
:param str path: The path of the file to download.
152-
:param Nullable rev: Deprecated. Please specify revision in
153-
:field:'path' instead
152+
:param Nullable rev: Deprecated. Please specify revision in ``path``
153+
instead
154154
:rtype: (:class:`dropbox.files.FileMetadata`,
155155
:class:`requests.models.Response`)
156156
:raises: :class:`dropbox.exceptions.ApiError`
@@ -177,11 +177,12 @@ def files_get_metadata(self,
177177
path,
178178
include_media_info=False):
179179
"""
180-
Returns the metadata for a file or folder.
180+
Returns the metadata for a file or folder. Note: Metadata for the root
181+
folder is unsupported.
181182
182-
:param str path: The path of a file or folder on Dropbox
183-
:param bool include_media_info: If true,
184-
:field:'FileMetadata.media_info' is set for photo and video.
183+
:param str path: The path of a file or folder on Dropbox.
184+
:param bool include_media_info: If true, ``FileMetadata.media_info`` is
185+
set for photo and video.
185186
:rtype: :class:`dropbox.files.Metadata`
186187
:raises: :class:`dropbox.exceptions.ApiError`
187188
@@ -211,8 +212,8 @@ def files_get_preview(self,
211212
.ppsx, .ppsm, .pptx, .pptm, .xls, .xlsx, .xlsm, .rtf
212213
213214
:param str path: The path of the file to preview.
214-
:param Nullable rev: Deprecated. Please specify revision in
215-
:field:'path' instead
215+
:param Nullable rev: Deprecated. Please specify revision in ``path``
216+
instead
216217
:rtype: (:class:`dropbox.files.FileMetadata`,
217218
:class:`requests.models.Response`)
218219
:raises: :class:`dropbox.exceptions.ApiError`
@@ -251,8 +252,8 @@ def files_get_preview_to_file(self,
251252
252253
:param str download_path: Path on local machine to save file.
253254
:param str path: The path of the file to preview.
254-
:param Nullable rev: Deprecated. Please specify revision in
255-
:field:'path' instead
255+
:param Nullable rev: Deprecated. Please specify revision in ``path``
256+
instead
256257
:rtype: (:class:`dropbox.files.FileMetadata`,
257258
:class:`requests.models.Response`)
258259
:raises: :class:`dropbox.exceptions.ApiError`
@@ -374,8 +375,8 @@ def files_list_folder(self,
374375
:param bool recursive: If true, the list folder operation will be
375376
applied recursively to all subfolders and the response will contain
376377
contents of all subfolders.
377-
:param bool include_media_info: If true,
378-
:field:'FileMetadata.media_info' is set for photo and video.
378+
:param bool include_media_info: If true, ``FileMetadata.media_info`` is
379+
set for photo and video.
379380
:param bool include_deleted: If true, the results will include entries
380381
for files and folders that used to exist but were deleted.
381382
:rtype: :class:`dropbox.files.ListFolderResult`
@@ -443,8 +444,8 @@ def files_list_folder_get_latest_cursor(self,
443444
:param bool recursive: If true, the list folder operation will be
444445
applied recursively to all subfolders and the response will contain
445446
contents of all subfolders.
446-
:param bool include_media_info: If true,
447-
:field:'FileMetadata.media_info' is set for photo and video.
447+
:param bool include_media_info: If true, ``FileMetadata.media_info`` is
448+
set for photo and video.
448449
:param bool include_deleted: If true, the results will include entries
449450
for files and folders that used to exist but were deleted.
450451
:rtype: :class:`dropbox.files.ListFolderGetLatestCursorResult`
@@ -996,7 +997,8 @@ def sharing_get_folder_metadata(self,
996997
and is subject to minor but possibly backwards-incompatible changes.
997998
998999
:param str shared_folder_id: The ID for the shared folder.
999-
:param Nullable actions: Folder actions to query.
1000+
:param Nullable actions: Folder actions to query. This field is
1001+
optional.
10001002
:rtype: :class:`dropbox.sharing.SharedFolderMetadata`
10011003
:raises: :class:`dropbox.exceptions.ApiError`
10021004
@@ -1163,22 +1165,27 @@ def sharing_get_shared_links(self,
11631165

11641166
def sharing_list_folder_members(self,
11651167
shared_folder_id,
1166-
actions=None):
1168+
actions=None,
1169+
limit=1000):
11671170
"""
11681171
Returns shared folder membership by its folder ID. Apps must have full
11691172
Dropbox access to use this endpoint. Warning: This endpoint is in beta
11701173
and is subject to minor but possibly backwards-incompatible changes.
11711174
11721175
:param str shared_folder_id: The ID for the shared folder.
1173-
:param Nullable actions: Member actions to query.
1176+
:param Nullable actions: Member actions to query. This field is
1177+
optional.
1178+
:param long limit: The maximum number of results that include members,
1179+
groups and invitees to return per request.
11741180
:rtype: :class:`dropbox.sharing.SharedFolderMembers`
11751181
:raises: :class:`dropbox.exceptions.ApiError`
11761182
11771183
If this raises, ApiError.reason is of type:
11781184
:class:`dropbox.sharing.SharedFolderAccessError`
11791185
"""
11801186
arg = sharing.ListFolderMembersArgs(shared_folder_id,
1181-
actions)
1187+
actions,
1188+
limit)
11821189
r = self.request(
11831190
'api',
11841191
'sharing/list_folder_members',
@@ -1220,21 +1227,27 @@ def sharing_list_folder_members_continue(self,
12201227
)
12211228
return r
12221229

1223-
def sharing_list_folders(self):
1230+
def sharing_list_folders(self,
1231+
limit=1000,
1232+
actions=None):
12241233
"""
12251234
Return the list of all shared folders the current user has access to.
12261235
Apps must have full Dropbox access to use this endpoint. Warning: This
12271236
endpoint is in beta and is subject to minor but possibly
12281237
backwards-incompatible changes.
12291238
1239+
:param long limit: The maximum number of results to return per request.
1240+
:param Nullable actions: Folder actions to query. This field is
1241+
optional.
12301242
:rtype: :class:`dropbox.sharing.ListFoldersResult`
12311243
"""
1232-
arg = None
1244+
arg = sharing.ListFoldersArgs(limit,
1245+
actions)
12331246
r = self.request(
12341247
'api',
12351248
'sharing/list_folders',
12361249
'rpc',
1237-
bv.Void(),
1250+
bv.Struct(sharing.ListFoldersArgs),
12381251
bv.Struct(sharing.ListFoldersResult),
12391252
bv.Void(),
12401253
arg,
@@ -1271,27 +1284,85 @@ def sharing_list_folders_continue(self,
12711284
)
12721285
return r
12731286

1287+
def sharing_list_mountable_folders(self,
1288+
limit=1000,
1289+
actions=None):
1290+
"""
1291+
Return the list of all shared folders the current user can mount or
1292+
unmount. Apps must have full Dropbox access to use this endpoint.
1293+
1294+
:param long limit: The maximum number of results to return per request.
1295+
:param Nullable actions: Folder actions to query. This field is
1296+
optional.
1297+
:rtype: :class:`dropbox.sharing.ListFoldersResult`
1298+
"""
1299+
arg = sharing.ListFoldersArgs(limit,
1300+
actions)
1301+
r = self.request(
1302+
'api',
1303+
'sharing/list_mountable_folders',
1304+
'rpc',
1305+
bv.Struct(sharing.ListFoldersArgs),
1306+
bv.Struct(sharing.ListFoldersResult),
1307+
bv.Void(),
1308+
arg,
1309+
None,
1310+
)
1311+
return r
1312+
1313+
def sharing_list_mountable_folders_continue(self,
1314+
cursor):
1315+
"""
1316+
Once a cursor has been retrieved from :meth:`list_mountable_folders`,
1317+
use this to paginate through all mountable shared folders. Apps must
1318+
have full Dropbox access to use this endpoint.
1319+
1320+
:param str cursor: The cursor returned by your last call to
1321+
:meth:`list_folders` or :meth:`list_folders_continue`.
1322+
:rtype: :class:`dropbox.sharing.ListFoldersResult`
1323+
:raises: :class:`dropbox.exceptions.ApiError`
1324+
1325+
If this raises, ApiError.reason is of type:
1326+
:class:`dropbox.sharing.ListFoldersContinueError`
1327+
"""
1328+
arg = sharing.ListFoldersContinueArg(cursor)
1329+
r = self.request(
1330+
'api',
1331+
'sharing/list_mountable_folders/continue',
1332+
'rpc',
1333+
bv.Struct(sharing.ListFoldersContinueArg),
1334+
bv.Struct(sharing.ListFoldersResult),
1335+
bv.Union(sharing.ListFoldersContinueError),
1336+
arg,
1337+
None,
1338+
)
1339+
return r
1340+
12741341
def sharing_list_shared_links(self,
12751342
path=None,
1276-
cursor=None):
1343+
cursor=None,
1344+
direct_only=None):
12771345
"""
12781346
List shared links of this user. If no path is given or the path is
12791347
empty, returns a list of all shared links for the current user. If a
12801348
non-empty path is given, returns a list of all shared links that allow
12811349
access to the given path - direct links to the given path and links to
1282-
parent folders of the given path.
1350+
parent folders of the given path. Links to parent folders can be
1351+
suppressed by setting direct_only to true.
12831352
12841353
:param Nullable path: See :meth:`list_shared_links` description.
12851354
:param Nullable cursor: The cursor returned by your last call to
12861355
:meth:`list_shared_links`.
1356+
:param Nullable direct_only: See :meth:`list_shared_links` description.
12871357
:rtype: :class:`dropbox.sharing.ListSharedLinksResult`
12881358
:raises: :class:`dropbox.exceptions.ApiError`
12891359
12901360
If this raises, ApiError.reason is of type:
12911361
:class:`dropbox.sharing.ListSharedLinksError`
12921362
"""
12931363
arg = sharing.ListSharedLinksArg(path,
1294-
cursor)
1364+
cursor,
1365+
direct_only)
12951366
r = self.request(
12961367
'api',
12971368
'sharing/list_shared_links',

dropbox/base_team.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,10 +731,9 @@ def team_members_remove(self,
731731
can be re-activated again. Calling :meth:`members_add` with the removed
732732
user's email address will create a new account with a new team_member_id
733733
that will not have access to any content that was shared with the
734-
initial account. This endpoint can also be used to cancel a pending
735-
invite to join the team. This endpoint may initiate an asynchronous job.
736-
To obtain the final result of the job, the client should periodically
737-
poll :meth:`members_remove_job_status_get`.
734+
initial account. This endpoint may initiate an asynchronous job. To
735+
obtain the final result of the job, the client should periodically poll
736+
:meth:`members_remove_job_status_get`.
738737
739738
:param Nullable transfer_dest_id: If provided, files from the deleted
740739
member account will be transferred to this user.

dropbox/dropbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
]
66

77
# TODO(kelkabany): We need to auto populate this as done in the v1 SDK.
8-
__version__ = '5.2.2'
8+
__version__ = '6.0'
99

1010
import contextlib
1111
import json

0 commit comments

Comments
 (0)