Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
feat: add using next tokens example
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado authored and moltar committed Jun 28, 2020
1 parent 426695d commit 9f2861d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
55 changes: 55 additions & 0 deletions examples/using-next-tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unused-vars */
/**
* import from 'amazon-mws-api-sdk'
*/
import { amazonMarketplaces, HttpClient, MWSOptions, NextToken, Sellers } from '../src'

/**
* Configure the HttpClient
*/

const mwsOptions: MWSOptions = {
marketplace: amazonMarketplaces.US,
awsAccessKeyId: '',
mwsAuthToken: '',
sellerId: '',
secretKey: '',
}

const http = new HttpClient(mwsOptions)

/**
* Configure which API you need
* Sellers, Orders, Fulfillment Inventory, Products, Reports, Subscriptions, Finances, Feeds
*/
const sellers = new Sellers(http)

/**
* Get service status of the Sellers API
*/
const main = async () => {
/**
* Construct your next token with the following arguments
* 1. Valid Amazon MWS action.
* 2. Actual NextToken
*/
const nextToken = new NextToken('ListMarketplaceParticipations', 'NEXTTOKEN123')

/**
* Returns a tuple containing
* [0] Actual response data in JS object format
* [1] Metadata of the request
*/
const [
marketplaceParticipationsList,
requestMeta,
] = await sellers.listMarketplaceParticipationsByNextToken(nextToken)

/**
* Check out Amazon's official docs for other available endpoints
* and definitions of possible request and response parameters
* http://docs.developer.amazonservices.com/en_CA/dev_guide/index.html
* Under the folder API References
*/
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export * from './sections/products/type'
export * from './sections/reports'
export * from './sections/sellers'
export * from '@scaleleap/amazon-marketplaces'
export { NextToken } from './parsing'

0 comments on commit 9f2861d

Please sign in to comment.