@pgprojectx/open-commerce-sdk
v2.4.0
Published
Client library for interacting with SalesForce Open Commerce api.
Downloads
28
Keywords
Readme
open-commerce-sdk
Client library for interacting with SalesForce Open Commerce api.
Installation
npm install @pgprojectx/open-commerce-sdk
Usage
const ocSDK = require('@pgprojectx/open-commerce-sdk');
OpenCommerceSDK.ApiClient.instance = new OpenCommerceSDK.ApiClient({ basePath: basePath, clientId: clientId });
const productApi = new OpenCommerceSDK.Product();
development
- Set environment variables appropriate to running a Open Commerce deployment (see olay-api-serverless/config).
NOTE: If you do not set your environment properly, the repl will not start:
λ ./src/repl.js
> init()
missing env OC_API_HOST
missing env OC_CLIENT_ID
Error: invalid config, abort
- Start the repl via
./src/repl.js
. Once the repl starts, you mayinit()
, this loads two references on the repl context:config
andoc
:
> init()
> ProductApi
ProductApi.getProduct('075609195518').then(d => data = d);
> data
{ _v: '17.8',
_type: 'product',
... }