@field123/client-shopper
v0.1.5
Published
<!-- generated file, do not edit directly -->
Downloads
2
Readme
@field123/client-shopper
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