io.sphere.sdk.client.SphereClient Maven / Gradle / Ivy
package io.sphere.sdk.client;
import io.sphere.sdk.http.HttpClient;
import java.util.concurrent.CompletionStage;
/**
* A client interface to perform requests to SPHERE.IO.
*
* Instantiation
*
* {@include.example example.JavaClientInstantiationExample}
*
* Example call
*
* {@include.example example.TaxCategoryQueryExample#exampleQuery()}
*
* Refer to resources for known SPHERE.IO requests.
*
*/
public interface SphereClient extends AutoCloseable {
/**
* Executes asynchronously a request to commercetools. By default it does not have a timeout.
* @param sphereRequest request to commercetools to perfom
* @param type of the result for the request
* @return future monad which can contain the result or an exception
*/
CompletionStage execute(final SphereRequest sphereRequest);
/**
* Shuts down the client to save resources like connections and threads.
*/
@Override
void close();
/**
* Raw client creation.
* See also SphereClientFactory.
*
* @param config SPHERE.IO project and location
* @param httpClient client to execute requests
* @param tokenSupplier delivery of access tokens
* @return sphere client
*/
static SphereClient of(final SphereApiConfig config, final HttpClient httpClient, final SphereAccessTokenSupplier tokenSupplier) {
return SphereClientImpl.of(config, httpClient, tokenSupplier);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy