
io.sphere.internal.ProjectScopedAPI Maven / Gradle / Ivy
package io.sphere.internal;
import com.google.common.base.Optional;
import io.sphere.client.CommandRequest;
import io.sphere.client.ProjectEndpoints;
import io.sphere.client.QueryRequest;
import io.sphere.client.model.QueryResult;
import io.sphere.client.shop.ApiMode;
import io.sphere.internal.command.Command;
import io.sphere.internal.request.RequestFactory;
import org.codehaus.jackson.type.TypeReference;
/** Base class for Sphere HTTP APIs scoped to a project. */
abstract class ProjectScopedAPI {
protected ProjectEndpoints endpoints;
protected RequestFactory requestFactory;
protected TypeReference typeReference;
protected TypeReference> queryResultTypeReference;
protected ProjectScopedAPI(RequestFactory requestFactory, ProjectEndpoints endpoints, TypeReference typeReference, TypeReference> queryResultTypeReference) {
this.requestFactory = requestFactory;
this.endpoints = endpoints;
this.typeReference = typeReference;
this.queryResultTypeReference = queryResultTypeReference;
}
protected CommandRequest createCommandRequest(String url, Command command) {
return requestFactory.createCommandRequest(url, command, typeReference);
}
protected QueryRequest queryImpl(String url) {
return requestFactory.createQueryRequest(url, Optional.absent(), queryResultTypeReference);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy