Skip to content

Commit

Permalink
feat: add sb search term report
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyentoanit committed Apr 20, 2020
1 parent 73f4f42 commit 5ea0ba9
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/operations/reports/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from './sponsored-brands-ad-group-report-metrics'
export * from './sponsored-brands-campaign-report-metrics'
export * from './sponsored-brands-headline-search-report-metrics'
export * from './sponsored-brands-keyword-report-metrics'
export * from './sponsored-brands-search-term-report-metrics'
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import * as t from 'io-ts'

export const SponsoredBrandsSearchTermReportMetrics = t.union([
/**
* Unique numerical ID of the campaign
*/
t.literal('campaignId'),

/**
* Unique name of the campaign
*/
t.literal('campaignName'),

/**
* Unique numerical ID of the ad group
*/
t.literal('adGroupId'),

/**
* Unique name of the ad group
*/
t.literal('adGroupName'),

t.literal('campaignBudgetType'),

/**
* Status of the campaign
*/
t.literal('campaignStatus'),

/**
* ID of the keyword used in bid
*/
t.literal('keywordId'),

/**
* Keyword state.
*/
t.literal('keywordStatus'),

/**
* User-set bid value for keyword.
*/
t.literal('keywordBid'),

/**
* Text of the keyword or phrase used in bid
*/
t.literal('keywordText'),

/**
* Type of matching for the keyword or phrase used in bid. Must be one of: broad, phrase, or exact
*/
t.literal('matchType'),
])
export type SponsoredBrandsSearchTermReportMetrics = t.TypeOf<
typeof SponsoredBrandsSearchTermReportMetrics
>
1 change: 1 addition & 0 deletions src/operations/reports/report-types-enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export enum SponsoredBrandsReportTypeEnum {
AD_GROUPS = 'adGroups',
KEYWORDS = 'keywords',
HEADLINE_SEARCH = 'headlineSearch',
SEARCH_TERM = 'searchTerms',
}
1 change: 1 addition & 0 deletions src/operations/reports/sponsored-brands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './sponsored-brands-ad-group-report-params'
export * from './sponsored-brands-campaign-report-params'
export * from './sponsored-brands-keyword-report-params'
export * from './sponsored-brands-headline-search-report-params'
export * from './sponsored-brands-search-term-report-params'
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ import { omit } from 'lodash'
import { Decode } from '../../../decorators'
import { BaseReportOperation } from '../base-report-operation'
import { ReportResponse } from '../report-response'
import { SponsoredBrandsAdGroupReportParams } from './sponsored-brands-ad-group-report-params'
import { SponsoredBrandsCampaignReportParams } from './sponsored-brands-campaign-report-params'
import { SponsoredBrandsKeywordReportParams } from './sponsored-brands-keyword-report-params'
import { SponsoredBrandsHeadlineSearchReportParams } from './sponsored-brands-headline-search-report-params'
import {
SponsoredBrandsAdGroupReportParams,
SponsoredBrandsCampaignReportParams,
SponsoredBrandsKeywordReportParams,
SponsoredBrandsHeadlineSearchReportParams,
SponsoredBrandsSearchTermReportParams,
} from './index'

type SponsoredBrandsReportParams =
| SponsoredBrandsAdGroupReportParams
| SponsoredBrandsCampaignReportParams
| SponsoredBrandsKeywordReportParams
| SponsoredBrandsHeadlineSearchReportParams
| SponsoredBrandsSearchTermReportParams

export class SponsoredBrandsReportOperation<
ReportParams extends SponsoredBrandsReportParams
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { BaseReportParams } from '../base-report-params'
import { SponsoredBrandsReportTypeEnum } from '../report-types-enum'
import { SponsoredBrandsSearchTermReportMetrics } from '../metrics'

export interface SponsoredBrandsSearchTermReportParams
extends BaseReportParams<SponsoredBrandsReportTypeEnum, SponsoredBrandsSearchTermReportMetrics> {
recordType: SponsoredBrandsReportTypeEnum.SEARCH_TERM
}

0 comments on commit 5ea0ba9

Please sign in to comment.