Skip to content

Commit

Permalink
feat: split concrete and optional fields for Campaign type
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyentoanit committed Apr 20, 2020
1 parent d70c4bd commit be65b05
Showing 1 changed file with 47 additions and 44 deletions.
91 changes: 47 additions & 44 deletions src/operations/campaigns/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,59 +49,62 @@ export const CampaignBidding = t.type({
})
export type CampaignBidding = t.TypeOf<typeof CampaignBidding>

export const Campaign = t.partial({
/**
* The ID of the portfolio.
*/
portfolioId: PortfolioId,

/**
* The ID of the campaign.
*/
campaignId: CampaignId,
export const Campaign = t.intersection([
t.strict({
/**
* The ID of the campaign.
*/
campaignId: CampaignId,

/**
* The name of the campaign.
*/
name: CampaignName,
/**
* The name of the campaign.
*/
name: CampaignName,

/**
* Specifies the advertising product managed by this campaign.
*/
campaignType: CampaignType,
/**
* Specifies the advertising product managed by this campaign.
*/
campaignType: CampaignType,

/**
* Differentiates between a keyword-targeted and automatically targeted campaign.
*/
targetingType: CampaignTargetingType,
/**
* Differentiates between a keyword-targeted and automatically targeted campaign.
*/
targetingType: CampaignTargetingType,

/**
* The state of the campaign.
*/
state: CampaignState,
/**
* The state of the campaign.
*/
state: CampaignState,

/**
* Daily budget for the campaign.
*/
dailyBudget: t.number,
/**
* Daily budget for the campaign.
*/
dailyBudget: t.number,

/**
* The date the campaign will go or went live as YYYYMMDD.
*/
startDate: t.string,
/**
* The date the campaign will go or went live as YYYYMMDD.
*/
startDate: t.string,
}),
t.partial({
/**
* The ID of the portfolio.
*/
portfolioId: PortfolioId,

/**
* The optional date the campaign will stop running as YYYYMMDD.
*/
endDate: t.string,
/**
* The optional date the campaign will stop running as YYYYMMDD.
*/
endDate: t.string,

/**
* When enabled, Amazon will increase the default bid for your ads that are eligible to appear in this placement. See developer notes for more information.
*/
premiumBidAdjustment: t.boolean,
/**
* When enabled, Amazon will increase the default bid for your ads that are eligible to appear in this placement. See developer notes for more information.
*/
premiumBidAdjustment: t.boolean,

bidding: CampaignBidding,
})
bidding: CampaignBidding,
}),
])
export type Campaign = t.TypeOf<typeof Campaign>

export const SponsoredProductsCampaignCreateParams = t.intersection([
Expand Down

0 comments on commit be65b05

Please sign in to comment.