Package com.google.api.gax.httpjson
Class ProtoMessageRequestFormatter<RequestT extends com.google.protobuf.Message>
- java.lang.Object
-
- com.google.api.gax.httpjson.ProtoMessageRequestFormatter<RequestT>
-
- All Implemented Interfaces:
HttpRequestFormatter<RequestT>
public class ProtoMessageRequestFormatter<RequestT extends com.google.protobuf.Message> extends Object implements HttpRequestFormatter<RequestT>
Creates parts of a HTTP request from a protobuf message.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProtoMessageRequestFormatter.Builder<RequestT extends com.google.protobuf.Message>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<PathTemplate>getAdditionalPathTemplates()Additional (alternative) path templates for endpoint URL path.StringgetPath(RequestT apiMessage)Returns the relative URL path created from the path parameters from the given message.PathTemplategetPathTemplate()Path template for endpoint URL path.Map<String,List<String>>getQueryParamNames(RequestT apiMessage)Return a map where each entry is the name of a query param mapped to the values of the param.StringgetRequestBody(RequestT apiMessage)Return the serialized inner request body of the given message.static <RequestT extends com.google.protobuf.Message>
ProtoMessageRequestFormatter.Builder<RequestT>newBuilder()ProtoMessageRequestFormatter.Builder<RequestT>toBuilder()
-
-
-
Method Detail
-
newBuilder
public static <RequestT extends com.google.protobuf.Message> ProtoMessageRequestFormatter.Builder<RequestT> newBuilder()
-
toBuilder
public ProtoMessageRequestFormatter.Builder<RequestT> toBuilder()
-
getQueryParamNames
public Map<String,List<String>> getQueryParamNames(RequestT apiMessage)
Description copied from interface:HttpRequestFormatterReturn a map where each entry is the name of a query param mapped to the values of the param.- Specified by:
getQueryParamNamesin interfaceHttpRequestFormatter<RequestT extends com.google.protobuf.Message>
-
getRequestBody
public String getRequestBody(RequestT apiMessage)
Description copied from interface:HttpRequestFormatterReturn the serialized inner request body of the given message.- Specified by:
getRequestBodyin interfaceHttpRequestFormatter<RequestT extends com.google.protobuf.Message>
-
getPath
public String getPath(RequestT apiMessage)
Returns the relative URL path created from the path parameters from the given message. Attempts to match the with the default PathTemplate. If there is not match, it attempts to match with the templates in the additionalPathTemplates.- Specified by:
getPathin interfaceHttpRequestFormatter<RequestT extends com.google.protobuf.Message>- Parameters:
apiMessage- Request object to extract fields from- Returns:
- Path of a matching valid URL or the default Path URL
-
getAdditionalPathTemplates
@BetaApi public List<PathTemplate> getAdditionalPathTemplates()
Description copied from interface:HttpRequestFormatterAdditional (alternative) path templates for endpoint URL path.- Specified by:
getAdditionalPathTemplatesin interfaceHttpRequestFormatter<RequestT extends com.google.protobuf.Message>
-
getPathTemplate
public PathTemplate getPathTemplate()
Description copied from interface:HttpRequestFormatterPath template for endpoint URL path.- Specified by:
getPathTemplatein interfaceHttpRequestFormatter<RequestT extends com.google.protobuf.Message>
-
-