@field123/client-shopper
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

@field123/client-shopper

NPM version NPM downloads

Description

EPCC for JavaScript shopper Client for Node.js, Browser and React Native.

Installing

To install the this package, simply type add or install @field123/client-shopper using your favorite package manager:

  • npm install @field123/client-shopper
  • yarn add @field123/client-shopper
  • pnpm add @field123/client-shopper

Getting Started

Module imports

The EPCC SDK uses clients and commands. To send a request, you only need to import the client creator function createShopperClient and the command creator functions you need, for example createGetAllHierarchiesCommand:

Syntax

// ES5 example
const {
  createShopperClient,
  createGetAllHierarchiesCommand
} = require('@field123/client-shopper')
// ES6+ example
import {
  createShopperClient,
  createGetAllHierarchiesCommand
} from '@field123/client-shopper'

Usage

To send a request, you:

  • Create a client with configuration (e.g. credentials).
  • Create a command with any required input parameters.
  • Call send operation on client with command object as the first argument.
// a client can be shared by different commands.
// example using fromKeys credential provider
const client = createShopperClient({
  credentials: fromKeys({
    clientId: '...'
  })
})

const params = {
  /** commands input parameters */
}
const command = createGetAllHierarchiesCommand(params)

Sending command

try {
  const data = await client.send(command)
  // do something with response data.
} catch (error) {
  // handle any errors.
}

Support command creators for ShopperClient

  • createGetAllHierarchiesCommand
  • createGetAllNodesCommand
  • createGetAllProductsCommand
  • createGetHierarchyByIdCommand
  • createGetHierarchyChildNodesCommand
  • createGetHierarchyNodesCommand
  • createGetHierarchyProductsCommand
  • createGetNodeByIdCommand
  • createGetNodeChildNodesCommand
  • createGetNodeProductsCommand
  • createGetProductByIdCommand
  • createGetShopperCatalogCommand

Readme

Keywords

none

Package Sidebar

Install

npm i @field123/client-shopper

Weekly Downloads

0

Version

0.1.5

License

MIT

Unpacked Size

132 kB

Total Files

179

Last publish

Collaborators

  • field123