@commercelayer/sdk 4.40.0 → 4.42.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 (143) hide show
  1. package/lib/cjs/api.d.ts +3 -2
  2. package/lib/cjs/api.js +8 -2
  3. package/lib/cjs/client.d.ts +8 -9
  4. package/lib/cjs/client.js +42 -11
  5. package/lib/cjs/commercelayer.d.ts +4 -2
  6. package/lib/cjs/commercelayer.js +7 -1
  7. package/lib/cjs/error.d.ts +7 -7
  8. package/lib/cjs/jsonapi.d.ts +1 -0
  9. package/lib/cjs/jsonapi.js +1 -1
  10. package/lib/cjs/model.d.ts +1 -1
  11. package/lib/cjs/resource.d.ts +1 -1
  12. package/lib/cjs/resource.js +1 -2
  13. package/lib/cjs/resources/authorizations.d.ts +3 -3
  14. package/lib/cjs/resources/authorizations.js +4 -4
  15. package/lib/cjs/resources/avalara_accounts.d.ts +6 -6
  16. package/lib/cjs/resources/axerve_payments.d.ts +2 -0
  17. package/lib/cjs/resources/bundles.d.ts +8 -8
  18. package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +12 -2
  19. package/lib/cjs/resources/buy_x_pay_y_promotions.js +4 -0
  20. package/lib/cjs/resources/captures.d.ts +3 -3
  21. package/lib/cjs/resources/captures.js +4 -4
  22. package/lib/cjs/resources/customer_payment_sources.d.ts +13 -1
  23. package/lib/cjs/resources/customer_payment_sources.js +4 -0
  24. package/lib/cjs/resources/external_promotions.d.ts +12 -2
  25. package/lib/cjs/resources/external_promotions.js +4 -0
  26. package/lib/cjs/resources/fixed_amount_promotions.d.ts +12 -2
  27. package/lib/cjs/resources/fixed_amount_promotions.js +4 -0
  28. package/lib/cjs/resources/fixed_price_promotions.d.ts +12 -2
  29. package/lib/cjs/resources/fixed_price_promotions.js +4 -0
  30. package/lib/cjs/resources/free_gift_promotions.d.ts +12 -2
  31. package/lib/cjs/resources/free_gift_promotions.js +4 -0
  32. package/lib/cjs/resources/free_shipping_promotions.d.ts +12 -2
  33. package/lib/cjs/resources/free_shipping_promotions.js +4 -0
  34. package/lib/cjs/resources/imports.d.ts +0 -2
  35. package/lib/cjs/resources/inventory_models.d.ts +3 -0
  36. package/lib/cjs/resources/line_items.d.ts +9 -0
  37. package/lib/cjs/resources/line_items.js +4 -0
  38. package/lib/cjs/resources/markets.d.ts +5 -0
  39. package/lib/cjs/resources/orders.d.ts +5 -1
  40. package/lib/cjs/resources/orders.js +4 -0
  41. package/lib/cjs/resources/organization.d.ts +4 -4
  42. package/lib/cjs/resources/payment_methods.d.ts +2 -0
  43. package/lib/cjs/resources/percentage_discount_promotions.d.ts +12 -2
  44. package/lib/cjs/resources/percentage_discount_promotions.js +4 -0
  45. package/lib/cjs/resources/price_lists.d.ts +3 -0
  46. package/lib/cjs/resources/prices.d.ts +6 -6
  47. package/lib/cjs/resources/promotions.d.ts +4 -1
  48. package/lib/cjs/resources/promotions.js +4 -0
  49. package/lib/cjs/resources/refunds.d.ts +3 -3
  50. package/lib/cjs/resources/refunds.js +4 -4
  51. package/lib/cjs/resources/shipments.d.ts +11 -1
  52. package/lib/cjs/resources/shipments.js +7 -0
  53. package/lib/cjs/resources/shipping_categories.d.ts +3 -0
  54. package/lib/cjs/resources/shipping_methods.d.ts +2 -0
  55. package/lib/cjs/resources/stock_line_items.d.ts +7 -0
  56. package/lib/cjs/resources/stock_line_items.js +9 -0
  57. package/lib/cjs/resources/stock_locations.d.ts +3 -0
  58. package/lib/cjs/resources/stock_reservations.d.ts +0 -1
  59. package/lib/cjs/resources/stock_transfers.d.ts +1 -0
  60. package/lib/cjs/resources/stripe_payments.d.ts +2 -0
  61. package/lib/cjs/resources/transactions.d.ts +3 -0
  62. package/lib/cjs/resources/transactions.js +4 -0
  63. package/lib/cjs/resources/voids.d.ts +3 -3
  64. package/lib/cjs/resources/voids.js +4 -4
  65. package/lib/cjs/resources/webhooks.d.ts +7 -0
  66. package/lib/cjs/resources/webhooks.js +6 -0
  67. package/lib/cjs/static.d.ts +4 -1
  68. package/lib/cjs/static.js +8 -2
  69. package/lib/cjs/util.d.ts +6 -1
  70. package/lib/cjs/util.js +1 -0
  71. package/lib/esm/api.d.ts +3 -2
  72. package/lib/esm/api.js +7 -1
  73. package/lib/esm/client.d.ts +8 -9
  74. package/lib/esm/client.js +42 -11
  75. package/lib/esm/commercelayer.d.ts +4 -2
  76. package/lib/esm/commercelayer.js +7 -1
  77. package/lib/esm/error.d.ts +7 -7
  78. package/lib/esm/jsonapi.d.ts +1 -0
  79. package/lib/esm/jsonapi.js +1 -1
  80. package/lib/esm/model.d.ts +1 -1
  81. package/lib/esm/resource.d.ts +1 -1
  82. package/lib/esm/resource.js +1 -2
  83. package/lib/esm/resources/authorizations.d.ts +3 -3
  84. package/lib/esm/resources/authorizations.js +4 -4
  85. package/lib/esm/resources/avalara_accounts.d.ts +6 -6
  86. package/lib/esm/resources/axerve_payments.d.ts +2 -0
  87. package/lib/esm/resources/bundles.d.ts +8 -8
  88. package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +12 -2
  89. package/lib/esm/resources/buy_x_pay_y_promotions.js +4 -0
  90. package/lib/esm/resources/captures.d.ts +3 -3
  91. package/lib/esm/resources/captures.js +4 -4
  92. package/lib/esm/resources/customer_payment_sources.d.ts +13 -1
  93. package/lib/esm/resources/customer_payment_sources.js +4 -0
  94. package/lib/esm/resources/external_promotions.d.ts +12 -2
  95. package/lib/esm/resources/external_promotions.js +4 -0
  96. package/lib/esm/resources/fixed_amount_promotions.d.ts +12 -2
  97. package/lib/esm/resources/fixed_amount_promotions.js +4 -0
  98. package/lib/esm/resources/fixed_price_promotions.d.ts +12 -2
  99. package/lib/esm/resources/fixed_price_promotions.js +4 -0
  100. package/lib/esm/resources/free_gift_promotions.d.ts +12 -2
  101. package/lib/esm/resources/free_gift_promotions.js +4 -0
  102. package/lib/esm/resources/free_shipping_promotions.d.ts +12 -2
  103. package/lib/esm/resources/free_shipping_promotions.js +4 -0
  104. package/lib/esm/resources/imports.d.ts +0 -2
  105. package/lib/esm/resources/inventory_models.d.ts +3 -0
  106. package/lib/esm/resources/line_items.d.ts +9 -0
  107. package/lib/esm/resources/line_items.js +4 -0
  108. package/lib/esm/resources/markets.d.ts +5 -0
  109. package/lib/esm/resources/orders.d.ts +5 -1
  110. package/lib/esm/resources/orders.js +4 -0
  111. package/lib/esm/resources/organization.d.ts +4 -4
  112. package/lib/esm/resources/payment_methods.d.ts +2 -0
  113. package/lib/esm/resources/percentage_discount_promotions.d.ts +12 -2
  114. package/lib/esm/resources/percentage_discount_promotions.js +4 -0
  115. package/lib/esm/resources/price_lists.d.ts +3 -0
  116. package/lib/esm/resources/prices.d.ts +6 -6
  117. package/lib/esm/resources/promotions.d.ts +4 -1
  118. package/lib/esm/resources/promotions.js +4 -0
  119. package/lib/esm/resources/refunds.d.ts +3 -3
  120. package/lib/esm/resources/refunds.js +4 -4
  121. package/lib/esm/resources/shipments.d.ts +11 -1
  122. package/lib/esm/resources/shipments.js +7 -0
  123. package/lib/esm/resources/shipping_categories.d.ts +3 -0
  124. package/lib/esm/resources/shipping_methods.d.ts +2 -0
  125. package/lib/esm/resources/stock_line_items.d.ts +7 -0
  126. package/lib/esm/resources/stock_line_items.js +9 -0
  127. package/lib/esm/resources/stock_locations.d.ts +3 -0
  128. package/lib/esm/resources/stock_reservations.d.ts +0 -1
  129. package/lib/esm/resources/stock_transfers.d.ts +1 -0
  130. package/lib/esm/resources/stripe_payments.d.ts +2 -0
  131. package/lib/esm/resources/transactions.d.ts +3 -0
  132. package/lib/esm/resources/transactions.js +4 -0
  133. package/lib/esm/resources/voids.d.ts +3 -3
  134. package/lib/esm/resources/voids.js +4 -4
  135. package/lib/esm/resources/webhooks.d.ts +7 -0
  136. package/lib/esm/resources/webhooks.js +6 -0
  137. package/lib/esm/static.d.ts +4 -1
  138. package/lib/esm/static.js +8 -2
  139. package/lib/esm/util.d.ts +6 -1
  140. package/lib/esm/util.js +27 -1
  141. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  142. package/lib/tsconfig.tsbuildinfo +1 -1
  143. package/package.json +7 -7
package/lib/cjs/api.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { Resource, ResourceRel } from './resource';
2
2
  import type { TagType } from './resources/tags';
3
3
  import type { VersionType } from './resources/versions';
4
4
  /**
5
- * ©2023 Commerce Layer Inc.
5
+ * ©2024 Commerce Layer Inc.
6
6
  **/
7
7
  export { default as Addresses } from './resources/addresses';
8
8
  export { default as Adjustments } from './resources/adjustments';
@@ -126,6 +126,7 @@ export { default as Webhooks } from './resources/webhooks';
126
126
  export { default as WireTransfers } from './resources/wire_transfers';
127
127
  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' | 'buy_x_pay_y_promotions' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'custom_promotion_rules' | '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' | 'payment_options' | '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' | 'versions' | 'voids' | 'webhooks' | 'wire_transfers';
128
128
  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", "buy_x_pay_y_promotions", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "cleanups", "coupon_codes_promotion_rules", "coupon_recipients", "coupons", "custom_promotion_rules", "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", "payment_options", "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", "versions", "voids", "webhooks", "wire_transfers"];
129
+ export declare const singletonList: readonly ["application", "organization"];
129
130
  export type RetrievableResourceType = ResourceTypeLock;
130
131
  export type RetrievableResource = Resource & {
131
132
  type: RetrievableResourceType;
@@ -146,7 +147,7 @@ export type DeletableResourceType = 'addresses' | 'adjustments' | 'adyen_gateway
146
147
  export type DeletableResource = Resource & {
147
148
  type: DeletableResourceType;
148
149
  };
149
- export type TaggableResourceType = 'addresses' | 'bundles' | 'buy_x_pay_y_promotions' | 'coupons' | 'customers' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_cards' | 'line_item_options' | 'line_items' | 'orders' | 'percentage_discount_promotions' | 'promotions' | 'returns' | 'sku_options' | 'skus';
150
+ export type TaggableResourceType = 'addresses' | 'bundles' | 'buy_x_pay_y_promotions' | 'coupons' | 'customers' | 'external_promotions' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'gift_cards' | 'line_item_options' | 'line_items' | 'orders' | 'percentage_discount_promotions' | 'promotions' | 'returns' | 'shipments' | 'sku_options' | 'skus';
150
151
  export type TaggableResource = Resource & {
151
152
  type: TaggableResourceType;
152
153
  tags?: Array<ResourceRel & {
package/lib/cjs/api.js CHANGED
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  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.CustomPromotionRules = exports.Coupons = exports.CouponRecipients = exports.CouponCodesPromotionRules = exports.Cleanups = exports.CheckoutComPayments = exports.CheckoutComGateways = exports.CarrierAccounts = exports.Captures = exports.BuyXPayYPromotions = 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
7
  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.PaymentOptions = 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 = exports.InventoryStockLocations = exports.InventoryReturnLocations = void 0;
8
- exports.resourceList = exports.WireTransfers = exports.Webhooks = exports.Voids = exports.Versions = 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 = exports.StockItems = exports.Skus = exports.SkuOptions = void 0;
8
+ exports.singletonList = exports.resourceList = exports.WireTransfers = exports.Webhooks = exports.Voids = exports.Versions = 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 = exports.StockItems = exports.Skus = exports.SkuOptions = void 0;
9
9
  // ##__API_RESOURCES_START__##
10
10
  // ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##'
11
11
  /**
12
- * ©2023 Commerce Layer Inc.
12
+ * ©2024 Commerce Layer Inc.
13
13
  **/
14
14
  var addresses_1 = require("./resources/addresses");
15
15
  Object.defineProperty(exports, "Addresses", { enumerable: true, get: function () { return __importDefault(addresses_1).default; } });
@@ -376,3 +376,9 @@ exports.resourceList = [
376
376
  'wire_transfers'
377
377
  // ##__API_RESOURCE_LIST_STOP__##
378
378
  ];
379
+ exports.singletonList = [
380
+ // ##__API_RESOURCE_SINGLETON_START__##
381
+ 'application',
382
+ 'organization'
383
+ // ##__API_RESOURCE_SINGLETON_STOP__##
384
+ ];
@@ -1,9 +1,5 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import type { AxiosAdapter, AxiosProxyConfig, Method } from 'axios';
4
2
  import type { InterceptorManager } from './interceptor';
5
- import type { Agent as HttpAgent } from 'http';
6
- import type { Agent as HttpsAgent } from 'https';
7
3
  type ProxyConfig = AxiosProxyConfig | false;
8
4
  type Adapter = AxiosAdapter;
9
5
  type RequestParams = Record<string, string | number | boolean>;
@@ -11,19 +7,21 @@ type RequestHeaders = Record<string, string>;
11
7
  type RequestConfig = {
12
8
  timeout?: number;
13
9
  params?: RequestParams;
14
- httpAgent?: HttpAgent;
15
- httpsAgent?: HttpsAgent;
10
+ httpAgent?: any;
11
+ httpsAgent?: any;
16
12
  proxy?: ProxyConfig;
17
13
  headers?: RequestHeaders;
18
14
  };
15
+ type RequestConfigExtra = {
16
+ adapter?: Adapter;
17
+ userAgent?: string;
18
+ };
19
19
  type ApiConfig = {
20
20
  organization: string;
21
21
  domain?: string;
22
22
  accessToken: string;
23
23
  };
24
- type ApiClientInitConfig = ApiConfig & RequestConfig & {
25
- adapter?: Adapter;
26
- };
24
+ type ApiClientInitConfig = ApiConfig & RequestConfig & RequestConfigExtra;
27
25
  type ApiClientConfig = Partial<ApiClientInitConfig>;
28
26
  declare class ApiClient {
29
27
  #private;
@@ -32,6 +30,7 @@ declare class ApiClient {
32
30
  interceptors: InterceptorManager;
33
31
  private constructor();
34
32
  config(config: ApiClientConfig): ApiClient;
33
+ userAgent(userAgent: string): ApiClient;
35
34
  adapter(adapter: Adapter): ApiClient;
36
35
  request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
37
36
  private customHeaders;
package/lib/cjs/client.js CHANGED
@@ -18,6 +18,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const axios_1 = __importDefault(require("axios"));
19
19
  const error_1 = require("./error");
20
20
  const config_1 = __importDefault(require("./config"));
21
+ // import type { Agent as HttpAgent } from 'http'
22
+ // import type { Agent as HttpsAgent } from 'https'
23
+ // import { packageInfo } from './util'
21
24
  const debug_1 = __importDefault(require("./debug"));
22
25
  const debug = (0, debug_1.default)('client');
23
26
  const baseURL = (organization, domain) => {
@@ -40,19 +43,28 @@ class ApiClient {
40
43
  timeout: options.timeout || config_1.default.client.timeout,
41
44
  proxy: options.proxy,
42
45
  httpAgent: options.httpAgent,
43
- httpsAgent: options.httpsAgent,
46
+ httpsAgent: options.httpsAgent
44
47
  };
45
48
  // Set custom headers
46
49
  const customHeaders = this.customHeaders(options.headers);
50
+ // Set headers
51
+ const headers = {
52
+ ...customHeaders,
53
+ 'Accept': 'application/vnd.api+json',
54
+ 'Content-Type': 'application/vnd.api+json',
55
+ 'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
56
+ };
57
+ // Set User-Agent
58
+ let userAgent = options.userAgent; // || `SDK-core axios/${axios.VERSION}`
59
+ if (userAgent) {
60
+ if (!userAgent.includes('axios/'))
61
+ userAgent += ` axios/${axios_1.default.VERSION}`;
62
+ headers['User-Agent'] = userAgent;
63
+ }
47
64
  const axiosOptions = {
48
65
  baseURL: this.baseUrl,
49
66
  timeout: config_1.default.client.timeout,
50
- headers: {
51
- ...customHeaders,
52
- 'Accept': 'application/vnd.api+json',
53
- 'Content-Type': 'application/vnd.api+json',
54
- 'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
55
- },
67
+ headers,
56
68
  ...axiosConfig
57
69
  };
58
70
  if (options.adapter)
@@ -73,6 +85,10 @@ class ApiClient {
73
85
  def.httpAgent = config.httpAgent;
74
86
  if (config.httpsAgent)
75
87
  def.httpsAgent = config.httpsAgent;
88
+ if (config.adapter)
89
+ this.adapter(config.adapter);
90
+ if (config.userAgent)
91
+ this.userAgent(config.userAgent);
76
92
  // API Client config
77
93
  if (config.organization)
78
94
  this.baseUrl = baseURL(config.organization, config.domain);
@@ -82,8 +98,18 @@ class ApiClient {
82
98
  }
83
99
  if (config.headers)
84
100
  def.headers.common = this.customHeaders(config.headers);
85
- if (config.adapter)
86
- this.adapter(config.adapter);
101
+ return this;
102
+ }
103
+ userAgent(userAgent) {
104
+ if (userAgent) {
105
+ let ua = userAgent;
106
+ if (!ua.includes('axios/')) {
107
+ // const axiosVer = packageInfo(['dependencies.axios'], { nestedName: true })
108
+ if (axios_1.default.VERSION)
109
+ ua += ` axios/${axios_1.default.VERSION}`;
110
+ }
111
+ __classPrivateFieldGet(this, _ApiClient_client, "f").defaults.headers['User-Agent'] = ua;
112
+ }
87
113
  return this;
88
114
  }
89
115
  adapter(adapter) {
@@ -93,6 +119,11 @@ class ApiClient {
93
119
  }
94
120
  async request(method, path, body, options) {
95
121
  debug('request %s %s, %O, %O', method, path, body || {}, options || {});
122
+ // Ignored params alerts (in debug mode)
123
+ if (options === null || options === void 0 ? void 0 : options.adapter)
124
+ debug('Adapter ignored in request config');
125
+ if (options === null || options === void 0 ? void 0 : options.userAgent)
126
+ debug('User-Agent header ignored in request config');
96
127
  const data = body ? { data: body } : undefined;
97
128
  const url = path;
98
129
  // Runtime request parameters
@@ -106,14 +137,14 @@ class ApiClient {
106
137
  // const start = Date.now()
107
138
  return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
108
139
  .then(response => response.data)
109
- .catch(error => (0, error_1.handleError)(error));
140
+ .catch((error) => (0, error_1.handleError)(error));
110
141
  // .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
111
142
  }
112
143
  customHeaders(headers) {
113
144
  const customHeaders = {};
114
145
  if (headers) {
115
146
  for (const [name, value] of Object.entries(headers))
116
- if (!['accept', 'content-type', 'authorization'].includes(name.toLowerCase()))
147
+ if (!['accept', 'content-type', 'authorization', 'user-agent'].includes(name.toLowerCase()))
117
148
  customHeaders[name] = value;
118
149
  }
119
150
  return customHeaders;
@@ -2,14 +2,14 @@ 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.16.0";
5
+ declare const OPEN_API_SCHEMA_VERSION = "4.24.0";
6
6
  export { OPEN_API_SCHEMA_VERSION };
7
7
  type SdkConfig = {};
8
8
  type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
9
9
  type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
10
10
  declare class CommerceLayerClient {
11
11
  #private;
12
- readonly openApiSchemaVersion = "4.16.0";
12
+ readonly openApiSchemaVersion = "4.24.0";
13
13
  addresses: api.Addresses;
14
14
  adjustments: api.Adjustments;
15
15
  adyen_gateways: api.AdyenGateways;
@@ -135,6 +135,8 @@ declare class CommerceLayerClient {
135
135
  private localConfig;
136
136
  config(config: CommerceLayerConfig): CommerceLayerClient;
137
137
  resources(): readonly string[];
138
+ singletons(): readonly string[];
139
+ isSingleton(resource: api.ResourceTypeLock): boolean;
138
140
  isApiError(error: any): error is ApiError;
139
141
  addRequestInterceptor(onFulfilled?: RequestInterceptor, onRejected?: ErrorInterceptor): number;
140
142
  addResponseInterceptor(onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor): number;
@@ -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.16.0';
48
+ const OPEN_API_SCHEMA_VERSION = '4.24.0';
49
49
  exports.OPEN_API_SCHEMA_VERSION = OPEN_API_SCHEMA_VERSION;
50
50
  class CommerceLayerClient {
51
51
  // ##__CL_RESOURCES_DEF_STOP__##
@@ -203,6 +203,12 @@ class CommerceLayerClient {
203
203
  resources() {
204
204
  return static_1.CommerceLayerStatic.resources();
205
205
  }
206
+ singletons() {
207
+ return static_1.CommerceLayerStatic.singletons();
208
+ }
209
+ isSingleton(resource) {
210
+ return static_1.CommerceLayerStatic.isSingleton(resource);
211
+ }
206
212
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
207
213
  isApiError(error) {
208
214
  return static_1.CommerceLayerStatic.isApiError(error);
@@ -1,15 +1,15 @@
1
1
  declare enum ErrorType {
2
- CLIENT = "client",
3
- REQUEST = "request",
4
- RESPONSE = "response",
5
- CANCEL = "cancel",
6
- PARSE = "parse",
2
+ CLIENT = "client",// Error instantiating the client
3
+ REQUEST = "request",// Error preparing API request
4
+ RESPONSE = "response",// Error response from API
5
+ CANCEL = "cancel",// Forced request abort using interceptor
6
+ PARSE = "parse",// Error parsing API resource
7
7
  GENERIC = "generic"
8
8
  }
9
9
  declare class SdkError extends Error {
10
10
  static NAME: string;
11
- static isSdkError(error: any): error is ApiError;
12
- type: string;
11
+ static isSdkError(error: any): error is SdkError;
12
+ type: ErrorType;
13
13
  code?: string;
14
14
  source?: Error;
15
15
  request?: any;
@@ -1,5 +1,6 @@
1
1
  import type { DocWithData, ResourceObject as JSONAPIObject } from 'jsonapi-typescript';
2
2
  import type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource } from './resource';
3
+ export type { DocWithData };
3
4
  declare const denormalize: <R extends Resource>(response: DocWithData) => R | R[];
4
5
  declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => JSONAPIObject;
5
6
  export { denormalize, normalize };
@@ -45,7 +45,7 @@ const denormalizeResource = (res, included) => {
45
45
  const rel = res.relationships[key].data;
46
46
  if (rel) {
47
47
  if (Array.isArray(rel))
48
- resource[key] = rel.map(r => denormalizeResource(findIncluded(r, included), included));
48
+ resource[key] = rel.map((r) => denormalizeResource(findIncluded(r, included), included));
49
49
  else
50
50
  resource[key] = denormalizeResource(findIncluded(rel, included), included);
51
51
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * ©2023 Commerce Layer Inc.
2
+ * ©2024 Commerce Layer Inc.
3
3
  **/
4
4
  export type { Address, AddressCreate, AddressUpdate } from './resources/addresses';
5
5
  export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments';
@@ -70,7 +70,7 @@ declare abstract class ApiResourceBase<R extends Resource> {
70
70
  constructor(adapter: ResourceAdapter);
71
71
  abstract relationship(id: string | ResourceId | null): ResourceRel;
72
72
  abstract type(): ResourceTypeLock;
73
- parse(resource: any): R | R[];
73
+ parse(resource: string): R | R[];
74
74
  update(resource: ResourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
75
75
  }
76
76
  declare abstract class ApiResource<R extends Resource> extends ApiResourceBase<R> {
@@ -20,8 +20,8 @@ const client_1 = __importDefault(require("./client"));
20
20
  const jsonapi_1 = require("./jsonapi");
21
21
  const query_1 = require("./query");
22
22
  const config_1 = __importDefault(require("./config"));
23
- const debug_1 = __importDefault(require("./debug"));
24
23
  const error_1 = require("./error");
24
+ const debug_1 = __importDefault(require("./debug"));
25
25
  const debug = (0, debug_1.default)('resource');
26
26
  class ListResponse extends Array {
27
27
  constructor(meta, data) {
@@ -46,7 +46,6 @@ class ResourceAdapter {
46
46
  this.localConfig(config);
47
47
  }
48
48
  get interceptors() { return __classPrivateFieldGet(this, _ResourceAdapter_client, "f").interceptors; }
49
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
50
49
  localConfig(config) {
51
50
  // if (typeof config.xyz !== 'undefined') this.#config.xyz = config.xyz
52
51
  }
@@ -3,10 +3,10 @@ import type { Resource, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Capture } from './captures';
8
9
  import type { Void } from './voids';
9
- import type { Event } from './events';
10
10
  type AuthorizationType = 'authorizations';
11
11
  type AuthorizationRel = ResourceRel & {
12
12
  type: AuthorizationType;
@@ -40,10 +40,10 @@ interface Authorization extends Resource {
40
40
  formatted_void_balance?: string | null;
41
41
  order?: Order | null;
42
42
  attachments?: Attachment[] | null;
43
+ events?: Event[] | null;
43
44
  versions?: Version[] | null;
44
45
  captures?: Capture[] | null;
45
46
  voids?: Void[] | null;
46
- events?: Event[] | null;
47
47
  }
48
48
  interface AuthorizationUpdate extends ResourceUpdate {
49
49
  _capture?: boolean | null;
@@ -55,10 +55,10 @@ declare class Authorizations extends ApiResource<Authorization> {
55
55
  update(resource: AuthorizationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
56
56
  order(authorizationId: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
57
57
  attachments(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
58
+ events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
58
59
  versions(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
59
60
  captures(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Capture>>;
60
61
  voids(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Void>>;
61
- events(authorizationId: string | Authorization, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
62
62
  _capture(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
63
63
  _capture_amount_cents(id: string | Authorization, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
64
64
  _void(id: string | Authorization, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
@@ -13,6 +13,10 @@ class Authorizations extends resource_1.ApiResource {
13
13
  const _authorizationId = authorizationId.id || authorizationId;
14
14
  return this.resources.fetch({ type: 'attachments' }, `authorizations/${_authorizationId}/attachments`, params, options);
15
15
  }
16
+ async events(authorizationId, params, options) {
17
+ const _authorizationId = authorizationId.id || authorizationId;
18
+ return this.resources.fetch({ type: 'events' }, `authorizations/${_authorizationId}/events`, params, options);
19
+ }
16
20
  async versions(authorizationId, params, options) {
17
21
  const _authorizationId = authorizationId.id || authorizationId;
18
22
  return this.resources.fetch({ type: 'versions' }, `authorizations/${_authorizationId}/versions`, params, options);
@@ -25,10 +29,6 @@ class Authorizations extends resource_1.ApiResource {
25
29
  const _authorizationId = authorizationId.id || authorizationId;
26
30
  return this.resources.fetch({ type: 'voids' }, `authorizations/${_authorizationId}/voids`, params, options);
27
31
  }
28
- async events(authorizationId, params, options) {
29
- const _authorizationId = authorizationId.id || authorizationId;
30
- return this.resources.fetch({ type: 'events' }, `authorizations/${_authorizationId}/events`, params, options);
31
- }
32
32
  async _capture(id, params, options) {
33
33
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Authorizations.TYPE, _capture: true }, params, options);
34
34
  }
@@ -17,8 +17,8 @@ interface AvalaraAccount extends Resource {
17
17
  name: string;
18
18
  username: string;
19
19
  company_code: string;
20
- commit_invoice?: string | null;
21
- ddp?: string | null;
20
+ commit_invoice?: boolean | null;
21
+ ddp?: boolean | null;
22
22
  markets?: Market[] | null;
23
23
  attachments?: Attachment[] | null;
24
24
  versions?: Version[] | null;
@@ -29,8 +29,8 @@ interface AvalaraAccountCreate extends ResourceCreate {
29
29
  username: string;
30
30
  password: string;
31
31
  company_code: string;
32
- commit_invoice?: string | null;
33
- ddp?: string | null;
32
+ commit_invoice?: boolean | null;
33
+ ddp?: boolean | null;
34
34
  tax_categories?: TaxCategoryRel[] | null;
35
35
  }
36
36
  interface AvalaraAccountUpdate extends ResourceUpdate {
@@ -38,8 +38,8 @@ interface AvalaraAccountUpdate extends ResourceUpdate {
38
38
  username?: string | null;
39
39
  password?: string | null;
40
40
  company_code?: string | null;
41
- commit_invoice?: string | null;
42
- ddp?: string | null;
41
+ commit_invoice?: boolean | null;
42
+ ddp?: boolean | null;
43
43
  tax_categories?: TaxCategoryRel[] | null;
44
44
  }
45
45
  declare class AvalaraAccounts extends ApiResource<AvalaraAccount> {
@@ -18,6 +18,7 @@ interface AxervePayment extends Resource {
18
18
  payment_request_data?: Record<string, any> | null;
19
19
  client_ip?: string | null;
20
20
  buyer_details?: Record<string, any> | null;
21
+ request_token?: boolean | null;
21
22
  mismatched_amounts?: boolean | null;
22
23
  intent_amount_cents: number;
23
24
  intent_amount_float?: number | null;
@@ -31,6 +32,7 @@ interface AxervePaymentCreate extends ResourceCreate {
31
32
  return_url: string;
32
33
  client_ip?: string | null;
33
34
  buyer_details?: Record<string, any> | null;
35
+ request_token?: boolean | null;
34
36
  order: OrderRel;
35
37
  }
36
38
  interface AxervePaymentUpdate extends ResourceUpdate {
@@ -30,12 +30,12 @@ interface Bundle extends Resource {
30
30
  image_url?: string | null;
31
31
  do_not_ship?: boolean | null;
32
32
  do_not_track?: boolean | null;
33
- price_amount_cents: number;
34
- price_amount_float: number;
35
- formatted_price_amount: string;
36
- compare_at_amount_cents: number;
37
- compare_at_amount_float: number;
38
- formatted_compare_at_amount: string;
33
+ price_amount_cents?: number | null;
34
+ price_amount_float?: number | null;
35
+ formatted_price_amount?: string | null;
36
+ compare_at_amount_cents?: number | null;
37
+ compare_at_amount_float?: number | null;
38
+ formatted_compare_at_amount?: string | null;
39
39
  skus_count?: number | null;
40
40
  market?: Market | null;
41
41
  sku_list?: SkuList | null;
@@ -51,8 +51,8 @@ interface BundleCreate extends ResourceCreate {
51
51
  currency_code?: string | null;
52
52
  description?: string | null;
53
53
  image_url?: string | null;
54
- price_amount_cents: number;
55
- compare_at_amount_cents: number;
54
+ price_amount_cents?: number | null;
55
+ compare_at_amount_cents?: number | null;
56
56
  _compute_price_amount?: boolean | null;
57
57
  _compute_compare_at_amount?: boolean | null;
58
58
  market?: MarketRel | 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 { CustomPromotionRule, CustomPromotionRuleType } from './custom_promotion_rules';
9
10
  import type { Coupon, CouponType } from './coupons';
10
11
  import type { SkuList, SkuListType } from './sku_lists';
11
12
  import type { Attachment } from './attachments';
@@ -32,6 +33,9 @@ type SkuListPromotionRuleRel = ResourceRel & {
32
33
  type CouponCodesPromotionRuleRel = ResourceRel & {
33
34
  type: CouponCodesPromotionRuleType;
34
35
  };
36
+ type CustomPromotionRuleRel = ResourceRel & {
37
+ type: CustomPromotionRuleType;
38
+ };
35
39
  type CouponRel = ResourceRel & {
36
40
  type: CouponType;
37
41
  };
@@ -49,7 +53,7 @@ interface BuyXPayYPromotion extends Resource {
49
53
  priority?: number | null;
50
54
  starts_at: string;
51
55
  expires_at: string;
52
- total_usage_limit: number;
56
+ total_usage_limit?: number | null;
53
57
  total_usage_count?: number | null;
54
58
  active?: boolean | null;
55
59
  disabled_at?: string | null;
@@ -61,6 +65,7 @@ interface BuyXPayYPromotion extends Resource {
61
65
  order_amount_promotion_rule?: OrderAmountPromotionRule | null;
62
66
  sku_list_promotion_rule?: SkuListPromotionRule | null;
63
67
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
68
+ custom_promotion_rule?: CustomPromotionRule | null;
64
69
  coupons?: Coupon[] | null;
65
70
  sku_list?: SkuList | null;
66
71
  attachments?: Attachment[] | null;
@@ -76,7 +81,9 @@ interface BuyXPayYPromotionCreate extends ResourceCreate {
76
81
  priority?: number | null;
77
82
  starts_at: string;
78
83
  expires_at: string;
79
- total_usage_limit: number;
84
+ total_usage_limit?: number | null;
85
+ _disable?: boolean | null;
86
+ _enable?: boolean | null;
80
87
  x: number;
81
88
  y: number;
82
89
  cheapest_free?: boolean | null;
@@ -85,6 +92,7 @@ interface BuyXPayYPromotionCreate extends ResourceCreate {
85
92
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
86
93
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
87
94
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
95
+ custom_promotion_rule?: CustomPromotionRuleRel | null;
88
96
  coupons?: CouponRel[] | null;
89
97
  sku_list: SkuListRel;
90
98
  tags?: TagRel[] | null;
@@ -107,6 +115,7 @@ interface BuyXPayYPromotionUpdate extends ResourceUpdate {
107
115
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
108
116
  sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
109
117
  coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
118
+ custom_promotion_rule?: CustomPromotionRuleRel | null;
110
119
  coupons?: CouponRel[] | null;
111
120
  sku_list?: SkuListRel | null;
112
121
  tags?: TagRel[] | null;
@@ -120,6 +129,7 @@ declare class BuyXPayYPromotions extends ApiResource<BuyXPayYPromotion> {
120
129
  order_amount_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
121
130
  sku_list_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
122
131
  coupon_codes_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
132
+ custom_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
123
133
  coupons(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
124
134
  sku_list(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
125
135
  attachments(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
@@ -27,6 +27,10 @@ class BuyXPayYPromotions extends resource_1.ApiResource {
27
27
  const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
28
28
  return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/coupon_codes_promotion_rule`, params, options);
29
29
  }
30
+ async custom_promotion_rule(buyXPayYPromotionId, params, options) {
31
+ const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
32
+ return this.resources.fetch({ type: 'custom_promotion_rules' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/custom_promotion_rule`, params, options);
33
+ }
30
34
  async coupons(buyXPayYPromotionId, params, options) {
31
35
  const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
32
36
  return this.resources.fetch({ type: 'coupons' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/coupons`, params, options);
@@ -3,10 +3,10 @@ import type { Resource, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel
3
3
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
4
4
  import type { Order } from './orders';
5
5
  import type { Attachment } from './attachments';
6
+ import type { Event } from './events';
6
7
  import type { Version } from './versions';
7
8
  import type { Authorization } from './authorizations';
8
9
  import type { Refund } from './refunds';
9
- import type { Event } from './events';
10
10
  type CaptureType = 'captures';
11
11
  type CaptureRel = ResourceRel & {
12
12
  type: CaptureType;
@@ -32,10 +32,10 @@ interface Capture extends Resource {
32
32
  formatted_refund_balance?: string | null;
33
33
  order?: Order | null;
34
34
  attachments?: Attachment[] | null;
35
+ events?: Event[] | null;
35
36
  versions?: Version[] | null;
36
37
  reference_authorization?: Authorization | null;
37
38
  refunds?: Refund[] | null;
38
- events?: Event[] | null;
39
39
  }
40
40
  interface CaptureUpdate extends ResourceUpdate {
41
41
  _refund?: boolean | null;
@@ -46,10 +46,10 @@ declare class Captures extends ApiResource<Capture> {
46
46
  update(resource: CaptureUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
47
47
  order(captureId: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
48
48
  attachments(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
49
+ events(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
49
50
  versions(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
50
51
  reference_authorization(captureId: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Authorization>;
51
52
  refunds(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Refund>>;
52
- events(captureId: string | Capture, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
53
53
  _refund(id: string | Capture, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
54
54
  _refund_amount_cents(id: string | Capture, triggerValue: number, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Capture>;
55
55
  isCapture(resource: any): resource is Capture;
@@ -13,6 +13,10 @@ class Captures extends resource_1.ApiResource {
13
13
  const _captureId = captureId.id || captureId;
14
14
  return this.resources.fetch({ type: 'attachments' }, `captures/${_captureId}/attachments`, params, options);
15
15
  }
16
+ async events(captureId, params, options) {
17
+ const _captureId = captureId.id || captureId;
18
+ return this.resources.fetch({ type: 'events' }, `captures/${_captureId}/events`, params, options);
19
+ }
16
20
  async versions(captureId, params, options) {
17
21
  const _captureId = captureId.id || captureId;
18
22
  return this.resources.fetch({ type: 'versions' }, `captures/${_captureId}/versions`, params, options);
@@ -25,10 +29,6 @@ class Captures extends resource_1.ApiResource {
25
29
  const _captureId = captureId.id || captureId;
26
30
  return this.resources.fetch({ type: 'refunds' }, `captures/${_captureId}/refunds`, params, options);
27
31
  }
28
- async events(captureId, params, options) {
29
- const _captureId = captureId.id || captureId;
30
- return this.resources.fetch({ type: 'events' }, `captures/${_captureId}/events`, params, options);
31
- }
32
32
  async _refund(id, params, options) {
33
33
  return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Captures.TYPE, _refund: true }, params, options);
34
34
  }