@commercelayer/sdk 4.45.0 → 4.47.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 (41) hide show
  1. package/lib/cjs/commercelayer.d.ts +2 -2
  2. package/lib/cjs/commercelayer.js +1 -1
  3. package/lib/cjs/resources/adjustments.d.ts +3 -0
  4. package/lib/cjs/resources/events.d.ts +3 -3
  5. package/lib/cjs/resources/events.js +4 -4
  6. package/lib/cjs/resources/external_gateways.d.ts +4 -1
  7. package/lib/cjs/resources/external_promotions.d.ts +3 -0
  8. package/lib/cjs/resources/external_tax_calculators.d.ts +3 -0
  9. package/lib/cjs/resources/line_items.d.ts +11 -4
  10. package/lib/cjs/resources/markets.d.ts +1 -1
  11. package/lib/cjs/resources/order_subscriptions.d.ts +0 -4
  12. package/lib/cjs/resources/orders.d.ts +3 -0
  13. package/lib/cjs/resources/organization.d.ts +1 -0
  14. package/lib/cjs/resources/parcel_line_items.d.ts +0 -8
  15. package/lib/cjs/resources/payment_methods.d.ts +5 -5
  16. package/lib/cjs/resources/shipments.d.ts +3 -4
  17. package/lib/cjs/resources/shipments.js +4 -0
  18. package/lib/cjs/resources/shipping_methods.d.ts +8 -5
  19. package/lib/cjs/resources/webhooks.d.ts +2 -2
  20. package/lib/esm/commercelayer.d.ts +2 -2
  21. package/lib/esm/commercelayer.js +1 -1
  22. package/lib/esm/resources/adjustments.d.ts +3 -0
  23. package/lib/esm/resources/events.d.ts +3 -3
  24. package/lib/esm/resources/events.js +4 -4
  25. package/lib/esm/resources/external_gateways.d.ts +4 -1
  26. package/lib/esm/resources/external_promotions.d.ts +3 -0
  27. package/lib/esm/resources/external_tax_calculators.d.ts +3 -0
  28. package/lib/esm/resources/line_items.d.ts +11 -4
  29. package/lib/esm/resources/markets.d.ts +1 -1
  30. package/lib/esm/resources/order_subscriptions.d.ts +0 -4
  31. package/lib/esm/resources/orders.d.ts +3 -0
  32. package/lib/esm/resources/organization.d.ts +1 -0
  33. package/lib/esm/resources/parcel_line_items.d.ts +0 -8
  34. package/lib/esm/resources/payment_methods.d.ts +5 -5
  35. package/lib/esm/resources/shipments.d.ts +3 -4
  36. package/lib/esm/resources/shipments.js +4 -0
  37. package/lib/esm/resources/shipping_methods.d.ts +8 -5
  38. package/lib/esm/resources/webhooks.d.ts +2 -2
  39. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  40. package/lib/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +2 -2
@@ -2,7 +2,7 @@ import * as api from './api';
2
2
  import { ApiError } from './error';
3
3
  import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
4
4
  import { ResourcesInitConfig } from './resource';
5
- declare const OPEN_API_SCHEMA_VERSION = "4.27.0";
5
+ declare const OPEN_API_SCHEMA_VERSION = "5.1.0";
6
6
  export { OPEN_API_SCHEMA_VERSION };
7
7
  type SdkConfig = {};
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.27.0";
13
+ readonly openApiSchemaVersion = "5.1.0";
14
14
  addresses: api.Addresses;
15
15
  adjustments: api.Adjustments;
16
16
  adyen_gateways: api.AdyenGateways;
@@ -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.27.0';
48
+ const OPEN_API_SCHEMA_VERSION = '5.1.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; }
@@ -10,17 +10,20 @@ interface Adjustment extends Resource {
10
10
  amount_cents?: number;
11
11
  amount_float?: number;
12
12
  formatted_amount?: string;
13
+ distribute_discount?: boolean;
13
14
  versions?: Version[];
14
15
  }
15
16
  interface AdjustmentCreate extends ResourceCreate {
16
17
  name: string;
17
18
  currency_code: string;
18
19
  amount_cents: number;
20
+ distribute_discount?: boolean;
19
21
  }
20
22
  interface AdjustmentUpdate extends ResourceUpdate {
21
23
  name?: string;
22
24
  currency_code?: string;
23
25
  amount_cents?: number;
26
+ distribute_discount?: boolean;
24
27
  }
25
28
  declare class Adjustments extends ApiResource {
26
29
  static readonly TYPE: 'adjustments';
@@ -1,21 +1,21 @@
1
1
  import { ApiResource, Resource, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
2
2
  import type { QueryParamsList, QueryParamsRetrieve } from '../query';
3
- import type { EventCallback } from './event_callbacks';
4
3
  import type { Webhook } from './webhooks';
4
+ import type { EventCallback } from './event_callbacks';
5
5
  type EventRel = ResourceRel & {
6
6
  type: typeof Events.TYPE;
7
7
  };
8
8
  interface Event extends Resource {
9
9
  name?: string;
10
- last_event_callbacks?: EventCallback[];
11
10
  webhooks?: Webhook[];
11
+ last_event_callbacks?: EventCallback[];
12
12
  }
13
13
  declare class Events extends ApiResource {
14
14
  static readonly TYPE: 'events';
15
15
  list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
16
16
  retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Event>;
17
- last_event_callbacks(eventId: string | Event, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<EventCallback>>;
18
17
  webhooks(eventId: string | Event, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Webhook>>;
18
+ last_event_callbacks(eventId: string | Event, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<EventCallback>>;
19
19
  isEvent(resource: any): resource is Event;
20
20
  relationship(id: string | ResourceId | null): EventRel;
21
21
  type(): string;
@@ -9,14 +9,14 @@ class Events extends resource_1.ApiResource {
9
9
  async retrieve(id, params, options) {
10
10
  return this.resources.retrieve({ type: Events.TYPE, id }, params, options);
11
11
  }
12
- async last_event_callbacks(eventId, params, options) {
13
- const _eventId = eventId.id || eventId;
14
- return this.resources.fetch({ type: 'event_callbacks' }, `events/${_eventId}/last_event_callbacks`, params, options);
15
- }
16
12
  async webhooks(eventId, params, options) {
17
13
  const _eventId = eventId.id || eventId;
18
14
  return this.resources.fetch({ type: 'webhooks' }, `events/${_eventId}/webhooks`, params, options);
19
15
  }
16
+ async last_event_callbacks(eventId, params, options) {
17
+ const _eventId = eventId.id || eventId;
18
+ return this.resources.fetch({ type: 'event_callbacks' }, `events/${_eventId}/last_event_callbacks`, params, options);
19
+ }
20
20
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
21
21
  isEvent(resource) {
22
22
  return resource.type && (resource.type === Events.TYPE);
@@ -8,12 +8,14 @@ type ExternalGatewayRel = ResourceRel & {
8
8
  };
9
9
  interface ExternalGateway extends Resource {
10
10
  name?: string;
11
- shared_secret?: string;
12
11
  authorize_url?: string;
13
12
  capture_url?: string;
14
13
  void_url?: string;
15
14
  refund_url?: string;
16
15
  token_url?: string;
16
+ circuit_state?: string;
17
+ circuit_failure_count?: number;
18
+ shared_secret?: string;
17
19
  payment_methods?: PaymentMethod[];
18
20
  versions?: Version[];
19
21
  external_payments?: ExternalPayment[];
@@ -33,6 +35,7 @@ interface ExternalGatewayUpdate extends ResourceUpdate {
33
35
  void_url?: string;
34
36
  refund_url?: string;
35
37
  token_url?: string;
38
+ _reset_circuit?: boolean;
36
39
  }
37
40
  declare class ExternalGateways extends ApiResource {
38
41
  static readonly TYPE: 'external_gateways';
@@ -49,6 +49,8 @@ interface ExternalPromotion extends Resource {
49
49
  active?: boolean;
50
50
  disabled_at?: string;
51
51
  promotion_url?: string;
52
+ circuit_state?: string;
53
+ circuit_failure_count?: number;
52
54
  shared_secret?: string;
53
55
  market?: Market;
54
56
  promotion_rules?: PromotionRule[];
@@ -94,6 +96,7 @@ interface ExternalPromotionUpdate extends ResourceUpdate {
94
96
  _disable?: boolean;
95
97
  _enable?: boolean;
96
98
  promotion_url?: string;
99
+ _reset_circuit?: boolean;
97
100
  market?: MarketRel;
98
101
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel;
99
102
  sku_list_promotion_rule?: SkuListPromotionRuleRel;
@@ -9,6 +9,8 @@ type ExternalTaxCalculatorRel = ResourceRel & {
9
9
  interface ExternalTaxCalculator extends Resource {
10
10
  name?: string;
11
11
  tax_calculator_url?: string;
12
+ circuit_state?: string;
13
+ circuit_failure_count?: number;
12
14
  shared_secret?: string;
13
15
  markets?: Market[];
14
16
  attachments?: Attachment[];
@@ -21,6 +23,7 @@ interface ExternalTaxCalculatorCreate extends ResourceCreate {
21
23
  interface ExternalTaxCalculatorUpdate extends ResourceUpdate {
22
24
  name?: string;
23
25
  tax_calculator_url?: string;
26
+ _reset_circuit?: boolean;
24
27
  }
25
28
  declare class ExternalTaxCalculators extends ApiResource {
26
29
  static readonly TYPE: 'external_tax_calculators';
@@ -89,16 +89,18 @@ interface LineItem extends Resource {
89
89
  item_type?: string;
90
90
  frequency?: string;
91
91
  coupon_code?: string;
92
+ circuit_state?: string;
93
+ circuit_failure_count?: number;
92
94
  order?: Order;
93
95
  item?: Adjustment | Bundle | ExternalPromotion | FixedAmountPromotion | FreeShippingPromotion | GiftCard | PaymentMethod | PercentageDiscountPromotion | Shipment | Sku;
94
96
  sku?: Sku;
95
97
  bundle?: Bundle;
98
+ adjustment?: Adjustment;
99
+ gift_card?: GiftCard;
100
+ shipment?: Shipment;
101
+ payment_method?: PaymentMethod;
96
102
  line_item_options?: LineItemOption[];
97
103
  return_line_items?: ReturnLineItem[];
98
- /**
99
- * @deprecated This field should not be used as it may be removed in the future without notice
100
- */
101
- shipment_line_items?: object[];
102
104
  stock_reservations?: StockReservation[];
103
105
  stock_line_items?: StockLineItem[];
104
106
  stock_transfers?: StockTransfer[];
@@ -122,6 +124,10 @@ interface LineItemCreate extends ResourceCreate {
122
124
  item?: AdjustmentRel | BundleRel | ExternalPromotionRel | FixedAmountPromotionRel | FreeShippingPromotionRel | GiftCardRel | PaymentMethodRel | PercentageDiscountPromotionRel | ShipmentRel | SkuRel;
123
125
  sku?: SkuRel;
124
126
  bundle?: BundleRel;
127
+ adjustment?: AdjustmentRel;
128
+ gift_card?: GiftCardRel;
129
+ shipment?: ShipmentRel;
130
+ payment_method?: PaymentMethodRel;
125
131
  tags?: TagRel[];
126
132
  }
127
133
  interface LineItemUpdate extends ResourceUpdate {
@@ -134,6 +140,7 @@ interface LineItemUpdate extends ResourceUpdate {
134
140
  name?: string;
135
141
  image_url?: string;
136
142
  frequency?: string;
143
+ _reset_circuit?: boolean;
137
144
  tags?: TagRel[];
138
145
  }
139
146
  declare class LineItems extends ApiResource {
@@ -37,9 +37,9 @@ interface Market extends Resource {
37
37
  checkout_url?: string;
38
38
  external_prices_url?: string;
39
39
  external_order_validation_url?: string;
40
- shared_secret?: string;
41
40
  private?: boolean;
42
41
  disabled_at?: string;
42
+ shared_secret?: string;
43
43
  merchant?: Merchant;
44
44
  price_list?: PriceList;
45
45
  inventory_model?: InventoryModel;
@@ -43,10 +43,6 @@ interface OrderSubscription extends Resource {
43
43
  customer_payment_source?: CustomerPaymentSource;
44
44
  order_subscription_items?: OrderSubscriptionItem[];
45
45
  order_factories?: OrderFactory[];
46
- /**
47
- * @deprecated This field should not be used as it may be removed in the future without notice
48
- */
49
- order_copies?: object[];
50
46
  recurring_order_copies?: RecurringOrderCopy[];
51
47
  orders?: Order[];
52
48
  events?: Event[];
@@ -194,6 +194,8 @@ interface Order extends Resource {
194
194
  archived_at?: string;
195
195
  expires_at?: string;
196
196
  subscription_created_at?: string;
197
+ circuit_state?: string;
198
+ circuit_failure_count?: number;
197
199
  market?: Market;
198
200
  customer?: Customer;
199
201
  shipping_address?: Address;
@@ -302,6 +304,7 @@ interface OrderUpdate extends ResourceUpdate {
302
304
  _create_subscriptions?: boolean;
303
305
  _start_editing?: boolean;
304
306
  _stop_editing?: boolean;
307
+ _reset_circuit?: boolean;
305
308
  market?: MarketRel;
306
309
  customer?: CustomerRel;
307
310
  shipping_address?: AddressRel;
@@ -20,6 +20,7 @@ interface Organization extends Resource {
20
20
  max_concurrent_cleanups?: number;
21
21
  order_number_editable_test?: boolean;
22
22
  order_number_editable_live?: boolean;
23
+ config?: object;
23
24
  }
24
25
  declare class Organizations extends ApiResource {
25
26
  static readonly TYPE: 'organization';
@@ -20,20 +20,12 @@ interface ParcelLineItem extends Resource {
20
20
  image_url?: string;
21
21
  parcel?: Parcel;
22
22
  stock_line_item?: StockLineItem;
23
- /**
24
- * @deprecated This field should not be used as it may be removed in the future without notice
25
- */
26
- shipment_line_item?: object;
27
23
  versions?: Version[];
28
24
  }
29
25
  interface ParcelLineItemCreate extends ResourceCreate {
30
26
  quantity: number;
31
27
  parcel: ParcelRel;
32
28
  stock_line_item: StockLineItemRel;
33
- /**
34
- * @deprecated This field should not be used as it may be removed in the future without notice
35
- */
36
- shipment_line_item?: object;
37
29
  }
38
30
  type ParcelLineItemUpdate = ResourceUpdate;
39
31
  declare class ParcelLineItems extends ApiResource {
@@ -21,13 +21,13 @@ interface PaymentMethod extends Resource {
21
21
  require_capture?: boolean;
22
22
  auto_place?: boolean;
23
23
  auto_capture?: boolean;
24
- disabled_at?: string;
25
24
  price_amount_cents?: number;
26
25
  price_amount_float?: number;
27
26
  formatted_price_amount?: string;
28
27
  auto_capture_max_amount_cents?: number;
29
28
  auto_capture_max_amount_float?: number;
30
29
  formatted_auto_capture_max_amount?: string;
30
+ disabled_at?: string;
31
31
  market?: Market;
32
32
  payment_gateway?: PaymentGateway;
33
33
  attachments?: Attachment[];
@@ -40,10 +40,10 @@ interface PaymentMethodCreate extends ResourceCreate {
40
40
  require_capture?: boolean;
41
41
  auto_place?: boolean;
42
42
  auto_capture?: boolean;
43
- _disable?: boolean;
44
- _enable?: boolean;
45
43
  price_amount_cents: number;
46
44
  auto_capture_max_amount_cents?: number;
45
+ _disable?: boolean;
46
+ _enable?: boolean;
47
47
  market?: MarketRel;
48
48
  payment_gateway: PaymentGatewayRel;
49
49
  }
@@ -54,10 +54,10 @@ interface PaymentMethodUpdate extends ResourceUpdate {
54
54
  require_capture?: boolean;
55
55
  auto_place?: boolean;
56
56
  auto_capture?: boolean;
57
- _disable?: boolean;
58
- _enable?: boolean;
59
57
  price_amount_cents?: number;
60
58
  auto_capture_max_amount_cents?: number;
59
+ _disable?: boolean;
60
+ _enable?: boolean;
61
61
  market?: MarketRel;
62
62
  payment_gateway?: PaymentGatewayRel;
63
63
  }
@@ -9,6 +9,7 @@ import type { ShippingMethod } from './shipping_methods';
9
9
  import type { DeliveryLeadTime } from './delivery_lead_times';
10
10
  import type { StockLineItem } from './stock_line_items';
11
11
  import type { StockTransfer } from './stock_transfers';
12
+ import type { LineItem } from './line_items';
12
13
  import type { CarrierAccount } from './carrier_accounts';
13
14
  import type { Parcel } from './parcels';
14
15
  import type { Attachment } from './attachments';
@@ -67,12 +68,9 @@ interface Shipment extends Resource {
67
68
  shipping_address?: Address;
68
69
  shipping_method?: ShippingMethod;
69
70
  delivery_lead_time?: DeliveryLeadTime;
70
- /**
71
- * @deprecated This field should not be used as it may be removed in the future without notice
72
- */
73
- shipment_line_items?: object[];
74
71
  stock_line_items?: StockLineItem[];
75
72
  stock_transfers?: StockTransfer[];
73
+ line_items?: LineItem[];
76
74
  available_shipping_methods?: ShippingMethod[];
77
75
  carrier_accounts?: CarrierAccount[];
78
76
  parcels?: Parcel[];
@@ -125,6 +123,7 @@ declare class Shipments extends ApiResource {
125
123
  delivery_lead_time(shipmentId: string | Shipment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<DeliveryLeadTime>;
126
124
  stock_line_items(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockLineItem>>;
127
125
  stock_transfers(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockTransfer>>;
126
+ line_items(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<LineItem>>;
128
127
  available_shipping_methods(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<ShippingMethod>>;
129
128
  carrier_accounts(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<CarrierAccount>>;
130
129
  parcels(shipmentId: string | Shipment, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Parcel>>;
@@ -58,6 +58,10 @@ class Shipments extends resource_1.ApiResource {
58
58
  const _shipmentId = shipmentId.id || shipmentId;
59
59
  return this.resources.fetch({ type: 'stock_transfers' }, `shipments/${_shipmentId}/stock_transfers`, params, options);
60
60
  }
61
+ async line_items(shipmentId, params, options) {
62
+ const _shipmentId = shipmentId.id || shipmentId;
63
+ return this.resources.fetch({ type: 'line_items' }, `shipments/${_shipmentId}/line_items`, params, options);
64
+ }
61
65
  async available_shipping_methods(shipmentId, params, options) {
62
66
  const _shipmentId = shipmentId.id || shipmentId;
63
67
  return this.resources.fetch({ type: 'shipping_methods' }, `shipments/${_shipmentId}/available_shipping_methods`, params, options);
@@ -32,7 +32,6 @@ interface ShippingMethod extends Resource {
32
32
  scheme?: string;
33
33
  currency_code?: string;
34
34
  external_prices_url?: string;
35
- disabled_at?: string;
36
35
  price_amount_cents?: number;
37
36
  price_amount_float?: number;
38
37
  formatted_price_amount?: string;
@@ -46,6 +45,9 @@ interface ShippingMethod extends Resource {
46
45
  min_weight?: number;
47
46
  max_weight?: number;
48
47
  unit_of_weight?: string;
48
+ disabled_at?: string;
49
+ circuit_state?: string;
50
+ circuit_failure_count?: number;
49
51
  market?: Market;
50
52
  shipping_zone?: ShippingZone;
51
53
  shipping_category?: ShippingCategory;
@@ -61,14 +63,14 @@ interface ShippingMethodCreate extends ResourceCreate {
61
63
  scheme?: string;
62
64
  currency_code?: string;
63
65
  external_prices_url?: string;
64
- _disable?: boolean;
65
- _enable?: boolean;
66
66
  price_amount_cents: number;
67
67
  free_over_amount_cents?: number;
68
68
  use_subtotal?: boolean;
69
69
  min_weight?: number;
70
70
  max_weight?: number;
71
71
  unit_of_weight?: string;
72
+ _disable?: boolean;
73
+ _enable?: boolean;
72
74
  market?: MarketRel;
73
75
  shipping_zone?: ShippingZoneRel;
74
76
  shipping_category?: ShippingCategoryRel;
@@ -80,14 +82,15 @@ interface ShippingMethodUpdate extends ResourceUpdate {
80
82
  scheme?: string;
81
83
  currency_code?: string;
82
84
  external_prices_url?: string;
83
- _disable?: boolean;
84
- _enable?: boolean;
85
85
  price_amount_cents?: number;
86
86
  free_over_amount_cents?: number;
87
87
  use_subtotal?: boolean;
88
88
  min_weight?: number;
89
89
  max_weight?: number;
90
90
  unit_of_weight?: string;
91
+ _disable?: boolean;
92
+ _enable?: boolean;
93
+ _reset_circuit?: boolean;
91
94
  market?: MarketRel;
92
95
  shipping_zone?: ShippingZoneRel;
93
96
  shipping_category?: ShippingCategoryRel;
@@ -10,10 +10,10 @@ interface Webhook extends Resource {
10
10
  topic?: string;
11
11
  callback_url?: string;
12
12
  include_resources?: string[];
13
+ disabled_at?: string;
13
14
  circuit_state?: string;
14
15
  circuit_failure_count?: number;
15
16
  shared_secret?: string;
16
- disabled_at?: string;
17
17
  last_event_callbacks?: EventCallback[];
18
18
  versions?: Version[];
19
19
  }
@@ -30,9 +30,9 @@ interface WebhookUpdate extends ResourceUpdate {
30
30
  topic?: string;
31
31
  callback_url?: string;
32
32
  include_resources?: string[];
33
- _reset_circuit?: boolean;
34
33
  _disable?: boolean;
35
34
  _enable?: boolean;
35
+ _reset_circuit?: boolean;
36
36
  }
37
37
  declare class Webhooks extends ApiResource {
38
38
  static readonly TYPE: 'webhooks';
@@ -2,7 +2,7 @@ import * as api from './api';
2
2
  import { ApiError } from './error';
3
3
  import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
4
4
  import { ResourcesInitConfig } from './resource';
5
- declare const OPEN_API_SCHEMA_VERSION = "4.27.0";
5
+ declare const OPEN_API_SCHEMA_VERSION = "5.1.0";
6
6
  export { OPEN_API_SCHEMA_VERSION };
7
7
  type SdkConfig = {};
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.27.0";
13
+ readonly openApiSchemaVersion = "5.1.0";
14
14
  addresses: api.Addresses;
15
15
  adjustments: api.Adjustments;
16
16
  adyen_gateways: api.AdyenGateways;
@@ -16,7 +16,7 @@ import ResourceAdapter from './resource';
16
16
  import Debug from './debug';
17
17
  const debug = Debug('commercelayer');
18
18
  // Autogenerated schema version number, do not remove this line
19
- const OPEN_API_SCHEMA_VERSION = '4.27.0';
19
+ const OPEN_API_SCHEMA_VERSION = '5.1.0';
20
20
  export { OPEN_API_SCHEMA_VERSION };
21
21
  class CommerceLayerClient {
22
22
  static get openApiSchemaVersion() { return OPEN_API_SCHEMA_VERSION; }
@@ -10,17 +10,20 @@ interface Adjustment extends Resource {
10
10
  amount_cents?: number;
11
11
  amount_float?: number;
12
12
  formatted_amount?: string;
13
+ distribute_discount?: boolean;
13
14
  versions?: Version[];
14
15
  }
15
16
  interface AdjustmentCreate extends ResourceCreate {
16
17
  name: string;
17
18
  currency_code: string;
18
19
  amount_cents: number;
20
+ distribute_discount?: boolean;
19
21
  }
20
22
  interface AdjustmentUpdate extends ResourceUpdate {
21
23
  name?: string;
22
24
  currency_code?: string;
23
25
  amount_cents?: number;
26
+ distribute_discount?: boolean;
24
27
  }
25
28
  declare class Adjustments extends ApiResource {
26
29
  static readonly TYPE: 'adjustments';
@@ -1,21 +1,21 @@
1
1
  import { ApiResource, Resource, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
2
2
  import type { QueryParamsList, QueryParamsRetrieve } from '../query';
3
- import type { EventCallback } from './event_callbacks';
4
3
  import type { Webhook } from './webhooks';
4
+ import type { EventCallback } from './event_callbacks';
5
5
  type EventRel = ResourceRel & {
6
6
  type: typeof Events.TYPE;
7
7
  };
8
8
  interface Event extends Resource {
9
9
  name?: string;
10
- last_event_callbacks?: EventCallback[];
11
10
  webhooks?: Webhook[];
11
+ last_event_callbacks?: EventCallback[];
12
12
  }
13
13
  declare class Events extends ApiResource {
14
14
  static readonly TYPE: 'events';
15
15
  list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
16
16
  retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Event>;
17
- last_event_callbacks(eventId: string | Event, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<EventCallback>>;
18
17
  webhooks(eventId: string | Event, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Webhook>>;
18
+ last_event_callbacks(eventId: string | Event, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<EventCallback>>;
19
19
  isEvent(resource: any): resource is Event;
20
20
  relationship(id: string | ResourceId | null): EventRel;
21
21
  type(): string;
@@ -7,14 +7,14 @@ class Events extends ApiResource {
7
7
  async retrieve(id, params, options) {
8
8
  return this.resources.retrieve({ type: Events.TYPE, id }, params, options);
9
9
  }
10
- async last_event_callbacks(eventId, params, options) {
11
- const _eventId = eventId.id || eventId;
12
- return this.resources.fetch({ type: 'event_callbacks' }, `events/${_eventId}/last_event_callbacks`, params, options);
13
- }
14
10
  async webhooks(eventId, params, options) {
15
11
  const _eventId = eventId.id || eventId;
16
12
  return this.resources.fetch({ type: 'webhooks' }, `events/${_eventId}/webhooks`, params, options);
17
13
  }
14
+ async last_event_callbacks(eventId, params, options) {
15
+ const _eventId = eventId.id || eventId;
16
+ return this.resources.fetch({ type: 'event_callbacks' }, `events/${_eventId}/last_event_callbacks`, params, options);
17
+ }
18
18
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
19
19
  isEvent(resource) {
20
20
  return resource.type && (resource.type === Events.TYPE);
@@ -8,12 +8,14 @@ type ExternalGatewayRel = ResourceRel & {
8
8
  };
9
9
  interface ExternalGateway extends Resource {
10
10
  name?: string;
11
- shared_secret?: string;
12
11
  authorize_url?: string;
13
12
  capture_url?: string;
14
13
  void_url?: string;
15
14
  refund_url?: string;
16
15
  token_url?: string;
16
+ circuit_state?: string;
17
+ circuit_failure_count?: number;
18
+ shared_secret?: string;
17
19
  payment_methods?: PaymentMethod[];
18
20
  versions?: Version[];
19
21
  external_payments?: ExternalPayment[];
@@ -33,6 +35,7 @@ interface ExternalGatewayUpdate extends ResourceUpdate {
33
35
  void_url?: string;
34
36
  refund_url?: string;
35
37
  token_url?: string;
38
+ _reset_circuit?: boolean;
36
39
  }
37
40
  declare class ExternalGateways extends ApiResource {
38
41
  static readonly TYPE: 'external_gateways';
@@ -49,6 +49,8 @@ interface ExternalPromotion extends Resource {
49
49
  active?: boolean;
50
50
  disabled_at?: string;
51
51
  promotion_url?: string;
52
+ circuit_state?: string;
53
+ circuit_failure_count?: number;
52
54
  shared_secret?: string;
53
55
  market?: Market;
54
56
  promotion_rules?: PromotionRule[];
@@ -94,6 +96,7 @@ interface ExternalPromotionUpdate extends ResourceUpdate {
94
96
  _disable?: boolean;
95
97
  _enable?: boolean;
96
98
  promotion_url?: string;
99
+ _reset_circuit?: boolean;
97
100
  market?: MarketRel;
98
101
  order_amount_promotion_rule?: OrderAmountPromotionRuleRel;
99
102
  sku_list_promotion_rule?: SkuListPromotionRuleRel;
@@ -9,6 +9,8 @@ type ExternalTaxCalculatorRel = ResourceRel & {
9
9
  interface ExternalTaxCalculator extends Resource {
10
10
  name?: string;
11
11
  tax_calculator_url?: string;
12
+ circuit_state?: string;
13
+ circuit_failure_count?: number;
12
14
  shared_secret?: string;
13
15
  markets?: Market[];
14
16
  attachments?: Attachment[];
@@ -21,6 +23,7 @@ interface ExternalTaxCalculatorCreate extends ResourceCreate {
21
23
  interface ExternalTaxCalculatorUpdate extends ResourceUpdate {
22
24
  name?: string;
23
25
  tax_calculator_url?: string;
26
+ _reset_circuit?: boolean;
24
27
  }
25
28
  declare class ExternalTaxCalculators extends ApiResource {
26
29
  static readonly TYPE: 'external_tax_calculators';
@@ -89,16 +89,18 @@ interface LineItem extends Resource {
89
89
  item_type?: string;
90
90
  frequency?: string;
91
91
  coupon_code?: string;
92
+ circuit_state?: string;
93
+ circuit_failure_count?: number;
92
94
  order?: Order;
93
95
  item?: Adjustment | Bundle | ExternalPromotion | FixedAmountPromotion | FreeShippingPromotion | GiftCard | PaymentMethod | PercentageDiscountPromotion | Shipment | Sku;
94
96
  sku?: Sku;
95
97
  bundle?: Bundle;
98
+ adjustment?: Adjustment;
99
+ gift_card?: GiftCard;
100
+ shipment?: Shipment;
101
+ payment_method?: PaymentMethod;
96
102
  line_item_options?: LineItemOption[];
97
103
  return_line_items?: ReturnLineItem[];
98
- /**
99
- * @deprecated This field should not be used as it may be removed in the future without notice
100
- */
101
- shipment_line_items?: object[];
102
104
  stock_reservations?: StockReservation[];
103
105
  stock_line_items?: StockLineItem[];
104
106
  stock_transfers?: StockTransfer[];
@@ -122,6 +124,10 @@ interface LineItemCreate extends ResourceCreate {
122
124
  item?: AdjustmentRel | BundleRel | ExternalPromotionRel | FixedAmountPromotionRel | FreeShippingPromotionRel | GiftCardRel | PaymentMethodRel | PercentageDiscountPromotionRel | ShipmentRel | SkuRel;
123
125
  sku?: SkuRel;
124
126
  bundle?: BundleRel;
127
+ adjustment?: AdjustmentRel;
128
+ gift_card?: GiftCardRel;
129
+ shipment?: ShipmentRel;
130
+ payment_method?: PaymentMethodRel;
125
131
  tags?: TagRel[];
126
132
  }
127
133
  interface LineItemUpdate extends ResourceUpdate {
@@ -134,6 +140,7 @@ interface LineItemUpdate extends ResourceUpdate {
134
140
  name?: string;
135
141
  image_url?: string;
136
142
  frequency?: string;
143
+ _reset_circuit?: boolean;
137
144
  tags?: TagRel[];
138
145
  }
139
146
  declare class LineItems extends ApiResource {
@@ -37,9 +37,9 @@ interface Market extends Resource {
37
37
  checkout_url?: string;
38
38
  external_prices_url?: string;
39
39
  external_order_validation_url?: string;
40
- shared_secret?: string;
41
40
  private?: boolean;
42
41
  disabled_at?: string;
42
+ shared_secret?: string;
43
43
  merchant?: Merchant;
44
44
  price_list?: PriceList;
45
45
  inventory_model?: InventoryModel;
@@ -43,10 +43,6 @@ interface OrderSubscription extends Resource {
43
43
  customer_payment_source?: CustomerPaymentSource;
44
44
  order_subscription_items?: OrderSubscriptionItem[];
45
45
  order_factories?: OrderFactory[];
46
- /**
47
- * @deprecated This field should not be used as it may be removed in the future without notice
48
- */
49
- order_copies?: object[];
50
46
  recurring_order_copies?: RecurringOrderCopy[];
51
47
  orders?: Order[];
52
48
  events?: Event[];