diff --git a/docs/conf.py b/docs/conf.py index 8928430b..f14a9d1d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -59,9 +59,9 @@ # built documents. # # The short X.Y version. -version = '5.2.2' +version = '6.0' # The full version, including alpha/beta/rc tags. -release = '5.2.2' +release = '6.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/dropbox/base.py b/dropbox/base.py index e46437ee..b77d3da1 100644 --- a/dropbox/base.py +++ b/dropbox/base.py @@ -111,8 +111,8 @@ def files_download(self, Download a file from a user's Dropbox. :param str path: The path of the file to download. - :param Nullable rev: Deprecated. Please specify revision in - :field:'path' instead + :param Nullable rev: Deprecated. Please specify revision in ``path`` + instead :rtype: (:class:`dropbox.files.FileMetadata`, :class:`requests.models.Response`) :raises: :class:`dropbox.exceptions.ApiError` @@ -149,8 +149,8 @@ def files_download_to_file(self, :param str download_path: Path on local machine to save file. :param str path: The path of the file to download. - :param Nullable rev: Deprecated. Please specify revision in - :field:'path' instead + :param Nullable rev: Deprecated. Please specify revision in ``path`` + instead :rtype: (:class:`dropbox.files.FileMetadata`, :class:`requests.models.Response`) :raises: :class:`dropbox.exceptions.ApiError` @@ -177,11 +177,12 @@ def files_get_metadata(self, path, include_media_info=False): """ - Returns the metadata for a file or folder. + Returns the metadata for a file or folder. Note: Metadata for the root + folder is unsupported. - :param str path: The path of a file or folder on Dropbox - :param bool include_media_info: If true, - :field:'FileMetadata.media_info' is set for photo and video. + :param str path: The path of a file or folder on Dropbox. + :param bool include_media_info: If true, ``FileMetadata.media_info`` is + set for photo and video. :rtype: :class:`dropbox.files.Metadata` :raises: :class:`dropbox.exceptions.ApiError` @@ -211,8 +212,8 @@ def files_get_preview(self, .ppsx, .ppsm, .pptx, .pptm, .xls, .xlsx, .xlsm, .rtf :param str path: The path of the file to preview. - :param Nullable rev: Deprecated. Please specify revision in - :field:'path' instead + :param Nullable rev: Deprecated. Please specify revision in ``path`` + instead :rtype: (:class:`dropbox.files.FileMetadata`, :class:`requests.models.Response`) :raises: :class:`dropbox.exceptions.ApiError` @@ -251,8 +252,8 @@ def files_get_preview_to_file(self, :param str download_path: Path on local machine to save file. :param str path: The path of the file to preview. - :param Nullable rev: Deprecated. Please specify revision in - :field:'path' instead + :param Nullable rev: Deprecated. Please specify revision in ``path`` + instead :rtype: (:class:`dropbox.files.FileMetadata`, :class:`requests.models.Response`) :raises: :class:`dropbox.exceptions.ApiError` @@ -374,8 +375,8 @@ def files_list_folder(self, :param bool recursive: If true, the list folder operation will be applied recursively to all subfolders and the response will contain contents of all subfolders. - :param bool include_media_info: If true, - :field:'FileMetadata.media_info' is set for photo and video. + :param bool include_media_info: If true, ``FileMetadata.media_info`` is + set for photo and video. :param bool include_deleted: If true, the results will include entries for files and folders that used to exist but were deleted. :rtype: :class:`dropbox.files.ListFolderResult` @@ -443,8 +444,8 @@ def files_list_folder_get_latest_cursor(self, :param bool recursive: If true, the list folder operation will be applied recursively to all subfolders and the response will contain contents of all subfolders. - :param bool include_media_info: If true, - :field:'FileMetadata.media_info' is set for photo and video. + :param bool include_media_info: If true, ``FileMetadata.media_info`` is + set for photo and video. :param bool include_deleted: If true, the results will include entries for files and folders that used to exist but were deleted. :rtype: :class:`dropbox.files.ListFolderGetLatestCursorResult` @@ -996,7 +997,8 @@ def sharing_get_folder_metadata(self, and is subject to minor but possibly backwards-incompatible changes. :param str shared_folder_id: The ID for the shared folder. - :param Nullable actions: Folder actions to query. + :param Nullable actions: Folder actions to query. This field is + optional. :rtype: :class:`dropbox.sharing.SharedFolderMetadata` :raises: :class:`dropbox.exceptions.ApiError` @@ -1163,14 +1165,18 @@ def sharing_get_shared_links(self, def sharing_list_folder_members(self, shared_folder_id, - actions=None): + actions=None, + limit=1000): """ Returns shared folder membership by its folder ID. Apps must have full Dropbox access to use this endpoint. Warning: This endpoint is in beta and is subject to minor but possibly backwards-incompatible changes. :param str shared_folder_id: The ID for the shared folder. - :param Nullable actions: Member actions to query. + :param Nullable actions: Member actions to query. This field is + optional. + :param long limit: The maximum number of results that include members, + groups and invitees to return per request. :rtype: :class:`dropbox.sharing.SharedFolderMembers` :raises: :class:`dropbox.exceptions.ApiError` @@ -1178,7 +1184,8 @@ def sharing_list_folder_members(self, :class:`dropbox.sharing.SharedFolderAccessError` """ arg = sharing.ListFolderMembersArgs(shared_folder_id, - actions) + actions, + limit) r = self.request( 'api', 'sharing/list_folder_members', @@ -1220,21 +1227,27 @@ def sharing_list_folder_members_continue(self, ) return r - def sharing_list_folders(self): + def sharing_list_folders(self, + limit=1000, + actions=None): """ Return the list of all shared folders the current user has access to. Apps must have full Dropbox access to use this endpoint. Warning: This endpoint is in beta and is subject to minor but possibly backwards-incompatible changes. + :param long limit: The maximum number of results to return per request. + :param Nullable actions: Folder actions to query. This field is + optional. :rtype: :class:`dropbox.sharing.ListFoldersResult` """ - arg = None + arg = sharing.ListFoldersArgs(limit, + actions) r = self.request( 'api', 'sharing/list_folders', 'rpc', - bv.Void(), + bv.Struct(sharing.ListFoldersArgs), bv.Struct(sharing.ListFoldersResult), bv.Void(), arg, @@ -1271,19 +1284,76 @@ def sharing_list_folders_continue(self, ) return r + def sharing_list_mountable_folders(self, + limit=1000, + actions=None): + """ + Return the list of all shared folders the current user can mount or + unmount. Apps must have full Dropbox access to use this endpoint. + + :param long limit: The maximum number of results to return per request. + :param Nullable actions: Folder actions to query. This field is + optional. + :rtype: :class:`dropbox.sharing.ListFoldersResult` + """ + arg = sharing.ListFoldersArgs(limit, + actions) + r = self.request( + 'api', + 'sharing/list_mountable_folders', + 'rpc', + bv.Struct(sharing.ListFoldersArgs), + bv.Struct(sharing.ListFoldersResult), + bv.Void(), + arg, + None, + ) + return r + + def sharing_list_mountable_folders_continue(self, + cursor): + """ + Once a cursor has been retrieved from :meth:`list_mountable_folders`, + use this to paginate through all mountable shared folders. Apps must + have full Dropbox access to use this endpoint. + + :param str cursor: The cursor returned by your last call to + :meth:`list_folders` or :meth:`list_folders_continue`. + :rtype: :class:`dropbox.sharing.ListFoldersResult` + :raises: :class:`dropbox.exceptions.ApiError` + + If this raises, ApiError.reason is of type: + :class:`dropbox.sharing.ListFoldersContinueError` + """ + arg = sharing.ListFoldersContinueArg(cursor) + r = self.request( + 'api', + 'sharing/list_mountable_folders/continue', + 'rpc', + bv.Struct(sharing.ListFoldersContinueArg), + bv.Struct(sharing.ListFoldersResult), + bv.Union(sharing.ListFoldersContinueError), + arg, + None, + ) + return r + def sharing_list_shared_links(self, path=None, - cursor=None): + cursor=None, + direct_only=None): """ List shared links of this user. If no path is given or the path is empty, returns a list of all shared links for the current user. If a non-empty path is given, returns a list of all shared links that allow access to the given path - direct links to the given path and links to - parent folders of the given path. + parent folders of the given path. Links to parent folders can be + suppressed by setting direct_only to true. :param Nullable path: See :meth:`list_shared_links` description. :param Nullable cursor: The cursor returned by your last call to :meth:`list_shared_links`. + :param Nullable direct_only: See :meth:`list_shared_links` description. :rtype: :class:`dropbox.sharing.ListSharedLinksResult` :raises: :class:`dropbox.exceptions.ApiError` @@ -1291,7 +1361,8 @@ def sharing_list_shared_links(self, :class:`dropbox.sharing.ListSharedLinksError` """ arg = sharing.ListSharedLinksArg(path, - cursor) + cursor, + direct_only) r = self.request( 'api', 'sharing/list_shared_links', diff --git a/dropbox/base_team.py b/dropbox/base_team.py index b2757fff..531f4bab 100644 --- a/dropbox/base_team.py +++ b/dropbox/base_team.py @@ -731,10 +731,9 @@ def team_members_remove(self, can be re-activated again. Calling :meth:`members_add` with the removed user's email address will create a new account with a new team_member_id that will not have access to any content that was shared with the - initial account. This endpoint can also be used to cancel a pending - invite to join the team. This endpoint may initiate an asynchronous job. - To obtain the final result of the job, the client should periodically - poll :meth:`members_remove_job_status_get`. + initial account. This endpoint may initiate an asynchronous job. To + obtain the final result of the job, the client should periodically poll + :meth:`members_remove_job_status_get`. :param Nullable transfer_dest_id: If provided, files from the deleted member account will be transferred to this user. diff --git a/dropbox/dropbox.py b/dropbox/dropbox.py index f8a9a519..2a7eca88 100644 --- a/dropbox/dropbox.py +++ b/dropbox/dropbox.py @@ -5,7 +5,7 @@ ] # TODO(kelkabany): We need to auto populate this as done in the v1 SDK. -__version__ = '5.2.2' +__version__ = '6.0' import contextlib import json diff --git a/dropbox/files.py b/dropbox/files.py index 9338597c..ce7e7dca 100644 --- a/dropbox/files.py +++ b/dropbox/files.py @@ -455,9 +455,14 @@ class Metadata(object): contains a slash. :ivar path_lower: The lowercased full path in the user's Dropbox. This always starts with a slash. + :ivar path_display: The cased path to be used for display purposes only. In + rare instances the casing will not correctly match the user's + filesystem, but this behavior will match the path provided in the Core + API v1. Changes to the casing of paths won't be returned by + list_folder/continue :ivar parent_shared_folder_id: Deprecated. Please use - :field:'FileSharingInfo.parent_shared_folder_id' or - :field:'FolderSharingInfo.parent_shared_folder_id' instead. + ``FileSharingInfo.parent_shared_folder_id`` or + ``FolderSharingInfo.parent_shared_folder_id`` instead. """ __slots__ = [ @@ -465,6 +470,8 @@ class Metadata(object): '_name_present', '_path_lower_value', '_path_lower_present', + '_path_display_value', + '_path_display_present', '_parent_shared_folder_id_value', '_parent_shared_folder_id_present', ] @@ -474,17 +481,22 @@ class Metadata(object): def __init__(self, name=None, path_lower=None, + path_display=None, parent_shared_folder_id=None): self._name_value = None self._name_present = False self._path_lower_value = None self._path_lower_present = False + self._path_display_value = None + self._path_display_present = False self._parent_shared_folder_id_value = None self._parent_shared_folder_id_present = False if name is not None: self.name = name if path_lower is not None: self.path_lower = path_lower + if path_display is not None: + self.path_display = path_display if parent_shared_folder_id is not None: self.parent_shared_folder_id = parent_shared_folder_id @@ -536,11 +548,37 @@ def path_lower(self): self._path_lower_value = None self._path_lower_present = False + @property + def path_display(self): + """ + The cased path to be used for display purposes only. In rare instances + the casing will not correctly match the user's filesystem, but this + behavior will match the path provided in the Core API v1. Changes to the + casing of paths won't be returned by list_folder/continue + + :rtype: str + """ + if self._path_display_present: + return self._path_display_value + else: + raise AttributeError("missing required field 'path_display'") + + @path_display.setter + def path_display(self, val): + val = self._path_display_validator.validate(val) + self._path_display_value = val + self._path_display_present = True + + @path_display.deleter + def path_display(self): + self._path_display_value = None + self._path_display_present = False + @property def parent_shared_folder_id(self): """ - Deprecated. Please use :field:'FileSharingInfo.parent_shared_folder_id' - or :field:'FolderSharingInfo.parent_shared_folder_id' instead. + Deprecated. Please use ``FileSharingInfo.parent_shared_folder_id`` or + ``FolderSharingInfo.parent_shared_folder_id`` instead. :rtype: str """ @@ -564,9 +602,10 @@ def parent_shared_folder_id(self): self._parent_shared_folder_id_present = False def __repr__(self): - return 'Metadata(name={!r}, path_lower={!r}, parent_shared_folder_id={!r})'.format( + return 'Metadata(name={!r}, path_lower={!r}, path_display={!r}, parent_shared_folder_id={!r})'.format( self._name_value, self._path_lower_value, + self._path_display_value, self._parent_shared_folder_id_value, ) @@ -584,15 +623,18 @@ class DeletedMetadata(Metadata): def __init__(self, name=None, path_lower=None, + path_display=None, parent_shared_folder_id=None): super(DeletedMetadata, self).__init__(name, path_lower, + path_display, parent_shared_folder_id) def __repr__(self): - return 'DeletedMetadata(name={!r}, path_lower={!r}, parent_shared_folder_id={!r})'.format( + return 'DeletedMetadata(name={!r}, path_lower={!r}, path_display={!r}, parent_shared_folder_id={!r})'.format( self._name_value, self._path_lower_value, + self._path_display_value, self._parent_shared_folder_id_value, ) @@ -680,7 +722,7 @@ def __repr__(self): class DownloadArg(object): """ :ivar path: The path of the file to download. - :ivar rev: Deprecated. Please specify revision in :field:'path' instead + :ivar rev: Deprecated. Please specify revision in ``path`` instead """ __slots__ = [ @@ -730,7 +772,7 @@ def path(self): @property def rev(self): """ - Deprecated. Please specify revision in :field:'path' instead + Deprecated. Please specify revision in ``path`` instead :rtype: str """ @@ -866,16 +908,18 @@ class FileMetadata(Metadata): def __init__(self, name=None, path_lower=None, + path_display=None, + id=None, client_modified=None, server_modified=None, rev=None, size=None, parent_shared_folder_id=None, - id=None, media_info=None, sharing_info=None): super(FileMetadata, self).__init__(name, path_lower, + path_display, parent_shared_folder_id) self._id_value = None self._id_present = False @@ -916,13 +960,10 @@ def id(self): if self._id_present: return self._id_value else: - return None + raise AttributeError("missing required field 'id'") @id.setter def id(self, val): - if val is None: - del self.id - return val = self._id_validator.validate(val) self._id_value = val self._id_present = True @@ -1083,15 +1124,16 @@ def sharing_info(self): self._sharing_info_present = False def __repr__(self): - return 'FileMetadata(name={!r}, path_lower={!r}, client_modified={!r}, server_modified={!r}, rev={!r}, size={!r}, parent_shared_folder_id={!r}, id={!r}, media_info={!r}, sharing_info={!r})'.format( + return 'FileMetadata(name={!r}, path_lower={!r}, path_display={!r}, id={!r}, client_modified={!r}, server_modified={!r}, rev={!r}, size={!r}, parent_shared_folder_id={!r}, media_info={!r}, sharing_info={!r})'.format( self._name_value, self._path_lower_value, + self._path_display_value, + self._id_value, self._client_modified_value, self._server_modified_value, self._rev_value, self._size_value, self._parent_shared_folder_id_value, - self._id_value, self._media_info_value, self._sharing_info_value, ) @@ -1238,8 +1280,7 @@ def __repr__(self): class FolderMetadata(Metadata): """ :ivar id: A unique identifier for the folder. - :ivar shared_folder_id: Deprecated. Please use :field:'sharing_info' - instead. + :ivar shared_folder_id: Deprecated. Please use ``sharing_info`` instead. :ivar sharing_info: Set if the folder is contained in a shared folder or is a shared folder mount point. """ @@ -1258,12 +1299,14 @@ class FolderMetadata(Metadata): def __init__(self, name=None, path_lower=None, - parent_shared_folder_id=None, + path_display=None, id=None, + parent_shared_folder_id=None, shared_folder_id=None, sharing_info=None): super(FolderMetadata, self).__init__(name, path_lower, + path_display, parent_shared_folder_id) self._id_value = None self._id_present = False @@ -1288,13 +1331,10 @@ def id(self): if self._id_present: return self._id_value else: - return None + raise AttributeError("missing required field 'id'") @id.setter def id(self, val): - if val is None: - del self.id - return val = self._id_validator.validate(val) self._id_value = val self._id_present = True @@ -1307,7 +1347,7 @@ def id(self): @property def shared_folder_id(self): """ - Deprecated. Please use :field:'sharing_info' instead. + Deprecated. Please use ``sharing_info`` instead. :rtype: str """ @@ -1358,11 +1398,12 @@ def sharing_info(self): self._sharing_info_present = False def __repr__(self): - return 'FolderMetadata(name={!r}, path_lower={!r}, parent_shared_folder_id={!r}, id={!r}, shared_folder_id={!r}, sharing_info={!r})'.format( + return 'FolderMetadata(name={!r}, path_lower={!r}, path_display={!r}, id={!r}, parent_shared_folder_id={!r}, shared_folder_id={!r}, sharing_info={!r})'.format( self._name_value, self._path_lower_value, - self._parent_shared_folder_id_value, + self._path_display_value, self._id_value, + self._parent_shared_folder_id_value, self._shared_folder_id_value, self._sharing_info_value, ) @@ -1463,9 +1504,9 @@ def __repr__(self): class GetMetadataArg(object): """ - :ivar path: The path of a file or folder on Dropbox - :ivar include_media_info: If true, :field:'FileMetadata.media_info' is set - for photo and video. + :ivar path: The path of a file or folder on Dropbox. + :ivar include_media_info: If true, ``FileMetadata.media_info`` is set for + photo and video. """ __slots__ = [ @@ -1492,7 +1533,7 @@ def __init__(self, @property def path(self): """ - The path of a file or folder on Dropbox + The path of a file or folder on Dropbox. :rtype: str """ @@ -1515,7 +1556,7 @@ def path(self): @property def include_media_info(self): """ - If true, :field:'FileMetadata.media_info' is set for photo and video. + If true, ``FileMetadata.media_info`` is set for photo and video. :rtype: bool """ @@ -1683,8 +1724,8 @@ class ListFolderArg(object): :ivar recursive: If true, the list folder operation will be applied recursively to all subfolders and the response will contain contents of all subfolders. - :ivar include_media_info: If true, :field:'FileMetadata.media_info' is set - for photo and video. + :ivar include_media_info: If true, ``FileMetadata.media_info`` is set for + photo and video. :ivar include_deleted: If true, the results will include entries for files and folders that used to exist but were deleted. """ @@ -1774,7 +1815,7 @@ def recursive(self): @property def include_media_info(self): """ - If true, :field:'FileMetadata.media_info' is set for photo and video. + If true, ``FileMetadata.media_info`` is set for photo and video. :rtype: bool """ @@ -2964,7 +3005,7 @@ def __repr__(self): class PreviewArg(object): """ :ivar path: The path of the file to preview. - :ivar rev: Deprecated. Please specify revision in :field:'path' instead + :ivar rev: Deprecated. Please specify revision in ``path`` instead """ __slots__ = [ @@ -3014,7 +3055,7 @@ def path(self): @property def rev(self): """ - Deprecated. Please specify revision in :field:'path' instead + Deprecated. Please specify revision in ``path`` instead :rtype: str """ @@ -5515,16 +5556,19 @@ def __repr__(self): Metadata._name_validator = bv.String() Metadata._path_lower_validator = bv.String() +Metadata._path_display_validator = bv.String() Metadata._parent_shared_folder_id_validator = bv.Nullable(bv.String(pattern=u'[-_0-9a-zA-Z:]+')) Metadata._field_names_ = set([ 'name', 'path_lower', + 'path_display', 'parent_shared_folder_id', ]) Metadata._all_field_names_ = Metadata._field_names_ Metadata._fields_ = [ ('name', Metadata._name_validator), ('path_lower', Metadata._path_lower_validator), + ('path_display', Metadata._path_display_validator), ('parent_shared_folder_id', Metadata._parent_shared_folder_id_validator), ] Metadata._all_fields_ = Metadata._fields_ @@ -5577,7 +5621,7 @@ def __repr__(self): DownloadError.other = DownloadError('other') -FileMetadata._id_validator = bv.Nullable(bv.String(min_length=1)) +FileMetadata._id_validator = bv.String(min_length=1) FileMetadata._client_modified_validator = bv.Timestamp(u'%Y-%m-%dT%H:%M:%SZ') FileMetadata._server_modified_validator = bv.Timestamp(u'%Y-%m-%dT%H:%M:%SZ') FileMetadata._rev_validator = bv.String(min_length=9, pattern=u'[0-9a-f]+') @@ -5620,7 +5664,7 @@ def __repr__(self): ('modified_by', FileSharingInfo._modified_by_validator), ] -FolderMetadata._id_validator = bv.Nullable(bv.String(min_length=1)) +FolderMetadata._id_validator = bv.String(min_length=1) FolderMetadata._shared_folder_id_validator = bv.Nullable(bv.String(pattern=u'[-_0-9a-zA-Z:]+')) FolderMetadata._sharing_info_validator = bv.Nullable(bv.Struct(FolderSharingInfo)) FolderMetadata._field_names_ = set([ diff --git a/dropbox/rest.py b/dropbox/rest.py index aa3922ba..7ad8dd46 100644 --- a/dropbox/rest.py +++ b/dropbox/rest.py @@ -31,7 +31,7 @@ else: url_encode = urllib.urlencode -SDK_VERSION = "5.2.2" +SDK_VERSION = "6.0" TRUSTED_CERT_FILE = pkg_resources.resource_filename(__name__, 'trusted-certs.crt') diff --git a/dropbox/session.py b/dropbox/session.py index 62cbe92f..8bf18953 100644 --- a/dropbox/session.py +++ b/dropbox/session.py @@ -301,7 +301,7 @@ def _generate_oauth_timestamp(cls): @classmethod def _generate_oauth_nonce(cls, length=8): - return ''.join([str(random.randint(0, 9)) for i in range(length)]) + return ''.join([str(random.SystemRandom().randint(0, 9)) for i in range(length)]) @classmethod def _oauth_version(cls): diff --git a/dropbox/sharing.py b/dropbox/sharing.py index fa8ac89a..4dce1143 100644 --- a/dropbox/sharing.py +++ b/dropbox/sharing.py @@ -318,11 +318,9 @@ class AddFolderMemberError(object): corresponding ``get_*`` method. :ivar SharedFolderAccessError access_error: Unable to access shared folder. - :ivar email_unverified: The current account's e-mail address is unverified. + :ivar email_unverified: The current user's e-mail address is unverified. :ivar AddMemberSelectorError bad_member: ``AddFolderMemberArg.members`` contains a bad invitation recipient. - :ivar no_permission: The current account does not have permission to perform - this action. :ivar cant_share_outside_team: Your team policy does not allow sharing outside of the team. :ivar long too_many_members: The value is the member limit that was reached. @@ -333,6 +331,9 @@ class AddFolderMemberError(object): action. An example of this is when adding a read-only member. This action can only be performed by users that have upgraded to a Pro or Business plan. + :ivar team_folder: This action cannot be performed on a team shared folder. + :ivar no_permission: The current user does not have permission to perform + this action. """ __slots__ = ['_tag', '_value'] @@ -341,14 +342,16 @@ class AddFolderMemberError(object): # Attribute is overwritten below the class definition email_unverified = None # Attribute is overwritten below the class definition - no_permission = None - # Attribute is overwritten below the class definition cant_share_outside_team = None # Attribute is overwritten below the class definition rate_limit = None # Attribute is overwritten below the class definition insufficient_plan = None # Attribute is overwritten below the class definition + team_folder = None + # Attribute is overwritten below the class definition + no_permission = None + # Attribute is overwritten below the class definition other = None def __init__(self, tag, value=None): @@ -431,14 +434,6 @@ def is_bad_member(self): """ return self._tag == 'bad_member' - def is_no_permission(self): - """ - Check if the union tag is ``no_permission``. - - :rtype: bool - """ - return self._tag == 'no_permission' - def is_cant_share_outside_team(self): """ Check if the union tag is ``cant_share_outside_team``. @@ -479,6 +474,22 @@ def is_insufficient_plan(self): """ return self._tag == 'insufficient_plan' + def is_team_folder(self): + """ + Check if the union tag is ``team_folder``. + + :rtype: bool + """ + return self._tag == 'team_folder' + + def is_no_permission(self): + """ + Check if the union tag is ``no_permission``. + + :rtype: bool + """ + return self._tag == 'no_permission' + def is_other(self): """ Check if the union tag is ``other``. @@ -637,7 +648,7 @@ class AddMemberSelectorError(object): :ivar group_deleted: At least one of the specified groups in ``AddFolderMemberArg.members`` is deleted. :ivar group_not_on_team: Sharing to a group that is not on the current - account's team. + user's team. """ __slots__ = ['_tag', '_value'] @@ -1805,6 +1816,11 @@ class FolderAction(object): :ivar change_options: Change folder options, such as who can be invited to join the folder. :ivar edit_contents: Change or edit contents of the folder. + :ivar invite_editor: Invite a user or group to join the folder with read and + write permission. + :ivar invite_viewer: Invite a user or group to join the folder with read + permission. + :ivar relinquish_membership: Relinquish one's own membership in the folder. :ivar unmount: Unmount the folder. :ivar unshare: Stop sharing this folder. """ @@ -1817,6 +1833,12 @@ class FolderAction(object): # Attribute is overwritten below the class definition edit_contents = None # Attribute is overwritten below the class definition + invite_editor = None + # Attribute is overwritten below the class definition + invite_viewer = None + # Attribute is overwritten below the class definition + relinquish_membership = None + # Attribute is overwritten below the class definition unmount = None # Attribute is overwritten below the class definition unshare = None @@ -1851,6 +1873,30 @@ def is_edit_contents(self): """ return self._tag == 'edit_contents' + def is_invite_editor(self): + """ + Check if the union tag is ``invite_editor``. + + :rtype: bool + """ + return self._tag == 'invite_editor' + + def is_invite_viewer(self): + """ + Check if the union tag is ``invite_viewer``. + + :rtype: bool + """ + return self._tag == 'invite_viewer' + + def is_relinquish_membership(self): + """ + Check if the union tag is ``relinquish_membership``. + + :rtype: bool + """ + return self._tag == 'relinquish_membership' + def is_unmount(self): """ Check if the union tag is ``unmount``. @@ -2158,7 +2204,7 @@ def __repr__(self): class GetMetadataArgs(object): """ :ivar shared_folder_id: The ID for the shared folder. - :ivar actions: Folder actions to query. + :ivar actions: Folder actions to query. This field is optional. """ __slots__ = [ @@ -2208,7 +2254,7 @@ def shared_folder_id(self): @property def actions(self): """ - Folder actions to query. + Folder actions to query. This field is optional. :rtype: list of [FolderAction] """ @@ -2689,6 +2735,9 @@ class MembershipInfo(object): :ivar access_type: The access type for this member. :ivar permissions: The permissions that requesting user has on this member. The set of permissions corresponds to the MemberActions in the request. + :ivar initials: Suggested name initials for a member. + :ivar is_inherited: True if the member's access to the file is inherited + from a parent folder. """ __slots__ = [ @@ -2696,21 +2745,35 @@ class MembershipInfo(object): '_access_type_present', '_permissions_value', '_permissions_present', + '_initials_value', + '_initials_present', + '_is_inherited_value', + '_is_inherited_present', ] _has_required_fields = True def __init__(self, access_type=None, - permissions=None): + permissions=None, + initials=None, + is_inherited=None): self._access_type_value = None self._access_type_present = False self._permissions_value = None self._permissions_present = False + self._initials_value = None + self._initials_present = False + self._is_inherited_value = None + self._is_inherited_present = False if access_type is not None: self.access_type = access_type if permissions is not None: self.permissions = permissions + if initials is not None: + self.initials = initials + if is_inherited is not None: + self.is_inherited = is_inherited @property def access_type(self): @@ -2762,10 +2825,62 @@ def permissions(self): self._permissions_value = None self._permissions_present = False + @property + def initials(self): + """ + Suggested name initials for a member. + + :rtype: str + """ + if self._initials_present: + return self._initials_value + else: + return None + + @initials.setter + def initials(self, val): + if val is None: + del self.initials + return + val = self._initials_validator.validate(val) + self._initials_value = val + self._initials_present = True + + @initials.deleter + def initials(self): + self._initials_value = None + self._initials_present = False + + @property + def is_inherited(self): + """ + True if the member's access to the file is inherited from a parent + folder. + + :rtype: bool + """ + if self._is_inherited_present: + return self._is_inherited_value + else: + return False + + @is_inherited.setter + def is_inherited(self, val): + val = self._is_inherited_validator.validate(val) + self._is_inherited_value = val + self._is_inherited_present = True + + @is_inherited.deleter + def is_inherited(self): + self._is_inherited_value = None + self._is_inherited_present = False + def __repr__(self): - return 'MembershipInfo(access_type={!r}, permissions={!r})'.format( + return 'MembershipInfo(access_type={!r}, permissions={!r}, initials={!r}, is_inherited={!r})'.format( self._access_type_value, self._permissions_value, + self._initials_value, + self._is_inherited_value, ) class GroupMembershipInfo(MembershipInfo): @@ -2785,9 +2900,13 @@ class GroupMembershipInfo(MembershipInfo): def __init__(self, access_type=None, group=None, - permissions=None): + permissions=None, + initials=None, + is_inherited=None): super(GroupMembershipInfo, self).__init__(access_type, - permissions) + permissions, + initials, + is_inherited) self._group_value = None self._group_present = False if group is not None: @@ -2817,10 +2936,12 @@ def group(self): self._group_present = False def __repr__(self): - return 'GroupMembershipInfo(access_type={!r}, group={!r}, permissions={!r})'.format( + return 'GroupMembershipInfo(access_type={!r}, group={!r}, permissions={!r}, initials={!r}, is_inherited={!r})'.format( self._access_type_value, self._group_value, self._permissions_value, + self._initials_value, + self._is_inherited_value, ) class InviteeInfo(object): @@ -2911,9 +3032,13 @@ class InviteeMembershipInfo(MembershipInfo): def __init__(self, access_type=None, invitee=None, - permissions=None): + permissions=None, + initials=None, + is_inherited=None): super(InviteeMembershipInfo, self).__init__(access_type, - permissions) + permissions, + initials, + is_inherited) self._invitee_value = None self._invitee_present = False if invitee is not None: @@ -2943,17 +3068,27 @@ def invitee(self): self._invitee_present = False def __repr__(self): - return 'InviteeMembershipInfo(access_type={!r}, invitee={!r}, permissions={!r})'.format( + return 'InviteeMembershipInfo(access_type={!r}, invitee={!r}, permissions={!r}, initials={!r}, is_inherited={!r})'.format( self._access_type_value, self._invitee_value, self._permissions_value, + self._initials_value, + self._is_inherited_value, ) class JobError(object): """ + Error occurred while performing an asynchronous job from unshare_folder or + remove_folder_member. + 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 UnshareFolderError unshare_folder_error: Error occurred while + performing unshare_folder action. + :ivar RemoveFolderMemberError remove_folder_member_error: Error occurred + while performing remove_folder_member action. """ __slots__ = ['_tag', '_value'] @@ -2975,42 +3110,42 @@ def __init__(self, tag, value=None): self._value = value @classmethod - def access_error(cls, val): + def unshare_folder_error(cls, val): """ - Create an instance of this class set to the ``access_error`` tag with - value ``val``. + Create an instance of this class set to the ``unshare_folder_error`` tag + with value ``val``. - :param SharedFolderAccessError val: + :param UnshareFolderError val: :rtype: JobError """ - return cls('access_error', val) + return cls('unshare_folder_error', val) @classmethod - def member_error(cls, val): + def remove_folder_member_error(cls, val): """ - Create an instance of this class set to the ``member_error`` tag with - value ``val``. + Create an instance of this class set to the + ``remove_folder_member_error`` tag with value ``val``. - :param SharedFolderMemberError val: + :param RemoveFolderMemberError val: :rtype: JobError """ - return cls('member_error', val) + return cls('remove_folder_member_error', val) - def is_access_error(self): + def is_unshare_folder_error(self): """ - Check if the union tag is ``access_error``. + Check if the union tag is ``unshare_folder_error``. :rtype: bool """ - return self._tag == 'access_error' + return self._tag == 'unshare_folder_error' - def is_member_error(self): + def is_remove_folder_member_error(self): """ - Check if the union tag is ``member_error``. + Check if the union tag is ``remove_folder_member_error``. :rtype: bool """ - return self._tag == 'member_error' + return self._tag == 'remove_folder_member_error' def is_other(self): """ @@ -3020,24 +3155,28 @@ def is_other(self): """ return self._tag == 'other' - def get_access_error(self): + def get_unshare_folder_error(self): """ - Only call this if :meth:`is_access_error` is true. + Error occurred while performing unshare_folder action. - :rtype: SharedFolderAccessError + Only call this if :meth:`is_unshare_folder_error` is true. + + :rtype: UnshareFolderError """ - if not self.is_access_error(): - raise AttributeError("tag 'access_error' not set") + if not self.is_unshare_folder_error(): + raise AttributeError("tag 'unshare_folder_error' not set") return self._value - def get_member_error(self): + def get_remove_folder_member_error(self): """ - Only call this if :meth:`is_member_error` is true. + Error occurred while performing remove_folder_member action. - :rtype: SharedFolderMemberError + Only call this if :meth:`is_remove_folder_member_error` is true. + + :rtype: RemoveFolderMemberError """ - if not self.is_member_error(): - raise AttributeError("tag 'member_error' not set") + if not self.is_remove_folder_member_error(): + raise AttributeError("tag 'remove_folder_member_error' not set") return self._value def __repr__(self): @@ -3285,7 +3424,9 @@ def __repr__(self): class ListFolderMembersArgs(object): """ :ivar shared_folder_id: The ID for the shared folder. - :ivar actions: Member actions to query. + :ivar actions: Member actions to query. This field is optional. + :ivar limit: The maximum number of results that include members, groups and + invitees to return per request. """ __slots__ = [ @@ -3293,21 +3434,28 @@ class ListFolderMembersArgs(object): '_shared_folder_id_present', '_actions_value', '_actions_present', + '_limit_value', + '_limit_present', ] _has_required_fields = True def __init__(self, shared_folder_id=None, - actions=None): + actions=None, + limit=None): self._shared_folder_id_value = None self._shared_folder_id_present = False self._actions_value = None self._actions_present = False + self._limit_value = None + self._limit_present = False if shared_folder_id is not None: self.shared_folder_id = shared_folder_id if actions is not None: self.actions = actions + if limit is not None: + self.limit = limit @property def shared_folder_id(self): @@ -3335,7 +3483,7 @@ def shared_folder_id(self): @property def actions(self): """ - Member actions to query. + Member actions to query. This field is optional. :rtype: list of [MemberAction] """ @@ -3358,10 +3506,35 @@ def actions(self): self._actions_value = None self._actions_present = False + @property + def limit(self): + """ + The maximum number of results that include members, groups and invitees + to return per request. + + :rtype: long + """ + if self._limit_present: + return self._limit_value + else: + return 1000 + + @limit.setter + def limit(self, val): + val = self._limit_validator.validate(val) + self._limit_value = val + self._limit_present = True + + @limit.deleter + def limit(self): + self._limit_value = None + self._limit_present = False + def __repr__(self): - return 'ListFolderMembersArgs(shared_folder_id={!r}, actions={!r})'.format( + return 'ListFolderMembersArgs(shared_folder_id={!r}, actions={!r}, limit={!r})'.format( self._shared_folder_id_value, self._actions_value, + self._limit_value, ) class ListFolderMembersContinueArg(object): @@ -3490,6 +3663,88 @@ def get_access_error(self): def __repr__(self): return 'ListFolderMembersContinueError(%r, %r)' % (self._tag, self._value) +class ListFoldersArgs(object): + """ + :ivar limit: The maximum number of results to return per request. + :ivar actions: Folder actions to query. This field is optional. + """ + + __slots__ = [ + '_limit_value', + '_limit_present', + '_actions_value', + '_actions_present', + ] + + _has_required_fields = False + + def __init__(self, + limit=None, + actions=None): + self._limit_value = None + self._limit_present = False + self._actions_value = None + self._actions_present = False + if limit is not None: + self.limit = limit + if actions is not None: + self.actions = actions + + @property + def limit(self): + """ + The maximum number of results to return per request. + + :rtype: long + """ + if self._limit_present: + return self._limit_value + else: + return 1000 + + @limit.setter + def limit(self, val): + val = self._limit_validator.validate(val) + self._limit_value = val + self._limit_present = True + + @limit.deleter + def limit(self): + self._limit_value = None + self._limit_present = False + + @property + def actions(self): + """ + Folder actions to query. This field is optional. + + :rtype: list of [FolderAction] + """ + if self._actions_present: + return self._actions_value + else: + return None + + @actions.setter + def actions(self, val): + if val is None: + del self.actions + return + val = self._actions_validator.validate(val) + self._actions_value = val + self._actions_present = True + + @actions.deleter + def actions(self): + self._actions_value = None + self._actions_present = False + + def __repr__(self): + return 'ListFoldersArgs(limit={!r}, actions={!r})'.format( + self._limit_value, + self._actions_value, + ) + class ListFoldersContinueArg(object): """ :ivar cursor: The cursor returned by your last call to list_folders or @@ -3681,6 +3936,7 @@ class ListSharedLinksArg(object): """ :ivar path: See list_shared_links description. :ivar cursor: The cursor returned by your last call to list_shared_links. + :ivar direct_only: See list_shared_links description. """ __slots__ = [ @@ -3688,21 +3944,28 @@ class ListSharedLinksArg(object): '_path_present', '_cursor_value', '_cursor_present', + '_direct_only_value', + '_direct_only_present', ] _has_required_fields = False def __init__(self, path=None, - cursor=None): + cursor=None, + direct_only=None): self._path_value = None self._path_present = False self._cursor_value = None self._cursor_present = False + self._direct_only_value = None + self._direct_only_present = False if path is not None: self.path = path if cursor is not None: self.cursor = cursor + if direct_only is not None: + self.direct_only = direct_only @property def path(self): @@ -3756,10 +4019,37 @@ def cursor(self): self._cursor_value = None self._cursor_present = False + @property + def direct_only(self): + """ + See list_shared_links description. + + :rtype: bool + """ + if self._direct_only_present: + return self._direct_only_value + else: + return None + + @direct_only.setter + def direct_only(self, val): + if val is None: + del self.direct_only + return + val = self._direct_only_validator.validate(val) + self._direct_only_value = val + self._direct_only_present = True + + @direct_only.deleter + def direct_only(self): + self._direct_only_value = None + self._direct_only_present = False + def __repr__(self): - return 'ListSharedLinksArg(path={!r}, cursor={!r})'.format( + return 'ListSharedLinksArg(path={!r}, cursor={!r}, direct_only={!r})'.format( self._path_value, self._cursor_value, + self._direct_only_value, ) class ListSharedLinksError(object): @@ -3968,7 +4258,9 @@ class MemberAction(object): return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method. + :ivar make_editor: Make the member an editor of the folder. :ivar make_owner: Make the member an owner of the folder. + :ivar make_viewer: Make the member a viewer of the folder. :ivar remove: Remove the member from the folder. """ @@ -3976,8 +4268,12 @@ class MemberAction(object): _catch_all = 'other' # Attribute is overwritten below the class definition + make_editor = None + # Attribute is overwritten below the class definition make_owner = None # Attribute is overwritten below the class definition + make_viewer = None + # Attribute is overwritten below the class definition remove = None # Attribute is overwritten below the class definition other = None @@ -3994,6 +4290,14 @@ def __init__(self, tag, value=None): self._tag = tag self._value = value + def is_make_editor(self): + """ + Check if the union tag is ``make_editor``. + + :rtype: bool + """ + return self._tag == 'make_editor' + def is_make_owner(self): """ Check if the union tag is ``make_owner``. @@ -4002,6 +4306,14 @@ def is_make_owner(self): """ return self._tag == 'make_owner' + def is_make_viewer(self): + """ + Check if the union tag is ``make_viewer``. + + :rtype: bool + """ + return self._tag == 'make_viewer' + def is_remove(self): """ Check if the union tag is ``remove``. @@ -4511,6 +4823,8 @@ class MountFolderError(object): :ivar insufficient_quota: The current user does not have enough space to mount the shared folder. :ivar already_mounted: The shared folder is already mounted. + :ivar no_permission: The current user does not have permission to perform + this action. """ __slots__ = ['_tag', '_value'] @@ -4523,6 +4837,8 @@ class MountFolderError(object): # Attribute is overwritten below the class definition already_mounted = None # Attribute is overwritten below the class definition + no_permission = None + # Attribute is overwritten below the class definition other = None def __init__(self, tag, value=None): @@ -4580,6 +4896,14 @@ def is_already_mounted(self): """ return self._tag == 'already_mounted' + def is_no_permission(self): + """ + Check if the union tag is ``no_permission``. + + :rtype: bool + """ + return self._tag == 'no_permission' + def is_other(self): """ Check if the union tag is ``other``. @@ -4874,11 +5198,14 @@ class RelinquishFolderMembershipError(object): :ivar folder_owner: The current user is the owner of the shared folder. Owners cannot relinquish membership to their own folders. Try unsharing - or transfering ownership first. + or transferring ownership first. :ivar mounted: The shared folder is currently mounted. Unmount the shared folder before relinquishing membership. :ivar group_access: The current user has access to the shared folder via a group. You can't relinquish membership to folders shared via groups. + :ivar team_folder: This action cannot be performed on a team shared folder. + :ivar no_permission: The current user does not have permission to perform + this action. """ __slots__ = ['_tag', '_value'] @@ -4891,6 +5218,10 @@ class RelinquishFolderMembershipError(object): # Attribute is overwritten below the class definition group_access = None # Attribute is overwritten below the class definition + team_folder = None + # Attribute is overwritten below the class definition + no_permission = None + # Attribute is overwritten below the class definition other = None def __init__(self, tag, value=None): @@ -4948,6 +5279,22 @@ def is_group_access(self): """ return self._tag == 'group_access' + def is_team_folder(self): + """ + Check if the union tag is ``team_folder``. + + :rtype: bool + """ + return self._tag == 'team_folder' + + def is_no_permission(self): + """ + Check if the union tag is ``no_permission``. + + :rtype: bool + """ + return self._tag == 'no_permission' + def is_other(self): """ Check if the union tag is ``other``. @@ -5096,6 +5443,9 @@ class RemoveFolderMemberError(object): member. :ivar group_access: The target user has access to the shared folder via a group. + :ivar team_folder: This action cannot be performed on a team shared folder. + :ivar no_permission: The current user does not have permission to perform + this action. """ __slots__ = ['_tag', '_value'] @@ -5106,6 +5456,10 @@ class RemoveFolderMemberError(object): # Attribute is overwritten below the class definition group_access = None # Attribute is overwritten below the class definition + team_folder = None + # Attribute is overwritten below the class definition + no_permission = None + # Attribute is overwritten below the class definition other = None def __init__(self, tag, value=None): @@ -5174,6 +5528,22 @@ def is_group_access(self): """ return self._tag == 'group_access' + def is_team_folder(self): + """ + Check if the union tag is ``team_folder``. + + :rtype: bool + """ + return self._tag == 'team_folder' + + def is_no_permission(self): + """ + Check if the union tag is ``no_permission``. + + :rtype: bool + """ + return self._tag == 'no_permission' + def is_other(self): """ Check if the union tag is ``other``. @@ -5611,13 +5981,13 @@ class ShareFolderError(object): return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method. - :ivar email_unverified: The current account's e-mail address is unverified. + :ivar email_unverified: The current user's e-mail address is unverified. :ivar SharePathError bad_path: ``ShareFolderArg.path`` is invalid. :ivar team_policy_disallows_member_policy: Team policy is more restrictive than ``ShareFolderArg.member_policy``. - :ivar disallowed_shared_link_policy: The current account is not allowed to - select the specified ``ShareFolderArg.shared_link_policy``. - :ivar no_permission: The current account does not have permission to perform + :ivar disallowed_shared_link_policy: The current user's account is not + allowed to select the specified ``ShareFolderArg.shared_link_policy``. + :ivar no_permission: The current user does not have permission to perform this action. """ @@ -5989,11 +6359,7 @@ class SharedFolderAccessError(object): :ivar invalid_id: This shared folder ID is invalid. :ivar not_a_member: The user is not a member of the shared folder thus cannot access it. - :ivar no_permission: The current user does not have sufficient privileges to - perform the desired action. - :ivar email_unverified: The current account's e-mail address is unverified. - :ivar team_folder: The current user cannot perform this action on a team - shared folder. + :ivar email_unverified: The current user's e-mail address is unverified. :ivar unmounted: The shared folder is unmounted. """ @@ -6005,12 +6371,8 @@ class SharedFolderAccessError(object): # Attribute is overwritten below the class definition not_a_member = None # Attribute is overwritten below the class definition - no_permission = None - # Attribute is overwritten below the class definition email_unverified = None # Attribute is overwritten below the class definition - team_folder = None - # Attribute is overwritten below the class definition unmounted = None # Attribute is overwritten below the class definition other = None @@ -6043,14 +6405,6 @@ def is_not_a_member(self): """ return self._tag == 'not_a_member' - def is_no_permission(self): - """ - Check if the union tag is ``no_permission``. - - :rtype: bool - """ - return self._tag == 'no_permission' - def is_email_unverified(self): """ Check if the union tag is ``email_unverified``. @@ -6059,14 +6413,6 @@ def is_email_unverified(self): """ return self._tag == 'email_unverified' - def is_team_folder(self): - """ - Check if the union tag is ``team_folder``. - - :rtype: bool - """ - return self._tag == 'team_folder' - def is_unmounted(self): """ Check if the union tag is ``unmounted``. @@ -6302,30 +6648,20 @@ def __repr__(self): self._cursor_value, ) -class SharedFolderMetadata(object): +class SharedFolderMetadataBase(object): """ - The metadata which includes basic information about the shared folder. + Properties of the shared folder. - :ivar path_lower: The lower-cased full path of this shared folder. Absent - for unmounted folders. - :ivar name: The name of the this shared folder. - :ivar shared_folder_id: The ID of the shared folder. :ivar access_type: The current user's access level for this shared folder. :ivar is_team_folder: Whether this folder is a `team folder `_. :ivar policy: Policies governing this shared folder. :ivar permissions: Actions the current user may perform on the folder and - its contents. The set of permissions corresponds to the MemberActions in + its contents. The set of permissions corresponds to the FolderActions in the request. """ __slots__ = [ - '_path_lower_value', - '_path_lower_present', - '_name_value', - '_name_present', - '_shared_folder_id_value', - '_shared_folder_id_present', '_access_type_value', '_access_type_present', '_is_team_folder_value', @@ -6339,19 +6675,10 @@ class SharedFolderMetadata(object): _has_required_fields = True def __init__(self, - name=None, - shared_folder_id=None, access_type=None, is_team_folder=None, policy=None, - path_lower=None, permissions=None): - self._path_lower_value = None - self._path_lower_present = False - self._name_value = None - self._name_present = False - self._shared_folder_id_value = None - self._shared_folder_id_present = False self._access_type_value = None self._access_type_present = False self._is_team_folder_value = None @@ -6360,12 +6687,6 @@ def __init__(self, self._policy_present = False self._permissions_value = None self._permissions_present = False - if path_lower is not None: - self.path_lower = path_lower - if name is not None: - self.name = name - if shared_folder_id is not None: - self.shared_folder_id = shared_folder_id if access_type is not None: self.access_type = access_type if is_team_folder is not None: @@ -6375,79 +6696,6 @@ def __init__(self, if permissions is not None: self.permissions = permissions - @property - def path_lower(self): - """ - The lower-cased full path of this shared folder. Absent for unmounted - folders. - - :rtype: str - """ - if self._path_lower_present: - return self._path_lower_value - else: - return None - - @path_lower.setter - def path_lower(self, val): - if val is None: - del self.path_lower - return - val = self._path_lower_validator.validate(val) - self._path_lower_value = val - self._path_lower_present = True - - @path_lower.deleter - def path_lower(self): - self._path_lower_value = None - self._path_lower_present = False - - @property - def name(self): - """ - The name of the this shared folder. - - :rtype: str - """ - if self._name_present: - return self._name_value - else: - raise AttributeError("missing required field 'name'") - - @name.setter - def name(self, val): - val = self._name_validator.validate(val) - self._name_value = val - self._name_present = True - - @name.deleter - def name(self): - self._name_value = None - self._name_present = False - - @property - def shared_folder_id(self): - """ - The ID of the shared folder. - - :rtype: str - """ - if self._shared_folder_id_present: - return self._shared_folder_id_value - else: - raise AttributeError("missing required field 'shared_folder_id'") - - @shared_folder_id.setter - def shared_folder_id(self, val): - val = self._shared_folder_id_validator.validate(val) - self._shared_folder_id_value = val - self._shared_folder_id_present = True - - @shared_folder_id.deleter - def shared_folder_id(self): - self._shared_folder_id_value = None - self._shared_folder_id_present = False - @property def access_type(self): """ @@ -6522,7 +6770,7 @@ def policy(self): def permissions(self): """ Actions the current user may perform on the folder and its contents. The - set of permissions corresponds to the MemberActions in the request. + set of permissions corresponds to the FolderActions in the request. :rtype: list of [FolderPermission] """ @@ -6546,16 +6794,143 @@ def permissions(self): self._permissions_present = False def __repr__(self): - return 'SharedFolderMetadata(name={!r}, shared_folder_id={!r}, access_type={!r}, is_team_folder={!r}, policy={!r}, path_lower={!r}, permissions={!r})'.format( - self._name_value, - self._shared_folder_id_value, + return 'SharedFolderMetadataBase(access_type={!r}, is_team_folder={!r}, policy={!r}, permissions={!r})'.format( self._access_type_value, self._is_team_folder_value, self._policy_value, - self._path_lower_value, self._permissions_value, ) +class SharedFolderMetadata(SharedFolderMetadataBase): + """ + The metadata which includes basic information about the shared folder. + + :ivar path_lower: The lower-cased full path of this shared folder. Absent + for unmounted folders. + :ivar name: The name of the this shared folder. + :ivar shared_folder_id: The ID of the shared folder. + """ + + __slots__ = [ + '_path_lower_value', + '_path_lower_present', + '_name_value', + '_name_present', + '_shared_folder_id_value', + '_shared_folder_id_present', + ] + + _has_required_fields = True + + def __init__(self, + access_type=None, + is_team_folder=None, + policy=None, + name=None, + shared_folder_id=None, + permissions=None, + path_lower=None): + super(SharedFolderMetadata, self).__init__(access_type, + is_team_folder, + policy, + permissions) + self._path_lower_value = None + self._path_lower_present = False + self._name_value = None + self._name_present = False + self._shared_folder_id_value = None + self._shared_folder_id_present = False + if path_lower is not None: + self.path_lower = path_lower + if name is not None: + self.name = name + if shared_folder_id is not None: + self.shared_folder_id = shared_folder_id + + @property + def path_lower(self): + """ + The lower-cased full path of this shared folder. Absent for unmounted + folders. + + :rtype: str + """ + if self._path_lower_present: + return self._path_lower_value + else: + return None + + @path_lower.setter + def path_lower(self, val): + if val is None: + del self.path_lower + return + val = self._path_lower_validator.validate(val) + self._path_lower_value = val + self._path_lower_present = True + + @path_lower.deleter + def path_lower(self): + self._path_lower_value = None + self._path_lower_present = False + + @property + def name(self): + """ + The name of the this shared folder. + + :rtype: str + """ + if self._name_present: + return self._name_value + else: + raise AttributeError("missing required field 'name'") + + @name.setter + def name(self, val): + val = self._name_validator.validate(val) + self._name_value = val + self._name_present = True + + @name.deleter + def name(self): + self._name_value = None + self._name_present = False + + @property + def shared_folder_id(self): + """ + The ID of the shared folder. + + :rtype: str + """ + if self._shared_folder_id_present: + return self._shared_folder_id_value + else: + raise AttributeError("missing required field 'shared_folder_id'") + + @shared_folder_id.setter + def shared_folder_id(self, val): + val = self._shared_folder_id_validator.validate(val) + self._shared_folder_id_value = val + self._shared_folder_id_present = True + + @shared_folder_id.deleter + def shared_folder_id(self): + self._shared_folder_id_value = None + self._shared_folder_id_present = False + + def __repr__(self): + return 'SharedFolderMetadata(access_type={!r}, is_team_folder={!r}, policy={!r}, name={!r}, shared_folder_id={!r}, permissions={!r}, path_lower={!r})'.format( + self._access_type_value, + self._is_team_folder_value, + self._policy_value, + self._name_value, + self._shared_folder_id_value, + self._permissions_value, + self._path_lower_value, + ) + class SharedLinkAccessFailureReason(object): """ This class acts as a tagged union. Only one of the ``is_*`` methods will @@ -7094,23 +7469,22 @@ class TransferFolderError(object): return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method. - :ivar no_permission: The current account does not have permission to perform - this action. :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 desginated owner does not have the shared + :ivar new_owner_unmounted: The new designated owner does not have the shared folder mounted. :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. + :ivar no_permission: The current user does not have permission to perform + this action. """ __slots__ = ['_tag', '_value'] _catch_all = 'other' # Attribute is overwritten below the class definition - no_permission = None - # Attribute is overwritten below the class definition invalid_dropbox_id = None # Attribute is overwritten below the class definition new_owner_not_a_member = None @@ -7119,6 +7493,10 @@ class TransferFolderError(object): # Attribute is overwritten below the class definition new_owner_email_unverified = None # Attribute is overwritten below the class definition + team_folder = None + # Attribute is overwritten below the class definition + no_permission = None + # Attribute is overwritten below the class definition other = None def __init__(self, tag, value=None): @@ -7152,14 +7530,6 @@ def is_access_error(self): """ return self._tag == 'access_error' - def is_no_permission(self): - """ - Check if the union tag is ``no_permission``. - - :rtype: bool - """ - return self._tag == 'no_permission' - def is_invalid_dropbox_id(self): """ Check if the union tag is ``invalid_dropbox_id``. @@ -7192,6 +7562,22 @@ def is_new_owner_email_unverified(self): """ return self._tag == 'new_owner_email_unverified' + def is_team_folder(self): + """ + Check if the union tag is ``team_folder``. + + :rtype: bool + """ + return self._tag == 'team_folder' + + def is_no_permission(self): + """ + Check if the union tag is ``no_permission``. + + :rtype: bool + """ + return self._tag == 'no_permission' + def is_other(self): """ Check if the union tag is ``other``. @@ -7265,12 +7651,17 @@ class UnmountFolderError(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 no_permission: The current user does not have permission to perform + this action. """ __slots__ = ['_tag', '_value'] _catch_all = 'other' # Attribute is overwritten below the class definition + no_permission = None + # Attribute is overwritten below the class definition other = None def __init__(self, tag, value=None): @@ -7304,6 +7695,14 @@ def is_access_error(self): """ return self._tag == 'access_error' + def is_no_permission(self): + """ + Check if the union tag is ``no_permission``. + + :rtype: bool + """ + return self._tag == 'no_permission' + def is_other(self): """ Check if the union tag is ``other``. @@ -7414,12 +7813,20 @@ class UnshareFolderError(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 team_folder: This action cannot be performed on a team shared folder. + :ivar no_permission: The current user does not have permission to perform + this action. """ __slots__ = ['_tag', '_value'] _catch_all = 'other' # Attribute is overwritten below the class definition + team_folder = None + # Attribute is overwritten below the class definition + no_permission = None + # Attribute is overwritten below the class definition other = None def __init__(self, tag, value=None): @@ -7453,6 +7860,22 @@ def is_access_error(self): """ return self._tag == 'access_error' + def is_team_folder(self): + """ + Check if the union tag is ``team_folder``. + + :rtype: bool + """ + return self._tag == 'team_folder' + + def is_no_permission(self): + """ + Check if the union tag is ``no_permission``. + + :rtype: bool + """ + return self._tag == 'no_permission' + def is_other(self): """ Check if the union tag is ``other``. @@ -7599,6 +8022,8 @@ class UpdateFolderMemberError(object): action. An example of this is when downgrading a member from editor to viewer. This action can only be performed by users that have upgraded to a Pro or Business plan. + :ivar no_permission: The current user does not have permission to perform + this action. """ __slots__ = ['_tag', '_value'] @@ -7607,6 +8032,8 @@ class UpdateFolderMemberError(object): # Attribute is overwritten below the class definition insufficient_plan = None # Attribute is overwritten below the class definition + no_permission = None + # Attribute is overwritten below the class definition other = None def __init__(self, tag, value=None): @@ -7667,6 +8094,14 @@ def is_insufficient_plan(self): """ return self._tag == 'insufficient_plan' + def is_no_permission(self): + """ + Check if the union tag is ``no_permission``. + + :rtype: bool + """ + return self._tag == 'no_permission' + def is_other(self): """ Check if the union tag is ``other``. @@ -7962,7 +8397,7 @@ def __repr__(self): class UserInfo(object): """ Basic information about a user. Use users.get_account and - users.get_account_batch` to obtain more detailed information. + users.get_account_batch to obtain more detailed information. :ivar account_id: The account ID of the user. :ivar same_team: If the user is in the same team as current user. @@ -8095,9 +8530,13 @@ class UserMembershipInfo(MembershipInfo): def __init__(self, access_type=None, user=None, - permissions=None): + permissions=None, + initials=None, + is_inherited=None): super(UserMembershipInfo, self).__init__(access_type, - permissions) + permissions, + initials, + is_inherited) self._user_value = None self._user_present = False if user is not None: @@ -8127,10 +8566,12 @@ def user(self): self._user_present = False def __repr__(self): - return 'UserMembershipInfo(access_type={!r}, user={!r}, permissions={!r})'.format( + return 'UserMembershipInfo(access_type={!r}, user={!r}, permissions={!r}, initials={!r}, is_inherited={!r})'.format( self._access_type_value, self._user_value, self._permissions_value, + self._initials_value, + self._is_inherited_value, ) class Visibility(object): @@ -8284,31 +8725,34 @@ def __repr__(self): AddFolderMemberError._access_error_validator = bv.Union(SharedFolderAccessError) AddFolderMemberError._email_unverified_validator = bv.Void() AddFolderMemberError._bad_member_validator = bv.Union(AddMemberSelectorError) -AddFolderMemberError._no_permission_validator = bv.Void() AddFolderMemberError._cant_share_outside_team_validator = bv.Void() AddFolderMemberError._too_many_members_validator = bv.UInt64() AddFolderMemberError._too_many_pending_invites_validator = bv.UInt64() AddFolderMemberError._rate_limit_validator = bv.Void() AddFolderMemberError._insufficient_plan_validator = bv.Void() +AddFolderMemberError._team_folder_validator = bv.Void() +AddFolderMemberError._no_permission_validator = bv.Void() AddFolderMemberError._other_validator = bv.Void() AddFolderMemberError._tagmap = { 'access_error': AddFolderMemberError._access_error_validator, 'email_unverified': AddFolderMemberError._email_unverified_validator, 'bad_member': AddFolderMemberError._bad_member_validator, - 'no_permission': AddFolderMemberError._no_permission_validator, 'cant_share_outside_team': AddFolderMemberError._cant_share_outside_team_validator, 'too_many_members': AddFolderMemberError._too_many_members_validator, 'too_many_pending_invites': AddFolderMemberError._too_many_pending_invites_validator, 'rate_limit': AddFolderMemberError._rate_limit_validator, 'insufficient_plan': AddFolderMemberError._insufficient_plan_validator, + 'team_folder': AddFolderMemberError._team_folder_validator, + 'no_permission': AddFolderMemberError._no_permission_validator, 'other': AddFolderMemberError._other_validator, } AddFolderMemberError.email_unverified = AddFolderMemberError('email_unverified') -AddFolderMemberError.no_permission = AddFolderMemberError('no_permission') AddFolderMemberError.cant_share_outside_team = AddFolderMemberError('cant_share_outside_team') AddFolderMemberError.rate_limit = AddFolderMemberError('rate_limit') AddFolderMemberError.insufficient_plan = AddFolderMemberError('insufficient_plan') +AddFolderMemberError.team_folder = AddFolderMemberError('team_folder') +AddFolderMemberError.no_permission = AddFolderMemberError('no_permission') AddFolderMemberError.other = AddFolderMemberError('other') AddMember._member_validator = bv.Union(MemberSelector) @@ -8323,7 +8767,7 @@ def __repr__(self): ] AddMemberSelectorError._invalid_dropbox_id_validator = bv.String(min_length=1) -AddMemberSelectorError._invalid_email_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +AddMemberSelectorError._invalid_email_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") AddMemberSelectorError._unverified_dropbox_id_validator = bv.String(min_length=1) AddMemberSelectorError._group_deleted_validator = bv.Void() AddMemberSelectorError._group_not_on_team_validator = bv.Void() @@ -8485,12 +8929,18 @@ def __repr__(self): FolderAction._change_options_validator = bv.Void() FolderAction._edit_contents_validator = bv.Void() +FolderAction._invite_editor_validator = bv.Void() +FolderAction._invite_viewer_validator = bv.Void() +FolderAction._relinquish_membership_validator = bv.Void() FolderAction._unmount_validator = bv.Void() FolderAction._unshare_validator = bv.Void() FolderAction._other_validator = bv.Void() FolderAction._tagmap = { 'change_options': FolderAction._change_options_validator, 'edit_contents': FolderAction._edit_contents_validator, + 'invite_editor': FolderAction._invite_editor_validator, + 'invite_viewer': FolderAction._invite_viewer_validator, + 'relinquish_membership': FolderAction._relinquish_membership_validator, 'unmount': FolderAction._unmount_validator, 'unshare': FolderAction._unshare_validator, 'other': FolderAction._other_validator, @@ -8498,6 +8948,9 @@ def __repr__(self): FolderAction.change_options = FolderAction('change_options') FolderAction.edit_contents = FolderAction('edit_contents') +FolderAction.invite_editor = FolderAction('invite_editor') +FolderAction.invite_viewer = FolderAction('invite_viewer') +FolderAction.relinquish_membership = FolderAction('relinquish_membership') FolderAction.unmount = FolderAction('unmount') FolderAction.unshare = FolderAction('unshare') FolderAction.other = FolderAction('other') @@ -8604,20 +9057,26 @@ def __repr__(self): MembershipInfo._access_type_validator = bv.Union(AccessLevel) MembershipInfo._permissions_validator = bv.Nullable(bv.List(bv.Struct(MemberPermission))) +MembershipInfo._initials_validator = bv.Nullable(bv.String()) +MembershipInfo._is_inherited_validator = bv.Boolean() MembershipInfo._all_field_names_ = set([ 'access_type', 'permissions', + 'initials', + 'is_inherited', ]) MembershipInfo._all_fields_ = [ ('access_type', MembershipInfo._access_type_validator), ('permissions', MembershipInfo._permissions_validator), + ('initials', MembershipInfo._initials_validator), + ('is_inherited', MembershipInfo._is_inherited_validator), ] GroupMembershipInfo._group_validator = bv.Struct(GroupInfo) GroupMembershipInfo._all_field_names_ = MembershipInfo._all_field_names_.union(set(['group'])) GroupMembershipInfo._all_fields_ = MembershipInfo._all_fields_ + [('group', GroupMembershipInfo._group_validator)] -InviteeInfo._email_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +InviteeInfo._email_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") InviteeInfo._other_validator = bv.Void() InviteeInfo._tagmap = { 'email': InviteeInfo._email_validator, @@ -8630,12 +9089,12 @@ def __repr__(self): InviteeMembershipInfo._all_field_names_ = MembershipInfo._all_field_names_.union(set(['invitee'])) InviteeMembershipInfo._all_fields_ = MembershipInfo._all_fields_ + [('invitee', InviteeMembershipInfo._invitee_validator)] -JobError._access_error_validator = bv.Union(SharedFolderAccessError) -JobError._member_error_validator = bv.Union(SharedFolderMemberError) +JobError._unshare_folder_error_validator = bv.Union(UnshareFolderError) +JobError._remove_folder_member_error_validator = bv.Union(RemoveFolderMemberError) JobError._other_validator = bv.Void() JobError._tagmap = { - 'access_error': JobError._access_error_validator, - 'member_error': JobError._member_error_validator, + 'unshare_folder_error': JobError._unshare_folder_error_validator, + 'remove_folder_member_error': JobError._remove_folder_member_error_validator, 'other': JobError._other_validator, } @@ -8670,13 +9129,16 @@ def __repr__(self): ListFolderMembersArgs._shared_folder_id_validator = bv.String(pattern=u'[-_0-9a-zA-Z:]+') ListFolderMembersArgs._actions_validator = bv.Nullable(bv.List(bv.Union(MemberAction))) +ListFolderMembersArgs._limit_validator = bv.UInt32(min_value=1, max_value=1000) ListFolderMembersArgs._all_field_names_ = set([ 'shared_folder_id', 'actions', + 'limit', ]) ListFolderMembersArgs._all_fields_ = [ ('shared_folder_id', ListFolderMembersArgs._shared_folder_id_validator), ('actions', ListFolderMembersArgs._actions_validator), + ('limit', ListFolderMembersArgs._limit_validator), ] ListFolderMembersContinueArg._cursor_validator = bv.String() @@ -8695,6 +9157,17 @@ def __repr__(self): ListFolderMembersContinueError.invalid_cursor = ListFolderMembersContinueError('invalid_cursor') ListFolderMembersContinueError.other = ListFolderMembersContinueError('other') +ListFoldersArgs._limit_validator = bv.UInt32(min_value=1, max_value=1000) +ListFoldersArgs._actions_validator = bv.Nullable(bv.List(bv.Union(FolderAction))) +ListFoldersArgs._all_field_names_ = set([ + 'limit', + 'actions', +]) +ListFoldersArgs._all_fields_ = [ + ('limit', ListFoldersArgs._limit_validator), + ('actions', ListFoldersArgs._actions_validator), +] + ListFoldersContinueArg._cursor_validator = bv.String() ListFoldersContinueArg._all_field_names_ = set(['cursor']) ListFoldersContinueArg._all_fields_ = [('cursor', ListFoldersContinueArg._cursor_validator)] @@ -8722,13 +9195,16 @@ def __repr__(self): ListSharedLinksArg._path_validator = bv.Nullable(bv.String(pattern=u'((/|id:).*)|(rev:[0-9a-f]{9,})')) ListSharedLinksArg._cursor_validator = bv.Nullable(bv.String()) +ListSharedLinksArg._direct_only_validator = bv.Nullable(bv.Boolean()) ListSharedLinksArg._all_field_names_ = set([ 'path', 'cursor', + 'direct_only', ]) ListSharedLinksArg._all_fields_ = [ ('path', ListSharedLinksArg._path_validator), ('cursor', ListSharedLinksArg._cursor_validator), + ('direct_only', ListSharedLinksArg._direct_only_validator), ] ListSharedLinksError._path_validator = bv.Union(files.LookupError) @@ -8757,16 +9233,22 @@ def __repr__(self): ('cursor', ListSharedLinksResult._cursor_validator), ] +MemberAction._make_editor_validator = bv.Void() MemberAction._make_owner_validator = bv.Void() +MemberAction._make_viewer_validator = bv.Void() MemberAction._remove_validator = bv.Void() MemberAction._other_validator = bv.Void() MemberAction._tagmap = { + 'make_editor': MemberAction._make_editor_validator, 'make_owner': MemberAction._make_owner_validator, + 'make_viewer': MemberAction._make_viewer_validator, 'remove': MemberAction._remove_validator, 'other': MemberAction._other_validator, } +MemberAction.make_editor = MemberAction('make_editor') MemberAction.make_owner = MemberAction('make_owner') +MemberAction.make_viewer = MemberAction('make_viewer') MemberAction.remove = MemberAction('remove') MemberAction.other = MemberAction('other') @@ -8798,7 +9280,7 @@ def __repr__(self): MemberPolicy.other = MemberPolicy('other') MemberSelector._dropbox_id_validator = bv.String(min_length=1) -MemberSelector._email_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberSelector._email_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") MemberSelector._other_validator = bv.Void() MemberSelector._tagmap = { 'dropbox_id': MemberSelector._dropbox_id_validator, @@ -8837,18 +9319,21 @@ def __repr__(self): MountFolderError._inside_shared_folder_validator = bv.Void() MountFolderError._insufficient_quota_validator = bv.Void() MountFolderError._already_mounted_validator = bv.Void() +MountFolderError._no_permission_validator = bv.Void() MountFolderError._other_validator = bv.Void() MountFolderError._tagmap = { 'access_error': MountFolderError._access_error_validator, 'inside_shared_folder': MountFolderError._inside_shared_folder_validator, 'insufficient_quota': MountFolderError._insufficient_quota_validator, 'already_mounted': MountFolderError._already_mounted_validator, + 'no_permission': MountFolderError._no_permission_validator, 'other': MountFolderError._other_validator, } MountFolderError.inside_shared_folder = MountFolderError('inside_shared_folder') MountFolderError.insufficient_quota = MountFolderError('insufficient_quota') MountFolderError.already_mounted = MountFolderError('already_mounted') +MountFolderError.no_permission = MountFolderError('no_permission') MountFolderError.other = MountFolderError('other') PathLinkMetadata._path_validator = bv.String() @@ -8900,18 +9385,24 @@ def __repr__(self): RelinquishFolderMembershipError._folder_owner_validator = bv.Void() RelinquishFolderMembershipError._mounted_validator = bv.Void() RelinquishFolderMembershipError._group_access_validator = bv.Void() +RelinquishFolderMembershipError._team_folder_validator = bv.Void() +RelinquishFolderMembershipError._no_permission_validator = bv.Void() RelinquishFolderMembershipError._other_validator = bv.Void() RelinquishFolderMembershipError._tagmap = { 'access_error': RelinquishFolderMembershipError._access_error_validator, 'folder_owner': RelinquishFolderMembershipError._folder_owner_validator, 'mounted': RelinquishFolderMembershipError._mounted_validator, 'group_access': RelinquishFolderMembershipError._group_access_validator, + 'team_folder': RelinquishFolderMembershipError._team_folder_validator, + 'no_permission': RelinquishFolderMembershipError._no_permission_validator, 'other': RelinquishFolderMembershipError._other_validator, } RelinquishFolderMembershipError.folder_owner = RelinquishFolderMembershipError('folder_owner') RelinquishFolderMembershipError.mounted = RelinquishFolderMembershipError('mounted') RelinquishFolderMembershipError.group_access = RelinquishFolderMembershipError('group_access') +RelinquishFolderMembershipError.team_folder = RelinquishFolderMembershipError('team_folder') +RelinquishFolderMembershipError.no_permission = RelinquishFolderMembershipError('no_permission') RelinquishFolderMembershipError.other = RelinquishFolderMembershipError('other') RemoveFolderMemberArg._shared_folder_id_validator = bv.String(pattern=u'[-_0-9a-zA-Z:]+') @@ -8932,17 +9423,23 @@ def __repr__(self): RemoveFolderMemberError._member_error_validator = bv.Union(SharedFolderMemberError) RemoveFolderMemberError._folder_owner_validator = bv.Void() RemoveFolderMemberError._group_access_validator = bv.Void() +RemoveFolderMemberError._team_folder_validator = bv.Void() +RemoveFolderMemberError._no_permission_validator = bv.Void() RemoveFolderMemberError._other_validator = bv.Void() RemoveFolderMemberError._tagmap = { 'access_error': RemoveFolderMemberError._access_error_validator, 'member_error': RemoveFolderMemberError._member_error_validator, 'folder_owner': RemoveFolderMemberError._folder_owner_validator, 'group_access': RemoveFolderMemberError._group_access_validator, + 'team_folder': RemoveFolderMemberError._team_folder_validator, + 'no_permission': RemoveFolderMemberError._no_permission_validator, 'other': RemoveFolderMemberError._other_validator, } RemoveFolderMemberError.folder_owner = RemoveFolderMemberError('folder_owner') RemoveFolderMemberError.group_access = RemoveFolderMemberError('group_access') +RemoveFolderMemberError.team_folder = RemoveFolderMemberError('team_folder') +RemoveFolderMemberError.no_permission = RemoveFolderMemberError('no_permission') RemoveFolderMemberError.other = RemoveFolderMemberError('other') RequestedVisibility._public_validator = bv.Void() @@ -9069,26 +9566,20 @@ def __repr__(self): SharedFolderAccessError._invalid_id_validator = bv.Void() SharedFolderAccessError._not_a_member_validator = bv.Void() -SharedFolderAccessError._no_permission_validator = bv.Void() SharedFolderAccessError._email_unverified_validator = bv.Void() -SharedFolderAccessError._team_folder_validator = bv.Void() SharedFolderAccessError._unmounted_validator = bv.Void() SharedFolderAccessError._other_validator = bv.Void() SharedFolderAccessError._tagmap = { 'invalid_id': SharedFolderAccessError._invalid_id_validator, 'not_a_member': SharedFolderAccessError._not_a_member_validator, - 'no_permission': SharedFolderAccessError._no_permission_validator, 'email_unverified': SharedFolderAccessError._email_unverified_validator, - 'team_folder': SharedFolderAccessError._team_folder_validator, 'unmounted': SharedFolderAccessError._unmounted_validator, 'other': SharedFolderAccessError._other_validator, } SharedFolderAccessError.invalid_id = SharedFolderAccessError('invalid_id') SharedFolderAccessError.not_a_member = SharedFolderAccessError('not_a_member') -SharedFolderAccessError.no_permission = SharedFolderAccessError('no_permission') SharedFolderAccessError.email_unverified = SharedFolderAccessError('email_unverified') -SharedFolderAccessError.team_folder = SharedFolderAccessError('team_folder') SharedFolderAccessError.unmounted = SharedFolderAccessError('unmounted') SharedFolderAccessError.other = SharedFolderAccessError('other') @@ -9122,30 +9613,35 @@ def __repr__(self): ('cursor', SharedFolderMembers._cursor_validator), ] +SharedFolderMetadataBase._access_type_validator = bv.Union(AccessLevel) +SharedFolderMetadataBase._is_team_folder_validator = bv.Boolean() +SharedFolderMetadataBase._policy_validator = bv.Struct(FolderPolicy) +SharedFolderMetadataBase._permissions_validator = bv.Nullable(bv.List(bv.Struct(FolderPermission))) +SharedFolderMetadataBase._all_field_names_ = set([ + 'access_type', + 'is_team_folder', + 'policy', + 'permissions', +]) +SharedFolderMetadataBase._all_fields_ = [ + ('access_type', SharedFolderMetadataBase._access_type_validator), + ('is_team_folder', SharedFolderMetadataBase._is_team_folder_validator), + ('policy', SharedFolderMetadataBase._policy_validator), + ('permissions', SharedFolderMetadataBase._permissions_validator), +] + SharedFolderMetadata._path_lower_validator = bv.Nullable(bv.String()) SharedFolderMetadata._name_validator = bv.String() SharedFolderMetadata._shared_folder_id_validator = bv.String(pattern=u'[-_0-9a-zA-Z:]+') -SharedFolderMetadata._access_type_validator = bv.Union(AccessLevel) -SharedFolderMetadata._is_team_folder_validator = bv.Boolean() -SharedFolderMetadata._policy_validator = bv.Struct(FolderPolicy) -SharedFolderMetadata._permissions_validator = bv.Nullable(bv.List(bv.Struct(FolderPermission))) -SharedFolderMetadata._all_field_names_ = set([ +SharedFolderMetadata._all_field_names_ = SharedFolderMetadataBase._all_field_names_.union(set([ 'path_lower', 'name', 'shared_folder_id', - 'access_type', - 'is_team_folder', - 'policy', - 'permissions', -]) -SharedFolderMetadata._all_fields_ = [ +])) +SharedFolderMetadata._all_fields_ = SharedFolderMetadataBase._all_fields_ + [ ('path_lower', SharedFolderMetadata._path_lower_validator), ('name', SharedFolderMetadata._name_validator), ('shared_folder_id', SharedFolderMetadata._shared_folder_id_validator), - ('access_type', SharedFolderMetadata._access_type_validator), - ('is_team_folder', SharedFolderMetadata._is_team_folder_validator), - ('policy', SharedFolderMetadata._policy_validator), - ('permissions', SharedFolderMetadata._permissions_validator), ] SharedLinkAccessFailureReason._login_required_validator = bv.Void() @@ -9233,27 +9729,30 @@ def __repr__(self): ] TransferFolderError._access_error_validator = bv.Union(SharedFolderAccessError) -TransferFolderError._no_permission_validator = bv.Void() TransferFolderError._invalid_dropbox_id_validator = bv.Void() TransferFolderError._new_owner_not_a_member_validator = bv.Void() TransferFolderError._new_owner_unmounted_validator = bv.Void() TransferFolderError._new_owner_email_unverified_validator = bv.Void() +TransferFolderError._team_folder_validator = bv.Void() +TransferFolderError._no_permission_validator = bv.Void() TransferFolderError._other_validator = bv.Void() TransferFolderError._tagmap = { 'access_error': TransferFolderError._access_error_validator, - 'no_permission': TransferFolderError._no_permission_validator, 'invalid_dropbox_id': TransferFolderError._invalid_dropbox_id_validator, 'new_owner_not_a_member': TransferFolderError._new_owner_not_a_member_validator, 'new_owner_unmounted': TransferFolderError._new_owner_unmounted_validator, 'new_owner_email_unverified': TransferFolderError._new_owner_email_unverified_validator, + 'team_folder': TransferFolderError._team_folder_validator, + 'no_permission': TransferFolderError._no_permission_validator, 'other': TransferFolderError._other_validator, } -TransferFolderError.no_permission = TransferFolderError('no_permission') TransferFolderError.invalid_dropbox_id = TransferFolderError('invalid_dropbox_id') TransferFolderError.new_owner_not_a_member = TransferFolderError('new_owner_not_a_member') TransferFolderError.new_owner_unmounted = TransferFolderError('new_owner_unmounted') TransferFolderError.new_owner_email_unverified = TransferFolderError('new_owner_email_unverified') +TransferFolderError.team_folder = TransferFolderError('team_folder') +TransferFolderError.no_permission = TransferFolderError('no_permission') TransferFolderError.other = TransferFolderError('other') UnmountFolderArg._shared_folder_id_validator = bv.String(pattern=u'[-_0-9a-zA-Z:]+') @@ -9261,12 +9760,15 @@ def __repr__(self): UnmountFolderArg._all_fields_ = [('shared_folder_id', UnmountFolderArg._shared_folder_id_validator)] UnmountFolderError._access_error_validator = bv.Union(SharedFolderAccessError) +UnmountFolderError._no_permission_validator = bv.Void() UnmountFolderError._other_validator = bv.Void() UnmountFolderError._tagmap = { 'access_error': UnmountFolderError._access_error_validator, + 'no_permission': UnmountFolderError._no_permission_validator, 'other': UnmountFolderError._other_validator, } +UnmountFolderError.no_permission = UnmountFolderError('no_permission') UnmountFolderError.other = UnmountFolderError('other') UnshareFolderArg._shared_folder_id_validator = bv.String(pattern=u'[-_0-9a-zA-Z:]+') @@ -9281,12 +9783,18 @@ def __repr__(self): ] UnshareFolderError._access_error_validator = bv.Union(SharedFolderAccessError) +UnshareFolderError._team_folder_validator = bv.Void() +UnshareFolderError._no_permission_validator = bv.Void() UnshareFolderError._other_validator = bv.Void() UnshareFolderError._tagmap = { 'access_error': UnshareFolderError._access_error_validator, + 'team_folder': UnshareFolderError._team_folder_validator, + 'no_permission': UnshareFolderError._no_permission_validator, 'other': UnshareFolderError._other_validator, } +UnshareFolderError.team_folder = UnshareFolderError('team_folder') +UnshareFolderError.no_permission = UnshareFolderError('no_permission') UnshareFolderError.other = UnshareFolderError('other') UpdateFolderMemberArg._shared_folder_id_validator = bv.String(pattern=u'[-_0-9a-zA-Z:]+') @@ -9306,15 +9814,18 @@ def __repr__(self): UpdateFolderMemberError._access_error_validator = bv.Union(SharedFolderAccessError) UpdateFolderMemberError._member_error_validator = bv.Union(SharedFolderMemberError) UpdateFolderMemberError._insufficient_plan_validator = bv.Void() +UpdateFolderMemberError._no_permission_validator = bv.Void() UpdateFolderMemberError._other_validator = bv.Void() UpdateFolderMemberError._tagmap = { 'access_error': UpdateFolderMemberError._access_error_validator, 'member_error': UpdateFolderMemberError._member_error_validator, 'insufficient_plan': UpdateFolderMemberError._insufficient_plan_validator, + 'no_permission': UpdateFolderMemberError._no_permission_validator, 'other': UpdateFolderMemberError._other_validator, } UpdateFolderMemberError.insufficient_plan = UpdateFolderMemberError('insufficient_plan') +UpdateFolderMemberError.no_permission = UpdateFolderMemberError('no_permission') UpdateFolderMemberError.other = UpdateFolderMemberError('other') UpdateFolderPolicyArg._shared_folder_id_validator = bv.String(pattern=u'[-_0-9a-zA-Z:]+') diff --git a/dropbox/team.py b/dropbox/team.py index 66d01967..4df52405 100644 --- a/dropbox/team.py +++ b/dropbox/team.py @@ -8275,8 +8275,7 @@ class MembersSetProfileError(MemberSelectorError): :ivar external_id_used_by_other_user: The external ID is already in use by another team member. :ivar set_profile_disallowed: Setting profile disallowed - :ivar param_cannot_be_empty: New new_email, new_given_name or new_surname - value cannot be empty. + :ivar param_cannot_be_empty: Parameter new_email cannot be empty. :ivar other: An unspecified error. """ @@ -11349,9 +11348,9 @@ def __repr__(self): ('access_type', MemberAccess._access_type_validator), ] -MemberAddArg._member_email_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") -MemberAddArg._member_given_name_validator = bv.String(min_length=1, pattern=u'[^/:?*<>"|]*') -MemberAddArg._member_surname_validator = bv.String(min_length=1, pattern=u'[^/:?*<>"|]*') +MemberAddArg._member_email_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberAddArg._member_given_name_validator = bv.String(min_length=1, max_length=100, pattern=u'[^/:?*<>"|]*') +MemberAddArg._member_surname_validator = bv.String(min_length=1, max_length=100, pattern=u'[^/:?*<>"|]*') MemberAddArg._member_external_id_validator = bv.Nullable(bv.String(max_length=64)) MemberAddArg._send_welcome_email_validator = bv.Boolean() MemberAddArg._role_validator = bv.Union(AdminTier) @@ -11373,14 +11372,14 @@ def __repr__(self): ] MemberAddResult._success_validator = bv.Struct(TeamMemberInfo) -MemberAddResult._team_license_limit_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") -MemberAddResult._free_team_member_limit_reached_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") -MemberAddResult._user_already_on_team_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") -MemberAddResult._user_on_another_team_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") -MemberAddResult._user_already_paired_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") -MemberAddResult._user_migration_failed_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") -MemberAddResult._duplicate_external_member_id_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") -MemberAddResult._user_creation_failed_validator = bv.String(pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberAddResult._team_license_limit_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberAddResult._free_team_member_limit_reached_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberAddResult._user_already_on_team_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberAddResult._user_on_another_team_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberAddResult._user_already_paired_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberAddResult._user_migration_failed_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberAddResult._duplicate_external_member_id_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") +MemberAddResult._user_creation_failed_validator = bv.String(max_length=255, pattern=u"^['&A-Za-z0-9._%+-]+@[A-Za-z0-9-][A-Za-z0-9.-]*.[A-Za-z]{2,15}$") MemberAddResult._tagmap = { 'success': MemberAddResult._success_validator, 'team_license_limit': MemberAddResult._team_license_limit_validator, @@ -11656,8 +11655,8 @@ def __repr__(self): MembersSetProfileArg._user_validator = bv.Union(UserSelectorArg) MembersSetProfileArg._new_email_validator = bv.Nullable(bv.String()) MembersSetProfileArg._new_external_id_validator = bv.Nullable(bv.String()) -MembersSetProfileArg._new_given_name_validator = bv.Nullable(bv.String()) -MembersSetProfileArg._new_surname_validator = bv.Nullable(bv.String()) +MembersSetProfileArg._new_given_name_validator = bv.Nullable(bv.String(min_length=1, max_length=100, pattern=u'[^/:?*<>"|]*')) +MembersSetProfileArg._new_surname_validator = bv.Nullable(bv.String(min_length=1, max_length=100, pattern=u'[^/:?*<>"|]*')) MembersSetProfileArg._all_field_names_ = set([ 'user', 'new_email', diff --git a/dropbox/users.py b/dropbox/users.py index 426a92f1..6d612678 100644 --- a/dropbox/users.py +++ b/dropbox/users.py @@ -17,6 +17,12 @@ class Account(object): :ivar account_id: The user's unique Dropbox ID. :ivar name: Details of a user's name. + :ivar email: The user's e-mail address. Do not rely on this without checking + the ``email_verified`` field. Even then, it's possible that the user has + since lost access to their e-mail. + :ivar email_verified: Whether the user has verified their e-mail address. + :ivar profile_photo_url: URL for the photo representing the user, if one is + set. """ __slots__ = [ @@ -24,21 +30,42 @@ class Account(object): '_account_id_present', '_name_value', '_name_present', + '_email_value', + '_email_present', + '_email_verified_value', + '_email_verified_present', + '_profile_photo_url_value', + '_profile_photo_url_present', ] _has_required_fields = True def __init__(self, account_id=None, - name=None): + name=None, + email=None, + email_verified=None, + profile_photo_url=None): self._account_id_value = None self._account_id_present = False self._name_value = None self._name_present = False + self._email_value = None + self._email_present = False + self._email_verified_value = None + self._email_verified_present = False + self._profile_photo_url_value = None + self._profile_photo_url_present = False if account_id is not None: self.account_id = account_id if name is not None: self.name = name + if email is not None: + self.email = email + if email_verified is not None: + self.email_verified = email_verified + if profile_photo_url is not None: + self.profile_photo_url = profile_photo_url @property def account_id(self): @@ -86,10 +113,87 @@ def name(self): self._name_value = None self._name_present = False + @property + def email(self): + """ + The user's e-mail address. Do not rely on this without checking the + ``email_verified`` field. Even then, it's possible that the user has + since lost access to their e-mail. + + :rtype: str + """ + if self._email_present: + return self._email_value + else: + raise AttributeError("missing required field 'email'") + + @email.setter + def email(self, val): + val = self._email_validator.validate(val) + self._email_value = val + self._email_present = True + + @email.deleter + def email(self): + self._email_value = None + self._email_present = False + + @property + def email_verified(self): + """ + Whether the user has verified their e-mail address. + + :rtype: bool + """ + if self._email_verified_present: + return self._email_verified_value + else: + raise AttributeError("missing required field 'email_verified'") + + @email_verified.setter + def email_verified(self, val): + val = self._email_verified_validator.validate(val) + self._email_verified_value = val + self._email_verified_present = True + + @email_verified.deleter + def email_verified(self): + self._email_verified_value = None + self._email_verified_present = False + + @property + def profile_photo_url(self): + """ + URL for the photo representing the user, if one is set. + + :rtype: str + """ + if self._profile_photo_url_present: + return self._profile_photo_url_value + else: + return None + + @profile_photo_url.setter + def profile_photo_url(self, val): + if val is None: + del self.profile_photo_url + return + val = self._profile_photo_url_validator.validate(val) + self._profile_photo_url_value = val + self._profile_photo_url_present = True + + @profile_photo_url.deleter + def profile_photo_url(self): + self._profile_photo_url_value = None + self._profile_photo_url_present = False + def __repr__(self): - return 'Account(account_id={!r}, name={!r})'.format( + return 'Account(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, profile_photo_url={!r})'.format( self._account_id_value, self._name_value, + self._email_value, + self._email_verified_value, + self._profile_photo_url_value, ) class AccountType(object): @@ -160,11 +264,16 @@ class BasicAccount(Account): :ivar is_teammate: Whether this user is a teammate of the current user. If this account is the current user's account, then this will be ``True``. + :ivar team_member_id: The user's unique team member id. This field will only + be present if the user is part of a team and ``is_teammate`` is + ``True``. """ __slots__ = [ '_is_teammate_value', '_is_teammate_present', + '_team_member_id_value', + '_team_member_id_present', ] _has_required_fields = True @@ -172,13 +281,24 @@ class BasicAccount(Account): def __init__(self, account_id=None, name=None, - is_teammate=None): + email=None, + email_verified=None, + is_teammate=None, + profile_photo_url=None, + team_member_id=None): super(BasicAccount, self).__init__(account_id, - name) + name, + email, + email_verified, + profile_photo_url) self._is_teammate_value = None self._is_teammate_present = False + self._team_member_id_value = None + self._team_member_id_present = False if is_teammate is not None: self.is_teammate = is_teammate + if team_member_id is not None: + self.team_member_id = team_member_id @property def is_teammate(self): @@ -204,21 +324,48 @@ def is_teammate(self): self._is_teammate_value = None self._is_teammate_present = False + @property + def team_member_id(self): + """ + The user's unique team member id. This field will only be present if the + user is part of a team and ``is_teammate`` is ``True``. + + :rtype: str + """ + if self._team_member_id_present: + return self._team_member_id_value + else: + return None + + @team_member_id.setter + def team_member_id(self, val): + if val is None: + del self.team_member_id + return + val = self._team_member_id_validator.validate(val) + self._team_member_id_value = val + self._team_member_id_present = True + + @team_member_id.deleter + def team_member_id(self): + self._team_member_id_value = None + self._team_member_id_present = False + def __repr__(self): - return 'BasicAccount(account_id={!r}, name={!r}, is_teammate={!r})'.format( + return 'BasicAccount(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, is_teammate={!r}, profile_photo_url={!r}, team_member_id={!r})'.format( self._account_id_value, self._name_value, + self._email_value, + self._email_verified_value, self._is_teammate_value, + self._profile_photo_url_value, + self._team_member_id_value, ) class FullAccount(Account): """ Detailed information about the current user's account. - :ivar email: The user's e-mail address. Do not rely on this without checking - the ``email_verified`` field. Even then, it's possible that the user has - since lost access to their e-mail. - :ivar email_verified: Whether the user has verified their e-mail address. :ivar country: The user's two-letter country code, if available. Country codes are based on `ISO 3166-1 `_. @@ -228,6 +375,8 @@ class FullAccount(Account): `_. :ivar team: If this account is a member of a team, information about that team. + :ivar team_member_id: This account's unique team member id. This field will + only be present if ``team`` is present. :ivar is_paired: Whether the user has a personal and work account. If the current account is personal, then ``team`` will always be None, but ``is_paired`` will indicate if a work account is linked. @@ -235,10 +384,6 @@ class FullAccount(Account): """ __slots__ = [ - '_email_value', - '_email_present', - '_email_verified_value', - '_email_verified_present', '_country_value', '_country_present', '_locale_value', @@ -247,6 +392,8 @@ class FullAccount(Account): '_referral_link_present', '_team_value', '_team_present', + '_team_member_id_value', + '_team_member_id_present', '_is_paired_value', '_is_paired_present', '_account_type_value', @@ -264,14 +411,15 @@ def __init__(self, referral_link=None, is_paired=None, account_type=None, + profile_photo_url=None, country=None, - team=None): + team=None, + team_member_id=None): super(FullAccount, self).__init__(account_id, - name) - self._email_value = None - self._email_present = False - self._email_verified_value = None - self._email_verified_present = False + name, + email, + email_verified, + profile_photo_url) self._country_value = None self._country_present = False self._locale_value = None @@ -280,14 +428,12 @@ def __init__(self, self._referral_link_present = False self._team_value = None self._team_present = False + self._team_member_id_value = None + self._team_member_id_present = False self._is_paired_value = None self._is_paired_present = False self._account_type_value = None self._account_type_present = False - if email is not None: - self.email = email - if email_verified is not None: - self.email_verified = email_verified if country is not None: self.country = country if locale is not None: @@ -296,59 +442,13 @@ def __init__(self, self.referral_link = referral_link if team is not None: self.team = team + if team_member_id is not None: + self.team_member_id = team_member_id if is_paired is not None: self.is_paired = is_paired if account_type is not None: self.account_type = account_type - @property - def email(self): - """ - The user's e-mail address. Do not rely on this without checking the - ``email_verified`` field. Even then, it's possible that the user has - since lost access to their e-mail. - - :rtype: str - """ - if self._email_present: - return self._email_value - else: - raise AttributeError("missing required field 'email'") - - @email.setter - def email(self, val): - val = self._email_validator.validate(val) - self._email_value = val - self._email_present = True - - @email.deleter - def email(self): - self._email_value = None - self._email_present = False - - @property - def email_verified(self): - """ - Whether the user has verified their e-mail address. - - :rtype: bool - """ - if self._email_verified_present: - return self._email_verified_value - else: - raise AttributeError("missing required field 'email_verified'") - - @email_verified.setter - def email_verified(self, val): - val = self._email_verified_validator.validate(val) - self._email_verified_value = val - self._email_verified_present = True - - @email_verified.deleter - def email_verified(self): - self._email_verified_value = None - self._email_verified_present = False - @property def country(self): """ @@ -449,6 +549,33 @@ def team(self): self._team_value = None self._team_present = False + @property + def team_member_id(self): + """ + This account's unique team member id. This field will only be present if + ``team`` is present. + + :rtype: str + """ + if self._team_member_id_present: + return self._team_member_id_value + else: + return None + + @team_member_id.setter + def team_member_id(self, val): + if val is None: + del self.team_member_id + return + val = self._team_member_id_validator.validate(val) + self._team_member_id_value = val + self._team_member_id_present = True + + @team_member_id.deleter + def team_member_id(self): + self._team_member_id_value = None + self._team_member_id_present = False + @property def is_paired(self): """ @@ -498,7 +625,7 @@ def account_type(self): self._account_type_present = False def __repr__(self): - return 'FullAccount(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, locale={!r}, referral_link={!r}, is_paired={!r}, account_type={!r}, country={!r}, team={!r})'.format( + return 'FullAccount(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, locale={!r}, referral_link={!r}, is_paired={!r}, account_type={!r}, profile_photo_url={!r}, country={!r}, team={!r}, team_member_id={!r})'.format( self._account_id_value, self._name_value, self._email_value, @@ -507,8 +634,10 @@ def __repr__(self): self._referral_link_value, self._is_paired_value, self._account_type_value, + self._profile_photo_url_value, self._country_value, self._team_value, + self._team_member_id_value, ) class GetAccountArg(object): @@ -1272,13 +1401,22 @@ def __repr__(self): Account._account_id_validator = bv.String(min_length=40, max_length=40) Account._name_validator = bv.Struct(Name) +Account._email_validator = bv.String() +Account._email_verified_validator = bv.Boolean() +Account._profile_photo_url_validator = bv.Nullable(bv.String()) Account._all_field_names_ = set([ 'account_id', 'name', + 'email', + 'email_verified', + 'profile_photo_url', ]) Account._all_fields_ = [ ('account_id', Account._account_id_validator), ('name', Account._name_validator), + ('email', Account._email_validator), + ('email_verified', Account._email_verified_validator), + ('profile_photo_url', Account._profile_photo_url_validator), ] AccountType._basic_validator = bv.Void() @@ -1295,34 +1433,38 @@ def __repr__(self): AccountType.business = AccountType('business') BasicAccount._is_teammate_validator = bv.Boolean() -BasicAccount._all_field_names_ = Account._all_field_names_.union(set(['is_teammate'])) -BasicAccount._all_fields_ = Account._all_fields_ + [('is_teammate', BasicAccount._is_teammate_validator)] +BasicAccount._team_member_id_validator = bv.Nullable(bv.String()) +BasicAccount._all_field_names_ = Account._all_field_names_.union(set([ + 'is_teammate', + 'team_member_id', +])) +BasicAccount._all_fields_ = Account._all_fields_ + [ + ('is_teammate', BasicAccount._is_teammate_validator), + ('team_member_id', BasicAccount._team_member_id_validator), +] -FullAccount._email_validator = bv.String() -FullAccount._email_verified_validator = bv.Boolean() FullAccount._country_validator = bv.Nullable(bv.String(min_length=2, max_length=2)) FullAccount._locale_validator = bv.String(min_length=2) FullAccount._referral_link_validator = bv.String() FullAccount._team_validator = bv.Nullable(bv.Struct(Team)) +FullAccount._team_member_id_validator = bv.Nullable(bv.String()) FullAccount._is_paired_validator = bv.Boolean() FullAccount._account_type_validator = bv.Union(AccountType) FullAccount._all_field_names_ = Account._all_field_names_.union(set([ - 'email', - 'email_verified', 'country', 'locale', 'referral_link', 'team', + 'team_member_id', 'is_paired', 'account_type', ])) FullAccount._all_fields_ = Account._all_fields_ + [ - ('email', FullAccount._email_validator), - ('email_verified', FullAccount._email_verified_validator), ('country', FullAccount._country_validator), ('locale', FullAccount._locale_validator), ('referral_link', FullAccount._referral_link_validator), ('team', FullAccount._team_validator), + ('team_member_id', FullAccount._team_member_id_validator), ('is_paired', FullAccount._is_paired_validator), ('account_type', FullAccount._account_type_validator), ] diff --git a/setup.py b/setup.py index 62604420..fa2c133a 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ dist = setup( name='dropbox', - version='5.2.2', + version='6.0', description='Official Dropbox API Client', author='Dropbox', author_email='dev-platform@dropbox.com',