@@ -22,7 +22,6 @@ class AuthError(bb.Union):
2222 is no longer on the team.
2323 :ivar invalid_select_admin: The user specified in 'Dropbox-API-Select-Admin'
2424 is not a Dropbox Business team admin.
25- :ivar other: An unspecified error.
2625 """
2726
2827 _catch_all = 'other'
@@ -72,6 +71,140 @@ def __repr__(self):
7271
7372AuthError_validator = bv .Union (AuthError )
7473
74+ class RateLimitError (object ):
75+ """
76+ Error occurred because the app is being rate limited.
77+
78+ :ivar reason: The reason why the app is being rate limited.
79+ :ivar retry_after: The number of seconds that the app should wait before
80+ making another request.
81+ """
82+
83+ __slots__ = [
84+ '_reason_value' ,
85+ '_reason_present' ,
86+ '_retry_after_value' ,
87+ '_retry_after_present' ,
88+ ]
89+
90+ _has_required_fields = True
91+
92+ def __init__ (self ,
93+ reason = None ,
94+ retry_after = None ):
95+ self ._reason_value = None
96+ self ._reason_present = False
97+ self ._retry_after_value = None
98+ self ._retry_after_present = False
99+ if reason is not None :
100+ self .reason = reason
101+ if retry_after is not None :
102+ self .retry_after = retry_after
103+
104+ @property
105+ def reason (self ):
106+ """
107+ The reason why the app is being rate limited.
108+
109+ :rtype: RateLimitReason
110+ """
111+ if self ._reason_present :
112+ return self ._reason_value
113+ else :
114+ raise AttributeError ("missing required field 'reason'" )
115+
116+ @reason .setter
117+ def reason (self , val ):
118+ self ._reason_validator .validate_type_only (val )
119+ self ._reason_value = val
120+ self ._reason_present = True
121+
122+ @reason .deleter
123+ def reason (self ):
124+ self ._reason_value = None
125+ self ._reason_present = False
126+
127+ @property
128+ def retry_after (self ):
129+ """
130+ The number of seconds that the app should wait before making another
131+ request.
132+
133+ :rtype: long
134+ """
135+ if self ._retry_after_present :
136+ return self ._retry_after_value
137+ else :
138+ return 1
139+
140+ @retry_after .setter
141+ def retry_after (self , val ):
142+ val = self ._retry_after_validator .validate (val )
143+ self ._retry_after_value = val
144+ self ._retry_after_present = True
145+
146+ @retry_after .deleter
147+ def retry_after (self ):
148+ self ._retry_after_value = None
149+ self ._retry_after_present = False
150+
151+ def __repr__ (self ):
152+ return 'RateLimitError(reason={!r}, retry_after={!r})' .format (
153+ self ._reason_value ,
154+ self ._retry_after_value ,
155+ )
156+
157+ RateLimitError_validator = bv .Struct (RateLimitError )
158+
159+ class RateLimitReason (bb .Union ):
160+ """
161+ This class acts as a tagged union. Only one of the ``is_*`` methods will
162+ return true. To get the associated value of a tag (if one exists), use the
163+ corresponding ``get_*`` method.
164+
165+ :ivar too_many_requests: You are making too many requests in the past few
166+ minutes.
167+ :ivar too_many_write_operations: There are currently too many write
168+ operations happening in the user's Dropbox.
169+ """
170+
171+ _catch_all = 'other'
172+ # Attribute is overwritten below the class definition
173+ too_many_requests = None
174+ # Attribute is overwritten below the class definition
175+ too_many_write_operations = None
176+ # Attribute is overwritten below the class definition
177+ other = None
178+
179+ def is_too_many_requests (self ):
180+ """
181+ Check if the union tag is ``too_many_requests``.
182+
183+ :rtype: bool
184+ """
185+ return self ._tag == 'too_many_requests'
186+
187+ def is_too_many_write_operations (self ):
188+ """
189+ Check if the union tag is ``too_many_write_operations``.
190+
191+ :rtype: bool
192+ """
193+ return self ._tag == 'too_many_write_operations'
194+
195+ def is_other (self ):
196+ """
197+ Check if the union tag is ``other``.
198+
199+ :rtype: bool
200+ """
201+ return self ._tag == 'other'
202+
203+ def __repr__ (self ):
204+ return 'RateLimitReason(%r, %r)' % (self ._tag , self ._value )
205+
206+ RateLimitReason_validator = bv .Union (RateLimitReason )
207+
75208AuthError ._invalid_access_token_validator = bv .Void ()
76209AuthError ._invalid_select_user_validator = bv .Void ()
77210AuthError ._invalid_select_admin_validator = bv .Void ()
@@ -88,6 +221,30 @@ def __repr__(self):
88221AuthError .invalid_select_admin = AuthError ('invalid_select_admin' )
89222AuthError .other = AuthError ('other' )
90223
224+ RateLimitError ._reason_validator = RateLimitReason_validator
225+ RateLimitError ._retry_after_validator = bv .UInt64 ()
226+ RateLimitError ._all_field_names_ = set ([
227+ 'reason' ,
228+ 'retry_after' ,
229+ ])
230+ RateLimitError ._all_fields_ = [
231+ ('reason' , RateLimitError ._reason_validator ),
232+ ('retry_after' , RateLimitError ._retry_after_validator ),
233+ ]
234+
235+ RateLimitReason ._too_many_requests_validator = bv .Void ()
236+ RateLimitReason ._too_many_write_operations_validator = bv .Void ()
237+ RateLimitReason ._other_validator = bv .Void ()
238+ RateLimitReason ._tagmap = {
239+ 'too_many_requests' : RateLimitReason ._too_many_requests_validator ,
240+ 'too_many_write_operations' : RateLimitReason ._too_many_write_operations_validator ,
241+ 'other' : RateLimitReason ._other_validator ,
242+ }
243+
244+ RateLimitReason .too_many_requests = RateLimitReason ('too_many_requests' )
245+ RateLimitReason .too_many_write_operations = RateLimitReason ('too_many_write_operations' )
246+ RateLimitReason .other = RateLimitReason ('other' )
247+
91248token_revoke = bb .Route (
92249 'token/revoke' ,
93250 False ,
0 commit comments