JSPM

channelape-sdk

1.4.0-develop.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q71456F
  • License Apache-2.0

A client for interacting with ChannelApe's API

Package Exports

  • channelape-sdk

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (channelape-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ChannelApe SDK

TypeScript and JavaScript SDK for the ChannelApe REST API

Build Status Quality Gate Coverage

Features

Getting Started

The ChannelApe SDK is asynchronous and all functions return promises.

Using in a browser based app?

Make sure when you install the SDK you install with the --no-optional flag

npm i channelape-sdk --save --no-optional

Creating a client

Create a new instance of the ChannelApeClient with your sessionId.

const channelApeClient = new ChannelApeClient({
  sessionId: '4674b668-c4d2-4270-bf9b-ebaab78c378d'
});

Optional client configurations

  • timeout - Number of milliseconds to wait for the API to send response headers. Defaults to 180000 (3 minutes). Cannot be set lower than 2000 (2 seconds).
  • endpoint - Envrionment endpoint you would like to hit. Defaults to https://api.channelape.com
  • logLevel - Level of logs you wish to see from the SDK. Defaults to OFF.
  • maximumRequestRetryTimeout - Number of milliseconds to keep retrying a request for when an undesired response status code is received. Defaults to 180000 (3 minutes). Cannot be set lower than 2000 (2 seconds).
  • minimumRequestRetryRandomDelay - Minimum number of milliseconds to randomly delay by when an undesired response status code is received. Defaults to 1000 (1 second). Cannot be set lower than 1000 (1 second).
  • maximumRequestRetryRandomDelay - Maximum number of milliseconds to randomly delay by when an undesired response status code is received. Defaults to 5000 (5 seconds). Cannot be set lower than 2000 (2 seconds).

Sessions

Retrieve session using sessionId passed into ChannelApeClient.

channelapeClient.sessions().get()
  .then((session: Session) => {
    // do what you need to do with session data here
  });

Actions

Get action

channelapeClient.actions().get(actionId)
  .then((action: Action) => {
    // do what you need to do with action data here
  });

Complete action

channelapeClient.actions().complete(actionId)
  .then((action: Action) => {
    // do what you need to do with action data here
  });

Update action with error

channelapeClient.actions().error(actionId)
  .then((action: Action) => {
    // do what you need to do with action data here
  });

Update action health check

channelapeClient.actions().updateHealthCheck(actionId)
  .then((action: Action) => {
    // do what you need to do with action data here
  });

Channels

Get channel

channelapeClient.channels().get(channelId)
  .then((channel: Channel) => {
    // do what you need to do with channel data here
  });

Get all channels for a business

channelapeClient.channels().get({ businessId: 'some-valid-business-id' })
  .then((channels: Channel[]) => {
    // do what you need to do with channel data here
  });

Orders

Get order

channelapeClient.orders().get(orderId)
  .then((order: Order) => {
    // do what you need to do with order data here
  });

Update order

channelapeClient.orders().update(order)
  .then((updatedOrder: Order) => {
    // do what you need to do with updatedOrder data here
  });