Package co.elastic.clients.transport
Interface Endpoint<RequestT,ResponseT,ErrorT>
- Type Parameters:
RequestT- the endpoint's requestResponseT- the endpoint's response. UseVoidwhen there's no response body.ErrorT- the endpoint's error type. UseVoidwhen error responses have no body.
- All Known Subinterfaces:
JsonEndpoint<RequestT,ResponseT, ErrorT>
- All Known Implementing Classes:
BinaryEndpoint,BooleanEndpoint,DelegatingJsonEndpoint,EndpointBase,EndpointWithResponseMapperAttr,SimpleEndpoint,SimpleJsonEndpoint
public interface Endpoint<RequestT,ResponseT,ErrorT>
An endpoint links requests and responses to HTTP protocol encoding. It also defines the error response
when the server cannot perform the request.
Requests are serialized as JSON by default, unless they implement specific marker interfaces that indicate
otherwise and must be handled by the transport processing the request (e.g. NdJsonpSerializable).
Response body decoding, when applicable, is defined by child interfaces like JsonEndpoint.
-
Method Summary
Modifier and TypeMethodDescriptionGet the body for a request.default ResponseTdefault ResponseTdefault CompletableFuture<ResponseT>default CompletableFuture<ResponseT>errorDeserializer(int statusCode) The entity parser for the error response body.Get the HTTP headers for a request.id()The endpoint's identifier.booleanisError(int statusCode) Is this status code to be considered as an error?Get the endpoint's HTTP method for a request.pathParameters(RequestT request) Get the path parameters for a request.queryParameters(RequestT request) Get the query parameters for a request.requestUrl(RequestT request) Get the URL path for a request.default BinaryEndpoint<RequestT>
-
Method Details
-
id
String id()The endpoint's identifier. -
method
Get the endpoint's HTTP method for a request. -
requestUrl
Get the URL path for a request. -
pathParameters
Get the path parameters for a request. -
queryParameters
Get the query parameters for a request. -
headers
Get the HTTP headers for a request. -
body
Get the body for a request. The caller must handle several cases depending on the interface implemented by the result:nullmeans the request has no body.NdJsonpSerializablemust be serialized as nd-json.BinaryDatamust be serialized as is.- All other objects must be serialized as JSON using a
JsonpMapper -
isError
boolean isError(int statusCode) Is this status code to be considered as an error? -
errorDeserializer
The entity parser for the error response body. Can benullto indicate that there's no error body. -
withBinaryResponse
-
call
- Throws:
IOException
-
call
- Throws:
IOException
-
callAsync
default CompletableFuture<ResponseT> callAsync(RequestT request, Transport transport) throws IOException - Throws:
IOException
-
callAsync
default CompletableFuture<ResponseT> callAsync(RequestT request, ApiClient<?, ?> client) throws IOException- Throws:
IOException
-