mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-14 20:35:48 +01:00
updated Dropbox lib
This commit is contained in:
parent
30f8b93629
commit
456ebe9374
@ -1,310 +1,7 @@
|
||||
# -*- 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 (SystemError, ValueError):
|
||||
# Catch errors raised when importing a relative module when not in a package.
|
||||
# This makes testing this file directly (outside of a package) easier.
|
||||
import stone_validators as bv
|
||||
import stone_base as bb
|
||||
|
||||
class LaunchResultBase(bb.Union):
|
||||
"""
|
||||
Result returned by methods that launch an asynchronous job. A method who may
|
||||
either launch an asynchronous job, or complete the request synchronously,
|
||||
can use this union by extending it, and adding a 'complete' field with the
|
||||
type of the synchronous response. See :class:`LaunchEmptyResult` for an
|
||||
example.
|
||||
|
||||
This class acts as a tagged union. Only one of the ``is_*`` methods will
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar str async_job_id: This response indicates that the processing is
|
||||
asynchronous. The string is an id that can be used to obtain the status
|
||||
of the asynchronous job.
|
||||
"""
|
||||
|
||||
_catch_all = None
|
||||
|
||||
@classmethod
|
||||
def async_job_id(cls, val):
|
||||
"""
|
||||
Create an instance of this class set to the ``async_job_id`` tag with
|
||||
value ``val``.
|
||||
|
||||
:param str val:
|
||||
:rtype: LaunchResultBase
|
||||
"""
|
||||
return cls('async_job_id', val)
|
||||
|
||||
def is_async_job_id(self):
|
||||
"""
|
||||
Check if the union tag is ``async_job_id``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'async_job_id'
|
||||
|
||||
def get_async_job_id(self):
|
||||
"""
|
||||
This response indicates that the processing is asynchronous. The string
|
||||
is an id that can be used to obtain the status of the asynchronous job.
|
||||
|
||||
Only call this if :meth:`is_async_job_id` is true.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
if not self.is_async_job_id():
|
||||
raise AttributeError("tag 'async_job_id' not set")
|
||||
return self._value
|
||||
|
||||
def __repr__(self):
|
||||
return 'LaunchResultBase(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
LaunchResultBase_validator = bv.Union(LaunchResultBase)
|
||||
|
||||
class LaunchEmptyResult(LaunchResultBase):
|
||||
"""
|
||||
Result returned by methods that may either launch an asynchronous job or
|
||||
complete synchronously. Upon synchronous completion of the job, no
|
||||
additional information is returned.
|
||||
|
||||
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 complete: The job finished synchronously and successfully.
|
||||
"""
|
||||
|
||||
# Attribute is overwritten below the class definition
|
||||
complete = None
|
||||
|
||||
def is_complete(self):
|
||||
"""
|
||||
Check if the union tag is ``complete``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'complete'
|
||||
|
||||
def __repr__(self):
|
||||
return 'LaunchEmptyResult(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
LaunchEmptyResult_validator = bv.Union(LaunchEmptyResult)
|
||||
|
||||
class PollArg(object):
|
||||
"""
|
||||
Arguments for methods that poll the status of an asynchronous job.
|
||||
|
||||
:ivar async_job_id: Id of the asynchronous job. This is the value of a
|
||||
response returned from the method that launched the job.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
'_async_job_id_value',
|
||||
'_async_job_id_present',
|
||||
]
|
||||
|
||||
_has_required_fields = True
|
||||
|
||||
def __init__(self,
|
||||
async_job_id=None):
|
||||
self._async_job_id_value = None
|
||||
self._async_job_id_present = False
|
||||
if async_job_id is not None:
|
||||
self.async_job_id = async_job_id
|
||||
|
||||
@property
|
||||
def async_job_id(self):
|
||||
"""
|
||||
Id of the asynchronous job. This is the value of a response returned
|
||||
from the method that launched the job.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
if self._async_job_id_present:
|
||||
return self._async_job_id_value
|
||||
else:
|
||||
raise AttributeError("missing required field 'async_job_id'")
|
||||
|
||||
@async_job_id.setter
|
||||
def async_job_id(self, val):
|
||||
val = self._async_job_id_validator.validate(val)
|
||||
self._async_job_id_value = val
|
||||
self._async_job_id_present = True
|
||||
|
||||
@async_job_id.deleter
|
||||
def async_job_id(self):
|
||||
self._async_job_id_value = None
|
||||
self._async_job_id_present = False
|
||||
|
||||
def __repr__(self):
|
||||
return 'PollArg(async_job_id={!r})'.format(
|
||||
self._async_job_id_value,
|
||||
)
|
||||
|
||||
PollArg_validator = bv.Struct(PollArg)
|
||||
|
||||
class PollResultBase(bb.Union):
|
||||
"""
|
||||
Result returned by methods that poll for the status of an asynchronous job.
|
||||
Unions that extend this union should add a 'complete' field with a type of
|
||||
the information returned upon job completion. See :class:`PollEmptyResult`
|
||||
for an example.
|
||||
|
||||
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 in_progress: The asynchronous job is still in progress.
|
||||
"""
|
||||
|
||||
_catch_all = None
|
||||
# Attribute is overwritten below the class definition
|
||||
in_progress = None
|
||||
|
||||
def is_in_progress(self):
|
||||
"""
|
||||
Check if the union tag is ``in_progress``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'in_progress'
|
||||
|
||||
def __repr__(self):
|
||||
return 'PollResultBase(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PollResultBase_validator = bv.Union(PollResultBase)
|
||||
|
||||
class PollEmptyResult(PollResultBase):
|
||||
"""
|
||||
Result returned by methods that poll for the status of an asynchronous job.
|
||||
Upon completion of the job, no additional information is returned.
|
||||
|
||||
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 complete: The asynchronous job has completed successfully.
|
||||
"""
|
||||
|
||||
# Attribute is overwritten below the class definition
|
||||
complete = None
|
||||
|
||||
def is_complete(self):
|
||||
"""
|
||||
Check if the union tag is ``complete``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'complete'
|
||||
|
||||
def __repr__(self):
|
||||
return 'PollEmptyResult(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PollEmptyResult_validator = bv.Union(PollEmptyResult)
|
||||
|
||||
class PollError(bb.Union):
|
||||
"""
|
||||
Error returned by methods for polling the status of asynchronous job.
|
||||
|
||||
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 invalid_async_job_id: The job ID is invalid.
|
||||
:ivar internal_error: Something went wrong with the job on Dropbox's end.
|
||||
You'll need to verify that the action you were taking succeeded, and if
|
||||
not, try again. This should happen very rarely.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
invalid_async_job_id = None
|
||||
# Attribute is overwritten below the class definition
|
||||
internal_error = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_invalid_async_job_id(self):
|
||||
"""
|
||||
Check if the union tag is ``invalid_async_job_id``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'invalid_async_job_id'
|
||||
|
||||
def is_internal_error(self):
|
||||
"""
|
||||
Check if the union tag is ``internal_error``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'internal_error'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def __repr__(self):
|
||||
return 'PollError(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PollError_validator = bv.Union(PollError)
|
||||
|
||||
AsyncJobId_validator = bv.String(min_length=1)
|
||||
LaunchResultBase._async_job_id_validator = AsyncJobId_validator
|
||||
LaunchResultBase._tagmap = {
|
||||
'async_job_id': LaunchResultBase._async_job_id_validator,
|
||||
}
|
||||
|
||||
LaunchEmptyResult._complete_validator = bv.Void()
|
||||
LaunchEmptyResult._tagmap = {
|
||||
'complete': LaunchEmptyResult._complete_validator,
|
||||
}
|
||||
LaunchEmptyResult._tagmap.update(LaunchResultBase._tagmap)
|
||||
|
||||
LaunchEmptyResult.complete = LaunchEmptyResult('complete')
|
||||
|
||||
PollArg._async_job_id_validator = AsyncJobId_validator
|
||||
PollArg._all_field_names_ = set(['async_job_id'])
|
||||
PollArg._all_fields_ = [('async_job_id', PollArg._async_job_id_validator)]
|
||||
|
||||
PollResultBase._in_progress_validator = bv.Void()
|
||||
PollResultBase._tagmap = {
|
||||
'in_progress': PollResultBase._in_progress_validator,
|
||||
}
|
||||
|
||||
PollResultBase.in_progress = PollResultBase('in_progress')
|
||||
|
||||
PollEmptyResult._complete_validator = bv.Void()
|
||||
PollEmptyResult._tagmap = {
|
||||
'complete': PollEmptyResult._complete_validator,
|
||||
}
|
||||
PollEmptyResult._tagmap.update(PollResultBase._tagmap)
|
||||
|
||||
PollEmptyResult.complete = PollEmptyResult('complete')
|
||||
|
||||
PollError._invalid_async_job_id_validator = bv.Void()
|
||||
PollError._internal_error_validator = bv.Void()
|
||||
PollError._other_validator = bv.Void()
|
||||
PollError._tagmap = {
|
||||
'invalid_async_job_id': PollError._invalid_async_job_id_validator,
|
||||
'internal_error': PollError._internal_error_validator,
|
||||
'other': PollError._other_validator,
|
||||
}
|
||||
|
||||
PollError.invalid_async_job_id = PollError('invalid_async_job_id')
|
||||
PollError.internal_error = PollError('internal_error')
|
||||
PollError.other = PollError('other')
|
||||
|
||||
ROUTES = {
|
||||
}
|
||||
|
||||
# If you have issues importing this module because Python recognizes it as a keyword, use async_ instead.
|
||||
from .async_ import *
|
||||
|
332
resources/lib/dropbox/async_.py
Normal file
332
resources/lib/dropbox/async_.py
Normal file
@ -0,0 +1,332 @@
|
||||
# -*- 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
|
||||
|
||||
class LaunchResultBase(bb.Union):
|
||||
"""
|
||||
Result returned by methods that launch an asynchronous job. A method who may
|
||||
either launch an asynchronous job, or complete the request synchronously,
|
||||
can use this union by extending it, and adding a 'complete' field with the
|
||||
type of the synchronous response. See :class:`LaunchEmptyResult` for an
|
||||
example.
|
||||
|
||||
This class acts as a tagged union. Only one of the ``is_*`` methods will
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar str async.LaunchResultBase.async_job_id: This response indicates that
|
||||
the processing is asynchronous. The string is an id that can be used to
|
||||
obtain the status of the asynchronous job.
|
||||
"""
|
||||
|
||||
_catch_all = None
|
||||
|
||||
@classmethod
|
||||
def async_job_id(cls, val):
|
||||
"""
|
||||
Create an instance of this class set to the ``async_job_id`` tag with
|
||||
value ``val``.
|
||||
|
||||
:param str val:
|
||||
:rtype: LaunchResultBase
|
||||
"""
|
||||
return cls('async_job_id', val)
|
||||
|
||||
def is_async_job_id(self):
|
||||
"""
|
||||
Check if the union tag is ``async_job_id``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'async_job_id'
|
||||
|
||||
def get_async_job_id(self):
|
||||
"""
|
||||
This response indicates that the processing is asynchronous. The string
|
||||
is an id that can be used to obtain the status of the asynchronous job.
|
||||
|
||||
Only call this if :meth:`is_async_job_id` is true.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
if not self.is_async_job_id():
|
||||
raise AttributeError("tag 'async_job_id' not set")
|
||||
return self._value
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(LaunchResultBase, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'LaunchResultBase(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
LaunchResultBase_validator = bv.Union(LaunchResultBase)
|
||||
|
||||
class LaunchEmptyResult(LaunchResultBase):
|
||||
"""
|
||||
Result returned by methods that may either launch an asynchronous job or
|
||||
complete synchronously. Upon synchronous completion of the job, no
|
||||
additional information is returned.
|
||||
|
||||
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 async.LaunchEmptyResult.complete: The job finished synchronously and
|
||||
successfully.
|
||||
"""
|
||||
|
||||
# Attribute is overwritten below the class definition
|
||||
complete = None
|
||||
|
||||
def is_complete(self):
|
||||
"""
|
||||
Check if the union tag is ``complete``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'complete'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(LaunchEmptyResult, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'LaunchEmptyResult(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
LaunchEmptyResult_validator = bv.Union(LaunchEmptyResult)
|
||||
|
||||
class PollArg(bb.Struct):
|
||||
"""
|
||||
Arguments for methods that poll the status of an asynchronous job.
|
||||
|
||||
:ivar async.PollArg.async_job_id: Id of the asynchronous job. This is the
|
||||
value of a response returned from the method that launched the job.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
'_async_job_id_value',
|
||||
'_async_job_id_present',
|
||||
]
|
||||
|
||||
_has_required_fields = True
|
||||
|
||||
def __init__(self,
|
||||
async_job_id=None):
|
||||
self._async_job_id_value = None
|
||||
self._async_job_id_present = False
|
||||
if async_job_id is not None:
|
||||
self.async_job_id = async_job_id
|
||||
|
||||
@property
|
||||
def async_job_id(self):
|
||||
"""
|
||||
Id of the asynchronous job. This is the value of a response returned
|
||||
from the method that launched the job.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
if self._async_job_id_present:
|
||||
return self._async_job_id_value
|
||||
else:
|
||||
raise AttributeError("missing required field 'async_job_id'")
|
||||
|
||||
@async_job_id.setter
|
||||
def async_job_id(self, val):
|
||||
val = self._async_job_id_validator.validate(val)
|
||||
self._async_job_id_value = val
|
||||
self._async_job_id_present = True
|
||||
|
||||
@async_job_id.deleter
|
||||
def async_job_id(self):
|
||||
self._async_job_id_value = None
|
||||
self._async_job_id_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PollArg, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PollArg(async_job_id={!r})'.format(
|
||||
self._async_job_id_value,
|
||||
)
|
||||
|
||||
PollArg_validator = bv.Struct(PollArg)
|
||||
|
||||
class PollResultBase(bb.Union):
|
||||
"""
|
||||
Result returned by methods that poll for the status of an asynchronous job.
|
||||
Unions that extend this union should add a 'complete' field with a type of
|
||||
the information returned upon job completion. See :class:`PollEmptyResult`
|
||||
for an example.
|
||||
|
||||
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 async.PollResultBase.in_progress: The asynchronous job is still in
|
||||
progress.
|
||||
"""
|
||||
|
||||
_catch_all = None
|
||||
# Attribute is overwritten below the class definition
|
||||
in_progress = None
|
||||
|
||||
def is_in_progress(self):
|
||||
"""
|
||||
Check if the union tag is ``in_progress``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'in_progress'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PollResultBase, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PollResultBase(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PollResultBase_validator = bv.Union(PollResultBase)
|
||||
|
||||
class PollEmptyResult(PollResultBase):
|
||||
"""
|
||||
Result returned by methods that poll for the status of an asynchronous job.
|
||||
Upon completion of the job, no additional information is returned.
|
||||
|
||||
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 async.PollEmptyResult.complete: The asynchronous job has completed
|
||||
successfully.
|
||||
"""
|
||||
|
||||
# Attribute is overwritten below the class definition
|
||||
complete = None
|
||||
|
||||
def is_complete(self):
|
||||
"""
|
||||
Check if the union tag is ``complete``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'complete'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PollEmptyResult, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PollEmptyResult(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PollEmptyResult_validator = bv.Union(PollEmptyResult)
|
||||
|
||||
class PollError(bb.Union):
|
||||
"""
|
||||
Error returned by methods for polling the status of asynchronous job.
|
||||
|
||||
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 async.PollError.invalid_async_job_id: The job ID is invalid.
|
||||
:ivar async.PollError.internal_error: Something went wrong with the job on
|
||||
Dropbox's end. You'll need to verify that the action you were taking
|
||||
succeeded, and if not, try again. This should happen very rarely.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
invalid_async_job_id = None
|
||||
# Attribute is overwritten below the class definition
|
||||
internal_error = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_invalid_async_job_id(self):
|
||||
"""
|
||||
Check if the union tag is ``invalid_async_job_id``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'invalid_async_job_id'
|
||||
|
||||
def is_internal_error(self):
|
||||
"""
|
||||
Check if the union tag is ``internal_error``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'internal_error'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PollError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PollError(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PollError_validator = bv.Union(PollError)
|
||||
|
||||
AsyncJobId_validator = bv.String(min_length=1)
|
||||
LaunchResultBase._async_job_id_validator = AsyncJobId_validator
|
||||
LaunchResultBase._tagmap = {
|
||||
'async_job_id': LaunchResultBase._async_job_id_validator,
|
||||
}
|
||||
|
||||
LaunchEmptyResult._complete_validator = bv.Void()
|
||||
LaunchEmptyResult._tagmap = {
|
||||
'complete': LaunchEmptyResult._complete_validator,
|
||||
}
|
||||
LaunchEmptyResult._tagmap.update(LaunchResultBase._tagmap)
|
||||
|
||||
LaunchEmptyResult.complete = LaunchEmptyResult('complete')
|
||||
|
||||
PollArg._async_job_id_validator = AsyncJobId_validator
|
||||
PollArg._all_field_names_ = set(['async_job_id'])
|
||||
PollArg._all_fields_ = [('async_job_id', PollArg._async_job_id_validator)]
|
||||
|
||||
PollResultBase._in_progress_validator = bv.Void()
|
||||
PollResultBase._tagmap = {
|
||||
'in_progress': PollResultBase._in_progress_validator,
|
||||
}
|
||||
|
||||
PollResultBase.in_progress = PollResultBase('in_progress')
|
||||
|
||||
PollEmptyResult._complete_validator = bv.Void()
|
||||
PollEmptyResult._tagmap = {
|
||||
'complete': PollEmptyResult._complete_validator,
|
||||
}
|
||||
PollEmptyResult._tagmap.update(PollResultBase._tagmap)
|
||||
|
||||
PollEmptyResult.complete = PollEmptyResult('complete')
|
||||
|
||||
PollError._invalid_async_job_id_validator = bv.Void()
|
||||
PollError._internal_error_validator = bv.Void()
|
||||
PollError._other_validator = bv.Void()
|
||||
PollError._tagmap = {
|
||||
'invalid_async_job_id': PollError._invalid_async_job_id_validator,
|
||||
'internal_error': PollError._internal_error_validator,
|
||||
'other': PollError._other_validator,
|
||||
}
|
||||
|
||||
PollError.invalid_async_job_id = PollError('invalid_async_job_id')
|
||||
PollError.internal_error = PollError('internal_error')
|
||||
PollError.other = PollError('other')
|
||||
|
||||
ROUTES = {
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
# -*- 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 (SystemError, ValueError):
|
||||
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
|
||||
@ -20,10 +21,10 @@ class AccessError(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar InvalidAccountTypeError invalid_account_type: Current account type
|
||||
cannot access the resource.
|
||||
:ivar PaperAccessError paper_access_denied: Current account cannot access
|
||||
Paper.
|
||||
:ivar InvalidAccountTypeError AccessError.invalid_account_type: Current
|
||||
account type cannot access the resource.
|
||||
:ivar PaperAccessError AccessError.paper_access_denied: Current account
|
||||
cannot access Paper.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -100,6 +101,9 @@ class AccessError(bb.Union):
|
||||
raise AttributeError("tag 'paper_access_denied' not set")
|
||||
return self._value
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(AccessError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'AccessError(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -113,12 +117,15 @@ class AuthError(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar invalid_access_token: The access token is invalid.
|
||||
:ivar invalid_select_user: The user specified in 'Dropbox-API-Select-User'
|
||||
is no longer on the team.
|
||||
:ivar invalid_select_admin: The user specified in 'Dropbox-API-Select-Admin'
|
||||
is not a Dropbox Business team admin.
|
||||
:ivar user_suspended: The user has been suspended.
|
||||
:ivar auth.AuthError.invalid_access_token: The access token is invalid.
|
||||
:ivar auth.AuthError.invalid_select_user: The user specified in
|
||||
'Dropbox-API-Select-User' is no longer on the team.
|
||||
:ivar auth.AuthError.invalid_select_admin: The user specified in
|
||||
'Dropbox-API-Select-Admin' is not a Dropbox Business team admin.
|
||||
:ivar auth.AuthError.user_suspended: The user has been suspended.
|
||||
:ivar auth.AuthError.expired_access_token: The access token has expired.
|
||||
:ivar TokenScopeError AuthError.missing_scope: The access token does not
|
||||
have the required scope to access the route.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -131,8 +138,21 @@ class AuthError(bb.Union):
|
||||
# Attribute is overwritten below the class definition
|
||||
user_suspended = None
|
||||
# Attribute is overwritten below the class definition
|
||||
expired_access_token = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
@classmethod
|
||||
def missing_scope(cls, val):
|
||||
"""
|
||||
Create an instance of this class set to the ``missing_scope`` tag with
|
||||
value ``val``.
|
||||
|
||||
:param TokenScopeError val:
|
||||
:rtype: AuthError
|
||||
"""
|
||||
return cls('missing_scope', val)
|
||||
|
||||
def is_invalid_access_token(self):
|
||||
"""
|
||||
Check if the union tag is ``invalid_access_token``.
|
||||
@ -165,6 +185,22 @@ class AuthError(bb.Union):
|
||||
"""
|
||||
return self._tag == 'user_suspended'
|
||||
|
||||
def is_expired_access_token(self):
|
||||
"""
|
||||
Check if the union tag is ``expired_access_token``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'expired_access_token'
|
||||
|
||||
def is_missing_scope(self):
|
||||
"""
|
||||
Check if the union tag is ``missing_scope``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'missing_scope'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
@ -173,6 +209,21 @@ class AuthError(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def get_missing_scope(self):
|
||||
"""
|
||||
The access token does not have the required scope to access the route.
|
||||
|
||||
Only call this if :meth:`is_missing_scope` is true.
|
||||
|
||||
:rtype: TokenScopeError
|
||||
"""
|
||||
if not self.is_missing_scope():
|
||||
raise AttributeError("tag 'missing_scope' not set")
|
||||
return self._value
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(AuthError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'AuthError(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -184,10 +235,10 @@ class InvalidAccountTypeError(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar endpoint: Current account type doesn't have permission to access this
|
||||
route endpoint.
|
||||
:ivar feature: Current account type doesn't have permission to access this
|
||||
feature.
|
||||
:ivar auth.InvalidAccountTypeError.endpoint: Current account type doesn't
|
||||
have permission to access this route endpoint.
|
||||
:ivar auth.InvalidAccountTypeError.feature: Current account type doesn't
|
||||
have permission to access this feature.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -222,6 +273,9 @@ class InvalidAccountTypeError(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(InvalidAccountTypeError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'InvalidAccountTypeError(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -233,8 +287,9 @@ class PaperAccessError(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar paper_disabled: Paper is disabled.
|
||||
:ivar not_paper_user: The provided user has not used Paper yet.
|
||||
:ivar auth.PaperAccessError.paper_disabled: Paper is disabled.
|
||||
:ivar auth.PaperAccessError.not_paper_user: The provided user has not used
|
||||
Paper yet.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -269,18 +324,22 @@ class PaperAccessError(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PaperAccessError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PaperAccessError(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PaperAccessError_validator = bv.Union(PaperAccessError)
|
||||
|
||||
class RateLimitError(object):
|
||||
class RateLimitError(bb.Struct):
|
||||
"""
|
||||
Error occurred because the app is being rate limited.
|
||||
|
||||
:ivar reason: The reason why the app is being rate limited.
|
||||
:ivar retry_after: The number of seconds that the app should wait before
|
||||
making another request.
|
||||
:ivar auth.RateLimitError.reason: The reason why the app is being rate
|
||||
limited.
|
||||
:ivar auth.RateLimitError.retry_after: The number of seconds that the app
|
||||
should wait before making another request.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -333,7 +392,7 @@ class RateLimitError(object):
|
||||
The number of seconds that the app should wait before making another
|
||||
request.
|
||||
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
if self._retry_after_present:
|
||||
return self._retry_after_value
|
||||
@ -351,6 +410,9 @@ class RateLimitError(object):
|
||||
self._retry_after_value = None
|
||||
self._retry_after_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(RateLimitError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'RateLimitError(reason={!r}, retry_after={!r})'.format(
|
||||
self._reason_value,
|
||||
@ -365,10 +427,10 @@ class RateLimitReason(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar too_many_requests: You are making too many requests in the past few
|
||||
minutes.
|
||||
:ivar too_many_write_operations: There are currently too many write
|
||||
operations happening in the user's Dropbox.
|
||||
:ivar auth.RateLimitReason.too_many_requests: You are making too many
|
||||
requests in the past few minutes.
|
||||
:ivar auth.RateLimitReason.too_many_write_operations: There are currently
|
||||
too many write operations happening in the user's Dropbox.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -403,16 +465,20 @@ class RateLimitReason(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(RateLimitReason, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'RateLimitReason(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
RateLimitReason_validator = bv.Union(RateLimitReason)
|
||||
|
||||
class TokenFromOAuth1Arg(object):
|
||||
class TokenFromOAuth1Arg(bb.Struct):
|
||||
"""
|
||||
:ivar oauth1_token: The supplied OAuth 1.0 access token.
|
||||
:ivar oauth1_token_secret: The token secret associated with the supplied
|
||||
access token.
|
||||
:ivar auth.TokenFromOAuth1Arg.oauth1_token: The supplied OAuth 1.0 access
|
||||
token.
|
||||
:ivar auth.TokenFromOAuth1Arg.oauth1_token_secret: The token secret
|
||||
associated with the supplied access token.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -482,6 +548,9 @@ class TokenFromOAuth1Arg(object):
|
||||
self._oauth1_token_secret_value = None
|
||||
self._oauth1_token_secret_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TokenFromOAuth1Arg, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TokenFromOAuth1Arg(oauth1_token={!r}, oauth1_token_secret={!r})'.format(
|
||||
self._oauth1_token_value,
|
||||
@ -496,10 +565,10 @@ class TokenFromOAuth1Error(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar invalid_oauth1_token_info: Part or all of the OAuth 1.0 access token
|
||||
info is invalid.
|
||||
:ivar app_id_mismatch: The authorized app does not match the app associated
|
||||
with the supplied access token.
|
||||
:ivar auth.TokenFromOAuth1Error.invalid_oauth1_token_info: Part or all of
|
||||
the OAuth 1.0 access token info is invalid.
|
||||
:ivar auth.TokenFromOAuth1Error.app_id_mismatch: The authorized app does not
|
||||
match the app associated with the supplied access token.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -534,15 +603,18 @@ class TokenFromOAuth1Error(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TokenFromOAuth1Error, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TokenFromOAuth1Error(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
TokenFromOAuth1Error_validator = bv.Union(TokenFromOAuth1Error)
|
||||
|
||||
class TokenFromOAuth1Result(object):
|
||||
class TokenFromOAuth1Result(bb.Struct):
|
||||
"""
|
||||
:ivar oauth2_token: The OAuth 2.0 token generated from the supplied OAuth
|
||||
1.0 token.
|
||||
:ivar auth.TokenFromOAuth1Result.oauth2_token: The OAuth 2.0 token generated
|
||||
from the supplied OAuth 1.0 token.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -582,6 +654,9 @@ class TokenFromOAuth1Result(object):
|
||||
self._oauth2_token_value = None
|
||||
self._oauth2_token_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TokenFromOAuth1Result, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TokenFromOAuth1Result(oauth2_token={!r})'.format(
|
||||
self._oauth2_token_value,
|
||||
@ -589,6 +664,59 @@ class TokenFromOAuth1Result(object):
|
||||
|
||||
TokenFromOAuth1Result_validator = bv.Struct(TokenFromOAuth1Result)
|
||||
|
||||
class TokenScopeError(bb.Struct):
|
||||
"""
|
||||
:ivar auth.TokenScopeError.required_scope: The required scope to access the
|
||||
route.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
'_required_scope_value',
|
||||
'_required_scope_present',
|
||||
]
|
||||
|
||||
_has_required_fields = True
|
||||
|
||||
def __init__(self,
|
||||
required_scope=None):
|
||||
self._required_scope_value = None
|
||||
self._required_scope_present = False
|
||||
if required_scope is not None:
|
||||
self.required_scope = required_scope
|
||||
|
||||
@property
|
||||
def required_scope(self):
|
||||
"""
|
||||
The required scope to access the route.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
if self._required_scope_present:
|
||||
return self._required_scope_value
|
||||
else:
|
||||
raise AttributeError("missing required field 'required_scope'")
|
||||
|
||||
@required_scope.setter
|
||||
def required_scope(self, val):
|
||||
val = self._required_scope_validator.validate(val)
|
||||
self._required_scope_value = val
|
||||
self._required_scope_present = True
|
||||
|
||||
@required_scope.deleter
|
||||
def required_scope(self):
|
||||
self._required_scope_value = None
|
||||
self._required_scope_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TokenScopeError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TokenScopeError(required_scope={!r})'.format(
|
||||
self._required_scope_value,
|
||||
)
|
||||
|
||||
TokenScopeError_validator = bv.Struct(TokenScopeError)
|
||||
|
||||
AccessError._invalid_account_type_validator = InvalidAccountTypeError_validator
|
||||
AccessError._paper_access_denied_validator = PaperAccessError_validator
|
||||
AccessError._other_validator = bv.Void()
|
||||
@ -604,12 +732,16 @@ AuthError._invalid_access_token_validator = bv.Void()
|
||||
AuthError._invalid_select_user_validator = bv.Void()
|
||||
AuthError._invalid_select_admin_validator = bv.Void()
|
||||
AuthError._user_suspended_validator = bv.Void()
|
||||
AuthError._expired_access_token_validator = bv.Void()
|
||||
AuthError._missing_scope_validator = TokenScopeError_validator
|
||||
AuthError._other_validator = bv.Void()
|
||||
AuthError._tagmap = {
|
||||
'invalid_access_token': AuthError._invalid_access_token_validator,
|
||||
'invalid_select_user': AuthError._invalid_select_user_validator,
|
||||
'invalid_select_admin': AuthError._invalid_select_admin_validator,
|
||||
'user_suspended': AuthError._user_suspended_validator,
|
||||
'expired_access_token': AuthError._expired_access_token_validator,
|
||||
'missing_scope': AuthError._missing_scope_validator,
|
||||
'other': AuthError._other_validator,
|
||||
}
|
||||
|
||||
@ -617,6 +749,7 @@ AuthError.invalid_access_token = AuthError('invalid_access_token')
|
||||
AuthError.invalid_select_user = AuthError('invalid_select_user')
|
||||
AuthError.invalid_select_admin = AuthError('invalid_select_admin')
|
||||
AuthError.user_suspended = AuthError('user_suspended')
|
||||
AuthError.expired_access_token = AuthError('expired_access_token')
|
||||
AuthError.other = AuthError('other')
|
||||
|
||||
InvalidAccountTypeError._endpoint_validator = bv.Void()
|
||||
@ -697,8 +830,13 @@ TokenFromOAuth1Result._oauth2_token_validator = bv.String(min_length=1)
|
||||
TokenFromOAuth1Result._all_field_names_ = set(['oauth2_token'])
|
||||
TokenFromOAuth1Result._all_fields_ = [('oauth2_token', TokenFromOAuth1Result._oauth2_token_validator)]
|
||||
|
||||
TokenScopeError._required_scope_validator = bv.String()
|
||||
TokenScopeError._all_field_names_ = set(['required_scope'])
|
||||
TokenScopeError._all_fields_ = [('required_scope', TokenScopeError._required_scope_validator)]
|
||||
|
||||
token_from_oauth1 = bb.Route(
|
||||
'token/from_oauth1',
|
||||
1,
|
||||
False,
|
||||
TokenFromOAuth1Arg_validator,
|
||||
TokenFromOAuth1Result_validator,
|
||||
@ -708,6 +846,7 @@ token_from_oauth1 = bb.Route(
|
||||
)
|
||||
token_revoke = bb.Route(
|
||||
'token/revoke',
|
||||
1,
|
||||
False,
|
||||
bv.Void(),
|
||||
bv.Void(),
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,110 +1,50 @@
|
||||
# -*- 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 (SystemError, ValueError):
|
||||
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
|
||||
|
||||
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,
|
||||
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 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.).
|
||||
:ivar common.PathRoot.home: Paths are relative to the authenticating user's
|
||||
home namespace, whether or not that user belongs to a team.
|
||||
:ivar str common.PathRoot.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 common.PathRoot.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.).
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# 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 +65,13 @@ class PathRoot(bb.Union):
|
||||
"""
|
||||
return self._tag == 'home'
|
||||
|
||||
def is_member_home(self):
|
||||
def is_root(self):
|
||||
"""
|
||||
Check if the union tag is ``member_home``.
|
||||
Check if the union tag is ``root``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'member_home'
|
||||
|
||||
def is_team(self):
|
||||
"""
|
||||
Check if the union tag is ``team``.
|
||||
|
||||
: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 +89,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):
|
||||
@ -193,6 +117,9 @@ class PathRoot(bb.Union):
|
||||
raise AttributeError("tag 'namespace_id' not set")
|
||||
return self._value
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PathRoot, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PathRoot(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -204,10 +131,11 @@ 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
|
||||
Dropbox-API-Path-Root header.
|
||||
:ivar RootInfo PathRootError.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 common.PathRootError.no_permission: You don't have permission to
|
||||
access the namespace id in Dropbox-API-Path-Root header.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -217,23 +145,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,66 +179,239 @@ 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 _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PathRootError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PathRootError(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PathRootError_validator = bv.Union(PathRootError)
|
||||
|
||||
class RootInfo(bb.Struct):
|
||||
"""
|
||||
Information about current user's root.
|
||||
|
||||
:ivar common.RootInfo.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 team with a separate team root. Otherwise it will be
|
||||
same as ``RootInfo.home_namespace_id``.
|
||||
:ivar common.RootInfo.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 team with a separate
|
||||
team root. 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 _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(RootInfo, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
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 team with a separate root namespace ID.
|
||||
|
||||
:ivar common.TeamRootInfo.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 _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TeamRootInfo, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
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 team or the user is a member of a
|
||||
team and the team does not have a separate root namespace.
|
||||
"""
|
||||
|
||||
__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 _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(UserRootInfo, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
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)
|
||||
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}$")
|
||||
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.
|
||||
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 +419,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_
|
||||
|
||||
UserRootInfo._field_names_ = set([])
|
||||
UserRootInfo._all_field_names_ = RootInfo._all_field_names_.union(UserRootInfo._field_names_)
|
||||
UserRootInfo._fields_ = []
|
||||
UserRootInfo._all_fields_ = RootInfo._all_fields_ + UserRootInfo._fields_
|
||||
|
||||
ROUTES = {
|
||||
}
|
||||
|
||||
|
176
resources/lib/dropbox/contacts.py
Normal file
176
resources/lib/dropbox/contacts.py
Normal file
@ -0,0 +1,176 @@
|
||||
# -*- 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 contacts.DeleteManualContactsArg.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, field_path, processor):
|
||||
super(DeleteManualContactsArg, self)._process_custom_annotations(annotation_type, field_path, 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.DeleteManualContactsError.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, field_path, processor):
|
||||
super(DeleteManualContactsError, self)._process_custom_annotations(annotation_type, field_path, 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,
|
||||
}
|
||||
|
@ -22,6 +22,11 @@ from .auth import (
|
||||
AuthError_validator,
|
||||
RateLimitError_validator,
|
||||
)
|
||||
from .common import (
|
||||
PathRoot,
|
||||
PathRoot_validator,
|
||||
PathRootError_validator
|
||||
)
|
||||
from .base import DropboxBase
|
||||
from .base_team import DropboxTeamBase
|
||||
from .exceptions import (
|
||||
@ -29,6 +34,7 @@ from .exceptions import (
|
||||
AuthError,
|
||||
BadInputError,
|
||||
HttpError,
|
||||
PathRootError,
|
||||
InternalServerError,
|
||||
RateLimitError,
|
||||
)
|
||||
@ -42,6 +48,9 @@ from .session import (
|
||||
pinned_session,
|
||||
)
|
||||
|
||||
PATH_ROOT_HEADER = 'Dropbox-API-Path-Root'
|
||||
HTTP_STATUS_INVALID_PATH_ROOT = 422
|
||||
|
||||
class RouteResult(object):
|
||||
"""The successful result of a call to a route."""
|
||||
|
||||
@ -117,7 +126,7 @@ class _DropboxTransport(object):
|
||||
_ROUTE_STYLE_RPC = 'rpc'
|
||||
|
||||
# This is the default longest time we'll block on receiving data from the server
|
||||
_DEFAULT_TIMEOUT = 30
|
||||
_DEFAULT_TIMEOUT = 100
|
||||
|
||||
def __init__(self,
|
||||
oauth2_access_token,
|
||||
@ -182,6 +191,35 @@ class _DropboxTransport(object):
|
||||
|
||||
self._timeout = timeout
|
||||
|
||||
def clone(
|
||||
self,
|
||||
oauth2_access_token=None,
|
||||
max_retries_on_error=None,
|
||||
max_retries_on_rate_limit=None,
|
||||
user_agent=None,
|
||||
session=None,
|
||||
headers=None,
|
||||
timeout=None):
|
||||
"""
|
||||
Creates a new copy of the Dropbox client with the same defaults unless modified by
|
||||
arguments to clone()
|
||||
|
||||
See constructor for original parameter descriptions.
|
||||
|
||||
:return: New instance of Dropbox clent
|
||||
:rtype: Dropbox
|
||||
"""
|
||||
|
||||
return self.__class__(
|
||||
oauth2_access_token or self._oauth2_access_token,
|
||||
max_retries_on_error or self._max_retries_on_error,
|
||||
max_retries_on_rate_limit or self._max_retries_on_rate_limit,
|
||||
user_agent or self._user_agent,
|
||||
session or self._session,
|
||||
headers or self._headers,
|
||||
timeout or self._timeout
|
||||
)
|
||||
|
||||
def request(self,
|
||||
route,
|
||||
namespace,
|
||||
@ -211,6 +249,8 @@ class _DropboxTransport(object):
|
||||
"""
|
||||
host = route.attrs['host'] or 'api'
|
||||
route_name = namespace + '/' + route.name
|
||||
if route.version > 1:
|
||||
route_name += '_v{}'.format(route.version)
|
||||
route_style = route.attrs['style'] or 'rpc'
|
||||
serialized_arg = stone_serializers.json_encode(route.arg_type,
|
||||
request_arg)
|
||||
@ -421,6 +461,10 @@ class _DropboxTransport(object):
|
||||
err = stone_serializers.json_compat_obj_decode(
|
||||
AuthError_validator, r.json()['error'])
|
||||
raise AuthError(request_id, err)
|
||||
elif r.status_code == HTTP_STATUS_INVALID_PATH_ROOT:
|
||||
err = stone_serializers.json_compat_obj_decode(
|
||||
PathRootError_validator, r.json()['error'])
|
||||
raise PathRootError(request_id, err)
|
||||
elif r.status_code == 429:
|
||||
err = None
|
||||
if r.headers.get('content-type') == 'application/json':
|
||||
@ -479,6 +523,28 @@ class _DropboxTransport(object):
|
||||
for c in http_resp.iter_content(chunksize):
|
||||
f.write(c)
|
||||
|
||||
def with_path_root(self, path_root):
|
||||
"""
|
||||
Creates a clone of the Dropbox instance with the Dropbox-API-Path-Root header
|
||||
as the appropriate serialized instance of PathRoot.
|
||||
|
||||
For more information, see
|
||||
https://www.dropbox.com/developers/reference/namespace-guide#pathrootmodes
|
||||
|
||||
:param PathRoot path_root: instance of PathRoot to serialize into the headers field
|
||||
:return: A :class: `Dropbox`
|
||||
:rtype: Dropbox
|
||||
"""
|
||||
|
||||
if not isinstance(path_root, PathRoot):
|
||||
raise ValueError("path_root must be an instance of PathRoot")
|
||||
|
||||
return self.clone(
|
||||
headers={
|
||||
PATH_ROOT_HEADER: stone_serializers.json_encode(PathRoot_validator, path_root)
|
||||
}
|
||||
)
|
||||
|
||||
class Dropbox(_DropboxTransport, DropboxBase):
|
||||
"""
|
||||
Use this class to make requests to the Dropbox API using a user's access
|
||||
@ -493,22 +559,50 @@ class DropboxTeam(_DropboxTransport, DropboxTeamBase):
|
||||
token. Methods of this class are meant to act on the team, but there is
|
||||
also an :meth:`as_user` method for assuming a team member's identity.
|
||||
"""
|
||||
def as_admin(self, team_member_id):
|
||||
"""
|
||||
Allows a team credential to assume the identity of an administrator on the team
|
||||
and perform operations on any team-owned content.
|
||||
|
||||
:param str team_member_id: team member id of administrator to perform actions with
|
||||
:return: A :class:`Dropbox` object that can be used to query on behalf
|
||||
of this admin of the team.
|
||||
:rtype: Dropbox
|
||||
"""
|
||||
return self._get_dropbox_client_with_select_header('Dropbox-API-Select-Admin',
|
||||
team_member_id)
|
||||
|
||||
def as_user(self, team_member_id):
|
||||
"""
|
||||
Allows a team credential to assume the identity of a member of the
|
||||
team.
|
||||
|
||||
:param str team_member_id: team member id of team member to perform actions with
|
||||
:return: A :class:`Dropbox` object that can be used to query on behalf
|
||||
of this member of the team.
|
||||
:rtype: Dropbox
|
||||
"""
|
||||
return self._get_dropbox_client_with_select_header('Dropbox-API-Select-User',
|
||||
team_member_id)
|
||||
|
||||
def _get_dropbox_client_with_select_header(self, select_header_name, team_member_id):
|
||||
"""
|
||||
Get Dropbox client with modified headers
|
||||
|
||||
:param str select_header_name: Header name used to select users
|
||||
:param str team_member_id: team member id of team member to perform actions with
|
||||
:return: A :class:`Dropbox` object that can be used to query on behalf
|
||||
of a member or admin of the team
|
||||
:rtype: Dropbox
|
||||
"""
|
||||
|
||||
new_headers = self._headers.copy() if self._headers else {}
|
||||
new_headers['Dropbox-API-Select-User'] = team_member_id
|
||||
new_headers[select_header_name] = team_member_id
|
||||
return Dropbox(
|
||||
self._oauth2_access_token,
|
||||
max_retries_on_error=self._max_retries_on_error,
|
||||
max_retries_on_rate_limit=self._max_retries_on_rate_limit,
|
||||
timeout=self._timeout,
|
||||
user_agent=self._raw_user_agent,
|
||||
session=self._session,
|
||||
headers=new_headers,
|
||||
|
@ -46,6 +46,17 @@ class HttpError(DropboxException):
|
||||
self.status_code, self.body)
|
||||
|
||||
|
||||
class PathRootError(HttpError):
|
||||
"""Error caused by an invalid path root."""
|
||||
|
||||
def __init__(self, request_id, error=None):
|
||||
super(PathRootError, self).__init__(request_id, 422, None)
|
||||
self.error = error
|
||||
|
||||
def __repr__(self):
|
||||
return 'PathRootError({!r}, {!r})'.format(self.request_id, self.error)
|
||||
|
||||
|
||||
class BadInputError(HttpError):
|
||||
"""Errors due to bad input parameters to an API Operation."""
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
158
resources/lib/dropbox/seen_state.py
Normal file
158
resources/lib/dropbox/seen_state.py
Normal file
@ -0,0 +1,158 @@
|
||||
# -*- 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
|
||||
|
||||
class PlatformType(bb.Union):
|
||||
"""
|
||||
Possible platforms on which a user may view content.
|
||||
|
||||
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 seen_state.PlatformType.web: The content was viewed on the web.
|
||||
:ivar seen_state.PlatformType.desktop: The content was viewed on a desktop
|
||||
client.
|
||||
:ivar seen_state.PlatformType.mobile_ios: The content was viewed on a mobile
|
||||
iOS client.
|
||||
:ivar seen_state.PlatformType.mobile_android: The content was viewed on a
|
||||
mobile android client.
|
||||
:ivar seen_state.PlatformType.api: The content was viewed from an API
|
||||
client.
|
||||
:ivar seen_state.PlatformType.unknown: The content was viewed on an unknown
|
||||
platform.
|
||||
:ivar seen_state.PlatformType.mobile: The content was viewed on a mobile
|
||||
client. DEPRECATED: Use mobile_ios or mobile_android instead.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
web = None
|
||||
# Attribute is overwritten below the class definition
|
||||
desktop = None
|
||||
# Attribute is overwritten below the class definition
|
||||
mobile_ios = None
|
||||
# Attribute is overwritten below the class definition
|
||||
mobile_android = None
|
||||
# Attribute is overwritten below the class definition
|
||||
api = None
|
||||
# Attribute is overwritten below the class definition
|
||||
unknown = None
|
||||
# Attribute is overwritten below the class definition
|
||||
mobile = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_web(self):
|
||||
"""
|
||||
Check if the union tag is ``web``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'web'
|
||||
|
||||
def is_desktop(self):
|
||||
"""
|
||||
Check if the union tag is ``desktop``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'desktop'
|
||||
|
||||
def is_mobile_ios(self):
|
||||
"""
|
||||
Check if the union tag is ``mobile_ios``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'mobile_ios'
|
||||
|
||||
def is_mobile_android(self):
|
||||
"""
|
||||
Check if the union tag is ``mobile_android``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'mobile_android'
|
||||
|
||||
def is_api(self):
|
||||
"""
|
||||
Check if the union tag is ``api``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'api'
|
||||
|
||||
def is_unknown(self):
|
||||
"""
|
||||
Check if the union tag is ``unknown``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'unknown'
|
||||
|
||||
def is_mobile(self):
|
||||
"""
|
||||
Check if the union tag is ``mobile``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'mobile'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PlatformType, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PlatformType(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PlatformType_validator = bv.Union(PlatformType)
|
||||
|
||||
PlatformType._web_validator = bv.Void()
|
||||
PlatformType._desktop_validator = bv.Void()
|
||||
PlatformType._mobile_ios_validator = bv.Void()
|
||||
PlatformType._mobile_android_validator = bv.Void()
|
||||
PlatformType._api_validator = bv.Void()
|
||||
PlatformType._unknown_validator = bv.Void()
|
||||
PlatformType._mobile_validator = bv.Void()
|
||||
PlatformType._other_validator = bv.Void()
|
||||
PlatformType._tagmap = {
|
||||
'web': PlatformType._web_validator,
|
||||
'desktop': PlatformType._desktop_validator,
|
||||
'mobile_ios': PlatformType._mobile_ios_validator,
|
||||
'mobile_android': PlatformType._mobile_android_validator,
|
||||
'api': PlatformType._api_validator,
|
||||
'unknown': PlatformType._unknown_validator,
|
||||
'mobile': PlatformType._mobile_validator,
|
||||
'other': PlatformType._other_validator,
|
||||
}
|
||||
|
||||
PlatformType.web = PlatformType('web')
|
||||
PlatformType.desktop = PlatformType('desktop')
|
||||
PlatformType.mobile_ios = PlatformType('mobile_ios')
|
||||
PlatformType.mobile_android = PlatformType('mobile_android')
|
||||
PlatformType.api = PlatformType('api')
|
||||
PlatformType.unknown = PlatformType('unknown')
|
||||
PlatformType.mobile = PlatformType('mobile')
|
||||
PlatformType.other = PlatformType('other')
|
||||
|
||||
ROUTES = {
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import pkg_resources
|
||||
from . import pkg_resources
|
||||
import os
|
||||
import ssl
|
||||
|
||||
import requests
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.poolmanager import PoolManager
|
||||
from urllib3.poolmanager import PoolManager
|
||||
|
||||
API_DOMAIN = os.environ.get('DROPBOX_API_DOMAIN',
|
||||
os.environ.get('DROPBOX_DOMAIN', '.dropboxapi.com'))
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,9 +8,11 @@ than being added to a project.
|
||||
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import functools
|
||||
|
||||
try:
|
||||
from . import stone_validators as bv
|
||||
except (SystemError, ValueError):
|
||||
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 # type: ignore
|
||||
@ -19,17 +21,34 @@ _MYPY = False
|
||||
if _MYPY:
|
||||
import typing # noqa: F401 # pylint: disable=import-error,unused-import,useless-suppression
|
||||
|
||||
class AnnotationType(object):
|
||||
# This is a base class for all annotation types.
|
||||
pass
|
||||
|
||||
if _MYPY:
|
||||
T = typing.TypeVar('T', bound=AnnotationType)
|
||||
U = typing.TypeVar('U')
|
||||
|
||||
class Struct(object):
|
||||
# This is a base class for all classes representing Stone structs.
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
# type: (typing.Type[T], typing.Text, typing.Callable[[T, U], U]) -> None
|
||||
pass
|
||||
|
||||
class Union(object):
|
||||
# TODO(kelkabany): Possible optimization is to remove _value if a
|
||||
# union is composed of only symbols.
|
||||
__slots__ = ['_tag', '_value']
|
||||
_tagmap = {} # type: typing.Dict[typing.Text, bv.Validator]
|
||||
_permissioned_tagmaps = set() # type: typing.Set[typing.Text]
|
||||
|
||||
def __init__(self, tag, value=None):
|
||||
# type: (typing.Text, typing.Optional[typing.Any]) -> None
|
||||
assert tag in self._tagmap, 'Invalid tag %r.' % tag
|
||||
validator = self._tagmap[tag]
|
||||
validator = None
|
||||
tagmap_names = ['_{}_tagmap'.format(map_name) for map_name in self._permissioned_tagmaps]
|
||||
for tagmap_name in ['_tagmap'] + tagmap_names:
|
||||
if tag in getattr(self, tagmap_name):
|
||||
validator = getattr(self, tagmap_name)[tag]
|
||||
assert validator is not None, 'Invalid tag %r.' % tag
|
||||
if isinstance(validator, bv.Void):
|
||||
assert value is None, 'Void type union member must have None value.'
|
||||
elif isinstance(validator, (bv.Struct, bv.Union)):
|
||||
@ -54,10 +73,40 @@ class Union(object):
|
||||
def __hash__(self):
|
||||
return hash((self._tag, self._value))
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
# type: (typing.Type[T], typing.Text, typing.Callable[[T, U], U]) -> None
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def _is_tag_present(cls, tag, caller_permissions):
|
||||
assert tag, 'tag value should not be None'
|
||||
|
||||
if tag in cls._tagmap:
|
||||
return True
|
||||
|
||||
for extra_permission in caller_permissions.permissions:
|
||||
tagmap_name = '_{}_tagmap'.format(extra_permission)
|
||||
if hasattr(cls, tagmap_name) and tag in getattr(cls, tagmap_name):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def _get_val_data_type(cls, tag, caller_permissions):
|
||||
assert tag, 'tag value should not be None'
|
||||
|
||||
for extra_permission in caller_permissions.permissions:
|
||||
tagmap_name = '_{}_tagmap'.format(extra_permission)
|
||||
if hasattr(cls, tagmap_name) and tag in getattr(cls, tagmap_name):
|
||||
return getattr(cls, tagmap_name)[tag]
|
||||
|
||||
return cls._tagmap[tag]
|
||||
|
||||
class Route(object):
|
||||
|
||||
def __init__(self, name, deprecated, arg_type, result_type, error_type, attrs):
|
||||
def __init__(self, name, version, deprecated, arg_type, result_type, error_type, attrs):
|
||||
self.name = name
|
||||
self.version = version
|
||||
self.deprecated = deprecated
|
||||
self.arg_type = arg_type
|
||||
self.result_type = result_type
|
||||
@ -66,10 +115,38 @@ class Route(object):
|
||||
self.attrs = attrs
|
||||
|
||||
def __repr__(self):
|
||||
return 'Route({!r}, {!r}, {!r}, {!r}, {!r}, {!r})'.format(
|
||||
return 'Route({!r}, {!r}, {!r}, {!r}, {!r}, {!r}, {!r})'.format(
|
||||
self.name,
|
||||
self.version,
|
||||
self.deprecated,
|
||||
self.arg_type,
|
||||
self.result_type,
|
||||
self.error_type,
|
||||
self.attrs)
|
||||
|
||||
# helper functions used when constructing custom annotation processors
|
||||
|
||||
# put this here so that every other file doesn't need to import functools
|
||||
partially_apply = functools.partial
|
||||
|
||||
def make_struct_annotation_processor(annotation_type, processor):
|
||||
def g(field_path, struct):
|
||||
if struct is None:
|
||||
return struct
|
||||
struct._process_custom_annotations(annotation_type, field_path, processor)
|
||||
return struct
|
||||
return g
|
||||
|
||||
def make_list_annotation_processor(processor):
|
||||
def g(field_path, list_):
|
||||
if list_ is None:
|
||||
return list_
|
||||
return [processor('{}[{}]'.format(field_path, idx), x) for idx, x in enumerate(list_)]
|
||||
return g
|
||||
|
||||
def make_map_value_annotation_processor(processor):
|
||||
def g(field_path, map_):
|
||||
if map_ is None:
|
||||
return map_
|
||||
return {k: processor('{}[{}]'.format(field_path, repr(k)), v) for k, v in map_.items()}
|
||||
return g
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
import datetime
|
||||
import hashlib
|
||||
import math
|
||||
import numbers
|
||||
import re
|
||||
@ -73,7 +74,10 @@ class ValidationError(Exception):
|
||||
def generic_type_name(v):
|
||||
"""Return a descriptive type name that isn't Python specific. For example,
|
||||
an int value will return 'integer' rather than 'int'."""
|
||||
if isinstance(v, numbers.Integral):
|
||||
if isinstance(v, bool):
|
||||
# Must come before any numbers checks since booleans are integers too
|
||||
return 'boolean'
|
||||
elif isinstance(v, numbers.Integral):
|
||||
# Must come before real numbers check since integrals are reals too
|
||||
return 'integer'
|
||||
elif isinstance(v, numbers.Real):
|
||||
@ -455,6 +459,16 @@ class Struct(Composite):
|
||||
self.validate_fields_only(val)
|
||||
return val
|
||||
|
||||
def validate_with_permissions(self, val, caller_permissions):
|
||||
"""
|
||||
For a val to pass validation, val must be of the correct type and have
|
||||
all required permissioned fields present. Should only be called
|
||||
for callers with extra permissions.
|
||||
"""
|
||||
self.validate(val)
|
||||
self.validate_fields_only_with_permissions(val, caller_permissions)
|
||||
return val
|
||||
|
||||
def validate_fields_only(self, val):
|
||||
"""
|
||||
To pass field validation, no required field should be missing.
|
||||
@ -465,11 +479,27 @@ class Struct(Composite):
|
||||
FIXME(kelkabany): Since the definition object does not maintain a list
|
||||
of which fields are required, all fields are scanned.
|
||||
"""
|
||||
for field_name, _ in self.definition._all_fields_:
|
||||
for field_name in self.definition._all_field_names_:
|
||||
if not hasattr(val, field_name):
|
||||
raise ValidationError("missing required field '%s'" %
|
||||
field_name)
|
||||
|
||||
def validate_fields_only_with_permissions(self, val, caller_permissions):
|
||||
"""
|
||||
To pass field validation, no required field should be missing.
|
||||
This method assumes that the contents of each field have already been
|
||||
validated on assignment, so it's merely a presence check.
|
||||
Should only be called for callers with extra permissions.
|
||||
"""
|
||||
self.validate_fields_only(val)
|
||||
|
||||
# check if type has been patched
|
||||
for extra_permission in caller_permissions.permissions:
|
||||
all_field_names = '_all_{}_field_names_'.format(extra_permission)
|
||||
for field_name in getattr(self.definition, all_field_names, set()):
|
||||
if not hasattr(val, field_name):
|
||||
raise ValidationError("missing required field '%s'" % field_name)
|
||||
|
||||
def validate_type_only(self, val):
|
||||
"""
|
||||
Use this when you only want to validate that the type of an object
|
||||
@ -590,3 +620,54 @@ class Nullable(Validator):
|
||||
|
||||
def get_default(self):
|
||||
return None
|
||||
|
||||
class Redactor(object):
|
||||
def __init__(self, regex):
|
||||
"""
|
||||
Args:
|
||||
regex: What parts of the field to redact.
|
||||
"""
|
||||
self.regex = regex
|
||||
|
||||
@abstractmethod
|
||||
def apply(self, val):
|
||||
"""Redacts information from annotated field.
|
||||
Returns: A redacted version of the string provided.
|
||||
"""
|
||||
pass
|
||||
|
||||
def _get_matches(self, val):
|
||||
if not self.regex:
|
||||
return None
|
||||
try:
|
||||
return re.search(self.regex, val)
|
||||
except TypeError:
|
||||
return None
|
||||
|
||||
|
||||
class HashRedactor(Redactor):
|
||||
def apply(self, val):
|
||||
matches = self._get_matches(val)
|
||||
|
||||
val_to_hash = str(val) if isinstance(val, int) or isinstance(val, float) else val
|
||||
|
||||
try:
|
||||
# add string literal to ensure unicode
|
||||
hashed = hashlib.md5(val_to_hash.encode('utf-8')).hexdigest() + ''
|
||||
except [AttributeError, ValueError]:
|
||||
hashed = None
|
||||
|
||||
if matches:
|
||||
blotted = '***'.join(matches.groups())
|
||||
if hashed:
|
||||
return '{} ({})'.format(hashed, blotted)
|
||||
return blotted
|
||||
return hashed
|
||||
|
||||
|
||||
class BlotRedactor(Redactor):
|
||||
def apply(self, val):
|
||||
matches = self._get_matches(val)
|
||||
if matches:
|
||||
return '***'.join(matches.groups())
|
||||
return '********'
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,12 @@
|
||||
# -*- 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 (SystemError, ValueError):
|
||||
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
|
||||
@ -15,7 +16,7 @@ try:
|
||||
from . import (
|
||||
common,
|
||||
)
|
||||
except (SystemError, ValueError):
|
||||
except (ImportError, SystemError, ValueError):
|
||||
import common
|
||||
|
||||
class GroupManagementType(bb.Union):
|
||||
@ -26,9 +27,12 @@ class GroupManagementType(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar user_managed: A group which is managed by selected users.
|
||||
:ivar company_managed: A group which is managed by team admins only.
|
||||
:ivar system_managed: A group which is managed automatically by Dropbox.
|
||||
:ivar team_common.GroupManagementType.user_managed: A group which is managed
|
||||
by selected users.
|
||||
:ivar team_common.GroupManagementType.company_managed: A group which is
|
||||
managed by team admins only.
|
||||
:ivar team_common.GroupManagementType.system_managed: A group which is
|
||||
managed automatically by Dropbox.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -73,19 +77,24 @@ class GroupManagementType(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(GroupManagementType, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'GroupManagementType(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
GroupManagementType_validator = bv.Union(GroupManagementType)
|
||||
|
||||
class GroupSummary(object):
|
||||
class GroupSummary(bb.Struct):
|
||||
"""
|
||||
Information about a group.
|
||||
|
||||
:ivar group_external_id: External ID of group. This is an arbitrary ID that
|
||||
an admin can attach to a group.
|
||||
:ivar member_count: The number of members in the group.
|
||||
:ivar group_management_type: Who is allowed to manage the group.
|
||||
:ivar team_common.GroupSummary.group_external_id: External ID of group. This
|
||||
is an arbitrary ID that an admin can attach to a group.
|
||||
:ivar team_common.GroupSummary.member_count: The number of members in the
|
||||
group.
|
||||
:ivar team_common.GroupSummary.group_management_type: Who is allowed to
|
||||
manage the group.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -204,7 +213,7 @@ class GroupSummary(object):
|
||||
"""
|
||||
The number of members in the group.
|
||||
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
if self._member_count_present:
|
||||
return self._member_count_value
|
||||
@ -248,6 +257,9 @@ class GroupSummary(object):
|
||||
self._group_management_type_value = None
|
||||
self._group_management_type_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(GroupSummary, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'GroupSummary(group_name={!r}, group_id={!r}, group_management_type={!r}, group_external_id={!r}, member_count={!r})'.format(
|
||||
self._group_name_value,
|
||||
@ -267,9 +279,11 @@ class GroupType(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar team: A group to which team members are automatically added.
|
||||
Applicable to `team folders <https://www.dropbox.com/help/986>`_ only.
|
||||
:ivar user_managed: A group is created and managed by a user.
|
||||
:ivar team_common.GroupType.team: A group to which team members are
|
||||
automatically added. Applicable to `team folders
|
||||
<https://www.dropbox.com/help/986>`_ only.
|
||||
:ivar team_common.GroupType.user_managed: A group is created and managed by
|
||||
a user.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -304,17 +318,88 @@ class GroupType(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(GroupType, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'GroupType(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
GroupType_validator = bv.Union(GroupType)
|
||||
|
||||
class TimeRange(object):
|
||||
class MemberSpaceLimitType(bb.Union):
|
||||
"""
|
||||
The type of the space limit imposed on a team 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 team_common.MemberSpaceLimitType.off: The team member does not have
|
||||
imposed space limit.
|
||||
:ivar team_common.MemberSpaceLimitType.alert_only: The team member has soft
|
||||
imposed space limit - the limit is used for display and for
|
||||
notifications.
|
||||
:ivar team_common.MemberSpaceLimitType.stop_sync: The team member has hard
|
||||
imposed space limit - Dropbox file sync will stop after the limit is
|
||||
reached.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
off = None
|
||||
# Attribute is overwritten below the class definition
|
||||
alert_only = None
|
||||
# Attribute is overwritten below the class definition
|
||||
stop_sync = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_off(self):
|
||||
"""
|
||||
Check if the union tag is ``off``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'off'
|
||||
|
||||
def is_alert_only(self):
|
||||
"""
|
||||
Check if the union tag is ``alert_only``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'alert_only'
|
||||
|
||||
def is_stop_sync(self):
|
||||
"""
|
||||
Check if the union tag is ``stop_sync``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'stop_sync'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(MemberSpaceLimitType, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'MemberSpaceLimitType(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
MemberSpaceLimitType_validator = bv.Union(MemberSpaceLimitType)
|
||||
|
||||
class TimeRange(bb.Struct):
|
||||
"""
|
||||
Time range.
|
||||
|
||||
:ivar start_time: Optional starting time (inclusive).
|
||||
:ivar end_time: Optional ending time (exclusive).
|
||||
:ivar team_common.TimeRange.start_time: Optional starting time (inclusive).
|
||||
:ivar team_common.TimeRange.end_time: Optional ending time (exclusive).
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -390,6 +475,9 @@ class TimeRange(object):
|
||||
self._end_time_value = None
|
||||
self._end_time_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TimeRange, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TimeRange(start_time={!r}, end_time={!r})'.format(
|
||||
self._start_time_value,
|
||||
@ -452,6 +540,22 @@ GroupType.team = GroupType('team')
|
||||
GroupType.user_managed = GroupType('user_managed')
|
||||
GroupType.other = GroupType('other')
|
||||
|
||||
MemberSpaceLimitType._off_validator = bv.Void()
|
||||
MemberSpaceLimitType._alert_only_validator = bv.Void()
|
||||
MemberSpaceLimitType._stop_sync_validator = bv.Void()
|
||||
MemberSpaceLimitType._other_validator = bv.Void()
|
||||
MemberSpaceLimitType._tagmap = {
|
||||
'off': MemberSpaceLimitType._off_validator,
|
||||
'alert_only': MemberSpaceLimitType._alert_only_validator,
|
||||
'stop_sync': MemberSpaceLimitType._stop_sync_validator,
|
||||
'other': MemberSpaceLimitType._other_validator,
|
||||
}
|
||||
|
||||
MemberSpaceLimitType.off = MemberSpaceLimitType('off')
|
||||
MemberSpaceLimitType.alert_only = MemberSpaceLimitType('alert_only')
|
||||
MemberSpaceLimitType.stop_sync = MemberSpaceLimitType('stop_sync')
|
||||
MemberSpaceLimitType.other = MemberSpaceLimitType('other')
|
||||
|
||||
TimeRange._start_time_validator = bv.Nullable(common.DropboxTimestamp_validator)
|
||||
TimeRange._end_time_validator = bv.Nullable(common.DropboxTimestamp_validator)
|
||||
TimeRange._all_field_names_ = set([
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,78 @@
|
||||
# -*- 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 (SystemError, ValueError):
|
||||
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
|
||||
|
||||
class CameraUploadsPolicyState(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 team_policies.CameraUploadsPolicyState.disabled: Background camera
|
||||
uploads are disabled.
|
||||
:ivar team_policies.CameraUploadsPolicyState.enabled: Background camera
|
||||
uploads are allowed.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
disabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
enabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_disabled(self):
|
||||
"""
|
||||
Check if the union tag is ``disabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'disabled'
|
||||
|
||||
def is_enabled(self):
|
||||
"""
|
||||
Check if the union tag is ``enabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'enabled'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(CameraUploadsPolicyState, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'CameraUploadsPolicyState(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
CameraUploadsPolicyState_validator = bv.Union(CameraUploadsPolicyState)
|
||||
|
||||
class EmmState(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 disabled: Emm token is disabled.
|
||||
:ivar optional: Emm token is optional.
|
||||
:ivar required: Emm token is required.
|
||||
:ivar team_policies.EmmState.disabled: Emm token is disabled.
|
||||
:ivar team_policies.EmmState.optional: Emm token is optional.
|
||||
:ivar team_policies.EmmState.required: Emm token is required.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -64,19 +117,64 @@ class EmmState(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(EmmState, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'EmmState(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
EmmState_validator = bv.Union(EmmState)
|
||||
|
||||
class GroupCreation(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 team_policies.GroupCreation.admins_and_members: Team admins and
|
||||
members can create groups.
|
||||
:ivar team_policies.GroupCreation.admins_only: Only team admins can create
|
||||
groups.
|
||||
"""
|
||||
|
||||
_catch_all = None
|
||||
# Attribute is overwritten below the class definition
|
||||
admins_and_members = None
|
||||
# Attribute is overwritten below the class definition
|
||||
admins_only = None
|
||||
|
||||
def is_admins_and_members(self):
|
||||
"""
|
||||
Check if the union tag is ``admins_and_members``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'admins_and_members'
|
||||
|
||||
def is_admins_only(self):
|
||||
"""
|
||||
Check if the union tag is ``admins_only``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'admins_only'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(GroupCreation, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'GroupCreation(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
GroupCreation_validator = bv.Union(GroupCreation)
|
||||
|
||||
class OfficeAddInPolicy(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 disabled: Office Add-In is disabled.
|
||||
:ivar enabled: Office Add-In is enabled.
|
||||
:ivar team_policies.OfficeAddInPolicy.disabled: Office Add-In is disabled.
|
||||
:ivar team_policies.OfficeAddInPolicy.enabled: Office Add-In is enabled.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -111,20 +209,77 @@ class OfficeAddInPolicy(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(OfficeAddInPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'OfficeAddInPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
OfficeAddInPolicy_validator = bv.Union(OfficeAddInPolicy)
|
||||
|
||||
class PaperDefaultFolderPolicy(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 team_policies.PaperDefaultFolderPolicy.everyone_in_team: Everyone in
|
||||
team will be the default option when creating a folder in Paper.
|
||||
:ivar team_policies.PaperDefaultFolderPolicy.invite_only: Invite only will
|
||||
be the default option when creating a folder in Paper.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
everyone_in_team = None
|
||||
# Attribute is overwritten below the class definition
|
||||
invite_only = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_everyone_in_team(self):
|
||||
"""
|
||||
Check if the union tag is ``everyone_in_team``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'everyone_in_team'
|
||||
|
||||
def is_invite_only(self):
|
||||
"""
|
||||
Check if the union tag is ``invite_only``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'invite_only'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PaperDefaultFolderPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PaperDefaultFolderPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PaperDefaultFolderPolicy_validator = bv.Union(PaperDefaultFolderPolicy)
|
||||
|
||||
class PaperDeploymentPolicy(bb.Union):
|
||||
"""
|
||||
This class acts as a tagged union. Only one of the ``is_*`` methods will
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar full: All team members have access to Paper.
|
||||
:ivar partial: Only whitelisted team members can access Paper. To see which
|
||||
user is whitelisted, check 'is_paper_whitelisted' on 'account/info'.
|
||||
:ivar team_policies.PaperDeploymentPolicy.full: All team members have access
|
||||
to Paper.
|
||||
:ivar team_policies.PaperDeploymentPolicy.partial: Only whitelisted team
|
||||
members can access Paper. To see which user is whitelisted, check
|
||||
'is_paper_whitelisted' on 'account/info'.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -159,20 +314,75 @@ class PaperDeploymentPolicy(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PaperDeploymentPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PaperDeploymentPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PaperDeploymentPolicy_validator = bv.Union(PaperDeploymentPolicy)
|
||||
|
||||
class PaperDesktopPolicy(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 team_policies.PaperDesktopPolicy.disabled: Do not allow team members
|
||||
to use Paper Desktop.
|
||||
:ivar team_policies.PaperDesktopPolicy.enabled: Allow team members to use
|
||||
Paper Desktop.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
disabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
enabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_disabled(self):
|
||||
"""
|
||||
Check if the union tag is ``disabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'disabled'
|
||||
|
||||
def is_enabled(self):
|
||||
"""
|
||||
Check if the union tag is ``enabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'enabled'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PaperDesktopPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PaperDesktopPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
PaperDesktopPolicy_validator = bv.Union(PaperDesktopPolicy)
|
||||
|
||||
class PaperEnabledPolicy(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 disabled: Paper is disabled.
|
||||
:ivar enabled: Paper is enabled.
|
||||
:ivar unspecified: Unspecified policy.
|
||||
:ivar team_policies.PaperEnabledPolicy.disabled: Paper is disabled.
|
||||
:ivar team_policies.PaperEnabledPolicy.enabled: Paper is enabled.
|
||||
:ivar team_policies.PaperEnabledPolicy.unspecified: Unspecified policy.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -217,6 +427,9 @@ class PaperEnabledPolicy(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PaperEnabledPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PaperEnabledPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -228,12 +441,12 @@ class PasswordStrengthPolicy(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar minimal_requirements: User passwords will adhere to the minimal
|
||||
password strength policy.
|
||||
:ivar moderate_password: User passwords will adhere to the moderate password
|
||||
strength policy.
|
||||
:ivar strong_password: User passwords will adhere to the very strong
|
||||
password strength policy.
|
||||
:ivar team_policies.PasswordStrengthPolicy.minimal_requirements: User
|
||||
passwords will adhere to the minimal password strength policy.
|
||||
:ivar team_policies.PasswordStrengthPolicy.moderate_password: User passwords
|
||||
will adhere to the moderate password strength policy.
|
||||
:ivar team_policies.PasswordStrengthPolicy.strong_password: User passwords
|
||||
will adhere to the very strong password strength policy.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -278,6 +491,9 @@ class PasswordStrengthPolicy(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(PasswordStrengthPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'PasswordStrengthPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -289,9 +505,11 @@ class RolloutMethod(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar unlink_all: Unlink all.
|
||||
:ivar unlink_most_inactive: Unlink devices with the most inactivity.
|
||||
:ivar add_member_to_exceptions: Add member to Exceptions.
|
||||
:ivar team_policies.RolloutMethod.unlink_all: Unlink all.
|
||||
:ivar team_policies.RolloutMethod.unlink_most_inactive: Unlink devices with
|
||||
the most inactivity.
|
||||
:ivar team_policies.RolloutMethod.add_member_to_exceptions: Add member to
|
||||
Exceptions.
|
||||
"""
|
||||
|
||||
_catch_all = None
|
||||
@ -326,6 +544,9 @@ class RolloutMethod(bb.Union):
|
||||
"""
|
||||
return self._tag == 'add_member_to_exceptions'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(RolloutMethod, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'RolloutMethod(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -339,10 +560,11 @@ class SharedFolderJoinPolicy(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar from_team_only: Team members can only join folders shared by
|
||||
teammates.
|
||||
:ivar from_anyone: Team members can join any shared folder, including those
|
||||
shared by users outside the team.
|
||||
:ivar team_policies.SharedFolderJoinPolicy.from_team_only: Team members can
|
||||
only join folders shared by teammates.
|
||||
:ivar team_policies.SharedFolderJoinPolicy.from_anyone: Team members can
|
||||
join any shared folder, including those shared by users outside the
|
||||
team.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -377,6 +599,9 @@ class SharedFolderJoinPolicy(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(SharedFolderJoinPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'SharedFolderJoinPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -390,9 +615,10 @@ class SharedFolderMemberPolicy(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar team: Only a teammate can be a member of a folder shared by a team
|
||||
member.
|
||||
:ivar anyone: Anyone can be a member of a folder shared by a team member.
|
||||
:ivar team_policies.SharedFolderMemberPolicy.team: Only a teammate can be a
|
||||
member of a folder shared by a team member.
|
||||
:ivar team_policies.SharedFolderMemberPolicy.anyone: Anyone can be a member
|
||||
of a folder shared by a team member.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -427,6 +653,9 @@ class SharedFolderMemberPolicy(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(SharedFolderMemberPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'SharedFolderMemberPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -441,14 +670,15 @@ class SharedLinkCreatePolicy(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar default_public: By default, anyone can access newly created shared
|
||||
links. No login will be required to access the shared links unless
|
||||
overridden.
|
||||
:ivar default_team_only: By default, only members of the same team can
|
||||
access newly created shared links. Login will be required to access the
|
||||
shared links unless overridden.
|
||||
:ivar team_only: Only members of the same team can access all shared links.
|
||||
Login will be required to access all shared links.
|
||||
:ivar team_policies.SharedLinkCreatePolicy.default_public: By default,
|
||||
anyone can access newly created shared links. No login will be required
|
||||
to access the shared links unless overridden.
|
||||
:ivar team_policies.SharedLinkCreatePolicy.default_team_only: By default,
|
||||
only members of the same team can access newly created shared links.
|
||||
Login will be required to access the shared links unless overridden.
|
||||
:ivar team_policies.SharedLinkCreatePolicy.team_only: Only members of the
|
||||
same team can access all shared links. Login will be required to access
|
||||
all shared links.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -493,23 +723,232 @@ class SharedLinkCreatePolicy(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(SharedLinkCreatePolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'SharedLinkCreatePolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
SharedLinkCreatePolicy_validator = bv.Union(SharedLinkCreatePolicy)
|
||||
|
||||
class ShowcaseDownloadPolicy(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 team_policies.ShowcaseDownloadPolicy.disabled: Do not allow files to
|
||||
be downloaded from Showcases.
|
||||
:ivar team_policies.ShowcaseDownloadPolicy.enabled: Allow files to be
|
||||
downloaded from Showcases.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
disabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
enabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_disabled(self):
|
||||
"""
|
||||
Check if the union tag is ``disabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'disabled'
|
||||
|
||||
def is_enabled(self):
|
||||
"""
|
||||
Check if the union tag is ``enabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'enabled'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(ShowcaseDownloadPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'ShowcaseDownloadPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
ShowcaseDownloadPolicy_validator = bv.Union(ShowcaseDownloadPolicy)
|
||||
|
||||
class ShowcaseEnabledPolicy(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 team_policies.ShowcaseEnabledPolicy.disabled: Showcase is disabled.
|
||||
:ivar team_policies.ShowcaseEnabledPolicy.enabled: Showcase is enabled.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
disabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
enabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_disabled(self):
|
||||
"""
|
||||
Check if the union tag is ``disabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'disabled'
|
||||
|
||||
def is_enabled(self):
|
||||
"""
|
||||
Check if the union tag is ``enabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'enabled'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(ShowcaseEnabledPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'ShowcaseEnabledPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
ShowcaseEnabledPolicy_validator = bv.Union(ShowcaseEnabledPolicy)
|
||||
|
||||
class ShowcaseExternalSharingPolicy(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 team_policies.ShowcaseExternalSharingPolicy.disabled: Do not allow
|
||||
showcases to be shared with people not on the team.
|
||||
:ivar team_policies.ShowcaseExternalSharingPolicy.enabled: Allow showcases
|
||||
to be shared with people not on the team.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
disabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
enabled = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_disabled(self):
|
||||
"""
|
||||
Check if the union tag is ``disabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'disabled'
|
||||
|
||||
def is_enabled(self):
|
||||
"""
|
||||
Check if the union tag is ``enabled``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'enabled'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(ShowcaseExternalSharingPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'ShowcaseExternalSharingPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
ShowcaseExternalSharingPolicy_validator = bv.Union(ShowcaseExternalSharingPolicy)
|
||||
|
||||
class SmartSyncPolicy(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 team_policies.SmartSyncPolicy.local: The specified content will be
|
||||
synced as local files by default.
|
||||
:ivar team_policies.SmartSyncPolicy.on_demand: The specified content will be
|
||||
synced as on-demand files by default.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
local = None
|
||||
# Attribute is overwritten below the class definition
|
||||
on_demand = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_local(self):
|
||||
"""
|
||||
Check if the union tag is ``local``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'local'
|
||||
|
||||
def is_on_demand(self):
|
||||
"""
|
||||
Check if the union tag is ``on_demand``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'on_demand'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(SmartSyncPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'SmartSyncPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
SmartSyncPolicy_validator = bv.Union(SmartSyncPolicy)
|
||||
|
||||
class SsoPolicy(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 disabled: Users will be able to sign in with their Dropbox
|
||||
credentials.
|
||||
:ivar optional: Users will be able to sign in with either their Dropbox or
|
||||
single sign-on credentials.
|
||||
:ivar required: Users will be required to sign in with their single sign-on
|
||||
credentials.
|
||||
:ivar team_policies.SsoPolicy.disabled: Users will be able to sign in with
|
||||
their Dropbox credentials.
|
||||
:ivar team_policies.SsoPolicy.optional: Users will be able to sign in with
|
||||
either their Dropbox or single sign-on credentials.
|
||||
:ivar team_policies.SsoPolicy.required: Users will be required to sign in
|
||||
with their single sign-on credentials.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -554,24 +993,28 @@ class SsoPolicy(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(SsoPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'SsoPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
SsoPolicy_validator = bv.Union(SsoPolicy)
|
||||
|
||||
class TeamMemberPolicies(object):
|
||||
class TeamMemberPolicies(bb.Struct):
|
||||
"""
|
||||
Policies governing team members.
|
||||
|
||||
:ivar sharing: Policies governing sharing.
|
||||
:ivar emm_state: This describes the Enterprise Mobility Management (EMM)
|
||||
state for this team. This information can be used to understand if an
|
||||
organization is integrating with a third-party EMM vendor to further
|
||||
manage and apply restrictions upon the team's Dropbox usage on mobile
|
||||
devices. This is a new feature and in the future we'll be adding more
|
||||
new fields and additional documentation.
|
||||
:ivar office_addin: The admin policy around the Dropbox Office Add-In for
|
||||
this team.
|
||||
:ivar team_policies.TeamMemberPolicies.sharing: Policies governing sharing.
|
||||
:ivar team_policies.TeamMemberPolicies.emm_state: This describes the
|
||||
Enterprise Mobility Management (EMM) state for this team. This
|
||||
information can be used to understand if an organization is integrating
|
||||
with a third-party EMM vendor to further manage and apply restrictions
|
||||
upon the team's Dropbox usage on mobile devices. This is a new feature
|
||||
and in the future we'll be adding more new fields and additional
|
||||
documentation.
|
||||
:ivar team_policies.TeamMemberPolicies.office_addin: The admin policy around
|
||||
the Dropbox Office Add-In for this team.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -676,6 +1119,9 @@ class TeamMemberPolicies(object):
|
||||
self._office_addin_value = None
|
||||
self._office_addin_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TeamMemberPolicies, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TeamMemberPolicies(sharing={!r}, emm_state={!r}, office_addin={!r})'.format(
|
||||
self._sharing_value,
|
||||
@ -685,15 +1131,16 @@ class TeamMemberPolicies(object):
|
||||
|
||||
TeamMemberPolicies_validator = bv.Struct(TeamMemberPolicies)
|
||||
|
||||
class TeamSharingPolicies(object):
|
||||
class TeamSharingPolicies(bb.Struct):
|
||||
"""
|
||||
Policies governing sharing within and outside of the team.
|
||||
|
||||
:ivar shared_folder_member_policy: Who can join folders shared by team
|
||||
members.
|
||||
:ivar shared_folder_join_policy: Which shared folders team members can join.
|
||||
:ivar shared_link_create_policy: Who can view shared links owned by team
|
||||
members.
|
||||
:ivar team_policies.TeamSharingPolicies.shared_folder_member_policy: Who can
|
||||
join folders shared by team members.
|
||||
:ivar team_policies.TeamSharingPolicies.shared_folder_join_policy: Which
|
||||
shared folders team members can join.
|
||||
:ivar team_policies.TeamSharingPolicies.shared_link_create_policy: Who can
|
||||
view shared links owned by team members.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -793,6 +1240,9 @@ class TeamSharingPolicies(object):
|
||||
self._shared_link_create_policy_value = None
|
||||
self._shared_link_create_policy_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TeamSharingPolicies, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TeamSharingPolicies(shared_folder_member_policy={!r}, shared_folder_join_policy={!r}, shared_link_create_policy={!r})'.format(
|
||||
self._shared_folder_member_policy_value,
|
||||
@ -808,8 +1258,10 @@ class TwoStepVerificationPolicy(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar require_tfa_enable: Enabled require two factor authorization.
|
||||
:ivar require_tfa_disable: Disabled require two factor authorization.
|
||||
:ivar team_policies.TwoStepVerificationPolicy.require_tfa_enable: Enabled
|
||||
require two factor authorization.
|
||||
:ivar team_policies.TwoStepVerificationPolicy.require_tfa_disable: Disabled
|
||||
require two factor authorization.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -844,11 +1296,79 @@ class TwoStepVerificationPolicy(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TwoStepVerificationPolicy, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TwoStepVerificationPolicy(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
TwoStepVerificationPolicy_validator = bv.Union(TwoStepVerificationPolicy)
|
||||
|
||||
class TwoStepVerificationState(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 team_policies.TwoStepVerificationState.required: Enabled require two
|
||||
factor authorization.
|
||||
:ivar team_policies.TwoStepVerificationState.optional: Optional require two
|
||||
factor authorization.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
# Attribute is overwritten below the class definition
|
||||
required = None
|
||||
# Attribute is overwritten below the class definition
|
||||
optional = None
|
||||
# Attribute is overwritten below the class definition
|
||||
other = None
|
||||
|
||||
def is_required(self):
|
||||
"""
|
||||
Check if the union tag is ``required``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'required'
|
||||
|
||||
def is_optional(self):
|
||||
"""
|
||||
Check if the union tag is ``optional``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'optional'
|
||||
|
||||
def is_other(self):
|
||||
"""
|
||||
Check if the union tag is ``other``.
|
||||
|
||||
:rtype: bool
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TwoStepVerificationState, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TwoStepVerificationState(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
TwoStepVerificationState_validator = bv.Union(TwoStepVerificationState)
|
||||
|
||||
CameraUploadsPolicyState._disabled_validator = bv.Void()
|
||||
CameraUploadsPolicyState._enabled_validator = bv.Void()
|
||||
CameraUploadsPolicyState._other_validator = bv.Void()
|
||||
CameraUploadsPolicyState._tagmap = {
|
||||
'disabled': CameraUploadsPolicyState._disabled_validator,
|
||||
'enabled': CameraUploadsPolicyState._enabled_validator,
|
||||
'other': CameraUploadsPolicyState._other_validator,
|
||||
}
|
||||
|
||||
CameraUploadsPolicyState.disabled = CameraUploadsPolicyState('disabled')
|
||||
CameraUploadsPolicyState.enabled = CameraUploadsPolicyState('enabled')
|
||||
CameraUploadsPolicyState.other = CameraUploadsPolicyState('other')
|
||||
|
||||
EmmState._disabled_validator = bv.Void()
|
||||
EmmState._optional_validator = bv.Void()
|
||||
EmmState._required_validator = bv.Void()
|
||||
@ -865,6 +1385,16 @@ EmmState.optional = EmmState('optional')
|
||||
EmmState.required = EmmState('required')
|
||||
EmmState.other = EmmState('other')
|
||||
|
||||
GroupCreation._admins_and_members_validator = bv.Void()
|
||||
GroupCreation._admins_only_validator = bv.Void()
|
||||
GroupCreation._tagmap = {
|
||||
'admins_and_members': GroupCreation._admins_and_members_validator,
|
||||
'admins_only': GroupCreation._admins_only_validator,
|
||||
}
|
||||
|
||||
GroupCreation.admins_and_members = GroupCreation('admins_and_members')
|
||||
GroupCreation.admins_only = GroupCreation('admins_only')
|
||||
|
||||
OfficeAddInPolicy._disabled_validator = bv.Void()
|
||||
OfficeAddInPolicy._enabled_validator = bv.Void()
|
||||
OfficeAddInPolicy._other_validator = bv.Void()
|
||||
@ -878,6 +1408,19 @@ OfficeAddInPolicy.disabled = OfficeAddInPolicy('disabled')
|
||||
OfficeAddInPolicy.enabled = OfficeAddInPolicy('enabled')
|
||||
OfficeAddInPolicy.other = OfficeAddInPolicy('other')
|
||||
|
||||
PaperDefaultFolderPolicy._everyone_in_team_validator = bv.Void()
|
||||
PaperDefaultFolderPolicy._invite_only_validator = bv.Void()
|
||||
PaperDefaultFolderPolicy._other_validator = bv.Void()
|
||||
PaperDefaultFolderPolicy._tagmap = {
|
||||
'everyone_in_team': PaperDefaultFolderPolicy._everyone_in_team_validator,
|
||||
'invite_only': PaperDefaultFolderPolicy._invite_only_validator,
|
||||
'other': PaperDefaultFolderPolicy._other_validator,
|
||||
}
|
||||
|
||||
PaperDefaultFolderPolicy.everyone_in_team = PaperDefaultFolderPolicy('everyone_in_team')
|
||||
PaperDefaultFolderPolicy.invite_only = PaperDefaultFolderPolicy('invite_only')
|
||||
PaperDefaultFolderPolicy.other = PaperDefaultFolderPolicy('other')
|
||||
|
||||
PaperDeploymentPolicy._full_validator = bv.Void()
|
||||
PaperDeploymentPolicy._partial_validator = bv.Void()
|
||||
PaperDeploymentPolicy._other_validator = bv.Void()
|
||||
@ -891,6 +1434,19 @@ PaperDeploymentPolicy.full = PaperDeploymentPolicy('full')
|
||||
PaperDeploymentPolicy.partial = PaperDeploymentPolicy('partial')
|
||||
PaperDeploymentPolicy.other = PaperDeploymentPolicy('other')
|
||||
|
||||
PaperDesktopPolicy._disabled_validator = bv.Void()
|
||||
PaperDesktopPolicy._enabled_validator = bv.Void()
|
||||
PaperDesktopPolicy._other_validator = bv.Void()
|
||||
PaperDesktopPolicy._tagmap = {
|
||||
'disabled': PaperDesktopPolicy._disabled_validator,
|
||||
'enabled': PaperDesktopPolicy._enabled_validator,
|
||||
'other': PaperDesktopPolicy._other_validator,
|
||||
}
|
||||
|
||||
PaperDesktopPolicy.disabled = PaperDesktopPolicy('disabled')
|
||||
PaperDesktopPolicy.enabled = PaperDesktopPolicy('enabled')
|
||||
PaperDesktopPolicy.other = PaperDesktopPolicy('other')
|
||||
|
||||
PaperEnabledPolicy._disabled_validator = bv.Void()
|
||||
PaperEnabledPolicy._enabled_validator = bv.Void()
|
||||
PaperEnabledPolicy._unspecified_validator = bv.Void()
|
||||
@ -978,6 +1534,58 @@ SharedLinkCreatePolicy.default_team_only = SharedLinkCreatePolicy('default_team_
|
||||
SharedLinkCreatePolicy.team_only = SharedLinkCreatePolicy('team_only')
|
||||
SharedLinkCreatePolicy.other = SharedLinkCreatePolicy('other')
|
||||
|
||||
ShowcaseDownloadPolicy._disabled_validator = bv.Void()
|
||||
ShowcaseDownloadPolicy._enabled_validator = bv.Void()
|
||||
ShowcaseDownloadPolicy._other_validator = bv.Void()
|
||||
ShowcaseDownloadPolicy._tagmap = {
|
||||
'disabled': ShowcaseDownloadPolicy._disabled_validator,
|
||||
'enabled': ShowcaseDownloadPolicy._enabled_validator,
|
||||
'other': ShowcaseDownloadPolicy._other_validator,
|
||||
}
|
||||
|
||||
ShowcaseDownloadPolicy.disabled = ShowcaseDownloadPolicy('disabled')
|
||||
ShowcaseDownloadPolicy.enabled = ShowcaseDownloadPolicy('enabled')
|
||||
ShowcaseDownloadPolicy.other = ShowcaseDownloadPolicy('other')
|
||||
|
||||
ShowcaseEnabledPolicy._disabled_validator = bv.Void()
|
||||
ShowcaseEnabledPolicy._enabled_validator = bv.Void()
|
||||
ShowcaseEnabledPolicy._other_validator = bv.Void()
|
||||
ShowcaseEnabledPolicy._tagmap = {
|
||||
'disabled': ShowcaseEnabledPolicy._disabled_validator,
|
||||
'enabled': ShowcaseEnabledPolicy._enabled_validator,
|
||||
'other': ShowcaseEnabledPolicy._other_validator,
|
||||
}
|
||||
|
||||
ShowcaseEnabledPolicy.disabled = ShowcaseEnabledPolicy('disabled')
|
||||
ShowcaseEnabledPolicy.enabled = ShowcaseEnabledPolicy('enabled')
|
||||
ShowcaseEnabledPolicy.other = ShowcaseEnabledPolicy('other')
|
||||
|
||||
ShowcaseExternalSharingPolicy._disabled_validator = bv.Void()
|
||||
ShowcaseExternalSharingPolicy._enabled_validator = bv.Void()
|
||||
ShowcaseExternalSharingPolicy._other_validator = bv.Void()
|
||||
ShowcaseExternalSharingPolicy._tagmap = {
|
||||
'disabled': ShowcaseExternalSharingPolicy._disabled_validator,
|
||||
'enabled': ShowcaseExternalSharingPolicy._enabled_validator,
|
||||
'other': ShowcaseExternalSharingPolicy._other_validator,
|
||||
}
|
||||
|
||||
ShowcaseExternalSharingPolicy.disabled = ShowcaseExternalSharingPolicy('disabled')
|
||||
ShowcaseExternalSharingPolicy.enabled = ShowcaseExternalSharingPolicy('enabled')
|
||||
ShowcaseExternalSharingPolicy.other = ShowcaseExternalSharingPolicy('other')
|
||||
|
||||
SmartSyncPolicy._local_validator = bv.Void()
|
||||
SmartSyncPolicy._on_demand_validator = bv.Void()
|
||||
SmartSyncPolicy._other_validator = bv.Void()
|
||||
SmartSyncPolicy._tagmap = {
|
||||
'local': SmartSyncPolicy._local_validator,
|
||||
'on_demand': SmartSyncPolicy._on_demand_validator,
|
||||
'other': SmartSyncPolicy._other_validator,
|
||||
}
|
||||
|
||||
SmartSyncPolicy.local = SmartSyncPolicy('local')
|
||||
SmartSyncPolicy.on_demand = SmartSyncPolicy('on_demand')
|
||||
SmartSyncPolicy.other = SmartSyncPolicy('other')
|
||||
|
||||
SsoPolicy._disabled_validator = bv.Void()
|
||||
SsoPolicy._optional_validator = bv.Void()
|
||||
SsoPolicy._required_validator = bv.Void()
|
||||
@ -1035,6 +1643,19 @@ TwoStepVerificationPolicy.require_tfa_enable = TwoStepVerificationPolicy('requir
|
||||
TwoStepVerificationPolicy.require_tfa_disable = TwoStepVerificationPolicy('require_tfa_disable')
|
||||
TwoStepVerificationPolicy.other = TwoStepVerificationPolicy('other')
|
||||
|
||||
TwoStepVerificationState._required_validator = bv.Void()
|
||||
TwoStepVerificationState._optional_validator = bv.Void()
|
||||
TwoStepVerificationState._other_validator = bv.Void()
|
||||
TwoStepVerificationState._tagmap = {
|
||||
'required': TwoStepVerificationState._required_validator,
|
||||
'optional': TwoStepVerificationState._optional_validator,
|
||||
'other': TwoStepVerificationState._other_validator,
|
||||
}
|
||||
|
||||
TwoStepVerificationState.required = TwoStepVerificationState('required')
|
||||
TwoStepVerificationState.optional = TwoStepVerificationState('optional')
|
||||
TwoStepVerificationState.other = TwoStepVerificationState('other')
|
||||
|
||||
ROUTES = {
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Auto-generated by Stone, do not modify.
|
||||
# @generated
|
||||
# flake8: noqa
|
||||
# pylint: skip-file
|
||||
"""
|
||||
@ -9,7 +10,7 @@ This namespace contains endpoints and data types for user management.
|
||||
try:
|
||||
from . import stone_validators as bv
|
||||
from . import stone_base as bb
|
||||
except (SystemError, ValueError):
|
||||
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
|
||||
@ -17,27 +18,32 @@ except (SystemError, ValueError):
|
||||
|
||||
try:
|
||||
from . import (
|
||||
common,
|
||||
team_common,
|
||||
team_policies,
|
||||
users_common,
|
||||
)
|
||||
except (SystemError, ValueError):
|
||||
except (ImportError, SystemError, ValueError):
|
||||
import common
|
||||
import team_common
|
||||
import team_policies
|
||||
import users_common
|
||||
|
||||
class Account(object):
|
||||
class Account(bb.Struct):
|
||||
"""
|
||||
The amount of detail revealed about an account depends on the user being
|
||||
queried and the user making the query.
|
||||
|
||||
: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.
|
||||
:ivar disabled: Whether the user has been disabled.
|
||||
:ivar users.Account.account_id: The user's unique Dropbox ID.
|
||||
:ivar users.Account.name: Details of a user's name.
|
||||
:ivar users.Account.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 users.Account.email_verified: Whether the user has verified their
|
||||
e-mail address.
|
||||
:ivar users.Account.profile_photo_url: URL for the photo representing the
|
||||
user, if one is set.
|
||||
:ivar users.Account.disabled: Whether the user has been disabled.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -232,6 +238,9 @@ class Account(object):
|
||||
self._disabled_value = None
|
||||
self._disabled_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(Account, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'Account(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, disabled={!r}, profile_photo_url={!r})'.format(
|
||||
self._account_id_value,
|
||||
@ -248,11 +257,12 @@ class BasicAccount(Account):
|
||||
"""
|
||||
Basic information about any 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``.
|
||||
:ivar users.BasicAccount.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 users.BasicAccount.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__ = [
|
||||
@ -339,6 +349,9 @@ class BasicAccount(Account):
|
||||
self._team_member_id_value = None
|
||||
self._team_member_id_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(BasicAccount, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'BasicAccount(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, disabled={!r}, is_teammate={!r}, profile_photo_url={!r}, team_member_id={!r})'.format(
|
||||
self._account_id_value,
|
||||
@ -357,21 +370,23 @@ class FullAccount(Account):
|
||||
"""
|
||||
Detailed information about the current user's account.
|
||||
|
||||
:ivar country: The user's two-letter country code, if available. Country
|
||||
codes are based on `ISO 3166-1
|
||||
:ivar users.FullAccount.country: The user's two-letter country code, if
|
||||
available. Country codes are based on `ISO 3166-1
|
||||
<http://en.wikipedia.org/wiki/ISO_3166-1>`_.
|
||||
:ivar locale: The language that the user specified. Locale tags will be
|
||||
`IETF language tags <http://en.wikipedia.org/wiki/IETF_language_tag>`_.
|
||||
:ivar referral_link: The user's `referral link
|
||||
:ivar users.FullAccount.locale: The language that the user specified. Locale
|
||||
tags will be `IETF language tags
|
||||
<http://en.wikipedia.org/wiki/IETF_language_tag>`_.
|
||||
:ivar users.FullAccount.referral_link: The user's `referral link
|
||||
<https://www.dropbox.com/referrals>`_.
|
||||
: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.
|
||||
:ivar account_type: What type of account this user has.
|
||||
:ivar users.FullAccount.team: If this account is a member of a team,
|
||||
information about that team.
|
||||
:ivar users.FullAccount.team_member_id: This account's unique team member
|
||||
id. This field will only be present if ``team`` is present.
|
||||
:ivar users.FullAccount.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.
|
||||
:ivar users.FullAccount.account_type: What type of account this user has.
|
||||
:ivar users.FullAccount.root_info: The root info for this account.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -389,6 +404,8 @@ class FullAccount(Account):
|
||||
'_is_paired_present',
|
||||
'_account_type_value',
|
||||
'_account_type_present',
|
||||
'_root_info_value',
|
||||
'_root_info_present',
|
||||
]
|
||||
|
||||
_has_required_fields = True
|
||||
@ -403,6 +420,7 @@ class FullAccount(Account):
|
||||
referral_link=None,
|
||||
is_paired=None,
|
||||
account_type=None,
|
||||
root_info=None,
|
||||
profile_photo_url=None,
|
||||
country=None,
|
||||
team=None,
|
||||
@ -427,6 +445,8 @@ class FullAccount(Account):
|
||||
self._is_paired_present = False
|
||||
self._account_type_value = None
|
||||
self._account_type_present = False
|
||||
self._root_info_value = None
|
||||
self._root_info_present = False
|
||||
if country is not None:
|
||||
self.country = country
|
||||
if locale is not None:
|
||||
@ -441,6 +461,8 @@ class FullAccount(Account):
|
||||
self.is_paired = is_paired
|
||||
if account_type is not None:
|
||||
self.account_type = account_type
|
||||
if root_info is not None:
|
||||
self.root_info = root_info
|
||||
|
||||
@property
|
||||
def country(self):
|
||||
@ -599,7 +621,7 @@ class FullAccount(Account):
|
||||
"""
|
||||
What type of account this user has.
|
||||
|
||||
:rtype: users_common.AccountType_validator
|
||||
:rtype: users_common.AccountType
|
||||
"""
|
||||
if self._account_type_present:
|
||||
return self._account_type_value
|
||||
@ -617,8 +639,34 @@ class FullAccount(Account):
|
||||
self._account_type_value = None
|
||||
self._account_type_present = False
|
||||
|
||||
@property
|
||||
def root_info(self):
|
||||
"""
|
||||
The root info for this account.
|
||||
|
||||
:rtype: common.RootInfo
|
||||
"""
|
||||
if self._root_info_present:
|
||||
return self._root_info_value
|
||||
else:
|
||||
raise AttributeError("missing required field 'root_info'")
|
||||
|
||||
@root_info.setter
|
||||
def root_info(self, val):
|
||||
self._root_info_validator.validate_type_only(val)
|
||||
self._root_info_value = val
|
||||
self._root_info_present = True
|
||||
|
||||
@root_info.deleter
|
||||
def root_info(self):
|
||||
self._root_info_value = None
|
||||
self._root_info_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(FullAccount, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'FullAccount(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, disabled={!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(
|
||||
return 'FullAccount(account_id={!r}, name={!r}, email={!r}, email_verified={!r}, disabled={!r}, locale={!r}, referral_link={!r}, is_paired={!r}, account_type={!r}, root_info={!r}, profile_photo_url={!r}, country={!r}, team={!r}, team_member_id={!r})'.format(
|
||||
self._account_id_value,
|
||||
self._name_value,
|
||||
self._email_value,
|
||||
@ -628,6 +676,7 @@ class FullAccount(Account):
|
||||
self._referral_link_value,
|
||||
self._is_paired_value,
|
||||
self._account_type_value,
|
||||
self._root_info_value,
|
||||
self._profile_photo_url_value,
|
||||
self._country_value,
|
||||
self._team_value,
|
||||
@ -636,12 +685,12 @@ class FullAccount(Account):
|
||||
|
||||
FullAccount_validator = bv.Struct(FullAccount)
|
||||
|
||||
class Team(object):
|
||||
class Team(bb.Struct):
|
||||
"""
|
||||
Information about a team.
|
||||
|
||||
:ivar id: The team's unique ID.
|
||||
:ivar name: The name of the team.
|
||||
:ivar users.Team.id: The team's unique ID.
|
||||
:ivar users.Team.name: The name of the team.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -711,6 +760,9 @@ class Team(object):
|
||||
self._name_value = None
|
||||
self._name_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(Team, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'Team(id={!r}, name={!r})'.format(
|
||||
self._id_value,
|
||||
@ -723,9 +775,9 @@ class FullTeam(Team):
|
||||
"""
|
||||
Detailed information about a team.
|
||||
|
||||
:ivar sharing_policies: Team policies governing sharing.
|
||||
:ivar office_addin_policy: Team policy governing the use of the Office
|
||||
Add-In.
|
||||
:ivar users.FullTeam.sharing_policies: Team policies governing sharing.
|
||||
:ivar users.FullTeam.office_addin_policy: Team policy governing the use of
|
||||
the Office Add-In.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -758,7 +810,7 @@ class FullTeam(Team):
|
||||
"""
|
||||
Team policies governing sharing.
|
||||
|
||||
:rtype: team_policies.TeamSharingPolicies_validator
|
||||
:rtype: team_policies.TeamSharingPolicies
|
||||
"""
|
||||
if self._sharing_policies_present:
|
||||
return self._sharing_policies_value
|
||||
@ -781,7 +833,7 @@ class FullTeam(Team):
|
||||
"""
|
||||
Team policy governing the use of the Office Add-In.
|
||||
|
||||
:rtype: team_policies.OfficeAddInPolicy_validator
|
||||
:rtype: team_policies.OfficeAddInPolicy
|
||||
"""
|
||||
if self._office_addin_policy_present:
|
||||
return self._office_addin_policy_value
|
||||
@ -799,6 +851,9 @@ class FullTeam(Team):
|
||||
self._office_addin_policy_value = None
|
||||
self._office_addin_policy_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(FullTeam, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'FullTeam(id={!r}, name={!r}, sharing_policies={!r}, office_addin_policy={!r})'.format(
|
||||
self._id_value,
|
||||
@ -809,9 +864,9 @@ class FullTeam(Team):
|
||||
|
||||
FullTeam_validator = bv.Struct(FullTeam)
|
||||
|
||||
class GetAccountArg(object):
|
||||
class GetAccountArg(bb.Struct):
|
||||
"""
|
||||
:ivar account_id: A user's account identifier.
|
||||
:ivar users.GetAccountArg.account_id: A user's account identifier.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -851,6 +906,9 @@ class GetAccountArg(object):
|
||||
self._account_id_value = None
|
||||
self._account_id_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(GetAccountArg, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'GetAccountArg(account_id={!r})'.format(
|
||||
self._account_id_value,
|
||||
@ -858,10 +916,10 @@ class GetAccountArg(object):
|
||||
|
||||
GetAccountArg_validator = bv.Struct(GetAccountArg)
|
||||
|
||||
class GetAccountBatchArg(object):
|
||||
class GetAccountBatchArg(bb.Struct):
|
||||
"""
|
||||
:ivar account_ids: List of user account identifiers. Should not contain any
|
||||
duplicate account IDs.
|
||||
:ivar users.GetAccountBatchArg.account_ids: List of user account
|
||||
identifiers. Should not contain any duplicate account IDs.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -902,6 +960,9 @@ class GetAccountBatchArg(object):
|
||||
self._account_ids_value = None
|
||||
self._account_ids_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(GetAccountBatchArg, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'GetAccountBatchArg(account_ids={!r})'.format(
|
||||
self._account_ids_value,
|
||||
@ -915,8 +976,9 @@ class GetAccountBatchError(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar str no_account: The value is an account ID specified in
|
||||
:field:`GetAccountBatchArg.account_ids` that does not exist.
|
||||
:ivar str users.GetAccountBatchError.no_account: The value is an account ID
|
||||
specified in :field:`GetAccountBatchArg.account_ids` that does not
|
||||
exist.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -963,6 +1025,9 @@ class GetAccountBatchError(bb.Union):
|
||||
raise AttributeError("tag 'no_account' not set")
|
||||
return self._value
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(GetAccountBatchError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'GetAccountBatchError(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
@ -974,7 +1039,8 @@ class GetAccountError(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar no_account: The specified ``GetAccountArg.account_id`` does not exist.
|
||||
:ivar users.GetAccountError.no_account: The specified
|
||||
``GetAccountArg.account_id`` does not exist.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -999,14 +1065,18 @@ class GetAccountError(bb.Union):
|
||||
"""
|
||||
return self._tag == 'other'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(GetAccountError, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'GetAccountError(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
GetAccountError_validator = bv.Union(GetAccountError)
|
||||
|
||||
class IndividualSpaceAllocation(object):
|
||||
class IndividualSpaceAllocation(bb.Struct):
|
||||
"""
|
||||
:ivar allocated: The total space allocated to the user's account (bytes).
|
||||
:ivar users.IndividualSpaceAllocation.allocated: The total space allocated
|
||||
to the user's account (bytes).
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -1028,7 +1098,7 @@ class IndividualSpaceAllocation(object):
|
||||
"""
|
||||
The total space allocated to the user's account (bytes).
|
||||
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
if self._allocated_present:
|
||||
return self._allocated_value
|
||||
@ -1046,6 +1116,9 @@ class IndividualSpaceAllocation(object):
|
||||
self._allocated_value = None
|
||||
self._allocated_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(IndividualSpaceAllocation, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'IndividualSpaceAllocation(allocated={!r})'.format(
|
||||
self._allocated_value,
|
||||
@ -1053,19 +1126,19 @@ class IndividualSpaceAllocation(object):
|
||||
|
||||
IndividualSpaceAllocation_validator = bv.Struct(IndividualSpaceAllocation)
|
||||
|
||||
class Name(object):
|
||||
class Name(bb.Struct):
|
||||
"""
|
||||
Representations for a person's name to assist with internationalization.
|
||||
|
||||
:ivar given_name: Also known as a first name.
|
||||
:ivar surname: Also known as a last name or family name.
|
||||
:ivar familiar_name: Locale-dependent name. In the US, a person's familiar
|
||||
name is their ``given_name``, but elsewhere, it could be any combination
|
||||
of a person's ``given_name`` and ``surname``.
|
||||
:ivar display_name: A name that can be used directly to represent the name
|
||||
of a user's Dropbox account.
|
||||
:ivar abbreviated_name: An abbreviated form of the person's name. Their
|
||||
initials in most locales.
|
||||
:ivar users.Name.given_name: Also known as a first name.
|
||||
:ivar users.Name.surname: Also known as a last name or family name.
|
||||
:ivar users.Name.familiar_name: Locale-dependent name. In the US, a person's
|
||||
familiar name is their ``given_name``, but elsewhere, it could be any
|
||||
combination of a person's ``given_name`` and ``surname``.
|
||||
:ivar users.Name.display_name: A name that can be used directly to represent
|
||||
the name of a user's Dropbox account.
|
||||
:ivar users.Name.abbreviated_name: An abbreviated form of the person's name.
|
||||
Their initials in most locales.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -1229,6 +1302,9 @@ class Name(object):
|
||||
self._abbreviated_name_value = None
|
||||
self._abbreviated_name_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(Name, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'Name(given_name={!r}, surname={!r}, familiar_name={!r}, display_name={!r}, abbreviated_name={!r})'.format(
|
||||
self._given_name_value,
|
||||
@ -1248,10 +1324,10 @@ class SpaceAllocation(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar IndividualSpaceAllocation individual: The user's space allocation
|
||||
applies only to their individual account.
|
||||
:ivar TeamSpaceAllocation team: The user shares space with other members of
|
||||
their team.
|
||||
:ivar IndividualSpaceAllocation SpaceAllocation.individual: The user's space
|
||||
allocation applies only to their individual account.
|
||||
:ivar TeamSpaceAllocation SpaceAllocation.team: The user shares space with
|
||||
other members of their team.
|
||||
"""
|
||||
|
||||
_catch_all = 'other'
|
||||
@ -1328,17 +1404,20 @@ class SpaceAllocation(bb.Union):
|
||||
raise AttributeError("tag 'team' not set")
|
||||
return self._value
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(SpaceAllocation, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'SpaceAllocation(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
SpaceAllocation_validator = bv.Union(SpaceAllocation)
|
||||
|
||||
class SpaceUsage(object):
|
||||
class SpaceUsage(bb.Struct):
|
||||
"""
|
||||
Information about a user's space usage and quota.
|
||||
|
||||
:ivar used: The user's total space usage (bytes).
|
||||
:ivar allocation: The user's space allocation.
|
||||
:ivar users.SpaceUsage.used: The user's total space usage (bytes).
|
||||
:ivar users.SpaceUsage.allocation: The user's space allocation.
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -1367,7 +1446,7 @@ class SpaceUsage(object):
|
||||
"""
|
||||
The user's total space usage (bytes).
|
||||
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
if self._used_present:
|
||||
return self._used_value
|
||||
@ -1408,6 +1487,9 @@ class SpaceUsage(object):
|
||||
self._allocation_value = None
|
||||
self._allocation_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(SpaceUsage, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'SpaceUsage(used={!r}, allocation={!r})'.format(
|
||||
self._used_value,
|
||||
@ -1416,10 +1498,18 @@ class SpaceUsage(object):
|
||||
|
||||
SpaceUsage_validator = bv.Struct(SpaceUsage)
|
||||
|
||||
class TeamSpaceAllocation(object):
|
||||
class TeamSpaceAllocation(bb.Struct):
|
||||
"""
|
||||
:ivar used: The total space currently used by the user's team (bytes).
|
||||
:ivar allocated: The total space allocated to the user's team (bytes).
|
||||
:ivar users.TeamSpaceAllocation.used: The total space currently used by the
|
||||
user's team (bytes).
|
||||
:ivar users.TeamSpaceAllocation.allocated: The total space allocated to the
|
||||
user's team (bytes).
|
||||
:ivar users.TeamSpaceAllocation.user_within_team_space_allocated: The total
|
||||
space allocated to the user within its team allocated space (0 means
|
||||
that no restriction is imposed on the user's quota within its team).
|
||||
:ivar users.TeamSpaceAllocation.user_within_team_space_limit_type: The type
|
||||
of the space limit imposed on the team member (off, alert_only,
|
||||
stop_sync).
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
@ -1427,28 +1517,42 @@ class TeamSpaceAllocation(object):
|
||||
'_used_present',
|
||||
'_allocated_value',
|
||||
'_allocated_present',
|
||||
'_user_within_team_space_allocated_value',
|
||||
'_user_within_team_space_allocated_present',
|
||||
'_user_within_team_space_limit_type_value',
|
||||
'_user_within_team_space_limit_type_present',
|
||||
]
|
||||
|
||||
_has_required_fields = True
|
||||
|
||||
def __init__(self,
|
||||
used=None,
|
||||
allocated=None):
|
||||
allocated=None,
|
||||
user_within_team_space_allocated=None,
|
||||
user_within_team_space_limit_type=None):
|
||||
self._used_value = None
|
||||
self._used_present = False
|
||||
self._allocated_value = None
|
||||
self._allocated_present = False
|
||||
self._user_within_team_space_allocated_value = None
|
||||
self._user_within_team_space_allocated_present = False
|
||||
self._user_within_team_space_limit_type_value = None
|
||||
self._user_within_team_space_limit_type_present = False
|
||||
if used is not None:
|
||||
self.used = used
|
||||
if allocated is not None:
|
||||
self.allocated = allocated
|
||||
if user_within_team_space_allocated is not None:
|
||||
self.user_within_team_space_allocated = user_within_team_space_allocated
|
||||
if user_within_team_space_limit_type is not None:
|
||||
self.user_within_team_space_limit_type = user_within_team_space_limit_type
|
||||
|
||||
@property
|
||||
def used(self):
|
||||
"""
|
||||
The total space currently used by the user's team (bytes).
|
||||
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
if self._used_present:
|
||||
return self._used_value
|
||||
@ -1471,7 +1575,7 @@ class TeamSpaceAllocation(object):
|
||||
"""
|
||||
The total space allocated to the user's team (bytes).
|
||||
|
||||
:rtype: long
|
||||
:rtype: int
|
||||
"""
|
||||
if self._allocated_present:
|
||||
return self._allocated_value
|
||||
@ -1489,10 +1593,64 @@ class TeamSpaceAllocation(object):
|
||||
self._allocated_value = None
|
||||
self._allocated_present = False
|
||||
|
||||
@property
|
||||
def user_within_team_space_allocated(self):
|
||||
"""
|
||||
The total space allocated to the user within its team allocated space (0
|
||||
means that no restriction is imposed on the user's quota within its
|
||||
team).
|
||||
|
||||
:rtype: int
|
||||
"""
|
||||
if self._user_within_team_space_allocated_present:
|
||||
return self._user_within_team_space_allocated_value
|
||||
else:
|
||||
raise AttributeError("missing required field 'user_within_team_space_allocated'")
|
||||
|
||||
@user_within_team_space_allocated.setter
|
||||
def user_within_team_space_allocated(self, val):
|
||||
val = self._user_within_team_space_allocated_validator.validate(val)
|
||||
self._user_within_team_space_allocated_value = val
|
||||
self._user_within_team_space_allocated_present = True
|
||||
|
||||
@user_within_team_space_allocated.deleter
|
||||
def user_within_team_space_allocated(self):
|
||||
self._user_within_team_space_allocated_value = None
|
||||
self._user_within_team_space_allocated_present = False
|
||||
|
||||
@property
|
||||
def user_within_team_space_limit_type(self):
|
||||
"""
|
||||
The type of the space limit imposed on the team member (off, alert_only,
|
||||
stop_sync).
|
||||
|
||||
:rtype: team_common.MemberSpaceLimitType
|
||||
"""
|
||||
if self._user_within_team_space_limit_type_present:
|
||||
return self._user_within_team_space_limit_type_value
|
||||
else:
|
||||
raise AttributeError("missing required field 'user_within_team_space_limit_type'")
|
||||
|
||||
@user_within_team_space_limit_type.setter
|
||||
def user_within_team_space_limit_type(self, val):
|
||||
self._user_within_team_space_limit_type_validator.validate_type_only(val)
|
||||
self._user_within_team_space_limit_type_value = val
|
||||
self._user_within_team_space_limit_type_present = True
|
||||
|
||||
@user_within_team_space_limit_type.deleter
|
||||
def user_within_team_space_limit_type(self):
|
||||
self._user_within_team_space_limit_type_value = None
|
||||
self._user_within_team_space_limit_type_present = False
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(TeamSpaceAllocation, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'TeamSpaceAllocation(used={!r}, allocated={!r})'.format(
|
||||
return 'TeamSpaceAllocation(used={!r}, allocated={!r}, user_within_team_space_allocated={!r}, user_within_team_space_limit_type={!r})'.format(
|
||||
self._used_value,
|
||||
self._allocated_value,
|
||||
self._user_within_team_space_allocated_value,
|
||||
self._user_within_team_space_limit_type_value,
|
||||
)
|
||||
|
||||
TeamSpaceAllocation_validator = bv.Struct(TeamSpaceAllocation)
|
||||
@ -1539,6 +1697,7 @@ FullAccount._team_validator = bv.Nullable(FullTeam_validator)
|
||||
FullAccount._team_member_id_validator = bv.Nullable(bv.String())
|
||||
FullAccount._is_paired_validator = bv.Boolean()
|
||||
FullAccount._account_type_validator = users_common.AccountType_validator
|
||||
FullAccount._root_info_validator = common.RootInfo_validator
|
||||
FullAccount._all_field_names_ = Account._all_field_names_.union(set([
|
||||
'country',
|
||||
'locale',
|
||||
@ -1547,6 +1706,7 @@ FullAccount._all_field_names_ = Account._all_field_names_.union(set([
|
||||
'team_member_id',
|
||||
'is_paired',
|
||||
'account_type',
|
||||
'root_info',
|
||||
]))
|
||||
FullAccount._all_fields_ = Account._all_fields_ + [
|
||||
('country', FullAccount._country_validator),
|
||||
@ -1556,6 +1716,7 @@ FullAccount._all_fields_ = Account._all_fields_ + [
|
||||
('team_member_id', FullAccount._team_member_id_validator),
|
||||
('is_paired', FullAccount._is_paired_validator),
|
||||
('account_type', FullAccount._account_type_validator),
|
||||
('root_info', FullAccount._root_info_validator),
|
||||
]
|
||||
|
||||
Team._id_validator = bv.String()
|
||||
@ -1655,17 +1816,24 @@ SpaceUsage._all_fields_ = [
|
||||
|
||||
TeamSpaceAllocation._used_validator = bv.UInt64()
|
||||
TeamSpaceAllocation._allocated_validator = bv.UInt64()
|
||||
TeamSpaceAllocation._user_within_team_space_allocated_validator = bv.UInt64()
|
||||
TeamSpaceAllocation._user_within_team_space_limit_type_validator = team_common.MemberSpaceLimitType_validator
|
||||
TeamSpaceAllocation._all_field_names_ = set([
|
||||
'used',
|
||||
'allocated',
|
||||
'user_within_team_space_allocated',
|
||||
'user_within_team_space_limit_type',
|
||||
])
|
||||
TeamSpaceAllocation._all_fields_ = [
|
||||
('used', TeamSpaceAllocation._used_validator),
|
||||
('allocated', TeamSpaceAllocation._allocated_validator),
|
||||
('user_within_team_space_allocated', TeamSpaceAllocation._user_within_team_space_allocated_validator),
|
||||
('user_within_team_space_limit_type', TeamSpaceAllocation._user_within_team_space_limit_type_validator),
|
||||
]
|
||||
|
||||
get_account = bb.Route(
|
||||
'get_account',
|
||||
1,
|
||||
False,
|
||||
GetAccountArg_validator,
|
||||
BasicAccount_validator,
|
||||
@ -1675,6 +1843,7 @@ get_account = bb.Route(
|
||||
)
|
||||
get_account_batch = bb.Route(
|
||||
'get_account_batch',
|
||||
1,
|
||||
False,
|
||||
GetAccountBatchArg_validator,
|
||||
GetAccountBatchResult_validator,
|
||||
@ -1684,6 +1853,7 @@ get_account_batch = bb.Route(
|
||||
)
|
||||
get_current_account = bb.Route(
|
||||
'get_current_account',
|
||||
1,
|
||||
False,
|
||||
bv.Void(),
|
||||
FullAccount_validator,
|
||||
@ -1693,6 +1863,7 @@ get_current_account = bb.Route(
|
||||
)
|
||||
get_space_usage = bb.Route(
|
||||
'get_space_usage',
|
||||
1,
|
||||
False,
|
||||
bv.Void(),
|
||||
SpaceUsage_validator,
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Auto-generated by Stone, do not modify.
|
||||
# @generated
|
||||
# flake8: noqa
|
||||
# pylint: skip-file
|
||||
"""
|
||||
@ -9,7 +10,7 @@ This namespace contains common data types used within the users namespace.
|
||||
try:
|
||||
from . import stone_validators as bv
|
||||
from . import stone_base as bb
|
||||
except (SystemError, ValueError):
|
||||
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
|
||||
@ -23,9 +24,9 @@ class AccountType(bb.Union):
|
||||
return true. To get the associated value of a tag (if one exists), use the
|
||||
corresponding ``get_*`` method.
|
||||
|
||||
:ivar basic: The basic account type.
|
||||
:ivar pro: The Dropbox Pro account type.
|
||||
:ivar business: The Dropbox Business account type.
|
||||
:ivar users_common.AccountType.basic: The basic account type.
|
||||
:ivar users_common.AccountType.pro: The Dropbox Pro account type.
|
||||
:ivar users_common.AccountType.business: The Dropbox Business account type.
|
||||
"""
|
||||
|
||||
_catch_all = None
|
||||
@ -60,6 +61,9 @@ class AccountType(bb.Union):
|
||||
"""
|
||||
return self._tag == 'business'
|
||||
|
||||
def _process_custom_annotations(self, annotation_type, field_path, processor):
|
||||
super(AccountType, self)._process_custom_annotations(annotation_type, field_path, processor)
|
||||
|
||||
def __repr__(self):
|
||||
return 'AccountType(%r, %r)' % (self._tag, self._value)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user