bhushankummar / amazon-mws

Amazon MWS NodeJS Wrapper
MIT License
197 stars 78 forks source link

Provide TypeScript type definitions for MWS JSON responses #151

Open zirkelc opened 3 years ago

zirkelc commented 3 years ago

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?

bhushankummar commented 3 years ago

@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.