|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# Auto-generated by Stone, do not modify. |
| 3 | +# @generated |
| 4 | +# flake8: noqa |
| 5 | +# pylint: skip-file |
| 6 | +from __future__ import unicode_literals |
| 7 | +from stone.backends.python_rsrc import stone_base as bb |
| 8 | +from stone.backends.python_rsrc import stone_validators as bv |
| 9 | + |
| 10 | +class AuthError(bb.Union): |
| 11 | + """ |
| 12 | + This class acts as a tagged union. Only one of the ``is_*`` methods will |
| 13 | + return true. To get the associated value of a tag (if one exists), use the |
| 14 | + corresponding ``get_*`` method. |
| 15 | + """ |
| 16 | + |
| 17 | + _catch_all = 'other' |
| 18 | + # Attribute is overwritten below the class definition |
| 19 | + invalid_token = None |
| 20 | + # Attribute is overwritten below the class definition |
| 21 | + no_openid_auth = None |
| 22 | + # Attribute is overwritten below the class definition |
| 23 | + other = None |
| 24 | + |
| 25 | + def is_invalid_token(self): |
| 26 | + """ |
| 27 | + Check if the union tag is ``invalid_token``. |
| 28 | +
|
| 29 | + :rtype: bool |
| 30 | + """ |
| 31 | + return self._tag == 'invalid_token' |
| 32 | + |
| 33 | + def is_no_openid_auth(self): |
| 34 | + """ |
| 35 | + Check if the union tag is ``no_openid_auth``. |
| 36 | +
|
| 37 | + :rtype: bool |
| 38 | + """ |
| 39 | + return self._tag == 'no_openid_auth' |
| 40 | + |
| 41 | + def is_other(self): |
| 42 | + """ |
| 43 | + Check if the union tag is ``other``. |
| 44 | +
|
| 45 | + :rtype: bool |
| 46 | + """ |
| 47 | + return self._tag == 'other' |
| 48 | + |
| 49 | + def _process_custom_annotations(self, annotation_type, field_path, processor): |
| 50 | + super(AuthError, self)._process_custom_annotations(annotation_type, field_path, processor) |
| 51 | + |
| 52 | +AuthError_validator = bv.Union(AuthError) |
| 53 | + |
| 54 | +class UserInfoArgs(bb.Struct): |
| 55 | + """ |
| 56 | + This struct is empty. The comment here is intentionally emitted to avoid |
| 57 | + indentation issues with Stone. |
| 58 | + """ |
| 59 | + |
| 60 | + __slots__ = [ |
| 61 | + ] |
| 62 | + |
| 63 | + _has_required_fields = False |
| 64 | + |
| 65 | + def __init__(self): |
| 66 | + pass |
| 67 | + |
| 68 | + def _process_custom_annotations(self, annotation_type, field_path, processor): |
| 69 | + super(UserInfoArgs, self)._process_custom_annotations(annotation_type, field_path, processor) |
| 70 | + |
| 71 | +UserInfoArgs_validator = bv.Struct(UserInfoArgs) |
| 72 | + |
| 73 | +class UserInfoError(bb.Struct): |
| 74 | + |
| 75 | + __slots__ = [ |
| 76 | + '_err_value', |
| 77 | + '_error_message_value', |
| 78 | + ] |
| 79 | + |
| 80 | + _has_required_fields = False |
| 81 | + |
| 82 | + def __init__(self, |
| 83 | + err=None, |
| 84 | + error_message=None): |
| 85 | + self._err_value = bb.NOT_SET |
| 86 | + self._error_message_value = bb.NOT_SET |
| 87 | + if err is not None: |
| 88 | + self.err = err |
| 89 | + if error_message is not None: |
| 90 | + self.error_message = error_message |
| 91 | + |
| 92 | + # Instance attribute type: ErrUnion (validator is set below) |
| 93 | + err = bb.Attribute("err", nullable=True, user_defined=True) |
| 94 | + |
| 95 | + # Instance attribute type: str (validator is set below) |
| 96 | + error_message = bb.Attribute("error_message") |
| 97 | + |
| 98 | + def _process_custom_annotations(self, annotation_type, field_path, processor): |
| 99 | + super(UserInfoError, self)._process_custom_annotations(annotation_type, field_path, processor) |
| 100 | + |
| 101 | +UserInfoError_validator = bv.Struct(UserInfoError) |
| 102 | + |
| 103 | +class UserInfoResult(bb.Struct): |
| 104 | + |
| 105 | + __slots__ = [ |
| 106 | + '_family_name_value', |
| 107 | + '_given_name_value', |
| 108 | + '_email_value', |
| 109 | + '_email_verified_value', |
| 110 | + '_iss_value', |
| 111 | + '_sub_value', |
| 112 | + ] |
| 113 | + |
| 114 | + _has_required_fields = False |
| 115 | + |
| 116 | + def __init__(self, |
| 117 | + family_name=None, |
| 118 | + given_name=None, |
| 119 | + email=None, |
| 120 | + email_verified=None, |
| 121 | + iss=None, |
| 122 | + sub=None): |
| 123 | + self._family_name_value = bb.NOT_SET |
| 124 | + self._given_name_value = bb.NOT_SET |
| 125 | + self._email_value = bb.NOT_SET |
| 126 | + self._email_verified_value = bb.NOT_SET |
| 127 | + self._iss_value = bb.NOT_SET |
| 128 | + self._sub_value = bb.NOT_SET |
| 129 | + if family_name is not None: |
| 130 | + self.family_name = family_name |
| 131 | + if given_name is not None: |
| 132 | + self.given_name = given_name |
| 133 | + if email is not None: |
| 134 | + self.email = email |
| 135 | + if email_verified is not None: |
| 136 | + self.email_verified = email_verified |
| 137 | + if iss is not None: |
| 138 | + self.iss = iss |
| 139 | + if sub is not None: |
| 140 | + self.sub = sub |
| 141 | + |
| 142 | + # Instance attribute type: str (validator is set below) |
| 143 | + family_name = bb.Attribute("family_name", nullable=True) |
| 144 | + |
| 145 | + # Instance attribute type: str (validator is set below) |
| 146 | + given_name = bb.Attribute("given_name", nullable=True) |
| 147 | + |
| 148 | + # Instance attribute type: str (validator is set below) |
| 149 | + email = bb.Attribute("email", nullable=True) |
| 150 | + |
| 151 | + # Instance attribute type: bool (validator is set below) |
| 152 | + email_verified = bb.Attribute("email_verified", nullable=True) |
| 153 | + |
| 154 | + # Instance attribute type: str (validator is set below) |
| 155 | + iss = bb.Attribute("iss") |
| 156 | + |
| 157 | + # Instance attribute type: str (validator is set below) |
| 158 | + sub = bb.Attribute("sub") |
| 159 | + |
| 160 | + def _process_custom_annotations(self, annotation_type, field_path, processor): |
| 161 | + super(UserInfoResult, self)._process_custom_annotations(annotation_type, field_path, processor) |
| 162 | + |
| 163 | +UserInfoResult_validator = bv.Struct(UserInfoResult) |
| 164 | + |
| 165 | +class ErrUnion(bb.Union): |
| 166 | + """ |
| 167 | + This class acts as a tagged union. Only one of the ``is_*`` methods will |
| 168 | + return true. To get the associated value of a tag (if one exists), use the |
| 169 | + corresponding ``get_*`` method. |
| 170 | + """ |
| 171 | + |
| 172 | + _catch_all = 'other' |
| 173 | + # Attribute is overwritten below the class definition |
| 174 | + other = None |
| 175 | + |
| 176 | + @classmethod |
| 177 | + def auth_error(cls, val): |
| 178 | + """ |
| 179 | + Create an instance of this class set to the ``auth_error`` tag with |
| 180 | + value ``val``. |
| 181 | +
|
| 182 | + :param AuthError val: |
| 183 | + :rtype: ErrUnion |
| 184 | + """ |
| 185 | + return cls('auth_error', val) |
| 186 | + |
| 187 | + def is_auth_error(self): |
| 188 | + """ |
| 189 | + Check if the union tag is ``auth_error``. |
| 190 | +
|
| 191 | + :rtype: bool |
| 192 | + """ |
| 193 | + return self._tag == 'auth_error' |
| 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 get_auth_error(self): |
| 204 | + """ |
| 205 | + Only call this if :meth:`is_auth_error` is true. |
| 206 | +
|
| 207 | + :rtype: AuthError |
| 208 | + """ |
| 209 | + if not self.is_auth_error(): |
| 210 | + raise AttributeError("tag 'auth_error' not set") |
| 211 | + return self._value |
| 212 | + |
| 213 | + def _process_custom_annotations(self, annotation_type, field_path, processor): |
| 214 | + super(ErrUnion, self)._process_custom_annotations(annotation_type, field_path, processor) |
| 215 | + |
| 216 | +ErrUnion_validator = bv.Union(ErrUnion) |
| 217 | + |
| 218 | +AuthError._invalid_token_validator = bv.Void() |
| 219 | +AuthError._no_openid_auth_validator = bv.Void() |
| 220 | +AuthError._other_validator = bv.Void() |
| 221 | +AuthError._tagmap = { |
| 222 | + 'invalid_token': AuthError._invalid_token_validator, |
| 223 | + 'no_openid_auth': AuthError._no_openid_auth_validator, |
| 224 | + 'other': AuthError._other_validator, |
| 225 | +} |
| 226 | + |
| 227 | +AuthError.invalid_token = AuthError('invalid_token') |
| 228 | +AuthError.no_openid_auth = AuthError('no_openid_auth') |
| 229 | +AuthError.other = AuthError('other') |
| 230 | + |
| 231 | +UserInfoArgs._all_field_names_ = set([]) |
| 232 | +UserInfoArgs._all_fields_ = [] |
| 233 | + |
| 234 | +UserInfoError.err.validator = bv.Nullable(ErrUnion_validator) |
| 235 | +UserInfoError.error_message.validator = bv.String() |
| 236 | +UserInfoError._all_field_names_ = set([ |
| 237 | + 'err', |
| 238 | + 'error_message', |
| 239 | +]) |
| 240 | +UserInfoError._all_fields_ = [ |
| 241 | + ('err', UserInfoError.err.validator), |
| 242 | + ('error_message', UserInfoError.error_message.validator), |
| 243 | +] |
| 244 | + |
| 245 | +UserInfoResult.family_name.validator = bv.Nullable(bv.String()) |
| 246 | +UserInfoResult.given_name.validator = bv.Nullable(bv.String()) |
| 247 | +UserInfoResult.email.validator = bv.Nullable(bv.String()) |
| 248 | +UserInfoResult.email_verified.validator = bv.Nullable(bv.Boolean()) |
| 249 | +UserInfoResult.iss.validator = bv.String() |
| 250 | +UserInfoResult.sub.validator = bv.String() |
| 251 | +UserInfoResult._all_field_names_ = set([ |
| 252 | + 'family_name', |
| 253 | + 'given_name', |
| 254 | + 'email', |
| 255 | + 'email_verified', |
| 256 | + 'iss', |
| 257 | + 'sub', |
| 258 | +]) |
| 259 | +UserInfoResult._all_fields_ = [ |
| 260 | + ('family_name', UserInfoResult.family_name.validator), |
| 261 | + ('given_name', UserInfoResult.given_name.validator), |
| 262 | + ('email', UserInfoResult.email.validator), |
| 263 | + ('email_verified', UserInfoResult.email_verified.validator), |
| 264 | + ('iss', UserInfoResult.iss.validator), |
| 265 | + ('sub', UserInfoResult.sub.validator), |
| 266 | +] |
| 267 | + |
| 268 | +ErrUnion._auth_error_validator = AuthError_validator |
| 269 | +ErrUnion._other_validator = bv.Void() |
| 270 | +ErrUnion._tagmap = { |
| 271 | + 'auth_error': ErrUnion._auth_error_validator, |
| 272 | + 'other': ErrUnion._other_validator, |
| 273 | +} |
| 274 | + |
| 275 | +ErrUnion.other = ErrUnion('other') |
| 276 | + |
| 277 | +UserInfoError.error_message.default = '' |
| 278 | +UserInfoResult.iss.default = '' |
| 279 | +UserInfoResult.sub.default = '' |
| 280 | +ROUTES = { |
| 281 | +} |
| 282 | + |
0 commit comments