Package com.vonage.client
Class DynamicEndpoint<T,R>
java.lang.Object
com.vonage.client.AbstractMethod<T,R>
com.vonage.client.DynamicEndpoint<T,R>
- Type Parameters:
T- The request body type.R- The response body type.
- All Implemented Interfaces:
RestEndpoint<T,R>
Enables convenient declaration of endpoints without directly implementing
AbstractMethod.
This decouples the endpoint's implementation from the underlying HTTP library.- Since:
- 7.7.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Set<Class<? extends AuthMethod>> protected Tprotected Stringprotected BiFunction<DynamicEndpoint<T, R>, ? super T, String> protected HttpMethodprotected Class<? extends RuntimeException> Fields inherited from class com.vonage.client.AbstractMethod
httpWrapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,R> DynamicEndpoint.Builder <T, R> static <T,R> DynamicEndpoint.Builder <T, R> builder(R[] responseType) This trick enables initialisation of the builder whilst inferring the response type<R>without directly providing the class by using varargs as a parameter.static URIprotected final Set<Class<? extends AuthMethod>> protected final org.apache.http.client.methods.RequestBuildermakeRequest(T requestBody) Construct and return a RequestBuilder instance from the provided request.protected final RparseResponse(org.apache.http.HttpResponse response) Construct a ResultT representing the contents of the HTTP response returned from the Vonage Voice API.protected RparseResponseFromString(String response) Methods inherited from class com.vonage.client.AbstractMethod
execute, getAuthMethod, getHttpWrapper, postProcessParsedResponse
-
Field Details
-
authMethods
-
contentType
-
accept
-
requestMethod
-
pathGetter
-
responseExceptionType
-
responseType
-
cachedRequestBody
-
-
Constructor Details
-
DynamicEndpoint
-
-
Method Details
-
builder
This trick enables initialisation of the builder whilst inferring the response type<R>without directly providing the class by using varargs as a parameter. See usages for examples.- Type Parameters:
T- The request type.R- The response type.- Parameters:
responseType- The response type array, not provided directly but via a varargs parameter.- Returns:
- A new Builder.
- Since:
- 7.9.0
-
builder
-
getAcceptableAuthMethods
- Specified by:
getAcceptableAuthMethodsin classAbstractMethod<T,R>
-
buildUri
-
makeRequest
Description copied from class:AbstractMethodConstruct and return a RequestBuilder instance from the provided request.- Specified by:
makeRequestin classAbstractMethod<T,R> - Parameters:
requestBody- A RequestT representing input to the REST call to be made- Returns:
- A ResultT representing the response from the executed REST call
-
parseResponse
Description copied from class:AbstractMethodConstruct a ResultT representing the contents of the HTTP response returned from the Vonage Voice API.- Specified by:
parseResponsein classAbstractMethod<T,R> - Parameters:
response- An HttpResponse returned from the Vonage Voice API- Returns:
- A ResultT type representing the result of the REST call
- Throws:
IOException- if a problem occurs parsing the response
-
parseResponseFromString
-