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

Commit

Permalink
feat: made listInboundShipmentItemsByNextToken
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jul 15, 2020
1 parent 97b5df2 commit 0de78b9
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sections/fulfillment-inbound-shipment/codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,3 +574,9 @@ export const ListInboundShipmentItemsResponse = Codec.interface({
ListInboundShipmentItemsResult: ListInboundShipmentItems,
}),
})

export const ListInboundShipmentItemsByNextTokenResponse = Codec.interface({
ListInboundShipmentItemsByNextTokenResponse: Codec.interface({
ListInboundShipmentItemsByNextTokenResult: ListInboundShipmentItems,
}),
})
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
GetUniquePackageLabels,
GetUniquePackageLabelsResponse,
ListInboundShipmentItems,
ListInboundShipmentItemsByNextTokenResponse,
ListInboundShipmentItemsResponse,
ListInboundShipments,
ListInboundShipmentsByNextToken,
Expand Down Expand Up @@ -77,6 +78,26 @@ const FULFILLMENT_INBOUND_SHIPMENT_API_VERSION = '2010-10-01'
export class FulfillmentInboundShipment {
constructor(private httpClient: HttpClient) {}

async listInboundShipmentItemsByNextToken(
nextToken: NextToken<'ListInboundShipmentItems'>,
): Promise<[ListInboundShipmentItems, RequestMeta]> {
const [response, meta] = await this.httpClient.request('POST', {
resource: Resource.FulfillmentInboundShipment,
version: FULFILLMENT_INBOUND_SHIPMENT_API_VERSION,
action: 'ListInboundShipmentItemsByNextToken',
parameters: {
NextToken: nextToken.token,
},
})

return ListInboundShipmentItemsByNextTokenResponse.decode(response).caseOf({
Right: (x) => [x.ListInboundShipmentItemsByNextTokenResponse.ListInboundShipmentItemsByNextTokenResult, meta],
Left: (error) => {
throw new ParsingError(error)
},
})
}

async listInboundShipmentItems(
parameters: ListInboundShipmentItemsParameters,
): Promise<[ListInboundShipmentItems, RequestMeta]> {
Expand Down
34 changes: 34 additions & 0 deletions test/unit/__snapshots__/fulfillment-inbound-shipment.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,40 @@ Array [
]
`;

exports[`fulfillmentInboundShipment listInboundShipmentItemsByNextToken returns a list of inbound shipment item data if succesful 1`] = `
Array [
Object {
"ItemData": Array [
Object {
"FulfillmentNetworkSKU": "FNSKU1",
"PrepDetailsList": Array [
Object {
"PrepInstruction": "Taping",
"PrepOwner": "AMAZON",
},
Object {
"PrepInstruction": "Polybagging",
"PrepOwner": "AMAZON",
},
],
"QuantityInCase": 0,
"QuantityReceived": 0,
"QuantityShipped": 2,
"SellerSKU": "SKU00001",
"ShipmentId": "FBA0000001",
},
],
},
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;

exports[`fulfillmentInboundShipment listInboundShipments returns shipment data if succesful 1`] = `
Array [
Object {
Expand Down

0 comments on commit 0de78b9

Please sign in to comment.