Commit 623b781a authored by Michael Fladischer's avatar Michael Fladischer

New upstream version 9.2.0

parent 3c9e03b3
Dropbox for Python
==================
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v9.1.0
.. image:: https://travis-ci.org/dropbox/dropbox-sdk-python.svg?branch=v9.2.0
:target: https://travis-ci.org/dropbox/dropbox-sdk-python
.. image:: https://readthedocs.org/projects/dropbox-sdk-python/badge/?version=stable
......
......@@ -26,6 +26,14 @@ SDK Documentation
:special-members: __init__
:undoc-members:
:mod:`dropbox.contacts` -- Contacts
============================================
.. automodule:: dropbox.contacts
:members:
:show-inheritance:
:special-members: __init__
:undoc-members:
:mod:`dropbox.dropbox` -- Dropbox
============================================
.. automodule:: dropbox.dropbox
......
......@@ -10,6 +10,7 @@ from . import (
async_,
auth,
common,
contacts,
file_properties,
file_requests,
files,
......@@ -76,6 +77,48 @@ class DropboxBase(object):
)
return None
# ------------------------------------------
# Routes in contacts namespace
def contacts_delete_manual_contacts(self):
"""
Removes all manually added contacts. You'll still keep contacts who are
on your team or who you imported. New contacts will be added when you
share.
:rtype: None
"""
arg = None
r = self.request(
contacts.delete_manual_contacts,
'contacts',
arg,
None,
)
return None
def contacts_delete_manual_contacts_batch(self,
email_addresses):
"""
Removes manually added contacts from the given list.
:param list email_addresses: List of manually added contacts to be
deleted.
:rtype: None
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.contacts.DeleteManualContactsError`
"""
arg = contacts.DeleteManualContactsArg(email_addresses)
r = self.request(
contacts.delete_manual_contacts_batch,
'contacts',
arg,
None,
)
return None
# ------------------------------------------
# Routes in file_properties namespace
......@@ -250,32 +293,6 @@ class DropboxBase(object):
)
return None
def file_properties_templates_add_for_team(self,
name,
description,
fields):
"""
Add a template associated with a team. See
:meth:`file_properties_properties_add` to add properties to a file or
folder. Note: this endpoint will create team-owned templates.
:rtype: :class:`dropbox.file_properties.AddTemplateResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.file_properties.ModifyTemplateError`
"""
arg = file_properties.AddTemplateArg(name,
description,
fields)
r = self.request(
file_properties.templates_add_for_team,
'file_properties',
arg,
None,
)
return r
def file_properties_templates_add_for_user(self,
name,
description,
......@@ -302,29 +319,6 @@ class DropboxBase(object):
)
return r
def file_properties_templates_get_for_team(self,
template_id):
"""
Get the schema for a specified template.
:param str template_id: An identifier for template added by route See
:meth:`file_properties_templates_add_for_user` or
:meth:`file_properties_templates_add_for_team`.
:rtype: :class:`dropbox.file_properties.GetTemplateResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.file_properties.TemplateError`
"""
arg = file_properties.GetTemplateArg(template_id)
r = self.request(
file_properties.templates_get_for_team,
'file_properties',
arg,
None,
)
return r
def file_properties_templates_get_for_user(self,
template_id):
"""
......@@ -349,26 +343,6 @@ class DropboxBase(object):
)
return r
def file_properties_templates_list_for_team(self):
"""
Get the template identifiers for a team. To get the schema of each
template use :meth:`file_properties_templates_get_for_team`.
:rtype: :class:`dropbox.file_properties.ListTemplateResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.file_properties.TemplateError`
"""
arg = None
r = self.request(
file_properties.templates_list_for_team,
'file_properties',
arg,
None,
)
return r
def file_properties_templates_list_for_user(self):
"""
Get the template identifiers for a team. To get the schema of each
......@@ -390,32 +364,6 @@ 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:`.exceptions.ApiError`
If this raises, ApiError will contain:
: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):
"""
......@@ -442,44 +390,6 @@ class DropboxBase(object):
)
return None
def file_properties_templates_update_for_team(self,
template_id,
name=None,
description=None,
add_fields=None):
"""
Update a template associated with a team. This route can update the
template name, the template description and add optional properties to
templates.
:param str template_id: An identifier for template added by See
:meth:`file_properties_templates_add_for_user` or
:meth:`file_properties_templates_add_for_team`.
:param Nullable name: A display name for the template. template names
can be up to 256 bytes.
:param Nullable description: Description for the new template. Template
descriptions can be up to 1024 bytes.
:param Nullable add_fields: Property field templates to be added to the
group template. There can be up to 32 properties in a single
template.
:rtype: :class:`dropbox.file_properties.UpdateTemplateResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.file_properties.ModifyTemplateError`
"""
arg = file_properties.UpdateTemplateArg(template_id,
name,
description,
add_fields)
r = self.request(
file_properties.templates_update_for_team,
'file_properties',
arg,
None,
)
return r
def file_properties_templates_update_for_user(self,
template_id,
name=None,
......@@ -4278,6 +4188,12 @@ class DropboxBase(object):
)
return r
# ------------------------------------------
# Routes in team namespace
# ------------------------------------------
# Routes in team_log namespace
# ------------------------------------------
# Routes in users namespace
......
......@@ -10,6 +10,7 @@ from . import (
async_,
auth,
common,
contacts,
file_properties,
file_requests,
files,
......@@ -32,6 +33,160 @@ class DropboxTeamBase(object):
def request(self, route, namespace, arg, arg_binary=None):
pass
# ------------------------------------------
# Routes in auth namespace
# ------------------------------------------
# Routes in contacts namespace
# ------------------------------------------
# Routes in file_properties namespace
def file_properties_templates_add_for_team(self,
name,
description,
fields):
"""
Add a template associated with a team. See
:meth:`file_properties_properties_add` to add properties to a file or
folder. Note: this endpoint will create team-owned templates.
:rtype: :class:`dropbox.file_properties.AddTemplateResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.file_properties.ModifyTemplateError`
"""
arg = file_properties.AddTemplateArg(name,
description,
fields)
r = self.request(
file_properties.templates_add_for_team,
'file_properties',
arg,
None,
)
return r
def file_properties_templates_get_for_team(self,
template_id):
"""
Get the schema for a specified template.
:param str template_id: An identifier for template added by route See
:meth:`file_properties_templates_add_for_user` or
:meth:`file_properties_templates_add_for_team`.
:rtype: :class:`dropbox.file_properties.GetTemplateResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.file_properties.TemplateError`
"""
arg = file_properties.GetTemplateArg(template_id)
r = self.request(
file_properties.templates_get_for_team,
'file_properties',
arg,
None,
)
return r
def file_properties_templates_list_for_team(self):
"""
Get the template identifiers for a team. To get the schema of each
template use :meth:`file_properties_templates_get_for_team`.
:rtype: :class:`dropbox.file_properties.ListTemplateResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.file_properties.TemplateError`
"""
arg = None
r = self.request(
file_properties.templates_list_for_team,
'file_properties',
arg,
None,
)
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:`.exceptions.ApiError`
If this raises, ApiError will contain:
: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_update_for_team(self,
template_id,
name=None,
description=None,
add_fields=None):
"""
Update a template associated with a team. This route can update the
template name, the template description and add optional properties to
templates.
:param str template_id: An identifier for template added by See
:meth:`file_properties_templates_add_for_user` or
:meth:`file_properties_templates_add_for_team`.
:param Nullable name: A display name for the template. template names
can be up to 256 bytes.
:param Nullable description: Description for the new template. Template
descriptions can be up to 1024 bytes.
:param Nullable add_fields: Property field templates to be added to the
group template. There can be up to 32 properties in a single
template.
:rtype: :class:`dropbox.file_properties.UpdateTemplateResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.file_properties.ModifyTemplateError`
"""
arg = file_properties.UpdateTemplateArg(template_id,
name,
description,
add_fields)
r = self.request(
file_properties.templates_update_for_team,
'file_properties',
arg,
None,
)
return r
# ------------------------------------------
# Routes in file_requests namespace
# ------------------------------------------
# Routes in files namespace
# ------------------------------------------
# Routes in paper namespace
# ------------------------------------------
# Routes in sharing namespace
# ------------------------------------------
# Routes in team namespace
......@@ -1273,6 +1428,10 @@ class DropboxTeamBase(object):
:param long limit: Specifying a value here has no effect.
:rtype: :class:`dropbox.team.TeamNamespacesListResult`
:raises: :class:`.exceptions.ApiError`
If this raises, ApiError will contain:
:class:`dropbox.team.TeamNamespacesListError`
"""
arg = team.TeamNamespacesListArg(limit)
r = self.request(
......@@ -1811,3 +1970,6 @@ class DropboxTeamBase(object):
)
return r
# ------------------------------------------
# Routes in users namespace
......@@ -380,7 +380,7 @@ 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)
DisplayNameLegacy_validator = bv.String()
DropboxTimestamp_validator = bv.Timestamp(u'%Y-%m-%dT%H:%M:%SZ')
EmailAddress_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}$")
# A ISO639-1 code.
......
# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
try:
from . import stone_validators as bv
from . import stone_base as bb
except (ImportError, SystemError, ValueError):
# Catch errors raised when importing a relative module when not in a package.
# This makes testing this file directly (outside of a package) easier.
import stone_validators as bv
import stone_base as bb
try:
from . import (
common,
)
except (ImportError, SystemError, ValueError):
import common
class DeleteManualContactsArg(bb.Struct):
"""
:ivar email_addresses: List of manually added contacts to be deleted.
"""
__slots__ = [
'_email_addresses_value',
'_email_addresses_present',
]
_has_required_fields = True
def __init__(self,
email_addresses=None):
self._email_addresses_value = None
self._email_addresses_present = False
if email_addresses is not None:
self.email_addresses = email_addresses
@property
def email_addresses(self):
"""
List of manually added contacts to be deleted.
:rtype: list of [str]
"""
if self._email_addresses_present:
return self._email_addresses_value
else:
raise AttributeError("missing required field 'email_addresses'")
@email_addresses.setter
def email_addresses(self, val):
val = self._email_addresses_validator.validate(val)
self._email_addresses_value = val
self._email_addresses_present = True
@email_addresses.deleter
def email_addresses(self):
self._email_addresses_value = None
self._email_addresses_present = False
def _process_custom_annotations(self, annotation_type, processor):
super(DeleteManualContactsArg, self)._process_custom_annotations(annotation_type, processor)
def __repr__(self):
return 'DeleteManualContactsArg(email_addresses={!r})'.format(
self._email_addresses_value,
)
DeleteManualContactsArg_validator = bv.Struct(DeleteManualContactsArg)
class DeleteManualContactsError(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 list of [str] contacts_not_found: Can't delete contacts from this
list. Make sure the list only has manually added contacts. The deletion
was cancelled.
"""
_catch_all = 'other'
# Attribute is overwritten below the class definition
other = None
@classmethod
def contacts_not_found(cls, val):
"""
Create an instance of this class set to the ``contacts_not_found`` tag
with value ``val``.
:param list of [str] val:
:rtype: DeleteManualContactsError
"""
return cls('contacts_not_found', val)
def is_contacts_not_found(self):
"""
Check if the union tag is ``contacts_not_found``.
:rtype: bool
"""
return self._tag == 'contacts_not_found'
def is_other(self):
"""
Check if the union tag is ``other``.
:rtype: bool
"""
return self._tag == 'other'
def get_contacts_not_found(self):
"""
Can't delete contacts from this list. Make sure the list only has
manually added contacts. The deletion was cancelled.
Only call this if :meth:`is_contacts_not_found` is true.
:rtype: list of [str]
"""
if not self.is_contacts_not_found():
raise AttributeError("tag 'contacts_not_found' not set")
return self._value
def _process_custom_annotations(self, annotation_type, processor):
super(DeleteManualContactsError, self)._process_custom_annotations(annotation_type, processor)
def __repr__(self):
return 'DeleteManualContactsError(%r, %r)' % (self._tag, self._value)
DeleteManualContactsError_validator = bv.Union(DeleteManualContactsError)
DeleteManualContactsArg._email_addresses_validator = bv.List(common.EmailAddress_validator)
DeleteManualContactsArg._all_field_names_ = set(['email_addresses'])
DeleteManualContactsArg._all_fields_ = [('email_addresses', DeleteManualContactsArg._email_addresses_validator)]
DeleteManualContactsError._contacts_not_found_validator = bv.List(common.EmailAddress_validator)
DeleteManualContactsError._other_validator = bv.Void()
DeleteManualContactsError._tagmap = {
'contacts_not_found': DeleteManualContactsError._contacts_not_found_validator,
'other': DeleteManualContactsError._other_validator,
}
DeleteManualContactsError.other = DeleteManualContactsError('other')
delete_manual_contacts = bb.Route(
'delete_manual_contacts',
1,
False,
bv.Void(),
bv.Void(),
bv.Void(),
{'host': u'api',
'style': u'rpc'},
)
delete_manual_contacts_batch = bb.Route(
'delete_manual_contacts_batch',
1,
False,
DeleteManualContactsArg_validator,
bv.Void(),
DeleteManualContactsError_validator,
{'host': u'api',
'style': u'rpc'},
)
ROUTES = {
'delete_manual_contacts': delete_manual_contacts,
'delete_manual_contacts_batch': delete_manual_contacts_batch,
}
......@@ -6,7 +6,7 @@ __all__ = [
# This should always be 0.0.0 in master. Only update this after tagging
# before release.
__version__ = '9.1.0'
__version__ = '9.2.0'
import contextlib
import json
......
......@@ -6271,6 +6271,10 @@ class LinkAudience(bb.Union):
:ivar public: Link is accessible by anyone.
:ivar team: Link is accessible only by team members.
:ivar no_one: The link can be used by no one. The link merely points the
user to the content, and does not grant additional rights to the user.
Members of the content who use this link can only access the content
with their pre-existing access rights.
:ivar members: Link is accessible only by members of the content.
"""
......@@ -6280,6 +6284,8 @@ class LinkAudience(bb.Union):
# Attribute is overwritten below the class definition
team = None
# Attribute is overwritten below the class definition
no_one = None
# Attribute is overwritten below the class definition
members = None
# Attribute is overwritten below the class definition
other = None
......@@ -6300,6 +6306,14 @@ class LinkAudience(bb.Union):
"""
return self._tag == 'team'
def is_no_one(self):
"""
Check if the union tag is ``no_one``.
:rtype: bool
"""
return self._tag == 'no_one'
def is_members(self):
"""
Check if the union tag is ``members``.
......@@ -17339,17 +17353,20 @@ LinkAction.other = LinkAction('other')
LinkAudience._public_validator = bv.Void()
LinkAudience._team_validator = bv.Void()
LinkAudience._no_one_validator = bv.Void()
LinkAudience._members_validator = bv.Void()
LinkAudience._other_validator = bv.Void()
LinkAudience._tagmap = {
'public': LinkAudience._public_validator,
'team': LinkAudience._team_validator,
'no_one': LinkAudience._no_one_validator,
'members': LinkAudience._members_validator,
'other': LinkAudience._other_validator,
}
LinkAudience.public = LinkAudience('public')
LinkAudience.team = LinkAudience('team')
LinkAudience.no_one = LinkAudience('no_one')
LinkAudience.members = LinkAudience('members')
LinkAudience.other = LinkAudience('other')
......
......@@ -12420,21 +12420,30 @@ RemoveCustomQuotaResult_validator = bv.Union(RemoveCustomQuotaResult)
class RemovedStatus(bb.Struct):
"""
:ivar is_recoverable: True if the removed team member is recoverable.
:ivar is_disconnected: True if the team member's account was converted to
individual account.
"""
__slots__ = [
'_is_recoverable_value',
'_is_recoverable_present',
'_is_disconnected_value',
'_is_disconnected_present',
]
_has_required_fields = True
def __init__(self,
is_recoverable=None):
is_recoverable=None,
is_disconnected=None):
self._is_recoverable_value = None
self._is_recoverable_present = False
self._is_disconnected_value = None
self._is_disconnected_present = False
if is_recoverable is not None:
self.is_recoverable = is_recoverable
if is_disconnected is not None:
self.is_disconnected = is_disconnected
@property
def is_recoverable(self):
......@@ -12459,12 +12468,36 @@ class RemovedStatus(bb.Struct):
self._is_recoverable_value = None
self._is_recoverable_present = False
@property
def is_disconnected(self):
"""
True if the team member's account was converted to individual account.
:rtype: bool
"""
if self._is_disconnected_present:
return self._is_disconnected_value
else:
raise AttributeError("missing required field 'is_disconnected'")
@is_disconnected.setter
def is_disconnected(self, val):
val = self._is_disconnected_validator.validate(val)
self._is_disconnected_value = val
self._is_disconnected_present = True
@is_disconnected.deleter
def is_disconnected(self):
self._is_disconnected_value = None
self._is_disconnected_present = False
def _process_custom_annotations(self, annotation_type, processor):
super(RemovedStatus, self)._process_custom_annotations(annotation_type, processor)
def __repr__(self):
return 'RemovedStatus(is_recoverable={!r})'.format(
return 'RemovedStatus(is_recoverable={!r}, is_disconnected={!r})'.format(
self._is_recoverable_value,
self._is_disconnected_value,
)
RemovedStatus_validator = bv.Struct(RemovedStatus)
......@@ -15685,28 +15718,28 @@ class TeamNamespacesListContinueArg(bb.Struct):