diff --git a/src/operations/reports/base-report-params.ts b/src/operations/reports/base-report-params.ts index 1abae0e63..1ed4eb13f 100644 --- a/src/operations/reports/base-report-params.ts +++ b/src/operations/reports/base-report-params.ts @@ -1,4 +1,4 @@ -import { ReportSegmentsEnum } from './report-segments-enum' +import { ReportSegments } from './report-segments' export interface BaseReportParams { /** @@ -10,7 +10,7 @@ export interface BaseReportParams { * _Optional_. Dimension on which to segment the report. See segmentation details in the * following table. */ - segment?: ReportSegmentsEnum + segment?: ReportSegments /** * The date for which to retrieve the performance report in YYYYMMDD format. diff --git a/src/operations/reports/index.ts b/src/operations/reports/index.ts index 1b233d84e..ffcb5b9d8 100644 --- a/src/operations/reports/index.ts +++ b/src/operations/reports/index.ts @@ -2,5 +2,5 @@ export * from './metrics/index' export * from './sponsored-brands/index' export * from './sponsored-products/index' export * from './report-response' -export * from './report-segments-enum' +export * from './report-segments' export * from './report-types-enum' diff --git a/src/operations/reports/report-segments-enum.ts b/src/operations/reports/report-segments.ts similarity index 61% rename from src/operations/reports/report-segments-enum.ts rename to src/operations/reports/report-segments.ts index 3560728bd..96d6f19cd 100644 --- a/src/operations/reports/report-segments-enum.ts +++ b/src/operations/reports/report-segments.ts @@ -1,13 +1,16 @@ -export enum ReportSegmentsEnum { +import * as t from 'io-ts' + +export const ReportSegments = t.union([ /** * The optional dimension on which to segment a keyword report. * This is also referred to as the search terms report. */ - QUERY = 'query', + t.literal('query'), /** * The optional dimension on which to segment a campaigns report. * Placement refers to the location on a page where your ad appears. */ - PLACEMENT = 'placement', -} + t.literal('placement'), +]) +export type ReportSegments = t.TypeOf diff --git a/test/index.test.ts b/test/index.test.ts index 2d281569a..63569b8b4 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -163,7 +163,7 @@ describe('index', () => { reportEnum.SponsoredProductsProductTargetingReportMetrics, ) expect(index.ReportResponseStatus).toEqual(reportEnum.ReportResponseStatus) - expect(index.ReportSegmentsEnum).toEqual(reportEnum.ReportSegmentsEnum) + expect(index.ReportSegments).toEqual(reportEnum.ReportSegments) expect(index.SponsoredBrandsReportTypeEnum).toEqual(reportEnum.SponsoredBrandsReportTypeEnum) expect(index.SponsoredProductsReportTypeEnum).toEqual( reportEnum.SponsoredProductsReportTypeEnum,