@commercelayer/sdk 5.28.0 → 5.29.0-alfa.2
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/api.d.ts +3 -2
- package/lib/cjs/api.js +5 -2
- package/lib/cjs/client.js +5 -5
- package/lib/cjs/commercelayer.d.ts +3 -2
- package/lib/cjs/commercelayer.js +5 -4
- package/lib/cjs/common.js +1 -1
- package/lib/cjs/error.js +1 -2
- package/lib/cjs/model.d.ts +1 -0
- package/lib/cjs/query.d.ts +1 -1
- package/lib/cjs/query.js +1 -1
- package/lib/cjs/resource.js +22 -25
- package/lib/cjs/resources/adjustments.d.ts +3 -0
- package/lib/cjs/resources/adyen_gateways.d.ts +2 -2
- package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +4 -14
- package/lib/cjs/resources/buy_x_pay_y_promotions.js +4 -4
- 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 +8 -14
- package/lib/cjs/resources/external_promotions.js +7 -4
- 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/fixed_amount_promotions.d.ts +4 -14
- package/lib/cjs/resources/fixed_amount_promotions.js +4 -4
- package/lib/cjs/resources/fixed_price_promotions.d.ts +4 -14
- package/lib/cjs/resources/fixed_price_promotions.js +4 -4
- package/lib/cjs/resources/free_gift_promotions.d.ts +4 -14
- package/lib/cjs/resources/free_gift_promotions.js +4 -4
- package/lib/cjs/resources/free_shipping_promotions.d.ts +9 -14
- package/lib/cjs/resources/free_shipping_promotions.js +4 -4
- package/lib/cjs/resources/gift_cards.d.ts +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 +1 -4
- package/lib/cjs/resources/orders.d.ts +14 -1
- package/lib/cjs/resources/orders.js +10 -0
- package/lib/cjs/resources/parcel_line_items.d.ts +0 -8
- package/lib/cjs/resources/payment_methods.d.ts +8 -5
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +4 -14
- package/lib/cjs/resources/percentage_discount_promotions.js +4 -4
- package/lib/cjs/resources/promotions.d.ts +3 -3
- package/lib/cjs/resources/promotions.js +4 -4
- package/lib/cjs/resources/resource_errors.d.ts +22 -0
- package/lib/cjs/resources/resource_errors.js +16 -0
- 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/stock_transfers.d.ts +1 -1
- package/lib/cjs/resources/stripe_payments.d.ts +4 -1
- package/lib/cjs/resources/webhooks.d.ts +3 -3
- package/lib/cjs/resources/webhooks.js +3 -3
- package/lib/esm/api.d.ts +3 -2
- package/lib/esm/api.js +2 -0
- package/lib/esm/client.js +19 -30
- package/lib/esm/commercelayer.d.ts +3 -2
- package/lib/esm/commercelayer.js +261 -149
- package/lib/esm/common.js +1 -1
- package/lib/esm/error.js +10 -5
- package/lib/esm/model.d.ts +1 -0
- package/lib/esm/query.d.ts +1 -1
- package/lib/esm/query.js +1 -1
- package/lib/esm/resource.js +37 -50
- package/lib/esm/resources/addresses.js +1 -1
- package/lib/esm/resources/adjustments.d.ts +3 -0
- package/lib/esm/resources/adjustments.js +1 -1
- package/lib/esm/resources/adyen_gateways.d.ts +2 -2
- package/lib/esm/resources/adyen_gateways.js +1 -1
- package/lib/esm/resources/adyen_payments.js +1 -1
- package/lib/esm/resources/application.js +1 -1
- package/lib/esm/resources/attachments.js +1 -1
- package/lib/esm/resources/authorizations.js +1 -1
- package/lib/esm/resources/avalara_accounts.js +1 -1
- package/lib/esm/resources/axerve_gateways.js +1 -1
- package/lib/esm/resources/axerve_payments.js +1 -1
- package/lib/esm/resources/billing_info_validation_rules.js +1 -1
- package/lib/esm/resources/bing_geocoders.js +1 -1
- package/lib/esm/resources/braintree_gateways.js +1 -1
- package/lib/esm/resources/braintree_payments.js +1 -1
- package/lib/esm/resources/bundles.js +1 -1
- package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +4 -14
- package/lib/esm/resources/buy_x_pay_y_promotions.js +5 -5
- package/lib/esm/resources/captures.js +1 -1
- package/lib/esm/resources/carrier_accounts.js +1 -1
- package/lib/esm/resources/checkout_com_gateways.js +1 -1
- package/lib/esm/resources/checkout_com_payments.js +1 -1
- package/lib/esm/resources/cleanups.js +1 -1
- package/lib/esm/resources/coupon_codes_promotion_rules.js +1 -1
- package/lib/esm/resources/coupon_recipients.js +1 -1
- package/lib/esm/resources/coupons.js +1 -1
- package/lib/esm/resources/custom_promotion_rules.js +1 -1
- package/lib/esm/resources/customer_addresses.js +1 -1
- package/lib/esm/resources/customer_groups.js +1 -1
- package/lib/esm/resources/customer_password_resets.js +1 -1
- package/lib/esm/resources/customer_payment_sources.js +1 -1
- package/lib/esm/resources/customer_subscriptions.js +1 -1
- package/lib/esm/resources/customers.js +1 -1
- package/lib/esm/resources/delivery_lead_times.js +1 -1
- package/lib/esm/resources/event_callbacks.js +1 -1
- package/lib/esm/resources/events.js +1 -1
- package/lib/esm/resources/exports.js +1 -1
- package/lib/esm/resources/external_gateways.d.ts +5 -1
- package/lib/esm/resources/external_gateways.js +4 -1
- package/lib/esm/resources/external_payments.js +1 -1
- package/lib/esm/resources/external_promotions.d.ts +8 -14
- package/lib/esm/resources/external_promotions.js +8 -5
- package/lib/esm/resources/external_tax_calculators.d.ts +4 -0
- package/lib/esm/resources/external_tax_calculators.js +4 -1
- package/lib/esm/resources/fixed_amount_promotions.d.ts +4 -14
- package/lib/esm/resources/fixed_amount_promotions.js +5 -5
- package/lib/esm/resources/fixed_price_promotions.d.ts +4 -14
- package/lib/esm/resources/fixed_price_promotions.js +5 -5
- package/lib/esm/resources/free_gift_promotions.d.ts +4 -14
- package/lib/esm/resources/free_gift_promotions.js +5 -5
- package/lib/esm/resources/free_shipping_promotions.d.ts +9 -14
- package/lib/esm/resources/free_shipping_promotions.js +5 -5
- package/lib/esm/resources/geocoders.js +1 -1
- package/lib/esm/resources/gift_card_recipients.js +1 -1
- package/lib/esm/resources/gift_cards.d.ts +3 -0
- package/lib/esm/resources/gift_cards.js +1 -1
- package/lib/esm/resources/google_geocoders.js +1 -1
- package/lib/esm/resources/imports.js +1 -1
- package/lib/esm/resources/in_stock_subscriptions.js +1 -1
- package/lib/esm/resources/inventory_models.js +1 -1
- package/lib/esm/resources/inventory_return_locations.js +1 -1
- package/lib/esm/resources/inventory_stock_locations.js +1 -1
- package/lib/esm/resources/klarna_gateways.js +1 -1
- package/lib/esm/resources/klarna_payments.js +1 -1
- package/lib/esm/resources/line_item_options.js +1 -1
- package/lib/esm/resources/line_items.d.ts +12 -4
- package/lib/esm/resources/line_items.js +4 -1
- package/lib/esm/resources/manual_gateways.js +1 -1
- package/lib/esm/resources/manual_tax_calculators.js +1 -1
- package/lib/esm/resources/markets.d.ts +1 -1
- package/lib/esm/resources/markets.js +1 -1
- package/lib/esm/resources/merchants.js +1 -1
- package/lib/esm/resources/order_amount_promotion_rules.js +1 -1
- package/lib/esm/resources/order_copies.js +1 -1
- package/lib/esm/resources/order_factories.js +1 -1
- package/lib/esm/resources/order_subscription_items.js +1 -1
- package/lib/esm/resources/order_subscriptions.d.ts +1 -4
- package/lib/esm/resources/order_subscriptions.js +1 -1
- package/lib/esm/resources/order_validation_rules.js +1 -1
- package/lib/esm/resources/orders.d.ts +14 -1
- package/lib/esm/resources/orders.js +11 -1
- package/lib/esm/resources/organization.js +1 -1
- package/lib/esm/resources/packages.js +1 -1
- package/lib/esm/resources/parcel_line_items.d.ts +0 -8
- package/lib/esm/resources/parcel_line_items.js +1 -1
- package/lib/esm/resources/parcels.js +1 -1
- package/lib/esm/resources/payment_gateways.js +1 -1
- package/lib/esm/resources/payment_methods.d.ts +8 -5
- package/lib/esm/resources/payment_methods.js +1 -1
- package/lib/esm/resources/payment_options.js +1 -1
- package/lib/esm/resources/paypal_gateways.js +1 -1
- package/lib/esm/resources/paypal_payments.js +1 -1
- package/lib/esm/resources/percentage_discount_promotions.d.ts +4 -14
- package/lib/esm/resources/percentage_discount_promotions.js +5 -5
- package/lib/esm/resources/price_frequency_tiers.js +1 -1
- package/lib/esm/resources/price_lists.js +1 -1
- package/lib/esm/resources/price_tiers.js +1 -1
- package/lib/esm/resources/price_volume_tiers.js +1 -1
- package/lib/esm/resources/prices.js +1 -1
- package/lib/esm/resources/promotion_rules.js +1 -1
- package/lib/esm/resources/promotions.d.ts +3 -3
- package/lib/esm/resources/promotions.js +5 -5
- package/lib/esm/resources/recurring_order_copies.js +1 -1
- package/lib/esm/resources/refunds.js +1 -1
- package/lib/esm/resources/reserved_stocks.js +1 -1
- package/lib/esm/resources/resource_errors.d.ts +22 -0
- package/lib/esm/resources/resource_errors.js +14 -0
- package/lib/esm/resources/return_line_items.js +1 -1
- package/lib/esm/resources/returns.js +1 -1
- package/lib/esm/resources/satispay_gateways.js +1 -1
- package/lib/esm/resources/satispay_payments.js +1 -1
- package/lib/esm/resources/shipments.d.ts +0 -4
- package/lib/esm/resources/shipments.js +1 -1
- package/lib/esm/resources/shipping_categories.js +1 -1
- package/lib/esm/resources/shipping_method_tiers.js +1 -1
- package/lib/esm/resources/shipping_methods.d.ts +9 -5
- package/lib/esm/resources/shipping_methods.js +4 -1
- package/lib/esm/resources/shipping_weight_tiers.js +1 -1
- package/lib/esm/resources/shipping_zones.js +1 -1
- package/lib/esm/resources/sku_list_items.js +1 -1
- package/lib/esm/resources/sku_list_promotion_rules.js +1 -1
- package/lib/esm/resources/sku_lists.js +1 -1
- package/lib/esm/resources/sku_options.js +1 -1
- package/lib/esm/resources/skus.js +1 -1
- package/lib/esm/resources/stock_items.js +1 -1
- package/lib/esm/resources/stock_line_items.js +1 -1
- package/lib/esm/resources/stock_locations.js +1 -1
- package/lib/esm/resources/stock_reservations.js +1 -1
- package/lib/esm/resources/stock_transfers.d.ts +1 -1
- package/lib/esm/resources/stock_transfers.js +1 -1
- package/lib/esm/resources/stripe_gateways.js +1 -1
- package/lib/esm/resources/stripe_payments.d.ts +4 -1
- package/lib/esm/resources/stripe_payments.js +1 -1
- package/lib/esm/resources/subscription_models.js +1 -1
- package/lib/esm/resources/tags.js +1 -1
- package/lib/esm/resources/tax_calculators.js +1 -1
- package/lib/esm/resources/tax_categories.js +1 -1
- package/lib/esm/resources/tax_rules.js +1 -1
- package/lib/esm/resources/taxjar_accounts.js +1 -1
- package/lib/esm/resources/transactions.js +1 -1
- package/lib/esm/resources/versions.js +1 -1
- package/lib/esm/resources/voids.js +1 -1
- package/lib/esm/resources/webhooks.d.ts +3 -3
- package/lib/esm/resources/webhooks.js +4 -4
- package/lib/esm/resources/wire_transfers.js +1 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
package/lib/esm/common.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { resourceList } from './api';
|
2
2
|
const isResourceId = (resource) => {
|
3
|
-
return (
|
3
|
+
return (resource?.type && resource.id) && resourceList.includes(resource.type);
|
4
4
|
};
|
5
5
|
const isResourceType = (resource) => {
|
6
6
|
return resource && (typeof resource.type !== 'undefined') && resource.type && resourceList.includes(resource.type);
|
package/lib/esm/error.js
CHANGED
@@ -9,31 +9,36 @@ var ErrorType;
|
|
9
9
|
ErrorType["GENERIC"] = "generic";
|
10
10
|
})(ErrorType || (ErrorType = {}));
|
11
11
|
class SdkError extends Error {
|
12
|
+
static NAME = 'SdkError';
|
12
13
|
static isSdkError(error) {
|
13
14
|
return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
14
15
|
}
|
16
|
+
type;
|
17
|
+
code;
|
18
|
+
source;
|
19
|
+
request;
|
15
20
|
constructor(error) {
|
16
21
|
super(error.message);
|
17
22
|
this.name = SdkError.NAME; // this.constructor.name
|
18
23
|
this.type = error.type || ErrorType.GENERIC;
|
19
24
|
}
|
20
25
|
}
|
21
|
-
SdkError.NAME = 'SdkError';
|
22
26
|
class ApiError extends SdkError {
|
27
|
+
static NAME = 'ApiError';
|
23
28
|
static isApiError(error) {
|
24
29
|
return SdkError.isSdkError(error) && (error.name === ApiError.NAME) && (error.type === ErrorType.RESPONSE);
|
25
30
|
}
|
31
|
+
errors = [];
|
32
|
+
status;
|
33
|
+
statusText;
|
26
34
|
constructor(error) {
|
27
35
|
super({ ...error, type: ErrorType.RESPONSE });
|
28
|
-
this.errors = [];
|
29
36
|
this.name = ApiError.NAME; // this.constructor.name
|
30
37
|
}
|
31
38
|
first() {
|
32
|
-
|
33
|
-
return (((_a = this.errors) === null || _a === void 0 ? void 0 : _a.length) > 0) ? this.errors[0] : undefined;
|
39
|
+
return (this.errors?.length > 0) ? this.errors[0] : undefined;
|
34
40
|
}
|
35
41
|
}
|
36
|
-
ApiError.NAME = 'ApiError';
|
37
42
|
const handleError = (error) => {
|
38
43
|
let sdkError = new SdkError({ message: error.message });
|
39
44
|
if (axios.isAxiosError(error)) {
|
package/lib/esm/model.d.ts
CHANGED
@@ -88,6 +88,7 @@ export type { Promotion } from './resources/promotions';
|
|
88
88
|
export type { RecurringOrderCopy, RecurringOrderCopyCreate, RecurringOrderCopyUpdate } from './resources/recurring_order_copies';
|
89
89
|
export type { Refund } from './resources/refunds';
|
90
90
|
export type { ReservedStock } from './resources/reserved_stocks';
|
91
|
+
export type { ResourceError } from './resources/resource_errors';
|
91
92
|
export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items';
|
92
93
|
export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns';
|
93
94
|
export type { SatispayGateway, SatispayGatewayCreate, SatispayGatewayUpdate } from './resources/satispay_gateways';
|
package/lib/esm/query.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ResourceType } from "./resource";
|
2
|
-
type QueryFilter = Record<string, string | number | boolean>;
|
2
|
+
type QueryFilter = Record<string, string | number | boolean | object>;
|
3
3
|
interface QueryParamsRetrieve {
|
4
4
|
include?: string[];
|
5
5
|
fields?: string[] | Record<string, string[]>;
|
package/lib/esm/query.js
CHANGED
@@ -35,7 +35,7 @@ const generateQueryStringParams = (params, res) => {
|
|
35
35
|
// Filters
|
36
36
|
if (params.filters) {
|
37
37
|
Object.entries(params.filters).forEach(([p, v]) => {
|
38
|
-
qp[`filter[q][${p}]`] = String(v);
|
38
|
+
qp[`filter[q][${p}]`] = (typeof v === 'object') ? JSON.stringify(v) : String(v);
|
39
39
|
});
|
40
40
|
}
|
41
41
|
}
|
package/lib/esm/resource.js
CHANGED
@@ -1,15 +1,3 @@
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
|
-
};
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
-
};
|
12
|
-
var _ResourceAdapter_client, _ResourceAdapter_config;
|
13
1
|
import ApiClient from './client';
|
14
2
|
import { denormalize, normalize } from './jsonapi';
|
15
3
|
import { generateQueryStringParams, isParamsList } from './query';
|
@@ -18,6 +6,7 @@ import { ErrorType, SdkError } from './error';
|
|
18
6
|
import Debug from './debug';
|
19
7
|
const debug = Debug('resource');
|
20
8
|
class ListResponse extends Array {
|
9
|
+
meta;
|
21
10
|
constructor(meta, data) {
|
22
11
|
super(...(data || []));
|
23
12
|
this.meta = meta;
|
@@ -33,13 +22,13 @@ class ListResponse extends Array {
|
|
33
22
|
get pageCount() { return this.meta.pageCount; }
|
34
23
|
}
|
35
24
|
class ResourceAdapter {
|
25
|
+
#client;
|
26
|
+
#config = {};
|
36
27
|
constructor(config) {
|
37
|
-
|
38
|
-
_ResourceAdapter_config.set(this, {});
|
39
|
-
__classPrivateFieldSet(this, _ResourceAdapter_client, ApiClient.create(config), "f");
|
28
|
+
this.#client = ApiClient.create(config);
|
40
29
|
this.localConfig(config);
|
41
30
|
}
|
42
|
-
get interceptors() { return
|
31
|
+
get interceptors() { return this.#client.interceptors; }
|
43
32
|
localConfig(config) {
|
44
33
|
// if (typeof config.xyz !== 'undefined') this.#config.xyz = config.xyz
|
45
34
|
}
|
@@ -48,7 +37,7 @@ class ResourceAdapter {
|
|
48
37
|
// ResourceAdapter config
|
49
38
|
this.localConfig(config);
|
50
39
|
// Client config
|
51
|
-
|
40
|
+
this.#client.config(config);
|
52
41
|
return this;
|
53
42
|
}
|
54
43
|
/*
|
@@ -59,76 +48,74 @@ class ResourceAdapter {
|
|
59
48
|
async singleton(resource, params, options) {
|
60
49
|
debug('singleton: %o, %O, %O', resource, params || {}, options || {});
|
61
50
|
const queryParams = generateQueryStringParams(params, resource);
|
62
|
-
if (options
|
63
|
-
Object.assign(queryParams, options
|
64
|
-
const res = await
|
51
|
+
if (options?.params)
|
52
|
+
Object.assign(queryParams, options?.params);
|
53
|
+
const res = await this.#client.request('get', `${resource.type}`, undefined, { ...options, params: queryParams });
|
65
54
|
const r = denormalize(res);
|
66
55
|
return r;
|
67
56
|
}
|
68
57
|
async retrieve(resource, params, options) {
|
69
58
|
debug('retrieve: %o, %O, %O', resource, params || {}, options || {});
|
70
59
|
const queryParams = generateQueryStringParams(params, resource);
|
71
|
-
if (options
|
72
|
-
Object.assign(queryParams, options
|
73
|
-
const res = await
|
60
|
+
if (options?.params)
|
61
|
+
Object.assign(queryParams, options?.params);
|
62
|
+
const res = await this.#client.request('get', `${resource.type}/${resource.id}`, undefined, { ...options, params: queryParams });
|
74
63
|
const r = denormalize(res);
|
75
64
|
return r;
|
76
65
|
}
|
77
66
|
async list(resource, params, options) {
|
78
|
-
var _a, _b;
|
79
67
|
debug('list: %o, %O, %O', resource, params || {}, options || {});
|
80
68
|
const queryParams = generateQueryStringParams(params, resource);
|
81
|
-
if (options
|
82
|
-
Object.assign(queryParams, options
|
83
|
-
const res = await
|
69
|
+
if (options?.params)
|
70
|
+
Object.assign(queryParams, options?.params);
|
71
|
+
const res = await this.#client.request('get', `${resource.type}`, undefined, { ...options, params: queryParams });
|
84
72
|
const r = denormalize(res);
|
85
73
|
const meta = {
|
86
|
-
pageCount: Number(
|
87
|
-
recordCount: Number(
|
88
|
-
currentPage:
|
89
|
-
recordsPerPage:
|
74
|
+
pageCount: Number(res.meta?.page_count),
|
75
|
+
recordCount: Number(res.meta?.record_count),
|
76
|
+
currentPage: params?.pageNumber || config.default.pageNumber,
|
77
|
+
recordsPerPage: params?.pageSize || config.default.pageSize
|
90
78
|
};
|
91
79
|
return new ListResponse(meta, r);
|
92
80
|
}
|
93
81
|
async create(resource, params, options) {
|
94
82
|
debug('create: %o, %O, %O', resource, params || {}, options || {});
|
95
83
|
const queryParams = generateQueryStringParams(params, resource);
|
96
|
-
if (options
|
97
|
-
Object.assign(queryParams, options
|
84
|
+
if (options?.params)
|
85
|
+
Object.assign(queryParams, options?.params);
|
98
86
|
const data = normalize(resource);
|
99
|
-
const res = await
|
87
|
+
const res = await this.#client.request('post', resource.type, data, { ...options, params: queryParams });
|
100
88
|
const r = denormalize(res);
|
101
89
|
return r;
|
102
90
|
}
|
103
91
|
async update(resource, params, options) {
|
104
92
|
debug('update: %o, %O, %O', resource, params || {}, options || {});
|
105
93
|
const queryParams = generateQueryStringParams(params, resource);
|
106
|
-
if (options
|
107
|
-
Object.assign(queryParams, options
|
94
|
+
if (options?.params)
|
95
|
+
Object.assign(queryParams, options?.params);
|
108
96
|
const data = normalize(resource);
|
109
|
-
const res = await
|
97
|
+
const res = await this.#client.request('patch', `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
|
110
98
|
const r = denormalize(res);
|
111
99
|
return r;
|
112
100
|
}
|
113
101
|
async delete(resource, options) {
|
114
102
|
debug('delete: %o, %O', resource, options || {});
|
115
|
-
await
|
103
|
+
await this.#client.request('delete', `${resource.type}/${resource.id}`, undefined, options);
|
116
104
|
}
|
117
105
|
async fetch(resource, path, params, options) {
|
118
|
-
var _a, _b;
|
119
106
|
debug('fetch: %o, %O, %O', path, params || {}, options || {});
|
120
107
|
const queryParams = generateQueryStringParams(params, resource);
|
121
|
-
if (options
|
122
|
-
Object.assign(queryParams, options
|
123
|
-
const res = await
|
108
|
+
if (options?.params)
|
109
|
+
Object.assign(queryParams, options?.params);
|
110
|
+
const res = await this.#client.request('get', path, undefined, { ...options, params: queryParams });
|
124
111
|
const r = denormalize(res);
|
125
112
|
if (Array.isArray(r)) {
|
126
113
|
const p = params;
|
127
114
|
const meta = {
|
128
|
-
pageCount: Number(
|
129
|
-
recordCount: Number(
|
130
|
-
currentPage:
|
131
|
-
recordsPerPage:
|
115
|
+
pageCount: Number(res.meta?.page_count),
|
116
|
+
recordCount: Number(res.meta?.record_count),
|
117
|
+
currentPage: p?.pageNumber || config.default.pageNumber,
|
118
|
+
recordsPerPage: p?.pageSize || config.default.pageSize
|
132
119
|
};
|
133
120
|
return new ListResponse(meta, r);
|
134
121
|
}
|
@@ -136,18 +123,18 @@ class ResourceAdapter {
|
|
136
123
|
return r;
|
137
124
|
}
|
138
125
|
}
|
139
|
-
_ResourceAdapter_client = new WeakMap(), _ResourceAdapter_config = new WeakMap();
|
140
126
|
class ApiResourceBase {
|
127
|
+
static TYPE;
|
128
|
+
resources;
|
141
129
|
constructor(adapter) {
|
142
130
|
debug('new resource instance: %s', this.type());
|
143
131
|
this.resources = adapter;
|
144
132
|
}
|
145
133
|
parse(resource) {
|
146
|
-
var _a, _b;
|
147
134
|
try {
|
148
135
|
const res = JSON.parse(resource);
|
149
|
-
if (
|
150
|
-
throw new SdkError({ message: `Invalid resource type [${
|
136
|
+
if (res.data?.type !== this.type())
|
137
|
+
throw new SdkError({ message: `Invalid resource type [${res.data?.type}]`, type: ErrorType.PARSE });
|
151
138
|
return denormalize(res);
|
152
139
|
}
|
153
140
|
catch (error) {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class Addresses extends ApiResource {
|
3
|
+
static TYPE = 'addresses';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: Addresses.TYPE }, params, options);
|
5
6
|
}
|
@@ -35,5 +36,4 @@ class Addresses extends ApiResource {
|
|
35
36
|
return Addresses.TYPE;
|
36
37
|
}
|
37
38
|
}
|
38
|
-
Addresses.TYPE = 'addresses';
|
39
39
|
export default Addresses;
|
@@ -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;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class Adjustments extends ApiResource {
|
3
|
+
static TYPE = 'adjustments';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: Adjustments.TYPE }, params, options);
|
5
6
|
}
|
@@ -23,5 +24,4 @@ class Adjustments extends ApiResource {
|
|
23
24
|
return Adjustments.TYPE;
|
24
25
|
}
|
25
26
|
}
|
26
|
-
Adjustments.TYPE = 'adjustments';
|
27
27
|
export default Adjustments;
|
@@ -28,7 +28,7 @@ interface AdyenGatewayCreate extends ResourceCreate {
|
|
28
28
|
api_key: string;
|
29
29
|
public_key?: string | null;
|
30
30
|
live_url_prefix: string;
|
31
|
-
api_version?:
|
31
|
+
api_version?: number | null;
|
32
32
|
async_api?: boolean | null;
|
33
33
|
webhook_endpoint_secret?: string | null;
|
34
34
|
adyen_payments?: AdyenPaymentRel[] | null;
|
@@ -39,7 +39,7 @@ interface AdyenGatewayUpdate extends ResourceUpdate {
|
|
39
39
|
api_key?: string | null;
|
40
40
|
public_key?: string | null;
|
41
41
|
live_url_prefix?: string | null;
|
42
|
-
api_version?:
|
42
|
+
api_version?: number | null;
|
43
43
|
async_api?: boolean | null;
|
44
44
|
webhook_endpoint_secret?: string | null;
|
45
45
|
adyen_payments?: AdyenPaymentRel[] | null;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class AdyenGateways extends ApiResource {
|
3
|
+
static TYPE = 'adyen_gateways';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: AdyenGateways.TYPE }, params, options);
|
5
6
|
}
|
@@ -31,5 +32,4 @@ class AdyenGateways extends ApiResource {
|
|
31
32
|
return AdyenGateways.TYPE;
|
32
33
|
}
|
33
34
|
}
|
34
|
-
AdyenGateways.TYPE = 'adyen_gateways';
|
35
35
|
export default AdyenGateways;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class AdyenPayments extends ApiResource {
|
3
|
+
static TYPE = 'adyen_payments';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: AdyenPayments.TYPE }, params, options);
|
5
6
|
}
|
@@ -34,5 +35,4 @@ class AdyenPayments extends ApiResource {
|
|
34
35
|
return AdyenPayments.TYPE;
|
35
36
|
}
|
36
37
|
}
|
37
|
-
AdyenPayments.TYPE = 'adyen_payments';
|
38
38
|
export default AdyenPayments;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiSingleton } from '../resource';
|
2
2
|
class Applications extends ApiSingleton {
|
3
|
+
static TYPE = 'application';
|
3
4
|
isApplication(resource) {
|
4
5
|
return resource.type && (resource.type === Applications.TYPE);
|
5
6
|
}
|
@@ -10,5 +11,4 @@ class Applications extends ApiSingleton {
|
|
10
11
|
return Applications.TYPE;
|
11
12
|
}
|
12
13
|
}
|
13
|
-
Applications.TYPE = 'application';
|
14
14
|
export default Applications;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class Attachments extends ApiResource {
|
3
|
+
static TYPE = 'attachments';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: Attachments.TYPE }, params, options);
|
5
6
|
}
|
@@ -19,5 +20,4 @@ class Attachments extends ApiResource {
|
|
19
20
|
return Attachments.TYPE;
|
20
21
|
}
|
21
22
|
}
|
22
|
-
Attachments.TYPE = 'attachments';
|
23
23
|
export default Attachments;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class Authorizations extends ApiResource {
|
3
|
+
static TYPE = 'authorizations';
|
3
4
|
async update(resource, params, options) {
|
4
5
|
return this.resources.update({ ...resource, type: Authorizations.TYPE }, params, options);
|
5
6
|
}
|
@@ -46,5 +47,4 @@ class Authorizations extends ApiResource {
|
|
46
47
|
return Authorizations.TYPE;
|
47
48
|
}
|
48
49
|
}
|
49
|
-
Authorizations.TYPE = 'authorizations';
|
50
50
|
export default Authorizations;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class AvalaraAccounts extends ApiResource {
|
3
|
+
static TYPE = 'avalara_accounts';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: AvalaraAccounts.TYPE }, params, options);
|
5
6
|
}
|
@@ -35,5 +36,4 @@ class AvalaraAccounts extends ApiResource {
|
|
35
36
|
return AvalaraAccounts.TYPE;
|
36
37
|
}
|
37
38
|
}
|
38
|
-
AvalaraAccounts.TYPE = 'avalara_accounts';
|
39
39
|
export default AvalaraAccounts;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class AxerveGateways extends ApiResource {
|
3
|
+
static TYPE = 'axerve_gateways';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: AxerveGateways.TYPE }, params, options);
|
5
6
|
}
|
@@ -31,5 +32,4 @@ class AxerveGateways extends ApiResource {
|
|
31
32
|
return AxerveGateways.TYPE;
|
32
33
|
}
|
33
34
|
}
|
34
|
-
AxerveGateways.TYPE = 'axerve_gateways';
|
35
35
|
export default AxerveGateways;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class AxervePayments extends ApiResource {
|
3
|
+
static TYPE = 'axerve_payments';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: AxervePayments.TYPE }, params, options);
|
5
6
|
}
|
@@ -34,5 +35,4 @@ class AxervePayments extends ApiResource {
|
|
34
35
|
return AxervePayments.TYPE;
|
35
36
|
}
|
36
37
|
}
|
37
|
-
AxervePayments.TYPE = 'axerve_payments';
|
38
38
|
export default AxervePayments;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class BillingInfoValidationRules extends ApiResource {
|
3
|
+
static TYPE = 'billing_info_validation_rules';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: BillingInfoValidationRules.TYPE }, params, options);
|
5
6
|
}
|
@@ -31,5 +32,4 @@ class BillingInfoValidationRules extends ApiResource {
|
|
31
32
|
return BillingInfoValidationRules.TYPE;
|
32
33
|
}
|
33
34
|
}
|
34
|
-
BillingInfoValidationRules.TYPE = 'billing_info_validation_rules';
|
35
35
|
export default BillingInfoValidationRules;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class BingGeocoders extends ApiResource {
|
3
|
+
static TYPE = 'bing_geocoders';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: BingGeocoders.TYPE }, params, options);
|
5
6
|
}
|
@@ -27,5 +28,4 @@ class BingGeocoders extends ApiResource {
|
|
27
28
|
return BingGeocoders.TYPE;
|
28
29
|
}
|
29
30
|
}
|
30
|
-
BingGeocoders.TYPE = 'bing_geocoders';
|
31
31
|
export default BingGeocoders;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class BraintreeGateways extends ApiResource {
|
3
|
+
static TYPE = 'braintree_gateways';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: BraintreeGateways.TYPE }, params, options);
|
5
6
|
}
|
@@ -31,5 +32,4 @@ class BraintreeGateways extends ApiResource {
|
|
31
32
|
return BraintreeGateways.TYPE;
|
32
33
|
}
|
33
34
|
}
|
34
|
-
BraintreeGateways.TYPE = 'braintree_gateways';
|
35
35
|
export default BraintreeGateways;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class BraintreePayments extends ApiResource {
|
3
|
+
static TYPE = 'braintree_payments';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: BraintreePayments.TYPE }, params, options);
|
5
6
|
}
|
@@ -31,5 +32,4 @@ class BraintreePayments extends ApiResource {
|
|
31
32
|
return BraintreePayments.TYPE;
|
32
33
|
}
|
33
34
|
}
|
34
|
-
BraintreePayments.TYPE = 'braintree_payments';
|
35
35
|
export default BraintreePayments;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class Bundles extends ApiResource {
|
3
|
+
static TYPE = 'bundles';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: Bundles.TYPE }, params, options);
|
5
6
|
}
|
@@ -53,5 +54,4 @@ class Bundles extends ApiResource {
|
|
53
54
|
return Bundles.TYPE;
|
54
55
|
}
|
55
56
|
}
|
56
|
-
Bundles.TYPE = 'bundles';
|
57
57
|
export default Bundles;
|
@@ -2,13 +2,13 @@ import { ApiResource } from '../resource';
|
|
2
2
|
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { Market, MarketType } from './markets';
|
5
|
-
import type { PromotionRule
|
5
|
+
import type { PromotionRule } from './promotion_rules';
|
6
6
|
import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
|
7
7
|
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
9
|
import type { CustomPromotionRule, CustomPromotionRuleType } from './custom_promotion_rules';
|
10
|
-
import type { Coupon, CouponType } from './coupons';
|
11
10
|
import type { SkuList, SkuListType } from './sku_lists';
|
11
|
+
import type { Coupon } from './coupons';
|
12
12
|
import type { Attachment } from './attachments';
|
13
13
|
import type { Event } from './events';
|
14
14
|
import type { Tag, TagType } from './tags';
|
@@ -21,9 +21,6 @@ type BuyXPayYPromotionRel = ResourceRel & {
|
|
21
21
|
type MarketRel = ResourceRel & {
|
22
22
|
type: MarketType;
|
23
23
|
};
|
24
|
-
type PromotionRuleRel = ResourceRel & {
|
25
|
-
type: PromotionRuleType;
|
26
|
-
};
|
27
24
|
type OrderAmountPromotionRuleRel = ResourceRel & {
|
28
25
|
type: OrderAmountPromotionRuleType;
|
29
26
|
};
|
@@ -36,9 +33,6 @@ type CouponCodesPromotionRuleRel = ResourceRel & {
|
|
36
33
|
type CustomPromotionRuleRel = ResourceRel & {
|
37
34
|
type: CustomPromotionRuleType;
|
38
35
|
};
|
39
|
-
type CouponRel = ResourceRel & {
|
40
|
-
type: CouponType;
|
41
|
-
};
|
42
36
|
type SkuListRel = ResourceRel & {
|
43
37
|
type: SkuListType;
|
44
38
|
};
|
@@ -66,8 +60,8 @@ interface BuyXPayYPromotion extends Resource {
|
|
66
60
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
67
61
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
68
62
|
custom_promotion_rule?: CustomPromotionRule | null;
|
69
|
-
coupons?: Coupon[] | null;
|
70
63
|
sku_list?: SkuList | null;
|
64
|
+
coupons?: Coupon[] | null;
|
71
65
|
attachments?: Attachment[] | null;
|
72
66
|
events?: Event[] | null;
|
73
67
|
tags?: Tag[] | null;
|
@@ -88,12 +82,10 @@ interface BuyXPayYPromotionCreate extends ResourceCreate {
|
|
88
82
|
y: number;
|
89
83
|
cheapest_free?: boolean | null;
|
90
84
|
market?: MarketRel | null;
|
91
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
92
85
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
93
86
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
94
87
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
95
88
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
96
|
-
coupons?: CouponRel[] | null;
|
97
89
|
sku_list: SkuListRel;
|
98
90
|
tags?: TagRel[] | null;
|
99
91
|
}
|
@@ -111,12 +103,10 @@ interface BuyXPayYPromotionUpdate extends ResourceUpdate {
|
|
111
103
|
y?: number | null;
|
112
104
|
cheapest_free?: boolean | null;
|
113
105
|
market?: MarketRel | null;
|
114
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
115
106
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
116
107
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
117
108
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
118
109
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
119
|
-
coupons?: CouponRel[] | null;
|
120
110
|
sku_list?: SkuListRel | null;
|
121
111
|
tags?: TagRel[] | null;
|
122
112
|
}
|
@@ -130,8 +120,8 @@ declare class BuyXPayYPromotions extends ApiResource<BuyXPayYPromotion> {
|
|
130
120
|
sku_list_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
131
121
|
coupon_codes_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
132
122
|
custom_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
133
|
-
coupons(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
134
123
|
sku_list(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
124
|
+
coupons(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
135
125
|
attachments(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
136
126
|
events(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
137
127
|
tags(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class BuyXPayYPromotions extends ApiResource {
|
3
|
+
static TYPE = 'buy_x_pay_y_promotions';
|
3
4
|
async create(resource, params, options) {
|
4
5
|
return this.resources.create({ ...resource, type: BuyXPayYPromotions.TYPE }, params, options);
|
5
6
|
}
|
@@ -29,14 +30,14 @@ class BuyXPayYPromotions extends ApiResource {
|
|
29
30
|
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
30
31
|
return this.resources.fetch({ type: 'custom_promotion_rules' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/custom_promotion_rule`, params, options);
|
31
32
|
}
|
32
|
-
async coupons(buyXPayYPromotionId, params, options) {
|
33
|
-
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
34
|
-
return this.resources.fetch({ type: 'coupons' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/coupons`, params, options);
|
35
|
-
}
|
36
33
|
async sku_list(buyXPayYPromotionId, params, options) {
|
37
34
|
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
38
35
|
return this.resources.fetch({ type: 'sku_lists' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/sku_list`, params, options);
|
39
36
|
}
|
37
|
+
async coupons(buyXPayYPromotionId, params, options) {
|
38
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
39
|
+
return this.resources.fetch({ type: 'coupons' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/coupons`, params, options);
|
40
|
+
}
|
40
41
|
async attachments(buyXPayYPromotionId, params, options) {
|
41
42
|
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
42
43
|
return this.resources.fetch({ type: 'attachments' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/attachments`, params, options);
|
@@ -73,5 +74,4 @@ class BuyXPayYPromotions extends ApiResource {
|
|
73
74
|
return BuyXPayYPromotions.TYPE;
|
74
75
|
}
|
75
76
|
}
|
76
|
-
BuyXPayYPromotions.TYPE = 'buy_x_pay_y_promotions';
|
77
77
|
export default BuyXPayYPromotions;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class Captures extends ApiResource {
|
3
|
+
static TYPE = 'captures';
|
3
4
|
async update(resource, params, options) {
|
4
5
|
return this.resources.update({ ...resource, type: Captures.TYPE }, params, options);
|
5
6
|
}
|
@@ -43,5 +44,4 @@ class Captures extends ApiResource {
|
|
43
44
|
return Captures.TYPE;
|
44
45
|
}
|
45
46
|
}
|
46
|
-
Captures.TYPE = 'captures';
|
47
47
|
export default Captures;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ApiResource } from '../resource';
|
2
2
|
class CarrierAccounts extends ApiResource {
|
3
|
+
static TYPE = 'carrier_accounts';
|
3
4
|
async market(carrierAccountId, params, options) {
|
4
5
|
const _carrierAccountId = carrierAccountId.id || carrierAccountId;
|
5
6
|
return this.resources.fetch({ type: 'markets' }, `carrier_accounts/${_carrierAccountId}/market`, params, options);
|
@@ -22,5 +23,4 @@ class CarrierAccounts extends ApiResource {
|
|
22
23
|
return CarrierAccounts.TYPE;
|
23
24
|
}
|
24
25
|
}
|
25
|
-
CarrierAccounts.TYPE = 'carrier_accounts';
|
26
26
|
export default CarrierAccounts;
|