com.dft.api.shopify.v202410.ShopifyGraphQlWebhookAPI Maven / Gradle / Ivy
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.webhook.WebhookSubscriptionData;
import com.dft.api.shopify.v202410.model.webhook.WebhookSubscriptionInput;
import com.fasterxml.jackson.core.type.TypeReference;
public class ShopifyGraphQlWebhookAPI extends ShopifyGraphQLSdk {
public ShopifyGraphQlWebhookAPI(AccessCredential accessCredential) {
super(accessCredential);
}
public QueryResponse getAllWebhookSubscription() {
GraphQlQuery graphQlQuery = new GraphQlQuery();
graphQlQuery.setQuery("query { webhookSubscriptions(first: 250) { nodes{ apiVersion{ displayName handle supported } createdAt endpoint { ... on WebhookHttpEndpoint { callbackUrl } } format id legacyResourceId topic updatedAt } pageInfo{ endCursor hasNextPage } } }");
return getQueryData(graphQlQuery, new TypeReference<>() {});
}
public QueryResponse createWebhookSubscription(GraphQlVariable variables) {
GraphQlQuery graphQlQuery = new GraphQlQuery();
graphQlQuery.setQuery("mutation webhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $input: WebhookSubscriptionInput!) { webhookSubscriptionCreate(topic: $topic, webhookSubscription: $input) { webhookSubscription { id topic format includeFields metafieldNamespaces createdAt updatedAt endpoint { ... on WebhookHttpEndpoint { callbackUrl } } } userErrors { field message } } }");
graphQlQuery.setVariables(variables);
return getQueryData(graphQlQuery, new TypeReference<>() {});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy