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

initial attempt at a typescript definitions file by hand #170

Merged
merged 28 commits into from
Sep 30, 2020
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8fb03fd
initial attempt at a typescript definitions file by hand
ericblade Jun 5, 2020
40f7180
add TS paramaters for several functions
ericblade Jun 5, 2020
13747dc
fix missing =
ericblade Jun 6, 2020
3a20001
add ValueOf<T>, add MarketplaceId type
ericblade Jun 6, 2020
fd465a5
use ts-mocha for tests instead of mocha
ericblade Jun 16, 2020
71baef3
test-api.js => .ts
ericblade Jun 16, 2020
ac8087c
test-api is now in typescript, issues with that working fixed
ericblade Jun 16, 2020
3f7611a
test-api.ts works, some adjustments made in .d.ts, .d.ts moved
ericblade Jun 16, 2020
dad4a94
add typescript support for getMarketplaces and listOrders
ericblade Jun 17, 2020
4b8855f
add listOrderItems typescript
ericblade Jun 19, 2020
3aaa3d4
add typescript support for getOrder
ericblade Jun 19, 2020
ec85240
TypeScript return for getInboundGuidance*
ericblade Jun 19, 2020
a1a30af
TypeScript support for getMatchingProductForId
ericblade Jun 19, 2020
1c50590
TypeScript support for getLowestPricedOffers*
ericblade Jun 19, 2020
0380233
TypeScript support for getProductCategories*
ericblade Jun 19, 2020
5707e30
TypeScript for getMyFeesEstimate
ericblade Jun 19, 2020
8f69726
minor adjustment because it's not working on my desktop? i don't unde…
ericblade Jun 19, 2020
32c31b2
add input types for all report functions in .d.ts
ericblade Jun 21, 2020
ab39a85
CountryCode, CurrencyCode, MWSDomain
ericblade Jun 20, 2020
c608147
NONCOMPILANCE => NONCOMPLIANCE
ericblade Jun 20, 2020
cb02506
eliminate some repetition of string constant values
ericblade Jun 30, 2020
0777728
separate types for Reports functions
ericblade Jul 1, 2020
d2d9aa2
add esModuleInterop: true to test config
ericblade Jul 1, 2020
ae7f96e
that weird JSDoc import only works in ts-node not in tsc
ericblade Jul 8, 2020
8f24baa
tighten up IdTypes
ericblade Jul 8, 2020
5b5105f
fill out GetMatchingProductReturn more
ericblade Jul 8, 2020
de35c63
only use export = MwsAdvanced, seems to work
ericblade Aug 15, 2020
6f2699c
cleanup
ericblade Aug 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
separate types for Reports functions
  • Loading branch information
ericblade committed Aug 15, 2020
commit 077772823a818bea4d5e75813a0d0988140b17ba
2 changes: 1 addition & 1 deletion lib/helpers/reports.js
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ const requestReport = (api) => api.parseEndpoint((out) => out.ReportRequestInfo)
// interface will also show up here. Somewhere in the docs, it says that Amazon
// keeps all reports for 90 days.

// TODO: for some reason GetReportRequestListResult showsmentation twice.
// TODO: for some reason GetReportRequestListResult shows in documentation twice.
/**
* @typedef GetReportRequestListResult
* @param {string} ReportType Type of Report Requested @see {@link REQUEST_REPORT_TYPES}
104 changes: 83 additions & 21 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { OrderItem } from "./parsers/orderItems";
import { GetReportRequestListResult } from "./helpers/reports";

export type InitParams = {
type InitParams = {
accessKeyId: string;
authToken?: string;
host?: string;
@@ -424,6 +425,60 @@ export type GetFeesReturn = {
},
};

export type NextTokenParams = { NextToken: string };

export type RequestReportParams = {
ReportType: string,
ReportProcessingStatus?: string,
EndDate?: string,
Scheduled?: boolean,
ReportRequestId?: string,
SubmittedDate?: string,
StartDate?: string,
};
export type RequestReportReturn = any;

export type GetReportRequestListParams = {
ReportRequestIdList?: Array<string>,
ReportTypeList?: string,
ReportProcessingStatusList?: string,
MaxCount?: number,
RequestedFromDate?: Date,
RequestedToDate?: Date,
};
export type GetReportRequestListReturn = any;

export type GetReportParams = { ReportId: string };
export type GetReportReturn = any;

export type GetReportListParams = {
MaxCount?: number,
ReportTypeList?: Array<string>,
Acknowledged?: boolean,
ReportRequestIdList?: Array<string>,
AvailableFromDate?: Date,
AvailableToDate?: Date,
};
export type GetReportListReturn = any;

export type RequestAndDownloadReportReturn = any;

export type ManageReportScheduleParams = {
ReportType: string,
Schedule: any,
ScheduleDate?: Date,
};
export type ManageReportScheduleReturn = any;

export type UpdateReportAcknowledgementsParams = {
ReportIdList: Array<string>,
Acknowledged?: boolean,
};
export type UpdateReportAcknowledgementsReturn = any;

export type GetReportScheduleListParams = { ReportTypeList?: Array<string> };
export type GetReportScheduleListReturn = any;

export default class MwsAdvanced {
static constants: {
ericblade marked this conversation as resolved.
Show resolved Hide resolved
MWS_MARKETPLACES: MWS_MARKETPLACES,
@@ -479,24 +534,31 @@ export default class MwsAdvanced {
getMyFeesEstimate(params: Array<GetFeesParams>): Promise<GetFeesReturn>;
static getMyFeesEstimate(params: Array<GetFeesParams>): Promise<GetFeesReturn>;

requestReport(params: { ReportType: string, ReportProcessingStatus?: string, EndDate?: string, Scheduled?: boolean, ReportRequestId?: string, SubmittedDate?: string, StartDate?: string }): Promise<any>;
static requestReport(params: { ReportType: string, ReportProcessingStatus?: string, EndDate?: string, Scheduled?: boolean, ReportRequestId?: string, SubmittedDate?: string, StartDate?: string }): Promise<any>;
getReportRequestList(params: { ReportRequestIdList?: Array<string>, ReportTypeList?: string, ReportProcessingStatusList?: string, MaxCount?: number, RequestedFromDate?: Date, RequestedToDate?: Date }): Promise<any>;
static getReportRequestList(params: { ReportRequestIdList?: Array<string>, ReportTypeList?: string, ReportProcessingStatusList?: string, MaxCount?: number, RequestedFromDate?: Date, RequestedToDate?: Date }): Promise<any>;
getReport(params: { ReportId: string }): Promise<any>;
static getReport(params: { ReportId: string }): Promise<any>;
getReportList(params: { MaxCount?: number, ReportTypeList?: Array<string>, Acknowledged?: boolean, ReportRequestIdList?: Array<string>, AvailableFromDate?: Date, AvailableToDate?: Date }): Promise<any>;
static getReportList(params: { MaxCount?: number, ReportTypeList?: Array<string>, Acknowledged?: boolean, ReportRequestIdList?: Array<string>, AvailableFromDate?: Date, AvailableToDate?: Date }): Promise<any>;
getReportListByNextToken(params: { NextToken: string }): Promise<any>;
static getReportListByNextToken(params: { NextToken: string }): Promise<any>;
getReportListAll(params: { MaxCount?: number, ReportTypeList?: Array<string>, Acknowledged?: boolean, ReportRequestIdList?: Array <string>, AvailableFromDate?: Date, AvailableToDate?: Date }): Promise<any>;
static getReportListAll(params: { MaxCount?: number, ReportTypeList?: Array<string>, Acknowledged?: boolean, ReportRequestIdList?: Array<string>, AvailableFromDate?: Date, AvailableToDate?: Date }): Promise<any>;
requestAndDownloadReport(reportType: string, file: string, params?: any): Promise<any>;
static requestAndDownloadReport(reportType: string, file: string, params?: any): Promise<any>;
manageReportSchedule(params: { ReportType: string, Schedule: any, ScheduleDate?: Date }): Promise<any>;
static manageReportSchedule(params: { ReportType: string, Schedule: any, ScheduleDate?: Date }): Promise<any>;
updateReportAcknowledgements(params: { ReportIdList: Array<string>, Acknowledged?: boolean }): Promise<any>;
static updateReportAcknowledgements(params: { ReportIdList: Array<string>, Acknowledged?: boolean }): Promise<any>;
getReportScheduleList(params: { ReportTypeList?: Array<string> }): Promise<any>;
static getReportScheduleList(params: { ReportTypeList?: Array<string> }): Promise<any>;
requestReport(params: RequestReportParams): Promise<RequestReportReturn>;
static requestReport(params: RequestReportParams): Promise<RequestReportReturn>;

getReportRequestList(params: GetReportRequestListParams): Promise<GetReportRequestListResult>; // typescript imported this from the JSDoc, interesting? which is why it's name doesn't conform
static getReportRequestList(params: GetReportRequestListParams): Promise<GetReportRequestListResult>;

getReport(params: GetReportParams): Promise<GetReportReturn>;
static getReport(params: GetReportParams): Promise<GetReportReturn>;

getReportList(params: GetReportListParams): Promise<GetReportListReturn>;
static getReportList(params: GetReportListParams): Promise<GetReportListReturn>;
getReportListByNextToken(params: NextTokenParams): Promise<GetReportListReturn>;
static getReportListByNextToken(params: NextTokenParams): Promise<GetReportListReturn>;
getReportListAll(params: GetReportListParams): Promise<GetReportListReturn>;
static getReportListAll(params: GetReportListParams): Promise<GetReportListReturn>;

requestAndDownloadReport(reportType: string, file: string, params?: any): Promise<RequestAndDownloadReportReturn>;
static requestAndDownloadReport(reportType: string, file: string, params?: any): Promise<RequestAndDownloadReportReturn>;

manageReportSchedule(params: ManageReportScheduleParams): Promise<ManageReportScheduleReturn>;
static manageReportSchedule(params: ManageReportScheduleParams): Promise<ManageReportScheduleReturn>;

updateReportAcknowledgements(params: UpdateReportAcknowledgementsParams): Promise<UpdateReportAcknowledgementsReturn>;
static updateReportAcknowledgements(params: UpdateReportAcknowledgementsParams): Promise<UpdateReportAcknowledgementsReturn>;

getReportScheduleList(params: GetReportScheduleListParams): Promise<GetReportScheduleListReturn>;
static getReportScheduleList(params: GetReportScheduleListParams): Promise<GetReportScheduleListReturn>;
}