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

com.dft.api.shopify.v202410.ShopifyGraphQlInventoryLevelAPI Maven / Gradle / Ivy

The newest version!
package com.dft.api.shopify.v202410;

import com.dft.api.shopify.ShopifyGraphQLSdk;
import com.dft.api.shopify.model.auth.AccessCredential;
import com.dft.api.shopify.v202410.model.common.GraphQlQuery;
import com.dft.api.shopify.v202410.model.common.GraphQlVariable;
import com.dft.api.shopify.v202410.model.common.QueryResponse;
import com.dft.api.shopify.v202410.model.inventorylevel.InventoryLevelData;
import com.dft.api.shopify.v202410.model.inventorylevel.InventorySetQuantitiesInput;
import com.dft.api.shopify.v202410.model.location.LocationData;
import com.fasterxml.jackson.core.type.TypeReference;

public class ShopifyGraphQlInventoryLevelAPI extends ShopifyGraphQLSdk {

    public ShopifyGraphQlInventoryLevelAPI(AccessCredential accessCredential) {
        super(accessCredential);
    }

    public QueryResponse getInventoryLevelsByLocationId(GraphQlVariable graphQlVariable) {
        GraphQlQuery graphQlQuery = new GraphQlQuery();
        graphQlQuery.setQuery("query LocationInventoryLevelList($id: ID!, $endCursor: String) { location(id: $id) { inventoryLevels(first: 1, after: $endCursor) { nodes { id createdAt item { id legacyResourceId updatedAt } quantities (names:\"available\") { id name quantity updatedAt } updatedAt } pageInfo { hasNextPage endCursor } } } }");
        graphQlQuery.setVariables(graphQlVariable);
        return getQueryData(graphQlQuery, new TypeReference<>() {});
    }

    public QueryResponse updateInventoryQuantities(GraphQlVariable graphQlVariable) {
        GraphQlQuery graphQlQuery = new GraphQlQuery();
        graphQlQuery.setQuery("mutation InventorySet($input: InventorySetQuantitiesInput!) { inventorySetQuantities(input: $input) { inventoryAdjustmentGroup { createdAt reason changes { name delta } } userErrors { field message } } }");
        graphQlQuery.setVariables(graphQlVariable);
        return getQueryData(graphQlQuery, new TypeReference<>() {});
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy