-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement get ad group, get keyword, create keyword bid recomme…
…ndation methods
- Loading branch information
1 parent
6fff4aa
commit 0a44d2a
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
src/operations/bidding/sponsored-products-bid-recommendation-operation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) | ||
} | ||
} |