Package com.google.api
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 TypeMethodDescriptionaddAllExtensions(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.ByteStringThe HTTP Content-Type header value specifying the content type of the body.com.google.protobuf.ByteStringgetData()The HTTP request/response body as raw binary.com.google.protobuf.AnygetExtensions(int index) Application specific response metadata.intApplication specific response metadata.List<com.google.protobuf.Any>Application specific response metadata.removeExtensions(int index) Application specific response metadata.setContentType(String value) 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, mergeFromMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType, isInitialized
-
Method Details
-
getContentType
The HTTP Content-Type header value specifying the content type of the body.
string content_type = 1 [json_name = "contentType"];- Specified by:
getContentTypein interfaceHttpBodyOrBuilder- 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:
getContentTypeBytesin interfaceHttpBodyOrBuilder- Returns:
- The bytes for contentType.
-
setContentType
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
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
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:
getDatain interfaceHttpBodyOrBuilder- Returns:
- The data.
-
setData
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
The HTTP request/response body as raw binary.
bytes data = 2 [json_name = "data"];- Returns:
- This builder for chaining.
-
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:
getExtensionsListin interfaceHttpBodyOrBuilder
-
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:
getExtensionsCountin interfaceHttpBodyOrBuilder
-
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:
getExtensionsin interfaceHttpBodyOrBuilder
-
setExtensions
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"]; -
setExtensions
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"]; -
addExtensions
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"]; -
addExtensions
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"]; -
addExtensions
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"]; -
addExtensions
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"]; -
addAllExtensions
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"]; -
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
Application specific response metadata. Must be set in the first response for streaming APIs.
repeated .google.protobuf.Any extensions = 3 [json_name = "extensions"];
-