3 # Copyright 2007 Google Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 from google
.net
.proto
import ProtocolBuffer
22 import dummy_thread
as thread
24 __pychecker__
= """maxreturns=0 maxbranches=0 no-callinit
25 unusednames=printElemNumber,debug_strs no-special"""
27 if hasattr(ProtocolBuffer
, 'ExtendableProtocolMessage'):
28 _extension_runtime
= True
29 _ExtendableProtocolMessage
= ProtocolBuffer
.ExtendableProtocolMessage
31 _extension_runtime
= False
32 _ExtendableProtocolMessage
= ProtocolBuffer
.ProtocolMessage
34 class UserServiceError(ProtocolBuffer
.ProtocolMessage
):
38 REDIRECT_URL_TOO_LONG
= 1
40 OAUTH_INVALID_TOKEN
= 3
41 OAUTH_INVALID_REQUEST
= 4
46 1: "REDIRECT_URL_TOO_LONG",
48 3: "OAUTH_INVALID_TOKEN",
49 4: "OAUTH_INVALID_REQUEST",
53 def ErrorCode_Name(cls
, x
): return cls
._ErrorCode
_NAMES
.get(x
, "")
54 ErrorCode_Name
= classmethod(ErrorCode_Name
)
57 def __init__(self
, contents
=None):
59 if contents
is not None: self
.MergeFromString(contents
)
62 def MergeFrom(self
, x
):
66 if x
is self
: return 1
69 def IsInitialized(self
, debug_strs
=None):
77 def ByteSizePartial(self
):
84 def OutputUnchecked(self
, out
):
87 def OutputPartial(self
, out
):
90 def TryMerge(self
, d
):
95 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
99 def __str__(self
, prefix
="", printElemNumber
=0):
104 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
105 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
108 _TEXT
= _BuildTagLookupTable({
112 _TYPES
= _BuildTagLookupTable({
113 0: ProtocolBuffer
.Encoder
.NUMERIC
,
114 }, 0, ProtocolBuffer
.Encoder
.MAX_TYPE
)
118 _STYLE_CONTENT_TYPE
= """"""
119 _PROTO_DESCRIPTOR_NAME
= 'apphosting.UserServiceError'
120 class CreateLoginURLRequest(ProtocolBuffer
.ProtocolMessage
):
121 has_destination_url_
= 0
122 destination_url_
= ""
125 has_federated_identity_
= 0
126 federated_identity_
= ""
128 def __init__(self
, contents
=None):
129 if contents
is not None: self
.MergeFromString(contents
)
131 def destination_url(self
): return self
.destination_url_
133 def set_destination_url(self
, x
):
134 self
.has_destination_url_
= 1
135 self
.destination_url_
= x
137 def clear_destination_url(self
):
138 if self
.has_destination_url_
:
139 self
.has_destination_url_
= 0
140 self
.destination_url_
= ""
142 def has_destination_url(self
): return self
.has_destination_url_
144 def auth_domain(self
): return self
.auth_domain_
146 def set_auth_domain(self
, x
):
147 self
.has_auth_domain_
= 1
148 self
.auth_domain_
= x
150 def clear_auth_domain(self
):
151 if self
.has_auth_domain_
:
152 self
.has_auth_domain_
= 0
153 self
.auth_domain_
= ""
155 def has_auth_domain(self
): return self
.has_auth_domain_
157 def federated_identity(self
): return self
.federated_identity_
159 def set_federated_identity(self
, x
):
160 self
.has_federated_identity_
= 1
161 self
.federated_identity_
= x
163 def clear_federated_identity(self
):
164 if self
.has_federated_identity_
:
165 self
.has_federated_identity_
= 0
166 self
.federated_identity_
= ""
168 def has_federated_identity(self
): return self
.has_federated_identity_
171 def MergeFrom(self
, x
):
173 if (x
.has_destination_url()): self
.set_destination_url(x
.destination_url())
174 if (x
.has_auth_domain()): self
.set_auth_domain(x
.auth_domain())
175 if (x
.has_federated_identity()): self
.set_federated_identity(x
.federated_identity())
178 if x
is self
: return 1
179 if self
.has_destination_url_
!= x
.has_destination_url_
: return 0
180 if self
.has_destination_url_
and self
.destination_url_
!= x
.destination_url_
: return 0
181 if self
.has_auth_domain_
!= x
.has_auth_domain_
: return 0
182 if self
.has_auth_domain_
and self
.auth_domain_
!= x
.auth_domain_
: return 0
183 if self
.has_federated_identity_
!= x
.has_federated_identity_
: return 0
184 if self
.has_federated_identity_
and self
.federated_identity_
!= x
.federated_identity_
: return 0
187 def IsInitialized(self
, debug_strs
=None):
189 if (not self
.has_destination_url_
):
191 if debug_strs
is not None:
192 debug_strs
.append('Required field: destination_url not set.')
197 n
+= self
.lengthString(len(self
.destination_url_
))
198 if (self
.has_auth_domain_
): n
+= 1 + self
.lengthString(len(self
.auth_domain_
))
199 if (self
.has_federated_identity_
): n
+= 1 + self
.lengthString(len(self
.federated_identity_
))
202 def ByteSizePartial(self
):
204 if (self
.has_destination_url_
):
206 n
+= self
.lengthString(len(self
.destination_url_
))
207 if (self
.has_auth_domain_
): n
+= 1 + self
.lengthString(len(self
.auth_domain_
))
208 if (self
.has_federated_identity_
): n
+= 1 + self
.lengthString(len(self
.federated_identity_
))
212 self
.clear_destination_url()
213 self
.clear_auth_domain()
214 self
.clear_federated_identity()
216 def OutputUnchecked(self
, out
):
218 out
.putPrefixedString(self
.destination_url_
)
219 if (self
.has_auth_domain_
):
221 out
.putPrefixedString(self
.auth_domain_
)
222 if (self
.has_federated_identity_
):
224 out
.putPrefixedString(self
.federated_identity_
)
226 def OutputPartial(self
, out
):
227 if (self
.has_destination_url_
):
229 out
.putPrefixedString(self
.destination_url_
)
230 if (self
.has_auth_domain_
):
232 out
.putPrefixedString(self
.auth_domain_
)
233 if (self
.has_federated_identity_
):
235 out
.putPrefixedString(self
.federated_identity_
)
237 def TryMerge(self
, d
):
241 self
.set_destination_url(d
.getPrefixedString())
244 self
.set_auth_domain(d
.getPrefixedString())
247 self
.set_federated_identity(d
.getPrefixedString())
251 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
255 def __str__(self
, prefix
="", printElemNumber
=0):
257 if self
.has_destination_url_
: res
+=prefix
+("destination_url: %s\n" % self
.DebugFormatString(self
.destination_url_
))
258 if self
.has_auth_domain_
: res
+=prefix
+("auth_domain: %s\n" % self
.DebugFormatString(self
.auth_domain_
))
259 if self
.has_federated_identity_
: res
+=prefix
+("federated_identity: %s\n" % self
.DebugFormatString(self
.federated_identity_
))
263 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
264 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
268 kfederated_identity
= 3
270 _TEXT
= _BuildTagLookupTable({
272 1: "destination_url",
274 3: "federated_identity",
277 _TYPES
= _BuildTagLookupTable({
278 0: ProtocolBuffer
.Encoder
.NUMERIC
,
279 1: ProtocolBuffer
.Encoder
.STRING
,
280 2: ProtocolBuffer
.Encoder
.STRING
,
281 3: ProtocolBuffer
.Encoder
.STRING
,
282 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
286 _STYLE_CONTENT_TYPE
= """"""
287 _PROTO_DESCRIPTOR_NAME
= 'apphosting.CreateLoginURLRequest'
288 class CreateLoginURLResponse(ProtocolBuffer
.ProtocolMessage
):
292 def __init__(self
, contents
=None):
293 if contents
is not None: self
.MergeFromString(contents
)
295 def login_url(self
): return self
.login_url_
297 def set_login_url(self
, x
):
298 self
.has_login_url_
= 1
301 def clear_login_url(self
):
302 if self
.has_login_url_
:
303 self
.has_login_url_
= 0
306 def has_login_url(self
): return self
.has_login_url_
309 def MergeFrom(self
, x
):
311 if (x
.has_login_url()): self
.set_login_url(x
.login_url())
314 if x
is self
: return 1
315 if self
.has_login_url_
!= x
.has_login_url_
: return 0
316 if self
.has_login_url_
and self
.login_url_
!= x
.login_url_
: return 0
319 def IsInitialized(self
, debug_strs
=None):
321 if (not self
.has_login_url_
):
323 if debug_strs
is not None:
324 debug_strs
.append('Required field: login_url not set.')
329 n
+= self
.lengthString(len(self
.login_url_
))
332 def ByteSizePartial(self
):
334 if (self
.has_login_url_
):
336 n
+= self
.lengthString(len(self
.login_url_
))
340 self
.clear_login_url()
342 def OutputUnchecked(self
, out
):
344 out
.putPrefixedString(self
.login_url_
)
346 def OutputPartial(self
, out
):
347 if (self
.has_login_url_
):
349 out
.putPrefixedString(self
.login_url_
)
351 def TryMerge(self
, d
):
355 self
.set_login_url(d
.getPrefixedString())
359 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
363 def __str__(self
, prefix
="", printElemNumber
=0):
365 if self
.has_login_url_
: res
+=prefix
+("login_url: %s\n" % self
.DebugFormatString(self
.login_url_
))
369 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
370 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
374 _TEXT
= _BuildTagLookupTable({
379 _TYPES
= _BuildTagLookupTable({
380 0: ProtocolBuffer
.Encoder
.NUMERIC
,
381 1: ProtocolBuffer
.Encoder
.STRING
,
382 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
386 _STYLE_CONTENT_TYPE
= """"""
387 _PROTO_DESCRIPTOR_NAME
= 'apphosting.CreateLoginURLResponse'
388 class CreateLogoutURLRequest(ProtocolBuffer
.ProtocolMessage
):
389 has_destination_url_
= 0
390 destination_url_
= ""
394 def __init__(self
, contents
=None):
395 if contents
is not None: self
.MergeFromString(contents
)
397 def destination_url(self
): return self
.destination_url_
399 def set_destination_url(self
, x
):
400 self
.has_destination_url_
= 1
401 self
.destination_url_
= x
403 def clear_destination_url(self
):
404 if self
.has_destination_url_
:
405 self
.has_destination_url_
= 0
406 self
.destination_url_
= ""
408 def has_destination_url(self
): return self
.has_destination_url_
410 def auth_domain(self
): return self
.auth_domain_
412 def set_auth_domain(self
, x
):
413 self
.has_auth_domain_
= 1
414 self
.auth_domain_
= x
416 def clear_auth_domain(self
):
417 if self
.has_auth_domain_
:
418 self
.has_auth_domain_
= 0
419 self
.auth_domain_
= ""
421 def has_auth_domain(self
): return self
.has_auth_domain_
424 def MergeFrom(self
, x
):
426 if (x
.has_destination_url()): self
.set_destination_url(x
.destination_url())
427 if (x
.has_auth_domain()): self
.set_auth_domain(x
.auth_domain())
430 if x
is self
: return 1
431 if self
.has_destination_url_
!= x
.has_destination_url_
: return 0
432 if self
.has_destination_url_
and self
.destination_url_
!= x
.destination_url_
: return 0
433 if self
.has_auth_domain_
!= x
.has_auth_domain_
: return 0
434 if self
.has_auth_domain_
and self
.auth_domain_
!= x
.auth_domain_
: return 0
437 def IsInitialized(self
, debug_strs
=None):
439 if (not self
.has_destination_url_
):
441 if debug_strs
is not None:
442 debug_strs
.append('Required field: destination_url not set.')
447 n
+= self
.lengthString(len(self
.destination_url_
))
448 if (self
.has_auth_domain_
): n
+= 1 + self
.lengthString(len(self
.auth_domain_
))
451 def ByteSizePartial(self
):
453 if (self
.has_destination_url_
):
455 n
+= self
.lengthString(len(self
.destination_url_
))
456 if (self
.has_auth_domain_
): n
+= 1 + self
.lengthString(len(self
.auth_domain_
))
460 self
.clear_destination_url()
461 self
.clear_auth_domain()
463 def OutputUnchecked(self
, out
):
465 out
.putPrefixedString(self
.destination_url_
)
466 if (self
.has_auth_domain_
):
468 out
.putPrefixedString(self
.auth_domain_
)
470 def OutputPartial(self
, out
):
471 if (self
.has_destination_url_
):
473 out
.putPrefixedString(self
.destination_url_
)
474 if (self
.has_auth_domain_
):
476 out
.putPrefixedString(self
.auth_domain_
)
478 def TryMerge(self
, d
):
482 self
.set_destination_url(d
.getPrefixedString())
485 self
.set_auth_domain(d
.getPrefixedString())
489 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
493 def __str__(self
, prefix
="", printElemNumber
=0):
495 if self
.has_destination_url_
: res
+=prefix
+("destination_url: %s\n" % self
.DebugFormatString(self
.destination_url_
))
496 if self
.has_auth_domain_
: res
+=prefix
+("auth_domain: %s\n" % self
.DebugFormatString(self
.auth_domain_
))
500 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
501 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
506 _TEXT
= _BuildTagLookupTable({
508 1: "destination_url",
512 _TYPES
= _BuildTagLookupTable({
513 0: ProtocolBuffer
.Encoder
.NUMERIC
,
514 1: ProtocolBuffer
.Encoder
.STRING
,
515 2: ProtocolBuffer
.Encoder
.STRING
,
516 }, 2, ProtocolBuffer
.Encoder
.MAX_TYPE
)
520 _STYLE_CONTENT_TYPE
= """"""
521 _PROTO_DESCRIPTOR_NAME
= 'apphosting.CreateLogoutURLRequest'
522 class CreateLogoutURLResponse(ProtocolBuffer
.ProtocolMessage
):
526 def __init__(self
, contents
=None):
527 if contents
is not None: self
.MergeFromString(contents
)
529 def logout_url(self
): return self
.logout_url_
531 def set_logout_url(self
, x
):
532 self
.has_logout_url_
= 1
535 def clear_logout_url(self
):
536 if self
.has_logout_url_
:
537 self
.has_logout_url_
= 0
538 self
.logout_url_
= ""
540 def has_logout_url(self
): return self
.has_logout_url_
543 def MergeFrom(self
, x
):
545 if (x
.has_logout_url()): self
.set_logout_url(x
.logout_url())
548 if x
is self
: return 1
549 if self
.has_logout_url_
!= x
.has_logout_url_
: return 0
550 if self
.has_logout_url_
and self
.logout_url_
!= x
.logout_url_
: return 0
553 def IsInitialized(self
, debug_strs
=None):
555 if (not self
.has_logout_url_
):
557 if debug_strs
is not None:
558 debug_strs
.append('Required field: logout_url not set.')
563 n
+= self
.lengthString(len(self
.logout_url_
))
566 def ByteSizePartial(self
):
568 if (self
.has_logout_url_
):
570 n
+= self
.lengthString(len(self
.logout_url_
))
574 self
.clear_logout_url()
576 def OutputUnchecked(self
, out
):
578 out
.putPrefixedString(self
.logout_url_
)
580 def OutputPartial(self
, out
):
581 if (self
.has_logout_url_
):
583 out
.putPrefixedString(self
.logout_url_
)
585 def TryMerge(self
, d
):
589 self
.set_logout_url(d
.getPrefixedString())
593 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
597 def __str__(self
, prefix
="", printElemNumber
=0):
599 if self
.has_logout_url_
: res
+=prefix
+("logout_url: %s\n" % self
.DebugFormatString(self
.logout_url_
))
603 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
604 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
608 _TEXT
= _BuildTagLookupTable({
613 _TYPES
= _BuildTagLookupTable({
614 0: ProtocolBuffer
.Encoder
.NUMERIC
,
615 1: ProtocolBuffer
.Encoder
.STRING
,
616 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
620 _STYLE_CONTENT_TYPE
= """"""
621 _PROTO_DESCRIPTOR_NAME
= 'apphosting.CreateLogoutURLResponse'
622 class GetOAuthUserRequest(ProtocolBuffer
.ProtocolMessage
):
625 has_request_writer_permission_
= 0
626 request_writer_permission_
= 0
628 def __init__(self
, contents
=None):
630 if contents
is not None: self
.MergeFromString(contents
)
632 def scope(self
): return self
.scope_
634 def set_scope(self
, x
):
638 def clear_scope(self
):
643 def has_scope(self
): return self
.has_scope_
645 def scopes_size(self
): return len(self
.scopes_
)
646 def scopes_list(self
): return self
.scopes_
649 return self
.scopes_
[i
]
651 def set_scopes(self
, i
, x
):
654 def add_scopes(self
, x
):
655 self
.scopes_
.append(x
)
657 def clear_scopes(self
):
660 def request_writer_permission(self
): return self
.request_writer_permission_
662 def set_request_writer_permission(self
, x
):
663 self
.has_request_writer_permission_
= 1
664 self
.request_writer_permission_
= x
666 def clear_request_writer_permission(self
):
667 if self
.has_request_writer_permission_
:
668 self
.has_request_writer_permission_
= 0
669 self
.request_writer_permission_
= 0
671 def has_request_writer_permission(self
): return self
.has_request_writer_permission_
674 def MergeFrom(self
, x
):
676 if (x
.has_scope()): self
.set_scope(x
.scope())
677 for i
in xrange(x
.scopes_size()): self
.add_scopes(x
.scopes(i
))
678 if (x
.has_request_writer_permission()): self
.set_request_writer_permission(x
.request_writer_permission())
681 if x
is self
: return 1
682 if self
.has_scope_
!= x
.has_scope_
: return 0
683 if self
.has_scope_
and self
.scope_
!= x
.scope_
: return 0
684 if len(self
.scopes_
) != len(x
.scopes_
): return 0
685 for e1
, e2
in zip(self
.scopes_
, x
.scopes_
):
686 if e1
!= e2
: return 0
687 if self
.has_request_writer_permission_
!= x
.has_request_writer_permission_
: return 0
688 if self
.has_request_writer_permission_
and self
.request_writer_permission_
!= x
.request_writer_permission_
: return 0
691 def IsInitialized(self
, debug_strs
=None):
697 if (self
.has_scope_
): n
+= 1 + self
.lengthString(len(self
.scope_
))
698 n
+= 1 * len(self
.scopes_
)
699 for i
in xrange(len(self
.scopes_
)): n
+= self
.lengthString(len(self
.scopes_
[i
]))
700 if (self
.has_request_writer_permission_
): n
+= 2
703 def ByteSizePartial(self
):
705 if (self
.has_scope_
): n
+= 1 + self
.lengthString(len(self
.scope_
))
706 n
+= 1 * len(self
.scopes_
)
707 for i
in xrange(len(self
.scopes_
)): n
+= self
.lengthString(len(self
.scopes_
[i
]))
708 if (self
.has_request_writer_permission_
): n
+= 2
714 self
.clear_request_writer_permission()
716 def OutputUnchecked(self
, out
):
717 if (self
.has_scope_
):
719 out
.putPrefixedString(self
.scope_
)
720 for i
in xrange(len(self
.scopes_
)):
722 out
.putPrefixedString(self
.scopes_
[i
])
723 if (self
.has_request_writer_permission_
):
725 out
.putBoolean(self
.request_writer_permission_
)
727 def OutputPartial(self
, out
):
728 if (self
.has_scope_
):
730 out
.putPrefixedString(self
.scope_
)
731 for i
in xrange(len(self
.scopes_
)):
733 out
.putPrefixedString(self
.scopes_
[i
])
734 if (self
.has_request_writer_permission_
):
736 out
.putBoolean(self
.request_writer_permission_
)
738 def TryMerge(self
, d
):
742 self
.set_scope(d
.getPrefixedString())
745 self
.add_scopes(d
.getPrefixedString())
748 self
.set_request_writer_permission(d
.getBoolean())
752 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
756 def __str__(self
, prefix
="", printElemNumber
=0):
758 if self
.has_scope_
: res
+=prefix
+("scope: %s\n" % self
.DebugFormatString(self
.scope_
))
760 for e
in self
.scopes_
:
762 if printElemNumber
: elm
="(%d)" % cnt
763 res
+=prefix
+("scopes%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
765 if self
.has_request_writer_permission_
: res
+=prefix
+("request_writer_permission: %s\n" % self
.DebugFormatBool(self
.request_writer_permission_
))
769 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
770 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
774 krequest_writer_permission
= 3
776 _TEXT
= _BuildTagLookupTable({
780 3: "request_writer_permission",
783 _TYPES
= _BuildTagLookupTable({
784 0: ProtocolBuffer
.Encoder
.NUMERIC
,
785 1: ProtocolBuffer
.Encoder
.STRING
,
786 2: ProtocolBuffer
.Encoder
.STRING
,
787 3: ProtocolBuffer
.Encoder
.NUMERIC
,
788 }, 3, ProtocolBuffer
.Encoder
.MAX_TYPE
)
792 _STYLE_CONTENT_TYPE
= """"""
793 _PROTO_DESCRIPTOR_NAME
= 'apphosting.GetOAuthUserRequest'
794 class GetOAuthUserResponse(ProtocolBuffer
.ProtocolMessage
):
801 has_user_organization_
= 0
802 user_organization_
= ""
807 has_is_project_writer_
= 0
808 is_project_writer_
= 0
810 def __init__(self
, contents
=None):
812 if contents
is not None: self
.MergeFromString(contents
)
814 def email(self
): return self
.email_
816 def set_email(self
, x
):
820 def clear_email(self
):
825 def has_email(self
): return self
.has_email_
827 def user_id(self
): return self
.user_id_
829 def set_user_id(self
, x
):
830 self
.has_user_id_
= 1
833 def clear_user_id(self
):
834 if self
.has_user_id_
:
835 self
.has_user_id_
= 0
838 def has_user_id(self
): return self
.has_user_id_
840 def auth_domain(self
): return self
.auth_domain_
842 def set_auth_domain(self
, x
):
843 self
.has_auth_domain_
= 1
844 self
.auth_domain_
= x
846 def clear_auth_domain(self
):
847 if self
.has_auth_domain_
:
848 self
.has_auth_domain_
= 0
849 self
.auth_domain_
= ""
851 def has_auth_domain(self
): return self
.has_auth_domain_
853 def user_organization(self
): return self
.user_organization_
855 def set_user_organization(self
, x
):
856 self
.has_user_organization_
= 1
857 self
.user_organization_
= x
859 def clear_user_organization(self
):
860 if self
.has_user_organization_
:
861 self
.has_user_organization_
= 0
862 self
.user_organization_
= ""
864 def has_user_organization(self
): return self
.has_user_organization_
866 def is_admin(self
): return self
.is_admin_
868 def set_is_admin(self
, x
):
869 self
.has_is_admin_
= 1
872 def clear_is_admin(self
):
873 if self
.has_is_admin_
:
874 self
.has_is_admin_
= 0
877 def has_is_admin(self
): return self
.has_is_admin_
879 def client_id(self
): return self
.client_id_
881 def set_client_id(self
, x
):
882 self
.has_client_id_
= 1
885 def clear_client_id(self
):
886 if self
.has_client_id_
:
887 self
.has_client_id_
= 0
890 def has_client_id(self
): return self
.has_client_id_
892 def scopes_size(self
): return len(self
.scopes_
)
893 def scopes_list(self
): return self
.scopes_
896 return self
.scopes_
[i
]
898 def set_scopes(self
, i
, x
):
901 def add_scopes(self
, x
):
902 self
.scopes_
.append(x
)
904 def clear_scopes(self
):
907 def is_project_writer(self
): return self
.is_project_writer_
909 def set_is_project_writer(self
, x
):
910 self
.has_is_project_writer_
= 1
911 self
.is_project_writer_
= x
913 def clear_is_project_writer(self
):
914 if self
.has_is_project_writer_
:
915 self
.has_is_project_writer_
= 0
916 self
.is_project_writer_
= 0
918 def has_is_project_writer(self
): return self
.has_is_project_writer_
921 def MergeFrom(self
, x
):
923 if (x
.has_email()): self
.set_email(x
.email())
924 if (x
.has_user_id()): self
.set_user_id(x
.user_id())
925 if (x
.has_auth_domain()): self
.set_auth_domain(x
.auth_domain())
926 if (x
.has_user_organization()): self
.set_user_organization(x
.user_organization())
927 if (x
.has_is_admin()): self
.set_is_admin(x
.is_admin())
928 if (x
.has_client_id()): self
.set_client_id(x
.client_id())
929 for i
in xrange(x
.scopes_size()): self
.add_scopes(x
.scopes(i
))
930 if (x
.has_is_project_writer()): self
.set_is_project_writer(x
.is_project_writer())
933 if x
is self
: return 1
934 if self
.has_email_
!= x
.has_email_
: return 0
935 if self
.has_email_
and self
.email_
!= x
.email_
: return 0
936 if self
.has_user_id_
!= x
.has_user_id_
: return 0
937 if self
.has_user_id_
and self
.user_id_
!= x
.user_id_
: return 0
938 if self
.has_auth_domain_
!= x
.has_auth_domain_
: return 0
939 if self
.has_auth_domain_
and self
.auth_domain_
!= x
.auth_domain_
: return 0
940 if self
.has_user_organization_
!= x
.has_user_organization_
: return 0
941 if self
.has_user_organization_
and self
.user_organization_
!= x
.user_organization_
: return 0
942 if self
.has_is_admin_
!= x
.has_is_admin_
: return 0
943 if self
.has_is_admin_
and self
.is_admin_
!= x
.is_admin_
: return 0
944 if self
.has_client_id_
!= x
.has_client_id_
: return 0
945 if self
.has_client_id_
and self
.client_id_
!= x
.client_id_
: return 0
946 if len(self
.scopes_
) != len(x
.scopes_
): return 0
947 for e1
, e2
in zip(self
.scopes_
, x
.scopes_
):
948 if e1
!= e2
: return 0
949 if self
.has_is_project_writer_
!= x
.has_is_project_writer_
: return 0
950 if self
.has_is_project_writer_
and self
.is_project_writer_
!= x
.is_project_writer_
: return 0
953 def IsInitialized(self
, debug_strs
=None):
955 if (not self
.has_email_
):
957 if debug_strs
is not None:
958 debug_strs
.append('Required field: email not set.')
959 if (not self
.has_user_id_
):
961 if debug_strs
is not None:
962 debug_strs
.append('Required field: user_id not set.')
963 if (not self
.has_auth_domain_
):
965 if debug_strs
is not None:
966 debug_strs
.append('Required field: auth_domain not set.')
971 n
+= self
.lengthString(len(self
.email_
))
972 n
+= self
.lengthString(len(self
.user_id_
))
973 n
+= self
.lengthString(len(self
.auth_domain_
))
974 if (self
.has_user_organization_
): n
+= 1 + self
.lengthString(len(self
.user_organization_
))
975 if (self
.has_is_admin_
): n
+= 2
976 if (self
.has_client_id_
): n
+= 1 + self
.lengthString(len(self
.client_id_
))
977 n
+= 1 * len(self
.scopes_
)
978 for i
in xrange(len(self
.scopes_
)): n
+= self
.lengthString(len(self
.scopes_
[i
]))
979 if (self
.has_is_project_writer_
): n
+= 2
982 def ByteSizePartial(self
):
984 if (self
.has_email_
):
986 n
+= self
.lengthString(len(self
.email_
))
987 if (self
.has_user_id_
):
989 n
+= self
.lengthString(len(self
.user_id_
))
990 if (self
.has_auth_domain_
):
992 n
+= self
.lengthString(len(self
.auth_domain_
))
993 if (self
.has_user_organization_
): n
+= 1 + self
.lengthString(len(self
.user_organization_
))
994 if (self
.has_is_admin_
): n
+= 2
995 if (self
.has_client_id_
): n
+= 1 + self
.lengthString(len(self
.client_id_
))
996 n
+= 1 * len(self
.scopes_
)
997 for i
in xrange(len(self
.scopes_
)): n
+= self
.lengthString(len(self
.scopes_
[i
]))
998 if (self
.has_is_project_writer_
): n
+= 2
1003 self
.clear_user_id()
1004 self
.clear_auth_domain()
1005 self
.clear_user_organization()
1006 self
.clear_is_admin()
1007 self
.clear_client_id()
1009 self
.clear_is_project_writer()
1011 def OutputUnchecked(self
, out
):
1013 out
.putPrefixedString(self
.email_
)
1015 out
.putPrefixedString(self
.user_id_
)
1017 out
.putPrefixedString(self
.auth_domain_
)
1018 if (self
.has_user_organization_
):
1020 out
.putPrefixedString(self
.user_organization_
)
1021 if (self
.has_is_admin_
):
1023 out
.putBoolean(self
.is_admin_
)
1024 if (self
.has_client_id_
):
1026 out
.putPrefixedString(self
.client_id_
)
1027 for i
in xrange(len(self
.scopes_
)):
1029 out
.putPrefixedString(self
.scopes_
[i
])
1030 if (self
.has_is_project_writer_
):
1032 out
.putBoolean(self
.is_project_writer_
)
1034 def OutputPartial(self
, out
):
1035 if (self
.has_email_
):
1037 out
.putPrefixedString(self
.email_
)
1038 if (self
.has_user_id_
):
1040 out
.putPrefixedString(self
.user_id_
)
1041 if (self
.has_auth_domain_
):
1043 out
.putPrefixedString(self
.auth_domain_
)
1044 if (self
.has_user_organization_
):
1046 out
.putPrefixedString(self
.user_organization_
)
1047 if (self
.has_is_admin_
):
1049 out
.putBoolean(self
.is_admin_
)
1050 if (self
.has_client_id_
):
1052 out
.putPrefixedString(self
.client_id_
)
1053 for i
in xrange(len(self
.scopes_
)):
1055 out
.putPrefixedString(self
.scopes_
[i
])
1056 if (self
.has_is_project_writer_
):
1058 out
.putBoolean(self
.is_project_writer_
)
1060 def TryMerge(self
, d
):
1061 while d
.avail() > 0:
1062 tt
= d
.getVarInt32()
1064 self
.set_email(d
.getPrefixedString())
1067 self
.set_user_id(d
.getPrefixedString())
1070 self
.set_auth_domain(d
.getPrefixedString())
1073 self
.set_user_organization(d
.getPrefixedString())
1076 self
.set_is_admin(d
.getBoolean())
1079 self
.set_client_id(d
.getPrefixedString())
1082 self
.add_scopes(d
.getPrefixedString())
1085 self
.set_is_project_writer(d
.getBoolean())
1089 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1093 def __str__(self
, prefix
="", printElemNumber
=0):
1095 if self
.has_email_
: res
+=prefix
+("email: %s\n" % self
.DebugFormatString(self
.email_
))
1096 if self
.has_user_id_
: res
+=prefix
+("user_id: %s\n" % self
.DebugFormatString(self
.user_id_
))
1097 if self
.has_auth_domain_
: res
+=prefix
+("auth_domain: %s\n" % self
.DebugFormatString(self
.auth_domain_
))
1098 if self
.has_user_organization_
: res
+=prefix
+("user_organization: %s\n" % self
.DebugFormatString(self
.user_organization_
))
1099 if self
.has_is_admin_
: res
+=prefix
+("is_admin: %s\n" % self
.DebugFormatBool(self
.is_admin_
))
1100 if self
.has_client_id_
: res
+=prefix
+("client_id: %s\n" % self
.DebugFormatString(self
.client_id_
))
1102 for e
in self
.scopes_
:
1104 if printElemNumber
: elm
="(%d)" % cnt
1105 res
+=prefix
+("scopes%s: %s\n" % (elm
, self
.DebugFormatString(e
)))
1107 if self
.has_is_project_writer_
: res
+=prefix
+("is_project_writer: %s\n" % self
.DebugFormatBool(self
.is_project_writer_
))
1111 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1112 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1117 kuser_organization
= 4
1121 kis_project_writer
= 8
1123 _TEXT
= _BuildTagLookupTable({
1128 4: "user_organization",
1132 8: "is_project_writer",
1135 _TYPES
= _BuildTagLookupTable({
1136 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1137 1: ProtocolBuffer
.Encoder
.STRING
,
1138 2: ProtocolBuffer
.Encoder
.STRING
,
1139 3: ProtocolBuffer
.Encoder
.STRING
,
1140 4: ProtocolBuffer
.Encoder
.STRING
,
1141 5: ProtocolBuffer
.Encoder
.NUMERIC
,
1142 6: ProtocolBuffer
.Encoder
.STRING
,
1143 7: ProtocolBuffer
.Encoder
.STRING
,
1144 8: ProtocolBuffer
.Encoder
.NUMERIC
,
1145 }, 8, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1149 _STYLE_CONTENT_TYPE
= """"""
1150 _PROTO_DESCRIPTOR_NAME
= 'apphosting.GetOAuthUserResponse'
1151 class CheckOAuthSignatureRequest(ProtocolBuffer
.ProtocolMessage
):
1153 def __init__(self
, contents
=None):
1155 if contents
is not None: self
.MergeFromString(contents
)
1158 def MergeFrom(self
, x
):
1159 assert x
is not self
1161 def Equals(self
, x
):
1162 if x
is self
: return 1
1165 def IsInitialized(self
, debug_strs
=None):
1173 def ByteSizePartial(self
):
1180 def OutputUnchecked(self
, out
):
1183 def OutputPartial(self
, out
):
1186 def TryMerge(self
, d
):
1187 while d
.avail() > 0:
1188 tt
= d
.getVarInt32()
1191 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1195 def __str__(self
, prefix
="", printElemNumber
=0):
1200 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1201 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1204 _TEXT
= _BuildTagLookupTable({
1208 _TYPES
= _BuildTagLookupTable({
1209 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1210 }, 0, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1214 _STYLE_CONTENT_TYPE
= """"""
1215 _PROTO_DESCRIPTOR_NAME
= 'apphosting.CheckOAuthSignatureRequest'
1216 class CheckOAuthSignatureResponse(ProtocolBuffer
.ProtocolMessage
):
1217 has_oauth_consumer_key_
= 0
1218 oauth_consumer_key_
= ""
1220 def __init__(self
, contents
=None):
1221 if contents
is not None: self
.MergeFromString(contents
)
1223 def oauth_consumer_key(self
): return self
.oauth_consumer_key_
1225 def set_oauth_consumer_key(self
, x
):
1226 self
.has_oauth_consumer_key_
= 1
1227 self
.oauth_consumer_key_
= x
1229 def clear_oauth_consumer_key(self
):
1230 if self
.has_oauth_consumer_key_
:
1231 self
.has_oauth_consumer_key_
= 0
1232 self
.oauth_consumer_key_
= ""
1234 def has_oauth_consumer_key(self
): return self
.has_oauth_consumer_key_
1237 def MergeFrom(self
, x
):
1238 assert x
is not self
1239 if (x
.has_oauth_consumer_key()): self
.set_oauth_consumer_key(x
.oauth_consumer_key())
1241 def Equals(self
, x
):
1242 if x
is self
: return 1
1243 if self
.has_oauth_consumer_key_
!= x
.has_oauth_consumer_key_
: return 0
1244 if self
.has_oauth_consumer_key_
and self
.oauth_consumer_key_
!= x
.oauth_consumer_key_
: return 0
1247 def IsInitialized(self
, debug_strs
=None):
1249 if (not self
.has_oauth_consumer_key_
):
1251 if debug_strs
is not None:
1252 debug_strs
.append('Required field: oauth_consumer_key not set.')
1257 n
+= self
.lengthString(len(self
.oauth_consumer_key_
))
1260 def ByteSizePartial(self
):
1262 if (self
.has_oauth_consumer_key_
):
1264 n
+= self
.lengthString(len(self
.oauth_consumer_key_
))
1268 self
.clear_oauth_consumer_key()
1270 def OutputUnchecked(self
, out
):
1272 out
.putPrefixedString(self
.oauth_consumer_key_
)
1274 def OutputPartial(self
, out
):
1275 if (self
.has_oauth_consumer_key_
):
1277 out
.putPrefixedString(self
.oauth_consumer_key_
)
1279 def TryMerge(self
, d
):
1280 while d
.avail() > 0:
1281 tt
= d
.getVarInt32()
1283 self
.set_oauth_consumer_key(d
.getPrefixedString())
1287 if (tt
== 0): raise ProtocolBuffer
.ProtocolBufferDecodeError
1291 def __str__(self
, prefix
="", printElemNumber
=0):
1293 if self
.has_oauth_consumer_key_
: res
+=prefix
+("oauth_consumer_key: %s\n" % self
.DebugFormatString(self
.oauth_consumer_key_
))
1297 def _BuildTagLookupTable(sparse
, maxtag
, default
=None):
1298 return tuple([sparse
.get(i
, default
) for i
in xrange(0, 1+maxtag
)])
1300 koauth_consumer_key
= 1
1302 _TEXT
= _BuildTagLookupTable({
1304 1: "oauth_consumer_key",
1307 _TYPES
= _BuildTagLookupTable({
1308 0: ProtocolBuffer
.Encoder
.NUMERIC
,
1309 1: ProtocolBuffer
.Encoder
.STRING
,
1310 }, 1, ProtocolBuffer
.Encoder
.MAX_TYPE
)
1314 _STYLE_CONTENT_TYPE
= """"""
1315 _PROTO_DESCRIPTOR_NAME
= 'apphosting.CheckOAuthSignatureResponse'
1316 if _extension_runtime
:
1319 __all__
= ['UserServiceError','CreateLoginURLRequest','CreateLoginURLResponse','CreateLogoutURLRequest','CreateLogoutURLResponse','GetOAuthUserRequest','GetOAuthUserResponse','CheckOAuthSignatureRequest','CheckOAuthSignatureResponse']