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

Commit

Permalink
fix: expose parameters reports
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jun 22, 2020
1 parent 48ab7c9 commit 474218f
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions src/sections/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const REPORTS_API_VERSION = '2009-01-01'
* http://docs.developer.amazonservices.com/en_CA/reports/Reports_ReportType.html#ReportTypeCategories__ListingsReports
*/
const ReportType = string
type ReportType = GetInterface<typeof ReportType>
export type ReportType = GetInterface<typeof ReportType>

interface RequestReportParameters {
export interface RequestReportParameters {
ReportType: ReportType
StartDate?: Date
EndDate?: Date
Expand All @@ -47,7 +47,7 @@ const ReportRequestInfo = Codec.interface({
CompletedDate: optional(mwsDate),
})

type ReportRequestInfo = GetInterface<typeof ReportRequestInfo>
export type ReportRequestInfo = GetInterface<typeof ReportRequestInfo>

const RequestReportResponse = Codec.interface({
RequestReportResponse: Codec.interface({
Expand Down Expand Up @@ -102,7 +102,7 @@ export type ScheduleType =
| '_30_DAYS_'
| '_NEVER_'

interface GetReportRequestListParameters {
export interface GetReportRequestListParameters {
ReportRequestIdList?: string[]
ReportTypeList?: ReportType[]
ReportProcessingStatusList?: ReportProcessing[]
Expand All @@ -117,7 +117,7 @@ const GetReportRequestListResult = Codec.interface({
ReportRequestInfo: optional(oneOf([array(ReportRequestInfo), ReportRequestInfo, exactly('')])),
})

type GetReportRequestListResult = GetInterface<typeof GetReportRequestListResult>
export type GetReportRequestListResult = GetInterface<typeof GetReportRequestListResult>

const GetReportRequestListResponse = Codec.interface({
GetReportRequestListResponse: Codec.interface({
Expand All @@ -131,11 +131,11 @@ const GetReportRequestListByNextTokenResponse = Codec.interface({
}),
})

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

interface GetReportRequestCountParameters {
export interface GetReportRequestCountParameters {
ReportTypeList?: ReportType[]
ReportProcessingStatusList?: ReportProcessing[]
RequestedFromDate?: Date
Expand All @@ -152,9 +152,9 @@ const GetReportRequestCountResponse = Codec.interface({
}),
})

type GetReportRequestCount = GetInterface<typeof GetReportRequestCount>
export type GetReportRequestCount = GetInterface<typeof GetReportRequestCount>

interface CancelReportRequestsParameters {
export interface CancelReportRequestsParameters {
ReportRequestIdList?: string[]
ReportTypeList?: ReportType[]
ReportProcessingStatusList?: ReportProcessing[]
Expand All @@ -173,9 +173,9 @@ const CancelReportRequestsResponse = Codec.interface({
}),
})

type CancelReportRequests = GetInterface<typeof CancelReportRequests>
export type CancelReportRequests = GetInterface<typeof CancelReportRequests>

interface GetReportListParameters {
export interface GetReportListParameters {
MaxCount?: number
ReportTypeList?: ReportType[]
Acknowledged?: boolean
Expand Down Expand Up @@ -205,7 +205,7 @@ const GetReportListResponse = Codec.interface({
}),
})

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

Expand All @@ -215,7 +215,7 @@ const GetReportListByNextTokenResponse = Codec.interface({
}),
})

type GetReportListResult = GetInterface<typeof GetReportListResult>
export type GetReportListResult = GetInterface<typeof GetReportListResult>

const GetReportCount = Codec.interface({
Count: number,
Expand All @@ -227,7 +227,7 @@ const GetReportCountResponse = Codec.interface({
}),
})

interface GetReportCountParameters {
export interface GetReportCountParameters {
ReportTypeList?: ReportType[]
Acknowledged?: boolean
AvailableFromDate?: Date
Expand All @@ -247,9 +247,9 @@ const GetReportResponse = Codec.custom<string>({

type Report = string

type GetReportCount = GetInterface<typeof GetReportCount>
export type GetReportCount = GetInterface<typeof GetReportCount>

interface ManageReportScheduleParameters {
export interface ManageReportScheduleParameters {
ReportType: ReportType
Schedule: ScheduleType
ScheduleDate?: Date
Expand All @@ -266,15 +266,15 @@ const ManageReportSchedule = Codec.interface({
ReportSchedule: optional(oneOf([array(ReportSchedule), ReportSchedule, exactly('')])),
})

type ManageReportSchedule = GetInterface<typeof ManageReportSchedule>
export type ManageReportSchedule = GetInterface<typeof ManageReportSchedule>

const ManageReportScheduleResponse = Codec.interface({
ManageReportScheduleResponse: Codec.interface({
ManageReportScheduleResult: ManageReportSchedule,
}),
})

interface GetReportScheduleListParameters {
export interface GetReportScheduleListParameters {
ReportTypeList?: ReportType[]
}

Expand All @@ -284,31 +284,31 @@ const GetReportScheduleList = Codec.interface({
ReportSchedule: optional(oneOf([array(ReportSchedule), ReportSchedule, exactly('')])),
})

type GetReportScheduleList = GetInterface<typeof GetReportScheduleList>
export type GetReportScheduleList = GetInterface<typeof GetReportScheduleList>

const GetReportScheduleListResponse = Codec.interface({
GetReportScheduleListResponse: Codec.interface({
GetReportScheduleListResult: GetReportScheduleList,
}),
})

interface GetReportScheduleCountParameters {
export interface GetReportScheduleCountParameters {
ReportTypeList?: ReportType
}

const GetReportScheduleCount = Codec.interface({
Count: number,
})

type GetReportScheduleCount = GetInterface<typeof GetReportScheduleCount>
export type GetReportScheduleCount = GetInterface<typeof GetReportScheduleCount>

const GetReportScheduleCountResponse = Codec.interface({
GetReportScheduleCountResponse: Codec.interface({
GetReportScheduleCountResult: GetReportScheduleCount,
}),
})

interface UpdateReportAcknowledgementsParameters {
export interface UpdateReportAcknowledgementsParameters {
ReportIdList: string[]
Acknowledged?: boolean
}
Expand All @@ -318,13 +318,17 @@ const UpdateReportAcknowledgements = Codec.interface({
ReportInfo: optional(oneOf([array(ReportInfo), ReportInfo, exactly('')])),
})

type UpdateReportAcknowledgements = GetInterface<typeof UpdateReportAcknowledgements>
export type UpdateReportAcknowledgements = GetInterface<typeof UpdateReportAcknowledgements>

const UpdateReportAcknowledgementsResponse = Codec.interface({
UpdateReportAcknowledgementsResponse: Codec.interface({
UpdateReportAcknowledgementsResult: UpdateReportAcknowledgements,
}),
})

export interface GetReportParameters {
ReportId: string
}
export class Reports {
constructor(private httpClient: HttpClient) {}

Expand Down Expand Up @@ -418,7 +422,7 @@ export class Reports {
})
}

async getReport(parameters: { ReportId: string }): Promise<[Report, RequestMeta]> {
async getReport(parameters: GetReportParameters): Promise<[Report, RequestMeta]> {
const [response, meta] = await this.httpClient.request('POST', {
resource: Resource.Reports,
version: REPORTS_API_VERSION,
Expand Down

0 comments on commit 474218f

Please sign in to comment.