public class ApiCommandBuilder<TYPE,BUILDER extends ApiCommandBuilder> extends Object
| Constructor and Description |
|---|
ApiCommandBuilder(HttpMethodBuilder.MethodBuilder<?> methodBuilder,
URI uri,
Status responseStatus,
com.fasterxml.jackson.core.type.TypeReference<TYPE> responseType) |
| Modifier and Type | Method and Description |
|---|---|
BUILDER |
accept(String mediaType)
Sets the value of the
Accept HTTP header. |
String |
content()
Executes the current command and returns the
HttpResponse entity
content as String. |
TYPE |
execute()
Executes the current command and maps the
HttpResponse entity to
T specified by ApiCommand.responseType. |
TypedResponseWithEntity<TYPE> |
executeWithResponse() |
ApiCommand<TYPE> |
getCommand() |
BUILDER |
header(String name,
String value)
Sets a request header or removes it if
value equals null. |
BUILDER |
placeHolder(Boolean placeHolder) |
BUILDER |
queryParam(QueryParamValue qpv)
Sets a query parameter or removes it if the
value equals
null. |
BUILDER |
queryParam(String name,
List<String> value)
Sets a multi-valued query parameter or removes it if
value equals
null. |
BUILDER |
queryParam(String name,
String value)
Sets a query parameter or removes it if
value equals null
. |
BUILDER |
queryParamList(String name,
List<String> values)
Sets a multi-valued query parameter or removes it if
value equals
null. |
BUILDER |
queryParamList(String name,
String... values)
Sets a multi-valued query parameter or removes it if
value equals
null. |
BUILDER |
queryParams(Map<String,String> params)
Sets the provided query parametes.
|
org.apache.http.HttpResponse |
request()
Executes the current command and returns the native
HttpResponse. |
BUILDER |
sortOrder(com.evrythng.commons.domain.SortOrder sortOrder) |
InputStream |
stream()
Executes the current command and returns the
HttpResponse content
InputStream. |
public ApiCommandBuilder(HttpMethodBuilder.MethodBuilder<?> methodBuilder, URI uri, Status responseStatus, com.fasterxml.jackson.core.type.TypeReference<TYPE> responseType)
methodBuilder - the HttpMethodBuilder.MethodBuilder used for creating the
requesturi - the URI holding the absolute URLresponseStatus - the expected response StatusresponseType - the native type to which the HttpResponse will be
mapped topublic BUILDER queryParam(String name, String value)
value equals null
.name - the query parameter namevalue - the query parameter valueB instancepublic final BUILDER sortOrder(com.evrythng.commons.domain.SortOrder sortOrder)
public BUILDER queryParam(QueryParamValue qpv)
value equals
null.qpv - the name and the value of the query parameter.B instancepublic BUILDER queryParam(String name, List<String> value)
value equals
null.name - parameter namevalue - parameter values or nullB instancepublic BUILDER queryParamList(String name, List<String> values)
value equals
null.name - parameter namevalues - parameter values or nullB instancepublic BUILDER queryParamList(String name, String... values)
value equals
null.name - parameter namevalues - parameter values or nullB instancepublic BUILDER queryParams(Map<String,String> params)
params - a map name/value entriesB instancequeryParam(String, String)public BUILDER header(String name, String value)
value equals null.name - request header namevalue - the request header valueB instancepublic BUILDER accept(String mediaType)
Accept HTTP header.mediaType - a valid media type for the Accept HTTP headerB instancepublic TypedResponseWithEntity<TYPE> executeWithResponse() throws EvrythngException
EvrythngExceptionpublic TYPE execute() throws EvrythngException
HttpResponse entity to
T specified by ApiCommand.responseType.HttpResponse entity mapped to TEvrythngExceptionApiCommand.execute()public String content() throws EvrythngException
HttpResponse entity
content as String.HttpResponse entity content as StringEvrythngExceptionApiCommand.content()public org.apache.http.HttpResponse request()
throws EvrythngException
HttpResponse.HttpResponse resulting from the requestEvrythngExceptionApiCommand.request()public InputStream stream() throws EvrythngException
HttpResponse content
InputStream.InputStream of the HttpResponseEvrythngExceptionApiCommand.stream()public ApiCommand<TYPE> getCommand()
ApiCommand instanceCopyright © 2016 EVRYTHNG Ltd London / Zurich. All rights reserved.