[Python-modules-commits] [python-dropbox] 01/04: New upstream version 8.5.0

Michael Fladischer fladi at moszumanska.debian.org
Thu Nov 16 18:48:47 UTC 2017


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch debian/master
in repository python-dropbox.

commit b50124a78c5d717745726dd846ab7bc6c93cf4de
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Thu Nov 16 10:32:57 2017 +0100

    New upstream version 8.5.0
---
 PKG-INFO                     |    4 +-
 README.rst                   |    2 +-
 dropbox.egg-info/PKG-INFO    |    4 +-
 dropbox/async.py             |    1 +
 dropbox/auth.py              |    1 +
 dropbox/base.py              |  133 ++-
 dropbox/base_team.py         |   89 +-
 dropbox/common.py            |  373 ++++---
 dropbox/dropbox.py           |    2 +-
 dropbox/file_properties.py   |  352 ++++++-
 dropbox/file_requests.py     |    1 +
 dropbox/files.py             |  212 +++-
 dropbox/paper.py             |    1 +
 dropbox/sharing.py           |   18 +-
 dropbox/stone_base.py        |   35 +-
 dropbox/stone_serializers.py |  897 ++++++++--------
 dropbox/stone_validators.py  |   80 +-
 dropbox/team.py              |  767 +++++++++++++-
 dropbox/team_common.py       |    1 +
 dropbox/team_log.py          | 2391 +++++++++++++++++++++++-------------------
 dropbox/team_policies.py     |  109 ++
 dropbox/users.py             |   40 +-
 dropbox/users_common.py      |    1 +
 23 files changed, 3769 insertions(+), 1745 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index abb5a39..f606cab 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: dropbox
-Version: 8.4.1
+Version: 8.5.0
 Summary: Official Dropbox API Client
 Home-page: http://www.dropbox.com/developers
 Author: Dropbox
@@ -9,7 +9,7 @@ License: MIT License
 Description: Dropbox for Python
         ==================
         
-        .. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.4.1
+        .. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.5.0
             :target: https://travis-ci.org/dropbox/dropbox-sdk-python
         
         .. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
diff --git a/README.rst b/README.rst
index 80bb6c7..7e98966 100644
--- a/README.rst
+++ b/README.rst
@@ -1,7 +1,7 @@
 Dropbox for Python
 ==================
 
-.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.4.1
+.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.5.0
     :target: https://travis-ci.org/dropbox/dropbox-sdk-python
 
 .. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
diff --git a/dropbox.egg-info/PKG-INFO b/dropbox.egg-info/PKG-INFO
index abb5a39..f606cab 100644
--- a/dropbox.egg-info/PKG-INFO
+++ b/dropbox.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: dropbox
-Version: 8.4.1
+Version: 8.5.0
 Summary: Official Dropbox API Client
 Home-page: http://www.dropbox.com/developers
 Author: Dropbox
@@ -9,7 +9,7 @@ License: MIT License
 Description: Dropbox for Python
         ==================
         
-        .. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.4.1
+        .. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v8.5.0
             :target: https://travis-ci.org/dropbox/dropbox-sdk-python
         
         .. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
diff --git a/dropbox/async.py b/dropbox/async.py
index 453d9e9..8436beb 100644
--- a/dropbox/async.py
+++ b/dropbox/async.py
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 # Auto-generated by Stone, do not modify.
+# @generated
 # flake8: noqa
 # pylint: skip-file
 try:
diff --git a/dropbox/auth.py b/dropbox/auth.py
index 2dd5ef0..e8200de 100644
--- a/dropbox/auth.py
+++ b/dropbox/auth.py
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 # Auto-generated by Stone, do not modify.
+# @generated
 # flake8: noqa
 # pylint: skip-file
 try:
diff --git a/dropbox/base.py b/dropbox/base.py
index 583839c..0ae3982 100644
--- a/dropbox/base.py
+++ b/dropbox/base.py
@@ -139,8 +139,8 @@ class DropboxBase(object):
                                           path,
                                           property_template_ids):
         """
-        Remove the specified property group from the file. To remove specific
-        property field key value pairs, see
+        Permanently removes the specified property group from the file. To
+        remove specific property field key value pairs, see
         :meth:`file_properties_properties_update`. To update a template, see
         :meth:`file_properties_templates_update_for_user` or
         :meth:`file_properties_templates_update_for_team`. Templates can't be
@@ -192,6 +192,31 @@ class DropboxBase(object):
         )
         return r
 
+    def file_properties_properties_search_continue(self,
+                                                   cursor):
+        """
+        Once a cursor has been retrieved from
+        :meth:`file_properties_properties_search`, use this to paginate through
+        all search results.
+
+        :param str cursor: The cursor returned by your last call to
+            :meth:`file_properties_properties_search` or
+            :meth:`file_properties_properties_search_continue`.
+        :rtype: :class:`dropbox.file_properties.PropertiesSearchResult`
+        :raises: :class:`dropbox.exceptions.ApiError`
+
+        If this raises, ApiError.reason is of type:
+            :class:`dropbox.file_properties.PropertiesSearchContinueError`
+        """
+        arg = file_properties.PropertiesSearchContinueArg(cursor)
+        r = self.request(
+            file_properties.properties_search_continue,
+            'file_properties',
+            arg,
+            None,
+        )
+        return r
+
     def file_properties_properties_update(self,
                                           path,
                                           update_property_groups):
@@ -230,7 +255,7 @@ class DropboxBase(object):
         """
         Add a template associated with a team. See
         :meth:`file_properties_properties_add` to add properties to a file or
-        folder.
+        folder. Note: this endpoint will create team-owned templates.
 
         :rtype: :class:`dropbox.file_properties.AddTemplateResult`
         :raises: :class:`dropbox.exceptions.ApiError`
@@ -363,6 +388,58 @@ class DropboxBase(object):
         )
         return r
 
+    def file_properties_templates_remove_for_team(self,
+                                                  template_id):
+        """
+        Permanently removes the specified template created from
+        :meth:`file_properties_templates_add_for_user`. All properties
+        associated with the template will also be removed. This action cannot be
+        undone.
+
+        :param str template_id: An identifier for a template created by
+            :meth:`file_properties_templates_add_for_user` or
+            :meth:`file_properties_templates_add_for_team`.
+        :rtype: None
+        :raises: :class:`dropbox.exceptions.ApiError`
+
+        If this raises, ApiError.reason is of type:
+            :class:`dropbox.file_properties.TemplateError`
+        """
+        arg = file_properties.RemoveTemplateArg(template_id)
+        r = self.request(
+            file_properties.templates_remove_for_team,
+            'file_properties',
+            arg,
+            None,
+        )
+        return None
+
+    def file_properties_templates_remove_for_user(self,
+                                                  template_id):
+        """
+        Permanently removes the specified template created from
+        :meth:`file_properties_templates_add_for_user`. All properties
+        associated with the template will also be removed. This action cannot be
+        undone.
+
+        :param str template_id: An identifier for a template created by
+            :meth:`file_properties_templates_add_for_user` or
+            :meth:`file_properties_templates_add_for_team`.
+        :rtype: None
+        :raises: :class:`dropbox.exceptions.ApiError`
+
+        If this raises, ApiError.reason is of type:
+            :class:`dropbox.file_properties.TemplateError`
+        """
+        arg = file_properties.RemoveTemplateArg(template_id)
+        r = self.request(
+            file_properties.templates_remove_for_user,
+            'file_properties',
+            arg,
+            None,
+        )
+        return None
+
     def file_properties_templates_update_for_team(self,
                                                   template_id,
                                                   name=None,
@@ -554,6 +631,7 @@ class DropboxBase(object):
                                  include_media_info=False,
                                  include_deleted=False,
                                  include_has_explicit_shared_members=False,
+                                 include_property_groups=None,
                                  include_property_templates=None):
         """
         Returns the metadata for a file or folder. This is an alpha endpoint
@@ -569,10 +647,15 @@ class DropboxBase(object):
         If this raises, ApiError.reason is of type:
             :class:`dropbox.files.AlphaGetMetadataError`
         """
+        warnings.warn(
+            'alpha/get_metadata is deprecated. Use get_metadata.',
+            DeprecationWarning,
+        )
         arg = files.AlphaGetMetadataArg(path,
                                         include_media_info,
                                         include_deleted,
                                         include_has_explicit_shared_members,
+                                        include_property_groups,
                                         include_property_templates)
         r = self.request(
             files.alpha_get_metadata,
@@ -598,14 +681,16 @@ class DropboxBase(object):
         :meth:`files_upload_session_start`.
 
         :param bytes f: Contents to upload.
-        :param Nullable property_groups: List of custom properties to add to
-            file.
         :rtype: :class:`dropbox.files.FileMetadata`
         :raises: :class:`dropbox.exceptions.ApiError`
 
         If this raises, ApiError.reason is of type:
             :class:`dropbox.files.UploadErrorWithProperties`
         """
+        warnings.warn(
+            'alpha/upload is deprecated. Use alpha/upload.',
+            DeprecationWarning,
+        )
         arg = files.CommitInfoWithProperties(path,
                                              mode,
                                              autorename,
@@ -1032,7 +1117,8 @@ class DropboxBase(object):
                            path,
                            include_media_info=False,
                            include_deleted=False,
-                           include_has_explicit_shared_members=False):
+                           include_has_explicit_shared_members=False,
+                           include_property_groups=None):
         """
         Returns the metadata for a file or folder. Note: Metadata for the root
         folder is unsupported.
@@ -1047,6 +1133,10 @@ class DropboxBase(object):
         :param bool include_has_explicit_shared_members: If true, the results
             will include a flag for each file indicating whether or not  that
             file has any explicit members.
+        :param Nullable include_property_groups: If set to a valid list of
+            template IDs, ``FileMetadata.property_groups`` is set if there
+            exists property data associated with the file and each of the listed
+            templates.
         :rtype: :class:`dropbox.files.Metadata`
         :raises: :class:`dropbox.exceptions.ApiError`
 
@@ -1056,7 +1146,8 @@ class DropboxBase(object):
         arg = files.GetMetadataArg(path,
                                    include_media_info,
                                    include_deleted,
-                                   include_has_explicit_shared_members)
+                                   include_has_explicit_shared_members,
+                                   include_property_groups)
         r = self.request(
             files.get_metadata,
             'files',
@@ -1266,7 +1357,8 @@ class DropboxBase(object):
                           include_has_explicit_shared_members=False,
                           include_mounted_folders=True,
                           limit=None,
-                          shared_link=None):
+                          shared_link=None,
+                          include_property_groups=None):
         """
         Starts returning the contents of a folder. If the result's
         ``ListFolderResult.has_more`` field is ``True``, call
@@ -1315,6 +1407,10 @@ class DropboxBase(object):
             this field is present, ``ListFolderArg.path`` will be relative to
             root of the shared link. Only non-recursive mode is supported for
             shared link.
+        :param Nullable include_property_groups: If set to a valid list of
+            template IDs, ``FileMetadata.property_groups`` is set if there
+            exists property data associated with the file and each of the listed
+            templates.
         :rtype: :class:`dropbox.files.ListFolderResult`
         :raises: :class:`dropbox.exceptions.ApiError`
 
@@ -1328,7 +1424,8 @@ class DropboxBase(object):
                                   include_has_explicit_shared_members,
                                   include_mounted_folders,
                                   limit,
-                                  shared_link)
+                                  shared_link,
+                                  include_property_groups)
         r = self.request(
             files.list_folder,
             'files',
@@ -1369,7 +1466,8 @@ class DropboxBase(object):
                                             include_has_explicit_shared_members=False,
                                             include_mounted_folders=True,
                                             limit=None,
-                                            shared_link=None):
+                                            shared_link=None,
+                                            include_property_groups=None):
         """
         A way to quickly get a cursor for the folder's state. Unlike
         :meth:`files_list_folder`, :meth:`files_list_folder_get_latest_cursor`
@@ -1399,6 +1497,10 @@ class DropboxBase(object):
             this field is present, ``ListFolderArg.path`` will be relative to
             root of the shared link. Only non-recursive mode is supported for
             shared link.
+        :param Nullable include_property_groups: If set to a valid list of
+            template IDs, ``FileMetadata.property_groups`` is set if there
+            exists property data associated with the file and each of the listed
+            templates.
         :rtype: :class:`dropbox.files.ListFolderGetLatestCursorResult`
         :raises: :class:`dropbox.exceptions.ApiError`
 
@@ -1412,7 +1514,8 @@ class DropboxBase(object):
                                   include_has_explicit_shared_members,
                                   include_mounted_folders,
                                   limit,
-                                  shared_link)
+                                  shared_link,
+                                  include_property_groups)
         r = self.request(
             files.list_folder_get_latest_cursor,
             'files',
@@ -1928,7 +2031,8 @@ class DropboxBase(object):
                      mode=files.WriteMode.add,
                      autorename=False,
                      client_modified=None,
-                     mute=False):
+                     mute=False,
+                     property_groups=None):
         """
         Create a new file with the contents provided in the request. Do not use
         this to upload a file larger than 150 MB. Instead, create an upload
@@ -1951,6 +2055,8 @@ class DropboxBase(object):
             modifications in their Dropbox account via notifications in the
             client software. If ``True``, this tells the clients that this
             modification shouldn't result in a user notification.
+        :param Nullable property_groups: List of custom properties to add to
+            file.
         :rtype: :class:`dropbox.files.FileMetadata`
         :raises: :class:`dropbox.exceptions.ApiError`
 
@@ -1961,7 +2067,8 @@ class DropboxBase(object):
                                mode,
                                autorename,
                                client_modified,
-                               mute)
+                               mute,
+                               property_groups)
         r = self.request(
             files.upload,
             'files',
diff --git a/dropbox/base_team.py b/dropbox/base_team.py
index 80d092a..fd2e1b9 100644
--- a/dropbox/base_team.py
+++ b/dropbox/base_team.py
@@ -681,6 +681,91 @@ class DropboxTeamBase(object):
         )
         return r
 
+    def team_member_space_limits_excluded_users_add(self,
+                                                    users=None):
+        """
+        Add users to member space limits excluded users list.
+
+        :param Nullable users: List of users to be added/removed.
+        :rtype: :class:`dropbox.team.ExcludedUsersUpdateResult`
+        :raises: :class:`dropbox.exceptions.ApiError`
+
+        If this raises, ApiError.reason is of type:
+            :class:`dropbox.team.ExcludedUsersUpdateError`
+        """
+        arg = team.ExcludedUsersUpdateArg(users)
+        r = self.request(
+            team.member_space_limits_excluded_users_add,
+            'team',
+            arg,
+            None,
+        )
+        return r
+
+    def team_member_space_limits_excluded_users_list(self,
+                                                     limit=1000):
+        """
+        List member space limits excluded users.
+
+        :param long limit: Number of results to return per call.
+        :rtype: :class:`dropbox.team.ExcludedUsersListResult`
+        :raises: :class:`dropbox.exceptions.ApiError`
+
+        If this raises, ApiError.reason is of type:
+            :class:`dropbox.team.ExcludedUsersListError`
+        """
+        arg = team.ExcludedUsersListArg(limit)
+        r = self.request(
+            team.member_space_limits_excluded_users_list,
+            'team',
+            arg,
+            None,
+        )
+        return r
+
+    def team_member_space_limits_excluded_users_list_continue(self,
+                                                              cursor):
+        """
+        Continue listing member space limits excluded users.
+
+        :param str cursor: Indicates from what point to get the next set of
+            users.
+        :rtype: :class:`dropbox.team.ExcludedUsersListResult`
+        :raises: :class:`dropbox.exceptions.ApiError`
+
+        If this raises, ApiError.reason is of type:
+            :class:`dropbox.team.ExcludedUsersListContinueError`
+        """
+        arg = team.ExcludedUsersListContinueArg(cursor)
+        r = self.request(
+            team.member_space_limits_excluded_users_list_continue,
+            'team',
+            arg,
+            None,
+        )
+        return r
+
+    def team_member_space_limits_excluded_users_remove(self,
+                                                       users=None):
+        """
+        Remove users from member space limits excluded users list.
+
+        :param Nullable users: List of users to be added/removed.
+        :rtype: :class:`dropbox.team.ExcludedUsersUpdateResult`
+        :raises: :class:`dropbox.exceptions.ApiError`
+
+        If this raises, ApiError.reason is of type:
+            :class:`dropbox.team.ExcludedUsersUpdateError`
+        """
+        arg = team.ExcludedUsersUpdateArg(users)
+        r = self.request(
+            team.member_space_limits_excluded_users_remove,
+            'team',
+            arg,
+            None,
+        )
+        return r
+
     def team_member_space_limits_get_custom_quota(self,
                                                   users):
         """
@@ -728,7 +813,7 @@ class DropboxTeamBase(object):
     def team_member_space_limits_set_custom_quota(self,
                                                   users_and_quotas):
         """
-        Set users custom quota. Custom quota has to be at least 25GB. A maximum
+        Set users custom quota. Custom quota has to be at least 15GB. A maximum
         of 1000 members can be specified in a single call.
 
         :param list users_and_quotas: List of users and their custom quotas.
@@ -736,7 +821,7 @@ class DropboxTeamBase(object):
         :raises: :class:`dropbox.exceptions.ApiError`
 
         If this raises, ApiError.reason is of type:
-            :class:`dropbox.team.CustomQuotaError`
+            :class:`dropbox.team.SetCustomQuotaError`
         """
         arg = team.SetCustomQuotaArg(users_and_quotas)
         r = self.request(
diff --git a/dropbox/common.py b/dropbox/common.py
index 2a26747..ca16262 100644
--- a/dropbox/common.py
+++ b/dropbox/common.py
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 # Auto-generated by Stone, do not modify.
+# @generated
 # flake8: noqa
 # pylint: skip-file
 try:
@@ -11,75 +12,17 @@ except (SystemError, ValueError):
     import stone_validators as bv
     import stone_base as bb
 
-class InvalidPathRootError(object):
-    """
-    :ivar path_root: The latest path root id for user's team if the user is
-        still in a team.
-    """
-
-    __slots__ = [
-        '_path_root_value',
-        '_path_root_present',
-    ]
-
-    _has_required_fields = False
-
-    def __init__(self,
-                 path_root=None):
-        self._path_root_value = None
-        self._path_root_present = False
-        if path_root is not None:
-            self.path_root = path_root
-
-    @property
-    def path_root(self):
-        """
-        The latest path root id for user's team if the user is still in a team.
-
-        :rtype: str
-        """
-        if self._path_root_present:
-            return self._path_root_value
-        else:
-            return None
-
-    @path_root.setter
-    def path_root(self, val):
-        if val is None:
-            del self.path_root
-            return
-        val = self._path_root_validator.validate(val)
-        self._path_root_value = val
-        self._path_root_present = True
-
-    @path_root.deleter
-    def path_root(self):
-        self._path_root_value = None
-        self._path_root_present = False
-
-    def __repr__(self):
-        return 'InvalidPathRootError(path_root={!r})'.format(
-            self._path_root_value,
-        )
-
-InvalidPathRootError_validator = bv.Struct(InvalidPathRootError)
-
 class PathRoot(bb.Union):
     """
     This class acts as a tagged union. Only one of the ``is_*`` methods will
     return true. To get the associated value of a tag (if one exists), use the
     corresponding ``get_*`` method.
 
-    :ivar home: Paths are relative to the authenticating user's home directory,
+    :ivar home: Paths are relative to the authenticating user's home namespace,
         whether or not that user belongs to a team.
-    :ivar member_home: Paths are relative to the authenticating team member's
-        home directory. (This results in ``PathRootError.invalid`` if the user
-        does not belong to a team.).
-    :ivar str team: Paths are relative to the given team directory. (This
-        results in :field:`PathRootError.invalid` if the user is not a member of
-        the team associated with that path root id.).
-    :ivar user_home: Paths are relative to the user's home directory. (This
-        results in ``PathRootError.invalid`` if the belongs to a team.).
+    :ivar str root: Paths are relative to the authenticating user's root
+        namespace (This results in :field:`PathRootError.invalid_root` if the
+        user's root namespace has changed.).
     :ivar str namespace_id: Paths are relative to given namespace id (This
         results in :field:`PathRootError.no_permission` if you don't have access
         to this namespace.).
@@ -89,22 +32,18 @@ class PathRoot(bb.Union):
     # Attribute is overwritten below the class definition
     home = None
     # Attribute is overwritten below the class definition
-    member_home = None
-    # Attribute is overwritten below the class definition
-    user_home = None
-    # Attribute is overwritten below the class definition
     other = None
 
     @classmethod
-    def team(cls, val):
+    def root(cls, val):
         """
-        Create an instance of this class set to the ``team`` tag with value
+        Create an instance of this class set to the ``root`` tag with value
         ``val``.
 
         :param str val:
         :rtype: PathRoot
         """
-        return cls('team', val)
+        return cls('root', val)
 
     @classmethod
     def namespace_id(cls, val):
@@ -125,29 +64,13 @@ class PathRoot(bb.Union):
         """
         return self._tag == 'home'
 
-    def is_member_home(self):
-        """
-        Check if the union tag is ``member_home``.
-
-        :rtype: bool
-        """
-        return self._tag == 'member_home'
-
-    def is_team(self):
+    def is_root(self):
         """
-        Check if the union tag is ``team``.
+        Check if the union tag is ``root``.
 
         :rtype: bool
         """
-        return self._tag == 'team'
-
-    def is_user_home(self):
-        """
-        Check if the union tag is ``user_home``.
-
-        :rtype: bool
-        """
-        return self._tag == 'user_home'
+        return self._tag == 'root'
 
     def is_namespace_id(self):
         """
@@ -165,18 +88,18 @@ class PathRoot(bb.Union):
         """
         return self._tag == 'other'
 
-    def get_team(self):
+    def get_root(self):
         """
-        Paths are relative to the given team directory. (This results in
-        ``PathRootError.invalid`` if the user is not a member of the team
-        associated with that path root id.).
+        Paths are relative to the authenticating user's root namespace (This
+        results in ``PathRootError.invalid_root`` if the user's root namespace
+        has changed.).
 
-        Only call this if :meth:`is_team` is true.
+        Only call this if :meth:`is_root` is true.
 
         :rtype: str
         """
-        if not self.is_team():
-            raise AttributeError("tag 'team' not set")
+        if not self.is_root():
+            raise AttributeError("tag 'root' not set")
         return self._value
 
     def get_namespace_id(self):
@@ -204,9 +127,9 @@ class PathRootError(bb.Union):
     return true. To get the associated value of a tag (if one exists), use the
     corresponding ``get_*`` method.
 
-    :ivar InvalidPathRootError invalid: The path root id value in
-        Dropbox-API-Path-Root header is no longer valid.
-    :ivar no_permission: You don't have permission to access the path root id in
+    :ivar RootInfo invalid_root: The root namespace id in Dropbox-API-Path-Root
+        header is not valid. The value of this error is use's latest root info.
+    :ivar no_permission: You don't have permission to access the namespace id in
         Dropbox-API-Path-Root  header.
     """
 
@@ -217,23 +140,23 @@ class PathRootError(bb.Union):
     other = None
 
     @classmethod
-    def invalid(cls, val):
+    def invalid_root(cls, val):
         """
-        Create an instance of this class set to the ``invalid`` tag with value
-        ``val``.
+        Create an instance of this class set to the ``invalid_root`` tag with
+        value ``val``.
 
-        :param InvalidPathRootError val:
+        :param RootInfo val:
         :rtype: PathRootError
         """
-        return cls('invalid', val)
+        return cls('invalid_root', val)
 
-    def is_invalid(self):
+    def is_invalid_root(self):
         """
-        Check if the union tag is ``invalid``.
+        Check if the union tag is ``invalid_root``.
 
         :rtype: bool
         """
-        return self._tag == 'invalid'
+        return self._tag == 'invalid_root'
 
     def is_no_permission(self):
         """
@@ -251,17 +174,17 @@ class PathRootError(bb.Union):
         """
         return self._tag == 'other'
 
-    def get_invalid(self):
+    def get_invalid_root(self):
         """
-        The path root id value in Dropbox-API-Path-Root header is no longer
-        valid.
+        The root namespace id in Dropbox-API-Path-Root header is not valid. The
+        value of this error is use's latest root info.
 
-        Only call this if :meth:`is_invalid` is true.
+        Only call this if :meth:`is_invalid_root` is true.
 
-        :rtype: InvalidPathRootError
+        :rtype: RootInfo
         """
-        if not self.is_invalid():
-            raise AttributeError("tag 'invalid' not set")
+        if not self.is_invalid_root():
+            raise AttributeError("tag 'invalid_root' not set")
         return self._value
 
     def __repr__(self):
@@ -269,6 +192,175 @@ class PathRootError(bb.Union):
 
 PathRootError_validator = bv.Union(PathRootError)
 
+class RootInfo(object):
+    """
+    Information about current user's root.
+
+    :ivar root_namespace_id: The namespace id for user's root namespace. It will
+        be the namespace id of the shared team root if the user is member of a
+        CDM team. Otherwise it will be same as ``RootInfo.home_namespace_id``.
+    :ivar home_namespace_id: The namespace id for user's home namespace.
+    """
+
+    __slots__ = [
+        '_root_namespace_id_value',
+        '_root_namespace_id_present',
+        '_home_namespace_id_value',
+        '_home_namespace_id_present',
+    ]
+
+    _has_required_fields = True
+
+    def __init__(self,
+                 root_namespace_id=None,
+                 home_namespace_id=None):
+        self._root_namespace_id_value = None
+        self._root_namespace_id_present = False
+        self._home_namespace_id_value = None
+        self._home_namespace_id_present = False
+        if root_namespace_id is not None:
+            self.root_namespace_id = root_namespace_id
+        if home_namespace_id is not None:
+            self.home_namespace_id = home_namespace_id
+
+    @property
+    def root_namespace_id(self):
+        """
+        The namespace id for user's root namespace. It will be the namespace id
+        of the shared team root if the user is member of a CDM team. Otherwise
+        it will be same as ``RootInfo.home_namespace_id``.
+
+        :rtype: str
+        """
+        if self._root_namespace_id_present:
+            return self._root_namespace_id_value
+        else:
+            raise AttributeError("missing required field 'root_namespace_id'")
+
+    @root_namespace_id.setter
+    def root_namespace_id(self, val):
+        val = self._root_namespace_id_validator.validate(val)
+        self._root_namespace_id_value = val
+        self._root_namespace_id_present = True
+
+    @root_namespace_id.deleter
+    def root_namespace_id(self):
+        self._root_namespace_id_value = None
+        self._root_namespace_id_present = False
+
+    @property
+    def home_namespace_id(self):
+        """
+        The namespace id for user's home namespace.
+
+        :rtype: str
+        """
+        if self._home_namespace_id_present:
+            return self._home_namespace_id_value
+        else:
+            raise AttributeError("missing required field 'home_namespace_id'")
+
+    @home_namespace_id.setter
+    def home_namespace_id(self, val):
+        val = self._home_namespace_id_validator.validate(val)
+        self._home_namespace_id_value = val
+        self._home_namespace_id_present = True
+
+    @home_namespace_id.deleter
+    def home_namespace_id(self):
+        self._home_namespace_id_value = None
+        self._home_namespace_id_present = False
+
+    def __repr__(self):
+        return 'RootInfo(root_namespace_id={!r}, home_namespace_id={!r})'.format(
+            self._root_namespace_id_value,
+            self._home_namespace_id_value,
+        )
+
+RootInfo_validator = bv.StructTree(RootInfo)
+
+class TeamRootInfo(RootInfo):
+    """
+    Root info when user is member of a CDM team.
+
+    :ivar home_path: The path for user's home directory under the shared team
+        root.
+    """
+
+    __slots__ = [
+        '_home_path_value',
+        '_home_path_present',
+    ]
+
+    _has_required_fields = True
+
+    def __init__(self,
+                 root_namespace_id=None,
+                 home_namespace_id=None,
+                 home_path=None):
+        super(TeamRootInfo, self).__init__(root_namespace_id,
+                                           home_namespace_id)
+        self._home_path_value = None
+        self._home_path_present = False
+        if home_path is not None:
+            self.home_path = home_path
+
+    @property
+    def home_path(self):
+        """
+        The path for user's home directory under the shared team root.
+
+        :rtype: str
+        """
+        if self._home_path_present:
+            return self._home_path_value
+        else:
+            raise AttributeError("missing required field 'home_path'")
+
+    @home_path.setter
+    def home_path(self, val):
+        val = self._home_path_validator.validate(val)
+        self._home_path_value = val
+        self._home_path_present = True
+
+    @home_path.deleter
+    def home_path(self):
+        self._home_path_value = None
+        self._home_path_present = False
+
+    def __repr__(self):
+        return 'TeamRootInfo(root_namespace_id={!r}, home_namespace_id={!r}, home_path={!r})'.format(
+            self._root_namespace_id_value,
+            self._home_namespace_id_value,
+            self._home_path_value,
+        )
+
+TeamRootInfo_validator = bv.Struct(TeamRootInfo)
+
+class UserRootInfo(RootInfo):
+    """
+    Root info when user is not member of a CDM team.
+    """
+
+    __slots__ = [
+    ]
+
+    _has_required_fields = True
+
+    def __init__(self,
+                 root_namespace_id=None,
+                 home_namespace_id=None):
+        super(UserRootInfo, self).__init__(root_namespace_id,
+                                           home_namespace_id)
+
+    def __repr__(self):
+        return 'UserRootInfo(root_namespace_id={!r}, home_namespace_id={!r})'.format(
+            self._root_namespace_id_value,
+            self._home_namespace_id_value,
+        )
+
+UserRootInfo_validator = bv.Struct(UserRootInfo)
+
 Date_validator = bv.Timestamp(u'%Y-%m-%d')
 DisplayName_validator = bv.String(min_length=1, pattern=u'[^/:?*<>"|]*')
 DisplayNameLegacy_validator = bv.String(min_length=1)
@@ -279,38 +371,27 @@ LanguageCode_validator = bv.String(min_length=2)
 NamePart_validator = bv.String(min_length=1, max_length=100, pattern=u'[^/:?*<>"|]*')
 NamespaceId_validator = bv.String(pattern=u'[-_0-9a-zA-Z:]+')
 OptionalNamePart_validator = bv.String(max_length=100, pattern=u'[^/:?*<>"|]*')
-PathRootId_validator = NamespaceId_validator
 SessionId_validator = bv.String()
 SharedFolderId_validator = NamespaceId_validator
-InvalidPathRootError._path_root_validator = bv.Nullable(PathRootId_validator)
-InvalidPathRootError._all_field_names_ = set(['path_root'])
-InvalidPathRootError._all_fields_ = [('path_root', InvalidPathRootError._path_root_validator)]
-
 PathRoot._home_validator = bv.Void()
-PathRoot._member_home_validator = bv.Void()
-PathRoot._team_validator = PathRootId_validator
-PathRoot._user_home_validator = bv.Void()
-PathRoot._namespace_id_validator = PathRootId_validator
+PathRoot._root_validator = NamespaceId_validator
+PathRoot._namespace_id_validator = NamespaceId_validator
 PathRoot._other_validator = bv.Void()
 PathRoot._tagmap = {
     'home': PathRoot._home_validator,
-    'member_home': PathRoot._member_home_validator,
-    'team': PathRoot._team_validator,
-    'user_home': PathRoot._user_home_validator,
+    'root': PathRoot._root_validator,
     'namespace_id': PathRoot._namespace_id_validator,
     'other': PathRoot._other_validator,
 }
 
 PathRoot.home = PathRoot('home')
-PathRoot.member_home = PathRoot('member_home')
-PathRoot.user_home = PathRoot('user_home')
 PathRoot.other = PathRoot('other')
 
-PathRootError._invalid_validator = InvalidPathRootError_validator
+PathRootError._invalid_root_validator = RootInfo_validator
 PathRootError._no_permission_validator = bv.Void()
 PathRootError._other_validator = bv.Void()
 PathRootError._tagmap = {
-    'invalid': PathRootError._invalid_validator,
+    'invalid_root': PathRootError._invalid_root_validator,
     'no_permission': PathRootError._no_permission_validator,
     'other': PathRootError._other_validator,
 }
@@ -318,6 +399,40 @@ PathRootError._tagmap = {
 PathRootError.no_permission = PathRootError('no_permission')
 PathRootError.other = PathRootError('other')
 
+RootInfo._root_namespace_id_validator = NamespaceId_validator
+RootInfo._home_namespace_id_validator = NamespaceId_validator
+RootInfo._field_names_ = set([
+    'root_namespace_id',
+    'home_namespace_id',
+])
+RootInfo._all_field_names_ = RootInfo._field_names_
+RootInfo._fields_ = [
+    ('root_namespace_id', RootInfo._root_namespace_id_validator),
+    ('home_namespace_id', RootInfo._home_namespace_id_validator),
+]
+RootInfo._all_fields_ = RootInfo._fields_
+
+RootInfo._tag_to_subtype_ = {
+    (u'team',): TeamRootInfo_validator,
+    (u'user',): UserRootInfo_validator,
+}
+RootInfo._pytype_to_tag_and_subtype_ = {
+    TeamRootInfo: ((u'team',), TeamRootInfo_validator),
+    UserRootInfo: ((u'user',), UserRootInfo_validator),
+}
+RootInfo._is_catch_all_ = True
+
+TeamRootInfo._home_path_validator = bv.String()
+TeamRootInfo._field_names_ = set(['home_path'])
+TeamRootInfo._all_field_names_ = RootInfo._all_field_names_.union(TeamRootInfo._field_names_)
+TeamRootInfo._fields_ = [('home_path', TeamRootInfo._home_path_validator)]
+TeamRootInfo._all_fields_ = RootInfo._all_fields_ + TeamRootInfo._fields_
... 7397 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-dropbox.git



More information about the Python-modules-commits mailing list