class AllTypes(messages.Message): """Contains all field types.""" class SimpleEnum(messages.Enum): """Simple enumeration type.""" VAL1 = 1 VAL2 = 2 bool_value = messages.BooleanField(1, variant=messages.Variant.BOOL) bytes_value = messages.BytesField(2, variant=messages.Variant.BYTES) double_value = messages.FloatField(3, variant=messages.Variant.DOUBLE) enum_value = messages.EnumField(SimpleEnum, 4) float_value = messages.FloatField(5, variant=messages.Variant.FLOAT) int32_value = messages.IntegerField(6, variant=messages.Variant.INT32) int64_value = messages.IntegerField(7, variant=messages.Variant.INT64) string_value = messages.StringField( 8, variant=messages.Variant.STRING) uint32_value = messages.IntegerField( 9, variant=messages.Variant.UINT32) uint64_value = messages.IntegerField( 10, variant=messages.Variant.UINT64) int_value = messages.IntegerField(11) # Default variant is INT64. datetime_value = message_types.DateTimeField(12) repeated_datetime_value = message_types.DateTimeField( 13, repeated=True)
class MoveRequest(messages.Message): board_id = messages.StringField(1) item_id = messages.StringField(2) x = messages.IntegerField(3) y = messages.IntegerField(4) z = messages.IntegerField(5) client_id = messages.StringField(6) lock_token = messages.StringField(7) is_release = messages.BooleanField(8, default=False)
class AllBasicFields(messages.Message): """Contains all field types.""" bool_value = messages.BooleanField(1, variant=messages.Variant.BOOL) bytes_value = messages.BytesField(2, variant=messages.Variant.BYTES) double_value = messages.FloatField(3, variant=messages.Variant.DOUBLE) float_value = messages.FloatField(5, variant=messages.Variant.FLOAT) int32_value = messages.IntegerField(6, variant=messages.Variant.INT32) int64_value = messages.IntegerField(7, variant=messages.Variant.INT64) string_value = messages.StringField(8, variant=messages.Variant.STRING) uint32_value = messages.IntegerField(9, variant=messages.Variant.UINT32) uint64_value = messages.IntegerField(10, variant=messages.Variant.UINT64) sint32_value = messages.IntegerField(11, variant=messages.Variant.SINT32) sint64_value = messages.IntegerField(12, variant=messages.Variant.SINT64) datetime_value = message_types.DateTimeField(14)
class MultipleParameterEndpoint(remote.Service): @endpoints.method(endpoints.ResourceContainer( message_types.VoidMessage, parent=messages.StringField(1, required=True), query=messages.StringField(2, required=False), child=messages.StringField(3, required=True), queryb=messages.StringField(4, required=True), querya=messages.StringField(5, required=True), allow=messages.BooleanField(6, default=True), ), message_types.VoidMessage, name='param', path='param/{parent}/{child}') def param(self, request): pass
class AddEventResponse(messages.Message): """"Response object for addEvent API method""" content = messages.BooleanField(1)
class Bar(messages.Message): name = messages.StringField(1, default='Jimothy') value = messages.IntegerField(2, default=42, variant=messages.Variant.INT32) active = messages.BooleanField(3, default=True)
class BooleanMessageResponse(messages.Message): result = messages.BooleanField(1, required=True)