Package io.vrap.rmf.base.client
Class ApiMethod<T extends ApiMethod<T,TResult>,TResult>
java.lang.Object
io.vrap.rmf.base.client.ApiMethod<T,TResult>
- All Implemented Interfaces:
ClientRequestCommand<TResult>
,CreateHttpRequestCommand
,RequestCommand<TResult>
- Direct Known Subclasses:
BodyApiMethod
,CompatRequest
,TypeApiMethod
public abstract class ApiMethod<T extends ApiMethod<T,TResult>,TResult>
extends Object
implements RequestCommand<TResult>, ClientRequestCommand<TResult>, CreateHttpRequestCommand
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionApiMethod
(ApiHttpClient apiHttpClient) ApiMethod
(ApiHttpClient apiHttpClient, ApiHttpHeaders headers, List<ApiMethod.ParamEntry<String, String>> queryParams) -
Method Summary
Modifier and TypeMethodDescriptionadds a header with the specified value<V> T
addQueryParam
(String key, V value) add an additional query parameteraddQueryParams
(List<ApiMethod.ParamEntry<String, String>> queryParams) add the query parameterscontentType
(String contentType) set specific content typeabstract boolean
execute()
<TReturn> CompletableFuture<ApiHttpResponse<TReturn>>
execute
(com.fasterxml.jackson.core.type.TypeReference<TReturn> returnTypeReference) <TReturn> CompletableFuture<ApiHttpResponse<TReturn>>
abstract CompletableFuture<ApiHttpResponse<TResult>>
execute
(ApiHttpClient client) <TReturn> CompletableFuture<ApiHttpResponse<TReturn>>
execute
(ApiHttpClient client, com.fasterxml.jackson.core.type.TypeReference<TReturn> returnTypeReference) <TReturn> CompletableFuture<ApiHttpResponse<TReturn>>
execute
(ApiHttpClient client, JavaType returnJavaType) <TReturn> CompletableFuture<ApiHttpResponse<TReturn>>
execute
(ApiHttpClient client, Class<TReturn> returnType) <TReturn> CompletableFuture<ApiHttpResponse<TReturn>>
<TReturn> ApiHttpResponse<TReturn>
executeBlocking
(com.fasterxml.jackson.core.type.TypeReference<TReturn> typeReference) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(JavaType javaType) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(ApiHttpClient client, com.fasterxml.jackson.core.type.TypeReference<TReturn> typeReference) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(ApiHttpClient client, JavaType javaType) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(ApiHttpClient client, Class<TReturn> clazz) abstract ApiHttpResponse<TResult>
executeBlocking
(ApiHttpClient client, Duration timeout) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(ApiHttpClient client, Duration timeout, com.fasterxml.jackson.core.type.TypeReference<TReturn> typeReference) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(ApiHttpClient client, Duration timeout, JavaType javaType) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(ApiHttpClient client, Duration timeout, Class<TReturn> clazz) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(Class<TReturn> clazz) executeBlocking
(Duration timeout) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(Duration timeout, com.fasterxml.jackson.core.type.TypeReference<TReturn> typeReference) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(Duration timeout, JavaType javaType) <TReturn> ApiHttpResponse<TReturn>
executeBlocking
(Duration timeout, Class<TReturn> clazz) getFirstQueryParam
(String key) getQueryParam
(String key) abstract int
hashCode()
int
CompletableFuture<ApiHttpResponse<byte[]>>
send()
ApiHttpResponse<byte[]>
ApiHttpResponse<byte[]>
sendBlocking
(Duration timeout) toString()
<U> T
with
(BiFunction<T, U, T> op, U arg) allows to provide a function to modify the ApiMethod itselfallows to provide a function to modify the ApiMethod itselfwithHeader
(String key, String value) set the header with the specified valuewithHeaders
(ApiHttpHeaders headers) set the headersallows to modify the HTTP request before it will be executedwithoutHeader
(String key) removes the specified headerwithoutQueryParam
(String key) removes the specified query parameter<V> T
withQueryParam
(String key, V value) set the query parameter with the specified valuewithQueryParams
(List<ApiMethod.ParamEntry<String, String>> queryParams) set the query parametersMethods inherited from interface io.vrap.rmf.base.client.ClientRequestCommand
executeBlocking
Methods inherited from interface io.vrap.rmf.base.client.RequestCommand
executeBlocking
-
Constructor Details
-
ApiMethod
-
ApiMethod
public ApiMethod(ApiHttpClient apiHttpClient, ApiHttpHeaders headers, List<ApiMethod.ParamEntry<String, String>> queryParams) -
ApiMethod
-
-
Method Details
-
addHeader
adds a header with the specified value- Parameters:
key
- header namevalue
- header value- Returns:
- T
-
withoutHeader
removes the specified header- Parameters:
key
- header name- Returns:
- T
-
withHeader
set the header with the specified value- Parameters:
key
- header namevalue
- header value- Returns:
- T
-
withHeaders
set the headers- Parameters:
headers
-- Returns:
-
contentType
set specific content type- Parameters:
contentType
-- Returns:
-
getHeaders
-
addQueryParam
add an additional query parameter- Type Parameters:
V
- value type- Parameters:
key
- query parameter namevalue
- query parameter value- Returns:
- T
-
withQueryParam
set the query parameter with the specified value- Type Parameters:
V
- value type- Parameters:
key
- query parameter namevalue
- query parameter value- Returns:
- T
-
withoutQueryParam
removes the specified query parameter- Parameters:
key
- query parameter name- Returns:
- T
-
withQueryParams
set the query parameters- Parameters:
queryParams
- list of query parameters- Returns:
- T
-
addQueryParams
add the query parameters- Parameters:
queryParams
- list of query parameters- Returns:
- T
-
getQueryParams
-
getQueryParam
-
getQueryParamUriStrings
-
getQueryParamUriString
-
getFirstQueryParam
-
createHttpRequest
- Specified by:
createHttpRequest
in interfaceCreateHttpRequestCommand
-
execute
-
execute
-
withHttpRequest
allows to modify the HTTP request before it will be executed- Parameters:
op
- decorator function- Returns:
- the method itself
-
with
allows to provide a function to modify the ApiMethod itself- Parameters:
op
- decorator function- Returns:
- the method itself
-
with
allows to provide a function to modify the ApiMethod itself- Type Parameters:
U
- the method type itself- Parameters:
op
- decorator functionarg
- decorator function argument- Returns:
- the method itself
-
execute
-
execute
public <TReturn> CompletableFuture<ApiHttpResponse<TReturn>> execute(ApiHttpClient client, Class<TReturn> returnType) -
execute
public <TReturn> CompletableFuture<ApiHttpResponse<TReturn>> execute(com.fasterxml.jackson.core.type.TypeReference<TReturn> returnTypeReference) -
execute
public <TReturn> CompletableFuture<ApiHttpResponse<TReturn>> execute(ApiHttpClient client, com.fasterxml.jackson.core.type.TypeReference<TReturn> returnTypeReference) -
execute
-
execute
public <TReturn> CompletableFuture<ApiHttpResponse<TReturn>> execute(ApiHttpClient client, JavaType returnJavaType) -
executeBlocking
- Specified by:
executeBlocking
in interfaceRequestCommand<T extends ApiMethod<T,
TResult>>
-
executeBlocking
- Specified by:
executeBlocking
in interfaceClientRequestCommand<T extends ApiMethod<T,
TResult>>
-
executeBlocking
-
executeBlocking
public <TReturn> ApiHttpResponse<TReturn> executeBlocking(ApiHttpClient client, Class<TReturn> clazz) -
executeBlocking
-
executeBlocking
public <TReturn> ApiHttpResponse<TReturn> executeBlocking(ApiHttpClient client, Duration timeout, Class<TReturn> clazz) -
executeBlocking
public <TReturn> ApiHttpResponse<TReturn> executeBlocking(com.fasterxml.jackson.core.type.TypeReference<TReturn> typeReference) -
executeBlocking
public <TReturn> ApiHttpResponse<TReturn> executeBlocking(ApiHttpClient client, com.fasterxml.jackson.core.type.TypeReference<TReturn> typeReference) -
executeBlocking
public <TReturn> ApiHttpResponse<TReturn> executeBlocking(Duration timeout, com.fasterxml.jackson.core.type.TypeReference<TReturn> typeReference) -
executeBlocking
public <TReturn> ApiHttpResponse<TReturn> executeBlocking(ApiHttpClient client, Duration timeout, com.fasterxml.jackson.core.type.TypeReference<TReturn> typeReference) -
executeBlocking
-
executeBlocking
-
executeBlocking
-
executeBlocking
public <TReturn> ApiHttpResponse<TReturn> executeBlocking(ApiHttpClient client, Duration timeout, JavaType javaType) -
send
-
sendBlocking
-
sendBlocking
-
equals
-
hashCode
public abstract int hashCode() -
toString
-
reflectionHashCode
public int reflectionHashCode()
-