From eb66d8f98feb6fa25d948cd056399077cf32e2d1 Mon Sep 17 00:00:00 2001 From: Toan Nguyen Date: Thu, 23 Apr 2020 21:40:29 +0700 Subject: [PATCH] feat: export BidRecommendationForTargetsResponse and implement getBidRecommendations method --- ...red-products-bid-recommendation-operation.ts | 17 +++++++++++++++++ src/operations/bidding/types.ts | 3 +++ 2 files changed, 20 insertions(+) diff --git a/src/operations/bidding/sponsored-products-bid-recommendation-operation.ts b/src/operations/bidding/sponsored-products-bid-recommendation-operation.ts index c412fa4e4..20226a048 100644 --- a/src/operations/bidding/sponsored-products-bid-recommendation-operation.ts +++ b/src/operations/bidding/sponsored-products-bid-recommendation-operation.ts @@ -7,6 +7,8 @@ import { KeywordBidRecommendationsResponse, KeywordBidRecommendationsData, BidRecommendationsResponse, + BidRecommendationRequest, + BidRecommendationForTargetsResponse, } from './types' import { KeywordId } from '../keywords/types' @@ -55,4 +57,19 @@ export class SponsoredProductsBidRecommendationOperation extends Operation { params, ) } + + /** + * Retrieve a list of bid recommendations for keyword, product, or auto targeting expressions by adGroupId. + * + * @param {BidRecommendationRequest} params + * @returns BidRecommendationForTargetsResponse + * @memberof SponsoredProductsBidRecommendationOperation + */ + @Decode(BidRecommendationForTargetsResponse) + public getBidRecommendations(params: BidRecommendationRequest) { + return this.client.post( + `${this.resource}/targets/bidRecommendations`, + params, + ) + } } diff --git a/src/operations/bidding/types.ts b/src/operations/bidding/types.ts index 778319b54..bb3593a96 100644 --- a/src/operations/bidding/types.ts +++ b/src/operations/bidding/types.ts @@ -213,3 +213,6 @@ export const BidRecommendationForTargetsResponse = t.strict({ */ recommendations: BidRecommendationLists, }) +export type BidRecommendationForTargetsResponse = t.TypeOf< + typeof BidRecommendationForTargetsResponse +>