com.dft.api.shopify.v202407.ShopifyGraphQlAPI Maven / Gradle / Ivy
package com.dft.api.shopify.v202407;
import com.dft.api.shopify.ShopifyGraphQLSdk;
import com.dft.api.shopify.model.auth.AccessCredential;
import com.dft.api.shopify.v202407.model.graphqlapirequest.GraphQlQueryRequest;
import com.dft.api.shopify.v202407.model.inventoryitem.GraphQlQueryResponse;
import java.net.URI;
import java.net.http.HttpRequest;
public class ShopifyGraphQlAPI extends ShopifyGraphQLSdk {
private static final String VERSION_2024_07 = "/2024-07";
private static final String ENDPOINT = "/graphql";
public ShopifyGraphQlAPI(AccessCredential accessCredential) {
super(accessCredential);
}
public GraphQlQueryResponse getInventoryItem(Long inventoryItemId) {
String query = "query inventoryItem { inventoryItem(id: \"gid://shopify/InventoryItem/%s\") { id requiresShipping variant { id product { id status } } measurement { weight { value unit } } } }";
query = String.format(query, inventoryItemId);
GraphQlQueryRequest graphQlQuery = new GraphQlQueryRequest();
graphQlQuery.setQuery(query);
URI uri = baseUrl(VERSION_2024_07, ENDPOINT);
HttpRequest request = postWithObject(uri, graphQlQuery);
return getRequestWrapped(request, GraphQlQueryResponse.class);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy