Class CompatSphereClient

java.lang.Object
io.vrap.rmf.base.client.AutoCloseableService
com.commercetools.compat.CompatSphereClient
All Implemented Interfaces:
SphereClient, AutoCloseable

public class CompatSphereClient extends AutoCloseableService implements SphereClient
  • Method Details

    • apiRoot

      public ProjectApiRoot apiRoot()
    • getClient

      public ApiHttpClient getClient()
    • getProjectKey

      public String getProjectKey()
    • getExceptionMode

      public CompatSphereClient.ExceptionMode getExceptionMode()
    • getMapper

      public ObjectMapper getMapper()
    • of

      public static CompatSphereClient of(SphereClientConfig clientConfig)
      creates an instance of the CompatSphereClient. Please be aware for backwards compatibility the v2 Exceptions are thrown
      Parameters:
      clientConfig - client configuration
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • of

      public static CompatSphereClient of(ProjectApiRoot apiRoot)
      Wraps an ApiHttpClient in a SDK v1 compatible SphereClient. SDKv1 Exceptions are thrown
      Parameters:
      apiRoot - the ApiRoot with the underlying ApiHttpClient to be used
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • of

      public static CompatSphereClient of(ProjectApiRoot apiRoot, ObjectMapper mapper)
      Wraps an ApiHttpClient in a SDK v1 compatible SphereClient. SDKv1 Exceptions are thrown
      Parameters:
      apiRoot - the ApiRoot with the underlying ApiHttpClient to be used
      mapper - Jackson ObjectMapper to be used for deserialization
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • of

      public static CompatSphereClient of(ApiHttpClient apiHttpClient, String projectKey)
      Wraps an ApiHttpClient in a SDK v1 compatible SphereClient. SDKv1 Exceptions are thrown
      Parameters:
      apiHttpClient - the underlying ApiHttpClient to be used
      projectKey - the key of the used project
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • of

      public static CompatSphereClient of(ApiHttpClient apiHttpClient, ObjectMapper mapper, String projectKey)
      Wraps an ApiHttpClient in a SDK v1 compatible SphereClient. SDKv1 Exceptions are thrown
      Parameters:
      apiHttpClient - the underlying ApiHttpClient to be used
      projectKey - the project key to be used
      mapper - Jackson ObjectMapper to be used for deserialization
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • of

      public static CompatSphereClient of(SphereClientConfig clientConfig, CompatSphereClient.ExceptionMode exceptionMode)
      Wraps an ApiHttpClient in a SDK v1 compatible SphereClient. SDKv1 Exceptions are thrown
      Parameters:
      clientConfig - client configuration
      exceptionMode - SDKv1 or SDKv2 exceptions to be used
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • of

      public static CompatSphereClient of(ProjectApiRoot apiRoot, CompatSphereClient.ExceptionMode exceptionMode)
      Wraps an ApiHttpClient in a SDK v1 compatible SphereClient. SDKv1 Exceptions are thrown
      Parameters:
      apiRoot - the ApiRoot with the underlying ApiHttpClient to be used
      exceptionMode - SDKv1 or SDKv2 exceptions to be used
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • of

      public static CompatSphereClient of(ProjectApiRoot apiRoot, ObjectMapper mapper, CompatSphereClient.ExceptionMode exceptionMode)
      Wraps an ApiHttpClient in a SDK v1 compatible SphereClient. SDKv1 Exceptions are thrown
      Parameters:
      apiRoot - the ApiRoot with the underlying ApiHttpClient to be used
      mapper - Jackson ObjectMapper to be used for deserialization
      exceptionMode - SDKv1 or SDKv2 exceptions to be used
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • of

      public static CompatSphereClient of(ApiHttpClient apiHttpClient, String projectKey, CompatSphereClient.ExceptionMode exceptionMode)
      Wraps an ApiHttpClient in a SDK v1 compatible SphereClient. SDKv1 Exceptions are thrown
      Parameters:
      apiHttpClient - the underlying ApiHttpClient to be used
      projectKey - project key to be used
      exceptionMode - SDKv1 or SDKv2 exceptions to be used
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • of

      public static CompatSphereClient of(ApiHttpClient apiHttpClient, ObjectMapper mapper, String projectKey, CompatSphereClient.ExceptionMode exceptionMode)
      Wraps an ApiHttpClient in a SDK v1 compatible SphereClient. SDKv1 Exceptions are thrown
      Parameters:
      apiHttpClient - the underlying ApiHttpClient to be used
      projectKey - the project key to be used
      mapper - Jackson ObjectMapper to be used for deserialization
      exceptionMode - SDKv1 or SDKv2 exceptions to be used
      Returns:
      SphereClient using a SDK v2 ApiHttpClient as HTTP client
    • execute

      public <T> CompletionStage<T> execute(SphereRequest<T> sphereRequest)
      Specified by:
      execute in interface SphereClient
    • getConfig

      public SphereApiConfig getConfig()
      Specified by:
      getConfig in interface SphereClient
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • reflectionHashCode

      public int reflectionHashCode()