77from stone .backends .python_rsrc import stone_base as bb
88from stone .backends .python_rsrc import stone_validators as bv
99
10+ class AccountPhotoGetArg (bb .Struct ):
11+ """
12+ :ivar account.AccountPhotoGetArg.dbx_account_id: Encoded ID of the user.
13+ Must start either with 'dbid:' or 'dbaphid:'.
14+ :ivar account.AccountPhotoGetArg.size: A string representing the size of the
15+ photo.
16+ :ivar account.AccountPhotoGetArg.circle_crop: True if the photo should be
17+ cropped and false otherwise.
18+ :ivar account.AccountPhotoGetArg.expect_account_photo: True if we expect
19+ account photo to exist.
20+ """
21+
22+ __slots__ = [
23+ '_dbx_account_id_value' ,
24+ '_size_value' ,
25+ '_circle_crop_value' ,
26+ '_expect_account_photo_value' ,
27+ ]
28+
29+ _has_required_fields = True
30+
31+ def __init__ (self ,
32+ dbx_account_id = None ,
33+ size = None ,
34+ circle_crop = None ,
35+ expect_account_photo = None ):
36+ self ._dbx_account_id_value = bb .NOT_SET
37+ self ._size_value = bb .NOT_SET
38+ self ._circle_crop_value = bb .NOT_SET
39+ self ._expect_account_photo_value = bb .NOT_SET
40+ if dbx_account_id is not None :
41+ self .dbx_account_id = dbx_account_id
42+ if size is not None :
43+ self .size = size
44+ if circle_crop is not None :
45+ self .circle_crop = circle_crop
46+ if expect_account_photo is not None :
47+ self .expect_account_photo = expect_account_photo
48+
49+ # Instance attribute type: str (validator is set below)
50+ dbx_account_id = bb .Attribute ("dbx_account_id" )
51+
52+ # Instance attribute type: str (validator is set below)
53+ size = bb .Attribute ("size" )
54+
55+ # Instance attribute type: bool (validator is set below)
56+ circle_crop = bb .Attribute ("circle_crop" )
57+
58+ # Instance attribute type: bool (validator is set below)
59+ expect_account_photo = bb .Attribute ("expect_account_photo" )
60+
61+ def _process_custom_annotations (self , annotation_type , field_path , processor ):
62+ super (AccountPhotoGetArg , self )._process_custom_annotations (annotation_type , field_path , processor )
63+
64+ AccountPhotoGetArg_validator = bv .Struct (AccountPhotoGetArg )
65+
66+ class AccountPhotoGetError (bb .Union ):
67+ """
68+ This class acts as a tagged union. Only one of the ``is_*`` methods will
69+ return true. To get the associated value of a tag (if one exists), use the
70+ corresponding ``get_*`` method.
71+
72+ :ivar ThumbnailError AccountPhotoGetError.thumbnail_error: Indicates
73+ infrastructural failure.
74+ :ivar account.AccountPhotoGetError.account_photo_missing: Account photo is
75+ missing (but we did not expect it to exist).
76+ :ivar account.AccountPhotoGetError.expected_account_photo_missing: Account
77+ photo was expected to exist, but it's missing.
78+ """
79+
80+ _catch_all = 'other'
81+ # Attribute is overwritten below the class definition
82+ account_photo_missing = None
83+ # Attribute is overwritten below the class definition
84+ expected_account_photo_missing = None
85+ # Attribute is overwritten below the class definition
86+ other = None
87+
88+ @classmethod
89+ def thumbnail_error (cls , val ):
90+ """
91+ Create an instance of this class set to the ``thumbnail_error`` tag with
92+ value ``val``.
93+
94+ :param ThumbnailError val:
95+ :rtype: AccountPhotoGetError
96+ """
97+ return cls ('thumbnail_error' , val )
98+
99+ def is_thumbnail_error (self ):
100+ """
101+ Check if the union tag is ``thumbnail_error``.
102+
103+ :rtype: bool
104+ """
105+ return self ._tag == 'thumbnail_error'
106+
107+ def is_account_photo_missing (self ):
108+ """
109+ Check if the union tag is ``account_photo_missing``.
110+
111+ :rtype: bool
112+ """
113+ return self ._tag == 'account_photo_missing'
114+
115+ def is_expected_account_photo_missing (self ):
116+ """
117+ Check if the union tag is ``expected_account_photo_missing``.
118+
119+ :rtype: bool
120+ """
121+ return self ._tag == 'expected_account_photo_missing'
122+
123+ def is_other (self ):
124+ """
125+ Check if the union tag is ``other``.
126+
127+ :rtype: bool
128+ """
129+ return self ._tag == 'other'
130+
131+ def get_thumbnail_error (self ):
132+ """
133+ Indicates infrastructural failure.
134+
135+ Only call this if :meth:`is_thumbnail_error` is true.
136+
137+ :rtype: ThumbnailError
138+ """
139+ if not self .is_thumbnail_error ():
140+ raise AttributeError ("tag 'thumbnail_error' not set" )
141+ return self ._value
142+
143+ def _process_custom_annotations (self , annotation_type , field_path , processor ):
144+ super (AccountPhotoGetError , self )._process_custom_annotations (annotation_type , field_path , processor )
145+
146+ AccountPhotoGetError_validator = bv .Union (AccountPhotoGetError )
147+
148+ class AccountPhotoGetResult (bb .Struct ):
149+ """
150+ :ivar account.AccountPhotoGetResult.content_type: The data returned by
151+ get_photo.
152+ """
153+
154+ __slots__ = [
155+ '_content_type_value' ,
156+ ]
157+
158+ _has_required_fields = True
159+
160+ def __init__ (self ,
161+ content_type = None ):
162+ self ._content_type_value = bb .NOT_SET
163+ if content_type is not None :
164+ self .content_type = content_type
165+
166+ # Instance attribute type: str (validator is set below)
167+ content_type = bb .Attribute ("content_type" )
168+
169+ def _process_custom_annotations (self , annotation_type , field_path , processor ):
170+ super (AccountPhotoGetResult , self )._process_custom_annotations (annotation_type , field_path , processor )
171+
172+ AccountPhotoGetResult_validator = bv .Struct (AccountPhotoGetResult )
173+
174+ class DeleteProfilePhotoArg (bb .Struct ):
175+ """
176+ This struct is empty. The comment here is intentionally emitted to avoid
177+ indentation issues with Stone.
178+ """
179+
180+ __slots__ = [
181+ ]
182+
183+ _has_required_fields = False
184+
185+ def __init__ (self ):
186+ pass
187+
188+ def _process_custom_annotations (self , annotation_type , field_path , processor ):
189+ super (DeleteProfilePhotoArg , self )._process_custom_annotations (annotation_type , field_path , processor )
190+
191+ DeleteProfilePhotoArg_validator = bv .Struct (DeleteProfilePhotoArg )
192+
193+ class DeleteProfilePhotoError (bb .Union ):
194+ """
195+ This union is empty. The comment here is intentionally emitted to avoid
196+ indentation issues with Stone.
197+
198+ This class acts as a tagged union. Only one of the ``is_*`` methods will
199+ return true. To get the associated value of a tag (if one exists), use the
200+ corresponding ``get_*`` method.
201+ """
202+
203+ _catch_all = 'other'
204+ # Attribute is overwritten below the class definition
205+ other = None
206+
207+ def is_other (self ):
208+ """
209+ Check if the union tag is ``other``.
210+
211+ :rtype: bool
212+ """
213+ return self ._tag == 'other'
214+
215+ def _process_custom_annotations (self , annotation_type , field_path , processor ):
216+ super (DeleteProfilePhotoError , self )._process_custom_annotations (annotation_type , field_path , processor )
217+
218+ DeleteProfilePhotoError_validator = bv .Union (DeleteProfilePhotoError )
219+
220+ class DeleteProfilePhotoResult (bb .Struct ):
221+ """
222+ This struct is empty. The comment here is intentionally emitted to avoid
223+ indentation issues with Stone.
224+ """
225+
226+ __slots__ = [
227+ ]
228+
229+ _has_required_fields = False
230+
231+ def __init__ (self ):
232+ pass
233+
234+ def _process_custom_annotations (self , annotation_type , field_path , processor ):
235+ super (DeleteProfilePhotoResult , self )._process_custom_annotations (annotation_type , field_path , processor )
236+
237+ DeleteProfilePhotoResult_validator = bv .Struct (DeleteProfilePhotoResult )
238+
10239class PhotoSourceArg (bb .Union ):
11240 """
12241 This class acts as a tagged union. Only one of the ``is_*`` methods will
@@ -202,6 +431,104 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
202431
203432SetProfilePhotoResult_validator = bv .Struct (SetProfilePhotoResult )
204433
434+ class ThumbnailError (bb .Union ):
435+ """
436+ This class acts as a tagged union. Only one of the ``is_*`` methods will
437+ return true. To get the associated value of a tag (if one exists), use the
438+ corresponding ``get_*`` method.
439+
440+ :ivar account.ThumbnailError.permanent_failure: Indicates permanent
441+ infrastructural failure.
442+ :ivar account.ThumbnailError.temporary_failure: Indicates temporary
443+ infrastructural failure.
444+ """
445+
446+ _catch_all = 'other'
447+ # Attribute is overwritten below the class definition
448+ permanent_failure = None
449+ # Attribute is overwritten below the class definition
450+ temporary_failure = None
451+ # Attribute is overwritten below the class definition
452+ other = None
453+
454+ def is_permanent_failure (self ):
455+ """
456+ Check if the union tag is ``permanent_failure``.
457+
458+ :rtype: bool
459+ """
460+ return self ._tag == 'permanent_failure'
461+
462+ def is_temporary_failure (self ):
463+ """
464+ Check if the union tag is ``temporary_failure``.
465+
466+ :rtype: bool
467+ """
468+ return self ._tag == 'temporary_failure'
469+
470+ def is_other (self ):
471+ """
472+ Check if the union tag is ``other``.
473+
474+ :rtype: bool
475+ """
476+ return self ._tag == 'other'
477+
478+ def _process_custom_annotations (self , annotation_type , field_path , processor ):
479+ super (ThumbnailError , self )._process_custom_annotations (annotation_type , field_path , processor )
480+
481+ ThumbnailError_validator = bv .Union (ThumbnailError )
482+
483+ AccountPhotoGetArg .dbx_account_id .validator = bv .String ()
484+ AccountPhotoGetArg .size .validator = bv .String ()
485+ AccountPhotoGetArg .circle_crop .validator = bv .Boolean ()
486+ AccountPhotoGetArg .expect_account_photo .validator = bv .Boolean ()
487+ AccountPhotoGetArg ._all_field_names_ = set ([
488+ 'dbx_account_id' ,
489+ 'size' ,
490+ 'circle_crop' ,
491+ 'expect_account_photo' ,
492+ ])
493+ AccountPhotoGetArg ._all_fields_ = [
494+ ('dbx_account_id' , AccountPhotoGetArg .dbx_account_id .validator ),
495+ ('size' , AccountPhotoGetArg .size .validator ),
496+ ('circle_crop' , AccountPhotoGetArg .circle_crop .validator ),
497+ ('expect_account_photo' , AccountPhotoGetArg .expect_account_photo .validator ),
498+ ]
499+
500+ AccountPhotoGetError ._thumbnail_error_validator = ThumbnailError_validator
501+ AccountPhotoGetError ._account_photo_missing_validator = bv .Void ()
502+ AccountPhotoGetError ._expected_account_photo_missing_validator = bv .Void ()
503+ AccountPhotoGetError ._other_validator = bv .Void ()
504+ AccountPhotoGetError ._tagmap = {
505+ 'thumbnail_error' : AccountPhotoGetError ._thumbnail_error_validator ,
506+ 'account_photo_missing' : AccountPhotoGetError ._account_photo_missing_validator ,
507+ 'expected_account_photo_missing' : AccountPhotoGetError ._expected_account_photo_missing_validator ,
508+ 'other' : AccountPhotoGetError ._other_validator ,
509+ }
510+
511+ AccountPhotoGetError .account_photo_missing = AccountPhotoGetError ('account_photo_missing' )
512+ AccountPhotoGetError .expected_account_photo_missing = AccountPhotoGetError ('expected_account_photo_missing' )
513+ AccountPhotoGetError .other = AccountPhotoGetError ('other' )
514+
515+ AccountPhotoGetResult .content_type .validator = bv .String ()
516+ AccountPhotoGetResult ._all_field_names_ = set (['content_type' ])
517+ AccountPhotoGetResult ._all_fields_ = [('content_type' , AccountPhotoGetResult .content_type .validator )]
518+
519+ DeleteProfilePhotoArg ._all_field_names_ = set ([])
520+ DeleteProfilePhotoArg ._all_fields_ = []
521+
522+ DeleteProfilePhotoError ._other_validator = bv .Void ()
523+ DeleteProfilePhotoError ._tagmap = {
524+ 'other' : DeleteProfilePhotoError ._other_validator ,
525+ }
526+
527+ DeleteProfilePhotoError .other = DeleteProfilePhotoError ('other' )
528+
529+ DeleteProfilePhotoResult ._all_field_names_ = set ([])
530+ DeleteProfilePhotoResult ._all_fields_ = []
531+
205532PhotoSourceArg ._base64_data_validator = bv .String ()
206533PhotoSourceArg ._other_validator = bv .Void ()
207534PhotoSourceArg ._tagmap = {
@@ -241,6 +568,41 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
241568SetProfilePhotoResult ._all_field_names_ = set (['profile_photo_url' ])
242569SetProfilePhotoResult ._all_fields_ = [('profile_photo_url' , SetProfilePhotoResult .profile_photo_url .validator )]
243570
571+ ThumbnailError ._permanent_failure_validator = bv .Void ()
572+ ThumbnailError ._temporary_failure_validator = bv .Void ()
573+ ThumbnailError ._other_validator = bv .Void ()
574+ ThumbnailError ._tagmap = {
575+ 'permanent_failure' : ThumbnailError ._permanent_failure_validator ,
576+ 'temporary_failure' : ThumbnailError ._temporary_failure_validator ,
577+ 'other' : ThumbnailError ._other_validator ,
578+ }
579+
580+ ThumbnailError .permanent_failure = ThumbnailError ('permanent_failure' )
581+ ThumbnailError .temporary_failure = ThumbnailError ('temporary_failure' )
582+ ThumbnailError .other = ThumbnailError ('other' )
583+
584+ delete_profile_photo = bb .Route (
585+ 'delete_profile_photo' ,
586+ 1 ,
587+ False ,
588+ DeleteProfilePhotoArg_validator ,
589+ DeleteProfilePhotoResult_validator ,
590+ DeleteProfilePhotoError_validator ,
591+ {'auth' : 'user' ,
592+ 'host' : 'api' ,
593+ 'style' : 'rpc' },
594+ )
595+ get_photo = bb .Route (
596+ 'get_photo' ,
597+ 1 ,
598+ False ,
599+ AccountPhotoGetArg_validator ,
600+ AccountPhotoGetResult_validator ,
601+ AccountPhotoGetError_validator ,
602+ {'auth' : 'user' ,
603+ 'host' : 'content' ,
604+ 'style' : 'download' },
605+ )
244606set_profile_photo = bb .Route (
245607 'set_profile_photo' ,
246608 1 ,
@@ -254,6 +616,8 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
254616)
255617
256618ROUTES = {
619+ 'delete_profile_photo' : delete_profile_photo ,
620+ 'get_photo' : get_photo ,
257621 'set_profile_photo' : set_profile_photo ,
258622}
259623
0 commit comments