diff --git a/dropbox/auth.py b/dropbox/auth.py index d2c99305..976eede3 100644 --- a/dropbox/auth.py +++ b/dropbox/auth.py @@ -20,6 +20,8 @@ class AuthError(bb.Union): :ivar invalid_access_token: The access token is invalid. :ivar invalid_select_user: The user specified in 'Dropbox-API-Select-User' 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 other: An unspecified error. """ @@ -29,6 +31,8 @@ class AuthError(bb.Union): # Attribute is overwritten below the class definition invalid_select_user = None # Attribute is overwritten below the class definition + invalid_select_admin = None + # Attribute is overwritten below the class definition other = None def is_invalid_access_token(self): @@ -47,6 +51,14 @@ def is_invalid_select_user(self): """ return self._tag == 'invalid_select_user' + def is_invalid_select_admin(self): + """ + Check if the union tag is ``invalid_select_admin``. + + :rtype: bool + """ + return self._tag == 'invalid_select_admin' + def is_other(self): """ Check if the union tag is ``other``. @@ -62,15 +74,18 @@ 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._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, '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.other = AuthError('other') token_revoke = bb.Route( @@ -79,8 +94,8 @@ def __repr__(self): bv.Void(), bv.Void(), bv.Void(), - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) ROUTES = { diff --git a/dropbox/base.py b/dropbox/base.py index a6650985..a3e89a39 100644 --- a/dropbox/base.py +++ b/dropbox/base.py @@ -10,6 +10,7 @@ properties, sharing, team, + team_common, team_policies, users, ) @@ -538,8 +539,8 @@ def files_list_folder_longpoll(self, timeout=30): """ A longpoll endpoint to wait for changes on an account. In conjunction - with :meth:`list_folder`, this call gives you a low-latency way to - monitor an account for file changes. The connection will block until + with :meth:`list_folder_continue`, this call gives you a low-latency way + to monitor an account for file changes. The connection will block until there are changes available or a timeout occurs. This endpoint is useful mostly for client-side apps. If you're looking for server-side notifications, check out our `webhooks documentation @@ -665,6 +666,54 @@ def files_restore(self, ) return r + def files_save_url(self, + path, + url): + """ + Save a specified URL into a file in user's Dropbox. If the given path + already exists, the file will be renamed to avoid the conflict (e.g. + myfile (1).txt). + + :param str path: The path in Dropbox where the URL will be saved to. + :param str url: The URL to be saved. + :rtype: :class:`dropbox.files.SaveUrlResult` + :raises: :class:`dropbox.exceptions.ApiError` + + If this raises, ApiError.reason is of type: + :class:`dropbox.files.SaveUrlError` + """ + arg = files.SaveUrlArg(path, + url) + r = self.request( + files.save_url, + 'files', + arg, + None, + ) + return r + + def files_save_url_check_job_status(self, + async_job_id): + """ + Check the status of a :meth:`save_url` job. + + :param str async_job_id: Id of the asynchronous job. This is the value + of a response returned from the method that launched the job. + :rtype: :class:`dropbox.files.SaveUrlJobStatus` + :raises: :class:`dropbox.exceptions.ApiError` + + If this raises, ApiError.reason is of type: + :class:`dropbox.files.PollError` + """ + arg = async.PollArg(async_job_id) + r = self.request( + files.save_url_check_job_status, + 'files', + arg, + None, + ) + return r + def files_search(self, path, query, @@ -1423,28 +1472,34 @@ def sharing_mount_folder(self, return r def sharing_relinquish_folder_membership(self, - shared_folder_id): + shared_folder_id, + leave_a_copy=False): """ The current user relinquishes their membership in the designated shared folder and will no longer have access to the folder. A folder owner - cannot relinquish membership in their own folder. Apps must have full - Dropbox access to use this endpoint. + cannot relinquish membership in their own folder. This will run + synchronously if leave_a_copy is false, and asynchronously if + leave_a_copy is true. Apps must have full Dropbox access to use this + endpoint. :param str shared_folder_id: The ID for the shared folder. - :rtype: None + :param bool leave_a_copy: Keep a copy of the folder's contents upon + relinquishing membership. + :rtype: :class:`dropbox.sharing.LaunchEmptyResult` :raises: :class:`dropbox.exceptions.ApiError` If this raises, ApiError.reason is of type: :class:`dropbox.sharing.RelinquishFolderMembershipError` """ - arg = sharing.RelinquishFolderMembershipArg(shared_folder_id) + arg = sharing.RelinquishFolderMembershipArg(shared_folder_id, + leave_a_copy) r = self.request( sharing.relinquish_folder_membership, 'sharing', arg, None, ) - return None + return r def sharing_remove_folder_member(self, shared_folder_id, diff --git a/dropbox/base_team.py b/dropbox/base_team.py index 2dc27433..fc9ee6f3 100644 --- a/dropbox/base_team.py +++ b/dropbox/base_team.py @@ -10,6 +10,7 @@ properties, sharing, team, + team_common, team_policies, users, ) @@ -25,6 +26,128 @@ def request(self, route, namespace, arg, arg_binary=None): # ------------------------------------------ # Routes in team namespace + def team_alpha_groups_create(self, + group_name, + group_external_id=None, + group_management_type=team_common.GroupManagementType.company_managed): + """ + Creates a new, empty group, with a requested name. Permission : Team + member management + + :param group_management_type: Whether the team can be managed by + selected users, or only by team admins + :type group_management_type: :class:`dropbox.team.GroupManagementType` + :rtype: :class:`dropbox.team.AlphaGroupFullInfo` + :raises: :class:`dropbox.exceptions.ApiError` + + If this raises, ApiError.reason is of type: + :class:`dropbox.team.GroupCreateError` + """ + arg = team.AlphaGroupCreateArg(group_name, + group_external_id, + group_management_type) + r = self.request( + team.alpha_groups_create, + 'team', + arg, + None, + ) + return r + + def team_alpha_groups_get_info(self, + arg): + """ + Retrieves information about one or more groups. Permission : Team + Information + + :param arg: Argument for selecting a list of groups, either by + group_ids, or external group IDs. + :type arg: :class:`dropbox.team.GroupsSelector` + :rtype: list + :raises: :class:`dropbox.exceptions.ApiError` + + If this raises, ApiError.reason is of type: + :class:`dropbox.team.GroupsGetInfoError` + """ + r = self.request( + team.alpha_groups_get_info, + 'team', + arg, + None, + ) + return r + + def team_alpha_groups_list(self, + limit=1000): + """ + Lists groups on a team. Permission : Team Information + + :param long limit: Number of results to return per call. + :rtype: :class:`dropbox.team.AlphaGroupsListResult` + """ + arg = team.GroupsListArg(limit) + r = self.request( + team.alpha_groups_list, + 'team', + arg, + None, + ) + return r + + def team_alpha_groups_list_continue(self, + cursor): + """ + Once a cursor has been retrieved from :meth:`alpha_groups_list`, use + this to paginate through all groups. Permission : Team information + + :param str cursor: Indicates from what point to get the next set of + groups. + :rtype: :class:`dropbox.team.AlphaGroupsListResult` + :raises: :class:`dropbox.exceptions.ApiError` + + If this raises, ApiError.reason is of type: + :class:`dropbox.team.GroupsListContinueError` + """ + arg = team.GroupsListContinueArg(cursor) + r = self.request( + team.alpha_groups_list_continue, + 'team', + arg, + None, + ) + return r + + def team_alpha_groups_update(self, + group, + return_members=True, + new_group_name=None, + new_group_external_id=None, + new_group_management_type=None): + """ + Updates a group's name, external ID or management type. Permission : + Team member management + + :param Nullable new_group_management_type: Set new group management + type, if provided. + :rtype: :class:`dropbox.team.AlphaGroupFullInfo` + :raises: :class:`dropbox.exceptions.ApiError` + + If this raises, ApiError.reason is of type: + :class:`dropbox.team.GroupUpdateError` + """ + arg = team.AlphaGroupUpdateArgs(group, + return_members, + new_group_name, + new_group_external_id, + new_group_management_type) + r = self.request( + team.alpha_groups_update, + 'team', + arg, + None, + ) + return r + def team_devices_list_member_devices(self, team_member_id, include_web_sessions=True, @@ -200,8 +323,8 @@ def team_groups_create(self, member management :param str group_name: Group name. - :param Nullable group_external_id: Optional argument. The creator of a - team can associate an arbitrary external ID to the group. + :param Nullable group_external_id: The creator of a team can associate + an arbitrary external ID to the group. :rtype: :class:`dropbox.team.GroupFullInfo` :raises: :class:`dropbox.exceptions.ApiError` @@ -361,6 +484,55 @@ def team_groups_members_add(self, ) return r + def team_groups_members_list(self, + group, + limit=1000): + """ + Lists members of a group. Permission : Team Information + + :param group: The group whose members are to be listed. + :type group: :class:`dropbox.team.GroupSelector` + :param long limit: Number of results to return per call. + :rtype: :class:`dropbox.team.GroupsMembersListResult` + :raises: :class:`dropbox.exceptions.ApiError` + + If this raises, ApiError.reason is of type: + :class:`dropbox.team.GroupSelectorError` + """ + arg = team.GroupsMembersListArg(group, + limit) + r = self.request( + team.groups_members_list, + 'team', + arg, + None, + ) + return r + + def team_groups_members_list_continue(self, + cursor): + """ + Once a cursor has been retrieved from :meth:`groups_members_list`, use + this to paginate through all members of the group. Permission : Team + information + + :param str cursor: Indicates from what point to get the next set of + groups. + :rtype: :class:`dropbox.team.GroupsMembersListResult` + :raises: :class:`dropbox.exceptions.ApiError` + + If this raises, ApiError.reason is of type: + :class:`dropbox.team.GroupsMembersListContinueError` + """ + arg = team.GroupsMembersListContinueArg(cursor) + r = self.request( + team.groups_members_list_continue, + 'team', + arg, + None, + ) + return r + def team_groups_members_remove(self, group, users, @@ -713,7 +885,8 @@ def team_members_remove(self, user, wipe_data=True, transfer_dest_id=None, - transfer_admin_id=None): + transfer_admin_id=None, + keep_account=False): """ Removes a member from a team. Permission : Team member management Exactly one of team_member_id, email, or external_id must be provided to @@ -731,6 +904,10 @@ def team_members_remove(self, transfer process will be sent via email to this user. If the transfer_dest_id argument was provided, then this argument must be provided as well. + :param bool keep_account: Downgrade the member to a Basic account. The + user will retain the email address associated with their Dropbox + account and data in their account that is not restricted to team + members. :rtype: :class:`dropbox.team.LaunchEmptyResult` :raises: :class:`dropbox.exceptions.ApiError` @@ -740,7 +917,8 @@ def team_members_remove(self, arg = team.MembersRemoveArg(user, wipe_data, transfer_dest_id, - transfer_admin_id) + transfer_admin_id, + keep_account) r = self.request( team.members_remove, 'team', diff --git a/dropbox/dropbox.py b/dropbox/dropbox.py index e49a2e50..d961616b 100644 --- a/dropbox/dropbox.py +++ b/dropbox/dropbox.py @@ -4,7 +4,7 @@ 'create_session', ] -__version__ = '6.3.0' +__version__ = '6.4.0' import contextlib import json diff --git a/dropbox/files.py b/dropbox/files.py index f6eff949..ea48a98b 100644 --- a/dropbox/files.py +++ b/dropbox/files.py @@ -15,11 +15,13 @@ try: from . import ( + async, common, properties, users, ) except (SystemError, ValueError): + import async import common import properties import users @@ -2845,7 +2847,7 @@ def __repr__(self): class ListFolderLongpollResult(object): """ :ivar changes: Indicates whether new changes are available. If true, call - list_folder to retrieve the changes. + list_folder/continue to retrieve the changes. :ivar backoff: If present, backoff for at least this many seconds before calling list_folder/longpoll again. """ @@ -2874,8 +2876,8 @@ def __init__(self, @property def changes(self): """ - Indicates whether new changes are available. If true, call list_folder - to retrieve the changes. + Indicates whether new changes are available. If true, call + list_folder/continue to retrieve the changes. :rtype: bool """ @@ -4398,6 +4400,293 @@ def __repr__(self): SaveCopyReferenceResult_validator = bv.Struct(SaveCopyReferenceResult) +class SaveUrlArg(object): + """ + :ivar path: The path in Dropbox where the URL will be saved to. + :ivar url: The URL to be saved. + """ + + __slots__ = [ + '_path_value', + '_path_present', + '_url_value', + '_url_present', + ] + + _has_required_fields = True + + def __init__(self, + path=None, + url=None): + self._path_value = None + self._path_present = False + self._url_value = None + self._url_present = False + if path is not None: + self.path = path + if url is not None: + self.url = url + + @property + def path(self): + """ + The path in Dropbox where the URL will be saved to. + + :rtype: str + """ + if self._path_present: + return self._path_value + else: + raise AttributeError("missing required field 'path'") + + @path.setter + def path(self, val): + val = self._path_validator.validate(val) + self._path_value = val + self._path_present = True + + @path.deleter + def path(self): + self._path_value = None + self._path_present = False + + @property + def url(self): + """ + The URL to be saved. + + :rtype: str + """ + if self._url_present: + return self._url_value + else: + raise AttributeError("missing required field 'url'") + + @url.setter + def url(self, val): + val = self._url_validator.validate(val) + self._url_value = val + self._url_present = True + + @url.deleter + def url(self): + self._url_value = None + self._url_present = False + + def __repr__(self): + return 'SaveUrlArg(path={!r}, url={!r})'.format( + self._path_value, + self._url_value, + ) + +SaveUrlArg_validator = bv.Struct(SaveUrlArg) + +class SaveUrlError(bb.Union): + """ + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + + :ivar download_failed: Failed downloading the given URL. + :ivar invalid_url: The given URL is invalid. + :ivar not_found: The file where the URL is saved to no longer exists. + """ + + _catch_all = 'other' + # Attribute is overwritten below the class definition + download_failed = None + # Attribute is overwritten below the class definition + invalid_url = None + # Attribute is overwritten below the class definition + not_found = None + # Attribute is overwritten below the class definition + other = None + + @classmethod + def path(cls, val): + """ + Create an instance of this class set to the ``path`` tag with value + ``val``. + + :param WriteError val: + :rtype: SaveUrlError + """ + return cls('path', val) + + def is_path(self): + """ + Check if the union tag is ``path``. + + :rtype: bool + """ + return self._tag == 'path' + + def is_download_failed(self): + """ + Check if the union tag is ``download_failed``. + + :rtype: bool + """ + return self._tag == 'download_failed' + + def is_invalid_url(self): + """ + Check if the union tag is ``invalid_url``. + + :rtype: bool + """ + return self._tag == 'invalid_url' + + def is_not_found(self): + """ + Check if the union tag is ``not_found``. + + :rtype: bool + """ + return self._tag == 'not_found' + + def is_other(self): + """ + Check if the union tag is ``other``. + + :rtype: bool + """ + return self._tag == 'other' + + def get_path(self): + """ + Only call this if :meth:`is_path` is true. + + :rtype: WriteError + """ + if not self.is_path(): + raise AttributeError("tag 'path' not set") + return self._value + + def __repr__(self): + return 'SaveUrlError(%r, %r)' % (self._tag, self._value) + +SaveUrlError_validator = bv.Union(SaveUrlError) + +class SaveUrlJobStatus(async.PollResultBase): + """ + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + + :ivar FileMetadata complete: Metadata of the file where the URL is saved to. + """ + + @classmethod + def complete(cls, val): + """ + Create an instance of this class set to the ``complete`` tag with value + ``val``. + + :param FileMetadata val: + :rtype: SaveUrlJobStatus + """ + return cls('complete', val) + + @classmethod + def failed(cls, val): + """ + Create an instance of this class set to the ``failed`` tag with value + ``val``. + + :param SaveUrlError val: + :rtype: SaveUrlJobStatus + """ + return cls('failed', val) + + def is_complete(self): + """ + Check if the union tag is ``complete``. + + :rtype: bool + """ + return self._tag == 'complete' + + def is_failed(self): + """ + Check if the union tag is ``failed``. + + :rtype: bool + """ + return self._tag == 'failed' + + def get_complete(self): + """ + Metadata of the file where the URL is saved to. + + Only call this if :meth:`is_complete` is true. + + :rtype: FileMetadata + """ + if not self.is_complete(): + raise AttributeError("tag 'complete' not set") + return self._value + + def get_failed(self): + """ + Only call this if :meth:`is_failed` is true. + + :rtype: SaveUrlError + """ + if not self.is_failed(): + raise AttributeError("tag 'failed' not set") + return self._value + + def __repr__(self): + return 'SaveUrlJobStatus(%r, %r)' % (self._tag, self._value) + +SaveUrlJobStatus_validator = bv.Union(SaveUrlJobStatus) + +class SaveUrlResult(async.LaunchResultBase): + """ + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + + :ivar FileMetadata complete: Metadata of the file where the URL is saved to. + """ + + @classmethod + def complete(cls, val): + """ + Create an instance of this class set to the ``complete`` tag with value + ``val``. + + :param FileMetadata val: + :rtype: SaveUrlResult + """ + return cls('complete', val) + + def is_complete(self): + """ + Check if the union tag is ``complete``. + + :rtype: bool + """ + return self._tag == 'complete' + + def get_complete(self): + """ + Metadata of the file where the URL is saved to. + + Only call this if :meth:`is_complete` is true. + + :rtype: FileMetadata + """ + if not self.is_complete(): + raise AttributeError("tag 'complete' not set") + return self._value + + def __repr__(self): + return 'SaveUrlResult(%r, %r)' % (self._tag, self._value) + +SaveUrlResult_validator = bv.Union(SaveUrlResult) + class SearchArg(object): """ :ivar path: The path in the user's Dropbox to search. Should probably be a @@ -6322,10 +6611,10 @@ def __repr__(self): Id_validator = bv.String(min_length=1) ListFolderCursor_validator = bv.String(min_length=1) MalformedPathError_validator = bv.Nullable(bv.String()) -Path_validator = bv.String(pattern=u'/.*') -PathOrId_validator = bv.String(pattern=u'(/|id:).*') -PathR_validator = bv.String(pattern=u'(/.*)?') -ReadPath_validator = bv.String(pattern=u'((/|id:).*)|(rev:[0-9a-f]{9,})') +Path_validator = bv.String(pattern=u'/(.|[\\r\\n])*') +PathOrId_validator = bv.String(pattern=u'/(.|[\\r\\n])*|id:.*') +PathR_validator = bv.String(pattern=u'(/(.|[\\r\\n])*)?') +ReadPath_validator = bv.String(pattern=u'(/(.|[\\r\\n])*|id:.*)|(rev:[0-9a-f]{9,})') Rev_validator = bv.String(min_length=9, pattern=u'[0-9a-f]+') CommitInfo._path_validator = Path_validator CommitInfo._mode_validator = WriteMode_validator @@ -6911,6 +7200,49 @@ def __repr__(self): SaveCopyReferenceResult._all_field_names_ = set(['metadata']) SaveCopyReferenceResult._all_fields_ = [('metadata', SaveCopyReferenceResult._metadata_validator)] +SaveUrlArg._path_validator = Path_validator +SaveUrlArg._url_validator = bv.String() +SaveUrlArg._all_field_names_ = set([ + 'path', + 'url', +]) +SaveUrlArg._all_fields_ = [ + ('path', SaveUrlArg._path_validator), + ('url', SaveUrlArg._url_validator), +] + +SaveUrlError._path_validator = WriteError_validator +SaveUrlError._download_failed_validator = bv.Void() +SaveUrlError._invalid_url_validator = bv.Void() +SaveUrlError._not_found_validator = bv.Void() +SaveUrlError._other_validator = bv.Void() +SaveUrlError._tagmap = { + 'path': SaveUrlError._path_validator, + 'download_failed': SaveUrlError._download_failed_validator, + 'invalid_url': SaveUrlError._invalid_url_validator, + 'not_found': SaveUrlError._not_found_validator, + 'other': SaveUrlError._other_validator, +} + +SaveUrlError.download_failed = SaveUrlError('download_failed') +SaveUrlError.invalid_url = SaveUrlError('invalid_url') +SaveUrlError.not_found = SaveUrlError('not_found') +SaveUrlError.other = SaveUrlError('other') + +SaveUrlJobStatus._complete_validator = FileMetadata_validator +SaveUrlJobStatus._failed_validator = SaveUrlError_validator +SaveUrlJobStatus._tagmap = { + 'complete': SaveUrlJobStatus._complete_validator, + 'failed': SaveUrlJobStatus._failed_validator, +} +SaveUrlJobStatus._tagmap.update(async.PollResultBase._tagmap) + +SaveUrlResult._complete_validator = FileMetadata_validator +SaveUrlResult._tagmap = { + 'complete': SaveUrlResult._complete_validator, +} +SaveUrlResult._tagmap.update(async.LaunchResultBase._tagmap) + SearchArg._path_validator = PathR_validator SearchArg._query_validator = bv.String() SearchArg._start_validator = bv.UInt64() @@ -7206,8 +7538,8 @@ def __repr__(self): RelocationArg_validator, Metadata_validator, RelocationError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) copy_reference_get = bb.Route( 'copy_reference/get', @@ -7215,8 +7547,8 @@ def __repr__(self): GetCopyReferenceArg_validator, GetCopyReferenceResult_validator, GetCopyReferenceError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) copy_reference_save = bb.Route( 'copy_reference/save', @@ -7224,8 +7556,8 @@ def __repr__(self): SaveCopyReferenceArg_validator, SaveCopyReferenceResult_validator, SaveCopyReferenceError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) create_folder = bb.Route( 'create_folder', @@ -7233,8 +7565,8 @@ def __repr__(self): CreateFolderArg_validator, FolderMetadata_validator, CreateFolderError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) delete = bb.Route( 'delete', @@ -7242,8 +7574,8 @@ def __repr__(self): DeleteArg_validator, Metadata_validator, DeleteError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) download = bb.Route( 'download', @@ -7260,8 +7592,8 @@ def __repr__(self): GetMetadataArg_validator, Metadata_validator, GetMetadataError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) get_preview = bb.Route( 'get_preview', @@ -7278,8 +7610,8 @@ def __repr__(self): GetTemporaryLinkArg_validator, GetTemporaryLinkResult_validator, GetTemporaryLinkError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) get_thumbnail = bb.Route( 'get_thumbnail', @@ -7296,8 +7628,8 @@ def __repr__(self): ListFolderArg_validator, ListFolderResult_validator, ListFolderError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_folder_continue = bb.Route( 'list_folder/continue', @@ -7305,8 +7637,8 @@ def __repr__(self): ListFolderContinueArg_validator, ListFolderResult_validator, ListFolderContinueError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_folder_get_latest_cursor = bb.Route( 'list_folder/get_latest_cursor', @@ -7314,8 +7646,8 @@ def __repr__(self): ListFolderArg_validator, ListFolderGetLatestCursorResult_validator, ListFolderError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_folder_longpoll = bb.Route( 'list_folder/longpoll', @@ -7324,7 +7656,7 @@ def __repr__(self): ListFolderLongpollResult_validator, ListFolderLongpollError_validator, {'host': u'notify', - 'style': None}, + 'style': u'rpc'}, ) list_revisions = bb.Route( 'list_revisions', @@ -7332,8 +7664,8 @@ def __repr__(self): ListRevisionsArg_validator, ListRevisionsResult_validator, ListRevisionsError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) move = bb.Route( 'move', @@ -7341,8 +7673,8 @@ def __repr__(self): RelocationArg_validator, Metadata_validator, RelocationError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) permanently_delete = bb.Route( 'permanently_delete', @@ -7350,8 +7682,8 @@ def __repr__(self): DeleteArg_validator, bv.Void(), DeleteError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) restore = bb.Route( 'restore', @@ -7359,8 +7691,26 @@ def __repr__(self): RestoreArg_validator, FileMetadata_validator, RestoreError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, +) +save_url = bb.Route( + 'save_url', + False, + SaveUrlArg_validator, + SaveUrlResult_validator, + SaveUrlError_validator, + {'host': u'api', + 'style': u'rpc'}, +) +save_url_check_job_status = bb.Route( + 'save_url/check_job_status', + False, + async.PollArg_validator, + SaveUrlJobStatus_validator, + async.PollError_validator, + {'host': u'api', + 'style': u'rpc'}, ) search = bb.Route( 'search', @@ -7368,8 +7718,8 @@ def __repr__(self): SearchArg_validator, SearchResult_validator, SearchError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) upload = bb.Route( 'upload', @@ -7436,6 +7786,8 @@ def __repr__(self): 'move': move, 'permanently_delete': permanently_delete, 'restore': restore, + 'save_url': save_url, + 'save_url/check_job_status': save_url_check_job_status, 'search': search, 'upload': upload, 'upload_session/append': upload_session_append, diff --git a/dropbox/sharing.py b/dropbox/sharing.py index b6cc76a7..4474430f 100644 --- a/dropbox/sharing.py +++ b/dropbox/sharing.py @@ -18,14 +18,14 @@ async, common, files, - team, + team_common, users, ) except (SystemError, ValueError): import async import common import files - import team + import team_common import users class AccessLevel(bb.Union): @@ -41,6 +41,8 @@ class AccessLevel(bb.Union): using update_folder_policy. :ivar editor: The collaborator can both view and edit the shared folder. :ivar viewer: The collaborator can only view the shared folder. + :ivar viewer_no_comment: The collaborator can only view the shared folder + and does not have any access to comments. """ _catch_all = 'other' @@ -51,6 +53,8 @@ class AccessLevel(bb.Union): # Attribute is overwritten below the class definition viewer = None # Attribute is overwritten below the class definition + viewer_no_comment = None + # Attribute is overwritten below the class definition other = None def is_owner(self): @@ -77,6 +81,14 @@ def is_viewer(self): """ return self._tag == 'viewer' + def is_viewer_no_comment(self): + """ + Check if the union tag is ``viewer_no_comment``. + + :rtype: bool + """ + return self._tag == 'viewer_no_comment' + def is_other(self): """ Check if the union tag is ``other``. @@ -2638,18 +2650,21 @@ def __repr__(self): GetSharedLinksResult_validator = bv.Struct(GetSharedLinksResult) -class GroupInfo(team.GroupSummary): +class GroupInfo(team_common.GroupSummary): """ The information about a group. Groups is a way to manage a list of users who need same access permission to the shared folder. :ivar group_type: The type of group. + :ivar is_owner: If the current user is an owner of the group. :ivar same_team: If the group is owned by the current user's team. """ __slots__ = [ '_group_type_value', '_group_type_present', + '_is_owner_value', + '_is_owner_present', '_same_team_value', '_same_team_present', ] @@ -2660,6 +2675,7 @@ def __init__(self, group_name=None, group_id=None, group_type=None, + is_owner=None, same_team=None, group_external_id=None, member_count=None): @@ -2669,10 +2685,14 @@ def __init__(self, member_count) self._group_type_value = None self._group_type_present = False + self._is_owner_value = None + self._is_owner_present = False self._same_team_value = None self._same_team_present = False if group_type is not None: self.group_type = group_type + if is_owner is not None: + self.is_owner = is_owner if same_team is not None: self.same_team = same_team @@ -2681,7 +2701,7 @@ def group_type(self): """ The type of group. - :rtype: team.GroupType_validator + :rtype: team_common.GroupType_validator """ if self._group_type_present: return self._group_type_value @@ -2699,6 +2719,29 @@ def group_type(self): self._group_type_value = None self._group_type_present = False + @property + def is_owner(self): + """ + If the current user is an owner of the group. + + :rtype: bool + """ + if self._is_owner_present: + return self._is_owner_value + else: + raise AttributeError("missing required field 'is_owner'") + + @is_owner.setter + def is_owner(self, val): + val = self._is_owner_validator.validate(val) + self._is_owner_value = val + self._is_owner_present = True + + @is_owner.deleter + def is_owner(self): + self._is_owner_value = None + self._is_owner_present = False + @property def same_team(self): """ @@ -2723,10 +2766,11 @@ def same_team(self): self._same_team_present = False def __repr__(self): - return 'GroupInfo(group_name={!r}, group_id={!r}, group_type={!r}, same_team={!r}, group_external_id={!r}, member_count={!r})'.format( + return 'GroupInfo(group_name={!r}, group_id={!r}, group_type={!r}, is_owner={!r}, same_team={!r}, group_external_id={!r}, member_count={!r})'.format( self._group_name_value, self._group_id_value, self._group_type_value, + self._is_owner_value, self._same_team_value, self._group_external_id_value, self._member_count_value, @@ -3124,6 +3168,8 @@ class JobError(bb.Union): performing unshare_folder action. :ivar RemoveFolderMemberError remove_folder_member_error: Error occurred while performing remove_folder_member action. + :ivar RelinquishFolderMembershipError relinquish_folder_membership_error: + Error occurred while performing relinquish_folder_membership action. """ _catch_all = 'other' @@ -3152,6 +3198,17 @@ def remove_folder_member_error(cls, val): """ return cls('remove_folder_member_error', val) + @classmethod + def relinquish_folder_membership_error(cls, val): + """ + Create an instance of this class set to the + ``relinquish_folder_membership_error`` tag with value ``val``. + + :param RelinquishFolderMembershipError val: + :rtype: JobError + """ + return cls('relinquish_folder_membership_error', val) + def is_unshare_folder_error(self): """ Check if the union tag is ``unshare_folder_error``. @@ -3168,6 +3225,14 @@ def is_remove_folder_member_error(self): """ return self._tag == 'remove_folder_member_error' + def is_relinquish_folder_membership_error(self): + """ + Check if the union tag is ``relinquish_folder_membership_error``. + + :rtype: bool + """ + return self._tag == 'relinquish_folder_membership_error' + def is_other(self): """ Check if the union tag is ``other``. @@ -3200,6 +3265,18 @@ def get_remove_folder_member_error(self): raise AttributeError("tag 'remove_folder_member_error' not set") return self._value + def get_relinquish_folder_membership_error(self): + """ + Error occurred while performing relinquish_folder_membership action. + + Only call this if :meth:`is_relinquish_folder_membership_error` is true. + + :rtype: RelinquishFolderMembershipError + """ + if not self.is_relinquish_folder_membership_error(): + raise AttributeError("tag 'relinquish_folder_membership_error' not set") + return self._value + def __repr__(self): return 'JobError(%r, %r)' % (self._tag, self._value) @@ -5133,21 +5210,30 @@ def __repr__(self): class RelinquishFolderMembershipArg(object): """ :ivar shared_folder_id: The ID for the shared folder. + :ivar leave_a_copy: Keep a copy of the folder's contents upon relinquishing + membership. """ __slots__ = [ '_shared_folder_id_value', '_shared_folder_id_present', + '_leave_a_copy_value', + '_leave_a_copy_present', ] _has_required_fields = True def __init__(self, - shared_folder_id=None): + shared_folder_id=None, + leave_a_copy=None): self._shared_folder_id_value = None self._shared_folder_id_present = False + self._leave_a_copy_value = None + self._leave_a_copy_present = False if shared_folder_id is not None: self.shared_folder_id = shared_folder_id + if leave_a_copy is not None: + self.leave_a_copy = leave_a_copy @property def shared_folder_id(self): @@ -5172,9 +5258,33 @@ def shared_folder_id(self): self._shared_folder_id_value = None self._shared_folder_id_present = False + @property + def leave_a_copy(self): + """ + Keep a copy of the folder's contents upon relinquishing membership. + + :rtype: bool + """ + if self._leave_a_copy_present: + return self._leave_a_copy_value + else: + return False + + @leave_a_copy.setter + def leave_a_copy(self, val): + val = self._leave_a_copy_validator.validate(val) + self._leave_a_copy_value = val + self._leave_a_copy_present = True + + @leave_a_copy.deleter + def leave_a_copy(self): + self._leave_a_copy_value = None + self._leave_a_copy_present = False + def __repr__(self): - return 'RelinquishFolderMembershipArg(shared_folder_id={!r})'.format( + return 'RelinquishFolderMembershipArg(shared_folder_id={!r}, leave_a_copy={!r})'.format( self._shared_folder_id_value, + self._leave_a_copy_value, ) RelinquishFolderMembershipArg_validator = bv.Struct(RelinquishFolderMembershipArg) @@ -6152,7 +6262,8 @@ class SharePathError(bb.Union): public link instead. :ivar inside_public_folder: A folder inside a public folder can't be shared this way. Use a public link instead. - :ivar already_shared: Folder is already shared. + :ivar SharedFolderMetadata already_shared: Folder is already shared. + Contains metadata about the existing shared folder. :ivar invalid_path: Path is not valid. :ivar is_osx_package: We do not support sharing a Mac OS X package. :ivar inside_osx_package: We do not support sharing a folder inside a Mac OS @@ -6175,8 +6286,6 @@ class SharePathError(bb.Union): # Attribute is overwritten below the class definition inside_public_folder = None # Attribute is overwritten below the class definition - already_shared = None - # Attribute is overwritten below the class definition invalid_path = None # Attribute is overwritten below the class definition is_osx_package = None @@ -6185,6 +6294,17 @@ class SharePathError(bb.Union): # Attribute is overwritten below the class definition other = None + @classmethod + def already_shared(cls, val): + """ + Create an instance of this class set to the ``already_shared`` tag with + value ``val``. + + :param SharedFolderMetadata val: + :rtype: SharePathError + """ + return cls('already_shared', val) + def is_is_file(self): """ Check if the union tag is ``is_file``. @@ -6281,6 +6401,19 @@ def is_other(self): """ return self._tag == 'other' + def get_already_shared(self): + """ + Folder is already shared. Contains metadata about the existing shared + folder. + + Only call this if :meth:`is_already_shared` is true. + + :rtype: SharedFolderMetadata + """ + if not self.is_already_shared(): + raise AttributeError("tag 'already_shared' not set") + return self._value + def __repr__(self): return 'SharePathError(%r, %r)' % (self._tag, self._value) @@ -7470,8 +7603,8 @@ class TransferFolderError(bb.Union): :ivar invalid_dropbox_id: ``TransferFolderArg.to_dropbox_id`` is invalid. :ivar new_owner_not_a_member: The new designated owner is not currently a member of the shared folder. - :ivar new_owner_unmounted: The new designated owner does not have the shared - folder mounted. + :ivar new_owner_unmounted: The new designated owner has not added the folder + to their Dropbox. :ivar new_owner_email_unverified: The new designated owner's e-mail address is unverified. :ivar team_folder: This action cannot be performed on a team shared folder. @@ -8641,17 +8774,20 @@ def __repr__(self): AccessLevel._owner_validator = bv.Void() AccessLevel._editor_validator = bv.Void() AccessLevel._viewer_validator = bv.Void() +AccessLevel._viewer_no_comment_validator = bv.Void() AccessLevel._other_validator = bv.Void() AccessLevel._tagmap = { 'owner': AccessLevel._owner_validator, 'editor': AccessLevel._editor_validator, 'viewer': AccessLevel._viewer_validator, + 'viewer_no_comment': AccessLevel._viewer_no_comment_validator, 'other': AccessLevel._other_validator, } AccessLevel.owner = AccessLevel('owner') AccessLevel.editor = AccessLevel('editor') AccessLevel.viewer = AccessLevel('viewer') +AccessLevel.viewer_no_comment = AccessLevel('viewer_no_comment') AccessLevel.other = AccessLevel('other') AclUpdatePolicy._owner_validator = bv.Void() @@ -9019,14 +9155,17 @@ def __repr__(self): GetSharedLinksResult._all_field_names_ = set(['links']) GetSharedLinksResult._all_fields_ = [('links', GetSharedLinksResult._links_validator)] -GroupInfo._group_type_validator = team.GroupType_validator +GroupInfo._group_type_validator = team_common.GroupType_validator +GroupInfo._is_owner_validator = bv.Boolean() GroupInfo._same_team_validator = bv.Boolean() -GroupInfo._all_field_names_ = team.GroupSummary._all_field_names_.union(set([ +GroupInfo._all_field_names_ = team_common.GroupSummary._all_field_names_.union(set([ 'group_type', + 'is_owner', 'same_team', ])) -GroupInfo._all_fields_ = team.GroupSummary._all_fields_ + [ +GroupInfo._all_fields_ = team_common.GroupSummary._all_fields_ + [ ('group_type', GroupInfo._group_type_validator), + ('is_owner', GroupInfo._is_owner_validator), ('same_team', GroupInfo._same_team_validator), ] @@ -9073,10 +9212,12 @@ def __repr__(self): JobError._unshare_folder_error_validator = UnshareFolderError_validator JobError._remove_folder_member_error_validator = RemoveFolderMemberError_validator +JobError._relinquish_folder_membership_error_validator = RelinquishFolderMembershipError_validator JobError._other_validator = bv.Void() JobError._tagmap = { 'unshare_folder_error': JobError._unshare_folder_error_validator, 'remove_folder_member_error': JobError._remove_folder_member_error_validator, + 'relinquish_folder_membership_error': JobError._relinquish_folder_membership_error_validator, 'other': JobError._other_validator, } @@ -9367,8 +9508,15 @@ def __repr__(self): PermissionDeniedReason.other = PermissionDeniedReason('other') RelinquishFolderMembershipArg._shared_folder_id_validator = common.SharedFolderId_validator -RelinquishFolderMembershipArg._all_field_names_ = set(['shared_folder_id']) -RelinquishFolderMembershipArg._all_fields_ = [('shared_folder_id', RelinquishFolderMembershipArg._shared_folder_id_validator)] +RelinquishFolderMembershipArg._leave_a_copy_validator = bv.Boolean() +RelinquishFolderMembershipArg._all_field_names_ = set([ + 'shared_folder_id', + 'leave_a_copy', +]) +RelinquishFolderMembershipArg._all_fields_ = [ + ('shared_folder_id', RelinquishFolderMembershipArg._shared_folder_id_validator), + ('leave_a_copy', RelinquishFolderMembershipArg._leave_a_copy_validator), +] RelinquishFolderMembershipError._access_error_validator = SharedFolderAccessError_validator RelinquishFolderMembershipError._folder_owner_validator = bv.Void() @@ -9532,7 +9680,7 @@ def __repr__(self): SharePathError._inside_app_folder_validator = bv.Void() SharePathError._is_public_folder_validator = bv.Void() SharePathError._inside_public_folder_validator = bv.Void() -SharePathError._already_shared_validator = bv.Void() +SharePathError._already_shared_validator = SharedFolderMetadata_validator SharePathError._invalid_path_validator = bv.Void() SharePathError._is_osx_package_validator = bv.Void() SharePathError._inside_osx_package_validator = bv.Void() @@ -9559,7 +9707,6 @@ def __repr__(self): SharePathError.inside_app_folder = SharePathError('inside_app_folder') SharePathError.is_public_folder = SharePathError('is_public_folder') SharePathError.inside_public_folder = SharePathError('inside_public_folder') -SharePathError.already_shared = SharePathError('already_shared') SharePathError.invalid_path = SharePathError('invalid_path') SharePathError.is_osx_package = SharePathError('is_osx_package') SharePathError.inside_osx_package = SharePathError('inside_osx_package') @@ -9922,8 +10069,8 @@ def __repr__(self): AddFolderMemberArg_validator, bv.Void(), AddFolderMemberError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) check_job_status = bb.Route( 'check_job_status', @@ -9931,8 +10078,8 @@ def __repr__(self): async.PollArg_validator, JobStatus_validator, async.PollError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) check_share_job_status = bb.Route( 'check_share_job_status', @@ -9940,8 +10087,8 @@ def __repr__(self): async.PollArg_validator, ShareFolderJobStatus_validator, async.PollError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) create_shared_link = bb.Route( 'create_shared_link', @@ -9949,8 +10096,8 @@ def __repr__(self): CreateSharedLinkArg_validator, PathLinkMetadata_validator, CreateSharedLinkError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) create_shared_link_with_settings = bb.Route( 'create_shared_link_with_settings', @@ -9958,8 +10105,8 @@ def __repr__(self): CreateSharedLinkWithSettingsArg_validator, SharedLinkMetadata_validator, CreateSharedLinkWithSettingsError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) get_folder_metadata = bb.Route( 'get_folder_metadata', @@ -9967,8 +10114,8 @@ def __repr__(self): GetMetadataArgs_validator, SharedFolderMetadata_validator, SharedFolderAccessError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) get_shared_link_file = bb.Route( 'get_shared_link_file', @@ -9985,8 +10132,8 @@ def __repr__(self): GetSharedLinkMetadataArg_validator, SharedLinkMetadata_validator, SharedLinkError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) get_shared_links = bb.Route( 'get_shared_links', @@ -9994,8 +10141,8 @@ def __repr__(self): GetSharedLinksArg_validator, GetSharedLinksResult_validator, GetSharedLinksError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_folder_members = bb.Route( 'list_folder_members', @@ -10003,8 +10150,8 @@ def __repr__(self): ListFolderMembersArgs_validator, SharedFolderMembers_validator, SharedFolderAccessError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_folder_members_continue = bb.Route( 'list_folder_members/continue', @@ -10012,8 +10159,8 @@ def __repr__(self): ListFolderMembersContinueArg_validator, SharedFolderMembers_validator, ListFolderMembersContinueError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_folders = bb.Route( 'list_folders', @@ -10021,8 +10168,8 @@ def __repr__(self): ListFoldersArgs_validator, ListFoldersResult_validator, bv.Void(), - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_folders_continue = bb.Route( 'list_folders/continue', @@ -10030,8 +10177,8 @@ def __repr__(self): ListFoldersContinueArg_validator, ListFoldersResult_validator, ListFoldersContinueError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_mountable_folders = bb.Route( 'list_mountable_folders', @@ -10039,8 +10186,8 @@ def __repr__(self): ListFoldersArgs_validator, ListFoldersResult_validator, bv.Void(), - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_mountable_folders_continue = bb.Route( 'list_mountable_folders/continue', @@ -10048,8 +10195,8 @@ def __repr__(self): ListFoldersContinueArg_validator, ListFoldersResult_validator, ListFoldersContinueError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) list_shared_links = bb.Route( 'list_shared_links', @@ -10057,8 +10204,8 @@ def __repr__(self): ListSharedLinksArg_validator, ListSharedLinksResult_validator, ListSharedLinksError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) modify_shared_link_settings = bb.Route( 'modify_shared_link_settings', @@ -10066,8 +10213,8 @@ def __repr__(self): ModifySharedLinkSettingsArgs_validator, SharedLinkMetadata_validator, ModifySharedLinkSettingsError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) mount_folder = bb.Route( 'mount_folder', @@ -10075,17 +10222,17 @@ def __repr__(self): MountFolderArg_validator, SharedFolderMetadata_validator, MountFolderError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) relinquish_folder_membership = bb.Route( 'relinquish_folder_membership', False, RelinquishFolderMembershipArg_validator, - bv.Void(), + async.LaunchEmptyResult_validator, RelinquishFolderMembershipError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) remove_folder_member = bb.Route( 'remove_folder_member', @@ -10093,8 +10240,8 @@ def __repr__(self): RemoveFolderMemberArg_validator, async.LaunchEmptyResult_validator, RemoveFolderMemberError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) revoke_shared_link = bb.Route( 'revoke_shared_link', @@ -10102,8 +10249,8 @@ def __repr__(self): RevokeSharedLinkArg_validator, bv.Void(), RevokeSharedLinkError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) share_folder = bb.Route( 'share_folder', @@ -10111,8 +10258,8 @@ def __repr__(self): ShareFolderArg_validator, ShareFolderLaunch_validator, ShareFolderError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) transfer_folder = bb.Route( 'transfer_folder', @@ -10120,8 +10267,8 @@ def __repr__(self): TransferFolderArg_validator, bv.Void(), TransferFolderError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) unmount_folder = bb.Route( 'unmount_folder', @@ -10129,8 +10276,8 @@ def __repr__(self): UnmountFolderArg_validator, bv.Void(), UnmountFolderError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) unshare_folder = bb.Route( 'unshare_folder', @@ -10138,8 +10285,8 @@ def __repr__(self): UnshareFolderArg_validator, async.LaunchEmptyResult_validator, UnshareFolderError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) update_folder_member = bb.Route( 'update_folder_member', @@ -10147,8 +10294,8 @@ def __repr__(self): UpdateFolderMemberArg_validator, bv.Void(), UpdateFolderMemberError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) update_folder_policy = bb.Route( 'update_folder_policy', @@ -10156,8 +10303,8 @@ def __repr__(self): UpdateFolderPolicyArg_validator, SharedFolderMetadata_validator, UpdateFolderPolicyError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) ROUTES = { diff --git a/dropbox/team.py b/dropbox/team.py index c9344df1..d72e6854 100644 --- a/dropbox/team.py +++ b/dropbox/team.py @@ -14,6 +14,7 @@ async, common, properties, + team_common, team_policies, users, ) @@ -21,6 +22,7 @@ import async import common import properties + import team_common import team_policies import users @@ -485,6 +487,694 @@ def __repr__(self): AdminTier_validator = bv.Union(AdminTier) +class GroupCreateArg(object): + """ + :ivar group_name: Group name. + :ivar group_external_id: The creator of a team can associate an arbitrary + external ID to the group. + """ + + __slots__ = [ + '_group_name_value', + '_group_name_present', + '_group_external_id_value', + '_group_external_id_present', + ] + + _has_required_fields = True + + def __init__(self, + group_name=None, + group_external_id=None): + self._group_name_value = None + self._group_name_present = False + self._group_external_id_value = None + self._group_external_id_present = False + if group_name is not None: + self.group_name = group_name + if group_external_id is not None: + self.group_external_id = group_external_id + + @property + def group_name(self): + """ + Group name. + + :rtype: str + """ + if self._group_name_present: + return self._group_name_value + else: + raise AttributeError("missing required field 'group_name'") + + @group_name.setter + def group_name(self, val): + val = self._group_name_validator.validate(val) + self._group_name_value = val + self._group_name_present = True + + @group_name.deleter + def group_name(self): + self._group_name_value = None + self._group_name_present = False + + @property + def group_external_id(self): + """ + The creator of a team can associate an arbitrary external ID to the + group. + + :rtype: str + """ + if self._group_external_id_present: + return self._group_external_id_value + else: + return None + + @group_external_id.setter + def group_external_id(self, val): + if val is None: + del self.group_external_id + return + val = self._group_external_id_validator.validate(val) + self._group_external_id_value = val + self._group_external_id_present = True + + @group_external_id.deleter + def group_external_id(self): + self._group_external_id_value = None + self._group_external_id_present = False + + def __repr__(self): + return 'GroupCreateArg(group_name={!r}, group_external_id={!r})'.format( + self._group_name_value, + self._group_external_id_value, + ) + +GroupCreateArg_validator = bv.Struct(GroupCreateArg) + +class AlphaGroupCreateArg(GroupCreateArg): + """ + :ivar group_management_type: Whether the team can be managed by selected + users, or only by team admins + """ + + __slots__ = [ + '_group_management_type_value', + '_group_management_type_present', + ] + + _has_required_fields = True + + def __init__(self, + group_name=None, + group_external_id=None, + group_management_type=None): + super(AlphaGroupCreateArg, self).__init__(group_name, + group_external_id) + self._group_management_type_value = None + self._group_management_type_present = False + if group_management_type is not None: + self.group_management_type = group_management_type + + @property + def group_management_type(self): + """ + Whether the team can be managed by selected users, or only by team + admins + + :rtype: team_common.GroupManagementType_validator + """ + if self._group_management_type_present: + return self._group_management_type_value + else: + return team_common.GroupManagementType.company_managed + + @group_management_type.setter + def group_management_type(self, val): + self._group_management_type_validator.validate_type_only(val) + self._group_management_type_value = val + self._group_management_type_present = True + + @group_management_type.deleter + def group_management_type(self): + self._group_management_type_value = None + self._group_management_type_present = False + + def __repr__(self): + return 'AlphaGroupCreateArg(group_name={!r}, group_external_id={!r}, group_management_type={!r})'.format( + self._group_name_value, + self._group_external_id_value, + self._group_management_type_value, + ) + +AlphaGroupCreateArg_validator = bv.Struct(AlphaGroupCreateArg) + +class AlphaGroupFullInfo(team_common.AlphaGroupSummary): + """ + Full description of a group. + + :ivar members: List of group members. + :ivar created: The group creation time as a UTC timestamp in milliseconds + since the Unix epoch. + """ + + __slots__ = [ + '_members_value', + '_members_present', + '_created_value', + '_created_present', + ] + + _has_required_fields = True + + def __init__(self, + group_name=None, + group_id=None, + group_management_type=None, + created=None, + group_external_id=None, + member_count=None, + members=None): + super(AlphaGroupFullInfo, self).__init__(group_name, + group_id, + group_management_type, + group_external_id, + member_count) + self._members_value = None + self._members_present = False + self._created_value = None + self._created_present = False + if members is not None: + self.members = members + if created is not None: + self.created = created + + @property + def members(self): + """ + List of group members. + + :rtype: list of [GroupMemberInfo] + """ + if self._members_present: + return self._members_value + else: + return None + + @members.setter + def members(self, val): + if val is None: + del self.members + return + val = self._members_validator.validate(val) + self._members_value = val + self._members_present = True + + @members.deleter + def members(self): + self._members_value = None + self._members_present = False + + @property + def created(self): + """ + The group creation time as a UTC timestamp in milliseconds since the + Unix epoch. + + :rtype: long + """ + if self._created_present: + return self._created_value + else: + raise AttributeError("missing required field 'created'") + + @created.setter + def created(self, val): + val = self._created_validator.validate(val) + self._created_value = val + self._created_present = True + + @created.deleter + def created(self): + self._created_value = None + self._created_present = False + + def __repr__(self): + return 'AlphaGroupFullInfo(group_name={!r}, group_id={!r}, group_management_type={!r}, created={!r}, group_external_id={!r}, member_count={!r}, members={!r})'.format( + self._group_name_value, + self._group_id_value, + self._group_management_type_value, + self._created_value, + self._group_external_id_value, + self._member_count_value, + self._members_value, + ) + +AlphaGroupFullInfo_validator = bv.Struct(AlphaGroupFullInfo) + +class IncludeMembersArg(object): + """ + :ivar return_members: Whether to return the list of members in the group. + Note that the default value will cause all the group members to be + returned in the response. This may take a long time for large groups. + """ + + __slots__ = [ + '_return_members_value', + '_return_members_present', + ] + + _has_required_fields = False + + def __init__(self, + return_members=None): + self._return_members_value = None + self._return_members_present = False + if return_members is not None: + self.return_members = return_members + + @property + def return_members(self): + """ + Whether to return the list of members in the group. Note that the + default value will cause all the group members to be returned in the + response. This may take a long time for large groups. + + :rtype: bool + """ + if self._return_members_present: + return self._return_members_value + else: + return True + + @return_members.setter + def return_members(self, val): + val = self._return_members_validator.validate(val) + self._return_members_value = val + self._return_members_present = True + + @return_members.deleter + def return_members(self): + self._return_members_value = None + self._return_members_present = False + + def __repr__(self): + return 'IncludeMembersArg(return_members={!r})'.format( + self._return_members_value, + ) + +IncludeMembersArg_validator = bv.Struct(IncludeMembersArg) + +class GroupUpdateArgs(IncludeMembersArg): + """ + :ivar group: Specify a group. + :ivar new_group_name: Optional argument. Set group name to this if provided. + :ivar new_group_external_id: Optional argument. New group external ID. If + the argument is None, the group's external_id won't be updated. If the + argument is empty string, the group's external id will be cleared. + """ + + __slots__ = [ + '_group_value', + '_group_present', + '_new_group_name_value', + '_new_group_name_present', + '_new_group_external_id_value', + '_new_group_external_id_present', + ] + + _has_required_fields = True + + def __init__(self, + group=None, + return_members=None, + new_group_name=None, + new_group_external_id=None): + super(GroupUpdateArgs, self).__init__(return_members) + self._group_value = None + self._group_present = False + self._new_group_name_value = None + self._new_group_name_present = False + self._new_group_external_id_value = None + self._new_group_external_id_present = False + if group is not None: + self.group = group + if new_group_name is not None: + self.new_group_name = new_group_name + if new_group_external_id is not None: + self.new_group_external_id = new_group_external_id + + @property + def group(self): + """ + Specify a group. + + :rtype: GroupSelector + """ + if self._group_present: + return self._group_value + else: + raise AttributeError("missing required field 'group'") + + @group.setter + def group(self, val): + self._group_validator.validate_type_only(val) + self._group_value = val + self._group_present = True + + @group.deleter + def group(self): + self._group_value = None + self._group_present = False + + @property + def new_group_name(self): + """ + Optional argument. Set group name to this if provided. + + :rtype: str + """ + if self._new_group_name_present: + return self._new_group_name_value + else: + return None + + @new_group_name.setter + def new_group_name(self, val): + if val is None: + del self.new_group_name + return + val = self._new_group_name_validator.validate(val) + self._new_group_name_value = val + self._new_group_name_present = True + + @new_group_name.deleter + def new_group_name(self): + self._new_group_name_value = None + self._new_group_name_present = False + + @property + def new_group_external_id(self): + """ + Optional argument. New group external ID. If the argument is None, the + group's external_id won't be updated. If the argument is empty string, + the group's external id will be cleared. + + :rtype: str + """ + if self._new_group_external_id_present: + return self._new_group_external_id_value + else: + return None + + @new_group_external_id.setter + def new_group_external_id(self, val): + if val is None: + del self.new_group_external_id + return + val = self._new_group_external_id_validator.validate(val) + self._new_group_external_id_value = val + self._new_group_external_id_present = True + + @new_group_external_id.deleter + def new_group_external_id(self): + self._new_group_external_id_value = None + self._new_group_external_id_present = False + + def __repr__(self): + return 'GroupUpdateArgs(group={!r}, return_members={!r}, new_group_name={!r}, new_group_external_id={!r})'.format( + self._group_value, + self._return_members_value, + self._new_group_name_value, + self._new_group_external_id_value, + ) + +GroupUpdateArgs_validator = bv.Struct(GroupUpdateArgs) + +class AlphaGroupUpdateArgs(GroupUpdateArgs): + """ + :ivar new_group_management_type: Set new group management type, if provided. + """ + + __slots__ = [ + '_new_group_management_type_value', + '_new_group_management_type_present', + ] + + _has_required_fields = True + + def __init__(self, + group=None, + return_members=None, + new_group_name=None, + new_group_external_id=None, + new_group_management_type=None): + super(AlphaGroupUpdateArgs, self).__init__(group, + return_members, + new_group_name, + new_group_external_id) + self._new_group_management_type_value = None + self._new_group_management_type_present = False + if new_group_management_type is not None: + self.new_group_management_type = new_group_management_type + + @property + def new_group_management_type(self): + """ + Set new group management type, if provided. + + :rtype: team_common.GroupManagementType_validator + """ + if self._new_group_management_type_present: + return self._new_group_management_type_value + else: + return None + + @new_group_management_type.setter + def new_group_management_type(self, val): + if val is None: + del self.new_group_management_type + return + self._new_group_management_type_validator.validate_type_only(val) + self._new_group_management_type_value = val + self._new_group_management_type_present = True + + @new_group_management_type.deleter + def new_group_management_type(self): + self._new_group_management_type_value = None + self._new_group_management_type_present = False + + def __repr__(self): + return 'AlphaGroupUpdateArgs(group={!r}, return_members={!r}, new_group_name={!r}, new_group_external_id={!r}, new_group_management_type={!r})'.format( + self._group_value, + self._return_members_value, + self._new_group_name_value, + self._new_group_external_id_value, + self._new_group_management_type_value, + ) + +AlphaGroupUpdateArgs_validator = bv.Struct(AlphaGroupUpdateArgs) + +class AlphaGroupsGetInfoItem(bb.Union): + """ + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + + :ivar str id_not_found: An ID that was provided as a parameter to + :route:`alpha/groups/get_info`, and did not match a corresponding group. + The ID can be a group ID, or an external ID, depending on how the method + was called. + :ivar AlphaGroupFullInfo group_info: Info about a group. + """ + + _catch_all = None + + @classmethod + def id_not_found(cls, val): + """ + Create an instance of this class set to the ``id_not_found`` tag with + value ``val``. + + :param str val: + :rtype: AlphaGroupsGetInfoItem + """ + return cls('id_not_found', val) + + @classmethod + def group_info(cls, val): + """ + Create an instance of this class set to the ``group_info`` tag with + value ``val``. + + :param AlphaGroupFullInfo val: + :rtype: AlphaGroupsGetInfoItem + """ + return cls('group_info', val) + + def is_id_not_found(self): + """ + Check if the union tag is ``id_not_found``. + + :rtype: bool + """ + return self._tag == 'id_not_found' + + def is_group_info(self): + """ + Check if the union tag is ``group_info``. + + :rtype: bool + """ + return self._tag == 'group_info' + + def get_id_not_found(self): + """ + An ID that was provided as a parameter to alpha/groups/get_info, and did + not match a corresponding group. The ID can be a group ID, or an + external ID, depending on how the method was called. + + Only call this if :meth:`is_id_not_found` is true. + + :rtype: str + """ + if not self.is_id_not_found(): + raise AttributeError("tag 'id_not_found' not set") + return self._value + + def get_group_info(self): + """ + Info about a group. + + Only call this if :meth:`is_group_info` is true. + + :rtype: AlphaGroupFullInfo + """ + if not self.is_group_info(): + raise AttributeError("tag 'group_info' not set") + return self._value + + def __repr__(self): + return 'AlphaGroupsGetInfoItem(%r, %r)' % (self._tag, self._value) + +AlphaGroupsGetInfoItem_validator = bv.Union(AlphaGroupsGetInfoItem) + +class AlphaGroupsListResult(object): + """ + :ivar cursor: Pass the cursor into alpha/groups/list/continue to obtain the + additional groups. + :ivar has_more: Is true if there are additional groups that have not been + returned yet. An additional call to alpha/groups/list/continue can + retrieve them. + """ + + __slots__ = [ + '_groups_value', + '_groups_present', + '_cursor_value', + '_cursor_present', + '_has_more_value', + '_has_more_present', + ] + + _has_required_fields = True + + def __init__(self, + groups=None, + cursor=None, + has_more=None): + self._groups_value = None + self._groups_present = False + self._cursor_value = None + self._cursor_present = False + self._has_more_value = None + self._has_more_present = False + if groups is not None: + self.groups = groups + if cursor is not None: + self.cursor = cursor + if has_more is not None: + self.has_more = has_more + + @property + def groups(self): + """ + :rtype: list of [team_common.AlphaGroupSummary_validator] + """ + if self._groups_present: + return self._groups_value + else: + raise AttributeError("missing required field 'groups'") + + @groups.setter + def groups(self, val): + val = self._groups_validator.validate(val) + self._groups_value = val + self._groups_present = True + + @groups.deleter + def groups(self): + self._groups_value = None + self._groups_present = False + + @property + def cursor(self): + """ + Pass the cursor into alpha/groups/list/continue to obtain the additional + groups. + + :rtype: str + """ + if self._cursor_present: + return self._cursor_value + else: + raise AttributeError("missing required field 'cursor'") + + @cursor.setter + def cursor(self, val): + val = self._cursor_validator.validate(val) + self._cursor_value = val + self._cursor_present = True + + @cursor.deleter + def cursor(self): + self._cursor_value = None + self._cursor_present = False + + @property + def has_more(self): + """ + Is true if there are additional groups that have not been returned yet. + An additional call to alpha/groups/list/continue can retrieve them. + + :rtype: bool + """ + if self._has_more_present: + return self._has_more_value + else: + raise AttributeError("missing required field 'has_more'") + + @has_more.setter + def has_more(self, val): + val = self._has_more_validator.validate(val) + self._has_more_value = val + self._has_more_present = True + + @has_more.deleter + def has_more(self): + self._has_more_value = None + self._has_more_present = False + + def __repr__(self): + return 'AlphaGroupsListResult(groups={!r}, cursor={!r}, has_more={!r})'.format( + self._groups_value, + self._cursor_value, + self._has_more_value, + ) + +AlphaGroupsListResult_validator = bv.Struct(AlphaGroupsListResult) + class ApiApp(object): """ Information on linked third party applications @@ -2466,7 +3156,7 @@ class GroupAccessType(bb.Union): corresponding ``get_*`` method. :ivar member: User is a member of the group, but has no special permissions. - :ivar owner: A group owner can rename the group, and add/remove members. + :ivar owner: User can rename the group, and add/remove members. """ _catch_all = None @@ -2496,92 +3186,6 @@ def __repr__(self): GroupAccessType_validator = bv.Union(GroupAccessType) -class GroupCreateArg(object): - """ - :ivar group_name: Group name. - :ivar group_external_id: Optional argument. The creator of a team can - associate an arbitrary external ID to the group. - """ - - __slots__ = [ - '_group_name_value', - '_group_name_present', - '_group_external_id_value', - '_group_external_id_present', - ] - - _has_required_fields = True - - def __init__(self, - group_name=None, - group_external_id=None): - self._group_name_value = None - self._group_name_present = False - self._group_external_id_value = None - self._group_external_id_present = False - if group_name is not None: - self.group_name = group_name - if group_external_id is not None: - self.group_external_id = group_external_id - - @property - def group_name(self): - """ - Group name. - - :rtype: str - """ - if self._group_name_present: - return self._group_name_value - else: - raise AttributeError("missing required field 'group_name'") - - @group_name.setter - def group_name(self, val): - val = self._group_name_validator.validate(val) - self._group_name_value = val - self._group_name_present = True - - @group_name.deleter - def group_name(self): - self._group_name_value = None - self._group_name_present = False - - @property - def group_external_id(self): - """ - Optional argument. The creator of a team can associate an arbitrary - external ID to the group. - - :rtype: str - """ - if self._group_external_id_present: - return self._group_external_id_value - else: - return None - - @group_external_id.setter - def group_external_id(self, val): - if val is None: - del self.group_external_id - return - val = self._group_external_id_validator.validate(val) - self._group_external_id_value = val - self._group_external_id_present = True - - @group_external_id.deleter - def group_external_id(self): - self._group_external_id_value = None - self._group_external_id_present = False - - def __repr__(self): - return 'GroupCreateArg(group_name={!r}, group_external_id={!r})'.format( - self._group_name_value, - self._group_external_id_value, - ) - -GroupCreateArg_validator = bv.Struct(GroupCreateArg) - class GroupCreateError(bb.Union): """ This class acts as a tagged union. Only one of the ``is_*`` methods will @@ -2706,156 +3310,7 @@ def __repr__(self): GroupDeleteError_validator = bv.Union(GroupDeleteError) -class GroupSummary(object): - """ - Information about a group. - - :ivar group_external_id: External ID of group. This is an arbitrary ID that - an admin can attach to a group. - :ivar member_count: The number of members in the group. - """ - - __slots__ = [ - '_group_name_value', - '_group_name_present', - '_group_id_value', - '_group_id_present', - '_group_external_id_value', - '_group_external_id_present', - '_member_count_value', - '_member_count_present', - ] - - _has_required_fields = True - - def __init__(self, - group_name=None, - group_id=None, - group_external_id=None, - member_count=None): - self._group_name_value = None - self._group_name_present = False - self._group_id_value = None - self._group_id_present = False - self._group_external_id_value = None - self._group_external_id_present = False - self._member_count_value = None - self._member_count_present = False - if group_name is not None: - self.group_name = group_name - if group_id is not None: - self.group_id = group_id - if group_external_id is not None: - self.group_external_id = group_external_id - if member_count is not None: - self.member_count = member_count - - @property - def group_name(self): - """ - :rtype: str - """ - if self._group_name_present: - return self._group_name_value - else: - raise AttributeError("missing required field 'group_name'") - - @group_name.setter - def group_name(self, val): - val = self._group_name_validator.validate(val) - self._group_name_value = val - self._group_name_present = True - - @group_name.deleter - def group_name(self): - self._group_name_value = None - self._group_name_present = False - - @property - def group_id(self): - """ - :rtype: str - """ - if self._group_id_present: - return self._group_id_value - else: - raise AttributeError("missing required field 'group_id'") - - @group_id.setter - def group_id(self, val): - val = self._group_id_validator.validate(val) - self._group_id_value = val - self._group_id_present = True - - @group_id.deleter - def group_id(self): - self._group_id_value = None - self._group_id_present = False - - @property - def group_external_id(self): - """ - External ID of group. This is an arbitrary ID that an admin can attach - to a group. - - :rtype: str - """ - if self._group_external_id_present: - return self._group_external_id_value - else: - return None - - @group_external_id.setter - def group_external_id(self, val): - if val is None: - del self.group_external_id - return - val = self._group_external_id_validator.validate(val) - self._group_external_id_value = val - self._group_external_id_present = True - - @group_external_id.deleter - def group_external_id(self): - self._group_external_id_value = None - self._group_external_id_present = False - - @property - def member_count(self): - """ - The number of members in the group. - - :rtype: long - """ - if self._member_count_present: - return self._member_count_value - else: - return None - - @member_count.setter - def member_count(self, val): - if val is None: - del self.member_count - return - val = self._member_count_validator.validate(val) - self._member_count_value = val - self._member_count_present = True - - @member_count.deleter - def member_count(self): - self._member_count_value = None - self._member_count_present = False - - def __repr__(self): - return 'GroupSummary(group_name={!r}, group_id={!r}, group_external_id={!r}, member_count={!r})'.format( - self._group_name_value, - self._group_id_value, - self._group_external_id_value, - self._member_count_value, - ) - -GroupSummary_validator = bv.Struct(GroupSummary) - -class GroupFullInfo(GroupSummary): +class GroupFullInfo(team_common.GroupSummary): """ Full description of a group. @@ -3155,78 +3610,25 @@ class GroupMemberSetAccessTypeError(GroupMemberSelectorError): return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method. - :ivar user_cannot_be_manager_of_company_managed_group: A company managed - group cannot be managed by a user. - """ - - # Attribute is overwritten below the class definition - user_cannot_be_manager_of_company_managed_group = None - - def is_user_cannot_be_manager_of_company_managed_group(self): - """ - Check if the union tag is ``user_cannot_be_manager_of_company_managed_group``. - - :rtype: bool - """ - return self._tag == 'user_cannot_be_manager_of_company_managed_group' - - def __repr__(self): - return 'GroupMemberSetAccessTypeError(%r, %r)' % (self._tag, self._value) - -GroupMemberSetAccessTypeError_validator = bv.Union(GroupMemberSetAccessTypeError) - -class IncludeMembersArg(object): - """ - :ivar return_members: Whether to return the list of members in the group. - Note that the default value will cause all the group members to be - returned in the response. This may take a long time for large groups. - """ - - __slots__ = [ - '_return_members_value', - '_return_members_present', - ] - - _has_required_fields = False - - def __init__(self, - return_members=None): - self._return_members_value = None - self._return_members_present = False - if return_members is not None: - self.return_members = return_members + :ivar user_cannot_be_manager_of_company_managed_group: A company managed + group cannot be managed by a user. + """ - @property - def return_members(self): + # Attribute is overwritten below the class definition + user_cannot_be_manager_of_company_managed_group = None + + def is_user_cannot_be_manager_of_company_managed_group(self): """ - Whether to return the list of members in the group. Note that the - default value will cause all the group members to be returned in the - response. This may take a long time for large groups. + Check if the union tag is ``user_cannot_be_manager_of_company_managed_group``. :rtype: bool """ - if self._return_members_present: - return self._return_members_value - else: - return True - - @return_members.setter - def return_members(self, val): - val = self._return_members_validator.validate(val) - self._return_members_value = val - self._return_members_present = True - - @return_members.deleter - def return_members(self): - self._return_members_value = None - self._return_members_present = False + return self._tag == 'user_cannot_be_manager_of_company_managed_group' def __repr__(self): - return 'IncludeMembersArg(return_members={!r})'.format( - self._return_members_value, - ) + return 'GroupMemberSetAccessTypeError(%r, %r)' % (self._tag, self._value) -IncludeMembersArg_validator = bv.Struct(IncludeMembersArg) +GroupMemberSetAccessTypeError_validator = bv.Union(GroupMemberSetAccessTypeError) class GroupMembersAddArg(IncludeMembersArg): """ @@ -3329,7 +3731,7 @@ class GroupMembersAddError(GroupSelectorError): endpoint. :ivar list of [str] users_not_found: These users were not found in Dropbox. :ivar user_must_be_active_to_be_owner: A suspended user cannot be added to a - group as owner. + group as ``GroupAccessType.owner``. :ivar list of [str] user_cannot_be_manager_of_company_managed_group: A company-managed group cannot be managed by a user. """ @@ -3948,42 +4350,54 @@ def __repr__(self): GroupSelector_validator = bv.Union(GroupSelector) -class GroupType(bb.Union): +class GroupUpdateError(GroupSelectorError): """ - The group type determines how a group is created and managed. - This class acts as a tagged union. Only one of the ``is_*`` methods will return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method. - :ivar team: A group to which team members are automatically added. - Applicable to `team folders `_ only. - :ivar user_managed: A group is created and managed by a user. + :ivar external_id_already_in_use: The new external ID is already being used + by another group. """ - _catch_all = 'other' # Attribute is overwritten below the class definition - team = None - # Attribute is overwritten below the class definition - user_managed = None - # Attribute is overwritten below the class definition - other = None + external_id_already_in_use = None - def is_team(self): + def is_external_id_already_in_use(self): """ - Check if the union tag is ``team``. + Check if the union tag is ``external_id_already_in_use``. :rtype: bool """ - return self._tag == 'team' + return self._tag == 'external_id_already_in_use' + + def __repr__(self): + return 'GroupUpdateError(%r, %r)' % (self._tag, self._value) + +GroupUpdateError_validator = bv.Union(GroupUpdateError) + +class GroupsGetInfoError(bb.Union): + """ + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + + :ivar group_not_on_team: The group is not on your team. + """ + + _catch_all = 'other' + # Attribute is overwritten below the class definition + group_not_on_team = None + # Attribute is overwritten below the class definition + other = None - def is_user_managed(self): + def is_group_not_on_team(self): """ - Check if the union tag is ``user_managed``. + Check if the union tag is ``group_not_on_team``. :rtype: bool """ - return self._tag == 'user_managed' + return self._tag == 'group_not_on_team' def is_other(self): """ @@ -3994,184 +4408,215 @@ def is_other(self): return self._tag == 'other' def __repr__(self): - return 'GroupType(%r, %r)' % (self._tag, self._value) + return 'GroupsGetInfoError(%r, %r)' % (self._tag, self._value) -GroupType_validator = bv.Union(GroupType) +GroupsGetInfoError_validator = bv.Union(GroupsGetInfoError) -class GroupUpdateArgs(IncludeMembersArg): +class GroupsGetInfoItem(bb.Union): """ - :ivar group: Specify a group. - :ivar new_group_name: Optional argument. Set group name to this if provided. - :ivar new_group_external_id: Optional argument. New group external ID. If - the argument is None, the group's external_id won't be updated. If the - argument is empty string, the group's external id will be cleared. + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + + :ivar str id_not_found: An ID that was provided as a parameter to + :route:`groups/get_info`, and did not match a corresponding group. The + ID can be a group ID, or an external ID, depending on how the method was + called. + :ivar GroupFullInfo group_info: Info about a group. """ - __slots__ = [ - '_group_value', - '_group_present', - '_new_group_name_value', - '_new_group_name_present', - '_new_group_external_id_value', - '_new_group_external_id_present', - ] + _catch_all = None - _has_required_fields = True + @classmethod + def id_not_found(cls, val): + """ + Create an instance of this class set to the ``id_not_found`` tag with + value ``val``. - def __init__(self, - group=None, - return_members=None, - new_group_name=None, - new_group_external_id=None): - super(GroupUpdateArgs, self).__init__(return_members) - self._group_value = None - self._group_present = False - self._new_group_name_value = None - self._new_group_name_present = False - self._new_group_external_id_value = None - self._new_group_external_id_present = False - if group is not None: - self.group = group - if new_group_name is not None: - self.new_group_name = new_group_name - if new_group_external_id is not None: - self.new_group_external_id = new_group_external_id + :param str val: + :rtype: GroupsGetInfoItem + """ + return cls('id_not_found', val) - @property - def group(self): + @classmethod + def group_info(cls, val): """ - Specify a group. + Create an instance of this class set to the ``group_info`` tag with + value ``val``. - :rtype: GroupSelector + :param GroupFullInfo val: + :rtype: GroupsGetInfoItem """ - if self._group_present: - return self._group_value - else: - raise AttributeError("missing required field 'group'") + return cls('group_info', val) - @group.setter - def group(self, val): - self._group_validator.validate_type_only(val) - self._group_value = val - self._group_present = True + def is_id_not_found(self): + """ + Check if the union tag is ``id_not_found``. - @group.deleter - def group(self): - self._group_value = None - self._group_present = False + :rtype: bool + """ + return self._tag == 'id_not_found' - @property - def new_group_name(self): + def is_group_info(self): """ - Optional argument. Set group name to this if provided. + Check if the union tag is ``group_info``. + + :rtype: bool + """ + return self._tag == 'group_info' + + def get_id_not_found(self): + """ + An ID that was provided as a parameter to groups/get_info, and did not + match a corresponding group. The ID can be a group ID, or an external + ID, depending on how the method was called. + + Only call this if :meth:`is_id_not_found` is true. :rtype: str """ - if self._new_group_name_present: - return self._new_group_name_value - else: - return None + if not self.is_id_not_found(): + raise AttributeError("tag 'id_not_found' not set") + return self._value - @new_group_name.setter - def new_group_name(self, val): - if val is None: - del self.new_group_name - return - val = self._new_group_name_validator.validate(val) - self._new_group_name_value = val - self._new_group_name_present = True + def get_group_info(self): + """ + Info about a group. - @new_group_name.deleter - def new_group_name(self): - self._new_group_name_value = None - self._new_group_name_present = False + Only call this if :meth:`is_group_info` is true. + + :rtype: GroupFullInfo + """ + if not self.is_group_info(): + raise AttributeError("tag 'group_info' not set") + return self._value + + def __repr__(self): + return 'GroupsGetInfoItem(%r, %r)' % (self._tag, self._value) + +GroupsGetInfoItem_validator = bv.Union(GroupsGetInfoItem) + +class GroupsListArg(object): + """ + :ivar limit: Number of results to return per call. + """ + + __slots__ = [ + '_limit_value', + '_limit_present', + ] + + _has_required_fields = False + + def __init__(self, + limit=None): + self._limit_value = None + self._limit_present = False + if limit is not None: + self.limit = limit @property - def new_group_external_id(self): + def limit(self): """ - Optional argument. New group external ID. If the argument is None, the - group's external_id won't be updated. If the argument is empty string, - the group's external id will be cleared. + Number of results to return per call. - :rtype: str + :rtype: long """ - if self._new_group_external_id_present: - return self._new_group_external_id_value + if self._limit_present: + return self._limit_value else: - return None + return 1000 - @new_group_external_id.setter - def new_group_external_id(self, val): - if val is None: - del self.new_group_external_id - return - val = self._new_group_external_id_validator.validate(val) - self._new_group_external_id_value = val - self._new_group_external_id_present = True + @limit.setter + def limit(self, val): + val = self._limit_validator.validate(val) + self._limit_value = val + self._limit_present = True - @new_group_external_id.deleter - def new_group_external_id(self): - self._new_group_external_id_value = None - self._new_group_external_id_present = False + @limit.deleter + def limit(self): + self._limit_value = None + self._limit_present = False def __repr__(self): - return 'GroupUpdateArgs(group={!r}, return_members={!r}, new_group_name={!r}, new_group_external_id={!r})'.format( - self._group_value, - self._return_members_value, - self._new_group_name_value, - self._new_group_external_id_value, + return 'GroupsListArg(limit={!r})'.format( + self._limit_value, ) -GroupUpdateArgs_validator = bv.Struct(GroupUpdateArgs) +GroupsListArg_validator = bv.Struct(GroupsListArg) -class GroupUpdateError(GroupSelectorError): +class GroupsListContinueArg(object): """ - This class acts as a tagged union. Only one of the ``is_*`` methods will - return true. To get the associated value of a tag (if one exists), use the - corresponding ``get_*`` method. - - :ivar external_id_already_in_use: The new external ID is already being used - by another group. + :ivar cursor: Indicates from what point to get the next set of groups. """ - # Attribute is overwritten below the class definition - external_id_already_in_use = None + __slots__ = [ + '_cursor_value', + '_cursor_present', + ] - def is_external_id_already_in_use(self): + _has_required_fields = True + + def __init__(self, + cursor=None): + self._cursor_value = None + self._cursor_present = False + if cursor is not None: + self.cursor = cursor + + @property + def cursor(self): """ - Check if the union tag is ``external_id_already_in_use``. + Indicates from what point to get the next set of groups. - :rtype: bool + :rtype: str """ - return self._tag == 'external_id_already_in_use' + if self._cursor_present: + return self._cursor_value + else: + raise AttributeError("missing required field 'cursor'") + + @cursor.setter + def cursor(self, val): + val = self._cursor_validator.validate(val) + self._cursor_value = val + self._cursor_present = True + + @cursor.deleter + def cursor(self): + self._cursor_value = None + self._cursor_present = False def __repr__(self): - return 'GroupUpdateError(%r, %r)' % (self._tag, self._value) + return 'GroupsListContinueArg(cursor={!r})'.format( + self._cursor_value, + ) -GroupUpdateError_validator = bv.Union(GroupUpdateError) +GroupsListContinueArg_validator = bv.Struct(GroupsListContinueArg) -class GroupsGetInfoError(bb.Union): +class GroupsListContinueError(bb.Union): """ This class acts as a tagged union. Only one of the ``is_*`` methods will return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method. - :ivar group_not_on_team: The group is not on your team. + :ivar invalid_cursor: The cursor is invalid. + :ivar other: An unspecified error. """ _catch_all = 'other' # Attribute is overwritten below the class definition - group_not_on_team = None + invalid_cursor = None # Attribute is overwritten below the class definition other = None - def is_group_not_on_team(self): + def is_invalid_cursor(self): """ - Check if the union tag is ``group_not_on_team``. + Check if the union tag is ``invalid_cursor``. :rtype: bool """ - return self._tag == 'group_not_on_team' + return self._tag == 'invalid_cursor' def is_other(self): """ @@ -4182,112 +4627,174 @@ def is_other(self): return self._tag == 'other' def __repr__(self): - return 'GroupsGetInfoError(%r, %r)' % (self._tag, self._value) + return 'GroupsListContinueError(%r, %r)' % (self._tag, self._value) -GroupsGetInfoError_validator = bv.Union(GroupsGetInfoError) +GroupsListContinueError_validator = bv.Union(GroupsListContinueError) -class GroupsGetInfoItem(bb.Union): +class GroupsListResult(object): """ - This class acts as a tagged union. Only one of the ``is_*`` methods will - return true. To get the associated value of a tag (if one exists), use the - corresponding ``get_*`` method. - - :ivar str id_not_found: An ID that was provided as a parameter to - :route:`groups/get_info`, and did not match a corresponding group. The - ID can be a group ID, or an external ID, depending on how the method was - called. - :ivar GroupFullInfo group_info: Info about a group. + :ivar cursor: Pass the cursor into groups/list/continue to obtain the + additional groups. + :ivar has_more: Is true if there are additional groups that have not been + returned yet. An additional call to groups/list/continue can retrieve + them. """ - _catch_all = None + __slots__ = [ + '_groups_value', + '_groups_present', + '_cursor_value', + '_cursor_present', + '_has_more_value', + '_has_more_present', + ] - @classmethod - def id_not_found(cls, val): - """ - Create an instance of this class set to the ``id_not_found`` tag with - value ``val``. + _has_required_fields = True - :param str val: - :rtype: GroupsGetInfoItem - """ - return cls('id_not_found', val) + def __init__(self, + groups=None, + cursor=None, + has_more=None): + self._groups_value = None + self._groups_present = False + self._cursor_value = None + self._cursor_present = False + self._has_more_value = None + self._has_more_present = False + if groups is not None: + self.groups = groups + if cursor is not None: + self.cursor = cursor + if has_more is not None: + self.has_more = has_more - @classmethod - def group_info(cls, val): + @property + def groups(self): """ - Create an instance of this class set to the ``group_info`` tag with - value ``val``. - - :param GroupFullInfo val: - :rtype: GroupsGetInfoItem + :rtype: list of [team_common.GroupSummary_validator] """ - return cls('group_info', val) + if self._groups_present: + return self._groups_value + else: + raise AttributeError("missing required field 'groups'") - def is_id_not_found(self): - """ - Check if the union tag is ``id_not_found``. + @groups.setter + def groups(self, val): + val = self._groups_validator.validate(val) + self._groups_value = val + self._groups_present = True - :rtype: bool - """ - return self._tag == 'id_not_found' + @groups.deleter + def groups(self): + self._groups_value = None + self._groups_present = False - def is_group_info(self): + @property + def cursor(self): """ - Check if the union tag is ``group_info``. + Pass the cursor into groups/list/continue to obtain the additional + groups. - :rtype: bool + :rtype: str """ - return self._tag == 'group_info' + if self._cursor_present: + return self._cursor_value + else: + raise AttributeError("missing required field 'cursor'") - def get_id_not_found(self): - """ - An ID that was provided as a parameter to groups/get_info, and did not - match a corresponding group. The ID can be a group ID, or an external - ID, depending on how the method was called. + @cursor.setter + def cursor(self, val): + val = self._cursor_validator.validate(val) + self._cursor_value = val + self._cursor_present = True - Only call this if :meth:`is_id_not_found` is true. + @cursor.deleter + def cursor(self): + self._cursor_value = None + self._cursor_present = False - :rtype: str + @property + def has_more(self): """ - if not self.is_id_not_found(): - raise AttributeError("tag 'id_not_found' not set") - return self._value + Is true if there are additional groups that have not been returned yet. + An additional call to groups/list/continue can retrieve them. - def get_group_info(self): + :rtype: bool """ - Info about a group. + if self._has_more_present: + return self._has_more_value + else: + raise AttributeError("missing required field 'has_more'") - Only call this if :meth:`is_group_info` is true. + @has_more.setter + def has_more(self, val): + val = self._has_more_validator.validate(val) + self._has_more_value = val + self._has_more_present = True - :rtype: GroupFullInfo - """ - if not self.is_group_info(): - raise AttributeError("tag 'group_info' not set") - return self._value + @has_more.deleter + def has_more(self): + self._has_more_value = None + self._has_more_present = False def __repr__(self): - return 'GroupsGetInfoItem(%r, %r)' % (self._tag, self._value) + return 'GroupsListResult(groups={!r}, cursor={!r}, has_more={!r})'.format( + self._groups_value, + self._cursor_value, + self._has_more_value, + ) -GroupsGetInfoItem_validator = bv.Union(GroupsGetInfoItem) +GroupsListResult_validator = bv.Struct(GroupsListResult) -class GroupsListArg(object): +class GroupsMembersListArg(object): """ + :ivar group: The group whose members are to be listed. :ivar limit: Number of results to return per call. """ __slots__ = [ + '_group_value', + '_group_present', '_limit_value', '_limit_present', ] - _has_required_fields = False + _has_required_fields = True + + def __init__(self, + group=None, + limit=None): + self._group_value = None + self._group_present = False + self._limit_value = None + self._limit_present = False + if group is not None: + self.group = group + if limit is not None: + self.limit = limit + + @property + def group(self): + """ + The group whose members are to be listed. + + :rtype: GroupSelector + """ + if self._group_present: + return self._group_value + else: + raise AttributeError("missing required field 'group'") + + @group.setter + def group(self, val): + self._group_validator.validate_type_only(val) + self._group_value = val + self._group_present = True - def __init__(self, - limit=None): - self._limit_value = None - self._limit_present = False - if limit is not None: - self.limit = limit + @group.deleter + def group(self): + self._group_value = None + self._group_present = False @property def limit(self): @@ -4313,13 +4820,14 @@ def limit(self): self._limit_present = False def __repr__(self): - return 'GroupsListArg(limit={!r})'.format( + return 'GroupsMembersListArg(group={!r}, limit={!r})'.format( + self._group_value, self._limit_value, ) -GroupsListArg_validator = bv.Struct(GroupsListArg) +GroupsMembersListArg_validator = bv.Struct(GroupsMembersListArg) -class GroupsListContinueArg(object): +class GroupsMembersListContinueArg(object): """ :ivar cursor: Indicates from what point to get the next set of groups. """ @@ -4362,13 +4870,13 @@ def cursor(self): self._cursor_present = False def __repr__(self): - return 'GroupsListContinueArg(cursor={!r})'.format( + return 'GroupsMembersListContinueArg(cursor={!r})'.format( self._cursor_value, ) -GroupsListContinueArg_validator = bv.Struct(GroupsListContinueArg) +GroupsMembersListContinueArg_validator = bv.Struct(GroupsMembersListContinueArg) -class GroupsListContinueError(bb.Union): +class GroupsMembersListContinueError(bb.Union): """ This class acts as a tagged union. Only one of the ``is_*`` methods will return true. To get the associated value of a tag (if one exists), use the @@ -4401,22 +4909,22 @@ def is_other(self): return self._tag == 'other' def __repr__(self): - return 'GroupsListContinueError(%r, %r)' % (self._tag, self._value) + return 'GroupsMembersListContinueError(%r, %r)' % (self._tag, self._value) -GroupsListContinueError_validator = bv.Union(GroupsListContinueError) +GroupsMembersListContinueError_validator = bv.Union(GroupsMembersListContinueError) -class GroupsListResult(object): +class GroupsMembersListResult(object): """ - :ivar cursor: Pass the cursor into groups/list/continue to obtain the - additional groups. - :ivar has_more: Is true if there are additional groups that have not been - returned yet. An additional call to groups/list/continue can retrieve - them. + :ivar cursor: Pass the cursor into groups/members/list/continue to obtain + additional group members. + :ivar has_more: Is true if there are additional group members that have not + been returned yet. An additional call to groups/members/list/continue + can retrieve them. """ __slots__ = [ - '_groups_value', - '_groups_present', + '_members_value', + '_members_present', '_cursor_value', '_cursor_present', '_has_more_value', @@ -4426,48 +4934,48 @@ class GroupsListResult(object): _has_required_fields = True def __init__(self, - groups=None, + members=None, cursor=None, has_more=None): - self._groups_value = None - self._groups_present = False + self._members_value = None + self._members_present = False self._cursor_value = None self._cursor_present = False self._has_more_value = None self._has_more_present = False - if groups is not None: - self.groups = groups + if members is not None: + self.members = members if cursor is not None: self.cursor = cursor if has_more is not None: self.has_more = has_more @property - def groups(self): + def members(self): """ - :rtype: list of [GroupSummary] + :rtype: list of [GroupMemberInfo] """ - if self._groups_present: - return self._groups_value + if self._members_present: + return self._members_value else: - raise AttributeError("missing required field 'groups'") + raise AttributeError("missing required field 'members'") - @groups.setter - def groups(self, val): - val = self._groups_validator.validate(val) - self._groups_value = val - self._groups_present = True + @members.setter + def members(self, val): + val = self._members_validator.validate(val) + self._members_value = val + self._members_present = True - @groups.deleter - def groups(self): - self._groups_value = None - self._groups_present = False + @members.deleter + def members(self): + self._members_value = None + self._members_present = False @property def cursor(self): """ - Pass the cursor into groups/list/continue to obtain the additional - groups. + Pass the cursor into groups/members/list/continue to obtain additional + group members. :rtype: str """ @@ -4490,8 +4998,9 @@ def cursor(self): @property def has_more(self): """ - Is true if there are additional groups that have not been returned yet. - An additional call to groups/list/continue can retrieve them. + Is true if there are additional group members that have not been + returned yet. An additional call to groups/members/list/continue can + retrieve them. :rtype: bool """ @@ -4512,13 +5021,13 @@ def has_more(self): self._has_more_present = False def __repr__(self): - return 'GroupsListResult(groups={!r}, cursor={!r}, has_more={!r})'.format( - self._groups_value, + return 'GroupsMembersListResult(members={!r}, cursor={!r}, has_more={!r})'.format( + self._members_value, self._cursor_value, self._has_more_value, ) -GroupsListResult_validator = bv.Struct(GroupsListResult) +GroupsMembersListResult_validator = bv.Struct(GroupsMembersListResult) class GroupsPollError(async.PollError): """ @@ -7016,6 +7525,9 @@ class MemberProfile(object): the user. :ivar status: The user's status as a member of a specific team. :ivar name: Representations for a person's name. + :ivar membership_type: The user's membership type: full (normal team member) + vs limited (does not use a license; no access to the team's shared + quota). """ __slots__ = [ @@ -7031,6 +7543,8 @@ class MemberProfile(object): '_status_present', '_name_value', '_name_present', + '_membership_type_value', + '_membership_type_present', ] _has_required_fields = True @@ -7041,6 +7555,7 @@ def __init__(self, email_verified=None, status=None, name=None, + membership_type=None, external_id=None): self._team_member_id_value = None self._team_member_id_present = False @@ -7054,6 +7569,8 @@ def __init__(self, self._status_present = False self._name_value = None self._name_present = False + self._membership_type_value = None + self._membership_type_present = False if team_member_id is not None: self.team_member_id = team_member_id if external_id is not None: @@ -7066,6 +7583,8 @@ def __init__(self, self.status = status if name is not None: self.name = name + if membership_type is not None: + self.membership_type = membership_type @property def team_member_id(self): @@ -7210,13 +7729,38 @@ def name(self): self._name_value = None self._name_present = False + @property + def membership_type(self): + """ + The user's membership type: full (normal team member) vs limited (does + not use a license; no access to the team's shared quota). + + :rtype: TeamMembershipType + """ + if self._membership_type_present: + return self._membership_type_value + else: + raise AttributeError("missing required field 'membership_type'") + + @membership_type.setter + def membership_type(self, val): + self._membership_type_validator.validate_type_only(val) + self._membership_type_value = val + self._membership_type_present = True + + @membership_type.deleter + def membership_type(self): + self._membership_type_value = None + self._membership_type_present = False + def __repr__(self): - return 'MemberProfile(team_member_id={!r}, email={!r}, email_verified={!r}, status={!r}, name={!r}, external_id={!r})'.format( + return 'MemberProfile(team_member_id={!r}, email={!r}, email_verified={!r}, status={!r}, name={!r}, membership_type={!r}, external_id={!r})'.format( self._team_member_id_value, self._email_value, self._email_verified_value, self._status_value, self._name_value, + self._membership_type_value, self._external_id_value, ) @@ -8054,6 +8598,9 @@ class MembersRemoveArg(MembersDeactivateArg): :ivar transfer_admin_id: If provided, errors during the transfer process will be sent via email to this user. If the transfer_dest_id argument was provided, then this argument must be provided as well. + :ivar keep_account: Downgrade the member to a Basic account. The user will + retain the email address associated with their Dropbox account and data + in their account that is not restricted to team members. """ __slots__ = [ @@ -8061,6 +8608,8 @@ class MembersRemoveArg(MembersDeactivateArg): '_transfer_dest_id_present', '_transfer_admin_id_value', '_transfer_admin_id_present', + '_keep_account_value', + '_keep_account_present', ] _has_required_fields = True @@ -8069,17 +8618,22 @@ def __init__(self, user=None, wipe_data=None, transfer_dest_id=None, - transfer_admin_id=None): + transfer_admin_id=None, + keep_account=None): super(MembersRemoveArg, self).__init__(user, wipe_data) self._transfer_dest_id_value = None self._transfer_dest_id_present = False self._transfer_admin_id_value = None self._transfer_admin_id_present = False + self._keep_account_value = None + self._keep_account_present = False if transfer_dest_id is not None: self.transfer_dest_id = transfer_dest_id if transfer_admin_id is not None: self.transfer_admin_id = transfer_admin_id + if keep_account is not None: + self.keep_account = keep_account @property def transfer_dest_id(self): @@ -8136,12 +8690,38 @@ def transfer_admin_id(self): self._transfer_admin_id_value = None self._transfer_admin_id_present = False + @property + def keep_account(self): + """ + Downgrade the member to a Basic account. The user will retain the email + address associated with their Dropbox account and data in their account + that is not restricted to team members. + + :rtype: bool + """ + if self._keep_account_present: + return self._keep_account_value + else: + return False + + @keep_account.setter + def keep_account(self, val): + val = self._keep_account_validator.validate(val) + self._keep_account_value = val + self._keep_account_present = True + + @keep_account.deleter + def keep_account(self): + self._keep_account_value = None + self._keep_account_present = False + def __repr__(self): - return 'MembersRemoveArg(user={!r}, wipe_data={!r}, transfer_dest_id={!r}, transfer_admin_id={!r})'.format( + return 'MembersRemoveArg(user={!r}, wipe_data={!r}, transfer_dest_id={!r}, transfer_admin_id={!r}, keep_account={!r})'.format( self._user_value, self._wipe_data_value, self._transfer_dest_id_value, self._transfer_admin_id_value, + self._keep_account_value, ) MembersRemoveArg_validator = bv.Struct(MembersRemoveArg) @@ -8170,6 +8750,10 @@ class MembersRemoveError(MembersDeactivateError): provided when file transfer is requested. :ivar transfer_admin_is_not_admin: Specified transfer_admin user is not a team admin. + :ivar cannot_keep_account_and_transfer: Cannot keep account and transfer the + data to another user at the same time. + :ivar cannot_keep_account_and_delete_data: Cannot keep account and delete + the data at the same time. """ # Attribute is overwritten below the class definition @@ -8190,6 +8774,10 @@ class MembersRemoveError(MembersDeactivateError): unspecified_transfer_admin_id = None # Attribute is overwritten below the class definition transfer_admin_is_not_admin = None + # Attribute is overwritten below the class definition + cannot_keep_account_and_transfer = None + # Attribute is overwritten below the class definition + cannot_keep_account_and_delete_data = None def is_remove_last_admin(self): """ @@ -8263,6 +8851,22 @@ def is_transfer_admin_is_not_admin(self): """ return self._tag == 'transfer_admin_is_not_admin' + def is_cannot_keep_account_and_transfer(self): + """ + Check if the union tag is ``cannot_keep_account_and_transfer``. + + :rtype: bool + """ + return self._tag == 'cannot_keep_account_and_transfer' + + def is_cannot_keep_account_and_delete_data(self): + """ + Check if the union tag is ``cannot_keep_account_and_delete_data``. + + :rtype: bool + """ + return self._tag == 'cannot_keep_account_and_delete_data' + def __repr__(self): return 'MembersRemoveError(%r, %r)' % (self._tag, self._value) @@ -10391,6 +10995,7 @@ def __init__(self, email_verified=None, status=None, name=None, + membership_type=None, groups=None, external_id=None): super(TeamMemberProfile, self).__init__(team_member_id, @@ -10398,6 +11003,7 @@ def __init__(self, email_verified, status, name, + membership_type, external_id) self._groups_value = None self._groups_present = False @@ -10428,12 +11034,13 @@ def groups(self): self._groups_present = False def __repr__(self): - return 'TeamMemberProfile(team_member_id={!r}, email={!r}, email_verified={!r}, status={!r}, name={!r}, groups={!r}, external_id={!r})'.format( + return 'TeamMemberProfile(team_member_id={!r}, email={!r}, email_verified={!r}, status={!r}, name={!r}, membership_type={!r}, groups={!r}, external_id={!r})'.format( self._team_member_id_value, self._email_value, self._email_verified_value, self._status_value, self._name_value, + self._membership_type_value, self._groups_value, self._external_id_value, ) @@ -10492,6 +11099,45 @@ def __repr__(self): TeamMemberStatus_validator = bv.Union(TeamMemberStatus) +class TeamMembershipType(bb.Union): + """ + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + + :ivar full: User uses a license and has full access to team resources like + the shared quota. + :ivar limited: User does not have access to the shared quota and team admins + have restricted administrative control. + """ + + _catch_all = None + # Attribute is overwritten below the class definition + full = None + # Attribute is overwritten below the class definition + limited = None + + def is_full(self): + """ + Check if the union tag is ``full``. + + :rtype: bool + """ + return self._tag == 'full' + + def is_limited(self): + """ + Check if the union tag is ``limited``. + + :rtype: bool + """ + return self._tag == 'limited' + + def __repr__(self): + return 'TeamMembershipType(%r, %r)' % (self._tag, self._value) + +TeamMembershipType_validator = bv.Union(TeamMembershipType) + class UpdatePropertyTemplateArg(object): """ :ivar template_id: An identifier for property template added by @@ -10922,7 +11568,7 @@ def __repr__(self): UsersSelectorArg_validator = bv.Union(UsersSelectorArg) -GroupId_validator = bv.String() +AlphaGroupsGetInfoResult_validator = bv.List(AlphaGroupsGetInfoItem_validator) GroupsGetInfoResult_validator = bv.List(GroupsGetInfoItem_validator) MemberExternalId_validator = bv.String(max_length=64) MembersGetInfoResult_validator = bv.List(MembersGetInfoItem_validator) @@ -10985,6 +11631,75 @@ def __repr__(self): AdminTier.support_admin = AdminTier('support_admin') AdminTier.member_only = AdminTier('member_only') +GroupCreateArg._group_name_validator = bv.String() +GroupCreateArg._group_external_id_validator = bv.Nullable(bv.String()) +GroupCreateArg._all_field_names_ = set([ + 'group_name', + 'group_external_id', +]) +GroupCreateArg._all_fields_ = [ + ('group_name', GroupCreateArg._group_name_validator), + ('group_external_id', GroupCreateArg._group_external_id_validator), +] + +AlphaGroupCreateArg._group_management_type_validator = team_common.GroupManagementType_validator +AlphaGroupCreateArg._all_field_names_ = GroupCreateArg._all_field_names_.union(set(['group_management_type'])) +AlphaGroupCreateArg._all_fields_ = GroupCreateArg._all_fields_ + [('group_management_type', AlphaGroupCreateArg._group_management_type_validator)] + +AlphaGroupFullInfo._members_validator = bv.Nullable(bv.List(GroupMemberInfo_validator)) +AlphaGroupFullInfo._created_validator = bv.UInt64() +AlphaGroupFullInfo._all_field_names_ = team_common.AlphaGroupSummary._all_field_names_.union(set([ + 'members', + 'created', +])) +AlphaGroupFullInfo._all_fields_ = team_common.AlphaGroupSummary._all_fields_ + [ + ('members', AlphaGroupFullInfo._members_validator), + ('created', AlphaGroupFullInfo._created_validator), +] + +IncludeMembersArg._return_members_validator = bv.Boolean() +IncludeMembersArg._all_field_names_ = set(['return_members']) +IncludeMembersArg._all_fields_ = [('return_members', IncludeMembersArg._return_members_validator)] + +GroupUpdateArgs._group_validator = GroupSelector_validator +GroupUpdateArgs._new_group_name_validator = bv.Nullable(bv.String()) +GroupUpdateArgs._new_group_external_id_validator = bv.Nullable(bv.String()) +GroupUpdateArgs._all_field_names_ = IncludeMembersArg._all_field_names_.union(set([ + 'group', + 'new_group_name', + 'new_group_external_id', +])) +GroupUpdateArgs._all_fields_ = IncludeMembersArg._all_fields_ + [ + ('group', GroupUpdateArgs._group_validator), + ('new_group_name', GroupUpdateArgs._new_group_name_validator), + ('new_group_external_id', GroupUpdateArgs._new_group_external_id_validator), +] + +AlphaGroupUpdateArgs._new_group_management_type_validator = bv.Nullable(team_common.GroupManagementType_validator) +AlphaGroupUpdateArgs._all_field_names_ = GroupUpdateArgs._all_field_names_.union(set(['new_group_management_type'])) +AlphaGroupUpdateArgs._all_fields_ = GroupUpdateArgs._all_fields_ + [('new_group_management_type', AlphaGroupUpdateArgs._new_group_management_type_validator)] + +AlphaGroupsGetInfoItem._id_not_found_validator = bv.String() +AlphaGroupsGetInfoItem._group_info_validator = AlphaGroupFullInfo_validator +AlphaGroupsGetInfoItem._tagmap = { + 'id_not_found': AlphaGroupsGetInfoItem._id_not_found_validator, + 'group_info': AlphaGroupsGetInfoItem._group_info_validator, +} + +AlphaGroupsListResult._groups_validator = bv.List(team_common.AlphaGroupSummary_validator) +AlphaGroupsListResult._cursor_validator = bv.String() +AlphaGroupsListResult._has_more_validator = bv.Boolean() +AlphaGroupsListResult._all_field_names_ = set([ + 'groups', + 'cursor', + 'has_more', +]) +AlphaGroupsListResult._all_fields_ = [ + ('groups', AlphaGroupsListResult._groups_validator), + ('cursor', AlphaGroupsListResult._cursor_validator), + ('has_more', AlphaGroupsListResult._has_more_validator), +] + ApiApp._app_id_validator = bv.String() ApiApp._app_name_validator = bv.String() ApiApp._publisher_validator = bv.Nullable(bv.String()) @@ -11214,17 +11929,6 @@ def __repr__(self): GroupAccessType.member = GroupAccessType('member') GroupAccessType.owner = GroupAccessType('owner') -GroupCreateArg._group_name_validator = bv.String() -GroupCreateArg._group_external_id_validator = bv.Nullable(bv.String()) -GroupCreateArg._all_field_names_ = set([ - 'group_name', - 'group_external_id', -]) -GroupCreateArg._all_fields_ = [ - ('group_name', GroupCreateArg._group_name_validator), - ('group_external_id', GroupCreateArg._group_external_id_validator), -] - GroupCreateError._group_name_already_used_validator = bv.Void() GroupCreateError._group_name_invalid_validator = bv.Void() GroupCreateError._external_id_already_in_use_validator = bv.Void() @@ -11259,30 +11963,13 @@ def __repr__(self): GroupDeleteError.group_already_deleted = GroupDeleteError('group_already_deleted') -GroupSummary._group_name_validator = bv.String() -GroupSummary._group_id_validator = GroupId_validator -GroupSummary._group_external_id_validator = bv.Nullable(bv.String()) -GroupSummary._member_count_validator = bv.Nullable(bv.UInt32()) -GroupSummary._all_field_names_ = set([ - 'group_name', - 'group_id', - 'group_external_id', - 'member_count', -]) -GroupSummary._all_fields_ = [ - ('group_name', GroupSummary._group_name_validator), - ('group_id', GroupSummary._group_id_validator), - ('group_external_id', GroupSummary._group_external_id_validator), - ('member_count', GroupSummary._member_count_validator), -] - GroupFullInfo._members_validator = bv.Nullable(bv.List(GroupMemberInfo_validator)) GroupFullInfo._created_validator = bv.UInt64() -GroupFullInfo._all_field_names_ = GroupSummary._all_field_names_.union(set([ +GroupFullInfo._all_field_names_ = team_common.GroupSummary._all_field_names_.union(set([ 'members', 'created', ])) -GroupFullInfo._all_fields_ = GroupSummary._all_fields_ + [ +GroupFullInfo._all_fields_ = team_common.GroupSummary._all_fields_ + [ ('members', GroupFullInfo._members_validator), ('created', GroupFullInfo._created_validator), ] @@ -11325,10 +12012,6 @@ def __repr__(self): GroupMemberSetAccessTypeError.user_cannot_be_manager_of_company_managed_group = GroupMemberSetAccessTypeError('user_cannot_be_manager_of_company_managed_group') -IncludeMembersArg._return_members_validator = bv.Boolean() -IncludeMembersArg._all_field_names_ = set(['return_members']) -IncludeMembersArg._all_fields_ = [('return_members', IncludeMembersArg._return_members_validator)] - GroupMembersAddArg._group_validator = GroupSelector_validator GroupMembersAddArg._members_validator = bv.List(MemberAccess_validator) GroupMembersAddArg._all_field_names_ = IncludeMembersArg._all_field_names_.union(set([ @@ -11420,40 +12103,13 @@ def __repr__(self): ('return_members', GroupMembersSetAccessTypeArg._return_members_validator), ] -GroupSelector._group_id_validator = GroupId_validator +GroupSelector._group_id_validator = team_common.GroupId_validator GroupSelector._group_external_id_validator = bv.String() GroupSelector._tagmap = { 'group_id': GroupSelector._group_id_validator, 'group_external_id': GroupSelector._group_external_id_validator, } -GroupType._team_validator = bv.Void() -GroupType._user_managed_validator = bv.Void() -GroupType._other_validator = bv.Void() -GroupType._tagmap = { - 'team': GroupType._team_validator, - 'user_managed': GroupType._user_managed_validator, - 'other': GroupType._other_validator, -} - -GroupType.team = GroupType('team') -GroupType.user_managed = GroupType('user_managed') -GroupType.other = GroupType('other') - -GroupUpdateArgs._group_validator = GroupSelector_validator -GroupUpdateArgs._new_group_name_validator = bv.Nullable(bv.String()) -GroupUpdateArgs._new_group_external_id_validator = bv.Nullable(bv.String()) -GroupUpdateArgs._all_field_names_ = IncludeMembersArg._all_field_names_.union(set([ - 'group', - 'new_group_name', - 'new_group_external_id', -])) -GroupUpdateArgs._all_fields_ = IncludeMembersArg._all_fields_ + [ - ('group', GroupUpdateArgs._group_validator), - ('new_group_name', GroupUpdateArgs._new_group_name_validator), - ('new_group_external_id', GroupUpdateArgs._new_group_external_id_validator), -] - GroupUpdateError._external_id_already_in_use_validator = bv.Void() GroupUpdateError._tagmap = { 'external_id_already_in_use': GroupUpdateError._external_id_already_in_use_validator, @@ -11497,7 +12153,7 @@ def __repr__(self): GroupsListContinueError.invalid_cursor = GroupsListContinueError('invalid_cursor') GroupsListContinueError.other = GroupsListContinueError('other') -GroupsListResult._groups_validator = bv.List(GroupSummary_validator) +GroupsListResult._groups_validator = bv.List(team_common.GroupSummary_validator) GroupsListResult._cursor_validator = bv.String() GroupsListResult._has_more_validator = bv.Boolean() GroupsListResult._all_field_names_ = set([ @@ -11511,6 +12167,45 @@ def __repr__(self): ('has_more', GroupsListResult._has_more_validator), ] +GroupsMembersListArg._group_validator = GroupSelector_validator +GroupsMembersListArg._limit_validator = bv.UInt32(min_value=1, max_value=1000) +GroupsMembersListArg._all_field_names_ = set([ + 'group', + 'limit', +]) +GroupsMembersListArg._all_fields_ = [ + ('group', GroupsMembersListArg._group_validator), + ('limit', GroupsMembersListArg._limit_validator), +] + +GroupsMembersListContinueArg._cursor_validator = bv.String() +GroupsMembersListContinueArg._all_field_names_ = set(['cursor']) +GroupsMembersListContinueArg._all_fields_ = [('cursor', GroupsMembersListContinueArg._cursor_validator)] + +GroupsMembersListContinueError._invalid_cursor_validator = bv.Void() +GroupsMembersListContinueError._other_validator = bv.Void() +GroupsMembersListContinueError._tagmap = { + 'invalid_cursor': GroupsMembersListContinueError._invalid_cursor_validator, + 'other': GroupsMembersListContinueError._other_validator, +} + +GroupsMembersListContinueError.invalid_cursor = GroupsMembersListContinueError('invalid_cursor') +GroupsMembersListContinueError.other = GroupsMembersListContinueError('other') + +GroupsMembersListResult._members_validator = bv.List(GroupMemberInfo_validator) +GroupsMembersListResult._cursor_validator = bv.String() +GroupsMembersListResult._has_more_validator = bv.Boolean() +GroupsMembersListResult._all_field_names_ = set([ + 'members', + 'cursor', + 'has_more', +]) +GroupsMembersListResult._all_fields_ = [ + ('members', GroupsMembersListResult._members_validator), + ('cursor', GroupsMembersListResult._cursor_validator), + ('has_more', GroupsMembersListResult._has_more_validator), +] + GroupsPollError._access_denied_validator = bv.Void() GroupsPollError._tagmap = { 'access_denied': GroupsPollError._access_denied_validator, @@ -11519,7 +12214,7 @@ def __repr__(self): GroupsPollError.access_denied = GroupsPollError('access_denied') -GroupsSelector._group_ids_validator = bv.List(GroupId_validator) +GroupsSelector._group_ids_validator = bv.List(team_common.GroupId_validator) GroupsSelector._group_external_ids_validator = bv.List(bv.String()) GroupsSelector._tagmap = { 'group_ids': GroupsSelector._group_ids_validator, @@ -11812,6 +12507,7 @@ def __repr__(self): MemberProfile._email_verified_validator = bv.Boolean() MemberProfile._status_validator = TeamMemberStatus_validator MemberProfile._name_validator = users.Name_validator +MemberProfile._membership_type_validator = TeamMembershipType_validator MemberProfile._all_field_names_ = set([ 'team_member_id', 'external_id', @@ -11819,6 +12515,7 @@ def __repr__(self): 'email_verified', 'status', 'name', + 'membership_type', ]) MemberProfile._all_fields_ = [ ('team_member_id', MemberProfile._team_member_id_validator), @@ -11827,6 +12524,7 @@ def __repr__(self): ('email_verified', MemberProfile._email_verified_validator), ('status', MemberProfile._status_validator), ('name', MemberProfile._name_validator), + ('membership_type', MemberProfile._membership_type_validator), ] UserSelectorError._user_not_found_validator = bv.Void() @@ -11950,13 +12648,16 @@ def __repr__(self): MembersRemoveArg._transfer_dest_id_validator = bv.Nullable(UserSelectorArg_validator) MembersRemoveArg._transfer_admin_id_validator = bv.Nullable(UserSelectorArg_validator) +MembersRemoveArg._keep_account_validator = bv.Boolean() MembersRemoveArg._all_field_names_ = MembersDeactivateArg._all_field_names_.union(set([ 'transfer_dest_id', 'transfer_admin_id', + 'keep_account', ])) MembersRemoveArg._all_fields_ = MembersDeactivateArg._all_fields_ + [ ('transfer_dest_id', MembersRemoveArg._transfer_dest_id_validator), ('transfer_admin_id', MembersRemoveArg._transfer_admin_id_validator), + ('keep_account', MembersRemoveArg._keep_account_validator), ] MembersRemoveError._remove_last_admin_validator = bv.Void() @@ -11968,6 +12669,8 @@ def __repr__(self): MembersRemoveError._transfer_admin_user_not_in_team_validator = bv.Void() MembersRemoveError._unspecified_transfer_admin_id_validator = bv.Void() MembersRemoveError._transfer_admin_is_not_admin_validator = bv.Void() +MembersRemoveError._cannot_keep_account_and_transfer_validator = bv.Void() +MembersRemoveError._cannot_keep_account_and_delete_data_validator = bv.Void() MembersRemoveError._tagmap = { 'remove_last_admin': MembersRemoveError._remove_last_admin_validator, 'removed_and_transfer_dest_should_differ': MembersRemoveError._removed_and_transfer_dest_should_differ_validator, @@ -11978,6 +12681,8 @@ def __repr__(self): 'transfer_admin_user_not_in_team': MembersRemoveError._transfer_admin_user_not_in_team_validator, 'unspecified_transfer_admin_id': MembersRemoveError._unspecified_transfer_admin_id_validator, 'transfer_admin_is_not_admin': MembersRemoveError._transfer_admin_is_not_admin_validator, + 'cannot_keep_account_and_transfer': MembersRemoveError._cannot_keep_account_and_transfer_validator, + 'cannot_keep_account_and_delete_data': MembersRemoveError._cannot_keep_account_and_delete_data_validator, } MembersRemoveError._tagmap.update(MembersDeactivateError._tagmap) @@ -11990,6 +12695,8 @@ def __repr__(self): MembersRemoveError.transfer_admin_user_not_in_team = MembersRemoveError('transfer_admin_user_not_in_team') MembersRemoveError.unspecified_transfer_admin_id = MembersRemoveError('unspecified_transfer_admin_id') MembersRemoveError.transfer_admin_is_not_admin = MembersRemoveError('transfer_admin_is_not_admin') +MembersRemoveError.cannot_keep_account_and_transfer = MembersRemoveError('cannot_keep_account_and_transfer') +MembersRemoveError.cannot_keep_account_and_delete_data = MembersRemoveError('cannot_keep_account_and_delete_data') MembersSendWelcomeError._other_validator = bv.Void() MembersSendWelcomeError._tagmap = { @@ -12305,7 +13012,7 @@ def __repr__(self): ('role', TeamMemberInfo._role_validator), ] -TeamMemberProfile._groups_validator = bv.List(GroupId_validator) +TeamMemberProfile._groups_validator = bv.List(team_common.GroupId_validator) TeamMemberProfile._all_field_names_ = MemberProfile._all_field_names_.union(set(['groups'])) TeamMemberProfile._all_fields_ = MemberProfile._all_fields_ + [('groups', TeamMemberProfile._groups_validator)] @@ -12322,6 +13029,16 @@ def __repr__(self): TeamMemberStatus.invited = TeamMemberStatus('invited') TeamMemberStatus.suspended = TeamMemberStatus('suspended') +TeamMembershipType._full_validator = bv.Void() +TeamMembershipType._limited_validator = bv.Void() +TeamMembershipType._tagmap = { + 'full': TeamMembershipType._full_validator, + 'limited': TeamMembershipType._limited_validator, +} + +TeamMembershipType.full = TeamMembershipType('full') +TeamMembershipType.limited = TeamMembershipType('limited') + UpdatePropertyTemplateArg._template_id_validator = properties.TemplateId_validator UpdatePropertyTemplateArg._name_validator = bv.Nullable(bv.String()) UpdatePropertyTemplateArg._description_validator = bv.Nullable(bv.String()) @@ -12361,14 +13078,59 @@ def __repr__(self): 'emails': UsersSelectorArg._emails_validator, } +alpha_groups_create = bb.Route( + 'alpha/groups/create', + False, + AlphaGroupCreateArg_validator, + AlphaGroupFullInfo_validator, + GroupCreateError_validator, + {'host': u'api', + 'style': u'rpc'}, +) +alpha_groups_get_info = bb.Route( + 'alpha/groups/get_info', + False, + GroupsSelector_validator, + AlphaGroupsGetInfoResult_validator, + GroupsGetInfoError_validator, + {'host': u'api', + 'style': u'rpc'}, +) +alpha_groups_list = bb.Route( + 'alpha/groups/list', + False, + GroupsListArg_validator, + AlphaGroupsListResult_validator, + bv.Void(), + {'host': u'api', + 'style': u'rpc'}, +) +alpha_groups_list_continue = bb.Route( + 'alpha/groups/list/continue', + False, + GroupsListContinueArg_validator, + AlphaGroupsListResult_validator, + GroupsListContinueError_validator, + {'host': u'api', + 'style': u'rpc'}, +) +alpha_groups_update = bb.Route( + 'alpha/groups/update', + False, + AlphaGroupUpdateArgs_validator, + AlphaGroupFullInfo_validator, + GroupUpdateError_validator, + {'host': u'api', + 'style': u'rpc'}, +) devices_list_member_devices = bb.Route( 'devices/list_member_devices', False, ListMemberDevicesArg_validator, ListMemberDevicesResult_validator, ListMemberDevicesError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) devices_list_members_devices = bb.Route( 'devices/list_members_devices', @@ -12376,8 +13138,8 @@ def __repr__(self): ListMembersDevicesArg_validator, ListMembersDevicesResult_validator, ListMembersDevicesError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) devices_list_team_devices = bb.Route( 'devices/list_team_devices', @@ -12385,8 +13147,8 @@ def __repr__(self): ListTeamDevicesArg_validator, ListTeamDevicesResult_validator, ListTeamDevicesError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) devices_revoke_device_session = bb.Route( 'devices/revoke_device_session', @@ -12394,8 +13156,8 @@ def __repr__(self): RevokeDeviceSessionArg_validator, bv.Void(), RevokeDeviceSessionError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) devices_revoke_device_session_batch = bb.Route( 'devices/revoke_device_session_batch', @@ -12403,8 +13165,8 @@ def __repr__(self): RevokeDeviceSessionBatchArg_validator, RevokeDeviceSessionBatchResult_validator, RevokeDeviceSessionBatchError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) get_info = bb.Route( 'get_info', @@ -12412,8 +13174,8 @@ def __repr__(self): bv.Void(), TeamGetInfoResult_validator, bv.Void(), - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) groups_create = bb.Route( 'groups/create', @@ -12421,8 +13183,8 @@ def __repr__(self): GroupCreateArg_validator, GroupFullInfo_validator, GroupCreateError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) groups_delete = bb.Route( 'groups/delete', @@ -12430,8 +13192,8 @@ def __repr__(self): GroupSelector_validator, async.LaunchEmptyResult_validator, GroupDeleteError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) groups_get_info = bb.Route( 'groups/get_info', @@ -12439,8 +13201,8 @@ def __repr__(self): GroupsSelector_validator, GroupsGetInfoResult_validator, GroupsGetInfoError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) groups_job_status_get = bb.Route( 'groups/job_status/get', @@ -12448,8 +13210,8 @@ def __repr__(self): async.PollArg_validator, async.PollEmptyResult_validator, GroupsPollError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) groups_list = bb.Route( 'groups/list', @@ -12457,8 +13219,8 @@ def __repr__(self): GroupsListArg_validator, GroupsListResult_validator, bv.Void(), - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) groups_list_continue = bb.Route( 'groups/list/continue', @@ -12466,8 +13228,8 @@ def __repr__(self): GroupsListContinueArg_validator, GroupsListResult_validator, GroupsListContinueError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) groups_members_add = bb.Route( 'groups/members/add', @@ -12475,8 +13237,26 @@ def __repr__(self): GroupMembersAddArg_validator, GroupMembersChangeResult_validator, GroupMembersAddError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, +) +groups_members_list = bb.Route( + 'groups/members/list', + False, + GroupsMembersListArg_validator, + GroupsMembersListResult_validator, + GroupSelectorError_validator, + {'host': u'api', + 'style': u'rpc'}, +) +groups_members_list_continue = bb.Route( + 'groups/members/list/continue', + False, + GroupsMembersListContinueArg_validator, + GroupsMembersListResult_validator, + GroupsMembersListContinueError_validator, + {'host': u'api', + 'style': u'rpc'}, ) groups_members_remove = bb.Route( 'groups/members/remove', @@ -12484,8 +13264,8 @@ def __repr__(self): GroupMembersRemoveArg_validator, GroupMembersChangeResult_validator, GroupMembersRemoveError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) groups_members_set_access_type = bb.Route( 'groups/members/set_access_type', @@ -12493,8 +13273,8 @@ def __repr__(self): GroupMembersSetAccessTypeArg_validator, GroupsGetInfoResult_validator, GroupMemberSetAccessTypeError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) groups_update = bb.Route( 'groups/update', @@ -12502,8 +13282,8 @@ def __repr__(self): GroupUpdateArgs_validator, GroupFullInfo_validator, GroupUpdateError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) linked_apps_list_member_linked_apps = bb.Route( 'linked_apps/list_member_linked_apps', @@ -12511,8 +13291,8 @@ def __repr__(self): ListMemberAppsArg_validator, ListMemberAppsResult_validator, ListMemberAppsError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) linked_apps_list_members_linked_apps = bb.Route( 'linked_apps/list_members_linked_apps', @@ -12520,8 +13300,8 @@ def __repr__(self): ListMembersAppsArg_validator, ListMembersAppsResult_validator, ListMembersAppsError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) linked_apps_list_team_linked_apps = bb.Route( 'linked_apps/list_team_linked_apps', @@ -12529,8 +13309,8 @@ def __repr__(self): ListTeamAppsArg_validator, ListTeamAppsResult_validator, ListTeamAppsError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) linked_apps_revoke_linked_app = bb.Route( 'linked_apps/revoke_linked_app', @@ -12538,8 +13318,8 @@ def __repr__(self): RevokeLinkedApiAppArg_validator, bv.Void(), RevokeLinkedAppError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) linked_apps_revoke_linked_app_batch = bb.Route( 'linked_apps/revoke_linked_app_batch', @@ -12547,8 +13327,8 @@ def __repr__(self): RevokeLinkedApiAppBatchArg_validator, RevokeLinkedAppBatchResult_validator, RevokeLinkedAppBatchError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_add = bb.Route( 'members/add', @@ -12556,8 +13336,8 @@ def __repr__(self): MembersAddArg_validator, MembersAddLaunch_validator, bv.Void(), - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_add_job_status_get = bb.Route( 'members/add/job_status/get', @@ -12565,8 +13345,8 @@ def __repr__(self): async.PollArg_validator, MembersAddJobStatus_validator, async.PollError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_get_info = bb.Route( 'members/get_info', @@ -12574,8 +13354,8 @@ def __repr__(self): MembersGetInfoArgs_validator, MembersGetInfoResult_validator, MembersGetInfoError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_list = bb.Route( 'members/list', @@ -12583,8 +13363,8 @@ def __repr__(self): MembersListArg_validator, MembersListResult_validator, MembersListError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_list_continue = bb.Route( 'members/list/continue', @@ -12592,8 +13372,8 @@ def __repr__(self): MembersListContinueArg_validator, MembersListResult_validator, MembersListContinueError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_remove = bb.Route( 'members/remove', @@ -12601,8 +13381,8 @@ def __repr__(self): MembersRemoveArg_validator, async.LaunchEmptyResult_validator, MembersRemoveError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_remove_job_status_get = bb.Route( 'members/remove/job_status/get', @@ -12610,8 +13390,8 @@ def __repr__(self): async.PollArg_validator, async.PollEmptyResult_validator, async.PollError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_send_welcome_email = bb.Route( 'members/send_welcome_email', @@ -12619,8 +13399,8 @@ def __repr__(self): UserSelectorArg_validator, bv.Void(), MembersSendWelcomeError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_set_admin_permissions = bb.Route( 'members/set_admin_permissions', @@ -12628,8 +13408,8 @@ def __repr__(self): MembersSetPermissionsArg_validator, MembersSetPermissionsResult_validator, MembersSetPermissionsError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_set_profile = bb.Route( 'members/set_profile', @@ -12637,8 +13417,8 @@ def __repr__(self): MembersSetProfileArg_validator, TeamMemberInfo_validator, MembersSetProfileError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_suspend = bb.Route( 'members/suspend', @@ -12646,8 +13426,8 @@ def __repr__(self): MembersDeactivateArg_validator, bv.Void(), MembersSuspendError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) members_unsuspend = bb.Route( 'members/unsuspend', @@ -12655,8 +13435,8 @@ def __repr__(self): MembersUnsuspendArg_validator, bv.Void(), MembersUnsuspendError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) properties_template_add = bb.Route( 'properties/template/add', @@ -12664,8 +13444,8 @@ def __repr__(self): AddPropertyTemplateArg_validator, AddPropertyTemplateResult_validator, properties.ModifyPropertyTemplateError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) properties_template_get = bb.Route( 'properties/template/get', @@ -12673,8 +13453,8 @@ def __repr__(self): properties.GetPropertyTemplateArg_validator, properties.GetPropertyTemplateResult_validator, properties.PropertyTemplateError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) properties_template_list = bb.Route( 'properties/template/list', @@ -12682,8 +13462,8 @@ def __repr__(self): bv.Void(), properties.ListPropertyTemplateIds_validator, properties.PropertyTemplateError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) properties_template_update = bb.Route( 'properties/template/update', @@ -12691,8 +13471,8 @@ def __repr__(self): UpdatePropertyTemplateArg_validator, UpdatePropertyTemplateResult_validator, properties.ModifyPropertyTemplateError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) reports_get_activity = bb.Route( 'reports/get_activity', @@ -12700,8 +13480,8 @@ def __repr__(self): DateRange_validator, GetActivityReport_validator, DateRangeError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) reports_get_devices = bb.Route( 'reports/get_devices', @@ -12709,8 +13489,8 @@ def __repr__(self): DateRange_validator, GetDevicesReport_validator, DateRangeError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) reports_get_membership = bb.Route( 'reports/get_membership', @@ -12718,8 +13498,8 @@ def __repr__(self): DateRange_validator, GetMembershipReport_validator, DateRangeError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) reports_get_storage = bb.Route( 'reports/get_storage', @@ -12727,11 +13507,16 @@ def __repr__(self): DateRange_validator, GetStorageReport_validator, DateRangeError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) ROUTES = { + 'alpha/groups/create': alpha_groups_create, + 'alpha/groups/get_info': alpha_groups_get_info, + 'alpha/groups/list': alpha_groups_list, + 'alpha/groups/list/continue': alpha_groups_list_continue, + 'alpha/groups/update': alpha_groups_update, 'devices/list_member_devices': devices_list_member_devices, 'devices/list_members_devices': devices_list_members_devices, 'devices/list_team_devices': devices_list_team_devices, @@ -12745,6 +13530,8 @@ def __repr__(self): 'groups/list': groups_list, 'groups/list/continue': groups_list_continue, 'groups/members/add': groups_members_add, + 'groups/members/list': groups_members_list, + 'groups/members/list/continue': groups_members_list_continue, 'groups/members/remove': groups_members_remove, 'groups/members/set_access_type': groups_members_set_access_type, 'groups/update': groups_update, diff --git a/dropbox/team_common.py b/dropbox/team_common.py new file mode 100644 index 00000000..90ab0bf7 --- /dev/null +++ b/dropbox/team_common.py @@ -0,0 +1,373 @@ +# -*- coding: utf-8 -*- +# Auto-generated by Stone, do not modify. +try: + from . import stone_validators as bv + from . import stone_base as bb +except (SystemError, ValueError): + # Catch errors raised when importing a relative module when not in a package. + # This makes testing this file directly (outside of a package) easier. + import stone_validators as bv + import stone_base as bb + +class GroupSummary(object): + """ + Information about a group. + + :ivar group_external_id: External ID of group. This is an arbitrary ID that + an admin can attach to a group. + :ivar member_count: The number of members in the group. + """ + + __slots__ = [ + '_group_name_value', + '_group_name_present', + '_group_id_value', + '_group_id_present', + '_group_external_id_value', + '_group_external_id_present', + '_member_count_value', + '_member_count_present', + ] + + _has_required_fields = True + + def __init__(self, + group_name=None, + group_id=None, + group_external_id=None, + member_count=None): + self._group_name_value = None + self._group_name_present = False + self._group_id_value = None + self._group_id_present = False + self._group_external_id_value = None + self._group_external_id_present = False + self._member_count_value = None + self._member_count_present = False + if group_name is not None: + self.group_name = group_name + if group_id is not None: + self.group_id = group_id + if group_external_id is not None: + self.group_external_id = group_external_id + if member_count is not None: + self.member_count = member_count + + @property + def group_name(self): + """ + :rtype: str + """ + if self._group_name_present: + return self._group_name_value + else: + raise AttributeError("missing required field 'group_name'") + + @group_name.setter + def group_name(self, val): + val = self._group_name_validator.validate(val) + self._group_name_value = val + self._group_name_present = True + + @group_name.deleter + def group_name(self): + self._group_name_value = None + self._group_name_present = False + + @property + def group_id(self): + """ + :rtype: str + """ + if self._group_id_present: + return self._group_id_value + else: + raise AttributeError("missing required field 'group_id'") + + @group_id.setter + def group_id(self, val): + val = self._group_id_validator.validate(val) + self._group_id_value = val + self._group_id_present = True + + @group_id.deleter + def group_id(self): + self._group_id_value = None + self._group_id_present = False + + @property + def group_external_id(self): + """ + External ID of group. This is an arbitrary ID that an admin can attach + to a group. + + :rtype: str + """ + if self._group_external_id_present: + return self._group_external_id_value + else: + return None + + @group_external_id.setter + def group_external_id(self, val): + if val is None: + del self.group_external_id + return + val = self._group_external_id_validator.validate(val) + self._group_external_id_value = val + self._group_external_id_present = True + + @group_external_id.deleter + def group_external_id(self): + self._group_external_id_value = None + self._group_external_id_present = False + + @property + def member_count(self): + """ + The number of members in the group. + + :rtype: long + """ + if self._member_count_present: + return self._member_count_value + else: + return None + + @member_count.setter + def member_count(self, val): + if val is None: + del self.member_count + return + val = self._member_count_validator.validate(val) + self._member_count_value = val + self._member_count_present = True + + @member_count.deleter + def member_count(self): + self._member_count_value = None + self._member_count_present = False + + def __repr__(self): + return 'GroupSummary(group_name={!r}, group_id={!r}, group_external_id={!r}, member_count={!r})'.format( + self._group_name_value, + self._group_id_value, + self._group_external_id_value, + self._member_count_value, + ) + +GroupSummary_validator = bv.Struct(GroupSummary) + +class AlphaGroupSummary(GroupSummary): + """ + Information about a group. + + :ivar group_management_type: Who is allowed to manage the group. + """ + + __slots__ = [ + '_group_management_type_value', + '_group_management_type_present', + ] + + _has_required_fields = True + + def __init__(self, + group_name=None, + group_id=None, + group_management_type=None, + group_external_id=None, + member_count=None): + super(AlphaGroupSummary, self).__init__(group_name, + group_id, + group_external_id, + member_count) + self._group_management_type_value = None + self._group_management_type_present = False + if group_management_type is not None: + self.group_management_type = group_management_type + + @property + def group_management_type(self): + """ + Who is allowed to manage the group. + + :rtype: GroupManagementType + """ + if self._group_management_type_present: + return self._group_management_type_value + else: + raise AttributeError("missing required field 'group_management_type'") + + @group_management_type.setter + def group_management_type(self, val): + self._group_management_type_validator.validate_type_only(val) + self._group_management_type_value = val + self._group_management_type_present = True + + @group_management_type.deleter + def group_management_type(self): + self._group_management_type_value = None + self._group_management_type_present = False + + def __repr__(self): + return 'AlphaGroupSummary(group_name={!r}, group_id={!r}, group_management_type={!r}, group_external_id={!r}, member_count={!r})'.format( + self._group_name_value, + self._group_id_value, + self._group_management_type_value, + self._group_external_id_value, + self._member_count_value, + ) + +AlphaGroupSummary_validator = bv.Struct(AlphaGroupSummary) + +class GroupManagementType(bb.Union): + """ + The group type determines how a group is managed. + + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + + :ivar company_managed: A group which is managed by team admins only. + :ivar user_managed: A group which is managed by selected users. + """ + + _catch_all = 'other' + # Attribute is overwritten below the class definition + company_managed = None + # Attribute is overwritten below the class definition + user_managed = None + # Attribute is overwritten below the class definition + other = None + + def is_company_managed(self): + """ + Check if the union tag is ``company_managed``. + + :rtype: bool + """ + return self._tag == 'company_managed' + + def is_user_managed(self): + """ + Check if the union tag is ``user_managed``. + + :rtype: bool + """ + return self._tag == 'user_managed' + + def is_other(self): + """ + Check if the union tag is ``other``. + + :rtype: bool + """ + return self._tag == 'other' + + def __repr__(self): + return 'GroupManagementType(%r, %r)' % (self._tag, self._value) + +GroupManagementType_validator = bv.Union(GroupManagementType) + +class GroupType(bb.Union): + """ + The group type determines how a group is created and managed. + + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + + :ivar team: A group to which team members are automatically added. + Applicable to `team folders `_ only. + :ivar user_managed: A group is created and managed by a user. + """ + + _catch_all = 'other' + # Attribute is overwritten below the class definition + team = None + # Attribute is overwritten below the class definition + user_managed = None + # Attribute is overwritten below the class definition + other = None + + def is_team(self): + """ + Check if the union tag is ``team``. + + :rtype: bool + """ + return self._tag == 'team' + + def is_user_managed(self): + """ + Check if the union tag is ``user_managed``. + + :rtype: bool + """ + return self._tag == 'user_managed' + + def is_other(self): + """ + Check if the union tag is ``other``. + + :rtype: bool + """ + return self._tag == 'other' + + def __repr__(self): + return 'GroupType(%r, %r)' % (self._tag, self._value) + +GroupType_validator = bv.Union(GroupType) + +GroupId_validator = bv.String() +GroupSummary._group_name_validator = bv.String() +GroupSummary._group_id_validator = GroupId_validator +GroupSummary._group_external_id_validator = bv.Nullable(bv.String()) +GroupSummary._member_count_validator = bv.Nullable(bv.UInt32()) +GroupSummary._all_field_names_ = set([ + 'group_name', + 'group_id', + 'group_external_id', + 'member_count', +]) +GroupSummary._all_fields_ = [ + ('group_name', GroupSummary._group_name_validator), + ('group_id', GroupSummary._group_id_validator), + ('group_external_id', GroupSummary._group_external_id_validator), + ('member_count', GroupSummary._member_count_validator), +] + +AlphaGroupSummary._group_management_type_validator = GroupManagementType_validator +AlphaGroupSummary._all_field_names_ = GroupSummary._all_field_names_.union(set(['group_management_type'])) +AlphaGroupSummary._all_fields_ = GroupSummary._all_fields_ + [('group_management_type', AlphaGroupSummary._group_management_type_validator)] + +GroupManagementType._company_managed_validator = bv.Void() +GroupManagementType._user_managed_validator = bv.Void() +GroupManagementType._other_validator = bv.Void() +GroupManagementType._tagmap = { + 'company_managed': GroupManagementType._company_managed_validator, + 'user_managed': GroupManagementType._user_managed_validator, + 'other': GroupManagementType._other_validator, +} + +GroupManagementType.company_managed = GroupManagementType('company_managed') +GroupManagementType.user_managed = GroupManagementType('user_managed') +GroupManagementType.other = GroupManagementType('other') + +GroupType._team_validator = bv.Void() +GroupType._user_managed_validator = bv.Void() +GroupType._other_validator = bv.Void() +GroupType._tagmap = { + 'team': GroupType._team_validator, + 'user_managed': GroupType._user_managed_validator, + 'other': GroupType._other_validator, +} + +GroupType.team = GroupType('team') +GroupType.user_managed = GroupType('user_managed') +GroupType.other = GroupType('other') + +ROUTES = { +} + diff --git a/dropbox/users.py b/dropbox/users.py index 9f77ac07..6c235e3f 100644 --- a/dropbox/users.py +++ b/dropbox/users.py @@ -1653,8 +1653,8 @@ def __repr__(self): GetAccountArg_validator, BasicAccount_validator, GetAccountError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) get_account_batch = bb.Route( 'get_account_batch', @@ -1662,8 +1662,8 @@ def __repr__(self): GetAccountBatchArg_validator, GetAccountBatchResult_validator, GetAccountBatchError_validator, - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) get_current_account = bb.Route( 'get_current_account', @@ -1671,8 +1671,8 @@ def __repr__(self): bv.Void(), FullAccount_validator, bv.Void(), - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) get_space_usage = bb.Route( 'get_space_usage', @@ -1680,8 +1680,8 @@ def __repr__(self): bv.Void(), SpaceUsage_validator, bv.Void(), - {'host': None, - 'style': None}, + {'host': u'api', + 'style': u'rpc'}, ) ROUTES = { diff --git a/spec b/spec index 630d02fc..9e1fa64b 160000 --- a/spec +++ b/spec @@ -1 +1 @@ -Subproject commit 630d02fc53a8ce3e9b983119da869fa1e7cf17bf +Subproject commit 9e1fa64bef9edd8ae4f99cb55e382fdb4aecbdc0 diff --git a/stone b/stone index 0fa27d37..86d2062f 160000 --- a/stone +++ b/stone @@ -1 +1 @@ -Subproject commit 0fa27d37cf7be05a465e1fcb751bd9329fde5cc3 +Subproject commit 86d2062f5a35b4829e3112337a2f8545e384818a