Skip to content

Commit

Permalink
feat: implement get ad group, get keyword, create keyword bid recomme…
Browse files Browse the repository at this point in the history
…ndation methods
  • Loading branch information
nguyentoanit committed Apr 25, 2020
1 parent 6fff4aa commit 0a44d2a
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Operation } from '../operation'
import { Decode } from '../../decorators'
import { AmazonAdTypeURIPrefix } from '../amazon-ad-type-uri-prefix'
import { AdGroupId } from '../ad-groups/types'
import {
AdGroupBidRecommendationsResponse,
KeywordBidRecommendationsResponse,
KeywordBidRecommendationsData,
BidRecommendationsResponse,
} from './types'
import { KeywordId } from '../keywords/types'

export class SponsoredProductsBidRecommendationOperation extends Operation {
protected resource = `${this.version}/${AmazonAdTypeURIPrefix.SponsoredProducts}/`

/**
* Request bid recommendations for specified ad group.
*
* @param {AdGroupId} id
* @returns AdGroupBidRecommendationsResponse
* @memberof SponsoredProductsBidRecommendationOperation
*/
@Decode(AdGroupBidRecommendationsResponse)
public getAdGroupBidRecommendations(id: AdGroupId) {
return this.client.get<AdGroupBidRecommendationsResponse>(
`${this.resource}/adGroups/${id}/bidRecommendations`,
)
}

/**
* Request bid recommendations for specified keyword.
*
* @param {KeywordId} id
* @returns KeywordBidRecommendationsResponse
* @memberof SponsoredProductsBidRecommendationOperation
*/
@Decode(KeywordBidRecommendationsResponse)
public getKeywordBidRecommendations(id: KeywordId) {
return this.client.get<KeywordBidRecommendationsResponse>(
`${this.resource}/keywords/${id}/bidRecommendations`,
)
}

/**
* Request bid recommendations for a list of up to 100 keywords.
*
* @param {KeywordBidRecommendationsData} params
* @returns BidRecommendationsResponse
* @memberof SponsoredProductsBidRecommendationOperation
*/
@Decode(BidRecommendationsResponse)
public createKeywordBidRecommendations(params: KeywordBidRecommendationsData) {
return this.client.post<BidRecommendationsResponse>(
`${this.resource}/keywords/bidRecommendations`,
params,
)
}
}

0 comments on commit 0a44d2a

Please sign in to comment.