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

Commit

Permalink
feat: add get service status
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed May 19, 2020
1 parent 8bb1a87 commit 5bd7533
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ interface ResourceActions {
| 'GetProductCategoriesForSKU'
| 'GetProductCategoriesForASIN'
| 'GetServiceStatus'
[Resource.FulfilmentInventory]: 'ListInventorySupply' | 'ListInventorySupplyByNextToken'
[Resource.FulfilmentInventory]:
| 'ListInventorySupply'
| 'ListInventorySupplyByNextToken'
| 'GetServiceStatus'
}

interface Request {
Expand Down
9 changes: 9 additions & 0 deletions src/sections/fulfillment-inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Codec, exactly, GetInterface, number, oneOf, optional, string } from 'p
import { ParsingError } from '../error'
import { HttpClient, RequestMeta, Resource } from '../http'
import { ensureArray, mwsDate, NextToken, nextToken as nextTokenCodec } from '../parsing'
import { getServiceStatusByResource } from './shared'

const FULFILLMENT_INVENTORY_API_VERSION = '2010-10-01'

Expand Down Expand Up @@ -148,4 +149,12 @@ export class FulfillmentInventory {
},
})
}

async getServiceStatus() {
return getServiceStatusByResource(
this.httpClient,
Resource.FulfilmentInventory,
FULFILLMENT_INVENTORY_API_VERSION,
)
}
}
16 changes: 16 additions & 0 deletions test/unit/__snapshots__/fulfillment-inventory.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`fulfillment-inventory getServiceStatus returns a parsed model when the status response is valid 1`] = `
Array [
Object {
"Status": "GREEN",
"Timestamp": "2020-05-06T08:22:23.582Z",
},
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
},
]
`;

exports[`fulfillment-inventory listInventorySupply returns a parsed model when the response is valid 1`] = `
Array [
Object {
Expand Down

0 comments on commit 5bd7533

Please sign in to comment.