Skip to content

Commit da0ab5a

Browse files
committed
Update public spec.
- Files - Add save_url endpoint for saving online content to your Dropbox. - Shared folders - Add viewer_no_comment to AccessLevel. - Add is_owner to GroupInfo. - Change return type of SharePathError.already_shared from Void to SharedFolderMetadata. - Add leave_a_copy parameter to relinquish_folder_membership endpoint. - Change relinquish_folder_membership to return async job ID when leaving a copy. - Add relinquish_folder_membership_error to JobError. - Business endpoints - Add membership_type to MemberProfile. - Add keep_account parameter to members/remove endpoint. - Add cannot_keep_account_and_transfer and cannot_keep_account_and_delete_data to MembersRemoveError.
1 parent b314dab commit da0ab5a

File tree

11 files changed

+2742
-835
lines changed

11 files changed

+2742
-835
lines changed

dropbox/auth.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class AuthError(bb.Union):
2020
:ivar invalid_access_token: The access token is invalid.
2121
:ivar invalid_select_user: The user specified in 'Dropbox-API-Select-User'
2222
is no longer on the team.
23+
:ivar invalid_select_admin: The user specified in 'Dropbox-API-Select-Admin'
24+
is not a Dropbox Business team admin.
2325
:ivar other: An unspecified error.
2426
"""
2527

@@ -29,6 +31,8 @@ class AuthError(bb.Union):
2931
# Attribute is overwritten below the class definition
3032
invalid_select_user = None
3133
# Attribute is overwritten below the class definition
34+
invalid_select_admin = None
35+
# Attribute is overwritten below the class definition
3236
other = None
3337

3438
def is_invalid_access_token(self):
@@ -47,6 +51,14 @@ def is_invalid_select_user(self):
4751
"""
4852
return self._tag == 'invalid_select_user'
4953

54+
def is_invalid_select_admin(self):
55+
"""
56+
Check if the union tag is ``invalid_select_admin``.
57+
58+
:rtype: bool
59+
"""
60+
return self._tag == 'invalid_select_admin'
61+
5062
def is_other(self):
5163
"""
5264
Check if the union tag is ``other``.
@@ -62,15 +74,18 @@ def __repr__(self):
6274

6375
AuthError._invalid_access_token_validator = bv.Void()
6476
AuthError._invalid_select_user_validator = bv.Void()
77+
AuthError._invalid_select_admin_validator = bv.Void()
6578
AuthError._other_validator = bv.Void()
6679
AuthError._tagmap = {
6780
'invalid_access_token': AuthError._invalid_access_token_validator,
6881
'invalid_select_user': AuthError._invalid_select_user_validator,
82+
'invalid_select_admin': AuthError._invalid_select_admin_validator,
6983
'other': AuthError._other_validator,
7084
}
7185

7286
AuthError.invalid_access_token = AuthError('invalid_access_token')
7387
AuthError.invalid_select_user = AuthError('invalid_select_user')
88+
AuthError.invalid_select_admin = AuthError('invalid_select_admin')
7489
AuthError.other = AuthError('other')
7590

7691
token_revoke = bb.Route(
@@ -79,8 +94,8 @@ def __repr__(self):
7994
bv.Void(),
8095
bv.Void(),
8196
bv.Void(),
82-
{'host': None,
83-
'style': None},
97+
{'host': u'api',
98+
'style': u'rpc'},
8499
)
85100

86101
ROUTES = {

dropbox/base.py

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
properties,
1111
sharing,
1212
team,
13+
team_common,
1314
team_policies,
1415
users,
1516
)
@@ -538,8 +539,8 @@ def files_list_folder_longpoll(self,
538539
timeout=30):
539540
"""
540541
A longpoll endpoint to wait for changes on an account. In conjunction
541-
with :meth:`list_folder`, this call gives you a low-latency way to
542-
monitor an account for file changes. The connection will block until
542+
with :meth:`list_folder_continue`, this call gives you a low-latency way
543+
to monitor an account for file changes. The connection will block until
543544
there are changes available or a timeout occurs. This endpoint is useful
544545
mostly for client-side apps. If you're looking for server-side
545546
notifications, check out our `webhooks documentation
@@ -665,6 +666,54 @@ def files_restore(self,
665666
)
666667
return r
667668

669+
def files_save_url(self,
670+
path,
671+
url):
672+
"""
673+
Save a specified URL into a file in user's Dropbox. If the given path
674+
already exists, the file will be renamed to avoid the conflict (e.g.
675+
myfile (1).txt).
676+
677+
:param str path: The path in Dropbox where the URL will be saved to.
678+
:param str url: The URL to be saved.
679+
:rtype: :class:`dropbox.files.SaveUrlResult`
680+
:raises: :class:`dropbox.exceptions.ApiError`
681+
682+
If this raises, ApiError.reason is of type:
683+
:class:`dropbox.files.SaveUrlError`
684+
"""
685+
arg = files.SaveUrlArg(path,
686+
url)
687+
r = self.request(
688+
files.save_url,
689+
'files',
690+
arg,
691+
None,
692+
)
693+
return r
694+
695+
def files_save_url_check_job_status(self,
696+
async_job_id):
697+
"""
698+
Check the status of a :meth:`save_url` job.
699+
700+
:param str async_job_id: Id of the asynchronous job. This is the value
701+
of a response returned from the method that launched the job.
702+
:rtype: :class:`dropbox.files.SaveUrlJobStatus`
703+
:raises: :class:`dropbox.exceptions.ApiError`
704+
705+
If this raises, ApiError.reason is of type:
706+
:class:`dropbox.files.PollError`
707+
"""
708+
arg = async.PollArg(async_job_id)
709+
r = self.request(
710+
files.save_url_check_job_status,
711+
'files',
712+
arg,
713+
None,
714+
)
715+
return r
716+
668717
def files_search(self,
669718
path,
670719
query,
@@ -1423,28 +1472,34 @@ def sharing_mount_folder(self,
14231472
return r
14241473

14251474
def sharing_relinquish_folder_membership(self,
1426-
shared_folder_id):
1475+
shared_folder_id,
1476+
leave_a_copy=False):
14271477
"""
14281478
The current user relinquishes their membership in the designated shared
14291479
folder and will no longer have access to the folder. A folder owner
1430-
cannot relinquish membership in their own folder. Apps must have full
1431-
Dropbox access to use this endpoint.
1480+
cannot relinquish membership in their own folder. This will run
1481+
synchronously if leave_a_copy is false, and asynchronously if
1482+
leave_a_copy is true. Apps must have full Dropbox access to use this
1483+
endpoint.
14321484
14331485
:param str shared_folder_id: The ID for the shared folder.
1434-
:rtype: None
1486+
:param bool leave_a_copy: Keep a copy of the folder's contents upon
1487+
relinquishing membership.
1488+
:rtype: :class:`dropbox.sharing.LaunchEmptyResult`
14351489
:raises: :class:`dropbox.exceptions.ApiError`
14361490
14371491
If this raises, ApiError.reason is of type:
14381492
:class:`dropbox.sharing.RelinquishFolderMembershipError`
14391493
"""
1440-
arg = sharing.RelinquishFolderMembershipArg(shared_folder_id)
1494+
arg = sharing.RelinquishFolderMembershipArg(shared_folder_id,
1495+
leave_a_copy)
14411496
r = self.request(
14421497
sharing.relinquish_folder_membership,
14431498
'sharing',
14441499
arg,
14451500
None,
14461501
)
1447-
return None
1502+
return r
14481503

14491504
def sharing_remove_folder_member(self,
14501505
shared_folder_id,

0 commit comments

Comments
 (0)