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

Commit

Permalink
feat: made listAllFulfillmentOrders NT
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jul 20, 2020
1 parent 1e77921 commit 752fbd5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/sections/fulfillment-outbound-shipment/codec.ts
Expand Up @@ -168,7 +168,7 @@ const FulfillmentOrder = Codec.interface({
})

const ListAllFulfillmentOrders = Codec.interface({
NextToken: nextTokenCodec('ListAllFulfillmentOrders'),
NextToken: optional(nextTokenCodec('ListAllFulfillmentOrders')),
FulfillmentOrders: ensureArray('member', FulfillmentOrder),
})

Expand Down Expand Up @@ -276,3 +276,9 @@ export const GetFulfillmentOrderResponse = Codec.interface({
GetFulfillmentOrderResult: GetFulfillmentOrder,
}),
})

export const ListAllFulfillmentOrdersByNextTokenResponse = Codec.interface({
ListAllFulfillmentOrdersByNextTokenResponse: Codec.interface({
ListAllFulfillmentOrdersByNextTokenResult: ListAllFulfillmentOrders,
}),
})
@@ -1,5 +1,6 @@
import { ParsingError } from '../../error'
import { HttpClient, RequestMeta, Resource } from '../../http'
import { NextToken } from '../../parsing'
import { getServiceStatusByResource } from '../shared'
import {
CreateFulfillmentOrderResponse,
Expand All @@ -8,6 +9,7 @@ import {
GetFulfillmentPreview,
GetFulfillmentPreviewResponse,
ListAllFulfillmentOrders,
ListAllFulfillmentOrdersByNextTokenResponse,
ListAllFulfillmentOrdersResponse,
UpdateFulfillmentOrderResponse,
} from './codec'
Expand All @@ -27,6 +29,29 @@ const FOS_API_VERSION = '2010-10-01'
export class FulfillmentOutboundShipment {
constructor(private httpClient: HttpClient) {}

async listAllFulfillmentOrdersByNextToken(
nextToken: NextToken<'ListAllFulfillmentOrders'>,
): Promise<[ListAllFulfillmentOrders, RequestMeta]> {
const [response, meta] = await this.httpClient.request('POST', {
resource: Resource.FulfillmentOutboundShipment,
version: FOS_API_VERSION,
action: 'ListAllFulfillmentOrdersByNextToken',
parameters: {
NextToken: nextToken.token,
},
})

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

async getFulfillmentOrder(
parameters: GetFulfillmentOrderParameters,
): Promise<[GetFulfillmentOrder, RequestMeta]> {
Expand Down

0 comments on commit 752fbd5

Please sign in to comment.