1.0.0 • Published 4 years ago

@genql/cartql v1.0.0

Weekly downloads
1
License
-
Repository
-
Last release
4 years ago

@genql/cartql

Your awesome graphql client ❤️

Example usage

import { createClient } from '@genql/cartql'
const client = createClient()



// variables
var cart__id

client
  .query({
    orders: {
      cartId: true,
      email: true,
      totalItems: true,
      status: true,
      createdAt: true,
      updatedAt: true,
    },
    cart: [
      {
        id: cart__id,
      },
      {
        id: true,
        email: true,
        totalUniqueItems: true,
        isEmpty: true,
        notes: true,
      },
    ],
  })
  .then(x => console.log(JSON.stringify(x, null, 4)))




client
  .query({
    orders: {
      id: true,
      cartId: true,
      email: true,
      totalUniqueItems: true,
      notes: true,
      updatedAt: true,
    },
  })
  .then(x => console.log(JSON.stringify(x, null, 4)))




client
  .query({
    orders: {
      id: true,
      email: true,
      totalUniqueItems: true,
      notes: true,
      status: true,
      createdAt: true,
      updatedAt: true,
    },
  })
  .then(x => console.log(JSON.stringify(x, null, 4)))




// variables
var cart__id

client
  .query({
    cart: [
      {
        id: cart__id,
      },
      {
        taxTotal: {
          currency: {
            thousandsSeparator: true,
          },
          formatted: true,
        },
        currency: {
          code: true,
          decimalSeparator: true,
          decimalDigits: true,
        },
        items: {
          description: true,
          type: true,
          updatedAt: true,
        },
        shippingTotal: {
          currency: {
            code: true,
            symbol: true,
            decimalSeparator: true,
          },
          formatted: true,
        },
        grandTotal: {
          amount: true,
          formatted: true,
        },
        attributes: {
          key: true,
        },
        email: true,
        createdAt: true,
        updatedAt: true,
      },
    ],
  })
  .then(x => console.log(JSON.stringify(x, null, 4)))