@commercelayer/sdk 4.30.0 → 4.32.0

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 (126) hide show
  1. package/lib/cjs/api.d.ts +4 -2
  2. package/lib/cjs/api.js +8 -2
  3. package/lib/cjs/client.d.ts +5 -1
  4. package/lib/cjs/client.js +22 -3
  5. package/lib/cjs/commercelayer.d.ts +4 -2
  6. package/lib/cjs/commercelayer.js +3 -1
  7. package/lib/cjs/error.d.ts +1 -0
  8. package/lib/cjs/error.js +1 -2
  9. package/lib/cjs/interceptor.d.ts +1 -1
  10. package/lib/cjs/jsonapi.js +4 -1
  11. package/lib/cjs/model.d.ts +2 -0
  12. package/lib/cjs/resources/authorizations.d.ts +3 -0
  13. package/lib/cjs/resources/authorizations.js +4 -0
  14. package/lib/cjs/resources/captures.d.ts +3 -0
  15. package/lib/cjs/resources/captures.js +4 -0
  16. package/lib/cjs/resources/coupons.d.ts +8 -0
  17. package/lib/cjs/resources/coupons.js +4 -0
  18. package/lib/cjs/resources/customer_addresses.d.ts +2 -0
  19. package/lib/cjs/resources/customers.d.ts +1 -0
  20. package/lib/cjs/resources/external_promotions.d.ts +3 -0
  21. package/lib/cjs/resources/external_promotions.js +4 -0
  22. package/lib/cjs/resources/fixed_amount_promotions.d.ts +3 -0
  23. package/lib/cjs/resources/fixed_amount_promotions.js +4 -0
  24. package/lib/cjs/resources/fixed_price_promotions.d.ts +8 -8
  25. package/lib/cjs/resources/fixed_price_promotions.js +4 -4
  26. package/lib/cjs/resources/free_gift_promotions.d.ts +8 -8
  27. package/lib/cjs/resources/free_gift_promotions.js +4 -4
  28. package/lib/cjs/resources/free_shipping_promotions.d.ts +3 -0
  29. package/lib/cjs/resources/free_shipping_promotions.js +4 -0
  30. package/lib/cjs/resources/imports.d.ts +0 -3
  31. package/lib/cjs/resources/inventory_models.d.ts +3 -0
  32. package/lib/cjs/resources/line_items.d.ts +5 -0
  33. package/lib/cjs/resources/line_items.js +4 -0
  34. package/lib/cjs/resources/order_amount_promotion_rules.d.ts +3 -0
  35. package/lib/cjs/resources/orders.d.ts +4 -4
  36. package/lib/cjs/resources/parcel_line_items.d.ts +1 -1
  37. package/lib/cjs/resources/parcels.d.ts +3 -3
  38. package/lib/cjs/resources/percentage_discount_promotions.d.ts +8 -8
  39. package/lib/cjs/resources/percentage_discount_promotions.js +4 -4
  40. package/lib/cjs/resources/promotions.d.ts +3 -0
  41. package/lib/cjs/resources/promotions.js +4 -0
  42. package/lib/cjs/resources/refunds.d.ts +3 -0
  43. package/lib/cjs/resources/refunds.js +4 -0
  44. package/lib/cjs/resources/reserved_stocks.d.ts +28 -0
  45. package/lib/cjs/resources/reserved_stocks.js +28 -0
  46. package/lib/cjs/resources/return_line_items.d.ts +2 -1
  47. package/lib/cjs/resources/satispay_payments.d.ts +7 -0
  48. package/lib/cjs/resources/shipping_methods.d.ts +6 -0
  49. package/lib/cjs/resources/skus.d.ts +3 -0
  50. package/lib/cjs/resources/skus.js +4 -0
  51. package/lib/cjs/resources/stock_items.d.ts +6 -0
  52. package/lib/cjs/resources/stock_items.js +8 -0
  53. package/lib/cjs/resources/stock_line_items.d.ts +3 -0
  54. package/lib/cjs/resources/stock_line_items.js +4 -0
  55. package/lib/cjs/resources/stock_reservations.d.ts +36 -0
  56. package/lib/cjs/resources/stock_reservations.js +36 -0
  57. package/lib/cjs/resources/stripe_payments.d.ts +1 -0
  58. package/lib/cjs/resources/transactions.d.ts +5 -2
  59. package/lib/cjs/resources/transactions.js +4 -0
  60. package/lib/cjs/resources/voids.d.ts +3 -0
  61. package/lib/cjs/resources/voids.js +4 -0
  62. package/lib/cjs/util.d.ts +0 -4
  63. package/lib/esm/api.d.ts +4 -2
  64. package/lib/esm/api.js +4 -0
  65. package/lib/esm/client.d.ts +5 -1
  66. package/lib/esm/client.js +22 -3
  67. package/lib/esm/commercelayer.d.ts +4 -2
  68. package/lib/esm/commercelayer.js +3 -1
  69. package/lib/esm/error.d.ts +1 -0
  70. package/lib/esm/interceptor.d.ts +1 -1
  71. package/lib/esm/jsonapi.js +4 -1
  72. package/lib/esm/model.d.ts +2 -0
  73. package/lib/esm/resources/authorizations.d.ts +3 -0
  74. package/lib/esm/resources/authorizations.js +4 -0
  75. package/lib/esm/resources/captures.d.ts +3 -0
  76. package/lib/esm/resources/captures.js +4 -0
  77. package/lib/esm/resources/coupons.d.ts +8 -0
  78. package/lib/esm/resources/coupons.js +4 -0
  79. package/lib/esm/resources/customer_addresses.d.ts +2 -0
  80. package/lib/esm/resources/customers.d.ts +1 -0
  81. package/lib/esm/resources/external_promotions.d.ts +3 -0
  82. package/lib/esm/resources/external_promotions.js +4 -0
  83. package/lib/esm/resources/fixed_amount_promotions.d.ts +3 -0
  84. package/lib/esm/resources/fixed_amount_promotions.js +4 -0
  85. package/lib/esm/resources/fixed_price_promotions.d.ts +8 -8
  86. package/lib/esm/resources/fixed_price_promotions.js +4 -4
  87. package/lib/esm/resources/free_gift_promotions.d.ts +8 -8
  88. package/lib/esm/resources/free_gift_promotions.js +4 -4
  89. package/lib/esm/resources/free_shipping_promotions.d.ts +3 -0
  90. package/lib/esm/resources/free_shipping_promotions.js +4 -0
  91. package/lib/esm/resources/imports.d.ts +0 -3
  92. package/lib/esm/resources/inventory_models.d.ts +3 -0
  93. package/lib/esm/resources/line_items.d.ts +5 -0
  94. package/lib/esm/resources/line_items.js +4 -0
  95. package/lib/esm/resources/order_amount_promotion_rules.d.ts +3 -0
  96. package/lib/esm/resources/orders.d.ts +4 -4
  97. package/lib/esm/resources/parcel_line_items.d.ts +1 -1
  98. package/lib/esm/resources/parcels.d.ts +3 -3
  99. package/lib/esm/resources/percentage_discount_promotions.d.ts +8 -8
  100. package/lib/esm/resources/percentage_discount_promotions.js +4 -4
  101. package/lib/esm/resources/promotions.d.ts +3 -0
  102. package/lib/esm/resources/promotions.js +4 -0
  103. package/lib/esm/resources/refunds.d.ts +3 -0
  104. package/lib/esm/resources/refunds.js +4 -0
  105. package/lib/esm/resources/reserved_stocks.d.ts +28 -0
  106. package/lib/esm/resources/reserved_stocks.js +26 -0
  107. package/lib/esm/resources/return_line_items.d.ts +2 -1
  108. package/lib/esm/resources/satispay_payments.d.ts +7 -0
  109. package/lib/esm/resources/shipping_methods.d.ts +6 -0
  110. package/lib/esm/resources/skus.d.ts +3 -0
  111. package/lib/esm/resources/skus.js +4 -0
  112. package/lib/esm/resources/stock_items.d.ts +6 -0
  113. package/lib/esm/resources/stock_items.js +8 -0
  114. package/lib/esm/resources/stock_line_items.d.ts +3 -0
  115. package/lib/esm/resources/stock_line_items.js +4 -0
  116. package/lib/esm/resources/stock_reservations.d.ts +36 -0
  117. package/lib/esm/resources/stock_reservations.js +34 -0
  118. package/lib/esm/resources/stripe_payments.d.ts +1 -0
  119. package/lib/esm/resources/transactions.d.ts +5 -2
  120. package/lib/esm/resources/transactions.js +4 -0
  121. package/lib/esm/resources/voids.d.ts +3 -0
  122. package/lib/esm/resources/voids.js +4 -0
  123. package/lib/esm/util.d.ts +0 -4
  124. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  125. package/lib/tsconfig.tsbuildinfo +1 -1
  126. package/package.json +8 -8
package/lib/cjs/api.d.ts CHANGED
@@ -84,6 +84,7 @@ export { default as PromotionRules } from './resources/promotion_rules';
84
84
  export { default as Promotions } from './resources/promotions';
85
85
  export { default as RecurringOrderCopies } from './resources/recurring_order_copies';
86
86
  export { default as Refunds } from './resources/refunds';
87
+ export { default as ReservedStocks } from './resources/reserved_stocks';
87
88
  export { default as ReturnLineItems } from './resources/return_line_items';
88
89
  export { default as Returns } from './resources/returns';
89
90
  export { default as SatispayGateways } from './resources/satispay_gateways';
@@ -102,6 +103,7 @@ export { default as Skus } from './resources/skus';
102
103
  export { default as StockItems } from './resources/stock_items';
103
104
  export { default as StockLineItems } from './resources/stock_line_items';
104
105
  export { default as StockLocations } from './resources/stock_locations';
106
+ export { default as StockReservations } from './resources/stock_reservations';
105
107
  export { default as StockTransfers } from './resources/stock_transfers';
106
108
  export { default as StripeGateways } from './resources/stripe_gateways';
107
109
  export { default as StripePayments } from './resources/stripe_payments';
@@ -115,8 +117,8 @@ export { default as Transactions } from './resources/transactions';
115
117
  export { default as Voids } from './resources/voids';
116
118
  export { default as Webhooks } from './resources/webhooks';
117
119
  export { default as WireTransfers } from './resources/wire_transfers';
118
- export type ResourceTypeLock = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'application' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'event_callbacks' | 'events' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'geocoders' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_factories' | 'order_subscription_items' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'organization' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_tiers' | 'price_volume_tiers' | 'prices' | 'promotion_rules' | 'promotions' | 'recurring_order_copies' | 'refunds' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_method_tiers' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'voids' | 'webhooks' | 'wire_transfers';
119
- export declare const resourceList: readonly ["addresses", "adjustments", "adyen_gateways", "adyen_payments", "application", "attachments", "authorizations", "avalara_accounts", "axerve_gateways", "axerve_payments", "billing_info_validation_rules", "bing_geocoders", "braintree_gateways", "braintree_payments", "bundles", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "cleanups", "coupon_codes_promotion_rules", "coupon_recipients", "coupons", "customer_addresses", "customer_groups", "customer_password_resets", "customer_payment_sources", "customer_subscriptions", "customers", "delivery_lead_times", "event_callbacks", "events", "exports", "external_gateways", "external_payments", "external_promotions", "external_tax_calculators", "fixed_amount_promotions", "fixed_price_promotions", "free_gift_promotions", "free_shipping_promotions", "geocoders", "gift_card_recipients", "gift_cards", "google_geocoders", "imports", "in_stock_subscriptions", "inventory_models", "inventory_return_locations", "inventory_stock_locations", "klarna_gateways", "klarna_payments", "line_item_options", "line_items", "manual_gateways", "manual_tax_calculators", "markets", "merchants", "order_amount_promotion_rules", "order_copies", "order_factories", "order_subscription_items", "order_subscriptions", "order_validation_rules", "orders", "organization", "packages", "parcel_line_items", "parcels", "payment_gateways", "payment_methods", "paypal_gateways", "paypal_payments", "percentage_discount_promotions", "price_frequency_tiers", "price_lists", "price_tiers", "price_volume_tiers", "prices", "promotion_rules", "promotions", "recurring_order_copies", "refunds", "return_line_items", "returns", "satispay_gateways", "satispay_payments", "shipments", "shipping_categories", "shipping_method_tiers", "shipping_methods", "shipping_weight_tiers", "shipping_zones", "sku_list_items", "sku_list_promotion_rules", "sku_lists", "sku_options", "skus", "stock_items", "stock_line_items", "stock_locations", "stock_transfers", "stripe_gateways", "stripe_payments", "subscription_models", "tags", "tax_calculators", "tax_categories", "tax_rules", "taxjar_accounts", "transactions", "voids", "webhooks", "wire_transfers"];
120
+ export type ResourceTypeLock = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'application' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'event_callbacks' | 'events' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'geocoders' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_factories' | 'order_subscription_items' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'organization' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_tiers' | 'price_volume_tiers' | 'prices' | 'promotion_rules' | 'promotions' | 'recurring_order_copies' | 'refunds' | 'reserved_stocks' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_method_tiers' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'voids' | 'webhooks' | 'wire_transfers';
121
+ export declare const resourceList: readonly ["addresses", "adjustments", "adyen_gateways", "adyen_payments", "application", "attachments", "authorizations", "avalara_accounts", "axerve_gateways", "axerve_payments", "billing_info_validation_rules", "bing_geocoders", "braintree_gateways", "braintree_payments", "bundles", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "cleanups", "coupon_codes_promotion_rules", "coupon_recipients", "coupons", "customer_addresses", "customer_groups", "customer_password_resets", "customer_payment_sources", "customer_subscriptions", "customers", "delivery_lead_times", "event_callbacks", "events", "exports", "external_gateways", "external_payments", "external_promotions", "external_tax_calculators", "fixed_amount_promotions", "fixed_price_promotions", "free_gift_promotions", "free_shipping_promotions", "geocoders", "gift_card_recipients", "gift_cards", "google_geocoders", "imports", "in_stock_subscriptions", "inventory_models", "inventory_return_locations", "inventory_stock_locations", "klarna_gateways", "klarna_payments", "line_item_options", "line_items", "manual_gateways", "manual_tax_calculators", "markets", "merchants", "order_amount_promotion_rules", "order_copies", "order_factories", "order_subscription_items", "order_subscriptions", "order_validation_rules", "orders", "organization", "packages", "parcel_line_items", "parcels", "payment_gateways", "payment_methods", "paypal_gateways", "paypal_payments", "percentage_discount_promotions", "price_frequency_tiers", "price_lists", "price_tiers", "price_volume_tiers", "prices", "promotion_rules", "promotions", "recurring_order_copies", "refunds", "reserved_stocks", "return_line_items", "returns", "satispay_gateways", "satispay_payments", "shipments", "shipping_categories", "shipping_method_tiers", "shipping_methods", "shipping_weight_tiers", "shipping_zones", "sku_list_items", "sku_list_promotion_rules", "sku_lists", "sku_options", "skus", "stock_items", "stock_line_items", "stock_locations", "stock_reservations", "stock_transfers", "stripe_gateways", "stripe_payments", "subscription_models", "tags", "tax_calculators", "tax_categories", "tax_rules", "taxjar_accounts", "transactions", "voids", "webhooks", "wire_transfers"];
120
122
  export type RetrievableResourceType = ResourceTypeLock;
121
123
  export type RetrievableResource = {
122
124
  type: RetrievableResourceType;
package/lib/cjs/api.js CHANGED
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.InventoryStockLocations = exports.InventoryReturnLocations = exports.InventoryModels = exports.InStockSubscriptions = exports.Imports = exports.GoogleGeocoders = exports.GiftCards = exports.GiftCardRecipients = exports.Geocoders = exports.FreeShippingPromotions = exports.FreeGiftPromotions = exports.FixedPricePromotions = exports.FixedAmountPromotions = exports.ExternalTaxCalculators = exports.ExternalPromotions = exports.ExternalPayments = exports.ExternalGateways = exports.Exports = exports.Events = exports.EventCallbacks = exports.DeliveryLeadTimes = exports.Customers = exports.CustomerSubscriptions = exports.CustomerPaymentSources = exports.CustomerPasswordResets = exports.CustomerGroups = exports.CustomerAddresses = exports.Coupons = exports.CouponRecipients = exports.CouponCodesPromotionRules = exports.Cleanups = exports.CheckoutComPayments = exports.CheckoutComGateways = exports.CarrierAccounts = exports.Captures = exports.Bundles = exports.BraintreePayments = exports.BraintreeGateways = exports.BingGeocoders = exports.BillingInfoValidationRules = exports.AxervePayments = exports.AxerveGateways = exports.AvalaraAccounts = exports.Authorizations = exports.Attachments = exports.Applications = exports.AdyenPayments = exports.AdyenGateways = exports.Adjustments = exports.Addresses = void 0;
7
- exports.StockLineItems = exports.StockItems = exports.Skus = exports.SkuOptions = exports.SkuLists = exports.SkuListPromotionRules = exports.SkuListItems = exports.ShippingZones = exports.ShippingWeightTiers = exports.ShippingMethods = exports.ShippingMethodTiers = exports.ShippingCategories = exports.Shipments = exports.SatispayPayments = exports.SatispayGateways = exports.Returns = exports.ReturnLineItems = exports.Refunds = exports.RecurringOrderCopies = exports.Promotions = exports.PromotionRules = exports.Prices = exports.PriceVolumeTiers = exports.PriceTiers = exports.PriceLists = exports.PriceFrequencyTiers = exports.PercentageDiscountPromotions = exports.PaypalPayments = exports.PaypalGateways = exports.PaymentMethods = exports.PaymentGateways = exports.Parcels = exports.ParcelLineItems = exports.Packages = exports.Organizations = exports.Orders = exports.OrderValidationRules = exports.OrderSubscriptions = exports.OrderSubscriptionItems = exports.OrderFactories = exports.OrderCopies = exports.OrderAmountPromotionRules = exports.Merchants = exports.Markets = exports.ManualTaxCalculators = exports.ManualGateways = exports.LineItems = exports.LineItemOptions = exports.KlarnaPayments = exports.KlarnaGateways = void 0;
8
- exports.resourceList = exports.WireTransfers = exports.Webhooks = exports.Voids = exports.Transactions = exports.TaxjarAccounts = exports.TaxRules = exports.TaxCategories = exports.TaxCalculators = exports.Tags = exports.SubscriptionModels = exports.StripePayments = exports.StripeGateways = exports.StockTransfers = exports.StockLocations = void 0;
7
+ exports.StockItems = exports.Skus = exports.SkuOptions = exports.SkuLists = exports.SkuListPromotionRules = exports.SkuListItems = exports.ShippingZones = exports.ShippingWeightTiers = exports.ShippingMethods = exports.ShippingMethodTiers = exports.ShippingCategories = exports.Shipments = exports.SatispayPayments = exports.SatispayGateways = exports.Returns = exports.ReturnLineItems = exports.ReservedStocks = exports.Refunds = exports.RecurringOrderCopies = exports.Promotions = exports.PromotionRules = exports.Prices = exports.PriceVolumeTiers = exports.PriceTiers = exports.PriceLists = exports.PriceFrequencyTiers = exports.PercentageDiscountPromotions = exports.PaypalPayments = exports.PaypalGateways = exports.PaymentMethods = exports.PaymentGateways = exports.Parcels = exports.ParcelLineItems = exports.Packages = exports.Organizations = exports.Orders = exports.OrderValidationRules = exports.OrderSubscriptions = exports.OrderSubscriptionItems = exports.OrderFactories = exports.OrderCopies = exports.OrderAmountPromotionRules = exports.Merchants = exports.Markets = exports.ManualTaxCalculators = exports.ManualGateways = exports.LineItems = exports.LineItemOptions = exports.KlarnaPayments = exports.KlarnaGateways = void 0;
8
+ exports.resourceList = exports.WireTransfers = exports.Webhooks = exports.Voids = exports.Transactions = exports.TaxjarAccounts = exports.TaxRules = exports.TaxCategories = exports.TaxCalculators = exports.Tags = exports.SubscriptionModels = exports.StripePayments = exports.StripeGateways = exports.StockTransfers = exports.StockReservations = exports.StockLocations = exports.StockLineItems = void 0;
9
9
  // ##__API_RESOURCES_START__##
10
10
  // ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##'
11
11
  /**
@@ -177,6 +177,8 @@ var recurring_order_copies_1 = require("./resources/recurring_order_copies");
177
177
  Object.defineProperty(exports, "RecurringOrderCopies", { enumerable: true, get: function () { return __importDefault(recurring_order_copies_1).default; } });
178
178
  var refunds_1 = require("./resources/refunds");
179
179
  Object.defineProperty(exports, "Refunds", { enumerable: true, get: function () { return __importDefault(refunds_1).default; } });
180
+ var reserved_stocks_1 = require("./resources/reserved_stocks");
181
+ Object.defineProperty(exports, "ReservedStocks", { enumerable: true, get: function () { return __importDefault(reserved_stocks_1).default; } });
180
182
  var return_line_items_1 = require("./resources/return_line_items");
181
183
  Object.defineProperty(exports, "ReturnLineItems", { enumerable: true, get: function () { return __importDefault(return_line_items_1).default; } });
182
184
  var returns_1 = require("./resources/returns");
@@ -213,6 +215,8 @@ var stock_line_items_1 = require("./resources/stock_line_items");
213
215
  Object.defineProperty(exports, "StockLineItems", { enumerable: true, get: function () { return __importDefault(stock_line_items_1).default; } });
214
216
  var stock_locations_1 = require("./resources/stock_locations");
215
217
  Object.defineProperty(exports, "StockLocations", { enumerable: true, get: function () { return __importDefault(stock_locations_1).default; } });
218
+ var stock_reservations_1 = require("./resources/stock_reservations");
219
+ Object.defineProperty(exports, "StockReservations", { enumerable: true, get: function () { return __importDefault(stock_reservations_1).default; } });
216
220
  var stock_transfers_1 = require("./resources/stock_transfers");
217
221
  Object.defineProperty(exports, "StockTransfers", { enumerable: true, get: function () { return __importDefault(stock_transfers_1).default; } });
218
222
  var stripe_gateways_1 = require("./resources/stripe_gateways");
@@ -325,6 +329,7 @@ exports.resourceList = [
325
329
  'promotions',
326
330
  'recurring_order_copies',
327
331
  'refunds',
332
+ 'reserved_stocks',
328
333
  'return_line_items',
329
334
  'returns',
330
335
  'satispay_gateways',
@@ -343,6 +348,7 @@ exports.resourceList = [
343
348
  'stock_items',
344
349
  'stock_line_items',
345
350
  'stock_locations',
351
+ 'stock_reservations',
346
352
  'stock_transfers',
347
353
  'stripe_gateways',
348
354
  'stripe_payments',
@@ -5,12 +5,15 @@ import type { InterceptorManager } from './interceptor';
5
5
  import type { Agent as HttpAgent } from 'http';
6
6
  import type { Agent as HttpsAgent } from 'https';
7
7
  type ProxyConfig = AxiosProxyConfig | false;
8
+ type RequestParams = Record<string, string | number | boolean>;
9
+ type RequestHeaders = Record<string, string>;
8
10
  type RequestConfig = {
9
11
  timeout?: number;
10
- params?: Record<string, string | number | boolean>;
12
+ params?: RequestParams;
11
13
  httpAgent?: HttpAgent;
12
14
  httpsAgent?: HttpsAgent;
13
15
  proxy?: ProxyConfig;
16
+ headers?: RequestHeaders;
14
17
  };
15
18
  type ApiClientInitConfig = {
16
19
  organization: string;
@@ -26,6 +29,7 @@ declare class ApiClient {
26
29
  private constructor();
27
30
  config(config: ApiClientConfig): void;
28
31
  request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
32
+ private customHeaders;
29
33
  }
30
34
  export default ApiClient;
31
35
  export type { ApiClientInitConfig, ApiClientConfig, RequestConfig };
package/lib/cjs/client.js CHANGED
@@ -31,8 +31,11 @@ const handleError = (error) => {
31
31
  const apiError = new error_1.ApiError(sdkError);
32
32
  apiError.type = error_1.ErrorType.RESPONSE;
33
33
  apiError.status = error.response.status;
34
+ apiError.statusText = error.response.statusText;
34
35
  apiError.code = String(apiError.status);
35
36
  apiError.errors = error.response.data.errors;
37
+ if (!apiError.message && apiError.statusText)
38
+ apiError.message = apiError.statusText;
36
39
  sdkError = apiError;
37
40
  }
38
41
  else if (error.request) {
@@ -71,13 +74,16 @@ class ApiClient {
71
74
  httpAgent: options.httpAgent,
72
75
  httpsAgent: options.httpsAgent,
73
76
  };
77
+ // Set custom headers
78
+ const customHeaders = this.customHeaders(options.headers);
74
79
  const axiosOptions = {
75
80
  baseURL: this.baseUrl,
76
81
  timeout: config_1.default.client.timeout,
77
82
  headers: {
83
+ ...customHeaders,
78
84
  'Accept': 'application/vnd.api+json',
79
85
  'Content-Type': 'application/vnd.api+json',
80
- 'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f"),
86
+ 'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
81
87
  },
82
88
  ...axiosConfig
83
89
  };
@@ -104,6 +110,8 @@ class ApiClient {
104
110
  __classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
105
111
  def.headers.common.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
106
112
  }
113
+ if (config.headers)
114
+ def.headers.common = this.customHeaders(config.headers);
107
115
  }
108
116
  async request(method, path, body, options) {
109
117
  debug('request %s %s, %O, %O', method, path, body || {}, options || {});
@@ -112,8 +120,10 @@ class ApiClient {
112
120
  // Runtime request parameters
113
121
  const baseUrl = (options === null || options === void 0 ? void 0 : options.organization) ? baseURL(options.organization, options.domain) : undefined;
114
122
  const accessToken = (options === null || options === void 0 ? void 0 : options.accessToken) || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
115
- const headers = accessToken ? { 'Authorization': 'Bearer ' + accessToken } : undefined;
116
- const requestParams = { method, baseURL: baseUrl, url, data, headers, ...options };
123
+ const headers = this.customHeaders(options === null || options === void 0 ? void 0 : options.headers);
124
+ if (accessToken)
125
+ headers.Authorization = 'Bearer ' + accessToken;
126
+ const requestParams = { method, baseURL: baseUrl, url, data, ...options, headers };
117
127
  debug('request params: %O', requestParams);
118
128
  // const start = Date.now()
119
129
  return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
@@ -121,6 +131,15 @@ class ApiClient {
121
131
  .catch(error => handleError(error));
122
132
  // .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
123
133
  }
134
+ customHeaders(headers) {
135
+ const customHeaders = {};
136
+ if (headers) {
137
+ for (const [name, value] of Object.entries(headers))
138
+ if (!['accept', 'content-type', 'authorization'].includes(name.toLowerCase()))
139
+ customHeaders[name] = value;
140
+ }
141
+ return customHeaders;
142
+ }
124
143
  }
125
144
  _ApiClient_accessToken = new WeakMap(), _ApiClient_client = new WeakMap();
126
145
  exports.default = ApiClient;
@@ -2,7 +2,7 @@ import * as api from './api';
2
2
  import type { ApiError } from './error';
3
3
  import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
4
4
  import { type ResourcesInitConfig } from './resource';
5
- declare const OPEN_API_SCHEMA_VERSION = "4.2.4";
5
+ declare const OPEN_API_SCHEMA_VERSION = "4.10.0";
6
6
  export { OPEN_API_SCHEMA_VERSION };
7
7
  type SdkConfig = Record<string, unknown>;
8
8
  type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
@@ -10,7 +10,7 @@ type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
10
10
  declare class CommerceLayerClient {
11
11
  #private;
12
12
  static get openApiSchemaVersion(): string;
13
- readonly openApiSchemaVersion = "4.2.4";
13
+ readonly openApiSchemaVersion = "4.10.0";
14
14
  addresses: api.Addresses;
15
15
  adjustments: api.Adjustments;
16
16
  adyen_gateways: api.AdyenGateways;
@@ -94,6 +94,7 @@ declare class CommerceLayerClient {
94
94
  promotions: api.Promotions;
95
95
  recurring_order_copies: api.RecurringOrderCopies;
96
96
  refunds: api.Refunds;
97
+ reserved_stocks: api.ReservedStocks;
97
98
  return_line_items: api.ReturnLineItems;
98
99
  returns: api.Returns;
99
100
  satispay_gateways: api.SatispayGateways;
@@ -112,6 +113,7 @@ declare class CommerceLayerClient {
112
113
  stock_items: api.StockItems;
113
114
  stock_line_items: api.StockLineItems;
114
115
  stock_locations: api.StockLocations;
116
+ stock_reservations: api.StockReservations;
115
117
  stock_transfers: api.StockTransfers;
116
118
  stripe_gateways: api.StripeGateways;
117
119
  stripe_payments: api.StripePayments;
@@ -45,7 +45,7 @@ const resource_1 = __importDefault(require("./resource"));
45
45
  const debug_1 = __importDefault(require("./debug"));
46
46
  const debug = (0, debug_1.default)('commercelayer');
47
47
  // Autogenerated schema version number, do not remove this line
48
- const OPEN_API_SCHEMA_VERSION = '4.2.4';
48
+ const OPEN_API_SCHEMA_VERSION = '4.10.0';
49
49
  exports.OPEN_API_SCHEMA_VERSION = OPEN_API_SCHEMA_VERSION;
50
50
  class CommerceLayerClient {
51
51
  static get openApiSchemaVersion() { return OPEN_API_SCHEMA_VERSION; }
@@ -142,6 +142,7 @@ class CommerceLayerClient {
142
142
  this.promotions = new api.Promotions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
143
143
  this.recurring_order_copies = new api.RecurringOrderCopies(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
144
144
  this.refunds = new api.Refunds(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
145
+ this.reserved_stocks = new api.ReservedStocks(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
145
146
  this.return_line_items = new api.ReturnLineItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
146
147
  this.returns = new api.Returns(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
147
148
  this.satispay_gateways = new api.SatispayGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
@@ -160,6 +161,7 @@ class CommerceLayerClient {
160
161
  this.stock_items = new api.StockItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
161
162
  this.stock_line_items = new api.StockLineItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
162
163
  this.stock_locations = new api.StockLocations(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
164
+ this.stock_reservations = new api.StockReservations(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
163
165
  this.stock_transfers = new api.StockTransfers(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
164
166
  this.stripe_gateways = new api.StripeGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
165
167
  this.stripe_payments = new api.StripePayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
@@ -22,6 +22,7 @@ declare class ApiError extends SdkError {
22
22
  static isApiError(error: any): error is ApiError;
23
23
  errors: any[];
24
24
  status?: number;
25
+ statusText?: string;
25
26
  constructor(error: SdkError);
26
27
  first(): any;
27
28
  }
package/lib/cjs/error.js CHANGED
@@ -8,8 +8,7 @@ var ErrorType;
8
8
  ErrorType["RESPONSE"] = "response";
9
9
  ErrorType["GENERIC"] = "generic";
10
10
  ErrorType["CANCEL"] = "cancel";
11
- })(ErrorType || (ErrorType = {}));
12
- exports.ErrorType = ErrorType;
11
+ })(ErrorType || (exports.ErrorType = ErrorType = {}));
13
12
  class SdkError extends Error {
14
13
  static isSdkError(error) {
15
14
  return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
@@ -7,7 +7,7 @@ type RequestObj = AxiosRequestConfig;
7
7
  type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
8
8
  type ResponseObj = AxiosResponse;
9
9
  type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
10
- type ApiHeadersList = 'x-ratelimit-limit' | 'x-ratelimit-count' | 'x-ratelimit-period';
10
+ type ApiHeadersList = 'x-ratelimit-limit' | 'x-ratelimit-count' | 'x-ratelimit-period' | 'x-ratelimit-interval' | 'x-ratelimit-remaining';
11
11
  type ApiHeaders = {
12
12
  [key in ApiHeadersList]: string | number | boolean;
13
13
  };
@@ -64,7 +64,10 @@ const normalize = (resource) => {
64
64
  if (['type', 'id'].includes(field))
65
65
  continue;
66
66
  const value = resource[field];
67
- if (value && (0, common_1.isResourceType)(value) && value.id === null) {
67
+ if (Array.isArray(value) && (value.length === 1) && (0, common_1.isResourceType)(value[0]) && (value[0].id === null)) {
68
+ relationships[field] = { data: [] };
69
+ }
70
+ else if (value && (0, common_1.isResourceType)(value) && (value.id === null)) {
68
71
  relationships[field] = { data: null };
69
72
  }
70
73
  else if (value && ((0, common_1.isResourceId)(value) || (Array.isArray(value) && (0, common_1.isResourceId)(value[0])))) {
@@ -84,6 +84,7 @@ export type { PromotionRule } from './resources/promotion_rules';
84
84
  export type { Promotion } from './resources/promotions';
85
85
  export type { RecurringOrderCopy, RecurringOrderCopyCreate, RecurringOrderCopyUpdate } from './resources/recurring_order_copies';
86
86
  export type { Refund } from './resources/refunds';
87
+ export type { ReservedStock } from './resources/reserved_stocks';
87
88
  export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items';
88
89
  export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns';
89
90
  export type { SatispayGateway, SatispayGatewayCreate, SatispayGatewayUpdate } from './resources/satispay_gateways';
@@ -102,6 +103,7 @@ export type { Sku, SkuCreate, SkuUpdate } from './resources/skus';
102
103
  export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items';
103
104
  export type { StockLineItem } from './resources/stock_line_items';
104
105
  export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations';
106
+ export type { StockReservation } from './resources/stock_reservations';
105
107
  export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers';
106
108
  export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways';
107
109
  export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments';
@@ -2,6 +2,7 @@ import { ApiResource } from '../resource';
2
2
  import type { Resource, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
+ import type { Attachment } from './attachments';
5
6
  import type { Capture } from './captures';
6
7
  import type { Void } from './voids';
7
8
  import type { Event } from './events';
@@ -37,6 +38,7 @@ interface Authorization extends Resource {
37
38
  void_balance_float?: number | null;
38
39
  formatted_void_balance?: string | null;
39
40
  order?: Order | null;
41
+ attachments?: Attachment[] | null;
40
42
  captures?: Capture[] | null;
41
43
  voids?: Void[] | null;
42
44
  events?: Event[] | null;
@@ -50,6 +52,7 @@ declare class Authorizations extends ApiResource<Authorization> {
50
52
  static readonly TYPE: AuthorizationType;
51
53
  update(resource: AuthorizationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
52
54
  order(authorizationId: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
55
+ attachments(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
53
56
  captures(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Capture>>;
54
57
  voids(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Void>>;
55
58
  events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
@@ -9,6 +9,10 @@ class Authorizations extends resource_1.ApiResource {
9
9
  const _authorizationId = authorizationId.id || authorizationId;
10
10
  return this.resources.fetch({ type: 'orders' }, `authorizations/${_authorizationId}/order`, params, options);
11
11
  }
12
+ async attachments(authorizationId, params, options) {
13
+ const _authorizationId = authorizationId.id || authorizationId;
14
+ return this.resources.fetch({ type: 'attachments' }, `authorizations/${_authorizationId}/attachments`, params, options);
15
+ }
12
16
  async captures(authorizationId, params, options) {
13
17
  const _authorizationId = authorizationId.id || authorizationId;
14
18
  return this.resources.fetch({ type: 'captures' }, `authorizations/${_authorizationId}/captures`, params, options);
@@ -2,6 +2,7 @@ import { ApiResource } from '../resource';
2
2
  import type { Resource, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
+ import type { Attachment } from './attachments';
5
6
  import type { Authorization } from './authorizations';
6
7
  import type { Refund } from './refunds';
7
8
  import type { Event } from './events';
@@ -29,6 +30,7 @@ interface Capture extends Resource {
29
30
  refund_balance_float?: number | null;
30
31
  formatted_refund_balance?: string | null;
31
32
  order?: Order | null;
33
+ attachments?: Attachment[] | null;
32
34
  reference_authorization?: Authorization | null;
33
35
  refunds?: Refund[] | null;
34
36
  events?: Event[] | null;
@@ -41,6 +43,7 @@ declare class Captures extends ApiResource<Capture> {
41
43
  static readonly TYPE: CaptureType;
42
44
  update(resource: CaptureUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
43
45
  order(captureId: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
46
+ attachments(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
44
47
  reference_authorization(captureId: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
45
48
  refunds(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Refund>>;
46
49
  events(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
@@ -9,6 +9,10 @@ class Captures extends resource_1.ApiResource {
9
9
  const _captureId = captureId.id || captureId;
10
10
  return this.resources.fetch({ type: 'orders' }, `captures/${_captureId}/order`, params, options);
11
11
  }
12
+ async attachments(captureId, params, options) {
13
+ const _captureId = captureId.id || captureId;
14
+ return this.resources.fetch({ type: 'attachments' }, `captures/${_captureId}/attachments`, params, options);
15
+ }
12
16
  async reference_authorization(captureId, params, options) {
13
17
  const _captureId = captureId.id || captureId;
14
18
  return this.resources.fetch({ type: 'authorizations' }, `captures/${_captureId}/reference_authorization`, params, options);
@@ -2,6 +2,7 @@ import { ApiResource } from '../resource';
2
2
  import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
5
+ import type { CouponRecipient, CouponRecipientType } from './coupon_recipients';
5
6
  import type { Event } from './events';
6
7
  import type { Tag, TagType } from './tags';
7
8
  type CouponType = 'coupons';
@@ -11,6 +12,9 @@ type CouponRel = ResourceRel & {
11
12
  type CouponCodesPromotionRuleRel = ResourceRel & {
12
13
  type: CouponCodesPromotionRuleType;
13
14
  };
15
+ type CouponRecipientRel = ResourceRel & {
16
+ type: CouponRecipientType;
17
+ };
14
18
  type TagRel = ResourceRel & {
15
19
  type: TagType;
16
20
  };
@@ -22,6 +26,7 @@ interface Coupon extends Resource {
22
26
  usage_count?: number | null;
23
27
  recipient_email?: string | null;
24
28
  promotion_rule?: CouponCodesPromotionRule | null;
29
+ coupon_recipient?: CouponRecipient | null;
25
30
  events?: Event[] | null;
26
31
  tags?: Tag[] | null;
27
32
  }
@@ -31,6 +36,7 @@ interface CouponCreate extends ResourceCreate {
31
36
  usage_limit?: number | null;
32
37
  recipient_email?: string | null;
33
38
  promotion_rule: CouponCodesPromotionRuleRel;
39
+ coupon_recipient?: CouponRecipientRel | null;
34
40
  tags?: TagRel[] | null;
35
41
  }
36
42
  interface CouponUpdate extends ResourceUpdate {
@@ -39,6 +45,7 @@ interface CouponUpdate extends ResourceUpdate {
39
45
  usage_limit?: number | null;
40
46
  recipient_email?: string | null;
41
47
  promotion_rule?: CouponCodesPromotionRuleRel | null;
48
+ coupon_recipient?: CouponRecipientRel | null;
42
49
  tags?: TagRel[] | null;
43
50
  }
44
51
  declare class Coupons extends ApiResource<Coupon> {
@@ -47,6 +54,7 @@ declare class Coupons extends ApiResource<Coupon> {
47
54
  update(resource: CouponUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Coupon>;
48
55
  delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
49
56
  promotion_rule(couponId: string | Coupon, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
57
+ coupon_recipient(couponId: string | Coupon, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponRecipient>;
50
58
  events(couponId: string | Coupon, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
51
59
  tags(couponId: string | Coupon, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
52
60
  isCoupon(resource: any): resource is Coupon;
@@ -15,6 +15,10 @@ class Coupons extends resource_1.ApiResource {
15
15
  const _couponId = couponId.id || couponId;
16
16
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `coupons/${_couponId}/promotion_rule`, params, options);
17
17
  }
18
+ async coupon_recipient(couponId, params, options) {
19
+ const _couponId = couponId.id || couponId;
20
+ return this.resources.fetch({ type: 'coupon_recipients' }, `coupons/${_couponId}/coupon_recipient`, params, options);
21
+ }
18
22
  async events(couponId, params, options) {
19
23
  const _couponId = couponId.id || couponId;
20
24
  return this.resources.fetch({ type: 'events' }, `coupons/${_couponId}/events`, params, options);
@@ -17,11 +17,13 @@ type AddressRel = ResourceRel & {
17
17
  interface CustomerAddress extends Resource {
18
18
  readonly type: CustomerAddressType;
19
19
  name?: string | null;
20
+ customer_email: string;
20
21
  customer?: Customer | null;
21
22
  address?: Address | null;
22
23
  events?: Event[] | null;
23
24
  }
24
25
  interface CustomerAddressCreate extends ResourceCreate {
26
+ customer_email: string;
25
27
  customer: CustomerRel;
26
28
  address: AddressRel;
27
29
  }
@@ -27,6 +27,7 @@ interface Customer extends Resource {
27
27
  email: string;
28
28
  status: 'prospect' | 'acquired' | 'repeat';
29
29
  has_password?: boolean | null;
30
+ total_orders_count?: number | null;
30
31
  customer_group?: CustomerGroup | null;
31
32
  customer_addresses?: CustomerAddress[] | null;
32
33
  customer_payment_sources?: CustomerPaymentSource[] | null;
@@ -6,6 +6,7 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
6
6
  import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
7
7
  import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
8
8
  import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
9
+ import type { SkuList } from './sku_lists';
9
10
  import type { Attachment } from './attachments';
10
11
  import type { Event } from './events';
11
12
  import type { Tag, TagType } from './tags';
@@ -47,6 +48,7 @@ interface ExternalPromotion extends Resource {
47
48
  order_amount_promotion_rule?: OrderAmountPromotionRule | null;
48
49
  sku_list_promotion_rule?: SkuListPromotionRule | null;
49
50
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
51
+ sku_list?: SkuList | null;
50
52
  attachments?: Attachment[] | null;
51
53
  events?: Event[] | null;
52
54
  tags?: Tag[] | null;
@@ -88,6 +90,7 @@ declare class ExternalPromotions extends ApiResource<ExternalPromotion> {
88
90
  order_amount_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
89
91
  sku_list_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
90
92
  coupon_codes_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
93
+ sku_list(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
91
94
  attachments(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
92
95
  events(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
93
96
  tags(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
@@ -27,6 +27,10 @@ class ExternalPromotions extends resource_1.ApiResource {
27
27
  const _externalPromotionId = externalPromotionId.id || externalPromotionId;
28
28
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `external_promotions/${_externalPromotionId}/coupon_codes_promotion_rule`, params, options);
29
29
  }
30
+ async sku_list(externalPromotionId, params, options) {
31
+ const _externalPromotionId = externalPromotionId.id || externalPromotionId;
32
+ return this.resources.fetch({ type: 'sku_lists' }, `external_promotions/${_externalPromotionId}/sku_list`, params, options);
33
+ }
30
34
  async attachments(externalPromotionId, params, options) {
31
35
  const _externalPromotionId = externalPromotionId.id || externalPromotionId;
32
36
  return this.resources.fetch({ type: 'attachments' }, `external_promotions/${_externalPromotionId}/attachments`, params, options);
@@ -6,6 +6,7 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
6
6
  import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
7
7
  import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
8
8
  import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
9
+ import type { SkuList } from './sku_lists';
9
10
  import type { Attachment } from './attachments';
10
11
  import type { Event } from './events';
11
12
  import type { Tag, TagType } from './tags';
@@ -48,6 +49,7 @@ interface FixedAmountPromotion extends Resource {
48
49
  order_amount_promotion_rule?: OrderAmountPromotionRule | null;
49
50
  sku_list_promotion_rule?: SkuListPromotionRule | null;
50
51
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
52
+ sku_list?: SkuList | null;
51
53
  attachments?: Attachment[] | null;
52
54
  events?: Event[] | null;
53
55
  tags?: Tag[] | null;
@@ -89,6 +91,7 @@ declare class FixedAmountPromotions extends ApiResource<FixedAmountPromotion> {
89
91
  order_amount_promotion_rule(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
90
92
  sku_list_promotion_rule(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
91
93
  coupon_codes_promotion_rule(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
94
+ sku_list(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
92
95
  attachments(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
93
96
  events(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
94
97
  tags(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
@@ -27,6 +27,10 @@ class FixedAmountPromotions extends resource_1.ApiResource {
27
27
  const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
28
28
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/coupon_codes_promotion_rule`, params, options);
29
29
  }
30
+ async sku_list(fixedAmountPromotionId, params, options) {
31
+ const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
32
+ return this.resources.fetch({ type: 'sku_lists' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/sku_list`, params, options);
33
+ }
30
34
  async attachments(fixedAmountPromotionId, params, options) {
31
35
  const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
32
36
  return this.resources.fetch({ type: 'attachments' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/attachments`, params, options);