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

Commit

Permalink
Merge pull request #125 from ScaleLeap/feature/recommendations
Browse files Browse the repository at this point in the history
feat: recommendations
  • Loading branch information
justinemmanuelmercado committed Jul 10, 2020
2 parents 19ca1c0 + 0db5be3 commit 3208ff8
Show file tree
Hide file tree
Showing 14 changed files with 1,655 additions and 3 deletions.
125 changes: 124 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
* [getShipment](#getshipment)
* [cancelShipment](#cancelshipment)
* [getServiceStatus](#getservicestatus-5)
* [Recommendations](#recommendations)
* [Types used in Recommendations](#types-used-in-recommendations)
* [CategoryQuery](#categoryquery)
* [getLastUpdatedTimeForRecommendations](#getlastupdatedtimeforrecommendations)
* [listRecommendations](#listrecommendations)
* [listRecommendationsByNextToken](#listrecommendationsbynexttoken)
* [getServiceStatus](#getservicestatus-6)

<small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>Table of contents generated with markdown-toc</a></i></small>

Expand Down Expand Up @@ -2135,4 +2142,120 @@ const [response, meta] = merchantFulfillment.getServiceStatus()

**Response**

[See merchant fulfillment test snapshot](../test/unit/__snapshots__/merchant-fulfillment.test.ts.snap)
[See merchant fulfillment test snapshot](../test/unit/__snapshots__/merchant-fulfillment.test.ts.snap)















## Recommendations
[Amazon MWS Recommendations API official documentation](http://docs.developer.amazonservices.com/en_CA/recommendations/Recommendations_Overview.html)

### Types used in Recommendations

#### CategoryQuery

| Name | Type | Example - | Required |
|--------------- |-------------------------- |-------------- |---------- |
| RecommendationCategory | string | `'Selection '`| Yes |
| FilterOptions | string | `'QualitySet=Defect'`| Yes |

* [Possible values for RecommendationCategory and FilterOptions ](http://docs.developer.amazonservices.com/en_CA/recommendations/Recommendations_ListRecommendations.html)

### getLastUpdatedTimeForRecommendations

**Parameters**

| Name | Type | Example - | Required |
|--------------- |-------------------------- |-------------- |---------- |
| MarketplaceId | string | `'A2EUQ1WTGCTBG2'`| Yes |


**Example**

```typescript
const parameters = { MarketplaceId: 'A2EUQ1WTGCTBG2' }

const recommendations = new Recommendations(httpClient)
const [response, meta] = recommendations.getLastUpdatedTimeForRecommendations(parameters)
```

**Response**

[See recommendations test snapshot](../test/unit/__snapshots__/recommendations.test.ts.snap)

### listRecommendations

**Parameters**

| Name | Type | Example - | Required |
|--------------- |-------------------------- |-------------- |---------- |
| MarketplaceId | string | `'A2EUQ1WTGCTBG2'`| Yes |
| RecommendationCategory | string | `'Inventory'`| No. To retrieve all recommendations, do not specify a value for this parameter. |
| CategoryQueryList | CategoryQuery[] | [`[CategoryQuery]`](#categoryquery)| No |

* [Possible values for RecommendationCategory ](http://docs.developer.amazonservices.com/en_CA/recommendations/Recommendations_ListRecommendations.html)

**Example**

```typescript
const parameters = { MarketplaceId: 'A2EUQ1WTGCTBG2' }

const recommendations = new Recommendations(httpClient)
const [response, meta] = recommendations.listRecommendations(parameters)
```

**Response**

[See recommendations test snapshot](../test/unit/__snapshots__/recommendations.test.ts.snap)


### listRecommendationsByNextToken

**Parameters**

| Name | Type | Example | Required |
|-----------|-----------|-----------------------------------------------------------------------|----------|
| NextToken | NextToken | `new NextToken('action', 'nexttoken')`<br>[See examples for sample usage ](../examples/using-next-tokens.ts)| Yes |

**Example**

```typescript
const parameters = { MarketplaceId: 'A2EUQ1WTGCTBG2' }

const recommendations = new Recommendations(httpClient)
const [response, meta] = recommendations.listRecommendationsByNextToken(new NextToken('ListRecommendations', '123'))
```

**Response**

[See recommendations test snapshot](../test/unit/__snapshots__/recommendations.test.ts.snap)


### getServiceStatus

**Parameters**

| None |
|------|

**Example**

```typescript
const recommendations = new Recommendations(httpClient)
const [response, meta] = recommendations.getServiceStatus()
```

**Response**

[See recommendations test snapshot](../test/unit/__snapshots__/recommendations.test.ts.snap)
6 changes: 6 additions & 0 deletions src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export enum Resource {
Subscriptions = 'Subscriptions',
Feeds = 'Feeds',
ShipmentInvoicing = 'ShipmentInvoicing',
Recommendations = 'Recommendations',
MerchantFulfillment = 'MerchantFulfillment',
}

Expand Down Expand Up @@ -164,6 +165,11 @@ export interface ResourceActions {
| 'GetShipment'
| 'CancelShipment'
| 'GetServiceStatus'
[Resource.Recommendations]:
| 'GetLastUpdatedTimeForRecommendations'
| 'ListRecommendations'
| 'ListRecommendationsByNextToken'
| 'GetServiceStatus'
}

export interface Request {
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export * from './sections/products/products'
export * from './sections/products/codec'
export * from './sections/products/type'
export * from './sections/reports'
export * from './sections/recommendations'
export * from './sections/sellers'
export * from './sections/types'
export * from '@scaleleap/amazon-marketplaces'
Expand Down
11 changes: 11 additions & 0 deletions src/mws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FulfillmentInventory } from './sections/fulfillment-inventory'
import { MerchantFulfillment } from './sections/merchant-fulfillment/merchant-fulfillment'
import { Orders } from './sections/orders'
import { Products } from './sections/products/products'
import { Recommendations } from './sections/recommendations'
import { Reports } from './sections/reports'
import { Sellers } from './sections/sellers'
import { ShipmentInvoicing } from './sections/shipment-invoicing'
Expand All @@ -25,6 +26,8 @@ export class MWS {

private _reports!: Reports

private _recommendations!: Recommendations

private _sellers!: Sellers

private _subscriptions!: Subscriptions
Expand Down Expand Up @@ -89,6 +92,14 @@ export class MWS {
return this._products
}

get recommendations() {
if (!this._recommendations) {
this._recommendations = new Recommendations(this.httpClient)
}

return this._recommendations
}

get reports() {
if (!this._reports) {
this._reports = new Reports(this.httpClient)
Expand Down
Loading

0 comments on commit 3208ff8

Please sign in to comment.