Index
All Classes and Interfaces|All Packages
A
- ApiRequest<T> - Interface in dev.mayuna.simpleapi
-
Represents an API request.
- ApiRequestBuilder<T> - Class in dev.mayuna.simpleapi
-
A builder for
ApiRequest. - ApiResponse<T extends WrappedApi> - Class in dev.mayuna.simpleapi
-
An abstract class to represent an API response.
- ApiResponse() - Constructor for class dev.mayuna.simpleapi.ApiResponse
- applyHeadersToHttpRequestBuilder(ApiRequest<T>, HttpRequest.Builder, RequestHeader[]) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Applies the
RequestHeaders to the givenHttpRequest.Builder.
If theApiRequest.applyHeadersToHttpRequestBuilder(HttpRequest.Builder, RequestHeader[])is overridden, this method may not be called, depending on the implementation. - applyHeadersToHttpRequestBuilder(HttpRequest.Builder, RequestHeader[]) - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Applies the
RequestHeaders to the givenHttpRequest.Builder.
B
- build() - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Builds the
ApiRequest. - builder(WrappedApi, Class<T>) - Static method in interface dev.mayuna.simpleapi.ApiRequest
C
- computeEndpoint(ApiRequest<T>) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Computers the endpoint of this
ApiRequest.
If theApiRequest.getComputedEndpoint()is overridden, this method may not be called, depending on the implementation. - createHttpClientInstance() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Creates a new
HttpClientinstance. - createHttpClientInstance() - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Creates a new
HttpClientinstance that will be used for sending requests.
If theApiRequest.createHttpClientInstance()is overridden, this method may not be called, depending on the implementation. - createHttpRequestBuilderInstance() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Creates a new
HttpRequest.Builderinstance. - createHttpRequestBuilderInstance() - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Creates a new
HttpRequest.Builderinstance that will be used for building requests.
If theApiRequest.createHttpRequestBuilderInstance()is overridden, this method may not be called, depending on the implementation. - createInstanceOfResponseClass() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Creates a new instance of the response class.
- createInstanceOfResponseClass(Class<T>) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Creates a new instance of the response class.
If theApiRequest.createInstanceOfResponseClass()is overridden, this method may not be called, depending on the implementation.
D
- DELETE - Static variable in class dev.mayuna.simpleapi.RequestMethod
- DeserializableApiResponse<T extends WrappedApi> - Class in dev.mayuna.simpleapi
-
An API response that can be deserialized.
- DeserializableApiResponse() - Constructor for class dev.mayuna.simpleapi.DeserializableApiResponse
- deserialize(ApiRequest<?>, HttpResponse<?>) - Method in class dev.mayuna.simpleapi.DeserializableApiResponse
-
Deserialize the response body into an object of current type.
- deserialize(ApiRequest<?>, HttpResponse<?>) - Method in class dev.mayuna.simpleapi.GsonApiResponse
- dev.mayuna.simpleapi - package dev.mayuna.simpleapi
G
- GET - Static variable in class dev.mayuna.simpleapi.RequestMethod
- getBodyHandler() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the
HttpResponse.BodyHandlerof thisApiRequest. - getBodyPublisher() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the
HttpRequest.BodyPublisherof thisApiRequest. - getComputedEndpoint() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the computed endpoint of this
ApiRequest. - getDefaultRequestHeaders() - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Gets the default
RequestHeaders for this API.
Useful if you want to set some headers for all requests. - getDefaultUrl() - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Gets the default URL for this API.
- getEndpoint() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the endpoint of this
ApiRequest. - getGson() - Method in class dev.mayuna.simpleapi.GsonApiResponse
-
Get a Gson instance.
- getPathParameters() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the
PathParameters of thisApiRequest. - getRequestHeaders() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the
RequestHeaders of thisApiRequest. - getRequestMethod() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the
RequestMethodof thisApiRequest. - getRequestQueries() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the
RequestQuerys of thisApiRequest. - getResponseClass() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the
Classof the response. - getTimeoutDuration() - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Gets the default timeout duration for the API requests.
- getUrl() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the URL of this
ApiRequest. - getWrappedApi() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Gets the
WrappedApiof thisApiRequest. - GsonApiResponse<T extends WrappedApi> - Class in dev.mayuna.simpleapi
-
Implements
DeserializableApiResponseusingGsonlibrary. - GsonApiResponse() - Constructor for class dev.mayuna.simpleapi.GsonApiResponse
H
- handleResponse(ApiRequest<T>, HttpResponse<?>) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Handles the given
HttpResponse.
If theApiRequest.handleResponse(HttpResponse)is overridden, this method may not be called, depending on the implementation. - handleResponse(HttpResponse<?>) - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Handles the given
HttpResponse.
O
- of(String, String) - Static method in class dev.mayuna.simpleapi.RequestHeader
-
Create a new RequestHeader instance.
- of(String, String) - Static method in class dev.mayuna.simpleapi.PathParameter
-
Creates
PathParameterwith parameter name and its replacement - of(String, String) - Static method in class dev.mayuna.simpleapi.RequestQuery
-
Creates
RequestQuerywith name and value - of(String) - Static method in class dev.mayuna.simpleapi.RequestMethod
-
Creates
RequestMethodwith request method name - ofContentType(String) - Static method in class dev.mayuna.simpleapi.RequestHeader
-
Create a new RequestHeader instance with the key
Content-Type. - ofResponse(WrappedApi, Class<T>) - Static method in class dev.mayuna.simpleapi.ApiRequestBuilder
- onAfterApiRequest(ApiRequest<T>) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
It is called after the request is sent but before the response is handled.
If the request send fails with exception, this method is not called. - onAfterHandledApiRequest(ApiRequest<T>, T) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
It is called after the request's response is handled.
If the request send and/or request's response handler fails with exception, this method is not called. - onApiRequest(ApiRequest<T>) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Is called before the request is sent.
- onException(ApiRequest<T>, Throwable) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
It is called when any exception occurs when sending the request or handling the response.
Note: This method does not catch any exceptions.
All exceptions are re-thrown after this method is called, if therethrowExceptions()returnstrue.
P
- PathParameter - Class in dev.mayuna.simpleapi
-
Represents path parameter which will be replaced in your request
- POST - Static variable in class dev.mayuna.simpleapi.RequestMethod
- PUT - Static variable in class dev.mayuna.simpleapi.RequestMethod
R
- RequestHeader - Class in dev.mayuna.simpleapi
- RequestMethod - Class in dev.mayuna.simpleapi
- RequestQuery - Class in dev.mayuna.simpleapi
- rethrowExceptions() - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Determines if exceptions should be re-thrown after
onException(ApiRequest, Throwable)is called.
Also, if this method returns false, all responses that failed to be sent or handled will benull. - runAsync(Runnable) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
This method is used for async requests.
S
- send() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Sends the request synchronously.
- send(ApiRequest<T>) - Method in interface dev.mayuna.simpleapi.WrappedApi
-
Sends the request synchronously.
If theApiRequest.send()is overridden, this method may not be called, depending on the implementation. - sendAsync() - Method in interface dev.mayuna.simpleapi.ApiRequest
-
Sends the request asynchronously using
runAsync(Runnable).
W
- withBodyHandler(HttpResponse.BodyHandler<?>) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Sets the
HttpResponse.BodyHandlerof the request. - withBodyPublisher(HttpRequest.BodyPublisher) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Sets the
HttpRequest.BodyPublisherof the request. - withEndpoint(String) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Sets the endpoint of the request.
- withPathParameter(PathParameter) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Adds a
PathParameterto the request. - withPathParameters(PathParameter, PathParameter...) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Adds multiple
PathParameters to the request. - withRequestHeader(RequestHeader) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Adds a
RequestHeaderto the request. - withRequestHeaders(RequestHeader, RequestHeader...) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Adds multiple
RequestHeaders to the request. - withRequestMethod(RequestMethod) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Sets the request method of the request.
Pro-tip: You can use pre-defined instances ofRequestMethodlikeRequestMethod.GET. - withRequestMethod(String) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
- withRequestQueries(RequestQuery, RequestQuery...) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Adds multiple
RequestQuerys to the request. - withRequestQuery(RequestQuery) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Adds a
RequestQueryto the request. - withUrl(String) - Method in class dev.mayuna.simpleapi.ApiRequestBuilder
-
Sets the url of the request.
- WrappedApi - Interface in dev.mayuna.simpleapi
All Classes and Interfaces|All Packages