Class ApiCalls

java.lang.Object
com.qtsurfer.api.sdk.internal.ApiCalls

public final class ApiCalls extends Object
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.
  • Method Details

    • call

      public static <T, E extends QTSError> T call(ApiCalls.ApiCall<T> call, String message, BiFunction<String,Throwable,E> errorCtor)
      Invoke call, mapping an ApiException to the error type built by errorCtor.
      Type Parameters:
      T - response type
      E - SDK error type raised on failure
      Parameters:
      call - the api-client invocation
      message - prefix describing what was being attempted
      errorCtor - builds the SDK error from the message and the cause
      Returns:
      whatever the call returned
    • describe

      public static String describe(com.qtsurfer.api.client.invoker.ApiException e)
      Render an ApiException as HTTP <code> plus its body when it carries one.