amazon-mws icon indicating copy to clipboard operation
amazon-mws copied to clipboard

Provide TypeScript type definitions for MWS JSON responses

Open zirkelc opened this issue 3 years ago • 1 comments

Hi,

would it be possible to provide TypeScript type definitions for the different MWS JSON responses? For example, a call to mws.reports.submit({'Version': '2009-01-01', 'Action': 'RequestReport', ...) would provide the following result:

// Base type for Report Responses
export type ReportResponse = {
	Headers: { [key: string]: string; };
	StatusCode: number;
	ResponseMetadata: { RequestId: string };
	Type?: string;
	Code?: number;
	Message?: string;
}

// RequestReportResponse
export type RequestReportResponse = ReportResponse & {
	ReportRequestInfo: ReportRequestInfo;
}

export type ReportRequestInfo = {
	ReportType: string;
	ReportProcessingStatus: string;
	EndDate: string;
	Scheduled: boolean,
	ReportRequestId: string;
	SubmittedDate: string;
	StartDate: string;
	CompletedDate: string;
	GeneratedReportId: string;
}

I'm going to create type definitions for a few API calls as I need them. I could provide them as PR, if you are interested in taking them into your project?

zirkelc avatar Dec 13 '20 09:12 zirkelc

@chriszirkel Sure, I would like to add this. Please take a look a this file https://github.com/bhushankumarl/amazon-mws/blob/master/index.d.ts.

bhushankummar avatar Jan 05 '21 08:01 bhushankummar