@commercelayer/sdk 5.27.3 → 5.29.0-alfa.1

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.
Files changed (220) hide show
  1. package/lib/cjs/api.d.ts +3 -2
  2. package/lib/cjs/api.js +5 -2
  3. package/lib/cjs/client.js +5 -5
  4. package/lib/cjs/commercelayer.d.ts +3 -2
  5. package/lib/cjs/commercelayer.js +5 -4
  6. package/lib/cjs/common.js +1 -1
  7. package/lib/cjs/error.js +1 -2
  8. package/lib/cjs/model.d.ts +1 -0
  9. package/lib/cjs/query.d.ts +1 -1
  10. package/lib/cjs/query.js +1 -1
  11. package/lib/cjs/resource.js +22 -25
  12. package/lib/cjs/resources/adjustments.d.ts +3 -0
  13. package/lib/cjs/resources/adyen_gateways.d.ts +2 -2
  14. package/lib/cjs/resources/avalara_accounts.d.ts +6 -6
  15. package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +11 -13
  16. package/lib/cjs/resources/buy_x_pay_y_promotions.js +6 -2
  17. package/lib/cjs/resources/external_gateways.d.ts +5 -1
  18. package/lib/cjs/resources/external_gateways.js +3 -0
  19. package/lib/cjs/resources/external_promotions.d.ts +15 -13
  20. package/lib/cjs/resources/external_promotions.js +9 -2
  21. package/lib/cjs/resources/external_tax_calculators.d.ts +4 -0
  22. package/lib/cjs/resources/external_tax_calculators.js +3 -0
  23. package/lib/cjs/resources/fixed_amount_promotions.d.ts +11 -13
  24. package/lib/cjs/resources/fixed_amount_promotions.js +6 -2
  25. package/lib/cjs/resources/fixed_price_promotions.d.ts +11 -13
  26. package/lib/cjs/resources/fixed_price_promotions.js +6 -2
  27. package/lib/cjs/resources/free_gift_promotions.d.ts +11 -13
  28. package/lib/cjs/resources/free_gift_promotions.js +6 -2
  29. package/lib/cjs/resources/free_shipping_promotions.d.ts +17 -14
  30. package/lib/cjs/resources/free_shipping_promotions.js +6 -2
  31. package/lib/cjs/resources/gift_cards.d.ts +3 -0
  32. package/lib/cjs/resources/inventory_models.d.ts +3 -0
  33. package/lib/cjs/resources/line_items.d.ts +15 -4
  34. package/lib/cjs/resources/line_items.js +7 -0
  35. package/lib/cjs/resources/markets.d.ts +1 -1
  36. package/lib/cjs/resources/order_subscriptions.d.ts +1 -4
  37. package/lib/cjs/resources/orders.d.ts +16 -1
  38. package/lib/cjs/resources/orders.js +14 -0
  39. package/lib/cjs/resources/parcel_line_items.d.ts +0 -8
  40. package/lib/cjs/resources/payment_methods.d.ts +8 -5
  41. package/lib/cjs/resources/percentage_discount_promotions.d.ts +11 -13
  42. package/lib/cjs/resources/percentage_discount_promotions.js +6 -2
  43. package/lib/cjs/resources/promotions.d.ts +6 -3
  44. package/lib/cjs/resources/promotions.js +6 -2
  45. package/lib/cjs/resources/resource_errors.d.ts +22 -0
  46. package/lib/cjs/resources/resource_errors.js +16 -0
  47. package/lib/cjs/resources/shipments.d.ts +0 -4
  48. package/lib/cjs/resources/shipping_methods.d.ts +9 -5
  49. package/lib/cjs/resources/shipping_methods.js +3 -0
  50. package/lib/cjs/resources/stock_line_items.d.ts +6 -0
  51. package/lib/cjs/resources/stock_line_items.js +9 -0
  52. package/lib/cjs/resources/stock_reservations.d.ts +0 -1
  53. package/lib/cjs/resources/stock_transfers.d.ts +1 -1
  54. package/lib/cjs/resources/stripe_payments.d.ts +4 -1
  55. package/lib/cjs/resources/webhooks.d.ts +3 -3
  56. package/lib/cjs/resources/webhooks.js +3 -3
  57. package/lib/esm/api.d.ts +3 -2
  58. package/lib/esm/api.js +2 -0
  59. package/lib/esm/client.js +19 -30
  60. package/lib/esm/commercelayer.d.ts +3 -2
  61. package/lib/esm/commercelayer.js +261 -149
  62. package/lib/esm/common.js +1 -1
  63. package/lib/esm/error.js +10 -5
  64. package/lib/esm/model.d.ts +1 -0
  65. package/lib/esm/query.d.ts +1 -1
  66. package/lib/esm/query.js +1 -1
  67. package/lib/esm/resource.js +37 -50
  68. package/lib/esm/resources/addresses.js +1 -1
  69. package/lib/esm/resources/adjustments.d.ts +3 -0
  70. package/lib/esm/resources/adjustments.js +1 -1
  71. package/lib/esm/resources/adyen_gateways.d.ts +2 -2
  72. package/lib/esm/resources/adyen_gateways.js +1 -1
  73. package/lib/esm/resources/adyen_payments.js +1 -1
  74. package/lib/esm/resources/application.js +1 -1
  75. package/lib/esm/resources/attachments.js +1 -1
  76. package/lib/esm/resources/authorizations.js +1 -1
  77. package/lib/esm/resources/avalara_accounts.d.ts +6 -6
  78. package/lib/esm/resources/avalara_accounts.js +1 -1
  79. package/lib/esm/resources/axerve_gateways.js +1 -1
  80. package/lib/esm/resources/axerve_payments.js +1 -1
  81. package/lib/esm/resources/billing_info_validation_rules.js +1 -1
  82. package/lib/esm/resources/bing_geocoders.js +1 -1
  83. package/lib/esm/resources/braintree_gateways.js +1 -1
  84. package/lib/esm/resources/braintree_payments.js +1 -1
  85. package/lib/esm/resources/bundles.js +1 -1
  86. package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +11 -13
  87. package/lib/esm/resources/buy_x_pay_y_promotions.js +7 -3
  88. package/lib/esm/resources/captures.js +1 -1
  89. package/lib/esm/resources/carrier_accounts.js +1 -1
  90. package/lib/esm/resources/checkout_com_gateways.js +1 -1
  91. package/lib/esm/resources/checkout_com_payments.js +1 -1
  92. package/lib/esm/resources/cleanups.js +1 -1
  93. package/lib/esm/resources/coupon_codes_promotion_rules.js +1 -1
  94. package/lib/esm/resources/coupon_recipients.js +1 -1
  95. package/lib/esm/resources/coupons.js +1 -1
  96. package/lib/esm/resources/custom_promotion_rules.js +1 -1
  97. package/lib/esm/resources/customer_addresses.js +1 -1
  98. package/lib/esm/resources/customer_groups.js +1 -1
  99. package/lib/esm/resources/customer_password_resets.js +1 -1
  100. package/lib/esm/resources/customer_payment_sources.js +1 -1
  101. package/lib/esm/resources/customer_subscriptions.js +1 -1
  102. package/lib/esm/resources/customers.js +1 -1
  103. package/lib/esm/resources/delivery_lead_times.js +1 -1
  104. package/lib/esm/resources/event_callbacks.js +1 -1
  105. package/lib/esm/resources/events.js +1 -1
  106. package/lib/esm/resources/exports.js +1 -1
  107. package/lib/esm/resources/external_gateways.d.ts +5 -1
  108. package/lib/esm/resources/external_gateways.js +4 -1
  109. package/lib/esm/resources/external_payments.js +1 -1
  110. package/lib/esm/resources/external_promotions.d.ts +15 -13
  111. package/lib/esm/resources/external_promotions.js +10 -3
  112. package/lib/esm/resources/external_tax_calculators.d.ts +4 -0
  113. package/lib/esm/resources/external_tax_calculators.js +4 -1
  114. package/lib/esm/resources/fixed_amount_promotions.d.ts +11 -13
  115. package/lib/esm/resources/fixed_amount_promotions.js +7 -3
  116. package/lib/esm/resources/fixed_price_promotions.d.ts +11 -13
  117. package/lib/esm/resources/fixed_price_promotions.js +7 -3
  118. package/lib/esm/resources/free_gift_promotions.d.ts +11 -13
  119. package/lib/esm/resources/free_gift_promotions.js +7 -3
  120. package/lib/esm/resources/free_shipping_promotions.d.ts +17 -14
  121. package/lib/esm/resources/free_shipping_promotions.js +7 -3
  122. package/lib/esm/resources/geocoders.js +1 -1
  123. package/lib/esm/resources/gift_card_recipients.js +1 -1
  124. package/lib/esm/resources/gift_cards.d.ts +3 -0
  125. package/lib/esm/resources/gift_cards.js +1 -1
  126. package/lib/esm/resources/google_geocoders.js +1 -1
  127. package/lib/esm/resources/imports.js +1 -1
  128. package/lib/esm/resources/in_stock_subscriptions.js +1 -1
  129. package/lib/esm/resources/inventory_models.d.ts +3 -0
  130. package/lib/esm/resources/inventory_models.js +1 -1
  131. package/lib/esm/resources/inventory_return_locations.js +1 -1
  132. package/lib/esm/resources/inventory_stock_locations.js +1 -1
  133. package/lib/esm/resources/klarna_gateways.js +1 -1
  134. package/lib/esm/resources/klarna_payments.js +1 -1
  135. package/lib/esm/resources/line_item_options.js +1 -1
  136. package/lib/esm/resources/line_items.d.ts +15 -4
  137. package/lib/esm/resources/line_items.js +8 -1
  138. package/lib/esm/resources/manual_gateways.js +1 -1
  139. package/lib/esm/resources/manual_tax_calculators.js +1 -1
  140. package/lib/esm/resources/markets.d.ts +1 -1
  141. package/lib/esm/resources/markets.js +1 -1
  142. package/lib/esm/resources/merchants.js +1 -1
  143. package/lib/esm/resources/order_amount_promotion_rules.js +1 -1
  144. package/lib/esm/resources/order_copies.js +1 -1
  145. package/lib/esm/resources/order_factories.js +1 -1
  146. package/lib/esm/resources/order_subscription_items.js +1 -1
  147. package/lib/esm/resources/order_subscriptions.d.ts +1 -4
  148. package/lib/esm/resources/order_subscriptions.js +1 -1
  149. package/lib/esm/resources/order_validation_rules.js +1 -1
  150. package/lib/esm/resources/orders.d.ts +16 -1
  151. package/lib/esm/resources/orders.js +15 -1
  152. package/lib/esm/resources/organization.js +1 -1
  153. package/lib/esm/resources/packages.js +1 -1
  154. package/lib/esm/resources/parcel_line_items.d.ts +0 -8
  155. package/lib/esm/resources/parcel_line_items.js +1 -1
  156. package/lib/esm/resources/parcels.js +1 -1
  157. package/lib/esm/resources/payment_gateways.js +1 -1
  158. package/lib/esm/resources/payment_methods.d.ts +8 -5
  159. package/lib/esm/resources/payment_methods.js +1 -1
  160. package/lib/esm/resources/payment_options.js +1 -1
  161. package/lib/esm/resources/paypal_gateways.js +1 -1
  162. package/lib/esm/resources/paypal_payments.js +1 -1
  163. package/lib/esm/resources/percentage_discount_promotions.d.ts +11 -13
  164. package/lib/esm/resources/percentage_discount_promotions.js +7 -3
  165. package/lib/esm/resources/price_frequency_tiers.js +1 -1
  166. package/lib/esm/resources/price_lists.js +1 -1
  167. package/lib/esm/resources/price_tiers.js +1 -1
  168. package/lib/esm/resources/price_volume_tiers.js +1 -1
  169. package/lib/esm/resources/prices.js +1 -1
  170. package/lib/esm/resources/promotion_rules.js +1 -1
  171. package/lib/esm/resources/promotions.d.ts +6 -3
  172. package/lib/esm/resources/promotions.js +7 -3
  173. package/lib/esm/resources/recurring_order_copies.js +1 -1
  174. package/lib/esm/resources/refunds.js +1 -1
  175. package/lib/esm/resources/reserved_stocks.js +1 -1
  176. package/lib/esm/resources/resource_errors.d.ts +22 -0
  177. package/lib/esm/resources/resource_errors.js +14 -0
  178. package/lib/esm/resources/return_line_items.js +1 -1
  179. package/lib/esm/resources/returns.js +1 -1
  180. package/lib/esm/resources/satispay_gateways.js +1 -1
  181. package/lib/esm/resources/satispay_payments.js +1 -1
  182. package/lib/esm/resources/shipments.d.ts +0 -4
  183. package/lib/esm/resources/shipments.js +1 -1
  184. package/lib/esm/resources/shipping_categories.js +1 -1
  185. package/lib/esm/resources/shipping_method_tiers.js +1 -1
  186. package/lib/esm/resources/shipping_methods.d.ts +9 -5
  187. package/lib/esm/resources/shipping_methods.js +4 -1
  188. package/lib/esm/resources/shipping_weight_tiers.js +1 -1
  189. package/lib/esm/resources/shipping_zones.js +1 -1
  190. package/lib/esm/resources/sku_list_items.js +1 -1
  191. package/lib/esm/resources/sku_list_promotion_rules.js +1 -1
  192. package/lib/esm/resources/sku_lists.js +1 -1
  193. package/lib/esm/resources/sku_options.js +1 -1
  194. package/lib/esm/resources/skus.js +1 -1
  195. package/lib/esm/resources/stock_items.js +1 -1
  196. package/lib/esm/resources/stock_line_items.d.ts +6 -0
  197. package/lib/esm/resources/stock_line_items.js +10 -1
  198. package/lib/esm/resources/stock_locations.js +1 -1
  199. package/lib/esm/resources/stock_reservations.d.ts +0 -1
  200. package/lib/esm/resources/stock_reservations.js +1 -1
  201. package/lib/esm/resources/stock_transfers.d.ts +1 -1
  202. package/lib/esm/resources/stock_transfers.js +1 -1
  203. package/lib/esm/resources/stripe_gateways.js +1 -1
  204. package/lib/esm/resources/stripe_payments.d.ts +4 -1
  205. package/lib/esm/resources/stripe_payments.js +1 -1
  206. package/lib/esm/resources/subscription_models.js +1 -1
  207. package/lib/esm/resources/tags.js +1 -1
  208. package/lib/esm/resources/tax_calculators.js +1 -1
  209. package/lib/esm/resources/tax_categories.js +1 -1
  210. package/lib/esm/resources/tax_rules.js +1 -1
  211. package/lib/esm/resources/taxjar_accounts.js +1 -1
  212. package/lib/esm/resources/transactions.js +1 -1
  213. package/lib/esm/resources/versions.js +1 -1
  214. package/lib/esm/resources/voids.js +1 -1
  215. package/lib/esm/resources/webhooks.d.ts +3 -3
  216. package/lib/esm/resources/webhooks.js +4 -4
  217. package/lib/esm/resources/wire_transfers.js +1 -1
  218. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  219. package/lib/tsconfig.tsbuildinfo +1 -1
  220. package/package.json +16 -16
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class PercentageDiscountPromotions extends ApiResource {
3
+ static TYPE = 'percentage_discount_promotions';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: PercentageDiscountPromotions.TYPE }, params, options);
5
6
  }
@@ -25,14 +26,18 @@ class PercentageDiscountPromotions extends ApiResource {
25
26
  const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
26
27
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupon_codes_promotion_rule`, params, options);
27
28
  }
28
- async coupons(percentageDiscountPromotionId, params, options) {
29
+ async custom_promotion_rule(percentageDiscountPromotionId, params, options) {
29
30
  const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
30
- return this.resources.fetch({ type: 'coupons' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupons`, params, options);
31
+ return this.resources.fetch({ type: 'custom_promotion_rules' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/custom_promotion_rule`, params, options);
31
32
  }
32
33
  async sku_list(percentageDiscountPromotionId, params, options) {
33
34
  const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
34
35
  return this.resources.fetch({ type: 'sku_lists' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options);
35
36
  }
37
+ async coupons(percentageDiscountPromotionId, params, options) {
38
+ const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
39
+ return this.resources.fetch({ type: 'coupons' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupons`, params, options);
40
+ }
36
41
  async attachments(percentageDiscountPromotionId, params, options) {
37
42
  const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
38
43
  return this.resources.fetch({ type: 'attachments' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/attachments`, params, options);
@@ -69,5 +74,4 @@ class PercentageDiscountPromotions extends ApiResource {
69
74
  return PercentageDiscountPromotions.TYPE;
70
75
  }
71
76
  }
72
- PercentageDiscountPromotions.TYPE = 'percentage_discount_promotions';
73
77
  export default PercentageDiscountPromotions;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class PriceFrequencyTiers extends ApiResource {
3
+ static TYPE = 'price_frequency_tiers';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: PriceFrequencyTiers.TYPE }, params, options);
5
6
  }
@@ -35,5 +36,4 @@ class PriceFrequencyTiers extends ApiResource {
35
36
  return PriceFrequencyTiers.TYPE;
36
37
  }
37
38
  }
38
- PriceFrequencyTiers.TYPE = 'price_frequency_tiers';
39
39
  export default PriceFrequencyTiers;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class PriceLists extends ApiResource {
3
+ static TYPE = 'price_lists';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: PriceLists.TYPE }, params, options);
5
6
  }
@@ -31,5 +32,4 @@ class PriceLists extends ApiResource {
31
32
  return PriceLists.TYPE;
32
33
  }
33
34
  }
34
- PriceLists.TYPE = 'price_lists';
35
35
  export default PriceLists;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class PriceTiers extends ApiResource {
3
+ static TYPE = 'price_tiers';
3
4
  async price(priceTierId, params, options) {
4
5
  const _priceTierId = priceTierId.id || priceTierId;
5
6
  return this.resources.fetch({ type: 'prices' }, `price_tiers/${_priceTierId}/price`, params, options);
@@ -22,5 +23,4 @@ class PriceTiers extends ApiResource {
22
23
  return PriceTiers.TYPE;
23
24
  }
24
25
  }
25
- PriceTiers.TYPE = 'price_tiers';
26
26
  export default PriceTiers;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class PriceVolumeTiers extends ApiResource {
3
+ static TYPE = 'price_volume_tiers';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: PriceVolumeTiers.TYPE }, params, options);
5
6
  }
@@ -35,5 +36,4 @@ class PriceVolumeTiers extends ApiResource {
35
36
  return PriceVolumeTiers.TYPE;
36
37
  }
37
38
  }
38
- PriceVolumeTiers.TYPE = 'price_volume_tiers';
39
39
  export default PriceVolumeTiers;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class Prices extends ApiResource {
3
+ static TYPE = 'prices';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: Prices.TYPE }, params, options);
5
6
  }
@@ -47,5 +48,4 @@ class Prices extends ApiResource {
47
48
  return Prices.TYPE;
48
49
  }
49
50
  }
50
- Prices.TYPE = 'prices';
51
51
  export default Prices;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class PromotionRules extends ApiResource {
3
+ static TYPE = 'promotion_rules';
3
4
  async versions(promotionRuleId, params, options) {
4
5
  const _promotionRuleId = promotionRuleId.id || promotionRuleId;
5
6
  return this.resources.fetch({ type: 'versions' }, `promotion_rules/${_promotionRuleId}/versions`, params, options);
@@ -14,5 +15,4 @@ class PromotionRules extends ApiResource {
14
15
  return PromotionRules.TYPE;
15
16
  }
16
17
  }
17
- PromotionRules.TYPE = 'promotion_rules';
18
18
  export default PromotionRules;
@@ -6,8 +6,9 @@ import type { PromotionRule } from './promotion_rules';
6
6
  import type { OrderAmountPromotionRule } from './order_amount_promotion_rules';
7
7
  import type { SkuListPromotionRule } from './sku_list_promotion_rules';
8
8
  import type { CouponCodesPromotionRule } from './coupon_codes_promotion_rules';
9
- import type { Coupon } from './coupons';
9
+ import type { CustomPromotionRule } from './custom_promotion_rules';
10
10
  import type { SkuList } from './sku_lists';
11
+ import type { Coupon } from './coupons';
11
12
  import type { Attachment } from './attachments';
12
13
  import type { Event } from './events';
13
14
  import type { Tag } from './tags';
@@ -33,8 +34,9 @@ interface Promotion extends Resource {
33
34
  order_amount_promotion_rule?: OrderAmountPromotionRule | null;
34
35
  sku_list_promotion_rule?: SkuListPromotionRule | null;
35
36
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
36
- coupons?: Coupon[] | null;
37
+ custom_promotion_rule?: CustomPromotionRule | null;
37
38
  sku_list?: SkuList | null;
39
+ coupons?: Coupon[] | null;
38
40
  attachments?: Attachment[] | null;
39
41
  events?: Event[] | null;
40
42
  tags?: Tag[] | null;
@@ -46,8 +48,9 @@ declare class Promotions extends ApiResource<Promotion> {
46
48
  order_amount_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
47
49
  sku_list_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
48
50
  coupon_codes_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
49
- coupons(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
51
+ custom_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
50
52
  sku_list(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
53
+ coupons(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
51
54
  attachments(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
52
55
  events(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
53
56
  tags(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class Promotions extends ApiResource {
3
+ static TYPE = 'promotions';
3
4
  async market(promotionId, params, options) {
4
5
  const _promotionId = promotionId.id || promotionId;
5
6
  return this.resources.fetch({ type: 'markets' }, `promotions/${_promotionId}/market`, params, options);
@@ -16,14 +17,18 @@ class Promotions extends ApiResource {
16
17
  const _promotionId = promotionId.id || promotionId;
17
18
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `promotions/${_promotionId}/coupon_codes_promotion_rule`, params, options);
18
19
  }
19
- async coupons(promotionId, params, options) {
20
+ async custom_promotion_rule(promotionId, params, options) {
20
21
  const _promotionId = promotionId.id || promotionId;
21
- return this.resources.fetch({ type: 'coupons' }, `promotions/${_promotionId}/coupons`, params, options);
22
+ return this.resources.fetch({ type: 'custom_promotion_rules' }, `promotions/${_promotionId}/custom_promotion_rule`, params, options);
22
23
  }
23
24
  async sku_list(promotionId, params, options) {
24
25
  const _promotionId = promotionId.id || promotionId;
25
26
  return this.resources.fetch({ type: 'sku_lists' }, `promotions/${_promotionId}/sku_list`, params, options);
26
27
  }
28
+ async coupons(promotionId, params, options) {
29
+ const _promotionId = promotionId.id || promotionId;
30
+ return this.resources.fetch({ type: 'coupons' }, `promotions/${_promotionId}/coupons`, params, options);
31
+ }
27
32
  async attachments(promotionId, params, options) {
28
33
  const _promotionId = promotionId.id || promotionId;
29
34
  return this.resources.fetch({ type: 'attachments' }, `promotions/${_promotionId}/attachments`, params, options);
@@ -50,5 +55,4 @@ class Promotions extends ApiResource {
50
55
  return Promotions.TYPE;
51
56
  }
52
57
  }
53
- Promotions.TYPE = 'promotions';
54
58
  export default Promotions;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class RecurringOrderCopies extends ApiResource {
3
+ static TYPE = 'recurring_order_copies';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: RecurringOrderCopies.TYPE }, params, options);
5
6
  }
@@ -35,5 +36,4 @@ class RecurringOrderCopies extends ApiResource {
35
36
  return RecurringOrderCopies.TYPE;
36
37
  }
37
38
  }
38
- RecurringOrderCopies.TYPE = 'recurring_order_copies';
39
39
  export default RecurringOrderCopies;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class Refunds extends ApiResource {
3
+ static TYPE = 'refunds';
3
4
  async order(refundId, params, options) {
4
5
  const _refundId = refundId.id || refundId;
5
6
  return this.resources.fetch({ type: 'orders' }, `refunds/${_refundId}/order`, params, options);
@@ -30,5 +31,4 @@ class Refunds extends ApiResource {
30
31
  return Refunds.TYPE;
31
32
  }
32
33
  }
33
- Refunds.TYPE = 'refunds';
34
34
  export default Refunds;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class ReservedStocks extends ApiResource {
3
+ static TYPE = 'reserved_stocks';
3
4
  async stock_item(reservedStockId, params, options) {
4
5
  const _reservedStockId = reservedStockId.id || reservedStockId;
5
6
  return this.resources.fetch({ type: 'stock_items' }, `reserved_stocks/${_reservedStockId}/stock_item`, params, options);
@@ -22,5 +23,4 @@ class ReservedStocks extends ApiResource {
22
23
  return ReservedStocks.TYPE;
23
24
  }
24
25
  }
25
- ReservedStocks.TYPE = 'reserved_stocks';
26
26
  export default ReservedStocks;
@@ -0,0 +1,22 @@
1
+ import { ApiResource } from '../resource';
2
+ import type { Resource, ResourceId, ResourceRel } from '../resource';
3
+ import type { Order } from './orders';
4
+ type ResourceErrorType = 'resource_errors';
5
+ type ResourceErrorRel = ResourceRel & {
6
+ type: ResourceErrorType;
7
+ };
8
+ interface ResourceError extends Resource {
9
+ readonly type: ResourceErrorType;
10
+ name: string;
11
+ code: string;
12
+ message: string;
13
+ resource?: Order | null;
14
+ }
15
+ declare class ResourceErrors extends ApiResource<ResourceError> {
16
+ static readonly TYPE: ResourceErrorType;
17
+ isResourceError(resource: any): resource is ResourceError;
18
+ relationship(id: string | ResourceId | null): ResourceErrorRel;
19
+ type(): ResourceErrorType;
20
+ }
21
+ export default ResourceErrors;
22
+ export type { ResourceError, ResourceErrorType };
@@ -0,0 +1,14 @@
1
+ import { ApiResource } from '../resource';
2
+ class ResourceErrors extends ApiResource {
3
+ static TYPE = 'resource_errors';
4
+ isResourceError(resource) {
5
+ return resource.type && (resource.type === ResourceErrors.TYPE);
6
+ }
7
+ relationship(id) {
8
+ return ((id === null) || (typeof id === 'string')) ? { id, type: ResourceErrors.TYPE } : { id: id.id, type: ResourceErrors.TYPE };
9
+ }
10
+ type() {
11
+ return ResourceErrors.TYPE;
12
+ }
13
+ }
14
+ export default ResourceErrors;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class ReturnLineItems extends ApiResource {
3
+ static TYPE = 'return_line_items';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: ReturnLineItems.TYPE }, params, options);
5
6
  }
@@ -30,5 +31,4 @@ class ReturnLineItems extends ApiResource {
30
31
  return ReturnLineItems.TYPE;
31
32
  }
32
33
  }
33
- ReturnLineItems.TYPE = 'return_line_items';
34
34
  export default ReturnLineItems;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class Returns extends ApiResource {
3
+ static TYPE = 'returns';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: Returns.TYPE }, params, options);
5
6
  }
@@ -86,5 +87,4 @@ class Returns extends ApiResource {
86
87
  return Returns.TYPE;
87
88
  }
88
89
  }
89
- Returns.TYPE = 'returns';
90
90
  export default Returns;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class SatispayGateways extends ApiResource {
3
+ static TYPE = 'satispay_gateways';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: SatispayGateways.TYPE }, params, options);
5
6
  }
@@ -31,5 +32,4 @@ class SatispayGateways extends ApiResource {
31
32
  return SatispayGateways.TYPE;
32
33
  }
33
34
  }
34
- SatispayGateways.TYPE = 'satispay_gateways';
35
35
  export default SatispayGateways;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class SatispayPayments extends ApiResource {
3
+ static TYPE = 'satispay_payments';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: SatispayPayments.TYPE }, params, options);
5
6
  }
@@ -34,5 +35,4 @@ class SatispayPayments extends ApiResource {
34
35
  return SatispayPayments.TYPE;
35
36
  }
36
37
  }
37
- SatispayPayments.TYPE = 'satispay_payments';
38
38
  export default SatispayPayments;
@@ -70,10 +70,6 @@ interface Shipment extends Resource {
70
70
  shipping_address?: Address | null;
71
71
  shipping_method?: ShippingMethod | null;
72
72
  delivery_lead_time?: DeliveryLeadTime | null;
73
- /**
74
- * @deprecated This field should not be used as it may be removed in the future without notice
75
- */
76
- shipment_line_items?: object[];
77
73
  stock_line_items?: StockLineItem[] | null;
78
74
  stock_transfers?: StockTransfer[] | null;
79
75
  available_shipping_methods?: ShippingMethod[] | null;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class Shipments extends ApiResource {
3
+ static TYPE = 'shipments';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: Shipments.TYPE }, params, options);
5
6
  }
@@ -120,5 +121,4 @@ class Shipments extends ApiResource {
120
121
  return Shipments.TYPE;
121
122
  }
122
123
  }
123
- Shipments.TYPE = 'shipments';
124
124
  export default Shipments;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class ShippingCategories extends ApiResource {
3
+ static TYPE = 'shipping_categories';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: ShippingCategories.TYPE }, params, options);
5
6
  }
@@ -31,5 +32,4 @@ class ShippingCategories extends ApiResource {
31
32
  return ShippingCategories.TYPE;
32
33
  }
33
34
  }
34
- ShippingCategories.TYPE = 'shipping_categories';
35
35
  export default ShippingCategories;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class ShippingMethodTiers extends ApiResource {
3
+ static TYPE = 'shipping_method_tiers';
3
4
  async shipping_method(shippingMethodTierId, params, options) {
4
5
  const _shippingMethodTierId = shippingMethodTierId.id || shippingMethodTierId;
5
6
  return this.resources.fetch({ type: 'shipping_methods' }, `shipping_method_tiers/${_shippingMethodTierId}/shipping_method`, params, options);
@@ -22,5 +23,4 @@ class ShippingMethodTiers extends ApiResource {
22
23
  return ShippingMethodTiers.TYPE;
23
24
  }
24
25
  }
25
- ShippingMethodTiers.TYPE = 'shipping_method_tiers';
26
26
  export default ShippingMethodTiers;
@@ -35,7 +35,6 @@ interface ShippingMethod extends Resource {
35
35
  scheme?: string | null;
36
36
  currency_code?: string | null;
37
37
  external_prices_url?: string | null;
38
- disabled_at?: string | null;
39
38
  price_amount_cents: number;
40
39
  price_amount_float?: number | null;
41
40
  formatted_price_amount?: string | null;
@@ -49,6 +48,9 @@ interface ShippingMethod extends Resource {
49
48
  min_weight?: number | null;
50
49
  max_weight?: number | null;
51
50
  unit_of_weight?: string | null;
51
+ disabled_at?: string | null;
52
+ circuit_state?: string | null;
53
+ circuit_failure_count?: number | null;
52
54
  market?: Market | null;
53
55
  shipping_zone?: ShippingZone | null;
54
56
  shipping_category?: ShippingCategory | null;
@@ -64,14 +66,14 @@ interface ShippingMethodCreate extends ResourceCreate {
64
66
  scheme?: string | null;
65
67
  currency_code?: string | null;
66
68
  external_prices_url?: string | null;
67
- _disable?: boolean | null;
68
- _enable?: boolean | null;
69
69
  price_amount_cents: number;
70
70
  free_over_amount_cents?: number | null;
71
71
  use_subtotal?: boolean | null;
72
72
  min_weight?: number | null;
73
73
  max_weight?: number | null;
74
74
  unit_of_weight?: string | null;
75
+ _disable?: boolean | null;
76
+ _enable?: boolean | null;
75
77
  market?: MarketRel | null;
76
78
  shipping_zone?: ShippingZoneRel | null;
77
79
  shipping_category?: ShippingCategoryRel | null;
@@ -83,14 +85,15 @@ interface ShippingMethodUpdate extends ResourceUpdate {
83
85
  scheme?: string | null;
84
86
  currency_code?: string | null;
85
87
  external_prices_url?: string | null;
86
- _disable?: boolean | null;
87
- _enable?: boolean | null;
88
88
  price_amount_cents?: number | null;
89
89
  free_over_amount_cents?: number | null;
90
90
  use_subtotal?: boolean | null;
91
91
  min_weight?: number | null;
92
92
  max_weight?: number | null;
93
93
  unit_of_weight?: string | null;
94
+ _disable?: boolean | null;
95
+ _enable?: boolean | null;
96
+ _reset_circuit?: boolean | null;
94
97
  market?: MarketRel | null;
95
98
  shipping_zone?: ShippingZoneRel | null;
96
99
  shipping_category?: ShippingCategoryRel | null;
@@ -113,6 +116,7 @@ declare class ShippingMethods extends ApiResource<ShippingMethod> {
113
116
  versions(shippingMethodId: string | ShippingMethod, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
114
117
  _disable(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
115
118
  _enable(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
119
+ _reset_circuit(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
116
120
  isShippingMethod(resource: any): resource is ShippingMethod;
117
121
  relationship(id: string | ResourceId | null): ShippingMethodRel;
118
122
  type(): ShippingMethodType;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class ShippingMethods extends ApiResource {
3
+ static TYPE = 'shipping_methods';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: ShippingMethods.TYPE }, params, options);
5
6
  }
@@ -51,6 +52,9 @@ class ShippingMethods extends ApiResource {
51
52
  async _enable(id, params, options) {
52
53
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ShippingMethods.TYPE, _enable: true }, params, options);
53
54
  }
55
+ async _reset_circuit(id, params, options) {
56
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ShippingMethods.TYPE, _reset_circuit: true }, params, options);
57
+ }
54
58
  isShippingMethod(resource) {
55
59
  return resource.type && (resource.type === ShippingMethods.TYPE);
56
60
  }
@@ -61,5 +65,4 @@ class ShippingMethods extends ApiResource {
61
65
  return ShippingMethods.TYPE;
62
66
  }
63
67
  }
64
- ShippingMethods.TYPE = 'shipping_methods';
65
68
  export default ShippingMethods;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class ShippingWeightTiers extends ApiResource {
3
+ static TYPE = 'shipping_weight_tiers';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: ShippingWeightTiers.TYPE }, params, options);
5
6
  }
@@ -31,5 +32,4 @@ class ShippingWeightTiers extends ApiResource {
31
32
  return ShippingWeightTiers.TYPE;
32
33
  }
33
34
  }
34
- ShippingWeightTiers.TYPE = 'shipping_weight_tiers';
35
35
  export default ShippingWeightTiers;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class ShippingZones extends ApiResource {
3
+ static TYPE = 'shipping_zones';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: ShippingZones.TYPE }, params, options);
5
6
  }
@@ -27,5 +28,4 @@ class ShippingZones extends ApiResource {
27
28
  return ShippingZones.TYPE;
28
29
  }
29
30
  }
30
- ShippingZones.TYPE = 'shipping_zones';
31
31
  export default ShippingZones;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class SkuListItems extends ApiResource {
3
+ static TYPE = 'sku_list_items';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: SkuListItems.TYPE }, params, options);
5
6
  }
@@ -31,5 +32,4 @@ class SkuListItems extends ApiResource {
31
32
  return SkuListItems.TYPE;
32
33
  }
33
34
  }
34
- SkuListItems.TYPE = 'sku_list_items';
35
35
  export default SkuListItems;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class SkuListPromotionRules extends ApiResource {
3
+ static TYPE = 'sku_list_promotion_rules';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: SkuListPromotionRules.TYPE }, params, options);
5
6
  }
@@ -31,5 +32,4 @@ class SkuListPromotionRules extends ApiResource {
31
32
  return SkuListPromotionRules.TYPE;
32
33
  }
33
34
  }
34
- SkuListPromotionRules.TYPE = 'sku_list_promotion_rules';
35
35
  export default SkuListPromotionRules;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class SkuLists extends ApiResource {
3
+ static TYPE = 'sku_lists';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: SkuLists.TYPE }, params, options);
5
6
  }
@@ -43,5 +44,4 @@ class SkuLists extends ApiResource {
43
44
  return SkuLists.TYPE;
44
45
  }
45
46
  }
46
- SkuLists.TYPE = 'sku_lists';
47
47
  export default SkuLists;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class SkuOptions extends ApiResource {
3
+ static TYPE = 'sku_options';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: SkuOptions.TYPE }, params, options);
5
6
  }
@@ -39,5 +40,4 @@ class SkuOptions extends ApiResource {
39
40
  return SkuOptions.TYPE;
40
41
  }
41
42
  }
42
- SkuOptions.TYPE = 'sku_options';
43
43
  export default SkuOptions;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class Skus extends ApiResource {
3
+ static TYPE = 'skus';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: Skus.TYPE }, params, options);
5
6
  }
@@ -59,5 +60,4 @@ class Skus extends ApiResource {
59
60
  return Skus.TYPE;
60
61
  }
61
62
  }
62
- Skus.TYPE = 'skus';
63
63
  export default Skus;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class StockItems extends ApiResource {
3
+ static TYPE = 'stock_items';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: StockItems.TYPE }, params, options);
5
6
  }
@@ -43,5 +44,4 @@ class StockItems extends ApiResource {
43
44
  return StockItems.TYPE;
44
45
  }
45
46
  }
46
- StockItems.TYPE = 'stock_items';
47
47
  export default StockItems;
@@ -44,6 +44,9 @@ interface StockLineItemCreate extends ResourceCreate {
44
44
  interface StockLineItemUpdate extends ResourceUpdate {
45
45
  sku_code?: string | null;
46
46
  quantity?: number | null;
47
+ _reserve_stock?: boolean | null;
48
+ _release_stock?: boolean | null;
49
+ _decrement_stock?: boolean | null;
47
50
  shipment?: ShipmentRel | null;
48
51
  line_item?: LineItemRel | null;
49
52
  stock_item?: StockItemRel | null;
@@ -59,6 +62,9 @@ declare class StockLineItems extends ApiResource<StockLineItem> {
59
62
  stock_item(stockLineItemId: string | StockLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockItem>;
60
63
  sku(stockLineItemId: string | StockLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Sku>;
61
64
  versions(stockLineItemId: string | StockLineItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
65
+ _reserve_stock(id: string | StockLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockLineItem>;
66
+ _release_stock(id: string | StockLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockLineItem>;
67
+ _decrement_stock(id: string | StockLineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockLineItem>;
62
68
  isStockLineItem(resource: any): resource is StockLineItem;
63
69
  relationship(id: string | ResourceId | null): StockLineItemRel;
64
70
  type(): StockLineItemType;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class StockLineItems extends ApiResource {
3
+ static TYPE = 'stock_line_items';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: StockLineItems.TYPE }, params, options);
5
6
  }
@@ -29,6 +30,15 @@ class StockLineItems extends ApiResource {
29
30
  const _stockLineItemId = stockLineItemId.id || stockLineItemId;
30
31
  return this.resources.fetch({ type: 'versions' }, `stock_line_items/${_stockLineItemId}/versions`, params, options);
31
32
  }
33
+ async _reserve_stock(id, params, options) {
34
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockLineItems.TYPE, _reserve_stock: true }, params, options);
35
+ }
36
+ async _release_stock(id, params, options) {
37
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockLineItems.TYPE, _release_stock: true }, params, options);
38
+ }
39
+ async _decrement_stock(id, params, options) {
40
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockLineItems.TYPE, _decrement_stock: true }, params, options);
41
+ }
32
42
  isStockLineItem(resource) {
33
43
  return resource.type && (resource.type === StockLineItems.TYPE);
34
44
  }
@@ -39,5 +49,4 @@ class StockLineItems extends ApiResource {
39
49
  return StockLineItems.TYPE;
40
50
  }
41
51
  }
42
- StockLineItems.TYPE = 'stock_line_items';
43
52
  export default StockLineItems;
@@ -1,5 +1,6 @@
1
1
  import { ApiResource } from '../resource';
2
2
  class StockLocations extends ApiResource {
3
+ static TYPE = 'stock_locations';
3
4
  async create(resource, params, options) {
4
5
  return this.resources.create({ ...resource, type: StockLocations.TYPE }, params, options);
5
6
  }
@@ -47,5 +48,4 @@ class StockLocations extends ApiResource {
47
48
  return StockLocations.TYPE;
48
49
  }
49
50
  }
50
- StockLocations.TYPE = 'stock_locations';
51
51
  export default StockLocations;
@@ -31,7 +31,6 @@ interface StockReservationCreate extends ResourceCreate {
31
31
  interface StockReservationUpdate extends ResourceUpdate {
32
32
  quantity?: number | null;
33
33
  _pending?: boolean | null;
34
- stock_item?: StockItemRel | null;
35
34
  }
36
35
  declare class StockReservations extends ApiResource<StockReservation> {
37
36
  static readonly TYPE: StockReservationType;