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

Commit

Permalink
docs: add next token section and http client section
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jun 29, 2020
1 parent cb6a5e3 commit bdc74fd
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,31 @@ console.log(`

Each action returns a tuple containing [0] the actual request data and [1] the request metadata

---
## Configuring `HttpClient` and configuring the sections

```typescript
/**
* 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)
```

---
## Response Object

Expand All @@ -130,6 +155,43 @@ This is consistent for all actions
| quotaResetOn | Date | new Date() | Date the quota resets |

["Throttling: Limits to how often you can submit requests"](http://docs.developer.amazonservices.com/en_CA/dev_guide/DG_Throttling.html)
---

## Next tokens

### Creating `NextToken`s
["Using NextToken to request additional pages" from the Amazon documentation](http://docs.developer.amazonservices.com/en_CA/dev_guide/DG_NextToken.html)

```typescript
/**
* Construct your next token with the following arguments
* 1. Valid Amazon MWS action. WITHOUT `...ByNextToken` AT THE END
* 2. Actual NextToken
*/
const nextToken = new NextToken('ListMarketplaceParticipations', 'NEXTTOKEN123')
const [
marketplaceParticipationsList,
requestMeta,
] = await sellers.listMarketplaceParticipationsByNextToken(nextToken)
```

### Reusing next tokens from previous responses
```typescript
const [
marketplaceParticipationsList,
requestMeta,
] = await sellers.listMarketplaceParticipationsByNextToken(nextToken)
const nextToken = marketplaceParticipationsList.NextToken
/**
* Possibly undefined
*/
if (nextToken) {
const [
newMarketplaceParticipationsList,
newRequestMeta,
] = await sellers.listMarketplaceParticipationsByNextToken(nextToken)
}
```

# Sections

Expand Down

0 comments on commit bdc74fd

Please sign in to comment.