@commercelayer/sdk 6.0.0-alfa.4 → 6.0.0-alfa.5
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/client.d.ts +6 -14
- package/lib/cjs/client.js +57 -68
- package/lib/cjs/commercelayer.d.ts +126 -125
- package/lib/cjs/commercelayer.js +277 -143
- package/lib/cjs/error.d.ts +2 -3
- package/lib/cjs/error.js +40 -33
- package/lib/cjs/fetch.d.ts +13 -0
- package/lib/cjs/fetch.js +67 -0
- package/lib/cjs/interceptor.d.ts +24 -12
- package/lib/cjs/query.d.ts +2 -1
- package/lib/cjs/query.js +8 -2
- package/lib/cjs/resource.d.ts +0 -5
- package/lib/cjs/resource.js +36 -30
- package/lib/esm/client.d.ts +6 -14
- package/lib/esm/client.js +55 -68
- package/lib/esm/commercelayer.d.ts +126 -125
- package/lib/esm/commercelayer.js +274 -264
- package/lib/esm/error.d.ts +2 -3
- package/lib/esm/error.js +40 -31
- package/lib/esm/fetch.d.ts +13 -0
- package/lib/esm/fetch.js +46 -0
- package/lib/esm/interceptor.d.ts +24 -12
- package/lib/esm/query.d.ts +2 -1
- package/lib/esm/query.js +7 -2
- package/lib/esm/resource.d.ts +0 -5
- package/lib/esm/resource.js +36 -30
- package/lib/esm/util.js +5 -5
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -12
package/lib/cjs/client.d.ts
CHANGED
@@ -1,19 +1,11 @@
|
|
1
|
-
import type { AxiosAdapter, AxiosProxyConfig, Method } from 'axios';
|
2
1
|
import type { InterceptorManager } from './interceptor';
|
3
|
-
type
|
4
|
-
type Adapter = AxiosAdapter;
|
2
|
+
import { type FetchResponse } from './fetch';
|
5
3
|
type RequestParams = Record<string, string | number | boolean>;
|
6
4
|
type RequestHeaders = Record<string, string>;
|
7
5
|
type RequestConfig = {
|
8
6
|
timeout?: number;
|
9
7
|
params?: RequestParams;
|
10
|
-
httpAgent?: any;
|
11
|
-
httpsAgent?: any;
|
12
|
-
proxy?: ProxyConfig;
|
13
8
|
headers?: RequestHeaders;
|
14
|
-
};
|
15
|
-
type RequestConfigExtra = {
|
16
|
-
adapter?: Adapter;
|
17
9
|
userAgent?: string;
|
18
10
|
};
|
19
11
|
type ApiConfig = {
|
@@ -21,18 +13,18 @@ type ApiConfig = {
|
|
21
13
|
domain?: string;
|
22
14
|
accessToken: string;
|
23
15
|
};
|
24
|
-
type ApiClientInitConfig = ApiConfig & RequestConfig
|
16
|
+
type ApiClientInitConfig = ApiConfig & RequestConfig;
|
25
17
|
type ApiClientConfig = Partial<ApiClientInitConfig>;
|
18
|
+
export type Method = 'GET' | 'DELETE' | 'POST' | 'PUT' | 'PATCH';
|
26
19
|
declare class ApiClient {
|
27
20
|
#private;
|
28
21
|
static create(options: ApiClientInitConfig): ApiClient;
|
29
|
-
baseUrl: string;
|
30
|
-
interceptors: InterceptorManager;
|
31
22
|
private constructor();
|
23
|
+
get interceptors(): InterceptorManager;
|
24
|
+
get requestHeaders(): RequestHeaders;
|
32
25
|
config(config: ApiClientConfig): ApiClient;
|
33
26
|
userAgent(userAgent: string): ApiClient;
|
34
|
-
|
35
|
-
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
|
27
|
+
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<FetchResponse>;
|
36
28
|
private customHeaders;
|
37
29
|
}
|
38
30
|
export default ApiClient;
|
package/lib/cjs/client.js
CHANGED
@@ -13,14 +13,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
13
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
15
|
};
|
16
|
-
var _ApiClient_accessToken,
|
16
|
+
var _ApiClient_baseUrl, _ApiClient_accessToken, _ApiClient_clientConfig, _ApiClient_interceptors;
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
const axios_1 = __importDefault(require("axios"));
|
19
18
|
const error_1 = require("./error");
|
20
19
|
const config_1 = __importDefault(require("./config"));
|
21
|
-
|
22
|
-
// import type { Agent as HttpsAgent } from 'https'
|
23
|
-
// import { packageInfo } from './util'
|
20
|
+
const fetch_1 = require("./fetch");
|
24
21
|
const debug_1 = __importDefault(require("./debug"));
|
25
22
|
const debug = (0, debug_1.default)('client');
|
26
23
|
const baseURL = (organization, domain) => {
|
@@ -34,16 +31,17 @@ class ApiClient {
|
|
34
31
|
return new ApiClient(options);
|
35
32
|
}
|
36
33
|
constructor(options) {
|
34
|
+
_ApiClient_baseUrl.set(this, void 0);
|
37
35
|
_ApiClient_accessToken.set(this, void 0);
|
38
|
-
|
36
|
+
_ApiClient_clientConfig.set(this, void 0);
|
37
|
+
_ApiClient_interceptors.set(this, void 0);
|
39
38
|
debug('new client instance %O', options);
|
40
|
-
this
|
39
|
+
__classPrivateFieldSet(this, _ApiClient_baseUrl, baseURL(options.organization, options.domain), "f");
|
41
40
|
__classPrivateFieldSet(this, _ApiClient_accessToken, options.accessToken, "f");
|
42
|
-
const
|
41
|
+
const fetchConfig = {
|
43
42
|
timeout: options.timeout || config_1.default.client.timeout,
|
44
|
-
|
45
|
-
|
46
|
-
httpsAgent: options.httpsAgent
|
43
|
+
// httpAgent: options.httpAgent,
|
44
|
+
// httpsAgent: options.httpsAgent
|
47
45
|
};
|
48
46
|
// Set custom headers
|
49
47
|
const customHeaders = this.customHeaders(options.headers);
|
@@ -55,90 +53,81 @@ class ApiClient {
|
|
55
53
|
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
|
56
54
|
};
|
57
55
|
// Set User-Agent
|
58
|
-
|
59
|
-
if (userAgent)
|
60
|
-
if (!userAgent.includes('axios/'))
|
61
|
-
userAgent += ` axios/${axios_1.default.VERSION}`;
|
56
|
+
const userAgent = options.userAgent;
|
57
|
+
if (userAgent)
|
62
58
|
headers['User-Agent'] = userAgent;
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
59
|
+
fetchConfig.headers = headers;
|
60
|
+
__classPrivateFieldSet(this, _ApiClient_clientConfig, fetchConfig, "f");
|
61
|
+
debug('fetch config: %O', fetchConfig);
|
62
|
+
// Interceptors
|
63
|
+
__classPrivateFieldSet(this, _ApiClient_interceptors, {}, "f");
|
64
|
+
}
|
65
|
+
get interceptors() { return __classPrivateFieldGet(this, _ApiClient_interceptors, "f"); }
|
66
|
+
get requestHeaders() {
|
67
|
+
if (!__classPrivateFieldGet(this, _ApiClient_clientConfig, "f").headers)
|
68
|
+
__classPrivateFieldGet(this, _ApiClient_clientConfig, "f").headers = {};
|
69
|
+
return __classPrivateFieldGet(this, _ApiClient_clientConfig, "f").headers;
|
70
|
+
}
|
71
|
+
/*
|
72
|
+
set requestHeaders(headers: RequestHeaders) {
|
73
|
+
this.#clientConfig.headers = { ...this.#clientConfig.headers, ...headers }
|
75
74
|
}
|
75
|
+
*/
|
76
76
|
config(config) {
|
77
77
|
debug('config %o', config);
|
78
|
-
const def = __classPrivateFieldGet(this,
|
79
|
-
|
78
|
+
const def = __classPrivateFieldGet(this, _ApiClient_clientConfig, "f");
|
79
|
+
if (!def.headers)
|
80
|
+
def.headers = {};
|
81
|
+
// Client config
|
80
82
|
if (config.timeout)
|
81
83
|
def.timeout = config.timeout;
|
82
|
-
if (config.
|
83
|
-
|
84
|
-
if (config.httpAgent)
|
85
|
-
def.httpAgent = config.httpAgent;
|
86
|
-
if (config.httpsAgent)
|
87
|
-
def.httpsAgent = config.httpsAgent;
|
88
|
-
if (config.adapter)
|
89
|
-
this.adapter(config.adapter);
|
84
|
+
// if (config.httpAgent) def.httpAgent = config.httpAgent
|
85
|
+
// if (config.httpsAgent) def.httpsAgent = config.httpsAgent
|
90
86
|
if (config.userAgent)
|
91
87
|
this.userAgent(config.userAgent);
|
92
88
|
// API Client config
|
93
89
|
if (config.organization)
|
94
|
-
this
|
90
|
+
__classPrivateFieldSet(this, _ApiClient_baseUrl, baseURL(config.organization, config.domain), "f");
|
95
91
|
if (config.accessToken) {
|
96
92
|
__classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
|
97
|
-
def.headers.
|
93
|
+
def.headers.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
98
94
|
}
|
99
95
|
if (config.headers)
|
100
|
-
def.headers
|
96
|
+
def.headers = { ...def.headers, ...this.customHeaders(config.headers) };
|
101
97
|
return this;
|
102
98
|
}
|
103
99
|
userAgent(userAgent) {
|
104
|
-
if (userAgent)
|
105
|
-
|
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
|
-
}
|
113
|
-
return this;
|
114
|
-
}
|
115
|
-
adapter(adapter) {
|
116
|
-
if (adapter)
|
117
|
-
__classPrivateFieldGet(this, _ApiClient_client, "f").defaults.adapter = adapter;
|
100
|
+
if (userAgent)
|
101
|
+
this.requestHeaders['User-Agent'] = userAgent;
|
118
102
|
return this;
|
119
103
|
}
|
120
104
|
async request(method, path, body, options) {
|
121
105
|
debug('request %s %s, %O, %O', method, path, body || {}, options || {});
|
122
|
-
// Ignored params
|
123
|
-
if (options?.adapter)
|
124
|
-
debug('Adapter ignored in request config');
|
106
|
+
// Ignored params (in debug mode)
|
125
107
|
if (options?.userAgent)
|
126
108
|
debug('User-Agent header ignored in request config');
|
127
|
-
|
128
|
-
const
|
129
|
-
|
130
|
-
|
109
|
+
// URL
|
110
|
+
const baseUrl = options?.organization ? baseURL(options.organization, options.domain) : __classPrivateFieldGet(this, _ApiClient_baseUrl, "f");
|
111
|
+
const url = new URL(`${baseUrl}/${path}`);
|
112
|
+
// Body
|
113
|
+
const bodyData = body ? JSON.stringify({ data: body }) : undefined;
|
114
|
+
// Headers
|
115
|
+
const headers = { ...this.requestHeaders, ...this.customHeaders(options?.headers) };
|
116
|
+
// Access token
|
131
117
|
const accessToken = options?.accessToken || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
132
|
-
const headers = this.customHeaders(options?.headers);
|
133
118
|
if (accessToken)
|
134
119
|
headers.Authorization = 'Bearer ' + accessToken;
|
135
|
-
const
|
136
|
-
|
120
|
+
const fetchOptions = { method, body: bodyData, headers };
|
121
|
+
// Timeout
|
122
|
+
const timeout = options?.timeout || __classPrivateFieldGet(this, _ApiClient_clientConfig, "f").timeout;
|
123
|
+
if (timeout)
|
124
|
+
fetchOptions.signal = AbortSignal.timeout(timeout);
|
125
|
+
if (options?.params)
|
126
|
+
Object.entries(options?.params).forEach(([name, value]) => { url.searchParams.append(name, String(value)); });
|
137
127
|
// const start = Date.now()
|
138
|
-
return
|
139
|
-
.then(response => response.data)
|
128
|
+
return await (0, fetch_1.fetchURL)(url, fetchOptions, this.interceptors)
|
140
129
|
.catch((error) => (0, error_1.handleError)(error));
|
141
|
-
// .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
|
130
|
+
// .finally(() => { console.log(`<<-- ${method} ${path} ${Date.now() - start}`) })
|
142
131
|
}
|
143
132
|
customHeaders(headers) {
|
144
133
|
const customHeaders = {};
|
@@ -150,5 +139,5 @@ class ApiClient {
|
|
150
139
|
return customHeaders;
|
151
140
|
}
|
152
141
|
}
|
153
|
-
_ApiClient_accessToken = new WeakMap(),
|
142
|
+
_ApiClient_baseUrl = new WeakMap(), _ApiClient_accessToken = new WeakMap(), _ApiClient_clientConfig = new WeakMap(), _ApiClient_interceptors = new WeakMap();
|
154
143
|
exports.default = ApiClient;
|
@@ -10,142 +10,143 @@ type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
|
|
10
10
|
declare class CommerceLayerClient {
|
11
11
|
#private;
|
12
12
|
readonly openApiSchemaVersion = "5.1.0";
|
13
|
-
addresses: api.Addresses;
|
14
|
-
adjustments: api.Adjustments;
|
15
|
-
adyen_gateways: api.AdyenGateways;
|
16
|
-
adyen_payments: api.AdyenPayments;
|
17
|
-
application: api.Applications;
|
18
|
-
attachments: api.Attachments;
|
19
|
-
authorizations: api.Authorizations;
|
20
|
-
avalara_accounts: api.AvalaraAccounts;
|
21
|
-
axerve_gateways: api.AxerveGateways;
|
22
|
-
axerve_payments: api.AxervePayments;
|
23
|
-
billing_info_validation_rules: api.BillingInfoValidationRules;
|
24
|
-
bing_geocoders: api.BingGeocoders;
|
25
|
-
braintree_gateways: api.BraintreeGateways;
|
26
|
-
braintree_payments: api.BraintreePayments;
|
27
|
-
bundles: api.Bundles;
|
28
|
-
buy_x_pay_y_promotions: api.BuyXPayYPromotions;
|
29
|
-
captures: api.Captures;
|
30
|
-
carrier_accounts: api.CarrierAccounts;
|
31
|
-
checkout_com_gateways: api.CheckoutComGateways;
|
32
|
-
checkout_com_payments: api.CheckoutComPayments;
|
33
|
-
cleanups: api.Cleanups;
|
34
|
-
coupon_codes_promotion_rules: api.CouponCodesPromotionRules;
|
35
|
-
coupon_recipients: api.CouponRecipients;
|
36
|
-
coupons: api.Coupons;
|
37
|
-
custom_promotion_rules: api.CustomPromotionRules;
|
38
|
-
customer_addresses: api.CustomerAddresses;
|
39
|
-
customer_groups: api.CustomerGroups;
|
40
|
-
customer_password_resets: api.CustomerPasswordResets;
|
41
|
-
customer_payment_sources: api.CustomerPaymentSources;
|
42
|
-
customer_subscriptions: api.CustomerSubscriptions;
|
43
|
-
customers: api.Customers;
|
44
|
-
delivery_lead_times: api.DeliveryLeadTimes;
|
45
|
-
event_callbacks: api.EventCallbacks;
|
46
|
-
events: api.Events;
|
47
|
-
exports: api.Exports;
|
48
|
-
external_gateways: api.ExternalGateways;
|
49
|
-
external_payments: api.ExternalPayments;
|
50
|
-
external_promotions: api.ExternalPromotions;
|
51
|
-
external_tax_calculators: api.ExternalTaxCalculators;
|
52
|
-
fixed_amount_promotions: api.FixedAmountPromotions;
|
53
|
-
fixed_price_promotions: api.FixedPricePromotions;
|
54
|
-
free_gift_promotions: api.FreeGiftPromotions;
|
55
|
-
free_shipping_promotions: api.FreeShippingPromotions;
|
56
|
-
geocoders: api.Geocoders;
|
57
|
-
gift_card_recipients: api.GiftCardRecipients;
|
58
|
-
gift_cards: api.GiftCards;
|
59
|
-
google_geocoders: api.GoogleGeocoders;
|
60
|
-
imports: api.Imports;
|
61
|
-
in_stock_subscriptions: api.InStockSubscriptions;
|
62
|
-
inventory_models: api.InventoryModels;
|
63
|
-
inventory_return_locations: api.InventoryReturnLocations;
|
64
|
-
inventory_stock_locations: api.InventoryStockLocations;
|
65
|
-
klarna_gateways: api.KlarnaGateways;
|
66
|
-
klarna_payments: api.KlarnaPayments;
|
67
|
-
line_item_options: api.LineItemOptions;
|
68
|
-
line_items: api.LineItems;
|
69
|
-
manual_gateways: api.ManualGateways;
|
70
|
-
manual_tax_calculators: api.ManualTaxCalculators;
|
71
|
-
markets: api.Markets;
|
72
|
-
merchants: api.Merchants;
|
73
|
-
order_amount_promotion_rules: api.OrderAmountPromotionRules;
|
74
|
-
order_copies: api.OrderCopies;
|
75
|
-
order_factories: api.OrderFactories;
|
76
|
-
order_subscription_items: api.OrderSubscriptionItems;
|
77
|
-
order_subscriptions: api.OrderSubscriptions;
|
78
|
-
order_validation_rules: api.OrderValidationRules;
|
79
|
-
orders: api.Orders;
|
80
|
-
organization: api.Organizations;
|
81
|
-
packages: api.Packages;
|
82
|
-
parcel_line_items: api.ParcelLineItems;
|
83
|
-
parcels: api.Parcels;
|
84
|
-
payment_gateways: api.PaymentGateways;
|
85
|
-
payment_methods: api.PaymentMethods;
|
86
|
-
payment_options: api.PaymentOptions;
|
87
|
-
paypal_gateways: api.PaypalGateways;
|
88
|
-
paypal_payments: api.PaypalPayments;
|
89
|
-
percentage_discount_promotions: api.PercentageDiscountPromotions;
|
90
|
-
price_frequency_tiers: api.PriceFrequencyTiers;
|
91
|
-
price_lists: api.PriceLists;
|
92
|
-
price_tiers: api.PriceTiers;
|
93
|
-
price_volume_tiers: api.PriceVolumeTiers;
|
94
|
-
prices: api.Prices;
|
95
|
-
promotion_rules: api.PromotionRules;
|
96
|
-
promotions: api.Promotions;
|
97
|
-
recurring_order_copies: api.RecurringOrderCopies;
|
98
|
-
refunds: api.Refunds;
|
99
|
-
reserved_stocks: api.ReservedStocks;
|
100
|
-
resource_errors: api.ResourceErrors;
|
101
|
-
return_line_items: api.ReturnLineItems;
|
102
|
-
returns: api.Returns;
|
103
|
-
satispay_gateways: api.SatispayGateways;
|
104
|
-
satispay_payments: api.SatispayPayments;
|
105
|
-
shipments: api.Shipments;
|
106
|
-
shipping_categories: api.ShippingCategories;
|
107
|
-
shipping_method_tiers: api.ShippingMethodTiers;
|
108
|
-
shipping_methods: api.ShippingMethods;
|
109
|
-
shipping_weight_tiers: api.ShippingWeightTiers;
|
110
|
-
shipping_zones: api.ShippingZones;
|
111
|
-
sku_list_items: api.SkuListItems;
|
112
|
-
sku_list_promotion_rules: api.SkuListPromotionRules;
|
113
|
-
sku_lists: api.SkuLists;
|
114
|
-
sku_options: api.SkuOptions;
|
115
|
-
skus: api.Skus;
|
116
|
-
stock_items: api.StockItems;
|
117
|
-
stock_line_items: api.StockLineItems;
|
118
|
-
stock_locations: api.StockLocations;
|
119
|
-
stock_reservations: api.StockReservations;
|
120
|
-
stock_transfers: api.StockTransfers;
|
121
|
-
stripe_gateways: api.StripeGateways;
|
122
|
-
stripe_payments: api.StripePayments;
|
123
|
-
subscription_models: api.SubscriptionModels;
|
124
|
-
tags: api.Tags;
|
125
|
-
tax_calculators: api.TaxCalculators;
|
126
|
-
tax_categories: api.TaxCategories;
|
127
|
-
tax_rules: api.TaxRules;
|
128
|
-
taxjar_accounts: api.TaxjarAccounts;
|
129
|
-
transactions: api.Transactions;
|
130
|
-
versions: api.Versions;
|
131
|
-
voids: api.Voids;
|
132
|
-
webhooks: api.Webhooks;
|
133
|
-
wire_transfers: api.WireTransfers;
|
134
13
|
constructor(config: CommerceLayerInitConfig);
|
14
|
+
get addresses(): api.Addresses;
|
15
|
+
get adjustments(): api.Adjustments;
|
16
|
+
get adyen_gateways(): api.AdyenGateways;
|
17
|
+
get adyen_payments(): api.AdyenPayments;
|
18
|
+
get application(): api.Applications;
|
19
|
+
get attachments(): api.Attachments;
|
20
|
+
get authorizations(): api.Authorizations;
|
21
|
+
get avalara_accounts(): api.AvalaraAccounts;
|
22
|
+
get axerve_gateways(): api.AxerveGateways;
|
23
|
+
get axerve_payments(): api.AxervePayments;
|
24
|
+
get billing_info_validation_rules(): api.BillingInfoValidationRules;
|
25
|
+
get bing_geocoders(): api.BingGeocoders;
|
26
|
+
get braintree_gateways(): api.BraintreeGateways;
|
27
|
+
get braintree_payments(): api.BraintreePayments;
|
28
|
+
get bundles(): api.Bundles;
|
29
|
+
get buy_x_pay_y_promotions(): api.BuyXPayYPromotions;
|
30
|
+
get captures(): api.Captures;
|
31
|
+
get carrier_accounts(): api.CarrierAccounts;
|
32
|
+
get checkout_com_gateways(): api.CheckoutComGateways;
|
33
|
+
get checkout_com_payments(): api.CheckoutComPayments;
|
34
|
+
get cleanups(): api.Cleanups;
|
35
|
+
get coupon_codes_promotion_rules(): api.CouponCodesPromotionRules;
|
36
|
+
get coupon_recipients(): api.CouponRecipients;
|
37
|
+
get coupons(): api.Coupons;
|
38
|
+
get custom_promotion_rules(): api.CustomPromotionRules;
|
39
|
+
get customer_addresses(): api.CustomerAddresses;
|
40
|
+
get customer_groups(): api.CustomerGroups;
|
41
|
+
get customer_password_resets(): api.CustomerPasswordResets;
|
42
|
+
get customer_payment_sources(): api.CustomerPaymentSources;
|
43
|
+
get customer_subscriptions(): api.CustomerSubscriptions;
|
44
|
+
get customers(): api.Customers;
|
45
|
+
get delivery_lead_times(): api.DeliveryLeadTimes;
|
46
|
+
get event_callbacks(): api.EventCallbacks;
|
47
|
+
get events(): api.Events;
|
48
|
+
get exports(): api.Exports;
|
49
|
+
get external_gateways(): api.ExternalGateways;
|
50
|
+
get external_payments(): api.ExternalPayments;
|
51
|
+
get external_promotions(): api.ExternalPromotions;
|
52
|
+
get external_tax_calculators(): api.ExternalTaxCalculators;
|
53
|
+
get fixed_amount_promotions(): api.FixedAmountPromotions;
|
54
|
+
get fixed_price_promotions(): api.FixedPricePromotions;
|
55
|
+
get free_gift_promotions(): api.FreeGiftPromotions;
|
56
|
+
get free_shipping_promotions(): api.FreeShippingPromotions;
|
57
|
+
get geocoders(): api.Geocoders;
|
58
|
+
get gift_card_recipients(): api.GiftCardRecipients;
|
59
|
+
get gift_cards(): api.GiftCards;
|
60
|
+
get google_geocoders(): api.GoogleGeocoders;
|
61
|
+
get imports(): api.Imports;
|
62
|
+
get in_stock_subscriptions(): api.InStockSubscriptions;
|
63
|
+
get inventory_models(): api.InventoryModels;
|
64
|
+
get inventory_return_locations(): api.InventoryReturnLocations;
|
65
|
+
get inventory_stock_locations(): api.InventoryStockLocations;
|
66
|
+
get klarna_gateways(): api.KlarnaGateways;
|
67
|
+
get klarna_payments(): api.KlarnaPayments;
|
68
|
+
get line_item_options(): api.LineItemOptions;
|
69
|
+
get line_items(): api.LineItems;
|
70
|
+
get manual_gateways(): api.ManualGateways;
|
71
|
+
get manual_tax_calculators(): api.ManualTaxCalculators;
|
72
|
+
get markets(): api.Markets;
|
73
|
+
get merchants(): api.Merchants;
|
74
|
+
get order_amount_promotion_rules(): api.OrderAmountPromotionRules;
|
75
|
+
get order_copies(): api.OrderCopies;
|
76
|
+
get order_factories(): api.OrderFactories;
|
77
|
+
get order_subscription_items(): api.OrderSubscriptionItems;
|
78
|
+
get order_subscriptions(): api.OrderSubscriptions;
|
79
|
+
get order_validation_rules(): api.OrderValidationRules;
|
80
|
+
get orders(): api.Orders;
|
81
|
+
get organization(): api.Organizations;
|
82
|
+
get packages(): api.Packages;
|
83
|
+
get parcel_line_items(): api.ParcelLineItems;
|
84
|
+
get parcels(): api.Parcels;
|
85
|
+
get payment_gateways(): api.PaymentGateways;
|
86
|
+
get payment_methods(): api.PaymentMethods;
|
87
|
+
get payment_options(): api.PaymentOptions;
|
88
|
+
get paypal_gateways(): api.PaypalGateways;
|
89
|
+
get paypal_payments(): api.PaypalPayments;
|
90
|
+
get percentage_discount_promotions(): api.PercentageDiscountPromotions;
|
91
|
+
get price_frequency_tiers(): api.PriceFrequencyTiers;
|
92
|
+
get price_lists(): api.PriceLists;
|
93
|
+
get price_tiers(): api.PriceTiers;
|
94
|
+
get price_volume_tiers(): api.PriceVolumeTiers;
|
95
|
+
get prices(): api.Prices;
|
96
|
+
get promotion_rules(): api.PromotionRules;
|
97
|
+
get promotions(): api.Promotions;
|
98
|
+
get recurring_order_copies(): api.RecurringOrderCopies;
|
99
|
+
get refunds(): api.Refunds;
|
100
|
+
get reserved_stocks(): api.ReservedStocks;
|
101
|
+
get resource_errors(): api.ResourceErrors;
|
102
|
+
get return_line_items(): api.ReturnLineItems;
|
103
|
+
get returns(): api.Returns;
|
104
|
+
get satispay_gateways(): api.SatispayGateways;
|
105
|
+
get satispay_payments(): api.SatispayPayments;
|
106
|
+
get shipments(): api.Shipments;
|
107
|
+
get shipping_categories(): api.ShippingCategories;
|
108
|
+
get shipping_method_tiers(): api.ShippingMethodTiers;
|
109
|
+
get shipping_methods(): api.ShippingMethods;
|
110
|
+
get shipping_weight_tiers(): api.ShippingWeightTiers;
|
111
|
+
get shipping_zones(): api.ShippingZones;
|
112
|
+
get sku_list_items(): api.SkuListItems;
|
113
|
+
get sku_list_promotion_rules(): api.SkuListPromotionRules;
|
114
|
+
get sku_lists(): api.SkuLists;
|
115
|
+
get sku_options(): api.SkuOptions;
|
116
|
+
get skus(): api.Skus;
|
117
|
+
get stock_items(): api.StockItems;
|
118
|
+
get stock_line_items(): api.StockLineItems;
|
119
|
+
get stock_locations(): api.StockLocations;
|
120
|
+
get stock_reservations(): api.StockReservations;
|
121
|
+
get stock_transfers(): api.StockTransfers;
|
122
|
+
get stripe_gateways(): api.StripeGateways;
|
123
|
+
get stripe_payments(): api.StripePayments;
|
124
|
+
get subscription_models(): api.SubscriptionModels;
|
125
|
+
get tags(): api.Tags;
|
126
|
+
get tax_calculators(): api.TaxCalculators;
|
127
|
+
get tax_categories(): api.TaxCategories;
|
128
|
+
get tax_rules(): api.TaxRules;
|
129
|
+
get taxjar_accounts(): api.TaxjarAccounts;
|
130
|
+
get transactions(): api.Transactions;
|
131
|
+
get versions(): api.Versions;
|
132
|
+
get voids(): api.Voids;
|
133
|
+
get webhooks(): api.Webhooks;
|
134
|
+
get wire_transfers(): api.WireTransfers;
|
135
135
|
get currentOrganization(): string;
|
136
|
+
private get interceptors();
|
136
137
|
private localConfig;
|
137
138
|
config(config: CommerceLayerConfig): CommerceLayerClient;
|
138
139
|
resources(): readonly string[];
|
139
140
|
singletons(): readonly string[];
|
140
141
|
isSingleton(resource: api.ResourceTypeLock): boolean;
|
141
142
|
isApiError(error: any): error is ApiError;
|
142
|
-
addRequestInterceptor(
|
143
|
-
addResponseInterceptor(
|
144
|
-
removeInterceptor(type: InterceptorType, id
|
143
|
+
addRequestInterceptor(onSuccess?: RequestInterceptor, onFailure?: ErrorInterceptor): void;
|
144
|
+
addResponseInterceptor(onSuccess?: ResponseInterceptor, onFailure?: ErrorInterceptor): void;
|
145
|
+
removeInterceptor(type: InterceptorType, id?: number): void;
|
145
146
|
addRawResponseReader(options?: {
|
146
147
|
headers: boolean;
|
147
148
|
}): RawResponseReader;
|
148
|
-
removeRawResponseReader(
|
149
|
+
removeRawResponseReader(): void;
|
149
150
|
}
|
150
151
|
declare const CommerceLayer: (config: CommerceLayerInitConfig) => CommerceLayerClient;
|
151
152
|
export default CommerceLayer;
|