Package com.qtsurfer.api.sdk.internal
Class ApiCalls
java.lang.Object
com.qtsurfer.api.sdk.internal.ApiCalls
Turns a generated api-client call into an SDK call: the checked
ApiException becomes the QTSError subclass the calling stage
is defined in terms of, with the HTTP status and response body folded into
the message.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn api-client invocation, which may fail with the generated checked exception. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,E extends QTSError>
Tcall(ApiCalls.ApiCall<T> call, String message, BiFunction<String, Throwable, E> errorCtor) Invokecall, mapping anApiExceptionto the error type built byerrorCtor.static Stringdescribe(com.qtsurfer.api.client.invoker.ApiException e) Render anApiExceptionasHTTP <code>plus its body when it carries one.
-
Method Details
-
call
public static <T,E extends QTSError> T call(ApiCalls.ApiCall<T> call, String message, BiFunction<String, Throwable, E> errorCtor) Invokecall, mapping anApiExceptionto the error type built byerrorCtor.- Type Parameters:
T- response typeE- SDK error type raised on failure- Parameters:
call- the api-client invocationmessage- prefix describing what was being attemptederrorCtor- builds the SDK error from the message and the cause- Returns:
- whatever the call returned
-
describe
Render anApiExceptionasHTTP <code>plus its body when it carries one.
-