Skip to content

Commit b2357a1

Browse files
committed
Updated spec
1 parent 99457dc commit b2357a1

21 files changed

+7500
-1487
lines changed

dropbox/async_.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ def get_async_job_id(self):
6363
raise AttributeError("tag 'async_job_id' not set")
6464
return self._value
6565

66+
def _process_custom_annotations(self, annotation_type, processor):
67+
super(LaunchResultBase, self)._process_custom_annotations(annotation_type, processor)
68+
6669
def __repr__(self):
6770
return 'LaunchResultBase(%r, %r)' % (self._tag, self._value)
6871

@@ -92,12 +95,15 @@ def is_complete(self):
9295
"""
9396
return self._tag == 'complete'
9497

98+
def _process_custom_annotations(self, annotation_type, processor):
99+
super(LaunchEmptyResult, self)._process_custom_annotations(annotation_type, processor)
100+
95101
def __repr__(self):
96102
return 'LaunchEmptyResult(%r, %r)' % (self._tag, self._value)
97103

98104
LaunchEmptyResult_validator = bv.Union(LaunchEmptyResult)
99105

100-
class PollArg(object):
106+
class PollArg(bb.Struct):
101107
"""
102108
Arguments for methods that poll the status of an asynchronous job.
103109
@@ -143,6 +149,9 @@ def async_job_id(self):
143149
self._async_job_id_value = None
144150
self._async_job_id_present = False
145151

152+
def _process_custom_annotations(self, annotation_type, processor):
153+
super(PollArg, self)._process_custom_annotations(annotation_type, processor)
154+
146155
def __repr__(self):
147156
return 'PollArg(async_job_id={!r})'.format(
148157
self._async_job_id_value,
@@ -176,6 +185,9 @@ def is_in_progress(self):
176185
"""
177186
return self._tag == 'in_progress'
178187

188+
def _process_custom_annotations(self, annotation_type, processor):
189+
super(PollResultBase, self)._process_custom_annotations(annotation_type, processor)
190+
179191
def __repr__(self):
180192
return 'PollResultBase(%r, %r)' % (self._tag, self._value)
181193

@@ -204,6 +216,9 @@ def is_complete(self):
204216
"""
205217
return self._tag == 'complete'
206218

219+
def _process_custom_annotations(self, annotation_type, processor):
220+
super(PollEmptyResult, self)._process_custom_annotations(annotation_type, processor)
221+
207222
def __repr__(self):
208223
return 'PollEmptyResult(%r, %r)' % (self._tag, self._value)
209224

@@ -255,6 +270,9 @@ def is_other(self):
255270
"""
256271
return self._tag == 'other'
257272

273+
def _process_custom_annotations(self, annotation_type, processor):
274+
super(PollError, self)._process_custom_annotations(annotation_type, processor)
275+
258276
def __repr__(self):
259277
return 'PollError(%r, %r)' % (self._tag, self._value)
260278

dropbox/auth.py

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ def get_paper_access_denied(self):
101101
raise AttributeError("tag 'paper_access_denied' not set")
102102
return self._value
103103

104+
def _process_custom_annotations(self, annotation_type, processor):
105+
super(AccessError, self)._process_custom_annotations(annotation_type, processor)
106+
104107
def __repr__(self):
105108
return 'AccessError(%r, %r)' % (self._tag, self._value)
106109

@@ -120,6 +123,7 @@ class AuthError(bb.Union):
120123
:ivar invalid_select_admin: The user specified in 'Dropbox-API-Select-Admin'
121124
is not a Dropbox Business team admin.
122125
:ivar user_suspended: The user has been suspended.
126+
:ivar expired_access_token: The access token has expired.
123127
"""
124128

125129
_catch_all = 'other'
@@ -132,6 +136,8 @@ class AuthError(bb.Union):
132136
# Attribute is overwritten below the class definition
133137
user_suspended = None
134138
# Attribute is overwritten below the class definition
139+
expired_access_token = None
140+
# Attribute is overwritten below the class definition
135141
other = None
136142

137143
def is_invalid_access_token(self):
@@ -166,6 +172,14 @@ def is_user_suspended(self):
166172
"""
167173
return self._tag == 'user_suspended'
168174

175+
def is_expired_access_token(self):
176+
"""
177+
Check if the union tag is ``expired_access_token``.
178+
179+
:rtype: bool
180+
"""
181+
return self._tag == 'expired_access_token'
182+
169183
def is_other(self):
170184
"""
171185
Check if the union tag is ``other``.
@@ -174,6 +188,9 @@ def is_other(self):
174188
"""
175189
return self._tag == 'other'
176190

191+
def _process_custom_annotations(self, annotation_type, processor):
192+
super(AuthError, self)._process_custom_annotations(annotation_type, processor)
193+
177194
def __repr__(self):
178195
return 'AuthError(%r, %r)' % (self._tag, self._value)
179196

@@ -223,6 +240,9 @@ def is_other(self):
223240
"""
224241
return self._tag == 'other'
225242

243+
def _process_custom_annotations(self, annotation_type, processor):
244+
super(InvalidAccountTypeError, self)._process_custom_annotations(annotation_type, processor)
245+
226246
def __repr__(self):
227247
return 'InvalidAccountTypeError(%r, %r)' % (self._tag, self._value)
228248

@@ -270,12 +290,15 @@ def is_other(self):
270290
"""
271291
return self._tag == 'other'
272292

293+
def _process_custom_annotations(self, annotation_type, processor):
294+
super(PaperAccessError, self)._process_custom_annotations(annotation_type, processor)
295+
273296
def __repr__(self):
274297
return 'PaperAccessError(%r, %r)' % (self._tag, self._value)
275298

276299
PaperAccessError_validator = bv.Union(PaperAccessError)
277300

278-
class RateLimitError(object):
301+
class RateLimitError(bb.Struct):
279302
"""
280303
Error occurred because the app is being rate limited.
281304
@@ -352,6 +375,9 @@ def retry_after(self):
352375
self._retry_after_value = None
353376
self._retry_after_present = False
354377

378+
def _process_custom_annotations(self, annotation_type, processor):
379+
super(RateLimitError, self)._process_custom_annotations(annotation_type, processor)
380+
355381
def __repr__(self):
356382
return 'RateLimitError(reason={!r}, retry_after={!r})'.format(
357383
self._reason_value,
@@ -404,12 +430,15 @@ def is_other(self):
404430
"""
405431
return self._tag == 'other'
406432

433+
def _process_custom_annotations(self, annotation_type, processor):
434+
super(RateLimitReason, self)._process_custom_annotations(annotation_type, processor)
435+
407436
def __repr__(self):
408437
return 'RateLimitReason(%r, %r)' % (self._tag, self._value)
409438

410439
RateLimitReason_validator = bv.Union(RateLimitReason)
411440

412-
class TokenFromOAuth1Arg(object):
441+
class TokenFromOAuth1Arg(bb.Struct):
413442
"""
414443
:ivar oauth1_token: The supplied OAuth 1.0 access token.
415444
:ivar oauth1_token_secret: The token secret associated with the supplied
@@ -483,6 +512,9 @@ def oauth1_token_secret(self):
483512
self._oauth1_token_secret_value = None
484513
self._oauth1_token_secret_present = False
485514

515+
def _process_custom_annotations(self, annotation_type, processor):
516+
super(TokenFromOAuth1Arg, self)._process_custom_annotations(annotation_type, processor)
517+
486518
def __repr__(self):
487519
return 'TokenFromOAuth1Arg(oauth1_token={!r}, oauth1_token_secret={!r})'.format(
488520
self._oauth1_token_value,
@@ -535,12 +567,15 @@ def is_other(self):
535567
"""
536568
return self._tag == 'other'
537569

570+
def _process_custom_annotations(self, annotation_type, processor):
571+
super(TokenFromOAuth1Error, self)._process_custom_annotations(annotation_type, processor)
572+
538573
def __repr__(self):
539574
return 'TokenFromOAuth1Error(%r, %r)' % (self._tag, self._value)
540575

541576
TokenFromOAuth1Error_validator = bv.Union(TokenFromOAuth1Error)
542577

543-
class TokenFromOAuth1Result(object):
578+
class TokenFromOAuth1Result(bb.Struct):
544579
"""
545580
:ivar oauth2_token: The OAuth 2.0 token generated from the supplied OAuth
546581
1.0 token.
@@ -583,6 +618,9 @@ def oauth2_token(self):
583618
self._oauth2_token_value = None
584619
self._oauth2_token_present = False
585620

621+
def _process_custom_annotations(self, annotation_type, processor):
622+
super(TokenFromOAuth1Result, self)._process_custom_annotations(annotation_type, processor)
623+
586624
def __repr__(self):
587625
return 'TokenFromOAuth1Result(oauth2_token={!r})'.format(
588626
self._oauth2_token_value,
@@ -605,19 +643,22 @@ def __repr__(self):
605643
AuthError._invalid_select_user_validator = bv.Void()
606644
AuthError._invalid_select_admin_validator = bv.Void()
607645
AuthError._user_suspended_validator = bv.Void()
646+
AuthError._expired_access_token_validator = bv.Void()
608647
AuthError._other_validator = bv.Void()
609648
AuthError._tagmap = {
610649
'invalid_access_token': AuthError._invalid_access_token_validator,
611650
'invalid_select_user': AuthError._invalid_select_user_validator,
612651
'invalid_select_admin': AuthError._invalid_select_admin_validator,
613652
'user_suspended': AuthError._user_suspended_validator,
653+
'expired_access_token': AuthError._expired_access_token_validator,
614654
'other': AuthError._other_validator,
615655
}
616656

617657
AuthError.invalid_access_token = AuthError('invalid_access_token')
618658
AuthError.invalid_select_user = AuthError('invalid_select_user')
619659
AuthError.invalid_select_admin = AuthError('invalid_select_admin')
620660
AuthError.user_suspended = AuthError('user_suspended')
661+
AuthError.expired_access_token = AuthError('expired_access_token')
621662
AuthError.other = AuthError('other')
622663

623664
InvalidAccountTypeError._endpoint_validator = bv.Void()

0 commit comments

Comments
 (0)