Exemplo n.º 1
0
class RepeatedMessage(messages.Message):
    """Contains all message types as repeated fields."""
    class SimpleEnum(messages.Enum):
        """Simple enumeration type."""
        VAL1 = 1
        VAL2 = 2

    double_value = messages.FloatField(variant=messages.Variant.DOUBLE,
                                       repeated=True)
    float_value = messages.FloatField(variant=messages.Variant.FLOAT,
                                      repeated=True)
    int64_value = messages.IntegerField(variant=messages.Variant.INT64,
                                        repeated=True)
    uint64_value = messages.IntegerField(variant=messages.Variant.UINT64,
                                         repeated=True)
    int32_value = messages.IntegerField(variant=messages.Variant.INT32,
                                        repeated=True)
    bool_value = messages.BooleanField(variant=messages.Variant.BOOL,
                                       repeated=True)
    string_value = messages.StringField(variant=messages.Variant.STRING,
                                        repeated=True)
    bytes_value = messages.BytesField(variant=messages.Variant.BYTES,
                                      repeated=True)
    #uint32_value = messages.IntegerField(variant=messages.Variant.UINT32)
    enum_value = messages.EnumField(SimpleEnum, repeated=True)
Exemplo n.º 2
0
class MyMessage(messages.Message):
    """Test message containing various types."""
    class Color(messages.Enum):
        RED = 1
        GREEN = 2
        BLUE = 3

    class Nested(messages.Message):
        nested_value = messages.StringField()

    a_string = messages.StringField()
    an_integer = messages.IntegerField()
    a_float = messages.FloatField()
    a_boolean = messages.BooleanField()
    an_enum = messages.EnumField(Color)
    a_nested = messages.MessageField(Nested)
    a_repeated = messages.IntegerField(repeated=True)
    a_repeated_float = messages.FloatField(repeated=True)
    a_datetime_iso8601 = messages.DateTimeISO8601Field()
    a_repeated_datetime_iso8601 = messages.DateTimeISO8601Field(repeated=True)
    a_datetime_ms_integer = messages.DateTimeMsIntegerField()
    a_repeated_datetime_ms_integer = messages.DateTimeMsIntegerField(
        repeated=True)
    a_custom = CustomField()
    a_repeated_custom = CustomField(repeated=True)
    a_uuid = messages.UUIDField()
    a_repeated_uuid = messages.UUIDField(repeated=True)
Exemplo n.º 3
0
class OptionalMessage(messages.Message):
    """Contains all message types."""
    class SimpleEnum(messages.Enum):
        """Simple enumeration type."""
        VAL1 = 1
        VAL2 = 2

    double_value = messages.FloatField(variant=messages.Variant.DOUBLE)
    float_value = messages.FloatField(variant=messages.Variant.FLOAT)
    int64_value = messages.IntegerField(variant=messages.Variant.INT64)
    uint64_value = messages.IntegerField(variant=messages.Variant.UINT64)
    int32_value = messages.IntegerField(variant=messages.Variant.INT32)
    bool_value = messages.BooleanField(variant=messages.Variant.BOOL)
    string_value = messages.StringField(variant=messages.Variant.STRING)
    bytes_value = messages.BytesField(variant=messages.Variant.BYTES)
    enum_value = messages.EnumField(SimpleEnum)
Exemplo n.º 4
0
 class GrabBag(messages.Message):
     item_count = messages.IntegerField()
     items = messages.DictField()
Exemplo n.º 5
0
class TeamsResponseMessage(messages.Message):
    page = messages.IntegerField()
    teams = messages.MessageField(TeamMessage)
Exemplo n.º 6
0
 class Animals(messages.Message):
     animals = messages.MessageField(Animal, repeated=True)
     number = messages.IntegerField()
Exemplo n.º 7
0
 class Animal(messages.Message):
     name = messages.StringField()
     size = messages.IntegerField()
Exemplo n.º 8
0
 class Animals(messages.Message):
     animals = messages.StringField(repeated=True)
     number = messages.IntegerField()
Exemplo n.º 9
0
 class MyMessage(messages.Message):
     number = messages.IntegerField()
Exemplo n.º 10
0
 class MyMessage(messages.Message):
     number = messages.IntegerField()
     names = messages.StringField(repeated=True)
Exemplo n.º 11
0
 class HasRepeated(messages.Message):
     values = messages.IntegerField(repeated=True)