Package org.opensearch.client.base
Class Endpoint.Simple<RequestT,ResponseT>
java.lang.Object
org.opensearch.client.base.Endpoint.Simple<RequestT,ResponseT>
- All Implemented Interfaces:
Endpoint<RequestT,ResponseT,OpenSearchError>
- Direct Known Subclasses:
Endpoint.Boolean
public static class Endpoint.Simple<RequestT,ResponseT> extends java.lang.Object implements Endpoint<RequestT,ResponseT,OpenSearchError>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.client.base.Endpoint
Endpoint.Boolean<RequestT>, Endpoint.Simple<RequestT,ResponseT> -
Constructor Summary
Constructors Constructor Description Simple(java.util.function.Function<RequestT,java.lang.String> method, java.util.function.Function<RequestT,java.lang.String> requestUrl, java.util.function.Function<RequestT,java.util.Map<java.lang.String,java.lang.String>> queryParameters, java.util.function.Function<RequestT,java.util.Map<java.lang.String,java.lang.String>> headers, boolean hasRequestBody, JsonpDeserializer<ResponseT> responseParser) -
Method Summary
Modifier and Type Method Description static <T> java.util.function.Function<T,java.util.Map<java.lang.String,java.lang.String>>emptyMap()Returns a function that always returns an empty String to String map.JsonpDeserializer<OpenSearchError>errorParser(int statusCode)The entity parser for the error response body.booleanhasRequestBody()java.util.Map<java.lang.String,java.lang.String>headers(RequestT request)Build the headers for a requestbooleanisError(int statusCode)java.lang.Stringmethod(RequestT request)The endpoint's http methodstatic java.lang.RuntimeExceptionnoPathTemplateFound(java.lang.String what)java.util.Map<java.lang.String,java.lang.String>queryParameters(RequestT request)Build the query parameters for a requestjava.lang.StringrequestUrl(RequestT request)Build the URL path for a requestJsonpDeserializer<ResponseT>responseParser()The entity parser for the response body.<NewResponseT>
Endpoint.Simple<RequestT,NewResponseT>withResponseDeserializer(JsonpDeserializer<NewResponseT> newResponseParser)
-
Constructor Details
-
Simple
public Simple(java.util.function.Function<RequestT,java.lang.String> method, java.util.function.Function<RequestT,java.lang.String> requestUrl, java.util.function.Function<RequestT,java.util.Map<java.lang.String,java.lang.String>> queryParameters, java.util.function.Function<RequestT,java.util.Map<java.lang.String,java.lang.String>> headers, boolean hasRequestBody, JsonpDeserializer<ResponseT> responseParser)
-
-
Method Details
-
emptyMap
public static <T> java.util.function.Function<T,java.util.Map<java.lang.String,java.lang.String>> emptyMap()Returns a function that always returns an empty String to String map. Useful to avoid creating lots of duplicate lambdas in endpoints that don't have headers or parameters. -
method
Description copied from interface:EndpointThe endpoint's http method- Specified by:
methodin interfaceEndpoint<RequestT,ResponseT,OpenSearchError>
-
requestUrl
Description copied from interface:EndpointBuild the URL path for a request- Specified by:
requestUrlin interfaceEndpoint<RequestT,ResponseT,OpenSearchError>
-
queryParameters
Description copied from interface:EndpointBuild the query parameters for a request- Specified by:
queryParametersin interfaceEndpoint<RequestT,ResponseT,OpenSearchError>
-
headers
Description copied from interface:EndpointBuild the headers for a request- Specified by:
headersin interfaceEndpoint<RequestT,ResponseT,OpenSearchError>
-
hasRequestBody
public boolean hasRequestBody()- Specified by:
hasRequestBodyin interfaceEndpoint<RequestT,ResponseT,OpenSearchError>
-
responseParser
Description copied from interface:EndpointThe entity parser for the response body. Can benullto indicate that there's no response body.- Specified by:
responseParserin interfaceEndpoint<RequestT,ResponseT,OpenSearchError>
-
isError
public boolean isError(int statusCode)- Specified by:
isErrorin interfaceEndpoint<RequestT,ResponseT,OpenSearchError>
-
errorParser
Description copied from interface:EndpointThe entity parser for the error response body. Can benullto indicate that there's no error body.- Specified by:
errorParserin interfaceEndpoint<RequestT,ResponseT,OpenSearchError>
-
withResponseDeserializer
public <NewResponseT> Endpoint.Simple<RequestT,NewResponseT> withResponseDeserializer(JsonpDeserializer<NewResponseT> newResponseParser) -
noPathTemplateFound
public static java.lang.RuntimeException noPathTemplateFound(java.lang.String what)
-