@epcc-sdk/rule-promotions 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # @epcc-sdk/rule-promotions SDK
2
2
 
3
- Below youll find instructions on how to install, set up, and use the client, along with a list of available operations.
3
+ Below you'll find instructions on how to install, set up, and use the client, along with a list of available operations.
4
+
4
5
 
5
6
  ## Features
6
7
 
@@ -12,6 +13,7 @@ Below you’ll find instructions on how to install, set up, and use the client,
12
13
 
13
14
  ---
14
15
 
16
+
15
17
  ## Installation
16
18
 
17
19
  ```bash
@@ -206,39 +208,444 @@ const product = await getRulePromotions({
206
208
  ## Available Operations
207
209
 
208
210
 
211
+ ### **`getRulePromotions`**
212
+
213
+ **Endpoint:** `GET /v2/rule-promotions`
214
+
215
+ **Summary:** Get Rule Promotions
216
+
217
+ **Description:** GET operation
218
+
219
+ **TypeScript Example:**
220
+
221
+ ```typescript
222
+ import { getRulePromotions, type GetRulePromotionsData, type GetRulePromotionsResponse } from "@epcc-sdk/rule-promotions";
209
223
 
210
- - **`getRulePromotions`** (`GET /v2/rule-promotions`)
224
+ const params: GetRulePromotionsData = {
225
+ query: {
226
+ "filter": "eq(name,\"Product Name\")", // OPTIONAL
227
+ },
228
+ };
229
+
230
+ const result: GetRulePromotionsResponse = await getRulePromotions(params);
231
+ ```
232
+
233
+ ---
211
234
 
212
- - **`createRulePromotion`** (`POST /v2/rule-promotions`)
235
+ ### **`createRulePromotion`**
213
236
 
214
- - **`deleteRulePromotion`** (`DELETE /v2/rule-promotions/{promotionID}`)
237
+ **Endpoint:** `POST /v2/rule-promotions`
215
238
 
216
- - **`getRulePromotionById`** (`GET /v2/rule-promotions/{promotionID}`)
239
+ **Summary:** Create a Rule Promotion
217
240
 
218
- - **`updateRulePromotion`** (`PUT /v2/rule-promotions/{promotionID}`)
241
+ **Description:** POST operation
219
242
 
220
- - **`deleteRulePromotionCodes`** (`DELETE /v2/rule-promotions/{promotionID}/codes`)
243
+ **TypeScript Example:**
221
244
 
222
- - **`getRulePromotionCodes`** (`GET /v2/rule-promotions/{promotionID}/codes`)
245
+ ```typescript
246
+ import { createRulePromotion, type CreateRulePromotionData, type CreateRulePromotionResponse } from "@epcc-sdk/rule-promotions";
223
247
 
224
- - **`createRulePromotionCodes`** (`POST /v2/rule-promotions/{promotionID}/codes`)
248
+ const params: CreateRulePromotionData = {
249
+ body: {
250
+ data: {
251
+ type: "resource",
252
+ attributes: {
253
+ name: "Resource Name",
254
+ description: "Resource Description"
255
+ }
256
+ }
257
+ },
258
+ };
225
259
 
226
- - **`deleteSingleRulePromotionCode`** (`DELETE /v2/rule-promotions/{promotionID}/codes/{codeID}`)
260
+ const result: CreateRulePromotionResponse = await createRulePromotion(params);
261
+ ```
227
262
 
228
- - **`getV2RulePromotionsByUuidJobs`** (`GET /v2/rule-promotions/{uuid}/jobs`)
263
+ ---
229
264
 
230
- - **`postV2RulePromotionsByUuidJobs`** (`POST /v2/rule-promotions/{uuid}/jobs`)
265
+ ### **`deleteRulePromotion`**
231
266
 
232
- - **`getV2RulePromotionsByUuidJobsByJobUuidFile`** (`GET /v2/rule-promotions/{uuid}/jobs/{job-uuid}/file`)
267
+ **Endpoint:** `DELETE /v2/rule-promotions/{promotionID}`
233
268
 
234
- - **`postV2RulePromotionsByUuidJobsByJobUuidCancel`** (`POST /v2/rule-promotions/{uuid}/jobs/{job-uuid}/cancel`)
269
+ **Summary:** Delete a Rule Promotion
235
270
 
236
- - **`anonymizeRulePromotionUsages`** (`POST /v2/rule-promotions/usages/anonymize`)
271
+ **Description:** DELETE operation
237
272
 
238
- - **`getRulePromotionUsages`** (`GET /v2/rule-promotions/{promotionID}/usages`)
273
+ **TypeScript Example:**
239
274
 
240
- - **`getRulePromotionCodeUsages`** (`GET /v2/rule-promotions/{promotionID}/codes/{code}/usages`)
275
+ ```typescript
276
+ import { deleteRulePromotion, type DeleteRulePromotionData, type DeleteRulePromotionResponse } from "@epcc-sdk/rule-promotions";
241
277
 
278
+ const params: DeleteRulePromotionData = {
279
+ path: {
280
+ promotionID: "promotionID",
281
+ },
282
+ };
242
283
 
284
+ const result: DeleteRulePromotionResponse = await deleteRulePromotion(params);
285
+ ```
243
286
 
244
287
  ---
288
+
289
+ ### **`getRulePromotionById`**
290
+
291
+ **Endpoint:** `GET /v2/rule-promotions/{promotionID}`
292
+
293
+ **Summary:** Get a Rule Promotion by ID
294
+
295
+ **Description:** GET operation
296
+
297
+ **TypeScript Example:**
298
+
299
+ ```typescript
300
+ import { getRulePromotionById, type GetRulePromotionByIdData, type GetRulePromotionByIdResponse } from "@epcc-sdk/rule-promotions";
301
+
302
+ const params: GetRulePromotionByIdData = {
303
+ path: {
304
+ promotionID: "promotionID",
305
+ },
306
+ };
307
+
308
+ const result: GetRulePromotionByIdResponse = await getRulePromotionById(params);
309
+ ```
310
+
311
+ ---
312
+
313
+ ### **`updateRulePromotion`**
314
+
315
+ **Endpoint:** `PUT /v2/rule-promotions/{promotionID}`
316
+
317
+ **Summary:** Update a Rule Promotion
318
+
319
+ **Description:** PUT operation
320
+
321
+ **TypeScript Example:**
322
+
323
+ ```typescript
324
+ import { updateRulePromotion, type UpdateRulePromotionData, type UpdateRulePromotionResponse } from "@epcc-sdk/rule-promotions";
325
+
326
+ const params: UpdateRulePromotionData = {
327
+ path: {
328
+ promotionID: "promotionID",
329
+ },
330
+ body: {
331
+ data: {
332
+ type: "resource",
333
+ attributes: {
334
+ name: "Resource Name",
335
+ description: "Resource Description"
336
+ }
337
+ }
338
+ },
339
+ };
340
+
341
+ const result: UpdateRulePromotionResponse = await updateRulePromotion(params);
342
+ ```
343
+
344
+ ---
345
+
346
+ ### **`deleteRulePromotionCodes`**
347
+
348
+ **Endpoint:** `DELETE /v2/rule-promotions/{promotionID}/codes`
349
+
350
+ **Summary:** Delete Rule Promotion Codes
351
+
352
+ **Description:** DELETE operation
353
+
354
+ **TypeScript Example:**
355
+
356
+ ```typescript
357
+ import { deleteRulePromotionCodes, type DeleteRulePromotionCodesData, type DeleteRulePromotionCodesResponse } from "@epcc-sdk/rule-promotions";
358
+
359
+ const params: DeleteRulePromotionCodesData = {
360
+ path: {
361
+ promotionID: "promotionID",
362
+ },
363
+ };
364
+
365
+ const result: DeleteRulePromotionCodesResponse = await deleteRulePromotionCodes(params);
366
+ ```
367
+
368
+ ---
369
+
370
+ ### **`getRulePromotionCodes`**
371
+
372
+ **Endpoint:** `GET /v2/rule-promotions/{promotionID}/codes`
373
+
374
+ **Summary:** Get Rule Promotion Codes
375
+
376
+ **Description:** GET operation
377
+
378
+ **TypeScript Example:**
379
+
380
+ ```typescript
381
+ import { getRulePromotionCodes, type GetRulePromotionCodesData, type GetRulePromotionCodesResponse } from "@epcc-sdk/rule-promotions";
382
+
383
+ const params: GetRulePromotionCodesData = {
384
+ path: {
385
+ promotionID: "promotionID",
386
+ },
387
+ };
388
+
389
+ const result: GetRulePromotionCodesResponse = await getRulePromotionCodes(params);
390
+ ```
391
+
392
+ ---
393
+
394
+ ### **`createRulePromotionCodes`**
395
+
396
+ **Endpoint:** `POST /v2/rule-promotions/{promotionID}/codes`
397
+
398
+ **Summary:** Create Rule Promotion Codes
399
+
400
+ **Description:** POST operation
401
+
402
+ **TypeScript Example:**
403
+
404
+ ```typescript
405
+ import { createRulePromotionCodes, type CreateRulePromotionCodesData, type CreateRulePromotionCodesResponse } from "@epcc-sdk/rule-promotions";
406
+
407
+ const params: CreateRulePromotionCodesData = {
408
+ path: {
409
+ promotionID: "promotionID",
410
+ },
411
+ body: {
412
+ data: {
413
+ type: "resource",
414
+ attributes: {
415
+ name: "Resource Name",
416
+ description: "Resource Description"
417
+ }
418
+ }
419
+ },
420
+ };
421
+
422
+ const result: CreateRulePromotionCodesResponse = await createRulePromotionCodes(params);
423
+ ```
424
+
425
+ ---
426
+
427
+ ### **`deleteSingleRulePromotionCode`**
428
+
429
+ **Endpoint:** `DELETE /v2/rule-promotions/{promotionID}/codes/{codeID}`
430
+
431
+ **Summary:** Delete A Single Rule Promotion Code
432
+
433
+ **Description:** DELETE operation
434
+
435
+ **TypeScript Example:**
436
+
437
+ ```typescript
438
+ import { deleteSingleRulePromotionCode, type DeleteSingleRulePromotionCodeData, type DeleteSingleRulePromotionCodeResponse } from "@epcc-sdk/rule-promotions";
439
+
440
+ const params: DeleteSingleRulePromotionCodeData = {
441
+ path: {
442
+ promotionID: "promotionID",
443
+ codeID: "CODE123",
444
+ },
445
+ };
446
+
447
+ const result: DeleteSingleRulePromotionCodeResponse = await deleteSingleRulePromotionCode(params);
448
+ ```
449
+
450
+ ---
451
+
452
+ ### **`getV2RulePromotionsByUuidJobs`**
453
+
454
+ **Endpoint:** `GET /v2/rule-promotions/{uuid}/jobs`
455
+
456
+ **Summary:** Get Rule Promotion Jobs
457
+
458
+ **Description:** GET operation
459
+
460
+ **TypeScript Example:**
461
+
462
+ ```typescript
463
+ import { getV2RulePromotionsByUuidJobs, type GetV2RulePromotionsByUuidJobsData, type GetV2RulePromotionsByUuidJobsResponse } from "@epcc-sdk/rule-promotions";
464
+
465
+ const params: GetV2RulePromotionsByUuidJobsData = {
466
+ path: {
467
+ uuid: "12345678-1234-5678-9012-123456789012",
468
+ },
469
+ query: {
470
+ "filter": "eq(name,\"Product Name\")", // OPTIONAL
471
+ },
472
+ };
473
+
474
+ const result: GetV2RulePromotionsByUuidJobsResponse = await getV2RulePromotionsByUuidJobs(params);
475
+ ```
476
+
477
+ ---
478
+
479
+ ### **`postV2RulePromotionsByUuidJobs`**
480
+
481
+ **Endpoint:** `POST /v2/rule-promotions/{uuid}/jobs`
482
+
483
+ **Summary:** Create a Rule Promotion Job
484
+
485
+ **Description:** POST operation
486
+
487
+ **TypeScript Example:**
488
+
489
+ ```typescript
490
+ import { postV2RulePromotionsByUuidJobs, type PostV2RulePromotionsByUuidJobsData, type PostV2RulePromotionsByUuidJobsResponse } from "@epcc-sdk/rule-promotions";
491
+
492
+ const params: PostV2RulePromotionsByUuidJobsData = {
493
+ path: {
494
+ uuid: "12345678-1234-5678-9012-123456789012",
495
+ },
496
+ body: {
497
+ data: {
498
+ type: "resource"
499
+ }
500
+ },
501
+ };
502
+
503
+ const result: PostV2RulePromotionsByUuidJobsResponse = await postV2RulePromotionsByUuidJobs(params);
504
+ ```
505
+
506
+ ---
507
+
508
+ ### **`getV2RulePromotionsByUuidJobsByJobUuidFile`**
509
+
510
+ **Endpoint:** `GET /v2/rule-promotions/{uuid}/jobs/{job-uuid}/file`
511
+
512
+ **Summary:** Get Rule Promotion Code Exported File
513
+
514
+ **Description:** GET operation
515
+
516
+ **TypeScript Example:**
517
+
518
+ ```typescript
519
+ import { getV2RulePromotionsByUuidJobsByJobUuidFile, type GetV2RulePromotionsByUuidJobsByJobUuidFileData, type GetV2RulePromotionsByUuidJobsByJobUuidFileResponse } from "@epcc-sdk/rule-promotions";
520
+
521
+ const params: GetV2RulePromotionsByUuidJobsByJobUuidFileData = {
522
+ path: {
523
+ uuid: "12345678-1234-5678-9012-123456789012",
524
+ job-uuid: "12345678-1234-5678-9012-123456789012",
525
+ },
526
+ };
527
+
528
+ const result: GetV2RulePromotionsByUuidJobsByJobUuidFileResponse = await getV2RulePromotionsByUuidJobsByJobUuidFile(params);
529
+ ```
530
+
531
+ ---
532
+
533
+ ### **`postV2RulePromotionsByUuidJobsByJobUuidCancel`**
534
+
535
+ **Endpoint:** `POST /v2/rule-promotions/{uuid}/jobs/{job-uuid}/cancel`
536
+
537
+ **Summary:** Cancel a Rule Promotion Job
538
+
539
+ **Description:** POST operation
540
+
541
+ **TypeScript Example:**
542
+
543
+ ```typescript
544
+ import { postV2RulePromotionsByUuidJobsByJobUuidCancel, type PostV2RulePromotionsByUuidJobsByJobUuidCancelData, type PostV2RulePromotionsByUuidJobsByJobUuidCancelResponse } from "@epcc-sdk/rule-promotions";
545
+
546
+ const params: PostV2RulePromotionsByUuidJobsByJobUuidCancelData = {
547
+ path: {
548
+ uuid: "12345678-1234-5678-9012-123456789012",
549
+ job-uuid: "12345678-1234-5678-9012-123456789012",
550
+ },
551
+ body: {
552
+ data: {
553
+ type: "resource"
554
+ }
555
+ },
556
+ };
557
+
558
+ const result: PostV2RulePromotionsByUuidJobsByJobUuidCancelResponse = await postV2RulePromotionsByUuidJobsByJobUuidCancel(params);
559
+ ```
560
+
561
+ ---
562
+
563
+ ### **`anonymizeRulePromotionUsages`**
564
+
565
+ **Endpoint:** `POST /v2/rule-promotions/usages/anonymize`
566
+
567
+ **Summary:** Anonymize Rule Promotion Usages
568
+
569
+ **Description:** POST operation
570
+
571
+ **TypeScript Example:**
572
+
573
+ ```typescript
574
+ import { anonymizeRulePromotionUsages, type AnonymizeRulePromotionUsagesData, type AnonymizeRulePromotionUsagesResponse } from "@epcc-sdk/rule-promotions";
575
+
576
+ const params: AnonymizeRulePromotionUsagesData = {
577
+ body: {
578
+ data: {
579
+ type: "resource"
580
+ }
581
+ },
582
+ };
583
+
584
+ const result: AnonymizeRulePromotionUsagesResponse = await anonymizeRulePromotionUsages(params);
585
+ ```
586
+
587
+ ---
588
+
589
+ ### **`getRulePromotionUsages`**
590
+
591
+ **Endpoint:** `GET /v2/rule-promotions/{promotionID}/usages`
592
+
593
+ **Summary:** Get Rule Promotion Usages
594
+
595
+ **Description:** GET operation
596
+
597
+ **TypeScript Example:**
598
+
599
+ ```typescript
600
+ import { getRulePromotionUsages, type GetRulePromotionUsagesData, type GetRulePromotionUsagesResponse } from "@epcc-sdk/rule-promotions";
601
+
602
+ const params: GetRulePromotionUsagesData = {
603
+ path: {
604
+ promotionID: "promotionID",
605
+ },
606
+ query: {
607
+ "filter": "eq(name,\"Product Name\")", // OPTIONAL
608
+ "page[limit]": 10, // OPTIONAL
609
+ "page[offset]": 0, // OPTIONAL
610
+ },
611
+ };
612
+
613
+ const result: GetRulePromotionUsagesResponse = await getRulePromotionUsages(params);
614
+ ```
615
+
616
+ ---
617
+
618
+ ### **`getRulePromotionCodeUsages`**
619
+
620
+ **Endpoint:** `GET /v2/rule-promotions/{promotionID}/codes/{code}/usages`
621
+
622
+ **Summary:** Get Rule Promotion Code Usages
623
+
624
+ **Description:** GET operation
625
+
626
+ **TypeScript Example:**
627
+
628
+ ```typescript
629
+ import { getRulePromotionCodeUsages, type GetRulePromotionCodeUsagesData, type GetRulePromotionCodeUsagesResponse } from "@epcc-sdk/rule-promotions";
630
+
631
+ const params: GetRulePromotionCodeUsagesData = {
632
+ path: {
633
+ promotionID: "promotionID",
634
+ code: "CODE123",
635
+ },
636
+ query: {
637
+ "filter": "eq(name,\"Product Name\")", // OPTIONAL
638
+ "page[limit]": 10, // OPTIONAL
639
+ "page[offset]": 0, // OPTIONAL
640
+ },
641
+ };
642
+
643
+ const result: GetRulePromotionCodeUsagesResponse = await getRulePromotionCodeUsages(params);
644
+ ```
645
+
646
+ ---
647
+
648
+
649
+
650
+
651
+ ---
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/types.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nexport type Type = \"rule_promotion\"\n\n/**\n * Specifies the strategy for determining which items to discount based on their individual prices.\n */\nexport type PriceStrategy = \"cheapest\" | \"expensive\"\n\nexport type RulePromotionRequest = {\n data?: {\n type?: \"rule_promotion\"\n /**\n * Specifies a name for the promotion.\n */\n name?: string\n /**\n * Specifies a description for the rule promotion.\n */\n description?: string\n /**\n * Specifies the priority order of a promotion, with larger numbers indicating higher priorities.\n */\n priority?: number\n /**\n * Specifies whether the promotion is enabled. The options are true or false, and the default setting is false.\n */\n enabled?: boolean\n /**\n * Specifies whether the promotion is applied automatically to the cart or a code is required to apply the promotion. The default setting is false. When this value is set to true, a code is autogenerated. If this value is set to false, you must create the code manually.\n */\n automatic?: boolean\n /**\n * Specifies whether this promotion can stack with other promotions.\n */\n stackable?: boolean\n /**\n * Enables a promotion to be stacked with an otherwise non-stackable promotion.\n */\n override_stacking?: boolean\n /**\n * Specifies the start date and time of the promotion or the start date of the promotion. You can provide a specific time in the HH:MM format. If no time is specified, the default start and end time is set to 00:00.\n */\n start?: Date\n /**\n * Specifies the end date and time of the promotion or the end date of the promotion.\n */\n end?: Date\n rule_set?: {\n /**\n * Specifies the catalogs that are eligible for the promotion. By default, the promotion applies to all items, including custom items. However, when catalog_ids is defined, the promotion is only applied to items within the specified catalogs. If catalog IDs are specified, custom items cannot be applied as part of the promotion.\n */\n catalog_ids?: Array<string>\n /**\n * Specifies currencies that are applied for the promotion.\n */\n currencies?: Array<string>\n rules?: {\n /**\n * Specifies a given strategy for the rule. Strategies determine how rules are applied. Supported strategies value include `cart_total`, `cart_custom_attribute`, `item_price`, `item_sku`, `item_product_id`, `item_quantity`, `item_category`, `item_attribute`, `item_identifier`, `and` and `or`.\n */\n strategy?: string\n /**\n * Specifies the operators used for the rule strategy.\n */\n operator?: string\n /**\n * Represents the condition value associated with each rule within the rule set. It requires at least three arguments.\n */\n args?: Array<string>\n children?: Array<{\n strategy?: string\n operator?: string\n args?: Array<string>\n }>\n }\n actions?: Array<{\n /**\n * Specifies the strategy for the promotion action.\n */\n strategy?: string\n args?: Array<string>\n condition?: {\n strategy?: string\n children?: Array<{\n strategy?: string\n operator?: string\n args?: Array<string>\n }>\n }\n limitations?: {\n /**\n * Specifies the maximum amount of discount applied to the shopping cart.\n */\n max_discount?: number\n /**\n * Specifies the maximum quantity of each eligible item to which the promotion is applied.\n */\n max_quantity?: number\n items?: {\n /**\n * Specifies the maximum number of items eligible for the discount.\n */\n max_items?: number\n /**\n * Specifies the strategy for determining which items to discount based on their individual prices.\n */\n price_strategy?: \"cheapest\" | \"expensive\"\n }\n }\n }>\n }\n }\n}\n\nexport type RulePromotionResponse = {\n data?: {\n type?: \"rule_promotion\"\n id?: string\n store_id?: string\n name?: string\n description?: string\n priority?: number\n enabled?: boolean\n automatic?: boolean\n stackable?: boolean\n override_stacking?: boolean\n rule_set?: {\n catalog_ids?: Array<string>\n currencies?: Array<string>\n rules?: {\n strategy?: string\n operator?: string\n args?: Array<string>\n children?: Array<{\n strategy?: string\n operator?: string\n args?: Array<string>\n }>\n }\n actions?: Array<{\n strategy?: string\n args?: Array<string>\n condition?: {\n strategy?: string\n children?: Array<{\n strategy?: string\n operator?: string\n args?: Array<string>\n }>\n }\n limitations?: {\n max_discount?: number\n max_quantity?: number\n items?: {\n max_items?: number\n price_strategy?: \"cheapest\" | \"expensive\"\n }\n }\n }>\n }\n start?: Date\n end?: Date\n meta?: {\n timestamps?: {\n created_at?: Date\n updated_at?: Date\n }\n }\n }\n}\n\n/**\n * Object for setting max uses per shopper. Only include this object, when you want to set limit per shopper.\n */\nexport type MaxUsesPerShopper = {\n /**\n * Sets max number of times the code can be used by a shopper. NOTE - This cannot be set with `per_application` consume unit.\n */\n max_uses?: number\n /**\n * The flag to include guest shoppers for the discount with max use restriction. **If this field is provided, the max_uses value is required.** When set to `true`, guest shoppers must have an email associated with the cart to use the code. A guest cart without an email cannot use the code. When set to `false`, guest shoppers cannot use the promo code, even if the cart has an associated guest email.\n */\n includes_guests?: boolean\n}\n\n/**\n * Specifies whether the code is consumed per application or per checkout. With `per_checkout`, the code is used once for each checkout, regardless of the number of items in the cart. When set to `per_application`, the code is used per application. For cart discounts, each application counts as one usage. For item discounts, each application to either a single quantity or a bundle is counted as one usage. For example, in a store that offers 50% off on SKU1, SKU2, and SKU3, and limits the maximum usage of the promotion code to two, a shopper can apply the promotion up to two quantities. If the cart contains two or more quantities of SKU1, the promotion is applied 2 times to SKU1, and other quantities and items are at the regular price. If the cart contains one quantity of SKU1, one quantity of SKU2, and one quantity of SKU3, the promotion is applied once to SKU1 and once to SKU2. The code usage is applied at checkout and the code is considered consumed at that point.\n *\n */\nexport type ConsumeUnit = \"per_application\" | \"per_checkout\"\n\nexport type PromotionCodesRequest = {\n data?: {\n type?: \"promotion_codes\"\n /**\n * Specifies the code details in an array of objects.\n */\n codes?: Array<{\n /**\n * Specifies the string to use as a code for the promotion.\n */\n code?: string\n /**\n * Specifies the number of times the code can be used. If no value is set, the customer can use the code any number of times.\n */\n uses?: number\n /**\n * Specifies the customer ID of the shopper who can use the code. For more information, see the [Create a customer](/docs/customer-management/customer-management-api/create-a-customer) section.\n */\n user?: string\n /**\n * Specifies whether the code is consumed per application or per checkout. With `per_checkout`, the code is used once for each checkout, regardless of the number of items in the cart. When set to `per_application`, the code is used per application. For cart discounts, each application counts as one usage. For item discounts, each application to either a single quantity or a bundle is counted as one usage. For example, in a store that offers 50% off on SKU1, SKU2, and SKU3, and limits the maximum usage of the promotion code to two, a shopper can apply the promotion up to two quantities. If the cart contains two or more quantities of SKU1, the promotion is applied 2 times to SKU1, and other quantities and items are at the regular price. If the cart contains one quantity of SKU1, one quantity of SKU2, and one quantity of SKU3, the promotion is applied once to SKU1 and once to SKU2. The code usage is applied at checkout and the code is considered consumed at that point.\n *\n */\n consume_unit?: \"per_application\" | \"per_checkout\"\n max_users_per_shopper?: MaxUsesPerShopper\n /**\n * A flag indicating whether the coupon is for first-time shoppers. If set to `true`, the discount will only apply if the shopper has never made a payment on any order in the store. If set to `false` or left unset, it will be a regular discount that applies to all shoppers. When this flag is set to `true`, the coupon cannot have usage limitations or be assigned to specific users.\n */\n is_for_new_shopper?: boolean\n }>\n }\n}\n\nexport type GetPromotionCodeResponse = {\n type?: \"promotion_codes\"\n code?: string\n uses?: number\n user?: string\n /**\n * Specifies whether the code is consumed per application or per checkout. With `per_checkout`, the code is used once for each checkout, regardless of the number of items in the cart. When set to `per_application`, the code is used per application. For cart discounts, each application counts as one usage. For item discounts, each application to either a single quantity or a bundle is counted as one usage. For example, in a store that offers 50% off on SKU1, SKU2, and SKU3, and limits the maximum usage of the promotion code to two, a shopper can apply the promotion up to two quantities. If the cart contains two or more quantities of SKU1, the promotion is applied 2 times to SKU1, and other quantities and items are at the regular price. If the cart contains one quantity of SKU1, one quantity of SKU2, and one quantity of SKU3, the promotion is applied once to SKU1 and once to SKU2. The code usage is applied at checkout and the code is considered consumed at that point.\n *\n */\n consume_unit?: \"per_application\" | \"per_checkout\"\n max_uses?: number\n max_users_per_shopper?: MaxUsesPerShopper\n is_for_new_shopper?: boolean\n created_by?: string\n meta?: {\n timestamps?: {\n created_at?: Date\n }\n }\n}\n\nexport type CreatePromotionCodeResponse = {\n type?: \"promotion_codes\"\n code?: string\n uses?: number\n user?: string\n consume_unit?: \"per_application\" | \"per_checkout\"\n max_uses?: number\n max_users_per_shopper?: MaxUsesPerShopper\n is_for_new_shopper?: boolean\n}\n\nexport type GetPromotionCodesResponse = {\n data?: Array<GetPromotionCodeResponse>\n}\n\nexport type CreatePromotionCodesResponse = {\n data?: Array<CreatePromotionCodeResponse>\n messages?: Array<PromotionCodeMessage>\n}\n\n/**\n * Represents the result of a promotion job, including the number of generated and deleted promotion codes.\n *\n * - `generated`: Total number of successfully generated codes.\n * - `deleted`: Number of codes that were deleted during job cancellation, if applicable.\n *\n */\nexport type GenerateResult = {\n /**\n * Number of successfully generated promotion codes.\n */\n generated?: number\n /**\n * Number of codes deleted due to job cancellation.\n */\n deleted?: number\n}\n\nexport type PromotionJob = {\n /**\n * A unique ID generated when a job is created.\n */\n id?: string\n /**\n * Always `promotion_job`.\n */\n type?: \"promotion_job\"\n /**\n * A unique ID of a promotion.\n */\n rule_promotion_id?: string\n /**\n * The type of job you want to run. For example, `code_generate` to generate codes or `code_export` to export codes.\n */\n job_type?: string\n /**\n * The name of the job. The maximum length allowed is 50 characters.\n */\n name?: string\n parameters?: {\n [key: string]: unknown\n }\n /**\n * The status of the job. Please see [Overview](/docs/api/promotions/promotion-jobs).\n */\n status?: string\n /**\n * The error encountered during job execution, if applicable.\n */\n error?: string\n meta?: {\n timestamps?: {\n /**\n * The creation date of the job.\n */\n created_at?: Date\n /**\n * The last updated date of the job.\n */\n updated_at?: Date\n }\n }\n generate_result?: GenerateResult\n}\n\n/**\n * Successful response\n */\nexport type PromotionJobsListResponse = unknown\n\n/**\n * Promotion job created\n */\nexport type PromotionJobCreatedResponse = unknown\n\n/**\n * Job canceled successfully\n */\nexport type PromotionJobCanceledResponse = unknown\n\n/**\n * Successful response\n */\nexport type PromotionCodeExportedFileResponse = unknown\n\n/**\n * Represents a single rule promotion usage record.\n */\nexport type RulePromotionUsage = {\n /**\n * The unique identifier of the usage record.\n */\n id?: string\n /**\n * The associated order ID, if applicable.\n */\n order_id?: string\n /**\n * The unique identifier of the promotion code.\n */\n code_id?: string\n /**\n * The promotion code used.\n */\n code?: string\n /**\n * The number of times the promotion code has been used.\n */\n times_used?: number\n /**\n * The timestamp when the promotion was applied.\n */\n used_on?: Date\n /**\n * The customer identifier who used the promotion, if applicable.\n */\n customer_id?: string\n /**\n * The email of the customer who used the promotion, if applicable.\n */\n customer_email?: string\n meta?: {\n timestamps?: {\n /**\n * The timestamp when the usage record was last updated.\n */\n updated_at?: Date\n }\n }\n /**\n * Identifier of the user or system that last updated the record.\n */\n updated_by?: string\n /**\n * Indicates whether the usage record has been anonymized.\n */\n anonymized?: boolean\n}\n\nexport type ResponsePaginationMeta = {\n pagination?: {\n /**\n * Total number of available records.\n */\n total?: number\n /**\n * Number of records returned per page.\n */\n limit?: number\n /**\n * Number of records skipped.\n */\n offset?: number\n /**\n * Current page number.\n */\n current?: number\n }\n}\n\nexport type ResponseError = {\n errors?: Array<{\n /**\n * HTTP status code.\n */\n status?: number\n /**\n * Error title.\n */\n title?: string\n /**\n * Error details.\n */\n detail?: string\n }>\n}\n\nexport type PromotionCodeMessage = {\n /**\n * Information about the affected promotion codes.\n */\n source?: {\n /**\n * Indicates that the affected entity is a promotion code.\n */\n type?: \"promotion_codes\"\n /**\n * A list of promotion codes that triggered the message.\n */\n codes?: Array<string>\n }\n /**\n * A brief title summarizing the message.\n */\n title?: string\n /**\n * A detailed explanation of the message.\n */\n description?: string\n}\n\n/**\n * The Bearer token required to get access to the API.\n */\nexport type Authorization = string\n\nexport type GetRulePromotionsData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path?: never\n query?: {\n /**\n * This parameter accepts a filtering expression that uses specific operators and attributes.\n *\n * The following operators and attributes are available when filtering on this endpoint. See [Supported Filtering Characters](/guides/Getting-Started/filtering#supported-characters).\n *\n * | Attribute | Type | Operator | Example |\n * |:--------- |:---------|:------------|:---------------|\n * | `code` | `string`, `number` | `eq` | `eq(code,summer2024)` |\n * | `name` | `string` | `like`,`ilike` | `ilike(name, 'Summer *')` |\n * | `enabled` | `boolean` | `eq` | `eq(enabled, true)` |\n * | `stackable` | `boolean` | `eq` | `eq(stackable, true)` |\n * | `override_stacking` | `boolean` | `eq` | `eq(override_stacking, true)` |\n * | `start` | `date` | `lt`, `le`, `eq`, `gt`, `ge` | `gt(start, 2025-01-01T00:00:00.000Z)` |\n * | `end` | `date` | `lt`, `le`, `eq`, `gt`, `ge` | `lt(end, 2025-01-01T00:00:00.000Z)` |\n *\n * Please note: promotion codes are case-insensitive. You can search for codes using only `numbers` or codes containing both `string` and `numbers`.\n *\n */\n filter?: string\n }\n url: \"/v2/rule-promotions\"\n}\n\nexport type GetRulePromotionsResponses = {\n /**\n * OK\n */\n 200: Array<RulePromotionResponse>\n}\n\nexport type GetRulePromotionsResponse =\n GetRulePromotionsResponses[keyof GetRulePromotionsResponses]\n\nexport type CreateRulePromotionData = {\n body: RulePromotionRequest\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path?: never\n query?: never\n url: \"/v2/rule-promotions\"\n}\n\nexport type CreateRulePromotionResponses = {\n /**\n * Created\n */\n 201: RulePromotionResponse\n}\n\nexport type CreateRulePromotionResponse =\n CreateRulePromotionResponses[keyof CreateRulePromotionResponses]\n\nexport type DeleteRulePromotionData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}\"\n}\n\nexport type DeleteRulePromotionResponses = {\n /**\n * No Content\n */\n 204: void\n}\n\nexport type DeleteRulePromotionResponse =\n DeleteRulePromotionResponses[keyof DeleteRulePromotionResponses]\n\nexport type GetRulePromotionByIdData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}\"\n}\n\nexport type GetRulePromotionByIdResponses = {\n /**\n * OK\n */\n 200: RulePromotionResponse\n}\n\nexport type GetRulePromotionByIdResponse =\n GetRulePromotionByIdResponses[keyof GetRulePromotionByIdResponses]\n\nexport type UpdateRulePromotionData = {\n body: RulePromotionRequest\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the promotion to be updated.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}\"\n}\n\nexport type UpdateRulePromotionResponses = {\n /**\n * OK\n */\n 200: RulePromotionResponse\n}\n\nexport type UpdateRulePromotionResponse =\n UpdateRulePromotionResponses[keyof UpdateRulePromotionResponses]\n\nexport type DeleteRulePromotionCodesData = {\n body: PromotionCodesRequest\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}/codes\"\n}\n\nexport type DeleteRulePromotionCodesResponses = {\n /**\n * No Content\n */\n 204: void\n}\n\nexport type DeleteRulePromotionCodesResponse =\n DeleteRulePromotionCodesResponses[keyof DeleteRulePromotionCodesResponses]\n\nexport type GetRulePromotionCodesData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}/codes\"\n}\n\nexport type GetRulePromotionCodesResponses = {\n /**\n * OK\n */\n 200: GetPromotionCodesResponse\n}\n\nexport type GetRulePromotionCodesResponse =\n GetRulePromotionCodesResponses[keyof GetRulePromotionCodesResponses]\n\nexport type CreateRulePromotionCodesData = {\n body: PromotionCodesRequest\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}/codes\"\n}\n\nexport type CreateRulePromotionCodesErrors = {\n /**\n * Bad Request\n */\n 400: {\n errors?: Array<{\n status?: number\n source?: string\n title?: string\n detail?: string\n }>\n }\n /**\n * Unprocessable Entity\n */\n 422: {\n errors?: Array<{\n status?: number\n source?: string\n title?: string\n detail?: string\n }>\n }\n}\n\nexport type CreateRulePromotionCodesError =\n CreateRulePromotionCodesErrors[keyof CreateRulePromotionCodesErrors]\n\nexport type CreateRulePromotionCodesResponses = {\n /**\n * Created\n */\n 201: CreatePromotionCodesResponse\n}\n\nexport type CreateRulePromotionCodesResponse =\n CreateRulePromotionCodesResponses[keyof CreateRulePromotionCodesResponses]\n\nexport type DeleteSingleRulePromotionCodeData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n /**\n * The unique identifier of the rule promotion code.\n */\n codeID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}/codes/{codeID}\"\n}\n\nexport type DeleteSingleRulePromotionCodeResponses = {\n /**\n * No Content\n */\n 204: void\n}\n\nexport type DeleteSingleRulePromotionCodeResponse =\n DeleteSingleRulePromotionCodeResponses[keyof DeleteSingleRulePromotionCodeResponses]\n\nexport type GetV2RulePromotionsByUuidJobsData = {\n body?: never\n path: {\n /**\n * The unique identifier of a rule promotion.\n */\n uuid: string\n }\n query?: {\n /**\n * Specifies filter attributes.\n */\n filter?: string\n }\n url: \"/v2/rule-promotions/{uuid}/jobs\"\n}\n\nexport type GetV2RulePromotionsByUuidJobsResponses = {\n /**\n * Successful response\n */\n 200: {\n data?: Array<PromotionJob>\n }\n}\n\nexport type GetV2RulePromotionsByUuidJobsResponse =\n GetV2RulePromotionsByUuidJobsResponses[keyof GetV2RulePromotionsByUuidJobsResponses]\n\n/**\n * Specifies the type of task to run.\n *\n */\nexport type JobType = \"code_generate\" | \"code_export\"\n\nexport type PostV2RulePromotionsByUuidJobsData = {\n body: {\n /**\n * Must be set to `promotion_job`.\n */\n type?: \"promotion_job\"\n /**\n * Specifies the type of task to run.\n *\n */\n job_type?: \"code_generate\" | \"code_export\"\n /**\n * Represents the name of the job. The maximum allowed length is 50 characters.\n */\n name?: string\n parameters?: {\n /**\n * Specifies the number of codes to be generated.\n */\n number_of_codes?: number\n /**\n * Specifies the maximum number of usages per code. If set to zero, you cannot use this promotion. If no value is set, it can be used unlimited times.\n */\n max_uses_per_code?: number\n /**\n * Specifies whether the code is consumed per application or per checkout. With `per_checkout`, the code is used once for each checkout, regardless of the number of items in the cart. When set to `per_application`, the code is used per application. For cart discounts, each application counts as one usage. For item discounts, each application to either a single quantity or a bundle is counted as one usage. For example, in a store that offers 50% off on SKU1, SKU2, and SKU3, and limits the maximum usage of the promotion code to two, a shopper can apply the promotion up to two quantities. If the cart contains two or more quantities of SKU1, the promotion is applied 2 times to SKU1, and other quantities and items are at the regular price. If the cart contains one quantity of SKU1, one quantity of SKU2, and one quantity of SKU3, the promotion is applied once to SKU1 and once to SKU2. The code usage is applied at checkout and the code is considered consumed at that point.\n *\n */\n consume_unit?: \"per_application\" | \"per_checkout\"\n /**\n * Prefix for generated promotion codes (e.g., `SUMMER-`).\n */\n code_prefix?: string\n /**\n * Code length.\n */\n code_length?: number\n }\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n uuid: string\n }\n query?: never\n url: \"/v2/rule-promotions/{uuid}/jobs\"\n}\n\nexport type PostV2RulePromotionsByUuidJobsErrors = {\n /**\n * Bad Request\n */\n 400: {\n errors?: Array<{\n status?: string\n title?: string\n detail?: string\n }>\n }\n}\n\nexport type PostV2RulePromotionsByUuidJobsError =\n PostV2RulePromotionsByUuidJobsErrors[keyof PostV2RulePromotionsByUuidJobsErrors]\n\nexport type PostV2RulePromotionsByUuidJobsResponses = {\n /**\n * Promotion job created\n */\n 201: {\n data?: PromotionJob\n }\n}\n\nexport type PostV2RulePromotionsByUuidJobsResponse =\n PostV2RulePromotionsByUuidJobsResponses[keyof PostV2RulePromotionsByUuidJobsResponses]\n\nexport type GetV2RulePromotionsByUuidJobsByJobUuidFileData = {\n body?: never\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n uuid: string\n /**\n * The unique identifier of the job associated with the file.\n */\n \"job-uuid\": string\n }\n query?: never\n url: \"/v2/rule-promotions/{uuid}/jobs/{job-uuid}/file\"\n}\n\nexport type GetV2RulePromotionsByUuidJobsByJobUuidFileResponses = {\n /**\n * Successful response\n */\n 200: {\n /**\n * URL to download the CSV file.\n */\n href?: string\n }\n}\n\nexport type GetV2RulePromotionsByUuidJobsByJobUuidFileResponse =\n GetV2RulePromotionsByUuidJobsByJobUuidFileResponses[keyof GetV2RulePromotionsByUuidJobsByJobUuidFileResponses]\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelData = {\n body?: never\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n uuid: string\n /**\n * The unique identifier of the job to be canceled.\n */\n \"job-uuid\": string\n }\n query?: never\n url: \"/v2/rule-promotions/{uuid}/jobs/{job-uuid}/cancel\"\n}\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelErrors = {\n /**\n * Unprocessable Entity\n */\n 422: {\n errors?: Array<{\n status?: string\n title?: string\n detail?: string\n }>\n }\n}\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelError =\n PostV2RulePromotionsByUuidJobsByJobUuidCancelErrors[keyof PostV2RulePromotionsByUuidJobsByJobUuidCancelErrors]\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelResponses = {\n /**\n * Successfully Canceled the Rule Promotion Job\n */\n 200: PromotionJobCanceledResponse\n}\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelResponse =\n PostV2RulePromotionsByUuidJobsByJobUuidCancelResponses[keyof PostV2RulePromotionsByUuidJobsByJobUuidCancelResponses]\n\nexport type AnonymizeRulePromotionUsagesData = {\n body: {\n data: {\n /**\n * The unique identifiers of the usages to be anonymized.\n * Multiple usage IDs can be provided to anonymize in bulk.\n *\n */\n usage_ids?: Array<string>\n }\n }\n path?: never\n query?: never\n url: \"/v2/rule-promotions/usages/anonymize\"\n}\n\nexport type AnonymizeRulePromotionUsagesErrors = {\n /**\n * Bad Request\n */\n 400: ResponseError\n /**\n * Unauthorized\n */\n 401: ResponseError\n /**\n * Not Found\n */\n 404: ResponseError\n}\n\nexport type AnonymizeRulePromotionUsagesError =\n AnonymizeRulePromotionUsagesErrors[keyof AnonymizeRulePromotionUsagesErrors]\n\nexport type AnonymizeRulePromotionUsagesResponses = {\n /**\n * OK\n */\n 200: {\n data?: Array<RulePromotionUsage>\n }\n}\n\nexport type AnonymizeRulePromotionUsagesResponse =\n AnonymizeRulePromotionUsagesResponses[keyof AnonymizeRulePromotionUsagesResponses]\n\nexport type GetRulePromotionUsagesData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: {\n /**\n * Filter attributes to refine the usage records. Supported attributes:\n * - `id`: Filter by usage ID.\n * - `code`: Filter by promotion code.\n * - `used_on`: Filter by usage date with operators `gt`, `ge`, `le`, `lt`.\n *\n */\n filter?: string\n /**\n * The number of records per page.\n */\n \"page[limit]\"?: number\n /**\n * The number of records to offset the results by.\n */\n \"page[offset]\"?: number\n }\n url: \"/v2/rule-promotions/{promotionID}/usages\"\n}\n\nexport type GetRulePromotionUsagesErrors = {\n /**\n * Unauthorized\n */\n 401: ResponseError\n /**\n * Not Found\n */\n 404: ResponseError\n}\n\nexport type GetRulePromotionUsagesError =\n GetRulePromotionUsagesErrors[keyof GetRulePromotionUsagesErrors]\n\nexport type GetRulePromotionUsagesResponses = {\n /**\n * Successful response\n */\n 200: {\n data?: Array<RulePromotionUsage>\n meta?: ResponsePaginationMeta\n }\n}\n\nexport type GetRulePromotionUsagesResponse =\n GetRulePromotionUsagesResponses[keyof GetRulePromotionUsagesResponses]\n\nexport type GetRulePromotionCodeUsagesData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n /**\n * The specific promotion code for which to retrieve usage records.\n */\n code: string\n }\n query?: {\n /**\n * Filter attributes to refine the results. Supported attributes:\n * - `id`: Filter by usage ID.\n * - `used_on`: Filter by date with operators `gt`, `ge`, `le`, `lt`.\n *\n */\n filter?: string\n /**\n * The number of records per page.\n */\n \"page[limit]\"?: number\n /**\n * The number of records to offset the results by.\n */\n \"page[offset]\"?: number\n }\n url: \"/v2/rule-promotions/{promotionID}/codes/{code}/usages\"\n}\n\nexport type GetRulePromotionCodeUsagesErrors = {\n /**\n * Unauthorized\n */\n 401: ResponseError\n /**\n * Not Found\n */\n 404: ResponseError\n}\n\nexport type GetRulePromotionCodeUsagesError =\n GetRulePromotionCodeUsagesErrors[keyof GetRulePromotionCodeUsagesErrors]\n\nexport type GetRulePromotionCodeUsagesResponses = {\n /**\n * Successful response\n */\n 200: {\n data?: Array<RulePromotionUsage>\n meta?: ResponsePaginationMeta\n }\n}\n\nexport type GetRulePromotionCodeUsagesResponse =\n GetRulePromotionCodeUsagesResponses[keyof GetRulePromotionCodeUsagesResponses]\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/client/types.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nexport type Type = \"rule_promotion\"\n\n/**\n * Specifies the strategy for determining which items to discount based on their individual prices.\n */\nexport type PriceStrategy = \"cheapest\" | \"expensive\"\n\nexport type RulePromotionRequest = {\n data?: {\n type?: \"rule_promotion\"\n /**\n * Specifies a name for the promotion.\n */\n name?: string\n /**\n * Specifies a description for the rule promotion.\n */\n description?: string\n /**\n * Specifies the priority order of a promotion, with larger numbers indicating higher priorities.\n */\n priority?: number\n /**\n * Specifies whether the promotion is enabled. The options are true or false, and the default setting is false.\n */\n enabled?: boolean\n /**\n * Specifies whether the promotion is applied automatically to the cart or a code is required to apply the promotion. The default setting is false. When this value is set to true, a code is autogenerated. If this value is set to false, you must create the code manually.\n */\n automatic?: boolean\n /**\n * Specifies whether this promotion can stack with other promotions.\n */\n stackable?: boolean\n /**\n * Enables a promotion to be stacked with an otherwise non-stackable promotion.\n */\n override_stacking?: boolean\n /**\n * Specifies the start date and time of the promotion or the start date of the promotion. You can provide a specific time in the HH:MM format. If no time is specified, the default start and end time is set to 00:00.\n */\n start?: Date\n /**\n * Specifies the end date and time of the promotion or the end date of the promotion.\n */\n end?: Date\n rule_set?: {\n /**\n * Specifies the catalogs that are eligible for the promotion. By default, the promotion applies to all items, including custom items. However, when catalog_ids is defined, the promotion is only applied to items within the specified catalogs. If catalog IDs are specified, custom items cannot be applied as part of the promotion.\n */\n catalog_ids?: Array<string>\n /**\n * Specifies currencies that are applied for the promotion.\n */\n currencies?: Array<string>\n rules?: {\n /**\n * Specifies a given strategy for the rule. Strategies determine how rules are applied. Supported strategies value include `cart_total`, `cart_custom_attribute`, `item_price`, `item_sku`, `item_product_id`, `item_quantity`, `item_category`, `item_attribute`, `item_identifier`, `and` and `or`.\n */\n strategy?: string\n /**\n * Specifies the operators used for the rule strategy.\n */\n operator?: string\n /**\n * Represents the condition value associated with each rule within the rule set. It requires at least three arguments.\n */\n args?: Array<string>\n children?: Array<{\n strategy?: string\n operator?: string\n args?: Array<string>\n }>\n }\n actions?: Array<{\n /**\n * Specifies the strategy for the promotion action.\n */\n strategy?: string\n args?: Array<string>\n condition?: {\n strategy?: string\n children?: Array<{\n strategy?: string\n operator?: string\n args?: Array<string>\n }>\n }\n limitations?: {\n /**\n * Specifies the maximum amount of discount applied to the shopping cart.\n */\n max_discount?: number\n /**\n * Specifies the maximum quantity of each eligible item to which the promotion is applied.\n */\n max_quantity?: number\n items?: {\n /**\n * Specifies the maximum number of items eligible for the discount.\n */\n max_items?: number\n /**\n * Specifies the maximum total quantity of units eligible for the discount across all selected items. Units are sorted by price before selection, defaulting to cheapest first. Use `price_strategy` to change the sort order. For example, with `max_units: 2` and `price_strategy: expensive`, the 2 most expensive units across all eligible items receive the discount, regardless of which SKUs they belong to.\n */\n max_units?: number\n /**\n * Specifies the strategy for determining which items to discount based on their individual prices.\n */\n price_strategy?: \"cheapest\" | \"expensive\"\n }\n }\n }>\n }\n }\n}\n\nexport type RulePromotionResponse = {\n data?: {\n type?: \"rule_promotion\"\n id?: string\n store_id?: string\n name?: string\n description?: string\n priority?: number\n enabled?: boolean\n automatic?: boolean\n stackable?: boolean\n override_stacking?: boolean\n rule_set?: {\n catalog_ids?: Array<string>\n currencies?: Array<string>\n rules?: {\n strategy?: string\n operator?: string\n args?: Array<string>\n children?: Array<{\n strategy?: string\n operator?: string\n args?: Array<string>\n }>\n }\n actions?: Array<{\n strategy?: string\n args?: Array<string>\n condition?: {\n strategy?: string\n children?: Array<{\n strategy?: string\n operator?: string\n args?: Array<string>\n }>\n }\n limitations?: {\n max_discount?: number\n max_quantity?: number\n items?: {\n max_items?: number\n price_strategy?: \"cheapest\" | \"expensive\"\n }\n }\n }>\n }\n start?: Date\n end?: Date\n meta?: {\n timestamps?: {\n created_at?: Date\n updated_at?: Date\n }\n }\n }\n}\n\n/**\n * Object for setting max uses per shopper. Only include this object, when you want to set limit per shopper.\n */\nexport type MaxUsesPerShopper = {\n /**\n * Sets max number of times the code can be used by a shopper. NOTE - This cannot be set with `per_application` consume unit.\n */\n max_uses?: number\n /**\n * The flag to include guest shoppers for the discount with max use restriction. **If this field is provided, the max_uses value is required.** When set to `true`, guest shoppers must have an email associated with the cart to use the code. A guest cart without an email cannot use the code. When set to `false`, guest shoppers cannot use the promo code, even if the cart has an associated guest email.\n */\n includes_guests?: boolean\n}\n\n/**\n * Specifies whether the code is consumed per application or per checkout. With `per_checkout`, the code is used once for each checkout, regardless of the number of items in the cart. When set to `per_application`, the code is used per application. For cart discounts, each application counts as one usage. For item discounts, each application to either a single quantity or a bundle is counted as one usage. For example, in a store that offers 50% off on SKU1, SKU2, and SKU3, and limits the maximum usage of the promotion code to two, a shopper can apply the promotion up to two quantities. If the cart contains two or more quantities of SKU1, the promotion is applied 2 times to SKU1, and other quantities and items are at the regular price. If the cart contains one quantity of SKU1, one quantity of SKU2, and one quantity of SKU3, the promotion is applied once to SKU1 and once to SKU2. The code usage is applied at checkout and the code is considered consumed at that point.\n *\n */\nexport type ConsumeUnit = \"per_application\" | \"per_checkout\"\n\nexport type PromotionCodesRequest = {\n data?: {\n type?: \"promotion_codes\"\n /**\n * Specifies the code details in an array of objects.\n */\n codes?: Array<{\n /**\n * Specifies the string to use as a code for the promotion.\n */\n code?: string\n /**\n * Specifies the number of times the code can be used. If no value is set, the customer can use the code any number of times.\n */\n uses?: number\n /**\n * Specifies the customer ID of the shopper who can use the code. For more information, see the [Create a customer](/docs/customer-management/customer-management-api/create-a-customer) section.\n */\n user?: string\n /**\n * Specifies whether the code is consumed per application or per checkout. With `per_checkout`, the code is used once for each checkout, regardless of the number of items in the cart. When set to `per_application`, the code is used per application. For cart discounts, each application counts as one usage. For item discounts, each application to either a single quantity or a bundle is counted as one usage. For example, in a store that offers 50% off on SKU1, SKU2, and SKU3, and limits the maximum usage of the promotion code to two, a shopper can apply the promotion up to two quantities. If the cart contains two or more quantities of SKU1, the promotion is applied 2 times to SKU1, and other quantities and items are at the regular price. If the cart contains one quantity of SKU1, one quantity of SKU2, and one quantity of SKU3, the promotion is applied once to SKU1 and once to SKU2. The code usage is applied at checkout and the code is considered consumed at that point.\n *\n */\n consume_unit?: \"per_application\" | \"per_checkout\"\n max_users_per_shopper?: MaxUsesPerShopper\n /**\n * A flag indicating whether the coupon is for first-time shoppers. If set to `true`, the discount will only apply if the shopper has never made a payment on any order in the store. If set to `false` or left unset, it will be a regular discount that applies to all shoppers. When this flag is set to `true`, the coupon cannot have usage limitations or be assigned to specific users.\n */\n is_for_new_shopper?: boolean\n }>\n }\n}\n\nexport type GetPromotionCodeResponse = {\n type?: \"promotion_codes\"\n code?: string\n uses?: number\n user?: string\n /**\n * Specifies whether the code is consumed per application or per checkout. With `per_checkout`, the code is used once for each checkout, regardless of the number of items in the cart. When set to `per_application`, the code is used per application. For cart discounts, each application counts as one usage. For item discounts, each application to either a single quantity or a bundle is counted as one usage. For example, in a store that offers 50% off on SKU1, SKU2, and SKU3, and limits the maximum usage of the promotion code to two, a shopper can apply the promotion up to two quantities. If the cart contains two or more quantities of SKU1, the promotion is applied 2 times to SKU1, and other quantities and items are at the regular price. If the cart contains one quantity of SKU1, one quantity of SKU2, and one quantity of SKU3, the promotion is applied once to SKU1 and once to SKU2. The code usage is applied at checkout and the code is considered consumed at that point.\n *\n */\n consume_unit?: \"per_application\" | \"per_checkout\"\n max_uses?: number\n max_users_per_shopper?: MaxUsesPerShopper\n is_for_new_shopper?: boolean\n created_by?: string\n meta?: {\n timestamps?: {\n created_at?: Date\n }\n }\n}\n\nexport type CreatePromotionCodeResponse = {\n type?: \"promotion_codes\"\n code?: string\n uses?: number\n user?: string\n consume_unit?: \"per_application\" | \"per_checkout\"\n max_uses?: number\n max_users_per_shopper?: MaxUsesPerShopper\n is_for_new_shopper?: boolean\n}\n\nexport type GetPromotionCodesResponse = {\n data?: Array<GetPromotionCodeResponse>\n}\n\nexport type CreatePromotionCodesResponse = {\n data?: Array<CreatePromotionCodeResponse>\n messages?: Array<PromotionCodeMessage>\n}\n\n/**\n * Represents the result of a promotion job, including the number of generated and deleted promotion codes.\n *\n * - `generated`: Total number of successfully generated codes.\n * - `deleted`: Number of codes that were deleted during job cancellation, if applicable.\n *\n */\nexport type GenerateResult = {\n /**\n * Number of successfully generated promotion codes.\n */\n generated?: number\n /**\n * Number of codes deleted due to job cancellation.\n */\n deleted?: number\n}\n\nexport type PromotionJob = {\n /**\n * A unique ID generated when a job is created.\n */\n id?: string\n /**\n * Always `promotion_job`.\n */\n type?: \"promotion_job\"\n /**\n * A unique ID of a promotion.\n */\n rule_promotion_id?: string\n /**\n * The type of job you want to run. For example, `code_generate` to generate codes or `code_export` to export codes.\n */\n job_type?: string\n /**\n * The name of the job. The maximum length allowed is 50 characters.\n */\n name?: string\n parameters?: {\n [key: string]: unknown\n }\n /**\n * The status of the job. Please see [Overview](/docs/api/promotions/promotion-jobs).\n */\n status?: string\n /**\n * The error encountered during job execution, if applicable.\n */\n error?: string\n meta?: {\n timestamps?: {\n /**\n * The creation date of the job.\n */\n created_at?: Date\n /**\n * The last updated date of the job.\n */\n updated_at?: Date\n }\n }\n generate_result?: GenerateResult\n}\n\n/**\n * Successful response\n */\nexport type PromotionJobsListResponse = unknown\n\n/**\n * Promotion job created\n */\nexport type PromotionJobCreatedResponse = unknown\n\n/**\n * Job canceled successfully\n */\nexport type PromotionJobCanceledResponse = unknown\n\n/**\n * Successful response\n */\nexport type PromotionCodeExportedFileResponse = unknown\n\n/**\n * Represents a single rule promotion usage record.\n */\nexport type RulePromotionUsage = {\n /**\n * The unique identifier of the usage record.\n */\n id?: string\n /**\n * The associated order ID, if applicable.\n */\n order_id?: string\n /**\n * The unique identifier of the promotion code.\n */\n code_id?: string\n /**\n * The promotion code used.\n */\n code?: string\n /**\n * The number of times the promotion code has been used.\n */\n times_used?: number\n /**\n * The timestamp when the promotion was applied.\n */\n used_on?: Date\n /**\n * The customer identifier who used the promotion, if applicable.\n */\n customer_id?: string\n /**\n * The email of the customer who used the promotion, if applicable.\n */\n customer_email?: string\n meta?: {\n timestamps?: {\n /**\n * The timestamp when the usage record was last updated.\n */\n updated_at?: Date\n }\n }\n /**\n * Identifier of the user or system that last updated the record.\n */\n updated_by?: string\n /**\n * Indicates whether the usage record has been anonymized.\n */\n anonymized?: boolean\n}\n\nexport type ResponsePaginationMeta = {\n pagination?: {\n /**\n * Total number of available records.\n */\n total?: number\n /**\n * Number of records returned per page.\n */\n limit?: number\n /**\n * Number of records skipped.\n */\n offset?: number\n /**\n * Current page number.\n */\n current?: number\n }\n}\n\nexport type ResponseError = {\n errors?: Array<{\n /**\n * HTTP status code.\n */\n status?: number\n /**\n * Error title.\n */\n title?: string\n /**\n * Error details.\n */\n detail?: string\n }>\n}\n\nexport type PromotionCodeMessage = {\n /**\n * Information about the affected promotion codes.\n */\n source?: {\n /**\n * Indicates that the affected entity is a promotion code.\n */\n type?: \"promotion_codes\"\n /**\n * A list of promotion codes that triggered the message.\n */\n codes?: Array<string>\n }\n /**\n * A brief title summarizing the message.\n */\n title?: string\n /**\n * A detailed explanation of the message.\n */\n description?: string\n}\n\n/**\n * The Bearer token required to get access to the API.\n */\nexport type Authorization = string\n\nexport type GetRulePromotionsData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path?: never\n query?: {\n /**\n * This parameter accepts a filtering expression that uses specific operators and attributes.\n *\n * The following operators and attributes are available when filtering on this endpoint. See [Supported Filtering Characters](/guides/Getting-Started/filtering#supported-characters).\n *\n * | Attribute | Type | Operator | Example |\n * |:--------- |:---------|:------------|:---------------|\n * | `code` | `string`, `number` | `eq` | `eq(code,summer2024)` |\n * | `name` | `string` | `like`,`ilike` | `ilike(name, 'Summer *')` |\n * | `enabled` | `boolean` | `eq` | `eq(enabled, true)` |\n * | `stackable` | `boolean` | `eq` | `eq(stackable, true)` |\n * | `override_stacking` | `boolean` | `eq` | `eq(override_stacking, true)` |\n * | `start` | `date` | `lt`, `le`, `eq`, `gt`, `ge` | `gt(start, 2025-01-01T00:00:00.000Z)` |\n * | `end` | `date` | `lt`, `le`, `eq`, `gt`, `ge` | `lt(end, 2025-01-01T00:00:00.000Z)` |\n *\n * Please note: promotion codes are case-insensitive. You can search for codes using only `numbers` or codes containing both `string` and `numbers`.\n *\n */\n filter?: string\n }\n url: \"/v2/rule-promotions\"\n}\n\nexport type GetRulePromotionsResponses = {\n /**\n * OK\n */\n 200: Array<RulePromotionResponse>\n}\n\nexport type GetRulePromotionsResponse =\n GetRulePromotionsResponses[keyof GetRulePromotionsResponses]\n\nexport type CreateRulePromotionData = {\n body: RulePromotionRequest\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path?: never\n query?: never\n url: \"/v2/rule-promotions\"\n}\n\nexport type CreateRulePromotionResponses = {\n /**\n * Created\n */\n 201: RulePromotionResponse\n}\n\nexport type CreateRulePromotionResponse =\n CreateRulePromotionResponses[keyof CreateRulePromotionResponses]\n\nexport type DeleteRulePromotionData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}\"\n}\n\nexport type DeleteRulePromotionResponses = {\n /**\n * No Content\n */\n 204: void\n}\n\nexport type DeleteRulePromotionResponse =\n DeleteRulePromotionResponses[keyof DeleteRulePromotionResponses]\n\nexport type GetRulePromotionByIdData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}\"\n}\n\nexport type GetRulePromotionByIdResponses = {\n /**\n * OK\n */\n 200: RulePromotionResponse\n}\n\nexport type GetRulePromotionByIdResponse =\n GetRulePromotionByIdResponses[keyof GetRulePromotionByIdResponses]\n\nexport type UpdateRulePromotionData = {\n body: RulePromotionRequest\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the promotion to be updated.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}\"\n}\n\nexport type UpdateRulePromotionResponses = {\n /**\n * OK\n */\n 200: RulePromotionResponse\n}\n\nexport type UpdateRulePromotionResponse =\n UpdateRulePromotionResponses[keyof UpdateRulePromotionResponses]\n\nexport type DeleteRulePromotionCodesData = {\n body: PromotionCodesRequest\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}/codes\"\n}\n\nexport type DeleteRulePromotionCodesResponses = {\n /**\n * No Content\n */\n 204: void\n}\n\nexport type DeleteRulePromotionCodesResponse =\n DeleteRulePromotionCodesResponses[keyof DeleteRulePromotionCodesResponses]\n\nexport type GetRulePromotionCodesData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}/codes\"\n}\n\nexport type GetRulePromotionCodesResponses = {\n /**\n * OK\n */\n 200: GetPromotionCodesResponse\n}\n\nexport type GetRulePromotionCodesResponse =\n GetRulePromotionCodesResponses[keyof GetRulePromotionCodesResponses]\n\nexport type CreateRulePromotionCodesData = {\n body: PromotionCodesRequest\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}/codes\"\n}\n\nexport type CreateRulePromotionCodesErrors = {\n /**\n * Bad Request\n */\n 400: {\n errors?: Array<{\n status?: number\n source?: string\n title?: string\n detail?: string\n }>\n }\n /**\n * Unprocessable Entity\n */\n 422: {\n errors?: Array<{\n status?: number\n source?: string\n title?: string\n detail?: string\n }>\n }\n}\n\nexport type CreateRulePromotionCodesError =\n CreateRulePromotionCodesErrors[keyof CreateRulePromotionCodesErrors]\n\nexport type CreateRulePromotionCodesResponses = {\n /**\n * Created\n */\n 201: CreatePromotionCodesResponse\n}\n\nexport type CreateRulePromotionCodesResponse =\n CreateRulePromotionCodesResponses[keyof CreateRulePromotionCodesResponses]\n\nexport type DeleteSingleRulePromotionCodeData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n /**\n * The unique identifier of the rule promotion code.\n */\n codeID: string\n }\n query?: never\n url: \"/v2/rule-promotions/{promotionID}/codes/{codeID}\"\n}\n\nexport type DeleteSingleRulePromotionCodeResponses = {\n /**\n * No Content\n */\n 204: void\n}\n\nexport type DeleteSingleRulePromotionCodeResponse =\n DeleteSingleRulePromotionCodeResponses[keyof DeleteSingleRulePromotionCodeResponses]\n\nexport type GetV2RulePromotionsByUuidJobsData = {\n body?: never\n path: {\n /**\n * The unique identifier of a rule promotion.\n */\n uuid: string\n }\n query?: {\n /**\n * Specifies filter attributes.\n */\n filter?: string\n }\n url: \"/v2/rule-promotions/{uuid}/jobs\"\n}\n\nexport type GetV2RulePromotionsByUuidJobsResponses = {\n /**\n * Successful response\n */\n 200: {\n data?: Array<PromotionJob>\n }\n}\n\nexport type GetV2RulePromotionsByUuidJobsResponse =\n GetV2RulePromotionsByUuidJobsResponses[keyof GetV2RulePromotionsByUuidJobsResponses]\n\n/**\n * Specifies the type of task to run.\n *\n */\nexport type JobType = \"code_generate\" | \"code_export\"\n\nexport type PostV2RulePromotionsByUuidJobsData = {\n body: {\n /**\n * Must be set to `promotion_job`.\n */\n type?: \"promotion_job\"\n /**\n * Specifies the type of task to run.\n *\n */\n job_type?: \"code_generate\" | \"code_export\"\n /**\n * Represents the name of the job. The maximum allowed length is 50 characters.\n */\n name?: string\n parameters?: {\n /**\n * Specifies the number of codes to be generated.\n */\n number_of_codes?: number\n /**\n * Specifies the maximum number of usages per code. If set to zero, you cannot use this promotion. If no value is set, it can be used unlimited times.\n */\n max_uses_per_code?: number\n /**\n * Specifies whether the code is consumed per application or per checkout. With `per_checkout`, the code is used once for each checkout, regardless of the number of items in the cart. When set to `per_application`, the code is used per application. For cart discounts, each application counts as one usage. For item discounts, each application to either a single quantity or a bundle is counted as one usage. For example, in a store that offers 50% off on SKU1, SKU2, and SKU3, and limits the maximum usage of the promotion code to two, a shopper can apply the promotion up to two quantities. If the cart contains two or more quantities of SKU1, the promotion is applied 2 times to SKU1, and other quantities and items are at the regular price. If the cart contains one quantity of SKU1, one quantity of SKU2, and one quantity of SKU3, the promotion is applied once to SKU1 and once to SKU2. The code usage is applied at checkout and the code is considered consumed at that point.\n *\n */\n consume_unit?: \"per_application\" | \"per_checkout\"\n /**\n * Prefix for generated promotion codes (e.g., `SUMMER-`).\n */\n code_prefix?: string\n /**\n * Code length.\n */\n code_length?: number\n }\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n uuid: string\n }\n query?: never\n url: \"/v2/rule-promotions/{uuid}/jobs\"\n}\n\nexport type PostV2RulePromotionsByUuidJobsErrors = {\n /**\n * Bad Request\n */\n 400: {\n errors?: Array<{\n status?: string\n title?: string\n detail?: string\n }>\n }\n}\n\nexport type PostV2RulePromotionsByUuidJobsError =\n PostV2RulePromotionsByUuidJobsErrors[keyof PostV2RulePromotionsByUuidJobsErrors]\n\nexport type PostV2RulePromotionsByUuidJobsResponses = {\n /**\n * Promotion job created\n */\n 201: {\n data?: PromotionJob\n }\n}\n\nexport type PostV2RulePromotionsByUuidJobsResponse =\n PostV2RulePromotionsByUuidJobsResponses[keyof PostV2RulePromotionsByUuidJobsResponses]\n\nexport type GetV2RulePromotionsByUuidJobsByJobUuidFileData = {\n body?: never\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n uuid: string\n /**\n * The unique identifier of the job associated with the file.\n */\n \"job-uuid\": string\n }\n query?: never\n url: \"/v2/rule-promotions/{uuid}/jobs/{job-uuid}/file\"\n}\n\nexport type GetV2RulePromotionsByUuidJobsByJobUuidFileResponses = {\n /**\n * Successful response\n */\n 200: {\n /**\n * URL to download the CSV file.\n */\n href?: string\n }\n}\n\nexport type GetV2RulePromotionsByUuidJobsByJobUuidFileResponse =\n GetV2RulePromotionsByUuidJobsByJobUuidFileResponses[keyof GetV2RulePromotionsByUuidJobsByJobUuidFileResponses]\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelData = {\n body?: never\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n uuid: string\n /**\n * The unique identifier of the job to be canceled.\n */\n \"job-uuid\": string\n }\n query?: never\n url: \"/v2/rule-promotions/{uuid}/jobs/{job-uuid}/cancel\"\n}\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelErrors = {\n /**\n * Unprocessable Entity\n */\n 422: {\n errors?: Array<{\n status?: string\n title?: string\n detail?: string\n }>\n }\n}\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelError =\n PostV2RulePromotionsByUuidJobsByJobUuidCancelErrors[keyof PostV2RulePromotionsByUuidJobsByJobUuidCancelErrors]\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelResponses = {\n /**\n * Successfully Canceled the Rule Promotion Job\n */\n 200: PromotionJobCanceledResponse\n}\n\nexport type PostV2RulePromotionsByUuidJobsByJobUuidCancelResponse =\n PostV2RulePromotionsByUuidJobsByJobUuidCancelResponses[keyof PostV2RulePromotionsByUuidJobsByJobUuidCancelResponses]\n\nexport type AnonymizeRulePromotionUsagesData = {\n body: {\n data: {\n /**\n * The unique identifiers of the usages to be anonymized.\n * Multiple usage IDs can be provided to anonymize in bulk.\n *\n */\n usage_ids?: Array<string>\n }\n }\n path?: never\n query?: never\n url: \"/v2/rule-promotions/usages/anonymize\"\n}\n\nexport type AnonymizeRulePromotionUsagesErrors = {\n /**\n * Bad Request\n */\n 400: ResponseError\n /**\n * Unauthorized\n */\n 401: ResponseError\n /**\n * Not Found\n */\n 404: ResponseError\n}\n\nexport type AnonymizeRulePromotionUsagesError =\n AnonymizeRulePromotionUsagesErrors[keyof AnonymizeRulePromotionUsagesErrors]\n\nexport type AnonymizeRulePromotionUsagesResponses = {\n /**\n * OK\n */\n 200: {\n data?: Array<RulePromotionUsage>\n }\n}\n\nexport type AnonymizeRulePromotionUsagesResponse =\n AnonymizeRulePromotionUsagesResponses[keyof AnonymizeRulePromotionUsagesResponses]\n\nexport type GetRulePromotionUsagesData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n }\n query?: {\n /**\n * Filter attributes to refine the usage records. Supported attributes:\n * - `id`: Filter by usage ID.\n * - `code`: Filter by promotion code.\n * - `used_on`: Filter by usage date with operators `gt`, `ge`, `le`, `lt`.\n *\n */\n filter?: string\n /**\n * The number of records per page.\n */\n \"page[limit]\"?: number\n /**\n * The number of records to offset the results by.\n */\n \"page[offset]\"?: number\n }\n url: \"/v2/rule-promotions/{promotionID}/usages\"\n}\n\nexport type GetRulePromotionUsagesErrors = {\n /**\n * Unauthorized\n */\n 401: ResponseError\n /**\n * Not Found\n */\n 404: ResponseError\n}\n\nexport type GetRulePromotionUsagesError =\n GetRulePromotionUsagesErrors[keyof GetRulePromotionUsagesErrors]\n\nexport type GetRulePromotionUsagesResponses = {\n /**\n * Successful response\n */\n 200: {\n data?: Array<RulePromotionUsage>\n meta?: ResponsePaginationMeta\n }\n}\n\nexport type GetRulePromotionUsagesResponse =\n GetRulePromotionUsagesResponses[keyof GetRulePromotionUsagesResponses]\n\nexport type GetRulePromotionCodeUsagesData = {\n body?: never\n headers: {\n /**\n * The Bearer token required to get access to the API.\n */\n Authorization: string\n }\n path: {\n /**\n * The unique identifier of the rule promotion.\n */\n promotionID: string\n /**\n * The specific promotion code for which to retrieve usage records.\n */\n code: string\n }\n query?: {\n /**\n * Filter attributes to refine the results. Supported attributes:\n * - `id`: Filter by usage ID.\n * - `used_on`: Filter by date with operators `gt`, `ge`, `le`, `lt`.\n *\n */\n filter?: string\n /**\n * The number of records per page.\n */\n \"page[limit]\"?: number\n /**\n * The number of records to offset the results by.\n */\n \"page[offset]\"?: number\n }\n url: \"/v2/rule-promotions/{promotionID}/codes/{code}/usages\"\n}\n\nexport type GetRulePromotionCodeUsagesErrors = {\n /**\n * Unauthorized\n */\n 401: ResponseError\n /**\n * Not Found\n */\n 404: ResponseError\n}\n\nexport type GetRulePromotionCodeUsagesError =\n GetRulePromotionCodeUsagesErrors[keyof GetRulePromotionCodeUsagesErrors]\n\nexport type GetRulePromotionCodeUsagesResponses = {\n /**\n * Successful response\n */\n 200: {\n data?: Array<RulePromotionUsage>\n meta?: ResponsePaginationMeta\n }\n}\n\nexport type GetRulePromotionCodeUsagesResponse =\n GetRulePromotionCodeUsagesResponses[keyof GetRulePromotionCodeUsagesResponses]\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -98,6 +98,10 @@ type RulePromotionRequest = {
98
98
  * Specifies the maximum number of items eligible for the discount.
99
99
  */
100
100
  max_items?: number;
101
+ /**
102
+ * Specifies the maximum total quantity of units eligible for the discount across all selected items. Units are sorted by price before selection, defaulting to cheapest first. Use `price_strategy` to change the sort order. For example, with `max_units: 2` and `price_strategy: expensive`, the 2 most expensive units across all eligible items receive the discount, regardless of which SKUs they belong to.
103
+ */
104
+ max_units?: number;
101
105
  /**
102
106
  * Specifies the strategy for determining which items to discount based on their individual prices.
103
107
  */
@@ -98,6 +98,10 @@ type RulePromotionRequest = {
98
98
  * Specifies the maximum number of items eligible for the discount.
99
99
  */
100
100
  max_items?: number;
101
+ /**
102
+ * Specifies the maximum total quantity of units eligible for the discount across all selected items. Units are sorted by price before selection, defaulting to cheapest first. Use `price_strategy` to change the sort order. For example, with `max_units: 2` and `price_strategy: expensive`, the 2 most expensive units across all eligible items receive the discount, regardless of which SKUs they belong to.
103
+ */
104
+ max_units?: number;
101
105
  /**
102
106
  * Specifies the strategy for determining which items to discount based on their individual prices.
103
107
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epcc-sdk/rule-promotions",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",