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

io.sphere.internal.InventoryServiceImpl Maven / Gradle / Ivy

There is a newer version: 0.72.1
Show newest version
package io.sphere.internal;

import com.google.common.base.Optional;
import io.sphere.client.shop.ApiMode;
import io.sphere.internal.request.RequestFactory;
import io.sphere.client.FetchRequest;
import io.sphere.client.ProjectEndpoints;
import io.sphere.client.model.QueryResult;
import io.sphere.client.shop.InventoryService;
import io.sphere.client.shop.model.InventoryEntry;
import org.codehaus.jackson.type.TypeReference;

public class InventoryServiceImpl extends ProjectScopedAPI implements InventoryService {
    private final RequestFactory requestFactory;

    public InventoryServiceImpl(RequestFactory requestFactory, ProjectEndpoints endpoints) {
        super(endpoints);
        this.requestFactory = requestFactory;
    }

    @Override public FetchRequest byId(String id) {
        return requestFactory.createFetchRequest(
                endpoints.inventory.byId(id),
                Optional.absent(),
                new TypeReference() {});
    }

    @Override public FetchRequest byProductVariant(String productId, int variantId) {
        return requestFactory.createFetchRequestBasedOnQuery(
                endpoints.inventory.byVariantInCatalog(productId, variantId, null),
                Optional.absent(),
                new TypeReference>() {});
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy