Exemplo n.º 1
0
class JsonValue(messages.Message):
    """Any valid JSON value."""
    # Is this JSON object `null`?
    is_null = messages.BooleanField(1, default=False)

    # Exactly one of the following is provided if is_null is False; none
    # should be provided if is_null is True.
    boolean_value = messages.BooleanField(2)
    string_value = messages.StringField(3)
    # We keep two numeric fields to keep int64 round-trips exact.
    double_value = messages.FloatField(4, variant=messages.Variant.DOUBLE)
    integer_value = messages.IntegerField(5, variant=messages.Variant.INT64)
    # Compound types
    object_value = messages.MessageField('JsonObject', 6)
    array_value = messages.MessageField('JsonArray', 7)
Exemplo n.º 2
0
    class Property(messages.Message):
        """A property of a JSON object.

    Fields:
      key: Name of the property.
      value: A JsonValue attribute.
    """
        key = messages.StringField(1)
        value = messages.MessageField(JsonValue, 2)
Exemplo n.º 3
0
class JsonObject(messages.Message):
    """A JSON object value.

  Messages:
    Property: A property of a JsonObject.

  Fields:
    properties: A list of properties of a JsonObject.
  """
    class Property(messages.Message):
        """A property of a JSON object.

    Fields:
      key: Name of the property.
      value: A JsonValue attribute.
    """
        key = messages.StringField(1)
        value = messages.MessageField(JsonValue, 2)

    properties = messages.MessageField(Property, 1, repeated=True)
Exemplo n.º 4
0
class ApiMethodInfo(messages.Message):
    """Configuration info for an API method.

  All fields are strings unless noted otherwise.

  Fields:
    relative_path: Relative path for this method.
    method_id: ID for this method.
    http_method: HTTP verb to use for this method.
    path_params: (repeated) path parameters for this method.
    query_params: (repeated) query parameters for this method.
    ordered_params: (repeated) ordered list of parameters for
        this method.
    description: description of this method.
    request_type_name: name of the request type.
    response_type_name: name of the response type.
    request_field: if not null, the field to pass as the body
        of this POST request. may also be the REQUEST_IS_BODY
        value below to indicate the whole message is the body.
    upload_config: (ApiUploadInfo) Information about the upload
        configuration supported by this method.
    supports_download: (boolean) If True, this method supports
        downloading the request via the `alt=media` query
        parameter.
  """

    relative_path = messages.StringField(1)
    method_id = messages.StringField(2)
    http_method = messages.StringField(3)
    path_params = messages.StringField(4, repeated=True)
    query_params = messages.StringField(5, repeated=True)
    ordered_params = messages.StringField(6, repeated=True)
    description = messages.StringField(7)
    request_type_name = messages.StringField(8)
    response_type_name = messages.StringField(9)
    request_field = messages.StringField(10, default='')
    upload_config = messages.MessageField(ApiUploadInfo, 11)
    supports_download = messages.BooleanField(12, default=False)
Exemplo n.º 5
0
class JsonArray(messages.Message):
    """A JSON array value."""
    entries = messages.MessageField(JsonValue, 1, repeated=True)