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

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

There is a newer version: 1.0.7
Show 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.metafielddefinition.MetaFieldDefinitionData;
import com.dft.api.shopify.v202410.model.metafielddefinition.MetaFieldDefinitionInput;
import com.fasterxml.jackson.core.type.TypeReference;

public class ShopifyGraphQlMetafieldDefinitionAPI extends ShopifyGraphQLSdk {

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

    public QueryResponse getMetafieldDefinitions(GraphQlVariable variables) {
        GraphQlQuery graphQlQuery = new GraphQlQuery();
        graphQlQuery.setQuery("query call($ownerType: MetafieldOwnerType!, $namespace: String) { metafieldDefinitions(first: 1, ownerType: $ownerType, namespace: $namespace) { nodes { id name namespace ownerType useAsCollectionCondition } } }");
        graphQlQuery.setVariables(variables);

        return getQueryData(graphQlQuery, new TypeReference<>() {});
    }

    public QueryResponse createMetafieldDefinition(GraphQlVariable variables) {
        GraphQlQuery graphQlQuery = new GraphQlQuery();
        graphQlQuery.setQuery("mutation CreateMetafieldDefinition($input: MetafieldDefinitionInput!) { metafieldDefinitionCreate(definition: $input) { createdDefinition { id name } userErrors { field message code } } }");
        graphQlQuery.setVariables(variables);
        return getQueryData(graphQlQuery, new TypeReference<>() {});
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy