@commercelayer/sdk 5.33.0 → 5.34.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.
- package/lib/cjs/commercelayer.d.ts +2 -2
- package/lib/cjs/commercelayer.js +1 -1
- package/lib/cjs/resources/adjustments.d.ts +3 -0
- package/lib/cjs/resources/external_gateways.d.ts +5 -1
- package/lib/cjs/resources/external_gateways.js +3 -0
- package/lib/cjs/resources/external_promotions.d.ts +4 -0
- package/lib/cjs/resources/external_promotions.js +3 -0
- package/lib/cjs/resources/external_tax_calculators.d.ts +4 -0
- package/lib/cjs/resources/external_tax_calculators.js +3 -0
- package/lib/cjs/resources/line_items.d.ts +12 -4
- package/lib/cjs/resources/line_items.js +3 -0
- package/lib/cjs/resources/markets.d.ts +1 -1
- package/lib/cjs/resources/order_subscriptions.d.ts +0 -4
- package/lib/cjs/resources/orders.d.ts +4 -0
- package/lib/cjs/resources/orders.js +3 -0
- package/lib/cjs/resources/parcel_line_items.d.ts +0 -8
- package/lib/cjs/resources/payment_methods.d.ts +5 -5
- package/lib/cjs/resources/shipments.d.ts +0 -4
- package/lib/cjs/resources/shipping_methods.d.ts +9 -5
- package/lib/cjs/resources/shipping_methods.js +3 -0
- package/lib/cjs/resources/webhooks.d.ts +3 -3
- package/lib/cjs/resources/webhooks.js +3 -3
- package/lib/esm/commercelayer.d.ts +2 -2
- package/lib/esm/commercelayer.js +1 -1
- package/lib/esm/resources/adjustments.d.ts +3 -0
- package/lib/esm/resources/external_gateways.d.ts +5 -1
- package/lib/esm/resources/external_gateways.js +3 -0
- package/lib/esm/resources/external_promotions.d.ts +4 -0
- package/lib/esm/resources/external_promotions.js +3 -0
- package/lib/esm/resources/external_tax_calculators.d.ts +4 -0
- package/lib/esm/resources/external_tax_calculators.js +3 -0
- package/lib/esm/resources/line_items.d.ts +12 -4
- package/lib/esm/resources/line_items.js +3 -0
- package/lib/esm/resources/markets.d.ts +1 -1
- package/lib/esm/resources/order_subscriptions.d.ts +0 -4
- package/lib/esm/resources/orders.d.ts +4 -0
- package/lib/esm/resources/orders.js +3 -0
- package/lib/esm/resources/parcel_line_items.d.ts +0 -8
- package/lib/esm/resources/payment_methods.d.ts +5 -5
- package/lib/esm/resources/shipments.d.ts +0 -4
- package/lib/esm/resources/shipping_methods.d.ts +9 -5
- package/lib/esm/resources/shipping_methods.js +3 -0
- package/lib/esm/resources/webhooks.d.ts +3 -3
- package/lib/esm/resources/webhooks.js +3 -3
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
@@ -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 = "
|
5
|
+
declare const OPEN_API_SCHEMA_VERSION = "5.0.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 = "
|
12
|
+
readonly openApiSchemaVersion = "5.0.0";
|
13
13
|
addresses: api.Addresses;
|
14
14
|
adjustments: api.Adjustments;
|
15
15
|
adyen_gateways: api.AdyenGateways;
|
package/lib/cjs/commercelayer.js
CHANGED
@@ -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 = '
|
48
|
+
const OPEN_API_SCHEMA_VERSION = '5.0.0';
|
49
49
|
exports.OPEN_API_SCHEMA_VERSION = OPEN_API_SCHEMA_VERSION;
|
50
50
|
class CommerceLayerClient {
|
51
51
|
// ##__CL_RESOURCES_DEF_STOP__##
|
@@ -13,17 +13,20 @@ interface Adjustment extends Resource {
|
|
13
13
|
amount_cents: number;
|
14
14
|
amount_float: number;
|
15
15
|
formatted_amount: string;
|
16
|
+
distribute_discount?: boolean | null;
|
16
17
|
versions?: Version[] | null;
|
17
18
|
}
|
18
19
|
interface AdjustmentCreate extends ResourceCreate {
|
19
20
|
name: string;
|
20
21
|
currency_code: string;
|
21
22
|
amount_cents: number;
|
23
|
+
distribute_discount?: boolean | null;
|
22
24
|
}
|
23
25
|
interface AdjustmentUpdate extends ResourceUpdate {
|
24
26
|
name?: string | null;
|
25
27
|
currency_code?: string | null;
|
26
28
|
amount_cents?: number | null;
|
29
|
+
distribute_discount?: boolean | null;
|
27
30
|
}
|
28
31
|
declare class Adjustments extends ApiResource<Adjustment> {
|
29
32
|
static readonly TYPE: AdjustmentType;
|
@@ -11,12 +11,14 @@ type ExternalGatewayRel = ResourceRel & {
|
|
11
11
|
interface ExternalGateway extends Resource {
|
12
12
|
readonly type: ExternalGatewayType;
|
13
13
|
name: string;
|
14
|
-
shared_secret: string;
|
15
14
|
authorize_url?: string | null;
|
16
15
|
capture_url?: string | null;
|
17
16
|
void_url?: string | null;
|
18
17
|
refund_url?: string | null;
|
19
18
|
token_url?: string | null;
|
19
|
+
circuit_state?: string | null;
|
20
|
+
circuit_failure_count?: number | null;
|
21
|
+
shared_secret: string;
|
20
22
|
payment_methods?: PaymentMethod[] | null;
|
21
23
|
versions?: Version[] | null;
|
22
24
|
external_payments?: ExternalPayment[] | null;
|
@@ -36,6 +38,7 @@ interface ExternalGatewayUpdate extends ResourceUpdate {
|
|
36
38
|
void_url?: string | null;
|
37
39
|
refund_url?: string | null;
|
38
40
|
token_url?: string | null;
|
41
|
+
_reset_circuit?: boolean | null;
|
39
42
|
}
|
40
43
|
declare class ExternalGateways extends ApiResource<ExternalGateway> {
|
41
44
|
static readonly TYPE: ExternalGatewayType;
|
@@ -45,6 +48,7 @@ declare class ExternalGateways extends ApiResource<ExternalGateway> {
|
|
45
48
|
payment_methods(externalGatewayId: string | ExternalGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PaymentMethod>>;
|
46
49
|
versions(externalGatewayId: string | ExternalGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
47
50
|
external_payments(externalGatewayId: string | ExternalGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<ExternalPayment>>;
|
51
|
+
_reset_circuit(id: string | ExternalGateway, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalGateway>;
|
48
52
|
isExternalGateway(resource: any): resource is ExternalGateway;
|
49
53
|
relationship(id: string | ResourceId | null): ExternalGatewayRel;
|
50
54
|
type(): ExternalGatewayType;
|
@@ -23,6 +23,9 @@ class ExternalGateways extends resource_1.ApiResource {
|
|
23
23
|
const _externalGatewayId = externalGatewayId.id || externalGatewayId;
|
24
24
|
return this.resources.fetch({ type: 'external_payments' }, `external_gateways/${_externalGatewayId}/external_payments`, params, options);
|
25
25
|
}
|
26
|
+
async _reset_circuit(id, params, options) {
|
27
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalGateways.TYPE, _reset_circuit: true }, params, options);
|
28
|
+
}
|
26
29
|
isExternalGateway(resource) {
|
27
30
|
return resource.type && (resource.type === ExternalGateways.TYPE);
|
28
31
|
}
|
@@ -52,6 +52,8 @@ interface ExternalPromotion extends Resource {
|
|
52
52
|
active?: boolean | null;
|
53
53
|
disabled_at?: string | null;
|
54
54
|
promotion_url: string;
|
55
|
+
circuit_state?: string | null;
|
56
|
+
circuit_failure_count?: number | null;
|
55
57
|
shared_secret: string;
|
56
58
|
market?: Market | null;
|
57
59
|
promotion_rules?: PromotionRule[] | null;
|
@@ -97,6 +99,7 @@ interface ExternalPromotionUpdate extends ResourceUpdate {
|
|
97
99
|
_disable?: boolean | null;
|
98
100
|
_enable?: boolean | null;
|
99
101
|
promotion_url?: string | null;
|
102
|
+
_reset_circuit?: boolean | null;
|
100
103
|
market?: MarketRel | null;
|
101
104
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
102
105
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
@@ -124,6 +127,7 @@ declare class ExternalPromotions extends ApiResource<ExternalPromotion> {
|
|
124
127
|
skus(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
125
128
|
_disable(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
126
129
|
_enable(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
130
|
+
_reset_circuit(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
127
131
|
isExternalPromotion(resource: any): resource is ExternalPromotion;
|
128
132
|
relationship(id: string | ResourceId | null): ExternalPromotionRel;
|
129
133
|
type(): ExternalPromotionType;
|
@@ -65,6 +65,9 @@ class ExternalPromotions extends resource_1.ApiResource {
|
|
65
65
|
async _enable(id, params, options) {
|
66
66
|
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _enable: true }, params, options);
|
67
67
|
}
|
68
|
+
async _reset_circuit(id, params, options) {
|
69
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _reset_circuit: true }, params, options);
|
70
|
+
}
|
68
71
|
isExternalPromotion(resource) {
|
69
72
|
return resource.type && (resource.type === ExternalPromotions.TYPE);
|
70
73
|
}
|
@@ -12,6 +12,8 @@ interface ExternalTaxCalculator extends Resource {
|
|
12
12
|
readonly type: ExternalTaxCalculatorType;
|
13
13
|
name: string;
|
14
14
|
tax_calculator_url: string;
|
15
|
+
circuit_state?: string | null;
|
16
|
+
circuit_failure_count?: number | null;
|
15
17
|
shared_secret: string;
|
16
18
|
markets?: Market[] | null;
|
17
19
|
attachments?: Attachment[] | null;
|
@@ -24,6 +26,7 @@ interface ExternalTaxCalculatorCreate extends ResourceCreate {
|
|
24
26
|
interface ExternalTaxCalculatorUpdate extends ResourceUpdate {
|
25
27
|
name?: string | null;
|
26
28
|
tax_calculator_url?: string | null;
|
29
|
+
_reset_circuit?: boolean | null;
|
27
30
|
}
|
28
31
|
declare class ExternalTaxCalculators extends ApiResource<ExternalTaxCalculator> {
|
29
32
|
static readonly TYPE: ExternalTaxCalculatorType;
|
@@ -33,6 +36,7 @@ declare class ExternalTaxCalculators extends ApiResource<ExternalTaxCalculator>
|
|
33
36
|
markets(externalTaxCalculatorId: string | ExternalTaxCalculator, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Market>>;
|
34
37
|
attachments(externalTaxCalculatorId: string | ExternalTaxCalculator, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
35
38
|
versions(externalTaxCalculatorId: string | ExternalTaxCalculator, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
39
|
+
_reset_circuit(id: string | ExternalTaxCalculator, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalTaxCalculator>;
|
36
40
|
isExternalTaxCalculator(resource: any): resource is ExternalTaxCalculator;
|
37
41
|
relationship(id: string | ResourceId | null): ExternalTaxCalculatorRel;
|
38
42
|
type(): ExternalTaxCalculatorType;
|
@@ -23,6 +23,9 @@ class ExternalTaxCalculators extends resource_1.ApiResource {
|
|
23
23
|
const _externalTaxCalculatorId = externalTaxCalculatorId.id || externalTaxCalculatorId;
|
24
24
|
return this.resources.fetch({ type: 'versions' }, `external_tax_calculators/${_externalTaxCalculatorId}/versions`, params, options);
|
25
25
|
}
|
26
|
+
async _reset_circuit(id, params, options) {
|
27
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalTaxCalculators.TYPE, _reset_circuit: true }, params, options);
|
28
|
+
}
|
26
29
|
isExternalTaxCalculator(resource) {
|
27
30
|
return resource.type && (resource.type === ExternalTaxCalculators.TYPE);
|
28
31
|
}
|
@@ -92,16 +92,18 @@ interface LineItem extends Resource {
|
|
92
92
|
item_type?: 'skus' | 'bundles' | 'shipments' | 'payment_methods' | 'adjustments' | 'gift_cards' | 'percentage_discount_promotions' | 'free_shipping_promotions' | 'free_gift_promotions' | 'fixed_price_promotions' | 'external_promotions' | 'fixed_amount_promotions' | null;
|
93
93
|
frequency?: string | null;
|
94
94
|
coupon_code?: string | null;
|
95
|
+
circuit_state?: string | null;
|
96
|
+
circuit_failure_count?: number | null;
|
95
97
|
order?: Order | null;
|
96
98
|
item?: Adjustment | Bundle | ExternalPromotion | FixedAmountPromotion | FreeShippingPromotion | GiftCard | PaymentMethod | PercentageDiscountPromotion | Shipment | Sku | null;
|
97
99
|
sku?: Sku | null;
|
98
100
|
bundle?: Bundle | null;
|
101
|
+
adjustment?: Adjustment | null;
|
102
|
+
gift_card?: GiftCard | null;
|
103
|
+
shipment?: Shipment | null;
|
104
|
+
payment_method?: PaymentMethod | null;
|
99
105
|
line_item_options?: LineItemOption[] | null;
|
100
106
|
return_line_items?: ReturnLineItem[] | null;
|
101
|
-
/**
|
102
|
-
* @deprecated This field should not be used as it may be removed in the future without notice
|
103
|
-
*/
|
104
|
-
shipment_line_items?: object[];
|
105
107
|
stock_reservations?: StockReservation[] | null;
|
106
108
|
stock_line_items?: StockLineItem[] | null;
|
107
109
|
stock_transfers?: StockTransfer[] | null;
|
@@ -125,6 +127,10 @@ interface LineItemCreate extends ResourceCreate {
|
|
125
127
|
item?: AdjustmentRel | BundleRel | ExternalPromotionRel | FixedAmountPromotionRel | FreeShippingPromotionRel | GiftCardRel | PaymentMethodRel | PercentageDiscountPromotionRel | ShipmentRel | SkuRel | null;
|
126
128
|
sku?: SkuRel | null;
|
127
129
|
bundle?: BundleRel | null;
|
130
|
+
adjustment?: AdjustmentRel | null;
|
131
|
+
gift_card?: GiftCardRel | null;
|
132
|
+
shipment?: ShipmentRel | null;
|
133
|
+
payment_method?: PaymentMethodRel | null;
|
128
134
|
tags?: TagRel[] | null;
|
129
135
|
}
|
130
136
|
interface LineItemUpdate extends ResourceUpdate {
|
@@ -137,6 +143,7 @@ interface LineItemUpdate extends ResourceUpdate {
|
|
137
143
|
name?: string | null;
|
138
144
|
image_url?: string | null;
|
139
145
|
frequency?: string | null;
|
146
|
+
_reset_circuit?: boolean | null;
|
140
147
|
tags?: TagRel[] | null;
|
141
148
|
}
|
142
149
|
declare class LineItems extends ApiResource<LineItem> {
|
@@ -154,6 +161,7 @@ declare class LineItems extends ApiResource<LineItem> {
|
|
154
161
|
tags(lineItemId: string | LineItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
155
162
|
_external_price(id: string | LineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
|
156
163
|
_reserve_stock(id: string | LineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
|
164
|
+
_reset_circuit(id: string | LineItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<LineItem>;
|
157
165
|
isLineItem(resource: any): resource is LineItem;
|
158
166
|
relationship(id: string | ResourceId | null): LineItemRel;
|
159
167
|
type(): LineItemType;
|
@@ -49,6 +49,9 @@ class LineItems extends resource_1.ApiResource {
|
|
49
49
|
async _reserve_stock(id, params, options) {
|
50
50
|
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: LineItems.TYPE, _reserve_stock: true }, params, options);
|
51
51
|
}
|
52
|
+
async _reset_circuit(id, params, options) {
|
53
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: LineItems.TYPE, _reset_circuit: true }, params, options);
|
54
|
+
}
|
52
55
|
isLineItem(resource) {
|
53
56
|
return resource.type && (resource.type === LineItems.TYPE);
|
54
57
|
}
|
@@ -40,9 +40,9 @@ interface Market extends Resource {
|
|
40
40
|
checkout_url?: string | null;
|
41
41
|
external_prices_url?: string | null;
|
42
42
|
external_order_validation_url?: string | null;
|
43
|
-
shared_secret: string;
|
44
43
|
private?: boolean | null;
|
45
44
|
disabled_at?: string | null;
|
45
|
+
shared_secret: string;
|
46
46
|
merchant?: Merchant | null;
|
47
47
|
price_list?: PriceList | null;
|
48
48
|
inventory_model?: InventoryModel | null;
|
@@ -46,10 +46,6 @@ interface OrderSubscription extends Resource {
|
|
46
46
|
customer_payment_source?: CustomerPaymentSource | null;
|
47
47
|
order_subscription_items?: OrderSubscriptionItem[] | null;
|
48
48
|
order_factories?: OrderFactory[] | null;
|
49
|
-
/**
|
50
|
-
* @deprecated This field should not be used as it may be removed in the future without notice
|
51
|
-
*/
|
52
|
-
order_copies?: object[];
|
53
49
|
recurring_order_copies?: RecurringOrderCopy[] | null;
|
54
50
|
orders?: Order[] | null;
|
55
51
|
events?: Event[] | null;
|
@@ -197,6 +197,8 @@ interface Order extends Resource {
|
|
197
197
|
archived_at?: string | null;
|
198
198
|
expires_at?: string | null;
|
199
199
|
subscription_created_at?: string | null;
|
200
|
+
circuit_state?: string | null;
|
201
|
+
circuit_failure_count?: number | null;
|
200
202
|
market?: Market | null;
|
201
203
|
customer?: Customer | null;
|
202
204
|
shipping_address?: Address | null;
|
@@ -305,6 +307,7 @@ interface OrderUpdate extends ResourceUpdate {
|
|
305
307
|
_create_subscriptions?: boolean | null;
|
306
308
|
_start_editing?: boolean | null;
|
307
309
|
_stop_editing?: boolean | null;
|
310
|
+
_reset_circuit?: boolean | null;
|
308
311
|
market?: MarketRel | null;
|
309
312
|
customer?: CustomerRel | null;
|
310
313
|
shipping_address?: AddressRel | null;
|
@@ -377,6 +380,7 @@ declare class Orders extends ApiResource<Order> {
|
|
377
380
|
_create_subscriptions(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
378
381
|
_start_editing(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
379
382
|
_stop_editing(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
383
|
+
_reset_circuit(id: string | Order, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
380
384
|
isOrder(resource: any): resource is Order;
|
381
385
|
relationship(id: string | ResourceId | null): OrderRel;
|
382
386
|
type(): OrderType;
|
@@ -219,6 +219,9 @@ class Orders extends resource_1.ApiResource {
|
|
219
219
|
async _stop_editing(id, params, options) {
|
220
220
|
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _stop_editing: true }, params, options);
|
221
221
|
}
|
222
|
+
async _reset_circuit(id, params, options) {
|
223
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Orders.TYPE, _reset_circuit: true }, params, options);
|
224
|
+
}
|
222
225
|
isOrder(resource) {
|
223
226
|
return resource.type && (resource.type === Orders.TYPE);
|
224
227
|
}
|
@@ -23,20 +23,12 @@ interface ParcelLineItem extends Resource {
|
|
23
23
|
image_url?: string | null;
|
24
24
|
parcel?: Parcel | null;
|
25
25
|
stock_line_item?: StockLineItem | null;
|
26
|
-
/**
|
27
|
-
* @deprecated This field should not be used as it may be removed in the future without notice
|
28
|
-
*/
|
29
|
-
shipment_line_item?: object;
|
30
26
|
versions?: Version[] | null;
|
31
27
|
}
|
32
28
|
interface ParcelLineItemCreate extends ResourceCreate {
|
33
29
|
quantity: number;
|
34
30
|
parcel: ParcelRel;
|
35
31
|
stock_line_item: StockLineItemRel;
|
36
|
-
/**
|
37
|
-
* @deprecated This field should not be used as it may be removed in the future without notice
|
38
|
-
*/
|
39
|
-
shipment_line_item?: object;
|
40
32
|
}
|
41
33
|
type ParcelLineItemUpdate = ResourceUpdate;
|
42
34
|
declare class ParcelLineItems extends ApiResource<ParcelLineItem> {
|
@@ -24,13 +24,13 @@ interface PaymentMethod extends Resource {
|
|
24
24
|
require_capture?: boolean | null;
|
25
25
|
auto_place?: boolean | null;
|
26
26
|
auto_capture?: boolean | null;
|
27
|
-
disabled_at?: string | null;
|
28
27
|
price_amount_cents: number;
|
29
28
|
price_amount_float?: number | null;
|
30
29
|
formatted_price_amount?: string | null;
|
31
30
|
auto_capture_max_amount_cents?: number | null;
|
32
31
|
auto_capture_max_amount_float?: number | null;
|
33
32
|
formatted_auto_capture_max_amount?: string | null;
|
33
|
+
disabled_at?: string | null;
|
34
34
|
market?: Market | null;
|
35
35
|
payment_gateway?: PaymentGateway | null;
|
36
36
|
attachments?: Attachment[] | null;
|
@@ -43,10 +43,10 @@ interface PaymentMethodCreate extends ResourceCreate {
|
|
43
43
|
require_capture?: boolean | null;
|
44
44
|
auto_place?: boolean | null;
|
45
45
|
auto_capture?: boolean | null;
|
46
|
-
_disable?: boolean | null;
|
47
|
-
_enable?: boolean | null;
|
48
46
|
price_amount_cents: number;
|
49
47
|
auto_capture_max_amount_cents?: number | null;
|
48
|
+
_disable?: boolean | null;
|
49
|
+
_enable?: boolean | null;
|
50
50
|
market?: MarketRel | null;
|
51
51
|
payment_gateway: PaymentGatewayRel;
|
52
52
|
}
|
@@ -57,10 +57,10 @@ interface PaymentMethodUpdate extends ResourceUpdate {
|
|
57
57
|
require_capture?: boolean | null;
|
58
58
|
auto_place?: boolean | null;
|
59
59
|
auto_capture?: boolean | null;
|
60
|
-
_disable?: boolean | null;
|
61
|
-
_enable?: boolean | null;
|
62
60
|
price_amount_cents?: number | null;
|
63
61
|
auto_capture_max_amount_cents?: number | null;
|
62
|
+
_disable?: boolean | null;
|
63
|
+
_enable?: boolean | null;
|
64
64
|
market?: MarketRel | null;
|
65
65
|
payment_gateway?: PaymentGatewayRel | null;
|
66
66
|
}
|
@@ -70,10 +70,6 @@ interface Shipment extends Resource {
|
|
70
70
|
shipping_address?: Address | null;
|
71
71
|
shipping_method?: ShippingMethod | null;
|
72
72
|
delivery_lead_time?: DeliveryLeadTime | null;
|
73
|
-
/**
|
74
|
-
* @deprecated This field should not be used as it may be removed in the future without notice
|
75
|
-
*/
|
76
|
-
shipment_line_items?: object[];
|
77
73
|
stock_line_items?: StockLineItem[] | null;
|
78
74
|
stock_transfers?: StockTransfer[] | null;
|
79
75
|
available_shipping_methods?: ShippingMethod[] | null;
|
@@ -35,7 +35,6 @@ interface ShippingMethod extends Resource {
|
|
35
35
|
scheme?: string | null;
|
36
36
|
currency_code?: string | null;
|
37
37
|
external_prices_url?: string | null;
|
38
|
-
disabled_at?: string | null;
|
39
38
|
price_amount_cents: number;
|
40
39
|
price_amount_float?: number | null;
|
41
40
|
formatted_price_amount?: string | null;
|
@@ -49,6 +48,9 @@ interface ShippingMethod extends Resource {
|
|
49
48
|
min_weight?: number | null;
|
50
49
|
max_weight?: number | null;
|
51
50
|
unit_of_weight?: string | null;
|
51
|
+
disabled_at?: string | null;
|
52
|
+
circuit_state?: string | null;
|
53
|
+
circuit_failure_count?: number | null;
|
52
54
|
market?: Market | null;
|
53
55
|
shipping_zone?: ShippingZone | null;
|
54
56
|
shipping_category?: ShippingCategory | null;
|
@@ -64,14 +66,14 @@ interface ShippingMethodCreate extends ResourceCreate {
|
|
64
66
|
scheme?: string | null;
|
65
67
|
currency_code?: string | null;
|
66
68
|
external_prices_url?: string | null;
|
67
|
-
_disable?: boolean | null;
|
68
|
-
_enable?: boolean | null;
|
69
69
|
price_amount_cents: number;
|
70
70
|
free_over_amount_cents?: number | null;
|
71
71
|
use_subtotal?: boolean | null;
|
72
72
|
min_weight?: number | null;
|
73
73
|
max_weight?: number | null;
|
74
74
|
unit_of_weight?: string | null;
|
75
|
+
_disable?: boolean | null;
|
76
|
+
_enable?: boolean | null;
|
75
77
|
market?: MarketRel | null;
|
76
78
|
shipping_zone?: ShippingZoneRel | null;
|
77
79
|
shipping_category?: ShippingCategoryRel | null;
|
@@ -83,14 +85,15 @@ interface ShippingMethodUpdate extends ResourceUpdate {
|
|
83
85
|
scheme?: string | null;
|
84
86
|
currency_code?: string | null;
|
85
87
|
external_prices_url?: string | null;
|
86
|
-
_disable?: boolean | null;
|
87
|
-
_enable?: boolean | null;
|
88
88
|
price_amount_cents?: number | null;
|
89
89
|
free_over_amount_cents?: number | null;
|
90
90
|
use_subtotal?: boolean | null;
|
91
91
|
min_weight?: number | null;
|
92
92
|
max_weight?: number | null;
|
93
93
|
unit_of_weight?: string | null;
|
94
|
+
_disable?: boolean | null;
|
95
|
+
_enable?: boolean | null;
|
96
|
+
_reset_circuit?: boolean | null;
|
94
97
|
market?: MarketRel | null;
|
95
98
|
shipping_zone?: ShippingZoneRel | null;
|
96
99
|
shipping_category?: ShippingCategoryRel | null;
|
@@ -113,6 +116,7 @@ declare class ShippingMethods extends ApiResource<ShippingMethod> {
|
|
113
116
|
versions(shippingMethodId: string | ShippingMethod, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
114
117
|
_disable(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
|
115
118
|
_enable(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
|
119
|
+
_reset_circuit(id: string | ShippingMethod, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ShippingMethod>;
|
116
120
|
isShippingMethod(resource: any): resource is ShippingMethod;
|
117
121
|
relationship(id: string | ResourceId | null): ShippingMethodRel;
|
118
122
|
type(): ShippingMethodType;
|
@@ -53,6 +53,9 @@ class ShippingMethods extends resource_1.ApiResource {
|
|
53
53
|
async _enable(id, params, options) {
|
54
54
|
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ShippingMethods.TYPE, _enable: true }, params, options);
|
55
55
|
}
|
56
|
+
async _reset_circuit(id, params, options) {
|
57
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ShippingMethods.TYPE, _reset_circuit: true }, params, options);
|
58
|
+
}
|
56
59
|
isShippingMethod(resource) {
|
57
60
|
return resource.type && (resource.type === ShippingMethods.TYPE);
|
58
61
|
}
|
@@ -13,10 +13,10 @@ interface Webhook extends Resource {
|
|
13
13
|
topic: string;
|
14
14
|
callback_url: string;
|
15
15
|
include_resources?: string[] | null;
|
16
|
+
disabled_at?: string | null;
|
16
17
|
circuit_state?: string | null;
|
17
18
|
circuit_failure_count?: number | null;
|
18
19
|
shared_secret: string;
|
19
|
-
disabled_at?: string | null;
|
20
20
|
last_event_callbacks?: EventCallback[] | null;
|
21
21
|
versions?: Version[] | null;
|
22
22
|
}
|
@@ -33,9 +33,9 @@ interface WebhookUpdate extends ResourceUpdate {
|
|
33
33
|
topic?: string | null;
|
34
34
|
callback_url?: string | null;
|
35
35
|
include_resources?: string[] | null;
|
36
|
-
_reset_circuit?: boolean | null;
|
37
36
|
_disable?: boolean | null;
|
38
37
|
_enable?: boolean | null;
|
38
|
+
_reset_circuit?: boolean | null;
|
39
39
|
}
|
40
40
|
declare class Webhooks extends ApiResource<Webhook> {
|
41
41
|
static readonly TYPE: WebhookType;
|
@@ -44,9 +44,9 @@ declare class Webhooks extends ApiResource<Webhook> {
|
|
44
44
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
45
45
|
last_event_callbacks(webhookId: string | Webhook, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<EventCallback>>;
|
46
46
|
versions(webhookId: string | Webhook, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
47
|
-
_reset_circuit(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
48
47
|
_disable(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
49
48
|
_enable(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
49
|
+
_reset_circuit(id: string | Webhook, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Webhook>;
|
50
50
|
isWebhook(resource: any): resource is Webhook;
|
51
51
|
relationship(id: string | ResourceId | null): WebhookRel;
|
52
52
|
type(): WebhookType;
|
@@ -19,15 +19,15 @@ class Webhooks extends resource_1.ApiResource {
|
|
19
19
|
const _webhookId = webhookId.id || webhookId;
|
20
20
|
return this.resources.fetch({ type: 'versions' }, `webhooks/${_webhookId}/versions`, params, options);
|
21
21
|
}
|
22
|
-
async _reset_circuit(id, params, options) {
|
23
|
-
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _reset_circuit: true }, params, options);
|
24
|
-
}
|
25
22
|
async _disable(id, params, options) {
|
26
23
|
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _disable: true }, params, options);
|
27
24
|
}
|
28
25
|
async _enable(id, params, options) {
|
29
26
|
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _enable: true }, params, options);
|
30
27
|
}
|
28
|
+
async _reset_circuit(id, params, options) {
|
29
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: Webhooks.TYPE, _reset_circuit: true }, params, options);
|
30
|
+
}
|
31
31
|
isWebhook(resource) {
|
32
32
|
return resource.type && (resource.type === Webhooks.TYPE);
|
33
33
|
}
|
@@ -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 = "
|
5
|
+
declare const OPEN_API_SCHEMA_VERSION = "5.0.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 = "
|
12
|
+
readonly openApiSchemaVersion = "5.0.0";
|
13
13
|
addresses: api.Addresses;
|
14
14
|
adjustments: api.Adjustments;
|
15
15
|
adyen_gateways: api.AdyenGateways;
|
package/lib/esm/commercelayer.js
CHANGED
@@ -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 = '
|
19
|
+
const OPEN_API_SCHEMA_VERSION = '5.0.0';
|
20
20
|
export { OPEN_API_SCHEMA_VERSION };
|
21
21
|
class CommerceLayerClient {
|
22
22
|
// ##__CL_RESOURCES_DEF_STOP__##
|
@@ -13,17 +13,20 @@ interface Adjustment extends Resource {
|
|
13
13
|
amount_cents: number;
|
14
14
|
amount_float: number;
|
15
15
|
formatted_amount: string;
|
16
|
+
distribute_discount?: boolean | null;
|
16
17
|
versions?: Version[] | null;
|
17
18
|
}
|
18
19
|
interface AdjustmentCreate extends ResourceCreate {
|
19
20
|
name: string;
|
20
21
|
currency_code: string;
|
21
22
|
amount_cents: number;
|
23
|
+
distribute_discount?: boolean | null;
|
22
24
|
}
|
23
25
|
interface AdjustmentUpdate extends ResourceUpdate {
|
24
26
|
name?: string | null;
|
25
27
|
currency_code?: string | null;
|
26
28
|
amount_cents?: number | null;
|
29
|
+
distribute_discount?: boolean | null;
|
27
30
|
}
|
28
31
|
declare class Adjustments extends ApiResource<Adjustment> {
|
29
32
|
static readonly TYPE: AdjustmentType;
|
@@ -11,12 +11,14 @@ type ExternalGatewayRel = ResourceRel & {
|
|
11
11
|
interface ExternalGateway extends Resource {
|
12
12
|
readonly type: ExternalGatewayType;
|
13
13
|
name: string;
|
14
|
-
shared_secret: string;
|
15
14
|
authorize_url?: string | null;
|
16
15
|
capture_url?: string | null;
|
17
16
|
void_url?: string | null;
|
18
17
|
refund_url?: string | null;
|
19
18
|
token_url?: string | null;
|
19
|
+
circuit_state?: string | null;
|
20
|
+
circuit_failure_count?: number | null;
|
21
|
+
shared_secret: string;
|
20
22
|
payment_methods?: PaymentMethod[] | null;
|
21
23
|
versions?: Version[] | null;
|
22
24
|
external_payments?: ExternalPayment[] | null;
|
@@ -36,6 +38,7 @@ interface ExternalGatewayUpdate extends ResourceUpdate {
|
|
36
38
|
void_url?: string | null;
|
37
39
|
refund_url?: string | null;
|
38
40
|
token_url?: string | null;
|
41
|
+
_reset_circuit?: boolean | null;
|
39
42
|
}
|
40
43
|
declare class ExternalGateways extends ApiResource<ExternalGateway> {
|
41
44
|
static readonly TYPE: ExternalGatewayType;
|
@@ -45,6 +48,7 @@ declare class ExternalGateways extends ApiResource<ExternalGateway> {
|
|
45
48
|
payment_methods(externalGatewayId: string | ExternalGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PaymentMethod>>;
|
46
49
|
versions(externalGatewayId: string | ExternalGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
47
50
|
external_payments(externalGatewayId: string | ExternalGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<ExternalPayment>>;
|
51
|
+
_reset_circuit(id: string | ExternalGateway, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalGateway>;
|
48
52
|
isExternalGateway(resource: any): resource is ExternalGateway;
|
49
53
|
relationship(id: string | ResourceId | null): ExternalGatewayRel;
|
50
54
|
type(): ExternalGatewayType;
|
@@ -21,6 +21,9 @@ class ExternalGateways extends ApiResource {
|
|
21
21
|
const _externalGatewayId = externalGatewayId.id || externalGatewayId;
|
22
22
|
return this.resources.fetch({ type: 'external_payments' }, `external_gateways/${_externalGatewayId}/external_payments`, params, options);
|
23
23
|
}
|
24
|
+
async _reset_circuit(id, params, options) {
|
25
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalGateways.TYPE, _reset_circuit: true }, params, options);
|
26
|
+
}
|
24
27
|
isExternalGateway(resource) {
|
25
28
|
return resource.type && (resource.type === ExternalGateways.TYPE);
|
26
29
|
}
|
@@ -52,6 +52,8 @@ interface ExternalPromotion extends Resource {
|
|
52
52
|
active?: boolean | null;
|
53
53
|
disabled_at?: string | null;
|
54
54
|
promotion_url: string;
|
55
|
+
circuit_state?: string | null;
|
56
|
+
circuit_failure_count?: number | null;
|
55
57
|
shared_secret: string;
|
56
58
|
market?: Market | null;
|
57
59
|
promotion_rules?: PromotionRule[] | null;
|
@@ -97,6 +99,7 @@ interface ExternalPromotionUpdate extends ResourceUpdate {
|
|
97
99
|
_disable?: boolean | null;
|
98
100
|
_enable?: boolean | null;
|
99
101
|
promotion_url?: string | null;
|
102
|
+
_reset_circuit?: boolean | null;
|
100
103
|
market?: MarketRel | null;
|
101
104
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
102
105
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
@@ -124,6 +127,7 @@ declare class ExternalPromotions extends ApiResource<ExternalPromotion> {
|
|
124
127
|
skus(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
125
128
|
_disable(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
126
129
|
_enable(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
130
|
+
_reset_circuit(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
127
131
|
isExternalPromotion(resource: any): resource is ExternalPromotion;
|
128
132
|
relationship(id: string | ResourceId | null): ExternalPromotionRel;
|
129
133
|
type(): ExternalPromotionType;
|
@@ -63,6 +63,9 @@ class ExternalPromotions extends ApiResource {
|
|
63
63
|
async _enable(id, params, options) {
|
64
64
|
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _enable: true }, params, options);
|
65
65
|
}
|
66
|
+
async _reset_circuit(id, params, options) {
|
67
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _reset_circuit: true }, params, options);
|
68
|
+
}
|
66
69
|
isExternalPromotion(resource) {
|
67
70
|
return resource.type && (resource.type === ExternalPromotions.TYPE);
|
68
71
|
}
|
@@ -12,6 +12,8 @@ interface ExternalTaxCalculator extends Resource {
|
|
12
12
|
readonly type: ExternalTaxCalculatorType;
|
13
13
|
name: string;
|
14
14
|
tax_calculator_url: string;
|
15
|
+
circuit_state?: string | null;
|
16
|
+
circuit_failure_count?: number | null;
|
15
17
|
shared_secret: string;
|
16
18
|
markets?: Market[] | null;
|
17
19
|
attachments?: Attachment[] | null;
|
@@ -24,6 +26,7 @@ interface ExternalTaxCalculatorCreate extends ResourceCreate {
|
|
24
26
|
interface ExternalTaxCalculatorUpdate extends ResourceUpdate {
|
25
27
|
name?: string | null;
|
26
28
|
tax_calculator_url?: string | null;
|
29
|
+
_reset_circuit?: boolean | null;
|
27
30
|
}
|
28
31
|
declare class ExternalTaxCalculators extends ApiResource<ExternalTaxCalculator> {
|
29
32
|
static readonly TYPE: ExternalTaxCalculatorType;
|
@@ -33,6 +36,7 @@ declare class ExternalTaxCalculators extends ApiResource<ExternalTaxCalculator>
|
|
33
36
|
markets(externalTaxCalculatorId: string | ExternalTaxCalculator, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Market>>;
|
34
37
|
attachments(externalTaxCalculatorId: string | ExternalTaxCalculator, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
35
38
|
versions(externalTaxCalculatorId: string | ExternalTaxCalculator, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
39
|
+
_reset_circuit(id: string | ExternalTaxCalculator, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalTaxCalculator>;
|
36
40
|
isExternalTaxCalculator(resource: any): resource is ExternalTaxCalculator;
|
37
41
|
relationship(id: string | ResourceId | null): ExternalTaxCalculatorRel;
|
38
42
|
type(): ExternalTaxCalculatorType;
|