com.dft.api.shopify.v202410.ShopifyGraphQlSubscriptionAPI 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.subscription.AppSubscriptionCreateResponse;
import com.dft.api.shopify.v202410.model.subscription.AppSubscriptionResponse;
import com.dft.api.shopify.v202410.model.subscription.UsageChargeResponse;
import com.fasterxml.jackson.core.type.TypeReference;
public class ShopifyGraphQlSubscriptionAPI extends ShopifyGraphQLSdk {
public ShopifyGraphQlSubscriptionAPI(AccessCredential accessCredential) {
super(accessCredential);
}
public QueryResponse createShopifyUsageCharge(GraphQlVariable variable) {
GraphQlQuery graphQlQuery = new GraphQlQuery();
graphQlQuery.setQuery("mutation appUsageRecordCreate($description: String!, $price: MoneyInput!, $subscriptionLineItemId: ID!) { appUsageRecordCreate(description: $description, price: $price, subscriptionLineItemId: $subscriptionLineItemId) { userErrors { field message } appUsageRecord { id createdAt price{ amount currencyCode } } } }");
graphQlQuery.setVariables(variable);
return getQueryData(graphQlQuery, new TypeReference<>() {});
}
public QueryResponse getAppSubscription(GraphQlVariable variable) {
GraphQlQuery graphQlQuery = new GraphQlQuery();
graphQlQuery.setQuery("query getAppSubscription($id: ID!) { node(id: $id) { ...on AppSubscription { id createdAt currentPeriodEnd name status trialDays test lineItems { plan { pricingDetails { ...on AppRecurringPricing { interval price { amount currencyCode } } ...on AppUsagePricing { interval terms cappedAmount { amount currencyCode } balanceUsed { amount currencyCode } } } } } } } }");
graphQlQuery.setVariables(variable);
return getQueryData(graphQlQuery, new TypeReference<>() {});
}
public QueryResponse appSubscriptionCreate(GraphQlVariable variable) {
GraphQlQuery graphQlQuery = new GraphQlQuery();
graphQlQuery.setQuery("mutation AppSubscriptionCreate($name: String!, $lineItems: [AppSubscriptionLineItemInput!]!, $returnUrl: URL!, $test: Boolean, $trialDays: Int) { appSubscriptionCreate(name: $name, returnUrl: $returnUrl, lineItems: $lineItems, test: $test, trialDays: $trialDays) { userErrors { field message } appSubscription { id lineItems { id plan { pricingDetails { __typename } } } } confirmationUrl } }");
graphQlQuery.setVariables(variable);
return getQueryData(graphQlQuery, new TypeReference<>() {});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy