All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.client.JavaClientImpl Maven / Gradle / Ivy

The newest version!
package io.sphere.sdk.client;

import com.typesafe.config.Config;
import io.sphere.sdk.http.ClientRequest;
import io.sphere.sdk.http.HttpClient;

import java.util.concurrent.CompletableFuture;

public class JavaClientImpl implements JavaClient {
    private final SphereRequestExecutor sphereRequestExecutor;


    public JavaClientImpl(final Config config) {
        this(config, new NingAsyncHttpClient(config));
    }

    public JavaClientImpl(final Config config, final HttpClient httpClient) {
        this(config, new HttpSphereRequestExecutor(httpClient, config));
    }

    public JavaClientImpl(final Config config, final SphereRequestExecutor sphereRequestExecutor) {
        this.sphereRequestExecutor = sphereRequestExecutor;
    }

    public  CompletableFuture execute(final ClientRequest requestable) {
        return sphereRequestExecutor.execute(requestable);
    }

    @Override
    public void close() {
        sphereRequestExecutor.close();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy