shopify-graphql-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.26 • Public • Published

shopify-graphql-node

Shopify GraphQL for Node

semantic-release Build Status NPM JavaScript Style Guide

Installation

To install this package, you can run command

npm install --save shopify-graphql-node

Or

yarn add shopify-graphql-node

Usage

  • Simple query
import GraphQL from "shopify-graphql-node";

const GraphQLClient = new GraphQL("domain", "access-token");

const query = `query { shop { id } }`;

GraphQLClient
  .request(query)
  .then(data => console.log(JSON.stringify(data.shop, null, 2)))
  .catch(error => console.log(JSON.stringify(error, null, 2)));
  • Simple mutation
import GraphQL from "shopify-graphql-node";

const GraphQLClient = new GraphQL("domain", "access-token");

const mutation = `
  mutation collectionCreate($input: CollectionInput!) {
    collectionCreate(input: $input) {
      collection {
        id
      }
    }
  }
`;

GraphQLClient
  .request(mutation, {
    input: {
      descriptionHtml: "Collection was created from GraphQL",
      title: "GraphQL Collection",
    },
  })
  .then(data => console.log(JSON.stringify(data, null, 2)))
  .catch(error => console.log(JSON.stringify(error, null, 2)));
  • For more example, please read here

Customize fetcher

Issue

If you have any issue or question, please create new issue

License

This project is licensed under the MIT License.

Contributors

Todo

Versions

Current Tags

Version History

Package Sidebar

Install

npm i shopify-graphql-client

Weekly Downloads

0

Version

0.0.26

License

MIT

Unpacked Size

23.2 kB

Total Files

16

Last publish

Collaborators

  • mgara