0.0.1 • Published 2 years ago

@shopx/client v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

SHOPX Client API

@shopx/client MIT LICENSE @shopx/client Version

SHOPX Client API.

Installation:

$ yarn add @shopx/client graphql

API

This module exports a client function which takes following arguments.

Arguments

  • vendorID - Required - A string that specifies the shop. Can use "60e5185286ab2ff04f8cc576" as an example. This wil be sent to your email when you sign up. You can probably find this on console log of your store or admin panel, and on admin panel login page. You can also request this to be sent to you by contacting contact@shopxcommerce.com
  • authToken - Optional for accessing secure actions. Can be generated by await client("vendorID").new.login({ email: "", password: "" })

Example

import client from "@shopx/client"

const logProducts = async () => {
  const vendorID = "60e5185286ab2ff04f8cc576"
  const api = client(vendorID)
  console.log(await api.get.products())
}

logProducts() // List Products

Generating AuthToken Example

import client from "@shopx/client"

const { _id, token } = await client("vendorID").new.login({
  email: "",
  password: "",
})
const api = client("vendorID", token)

Full Usage Example

import client from "@shopx/client"

const logProducts = async () => {
  const { _id, token } = await client("vendorID").new.login({
    email: "",
    password: "",
  })
  const api = client("vendorID", token)
  console.log(await api.get.products())
}

logProducts() // List Products

License

@shopx/client MIT LICENSE MIT