Skip to content

Commit 86d1c55

Browse files
committed
Updated spec
1 parent c21462c commit 86d1c55

File tree

9 files changed

+1006
-32
lines changed

9 files changed

+1006
-32
lines changed

docs/moduledoc.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ SDK Documentation
2626
:special-members: __init__
2727
:undoc-members:
2828

29+
:mod:`dropbox.contacts` -- Contacts
30+
============================================
31+
.. automodule:: dropbox.contacts
32+
:members:
33+
:show-inheritance:
34+
:special-members: __init__
35+
:undoc-members:
36+
2937
:mod:`dropbox.dropbox` -- Dropbox
3038
============================================
3139
.. automodule:: dropbox.dropbox

dropbox/base.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
async_,
1111
auth,
1212
common,
13+
contacts,
1314
file_properties,
1415
file_requests,
1516
files,
@@ -76,6 +77,48 @@ def auth_token_revoke(self):
7677
)
7778
return None
7879

80+
# ------------------------------------------
81+
# Routes in contacts namespace
82+
83+
def contacts_delete_manual_contacts(self):
84+
"""
85+
Removes all manually added contacts. You'll still keep contacts who are
86+
on your team or who you imported. New contacts will be added when you
87+
share.
88+
89+
:rtype: None
90+
"""
91+
arg = None
92+
r = self.request(
93+
contacts.delete_manual_contacts,
94+
'contacts',
95+
arg,
96+
None,
97+
)
98+
return None
99+
100+
def contacts_delete_manual_contacts_batch(self,
101+
email_addresses):
102+
"""
103+
Removes manually added contacts from the given list.
104+
105+
:param list email_addresses: List of manually added contacts to be
106+
deleted.
107+
:rtype: None
108+
:raises: :class:`.exceptions.ApiError`
109+
110+
If this raises, ApiError will contain:
111+
:class:`dropbox.contacts.DeleteManualContactsError`
112+
"""
113+
arg = contacts.DeleteManualContactsArg(email_addresses)
114+
r = self.request(
115+
contacts.delete_manual_contacts_batch,
116+
'contacts',
117+
arg,
118+
None,
119+
)
120+
return None
121+
79122
# ------------------------------------------
80123
# Routes in file_properties namespace
81124

dropbox/base_team.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
async_,
1111
auth,
1212
common,
13+
contacts,
1314
file_properties,
1415
file_requests,
1516
files,
@@ -35,6 +36,9 @@ def request(self, route, namespace, arg, arg_binary=None):
3536
# ------------------------------------------
3637
# Routes in auth namespace
3738

39+
# ------------------------------------------
40+
# Routes in contacts namespace
41+
3842
# ------------------------------------------
3943
# Routes in file_properties namespace
4044

@@ -1424,6 +1428,10 @@ def team_namespaces_list(self,
14241428
14251429
:param long limit: Specifying a value here has no effect.
14261430
:rtype: :class:`dropbox.team.TeamNamespacesListResult`
1431+
:raises: :class:`.exceptions.ApiError`
1432+
1433+
If this raises, ApiError will contain:
1434+
:class:`dropbox.team.TeamNamespacesListError`
14271435
"""
14281436
arg = team.TeamNamespacesListArg(limit)
14291437
r = self.request(

dropbox/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def __repr__(self):
380380

381381
Date_validator = bv.Timestamp(u'%Y-%m-%d')
382382
DisplayName_validator = bv.String(min_length=1, pattern=u'[^/:?*<>"|]*')
383-
DisplayNameLegacy_validator = bv.String(min_length=1)
383+
DisplayNameLegacy_validator = bv.String()
384384
DropboxTimestamp_validator = bv.Timestamp(u'%Y-%m-%dT%H:%M:%SZ')
385385
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}$")
386386
# A ISO639-1 code.

dropbox/contacts.py

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# -*- coding: utf-8 -*-
2+
# Auto-generated by Stone, do not modify.
3+
# @generated
4+
# flake8: noqa
5+
# pylint: skip-file
6+
try:
7+
from . import stone_validators as bv
8+
from . import stone_base as bb
9+
except (ImportError, SystemError, ValueError):
10+
# Catch errors raised when importing a relative module when not in a package.
11+
# This makes testing this file directly (outside of a package) easier.
12+
import stone_validators as bv
13+
import stone_base as bb
14+
15+
try:
16+
from . import (
17+
common,
18+
)
19+
except (ImportError, SystemError, ValueError):
20+
import common
21+
22+
class DeleteManualContactsArg(bb.Struct):
23+
"""
24+
:ivar email_addresses: List of manually added contacts to be deleted.
25+
"""
26+
27+
__slots__ = [
28+
'_email_addresses_value',
29+
'_email_addresses_present',
30+
]
31+
32+
_has_required_fields = True
33+
34+
def __init__(self,
35+
email_addresses=None):
36+
self._email_addresses_value = None
37+
self._email_addresses_present = False
38+
if email_addresses is not None:
39+
self.email_addresses = email_addresses
40+
41+
@property
42+
def email_addresses(self):
43+
"""
44+
List of manually added contacts to be deleted.
45+
46+
:rtype: list of [str]
47+
"""
48+
if self._email_addresses_present:
49+
return self._email_addresses_value
50+
else:
51+
raise AttributeError("missing required field 'email_addresses'")
52+
53+
@email_addresses.setter
54+
def email_addresses(self, val):
55+
val = self._email_addresses_validator.validate(val)
56+
self._email_addresses_value = val
57+
self._email_addresses_present = True
58+
59+
@email_addresses.deleter
60+
def email_addresses(self):
61+
self._email_addresses_value = None
62+
self._email_addresses_present = False
63+
64+
def _process_custom_annotations(self, annotation_type, processor):
65+
super(DeleteManualContactsArg, self)._process_custom_annotations(annotation_type, processor)
66+
67+
def __repr__(self):
68+
return 'DeleteManualContactsArg(email_addresses={!r})'.format(
69+
self._email_addresses_value,
70+
)
71+
72+
DeleteManualContactsArg_validator = bv.Struct(DeleteManualContactsArg)
73+
74+
class DeleteManualContactsError(bb.Union):
75+
"""
76+
This class acts as a tagged union. Only one of the ``is_*`` methods will
77+
return true. To get the associated value of a tag (if one exists), use the
78+
corresponding ``get_*`` method.
79+
80+
:ivar list of [str] contacts_not_found: Can't delete contacts from this
81+
list. Make sure the list only has manually added contacts. The deletion
82+
was cancelled.
83+
"""
84+
85+
_catch_all = 'other'
86+
# Attribute is overwritten below the class definition
87+
other = None
88+
89+
@classmethod
90+
def contacts_not_found(cls, val):
91+
"""
92+
Create an instance of this class set to the ``contacts_not_found`` tag
93+
with value ``val``.
94+
95+
:param list of [str] val:
96+
:rtype: DeleteManualContactsError
97+
"""
98+
return cls('contacts_not_found', val)
99+
100+
def is_contacts_not_found(self):
101+
"""
102+
Check if the union tag is ``contacts_not_found``.
103+
104+
:rtype: bool
105+
"""
106+
return self._tag == 'contacts_not_found'
107+
108+
def is_other(self):
109+
"""
110+
Check if the union tag is ``other``.
111+
112+
:rtype: bool
113+
"""
114+
return self._tag == 'other'
115+
116+
def get_contacts_not_found(self):
117+
"""
118+
Can't delete contacts from this list. Make sure the list only has
119+
manually added contacts. The deletion was cancelled.
120+
121+
Only call this if :meth:`is_contacts_not_found` is true.
122+
123+
:rtype: list of [str]
124+
"""
125+
if not self.is_contacts_not_found():
126+
raise AttributeError("tag 'contacts_not_found' not set")
127+
return self._value
128+
129+
def _process_custom_annotations(self, annotation_type, processor):
130+
super(DeleteManualContactsError, self)._process_custom_annotations(annotation_type, processor)
131+
132+
def __repr__(self):
133+
return 'DeleteManualContactsError(%r, %r)' % (self._tag, self._value)
134+
135+
DeleteManualContactsError_validator = bv.Union(DeleteManualContactsError)
136+
137+
DeleteManualContactsArg._email_addresses_validator = bv.List(common.EmailAddress_validator)
138+
DeleteManualContactsArg._all_field_names_ = set(['email_addresses'])
139+
DeleteManualContactsArg._all_fields_ = [('email_addresses', DeleteManualContactsArg._email_addresses_validator)]
140+
141+
DeleteManualContactsError._contacts_not_found_validator = bv.List(common.EmailAddress_validator)
142+
DeleteManualContactsError._other_validator = bv.Void()
143+
DeleteManualContactsError._tagmap = {
144+
'contacts_not_found': DeleteManualContactsError._contacts_not_found_validator,
145+
'other': DeleteManualContactsError._other_validator,
146+
}
147+
148+
DeleteManualContactsError.other = DeleteManualContactsError('other')
149+
150+
delete_manual_contacts = bb.Route(
151+
'delete_manual_contacts',
152+
1,
153+
False,
154+
bv.Void(),
155+
bv.Void(),
156+
bv.Void(),
157+
{'host': u'api',
158+
'style': u'rpc'},
159+
)
160+
delete_manual_contacts_batch = bb.Route(
161+
'delete_manual_contacts_batch',
162+
1,
163+
False,
164+
DeleteManualContactsArg_validator,
165+
bv.Void(),
166+
DeleteManualContactsError_validator,
167+
{'host': u'api',
168+
'style': u'rpc'},
169+
)
170+
171+
ROUTES = {
172+
'delete_manual_contacts': delete_manual_contacts,
173+
'delete_manual_contacts_batch': delete_manual_contacts_batch,
174+
}
175+

dropbox/sharing.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6271,6 +6271,10 @@ class LinkAudience(bb.Union):
62716271

62726272
:ivar public: Link is accessible by anyone.
62736273
:ivar team: Link is accessible only by team members.
6274+
:ivar no_one: The link can be used by no one. The link merely points the
6275+
user to the content, and does not grant additional rights to the user.
6276+
Members of the content who use this link can only access the content
6277+
with their pre-existing access rights.
62746278
:ivar members: Link is accessible only by members of the content.
62756279
"""
62766280

@@ -6280,6 +6284,8 @@ class LinkAudience(bb.Union):
62806284
# Attribute is overwritten below the class definition
62816285
team = None
62826286
# Attribute is overwritten below the class definition
6287+
no_one = None
6288+
# Attribute is overwritten below the class definition
62836289
members = None
62846290
# Attribute is overwritten below the class definition
62856291
other = None
@@ -6300,6 +6306,14 @@ def is_team(self):
63006306
"""
63016307
return self._tag == 'team'
63026308

6309+
def is_no_one(self):
6310+
"""
6311+
Check if the union tag is ``no_one``.
6312+
6313+
:rtype: bool
6314+
"""
6315+
return self._tag == 'no_one'
6316+
63036317
def is_members(self):
63046318
"""
63056319
Check if the union tag is ``members``.
@@ -17339,17 +17353,20 @@ def __repr__(self):
1733917353

1734017354
LinkAudience._public_validator = bv.Void()
1734117355
LinkAudience._team_validator = bv.Void()
17356+
LinkAudience._no_one_validator = bv.Void()
1734217357
LinkAudience._members_validator = bv.Void()
1734317358
LinkAudience._other_validator = bv.Void()
1734417359
LinkAudience._tagmap = {
1734517360
'public': LinkAudience._public_validator,
1734617361
'team': LinkAudience._team_validator,
17362+
'no_one': LinkAudience._no_one_validator,
1734717363
'members': LinkAudience._members_validator,
1734817364
'other': LinkAudience._other_validator,
1734917365
}
1735017366

1735117367
LinkAudience.public = LinkAudience('public')
1735217368
LinkAudience.team = LinkAudience('team')
17369+
LinkAudience.no_one = LinkAudience('no_one')
1735317370
LinkAudience.members = LinkAudience('members')
1735417371
LinkAudience.other = LinkAudience('other')
1735517372

0 commit comments

Comments
 (0)