Class HttpBody.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder<MessageType,BuilderType>
com.google.protobuf.GeneratedMessageLite.Builder<HttpBody,HttpBody.Builder>
com.google.api.HttpBody.Builder
All Implemented Interfaces:
HttpBodyOrBuilder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, Cloneable
Enclosing class:
HttpBody

public static final class HttpBody.Builder extends com.google.protobuf.GeneratedMessageLite.Builder<HttpBody,HttpBody.Builder> implements HttpBodyOrBuilder
 Message that represents an arbitrary HTTP body. It should only be used for
 payload formats that can't be represented as JSON, such as raw binary or
 an HTML page.


 This message can be used both in streaming and non-streaming API methods in
 the request as well as the response.

 It can be used as a top-level request field, which is convenient if one
 wants to extract parameters from either the URL or HTTP template into the
 request fields and also want access to the raw HTTP body.

 Example:

 message GetResourceRequest {
 // A unique request id.
 string request_id = 1;

 // The raw HTTP body is bound to this field.
 google.api.HttpBody http_body = 2;

 }

 service ResourceService {
 rpc GetResource(GetResourceRequest)
 returns (google.api.HttpBody);
 rpc UpdateResource(google.api.HttpBody)
 returns (google.protobuf.Empty);

 }

 Example with streaming methods:

 service CaldavService {
 rpc GetCalendar(stream google.api.HttpBody)
 returns (stream google.api.HttpBody);
 rpc UpdateCalendar(stream google.api.HttpBody)
 returns (stream google.api.HttpBody);

 }

 Use of this type only changes how the request and response bodies are
 handled, all other features will continue to work unchanged.
 
Protobuf type google.api.HttpBody
  • Field Summary

    Fields inherited from class com.google.protobuf.GeneratedMessageLite.Builder

    instance
  • Method Summary

    Modifier and Type
    Method
    Description
    addAllExtensions(Iterable<? extends com.google.protobuf.Any> values)
    Application specific response metadata.
    addExtensions(int index, com.google.protobuf.Any value)
    Application specific response metadata.
    addExtensions(int index, com.google.protobuf.Any.Builder builderForValue)
    Application specific response metadata.
    addExtensions(com.google.protobuf.Any value)
    Application specific response metadata.
    addExtensions(com.google.protobuf.Any.Builder builderForValue)
    Application specific response metadata.
    The HTTP Content-Type header value specifying the content type of the body.
    The HTTP request/response body as raw binary.
    Application specific response metadata.
    The HTTP Content-Type header value specifying the content type of the body.
    com.google.protobuf.ByteString
    The HTTP Content-Type header value specifying the content type of the body.
    com.google.protobuf.ByteString
    The HTTP request/response body as raw binary.
    com.google.protobuf.Any
    getExtensions(int index)
    Application specific response metadata.
    int
    Application specific response metadata.
    List<com.google.protobuf.Any>
    Application specific response metadata.
    removeExtensions(int index)
    Application specific response metadata.
    The HTTP Content-Type header value specifying the content type of the body.
    setContentTypeBytes(com.google.protobuf.ByteString value)
    The HTTP Content-Type header value specifying the content type of the body.
    setData(com.google.protobuf.ByteString value)
    The HTTP request/response body as raw binary.
    setExtensions(int index, com.google.protobuf.Any value)
    Application specific response metadata.
    setExtensions(int index, com.google.protobuf.Any.Builder builderForValue)
    Application specific response metadata.

    Methods inherited from class com.google.protobuf.GeneratedMessageLite.Builder

    build, buildPartial, clear, clone, copyOnWrite, copyOnWriteInternal, getDefaultInstanceForType, internalMergeFrom, isInitialized, mergeFrom, mergeFrom, mergeFrom, mergeFrom

    Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder

    addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.google.protobuf.MessageLiteOrBuilder

    getDefaultInstanceForType, isInitialized
  • Method Details

    • getContentType

      public String getContentType()
       The HTTP Content-Type header value specifying the content type of the body.
       
      string content_type = 1 [json_name = "contentType"];
      Specified by:
      getContentType in interface HttpBodyOrBuilder
      Returns:
      The contentType.
    • getContentTypeBytes

      public com.google.protobuf.ByteString getContentTypeBytes()
       The HTTP Content-Type header value specifying the content type of the body.
       
      string content_type = 1 [json_name = "contentType"];
      Specified by:
      getContentTypeBytes in interface HttpBodyOrBuilder
      Returns:
      The bytes for contentType.
    • setContentType

      public HttpBody.Builder setContentType(String value)
       The HTTP Content-Type header value specifying the content type of the body.
       
      string content_type = 1 [json_name = "contentType"];
      Parameters:
      value - The contentType to set.
      Returns:
      This builder for chaining.
    • clearContentType

      public HttpBody.Builder clearContentType()
       The HTTP Content-Type header value specifying the content type of the body.
       
      string content_type = 1 [json_name = "contentType"];
      Returns:
      This builder for chaining.
    • setContentTypeBytes

      public HttpBody.Builder setContentTypeBytes(com.google.protobuf.ByteString value)
       The HTTP Content-Type header value specifying the content type of the body.
       
      string content_type = 1 [json_name = "contentType"];
      Parameters:
      value - The bytes for contentType to set.
      Returns:
      This builder for chaining.
    • getData

      public com.google.protobuf.ByteString getData()
       The HTTP request/response body as raw binary.
       
      bytes data = 2 [json_name = "data"];
      Specified by:
      getData in interface HttpBodyOrBuilder
      Returns:
      The data.
    • setData

      public HttpBody.Builder setData(com.google.protobuf.ByteString value)
       The HTTP request/response body as raw binary.
       
      bytes data = 2 [json_name = "data"];
      Parameters:
      value - The data to set.
      Returns:
      This builder for chaining.
    • clearData

      public HttpBody.Builder clearData()
       The HTTP request/response body as raw binary.
       
      bytes data = 2 [json_name = "data"];
      Returns:
      This builder for chaining.
    • getExtensionsList

      public List<com.google.protobuf.Any> getExtensionsList()
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
      Specified by:
      getExtensionsList in interface HttpBodyOrBuilder
    • getExtensionsCount

      public int getExtensionsCount()
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
      Specified by:
      getExtensionsCount in interface HttpBodyOrBuilder
    • getExtensions

      public com.google.protobuf.Any getExtensions(int index)
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
      Specified by:
      getExtensions in interface HttpBodyOrBuilder
    • setExtensions

      public HttpBody.Builder setExtensions(int index, com.google.protobuf.Any value)
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
    • setExtensions

      public HttpBody.Builder setExtensions(int index, com.google.protobuf.Any.Builder builderForValue)
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
    • addExtensions

      public HttpBody.Builder addExtensions(com.google.protobuf.Any value)
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
    • addExtensions

      public HttpBody.Builder addExtensions(int index, com.google.protobuf.Any value)
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
    • addExtensions

      public HttpBody.Builder addExtensions(com.google.protobuf.Any.Builder builderForValue)
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
    • addExtensions

      public HttpBody.Builder addExtensions(int index, com.google.protobuf.Any.Builder builderForValue)
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
    • addAllExtensions

      public HttpBody.Builder addAllExtensions(Iterable<? extends com.google.protobuf.Any> values)
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
    • clearExtensions

      public HttpBody.Builder clearExtensions()
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
    • removeExtensions

      public HttpBody.Builder removeExtensions(int index)
       Application specific response metadata. Must be set in the first response
       for streaming APIs.
       
      repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];