Skip to content

Commit

Permalink
Updated API specification.
Browse files Browse the repository at this point in the history
Auth namespace:
- Added user_suspended to AuthError.

Files namespace:
- Added PathRootError.
- Added invalid_path_root to LookupError.
- Added autorename to CreateFolderArg.
- Added DeleteBatchArg, DeleteBatchResultEntry, DeleteResult,
  DeleteBatchResult, DeleteBatchError and DeleteBatchJobStatus.
- Added delete_batch and delete_batch/check routes.
- Added RelocationPath.
- Added to allow_shared_folder and autorename to RelocationArg.
- Added RelocationBatchArg, RelocationBatchResult, RelocationBatchJobStatus.
  RelocationResult and RelocationBatchError.
- Added copy_batch and copy_batch/check routes.
- Added move_batch and move_batch/check routes.

Sharing namespace:
- Changed PathOrId validation pattern.
- Changed path in ShareFolderArg from type files.Path to files.WritePath.
- Added contains_app_folder, contains_team_folder and invalid_path_root to
  ShareFolderArg.

Stone Cfg namespace:
- Changed validation pattern for owner in Route.

Team namespace:
- Added team_license_limit to MembersRecoverError.
- Removed beta_group attribute from members/recover.
braincore committed Sep 29, 2016
1 parent 350e6e2 commit 56f2f33
Showing 8 changed files with 1,668 additions and 109 deletions.
14 changes: 14 additions & 0 deletions dropbox/auth.py
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ class AuthError(bb.Union):
is no longer on the team.
:ivar invalid_select_admin: The user specified in 'Dropbox-API-Select-Admin'
is not a Dropbox Business team admin.
:ivar user_suspended: The user has been suspended.
"""

_catch_all = 'other'
@@ -32,6 +33,8 @@ class AuthError(bb.Union):
# Attribute is overwritten below the class definition
invalid_select_admin = None
# Attribute is overwritten below the class definition
user_suspended = None
# Attribute is overwritten below the class definition
other = None

def is_invalid_access_token(self):
@@ -58,6 +61,14 @@ def is_invalid_select_admin(self):
"""
return self._tag == 'invalid_select_admin'

def is_user_suspended(self):
"""
Check if the union tag is ``user_suspended``.
:rtype: bool
"""
return self._tag == 'user_suspended'

def is_other(self):
"""
Check if the union tag is ``other``.
@@ -208,17 +219,20 @@ def __repr__(self):
AuthError._invalid_access_token_validator = bv.Void()
AuthError._invalid_select_user_validator = bv.Void()
AuthError._invalid_select_admin_validator = bv.Void()
AuthError._user_suspended_validator = bv.Void()
AuthError._other_validator = bv.Void()
AuthError._tagmap = {
'invalid_access_token': AuthError._invalid_access_token_validator,
'invalid_select_user': AuthError._invalid_select_user_validator,
'invalid_select_admin': AuthError._invalid_select_admin_validator,
'user_suspended': AuthError._user_suspended_validator,
'other': AuthError._other_validator,
}

AuthError.invalid_access_token = AuthError('invalid_access_token')
AuthError.invalid_select_user = AuthError('invalid_select_user')
AuthError.invalid_select_admin = AuthError('invalid_select_admin')
AuthError.user_suspended = AuthError('user_suspended')
AuthError.other = AuthError('other')

RateLimitError._reason_validator = RateLimitReason_validator
296 changes: 248 additions & 48 deletions dropbox/base.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dropbox/dropbox.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
'create_session',
]

__version__ = '6.8.0'
__version__ = '6.9.0'

import contextlib
import json
1,205 changes: 1,163 additions & 42 deletions dropbox/files.py

Large diffs are not rendered by default.

190 changes: 180 additions & 10 deletions dropbox/sharing.py

Large diffs are not rendered by default.

27 changes: 22 additions & 5 deletions dropbox/team.py
Original file line number Diff line number Diff line change
@@ -6659,15 +6659,15 @@ class MemberAddResult(bb.Union):
:ivar str free_team_member_limit_reached: Team is already full. The free
team member limit has been reached.
:ivar str user_already_on_team: User is already on this team. The provided
email address is associated with a user who is already a member of or
invited to the team.
email address is associated with a user who is already a member of
(including in recoverable state) or invited to the team.
:ivar str user_on_another_team: User is already on another team. The
provided email address is associated with a user that is already a
member or invited to another team.
:ivar str user_already_paired: User is already paired.
:ivar str user_migration_failed: User migration has failed.
:ivar str duplicate_external_member_id: A user with the given external
member ID already exists on the team.
member ID already exists on the team (including in recoverable state).
:ivar str user_creation_failed: User creation has failed.
"""

@@ -6883,7 +6883,8 @@ def get_free_team_member_limit_reached(self):
def get_user_already_on_team(self):
"""
User is already on this team. The provided email address is associated
with a user who is already a member of or invited to the team.
with a user who is already a member of (including in recoverable state)
or invited to the team.
Only call this if :meth:`is_user_already_on_team` is true.
@@ -6933,7 +6934,8 @@ def get_user_migration_failed(self):

def get_duplicate_external_member_id(self):
"""
A user with the given external member ID already exists on the team.
A user with the given external member ID already exists on the team
(including in recoverable state).
Only call this if :meth:`is_duplicate_external_member_id` is true.
@@ -8407,6 +8409,8 @@ class MembersRecoverError(UserSelectorError):
:ivar user_unrecoverable: The user is not recoverable.
:ivar user_not_in_team: The user is not a member of the team.
:ivar team_license_limit: Team is full. The organization has no available
licenses.
"""

_catch_all = 'other'
@@ -8415,6 +8419,8 @@ class MembersRecoverError(UserSelectorError):
# Attribute is overwritten below the class definition
user_not_in_team = None
# Attribute is overwritten below the class definition
team_license_limit = None
# Attribute is overwritten below the class definition
other = None

def is_user_unrecoverable(self):
@@ -8433,6 +8439,14 @@ def is_user_not_in_team(self):
"""
return self._tag == 'user_not_in_team'

def is_team_license_limit(self):
"""
Check if the union tag is ``team_license_limit``.
:rtype: bool
"""
return self._tag == 'team_license_limit'

def is_other(self):
"""
Check if the union tag is ``other``.
@@ -12573,16 +12587,19 @@ def __repr__(self):

MembersRecoverError._user_unrecoverable_validator = bv.Void()
MembersRecoverError._user_not_in_team_validator = bv.Void()
MembersRecoverError._team_license_limit_validator = bv.Void()
MembersRecoverError._other_validator = bv.Void()
MembersRecoverError._tagmap = {
'user_unrecoverable': MembersRecoverError._user_unrecoverable_validator,
'user_not_in_team': MembersRecoverError._user_not_in_team_validator,
'team_license_limit': MembersRecoverError._team_license_limit_validator,
'other': MembersRecoverError._other_validator,
}
MembersRecoverError._tagmap.update(UserSelectorError._tagmap)

MembersRecoverError.user_unrecoverable = MembersRecoverError('user_unrecoverable')
MembersRecoverError.user_not_in_team = MembersRecoverError('user_not_in_team')
MembersRecoverError.team_license_limit = MembersRecoverError('team_license_limit')
MembersRecoverError.other = MembersRecoverError('other')

MembersRemoveArg._transfer_dest_id_validator = bv.Nullable(UserSelectorArg_validator)
41 changes: 39 additions & 2 deletions dropbox/users.py
Original file line number Diff line number Diff line change
@@ -1077,6 +1077,8 @@ class Name(object):
of a person's ``given_name`` and ``surname``.
:ivar display_name: A name that can be used directly to represent the name
of a user's Dropbox account.
:ivar abbreviated_name: An abbreviated form of the person's name. Their
initials in most locales.
"""

__slots__ = [
@@ -1088,6 +1090,8 @@ class Name(object):
'_familiar_name_present',
'_display_name_value',
'_display_name_present',
'_abbreviated_name_value',
'_abbreviated_name_present',
]

_has_required_fields = True
@@ -1096,7 +1100,8 @@ def __init__(self,
given_name=None,
surname=None,
familiar_name=None,
display_name=None):
display_name=None,
abbreviated_name=None):
self._given_name_value = None
self._given_name_present = False
self._surname_value = None
@@ -1105,6 +1110,8 @@ def __init__(self,
self._familiar_name_present = False
self._display_name_value = None
self._display_name_present = False
self._abbreviated_name_value = None
self._abbreviated_name_present = False
if given_name is not None:
self.given_name = given_name
if surname is not None:
@@ -1113,6 +1120,8 @@ def __init__(self,
self.familiar_name = familiar_name
if display_name is not None:
self.display_name = display_name
if abbreviated_name is not None:
self.abbreviated_name = abbreviated_name

@property
def given_name(self):
@@ -1209,12 +1218,37 @@ def display_name(self):
self._display_name_value = None
self._display_name_present = False

@property
def abbreviated_name(self):
"""
An abbreviated form of the person's name. Their initials in most
locales.
:rtype: str
"""
if self._abbreviated_name_present:
return self._abbreviated_name_value
else:
raise AttributeError("missing required field 'abbreviated_name'")

@abbreviated_name.setter
def abbreviated_name(self, val):
val = self._abbreviated_name_validator.validate(val)
self._abbreviated_name_value = val
self._abbreviated_name_present = True

@abbreviated_name.deleter
def abbreviated_name(self):
self._abbreviated_name_value = None
self._abbreviated_name_present = False

def __repr__(self):
return 'Name(given_name={!r}, surname={!r}, familiar_name={!r}, display_name={!r})'.format(
return 'Name(given_name={!r}, surname={!r}, familiar_name={!r}, display_name={!r}, abbreviated_name={!r})'.format(
self._given_name_value,
self._surname_value,
self._familiar_name_value,
self._display_name_value,
self._abbreviated_name_value,
)

Name_validator = bv.Struct(Name)
@@ -1601,17 +1635,20 @@ def __repr__(self):
Name._surname_validator = bv.String()
Name._familiar_name_validator = bv.String()
Name._display_name_validator = bv.String()
Name._abbreviated_name_validator = bv.String()
Name._all_field_names_ = set([
'given_name',
'surname',
'familiar_name',
'display_name',
'abbreviated_name',
])
Name._all_fields_ = [
('given_name', Name._given_name_validator),
('surname', Name._surname_validator),
('familiar_name', Name._familiar_name_validator),
('display_name', Name._display_name_validator),
('abbreviated_name', Name._abbreviated_name_validator),
]

SpaceAllocation._individual_validator = IndividualSpaceAllocation_validator
2 changes: 1 addition & 1 deletion spec

0 comments on commit 56f2f33

Please sign in to comment.