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

Commit

Permalink
Browse files Browse the repository at this point in the history
 into feature/25-documentation
  • Loading branch information
justinemmanuelmercado committed Jun 26, 2020
2 parents 95b0fb0 + 849119f commit 9a39e00
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 55 deletions.
16 changes: 4 additions & 12 deletions src/sections/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ const GetReportRequestListByNextTokenResponse = Codec.interface({
}),
})

export interface GetReportRequestListByNextTokenParameters {
NextToken: NextToken<'GetReportRequestList'>
}

export interface GetReportRequestCountParameters {
ReportTypeList?: ReportType[]
ReportProcessingStatusList?: ReportProcessing[]
Expand Down Expand Up @@ -205,10 +201,6 @@ const GetReportListResponse = Codec.interface({
}),
})

export interface GetReportListByNextTokenParameters {
NextToken: NextToken<'GetReportList'>
}

const GetReportListByNextTokenResponse = Codec.interface({
GetReportListByNextTokenResponse: Codec.interface({
GetReportListByNextTokenResult: GetReportListResult,
Expand Down Expand Up @@ -464,14 +456,14 @@ export class Reports {
}

async getReportListByNextToken(
parameters: GetReportListByNextTokenParameters,
nextToken: NextToken<'GetReportList'>,
): Promise<[GetReportListResult, RequestMeta]> {
const [response, meta] = await this.httpClient.request('POST', {
resource: Resource.Reports,
version: REPORTS_API_VERSION,
action: 'GetReportListByNextToken',
parameters: {
NextToken: parameters.NextToken.token,
NextToken: nextToken.token,
},
})

Expand Down Expand Up @@ -556,14 +548,14 @@ export class Reports {
}

async getReportRequestListByNextToken(
parameters: GetReportRequestListByNextTokenParameters,
nextToken: NextToken<'GetReportRequestList'>,
): Promise<[GetReportRequestListResult, RequestMeta]> {
const [response, meta] = await this.httpClient.request('POST', {
resource: Resource.Reports,
version: REPORTS_API_VERSION,
action: 'GetReportListByNextToken',
parameters: {
NextToken: parameters.NextToken.token,
NextToken: nextToken.token,
},
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"entries": [
{
"_id": "d8629899729c640584baef2db86f2622",
"_id": "5ff95739bdbd570acef97863eab75ac4",
"_order": 0,
"cache": {},
"request": {
Expand Down Expand Up @@ -71,7 +71,7 @@
},
{
"name": "Signature",
"value": "tD7hfvr0yP7yyImiKckwTzYQvJOV2SUbWH9r8YMblRw="
"value": "P3YPb5Od6+J4TLn0brBtyGQFvrzEyAQ3VsVPCGrtLss="
},
{
"name": "SignatureMethod",
Expand All @@ -83,21 +83,21 @@
},
{
"name": "Timestamp",
"value": "2020-06-25T13:07:07.903Z"
"value": "2020-06-25T12:32:14.240Z"
},
{
"name": "Version",
"value": "2009-01-01"
}
],
"url": "https://mws.amazonservices.ca/Feeds/2009-01-01?AWSAccessKeyId=x&Action=SubmitFeed&ContentMD5Value=bDhJasSNYDMcVWyPpo%2Bvyw%3D%3D&FeedType=_POST_PRODUCT_DATA_&MWSAuthToken=x&SellerId=x&Signature=tD7hfvr0yP7yyImiKckwTzYQvJOV2SUbWH9r8YMblRw%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2020-06-25T13%3A07%3A07.903Z&Version=2009-01-01"
"url": "https://mws.amazonservices.ca/Feeds/2009-01-01?AWSAccessKeyId=x&Action=SubmitFeed&ContentMD5Value=bDhJasSNYDMcVWyPpo%2Bvyw%3D%3D&FeedType=_POST_PRODUCT_DATA_&MWSAuthToken=x&SellerId=x&Signature=P3YPb5Od6%2BJ4TLn0brBtyGQFvrzEyAQ3VsVPCGrtLss%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2020-06-25T12%3A32%3A14.240Z&Version=2009-01-01"
},
"response": {
"bodySize": 486,
"content": {
"mimeType": "text/xml",
"size": 486,
"text": "<?xml version=\"1.0\"?>\n<SubmitFeedResponse xmlns=\"http://mws.amazonaws.com/doc/2009-01-01/\"><SubmitFeedResult><FeedSubmissionInfo><FeedSubmissionId>51800018438</FeedSubmissionId><FeedType>_POST_PRODUCT_DATA_</FeedType><SubmittedDate>2020-06-25T13:07:08+00:00</SubmittedDate><FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus></FeedSubmissionInfo></SubmitFeedResult><ResponseMetadata><RequestId>99cb54df-69c2-454d-b0aa-49da94092d18</RequestId></ResponseMetadata></SubmitFeedResponse>"
"text": "<?xml version=\"1.0\"?>\n<SubmitFeedResponse xmlns=\"http://mws.amazonaws.com/doc/2009-01-01/\"><SubmitFeedResult><FeedSubmissionInfo><FeedSubmissionId>51799018438</FeedSubmissionId><FeedType>_POST_PRODUCT_DATA_</FeedType><SubmittedDate>2020-06-25T12:32:14+00:00</SubmittedDate><FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus></FeedSubmissionInfo></SubmitFeedResult><ResponseMetadata><RequestId>cdf4c6ca-67ec-42d9-9cc7-5cac67df723a</RequestId></ResponseMetadata></SubmitFeedResponse>"
},
"cookies": [],
"headers": [
Expand All @@ -107,7 +107,7 @@
},
{
"name": "date",
"value": "Thu, 25 Jun 2020 13:07:08 GMT"
"value": "Thu, 25 Jun 2020 12:32:14 GMT"
},
{
"name": "content-type",
Expand Down Expand Up @@ -135,27 +135,27 @@
},
{
"name": "x-mws-response-context",
"value": "9PSFFB/bO20TBQPIsEe0gkTrY8ufWcBnKlJDU3m8+3RcKGX3yXR5LXM8pNeHS4ir8cGFalY0wQI=, 3nlbmsxkAzfsqB1kAxdwxr4DkR+uGUamiWmBtsFySulWScnsQb5MU53w0jiG1Ify/CNjGzJ2uao="
"value": "KaMSjJJFKD5H8WoDG0Rf6THe/fAmsueFQ7Pcjlu+Ac5R4bH3TXoS7st5Vgz3NZlVFgNqf4Kdi1E=, ytN4oXk4X/HCufBmiasfjZ8QYEaeC0kK/VZRmhWnxttkL50/1APA+IR+yZvNvyt6Wdba4zTlw7Q="
},
{
"name": "x-amz-request-id",
"value": "99cb54df-69c2-454d-b0aa-49da94092d18"
"value": "cdf4c6ca-67ec-42d9-9cc7-5cac67df723a"
},
{
"name": "x-mws-request-id",
"value": "99cb54df-69c2-454d-b0aa-49da94092d18"
"value": "cdf4c6ca-67ec-42d9-9cc7-5cac67df723a"
},
{
"name": "x-mws-timestamp",
"value": "2020-06-25T13:07:08.265Z"
"value": "2020-06-25T12:32:14.514Z"
},
{
"name": "vary",
"value": "Content-Type,Accept-Encoding,X-Amzn-CDN-Cache,X-Amzn-AX-Treatment,User-Agent"
},
{
"name": "x-amz-rid",
"value": "A2GEZ93HB45VKJK4JS45"
"value": "JKCPZQPS3F65PPYWSKE5"
}
],
"headersSize": 678,
Expand All @@ -164,16 +164,16 @@
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-06-25T13:07:07.908Z",
"time": 734,
"startedDateTime": "2020-06-25T12:32:14.245Z",
"time": 614,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 734
"wait": 614
}
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{
"log": {
"_recordingName": "submit-feed/should be able to submit sample feed",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "4.3.0"
},
"entries": [
{
"_id": "b4391da807354cda8b8ffaab25e22621",
"_order": 0,
"cache": {},
"request": {
"bodySize": 1484,
"cookies": [],
"headers": [
{
"name": "accept",
"value": "application/json, text/plain, */*"
},
{
"name": "content-type",
"value": "text/xml"
},
{
"name": "user-agent",
"value": "@scaleleap/amazon-mws-api-sdk/1.0.0 (Language=JavaScript)"
},
{
"name": "content-length",
"value": 1484
},
{
"name": "host",
"value": "mws.amazonservices.ca"
}
],
"headersSize": 628,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "text/xml",
"params": [],
"text": "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<AmazonEnvelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"amzn-envelope.xsd\">\n <Header>\n <DocumentVersion>1.01</DocumentVersion>\n <MerchantIdentifier>M_EXAMPLE_123456</MerchantIdentifier>\n </Header>\n <MessageType>Product</MessageType>\n <PurgeAndReplace>false</PurgeAndReplace>\n <Message>\n <MessageID>1</MessageID>\n <OperationType>Update</OperationType>\n <Product>\n <SKU>56789</SKU>\n <StandardProductID>\n <Type>ASIN</Type>\n <Value>B0EXAMPLEG</Value>\n </StandardProductID>\n <ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>\n <DescriptionData>\n <Title>Example Product Title</Title>\n <Brand>Example Product Brand</Brand>\n <Description>This is an example product description.</Description>\n <BulletPoint>Example Bullet Point 1</BulletPoint>\n <BulletPoint>Example Bullet Point 2</BulletPoint>\n <MSRP currency=\"USD\">25.19</MSRP>\n <Manufacturer>Example Product Manufacturer</Manufacturer>\n <ItemType>example-item-type</ItemType>\n </DescriptionData>\n <ProductData>\n <Health>\n <ProductType>\n <HealthMisc>\n <Ingredients>Example Ingredients</Ingredients>\n <Directions>Example Directions</Directions>\n </HealthMisc>\n </ProductType>\n </Health>\n </ProductData>\n </Product>\n </Message>\n</AmazonEnvelope>\n"
},
"queryString": [
{
"name": "AWSAccessKeyId",
"value": "AKIAIAIAAT7ND54ZZHCA"
},
{
"name": "Action",
"value": "SubmitFeed"
},
{
"name": "ContentMD5Value",
"value": "bDhJasSNYDMcVWyPpo+vyw=="
},
{
"name": "FeedType",
"value": "_POST_PRODUCT_DATA_"
},
{
"name": "MWSAuthToken",
"value": "amzn.mws.ceb0168c-9b0a-a870-3728-898489b540f5"
},
{
"name": "SellerId",
"value": "AUZWHWR0590BC"
},
{
"name": "Signature",
"value": "V+nhflAhhUzOKbbtJ3atvKo9M5H3u1ybF4U31BRHnJE="
},
{
"name": "SignatureMethod",
"value": "HmacSHA256"
},
{
"name": "SignatureVersion",
"value": "2"
},
{
"name": "Timestamp",
"value": "2020-06-25T13:17:18.123Z"
},
{
"name": "Version",
"value": "2009-01-01"
}
],
"url": "https://mws.amazonservices.ca/Feeds/2009-01-01?AWSAccessKeyId=x&Action=SubmitFeed&ContentMD5Value=bDhJasSNYDMcVWyPpo%2Bvyw%3D%3D&FeedType=_POST_PRODUCT_DATA_&MWSAuthToken=x&SellerId=x&Signature=V%2BnhflAhhUzOKbbtJ3atvKo9M5H3u1ybF4U31BRHnJE%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2020-06-25T13%3A17%3A18.123Z&Version=2009-01-01"
},
"response": {
"bodySize": 486,
"content": {
"mimeType": "text/xml",
"size": 486,
"text": "<?xml version=\"1.0\"?>\n<SubmitFeedResponse xmlns=\"http://mws.amazonaws.com/doc/2009-01-01/\"><SubmitFeedResult><FeedSubmissionInfo><FeedSubmissionId>51801018438</FeedSubmissionId><FeedType>_POST_PRODUCT_DATA_</FeedType><SubmittedDate>2020-06-25T13:17:18+00:00</SubmittedDate><FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus></FeedSubmissionInfo></SubmitFeedResult><ResponseMetadata><RequestId>e6226f27-7e18-4f25-98b1-c76ea0f49e91</RequestId></ResponseMetadata></SubmitFeedResponse>"
},
"cookies": [],
"headers": [
{
"name": "server",
"value": "Server"
},
{
"name": "date",
"value": "Thu, 25 Jun 2020 13:17:18 GMT"
},
{
"name": "content-type",
"value": "text/xml"
},
{
"name": "transfer-encoding",
"value": "chunked"
},
{
"name": "connection",
"value": "close"
},
{
"name": "x-mws-quota-max",
"value": "30.0"
},
{
"name": "x-mws-quota-remaining",
"value": "30.0"
},
{
"name": "x-mws-quota-resetson",
"value": "2020-06-25T14:12:00.000Z"
},
{
"name": "x-mws-response-context",
"value": "d5TXZmKIPMUzVw195OP40nbl1G8bEaVdNnso0VphoRcMrBTqtYfP9XT2XVm73qGEL8If3QMZoF0=, PYo4uTL5lD+Nn0F6nhYC6P9LEWZwRuXVmYfvrjOfDD8UoAzBKJDoiLuxjH3z0uVOC5CufnQUWqw="
},
{
"name": "x-amz-request-id",
"value": "e6226f27-7e18-4f25-98b1-c76ea0f49e91"
},
{
"name": "x-mws-request-id",
"value": "e6226f27-7e18-4f25-98b1-c76ea0f49e91"
},
{
"name": "x-mws-timestamp",
"value": "2020-06-25T13:17:18.266Z"
},
{
"name": "vary",
"value": "Content-Type,Accept-Encoding,X-Amzn-CDN-Cache,X-Amzn-AX-Treatment,User-Agent"
},
{
"name": "x-amz-rid",
"value": "3ZFYRJEG1X9VWBTXM9Q5"
}
],
"headersSize": 678,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-06-25T13:17:18.136Z",
"time": 365,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 365
}
}
],
"pages": [],
"version": "1.2"
}
}
20 changes: 1 addition & 19 deletions test/integration/feeds.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { readFileSync } from 'fs'
import { join } from 'path'

import { Feeds, SubmitFeedParameters } from '../../src'
import { Feeds } from '../../src'
import { Config } from './config'
import { itci } from './it'

Expand Down Expand Up @@ -39,21 +36,6 @@ describe(`${Feeds.name}`, () => {
expect(typeof response.Count).toBe('number')
})

itci('should be able to submit sample feed', async () => {
expect.assertions(1)

const parameters: SubmitFeedParameters = {
FeedContent: readFileSync(join(__dirname, `/submit_feed_sample_feed_content.xml`), {
encoding: 'utf8',
}),
FeedType: '_POST_PRODUCT_DATA_',
}

const [response] = await feeds.submitFeed(parameters)

expect(response).toBeDefined()
})

itci('should be able to list feed submission list', async () => {
expect.assertions(1)

Expand Down

0 comments on commit 9a39e00

Please sign in to comment.