Skip to content

Commit

Permalink
Backwards-incompatible changes!
Browse files Browse the repository at this point in the history
- /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
  • Loading branch information
braincore committed Feb 24, 2016
1 parent 28c2588 commit bf0d3af
Show file tree
Hide file tree
Showing 11 changed files with 1,177 additions and 411 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
# built documents.
#
# The short X.Y version.
version = '5.2.2'
version = '6.0'
# The full version, including alpha/beta/rc tags.
release = '5.2.2'
release = '6.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
123 changes: 97 additions & 26 deletions dropbox/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def files_download(self,
Download a file from a user's Dropbox.
:param str path: The path of the file to download.
:param Nullable rev: Deprecated. Please specify revision in
:field:'path' instead
:param Nullable rev: Deprecated. Please specify revision in ``path``
instead
:rtype: (:class:`dropbox.files.FileMetadata`,
:class:`requests.models.Response`)
:raises: :class:`dropbox.exceptions.ApiError`
Expand Down Expand Up @@ -149,8 +149,8 @@ def files_download_to_file(self,
:param str download_path: Path on local machine to save file.
:param str path: The path of the file to download.
:param Nullable rev: Deprecated. Please specify revision in
:field:'path' instead
:param Nullable rev: Deprecated. Please specify revision in ``path``
instead
:rtype: (:class:`dropbox.files.FileMetadata`,
:class:`requests.models.Response`)
:raises: :class:`dropbox.exceptions.ApiError`
Expand All @@ -177,11 +177,12 @@ def files_get_metadata(self,
path,
include_media_info=False):
"""
Returns the metadata for a file or folder.
Returns the metadata for a file or folder. Note: Metadata for the root
folder is unsupported.
:param str path: The path of a file or folder on Dropbox
:param bool include_media_info: If true,
:field:'FileMetadata.media_info' is set for photo and video.
:param str path: The path of a file or folder on Dropbox.
:param bool include_media_info: If true, ``FileMetadata.media_info`` is
set for photo and video.
:rtype: :class:`dropbox.files.Metadata`
:raises: :class:`dropbox.exceptions.ApiError`
Expand Down Expand Up @@ -211,8 +212,8 @@ def files_get_preview(self,
.ppsx, .ppsm, .pptx, .pptm, .xls, .xlsx, .xlsm, .rtf
:param str path: The path of the file to preview.
:param Nullable rev: Deprecated. Please specify revision in
:field:'path' instead
:param Nullable rev: Deprecated. Please specify revision in ``path``
instead
:rtype: (:class:`dropbox.files.FileMetadata`,
:class:`requests.models.Response`)
:raises: :class:`dropbox.exceptions.ApiError`
Expand Down Expand Up @@ -251,8 +252,8 @@ def files_get_preview_to_file(self,
:param str download_path: Path on local machine to save file.
:param str path: The path of the file to preview.
:param Nullable rev: Deprecated. Please specify revision in
:field:'path' instead
:param Nullable rev: Deprecated. Please specify revision in ``path``
instead
:rtype: (:class:`dropbox.files.FileMetadata`,
:class:`requests.models.Response`)
:raises: :class:`dropbox.exceptions.ApiError`
Expand Down Expand Up @@ -374,8 +375,8 @@ def files_list_folder(self,
:param bool recursive: If true, the list folder operation will be
applied recursively to all subfolders and the response will contain
contents of all subfolders.
:param bool include_media_info: If true,
:field:'FileMetadata.media_info' is set for photo and video.
:param bool include_media_info: If true, ``FileMetadata.media_info`` is
set for photo and video.
:param bool include_deleted: If true, the results will include entries
for files and folders that used to exist but were deleted.
:rtype: :class:`dropbox.files.ListFolderResult`
Expand Down Expand Up @@ -443,8 +444,8 @@ def files_list_folder_get_latest_cursor(self,
:param bool recursive: If true, the list folder operation will be
applied recursively to all subfolders and the response will contain
contents of all subfolders.
:param bool include_media_info: If true,
:field:'FileMetadata.media_info' is set for photo and video.
:param bool include_media_info: If true, ``FileMetadata.media_info`` is
set for photo and video.
:param bool include_deleted: If true, the results will include entries
for files and folders that used to exist but were deleted.
:rtype: :class:`dropbox.files.ListFolderGetLatestCursorResult`
Expand Down Expand Up @@ -996,7 +997,8 @@ def sharing_get_folder_metadata(self,
and is subject to minor but possibly backwards-incompatible changes.
:param str shared_folder_id: The ID for the shared folder.
:param Nullable actions: Folder actions to query.
:param Nullable actions: Folder actions to query. This field is
optional.
:rtype: :class:`dropbox.sharing.SharedFolderMetadata`
:raises: :class:`dropbox.exceptions.ApiError`
Expand Down Expand Up @@ -1163,22 +1165,27 @@ def sharing_get_shared_links(self,

def sharing_list_folder_members(self,
shared_folder_id,
actions=None):
actions=None,
limit=1000):
"""
Returns shared folder membership by its folder ID. Apps must have full
Dropbox access to use this endpoint. Warning: This endpoint is in beta
and is subject to minor but possibly backwards-incompatible changes.
:param str shared_folder_id: The ID for the shared folder.
:param Nullable actions: Member actions to query.
:param Nullable actions: Member actions to query. This field is
optional.
:param long limit: The maximum number of results that include members,
groups and invitees to return per request.
:rtype: :class:`dropbox.sharing.SharedFolderMembers`
:raises: :class:`dropbox.exceptions.ApiError`
If this raises, ApiError.reason is of type:
:class:`dropbox.sharing.SharedFolderAccessError`
"""
arg = sharing.ListFolderMembersArgs(shared_folder_id,
actions)
actions,
limit)
r = self.request(
'api',
'sharing/list_folder_members',
Expand Down Expand Up @@ -1220,21 +1227,27 @@ def sharing_list_folder_members_continue(self,
)
return r

def sharing_list_folders(self):
def sharing_list_folders(self,
limit=1000,
actions=None):
"""
Return the list of all shared folders the current user has access to.
Apps must have full Dropbox access to use this endpoint. Warning: This
endpoint is in beta and is subject to minor but possibly
backwards-incompatible changes.
:param long limit: The maximum number of results to return per request.
:param Nullable actions: Folder actions to query. This field is
optional.
:rtype: :class:`dropbox.sharing.ListFoldersResult`
"""
arg = None
arg = sharing.ListFoldersArgs(limit,
actions)
r = self.request(
'api',
'sharing/list_folders',
'rpc',
bv.Void(),
bv.Struct(sharing.ListFoldersArgs),
bv.Struct(sharing.ListFoldersResult),
bv.Void(),
arg,
Expand Down Expand Up @@ -1271,27 +1284,85 @@ def sharing_list_folders_continue(self,
)
return r

def sharing_list_mountable_folders(self,
limit=1000,
actions=None):
"""
Return the list of all shared folders the current user can mount or
unmount. Apps must have full Dropbox access to use this endpoint.
:param long limit: The maximum number of results to return per request.
:param Nullable actions: Folder actions to query. This field is
optional.
:rtype: :class:`dropbox.sharing.ListFoldersResult`
"""
arg = sharing.ListFoldersArgs(limit,
actions)
r = self.request(
'api',
'sharing/list_mountable_folders',
'rpc',
bv.Struct(sharing.ListFoldersArgs),
bv.Struct(sharing.ListFoldersResult),
bv.Void(),
arg,
None,
)
return r

def sharing_list_mountable_folders_continue(self,
cursor):
"""
Once a cursor has been retrieved from :meth:`list_mountable_folders`,
use this to paginate through all mountable shared folders. Apps must
have full Dropbox access to use this endpoint.
:param str cursor: The cursor returned by your last call to
:meth:`list_folders` or :meth:`list_folders_continue`.
:rtype: :class:`dropbox.sharing.ListFoldersResult`
:raises: :class:`dropbox.exceptions.ApiError`
If this raises, ApiError.reason is of type:
:class:`dropbox.sharing.ListFoldersContinueError`
"""
arg = sharing.ListFoldersContinueArg(cursor)
r = self.request(
'api',
'sharing/list_mountable_folders/continue',
'rpc',
bv.Struct(sharing.ListFoldersContinueArg),
bv.Struct(sharing.ListFoldersResult),
bv.Union(sharing.ListFoldersContinueError),
arg,
None,
)
return r

def sharing_list_shared_links(self,
path=None,
cursor=None):
cursor=None,
direct_only=None):
"""
List shared links of this user. If no path is given or the path is
empty, returns a list of all shared links for the current user. 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.
parent folders of the given path. Links to parent folders can be
suppressed by setting direct_only to true.
:param Nullable path: See :meth:`list_shared_links` description.
:param Nullable cursor: The cursor returned by your last call to
:meth:`list_shared_links`.
:param Nullable direct_only: See :meth:`list_shared_links` description.
:rtype: :class:`dropbox.sharing.ListSharedLinksResult`
:raises: :class:`dropbox.exceptions.ApiError`
If this raises, ApiError.reason is of type:
:class:`dropbox.sharing.ListSharedLinksError`
"""
arg = sharing.ListSharedLinksArg(path,
cursor)
cursor,
direct_only)
r = self.request(
'api',
'sharing/list_shared_links',
Expand Down
7 changes: 3 additions & 4 deletions dropbox/base_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,9 @@ def team_members_remove(self,
can be re-activated again. Calling :meth:`members_add` with the removed
user's email address will create a new account with a new team_member_id
that will not have access to any content that was shared with the
initial account. This endpoint can also be used to cancel a pending
invite to join the team. This endpoint may initiate an asynchronous job.
To obtain the final result of the job, the client should periodically
poll :meth:`members_remove_job_status_get`.
initial account. This endpoint may initiate an asynchronous job. To
obtain the final result of the job, the client should periodically poll
:meth:`members_remove_job_status_get`.
:param Nullable transfer_dest_id: If provided, files from the deleted
member account will be transferred to this user.
Expand Down
2 changes: 1 addition & 1 deletion dropbox/dropbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
]

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

import contextlib
import json
Expand Down
Loading

2 comments on commit bf0d3af

@grantmcconnaughey
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you folks are going to introduce backwards-incompatible changes then please, PLEASE. add a CHANGELOG.rst to this repo. Changes are happening rapidly and I have no way to know what you've changed without sifting through tons of commits and reading the changes line-by-line.

@greg-db
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback!

Please sign in to comment.