0.0.4 • Published 3 years ago

smaregiapi v0.0.4

Weekly downloads
10
License
MIT
Repository
github
Last release
3 years ago

npm version

Smaregi API

Api tool for https://smaregi.jp/

Install

npm install smaregiapi

Usage

import SmaregiApi from "smaregiapi";

const main = async () => {
  const config = {
    contractId: process.env.SmaregiContractId,
    clientId: process.env.SmaregiClientId,
    clientSecret: process.env.SmaregiClientSecret,
    hostName: "api.smaregi.dev",
    scopes: [
      "pos.stock:read", "pos.stock:write",
      "pos.stores:read", "pos.stores:write",
      "pos.customers:read", "pos.customers:write", 
      "pos.products:read", "pos.products:write"
    ]
  };
  
  const api = new SmaregiApi(config);
  await api.auth();

  // Get stores lists
  const storeList = await api.stores().storesApi.list();

  // Update store data
  const data = {
    storeName: "npm api module test"
  };
  await api.stores().id(1).update(data);

  // Get products lists
  const productList = await api.products().productsApi.list();
};

main();
0.0.3

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago