diff --git a/package.json b/package.json index 518fafb7c..68a40ee57 100644 --- a/package.json +++ b/package.json @@ -114,4 +114,4 @@ "git add" ] } -} +} \ No newline at end of file diff --git a/src/endpoints/promotions.js b/src/endpoints/promotions.js index c20a59fac..86e379758 100644 --- a/src/endpoints/promotions.js +++ b/src/endpoints/promotions.js @@ -12,14 +12,18 @@ class PromotionsEndpoint extends CRUDExtend { return this.request.send(`${this.endpoint}/attributes`, 'GET') } - Codes(promotionId) { - const { limit, offset } = this - return this.request.send( - buildURL(`${this.endpoint}/${promotionId}/codes`, { - limit, - offset - }), - 'GET' + Codes(promotionId, token = null) { + const { limit, offset, filter } = this + return this.request.send( + buildURL(`${this.endpoint}/${promotionId}/codes`, { + limit, + offset, + filter + }), + 'GET', + undefined, + token, + this ) } diff --git a/src/types/promotions.d.ts b/src/types/promotions.d.ts index 9ab94fa7e..66721220e 100644 --- a/src/types/promotions.d.ts +++ b/src/types/promotions.d.ts @@ -237,10 +237,11 @@ export interface PromotionJob extends Identifiable { /** BE Doesnt support commented filter now, TO DO**/ -export interface PromotionJobsFilter { +export interface PromotionFilter { eq?: { job_type?: string status?: string + code?: string // name?: string // created_by?: string } @@ -277,13 +278,14 @@ export interface PromotionsEndpoint Promotion, PromotionBase, Identifiable & Partial, - PromotionJobsFilter, + PromotionFilter, never, never > { + endpoint: 'promotions' - Filter(filter: PromotionJobsFilter): PromotionsEndpoint + Filter(filter: PromotionFilter): PromotionsEndpoint Attributes(): Promise @@ -297,6 +299,7 @@ export interface PromotionsEndpoint /** * DOCS: https://documentation.elasticpath.com/commerce-cloud/docs/api/carts-and-checkout/promotions/create-promotion-codes.html */ + AddCodes( promotionId: string, codes: PromotionCode[]