0.0.1-alpha.5 • Published 2 years ago

@shopx/types v0.0.1-alpha.5

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

SHOPX API Types for Typescript

@shopx/types MIT LICENSE @shopx/types Version

SHOPX Types.

Installation:

$ yarn add @shopx/types

API

This module organized as Types and RecordTypes. Types is basic type which mostly used by add, update methods (mutations) of the API. RecordTypes are Types joined with _id, createdAt, updatedAt. Which is what will be received with get queries. All the types here are all the types used by SHOPX.

You can use this types with SHOPX Client to build your app.

This module exports following types,

  • appSettings
  • checkoutFields
  • customerGroups
  • customers
  • emailSettings
  • emailTemplates
  • files
  • orders
  • pages
  • paymentGateways
  • paymentMethods
  • productCategories
  • products
  • redirects
  • settings
  • shippingMethods
  • shopx/affiliates
  • shopx/analytics
  • shopx/features
  • shopx/vendors
  • themeSettings
  • users
  • webhooks

Example

import client from "@shopx/client"
import { productTypes, productRecordTypes } from "@shopx/types"

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

logProducts() // List Products

// Adds a new product
const addProduct = async () => {
  const api = client("vendorID", "token")
  const products = async (data: productTypes) => await api.new.addProduct(data)
}

License

@shopx/types MIT LICENSE MIT