@commercelayer/sdk 4.25.0 → 4.27.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/api.d.ts +9 -2
- package/lib/cjs/api.js +23 -2
- package/lib/cjs/commercelayer.d.ts +9 -2
- package/lib/cjs/commercelayer.js +8 -1
- package/lib/cjs/model.d.ts +8 -1
- package/lib/cjs/resources/axerve_payments.d.ts +1 -0
- package/lib/cjs/resources/customer_payment_sources.d.ts +7 -3
- package/lib/cjs/resources/fixed_price_promotions.d.ts +3 -3
- package/lib/cjs/resources/fixed_price_promotions.js +4 -4
- package/lib/cjs/resources/free_gift_promotions.d.ts +3 -3
- package/lib/cjs/resources/free_gift_promotions.js +4 -4
- package/lib/cjs/resources/free_shipping_promotions.d.ts +3 -0
- package/lib/cjs/resources/free_shipping_promotions.js +4 -0
- package/lib/cjs/resources/line_items.d.ts +3 -0
- package/lib/cjs/resources/markets.d.ts +8 -0
- package/lib/cjs/resources/markets.js +4 -0
- package/lib/cjs/resources/order_copies.d.ts +11 -9
- package/lib/cjs/resources/order_copies.js +7 -4
- package/lib/cjs/resources/order_factories.d.ts +33 -0
- package/lib/cjs/resources/order_factories.js +36 -0
- package/lib/cjs/resources/order_subscription_items.d.ts +60 -0
- package/lib/cjs/resources/order_subscription_items.js +37 -0
- package/lib/cjs/resources/order_subscriptions.d.ts +25 -3
- package/lib/cjs/resources/order_subscriptions.js +18 -2
- package/lib/cjs/resources/orders.d.ts +15 -3
- package/lib/cjs/resources/orders.js +8 -0
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +3 -3
- package/lib/cjs/resources/percentage_discount_promotions.js +4 -4
- package/lib/cjs/resources/price_frequency_tiers.d.ts +49 -0
- package/lib/cjs/resources/price_frequency_tiers.js +45 -0
- package/lib/cjs/resources/price_volume_tiers.d.ts +3 -0
- package/lib/cjs/resources/price_volume_tiers.js +4 -0
- package/lib/cjs/resources/prices.d.ts +3 -0
- package/lib/cjs/resources/prices.js +4 -0
- package/lib/cjs/resources/promotions.d.ts +3 -0
- package/lib/cjs/resources/promotions.js +4 -0
- package/lib/cjs/resources/recurring_order_copies.d.ts +52 -0
- package/lib/cjs/resources/recurring_order_copies.js +49 -0
- package/lib/cjs/resources/satispay_gateways.d.ts +39 -0
- package/lib/cjs/resources/satispay_gateways.js +41 -0
- package/lib/cjs/resources/satispay_payments.d.ts +43 -0
- package/lib/cjs/resources/satispay_payments.js +41 -0
- package/lib/cjs/resources/subscription_models.d.ts +48 -0
- package/lib/cjs/resources/subscription_models.js +45 -0
- package/lib/esm/api.d.ts +9 -2
- package/lib/esm/api.js +14 -0
- package/lib/esm/commercelayer.d.ts +9 -2
- package/lib/esm/commercelayer.js +8 -1
- package/lib/esm/model.d.ts +8 -1
- package/lib/esm/resources/axerve_payments.d.ts +1 -0
- package/lib/esm/resources/customer_payment_sources.d.ts +7 -3
- package/lib/esm/resources/fixed_price_promotions.d.ts +3 -3
- package/lib/esm/resources/fixed_price_promotions.js +4 -4
- package/lib/esm/resources/free_gift_promotions.d.ts +3 -3
- package/lib/esm/resources/free_gift_promotions.js +4 -4
- package/lib/esm/resources/free_shipping_promotions.d.ts +3 -0
- package/lib/esm/resources/free_shipping_promotions.js +4 -0
- package/lib/esm/resources/line_items.d.ts +3 -0
- package/lib/esm/resources/markets.d.ts +8 -0
- package/lib/esm/resources/markets.js +4 -0
- package/lib/esm/resources/order_copies.d.ts +11 -9
- package/lib/esm/resources/order_copies.js +7 -4
- package/lib/esm/resources/order_factories.d.ts +33 -0
- package/lib/esm/resources/order_factories.js +34 -0
- package/lib/esm/resources/order_subscription_items.d.ts +60 -0
- package/lib/esm/resources/order_subscription_items.js +35 -0
- package/lib/esm/resources/order_subscriptions.d.ts +25 -3
- package/lib/esm/resources/order_subscriptions.js +18 -2
- package/lib/esm/resources/orders.d.ts +15 -3
- package/lib/esm/resources/orders.js +8 -0
- package/lib/esm/resources/percentage_discount_promotions.d.ts +3 -3
- package/lib/esm/resources/percentage_discount_promotions.js +4 -4
- package/lib/esm/resources/price_frequency_tiers.d.ts +49 -0
- package/lib/esm/resources/price_frequency_tiers.js +43 -0
- package/lib/esm/resources/price_volume_tiers.d.ts +3 -0
- package/lib/esm/resources/price_volume_tiers.js +4 -0
- package/lib/esm/resources/prices.d.ts +3 -0
- package/lib/esm/resources/prices.js +4 -0
- package/lib/esm/resources/promotions.d.ts +3 -0
- package/lib/esm/resources/promotions.js +4 -0
- package/lib/esm/resources/recurring_order_copies.d.ts +52 -0
- package/lib/esm/resources/recurring_order_copies.js +47 -0
- package/lib/esm/resources/satispay_gateways.d.ts +39 -0
- package/lib/esm/resources/satispay_gateways.js +39 -0
- package/lib/esm/resources/satispay_payments.d.ts +43 -0
- package/lib/esm/resources/satispay_payments.js +39 -0
- package/lib/esm/resources/subscription_models.d.ts +48 -0
- package/lib/esm/resources/subscription_models.js +43 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
@@ -0,0 +1,35 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class OrderSubscriptionItems extends ApiResource {
|
3
|
+
// static readonly PATH = 'order_subscription_items'
|
4
|
+
async list(params, options) {
|
5
|
+
return this.resources.list({ type: OrderSubscriptionItems.TYPE }, params, options);
|
6
|
+
}
|
7
|
+
async create(resource, params, options) {
|
8
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: OrderSubscriptionItems.TYPE }), params, options);
|
9
|
+
}
|
10
|
+
async retrieve(id, params, options) {
|
11
|
+
return this.resources.retrieve({ type: OrderSubscriptionItems.TYPE, id }, params, options);
|
12
|
+
}
|
13
|
+
async update(resource, params, options) {
|
14
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: OrderSubscriptionItems.TYPE }), params, options);
|
15
|
+
}
|
16
|
+
async delete(id, options) {
|
17
|
+
await this.resources.delete({ type: OrderSubscriptionItems.TYPE, id }, options);
|
18
|
+
}
|
19
|
+
async order_subscription(orderSubscriptionItemId, params, options) {
|
20
|
+
const _orderSubscriptionItemId = orderSubscriptionItemId.id || orderSubscriptionItemId;
|
21
|
+
return this.resources.fetch({ type: 'order_subscriptions' }, `order_subscription_items/${_orderSubscriptionItemId}/order_subscription`, params, options);
|
22
|
+
}
|
23
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
24
|
+
isOrderSubscriptionItem(resource) {
|
25
|
+
return resource.type && (resource.type === OrderSubscriptionItems.TYPE);
|
26
|
+
}
|
27
|
+
relationship(id) {
|
28
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: OrderSubscriptionItems.TYPE } : { id: id.id, type: OrderSubscriptionItems.TYPE };
|
29
|
+
}
|
30
|
+
type() {
|
31
|
+
return OrderSubscriptionItems.TYPE;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
OrderSubscriptionItems.TYPE = 'order_subscription_items';
|
35
|
+
export default OrderSubscriptionItems;
|
@@ -1,9 +1,13 @@
|
|
1
1
|
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
|
2
2
|
import type { QueryParamsList, QueryParamsRetrieve } from '../query';
|
3
3
|
import type { Market } from './markets';
|
4
|
+
import type { SubscriptionModel } from './subscription_models';
|
4
5
|
import type { Order } from './orders';
|
5
6
|
import type { Customer } from './customers';
|
6
|
-
import type {
|
7
|
+
import type { CustomerPaymentSource } from './customer_payment_sources';
|
8
|
+
import type { OrderSubscriptionItem } from './order_subscription_items';
|
9
|
+
import type { OrderFactory } from './order_factories';
|
10
|
+
import type { RecurringOrderCopy } from './recurring_order_copies';
|
7
11
|
import type { Event } from './events';
|
8
12
|
type OrderSubscriptionRel = ResourceRel & {
|
9
13
|
type: typeof OrderSubscriptions.TYPE;
|
@@ -14,6 +18,9 @@ type MarketRel = ResourceRel & {
|
|
14
18
|
type OrderRel = ResourceRel & {
|
15
19
|
type: 'orders';
|
16
20
|
};
|
21
|
+
type CustomerPaymentSourceRel = ResourceRel & {
|
22
|
+
type: 'customer_payment_sources';
|
23
|
+
};
|
17
24
|
interface OrderSubscription extends Resource {
|
18
25
|
number?: string;
|
19
26
|
status?: string;
|
@@ -28,9 +35,17 @@ interface OrderSubscription extends Resource {
|
|
28
35
|
succeeded_on_last_run?: boolean;
|
29
36
|
options?: object;
|
30
37
|
market?: Market;
|
38
|
+
subscription_model?: SubscriptionModel;
|
31
39
|
source_order?: Order;
|
32
40
|
customer?: Customer;
|
33
|
-
|
41
|
+
customer_payment_source?: CustomerPaymentSource;
|
42
|
+
order_subscription_items?: OrderSubscriptionItem[];
|
43
|
+
order_factories?: OrderFactory[];
|
44
|
+
/**
|
45
|
+
* @deprecated This field should not be used as it may be removed in the future without notice
|
46
|
+
*/
|
47
|
+
order_copies?: object[];
|
48
|
+
recurring_order_copies?: RecurringOrderCopy[];
|
34
49
|
orders?: Order[];
|
35
50
|
events?: Event[];
|
36
51
|
}
|
@@ -44,10 +59,13 @@ interface OrderSubscriptionCreate extends ResourceCreate {
|
|
44
59
|
source_order: OrderRel;
|
45
60
|
}
|
46
61
|
interface OrderSubscriptionUpdate extends ResourceUpdate {
|
62
|
+
frequency?: string;
|
47
63
|
expires_at?: string;
|
64
|
+
next_run_at?: string;
|
48
65
|
_activate?: boolean;
|
49
66
|
_deactivate?: boolean;
|
50
67
|
_cancel?: boolean;
|
68
|
+
customer_payment_source?: CustomerPaymentSourceRel;
|
51
69
|
}
|
52
70
|
declare class OrderSubscriptions extends ApiResource {
|
53
71
|
static readonly TYPE: 'order_subscriptions';
|
@@ -57,9 +75,13 @@ declare class OrderSubscriptions extends ApiResource {
|
|
57
75
|
update(resource: OrderSubscriptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
|
58
76
|
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
59
77
|
market(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Market>;
|
78
|
+
subscription_model(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SubscriptionModel>;
|
60
79
|
source_order(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
61
80
|
customer(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Customer>;
|
62
|
-
|
81
|
+
customer_payment_source(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomerPaymentSource>;
|
82
|
+
order_subscription_items(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderSubscriptionItem>>;
|
83
|
+
order_factories(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderFactory>>;
|
84
|
+
recurring_order_copies(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<RecurringOrderCopy>>;
|
63
85
|
orders(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Order>>;
|
64
86
|
events(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
65
87
|
isOrderSubscription(resource: any): resource is OrderSubscription;
|
@@ -20,6 +20,10 @@ class OrderSubscriptions extends ApiResource {
|
|
20
20
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
21
21
|
return this.resources.fetch({ type: 'markets' }, `order_subscriptions/${_orderSubscriptionId}/market`, params, options);
|
22
22
|
}
|
23
|
+
async subscription_model(orderSubscriptionId, params, options) {
|
24
|
+
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
25
|
+
return this.resources.fetch({ type: 'subscription_models' }, `order_subscriptions/${_orderSubscriptionId}/subscription_model`, params, options);
|
26
|
+
}
|
23
27
|
async source_order(orderSubscriptionId, params, options) {
|
24
28
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
25
29
|
return this.resources.fetch({ type: 'orders' }, `order_subscriptions/${_orderSubscriptionId}/source_order`, params, options);
|
@@ -28,9 +32,21 @@ class OrderSubscriptions extends ApiResource {
|
|
28
32
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
29
33
|
return this.resources.fetch({ type: 'customers' }, `order_subscriptions/${_orderSubscriptionId}/customer`, params, options);
|
30
34
|
}
|
31
|
-
async
|
35
|
+
async customer_payment_source(orderSubscriptionId, params, options) {
|
36
|
+
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
37
|
+
return this.resources.fetch({ type: 'customer_payment_sources' }, `order_subscriptions/${_orderSubscriptionId}/customer_payment_source`, params, options);
|
38
|
+
}
|
39
|
+
async order_subscription_items(orderSubscriptionId, params, options) {
|
40
|
+
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
41
|
+
return this.resources.fetch({ type: 'order_subscription_items' }, `order_subscriptions/${_orderSubscriptionId}/order_subscription_items`, params, options);
|
42
|
+
}
|
43
|
+
async order_factories(orderSubscriptionId, params, options) {
|
44
|
+
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
45
|
+
return this.resources.fetch({ type: 'order_factories' }, `order_subscriptions/${_orderSubscriptionId}/order_factories`, params, options);
|
46
|
+
}
|
47
|
+
async recurring_order_copies(orderSubscriptionId, params, options) {
|
32
48
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
33
|
-
return this.resources.fetch({ type: '
|
49
|
+
return this.resources.fetch({ type: 'recurring_order_copies' }, `order_subscriptions/${_orderSubscriptionId}/recurring_order_copies`, params, options);
|
34
50
|
}
|
35
51
|
async orders(orderSubscriptionId, params, options) {
|
36
52
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
@@ -14,6 +14,7 @@ import type { CheckoutComPayment } from './checkout_com_payments';
|
|
14
14
|
import type { ExternalPayment } from './external_payments';
|
15
15
|
import type { KlarnaPayment } from './klarna_payments';
|
16
16
|
import type { PaypalPayment } from './paypal_payments';
|
17
|
+
import type { SatispayPayment } from './satispay_payments';
|
17
18
|
import type { StripePayment } from './stripe_payments';
|
18
19
|
import type { WireTransfer } from './wire_transfers';
|
19
20
|
import type { LineItem } from './line_items';
|
@@ -24,7 +25,9 @@ import type { Capture } from './captures';
|
|
24
25
|
import type { Refund } from './refunds';
|
25
26
|
import type { Return } from './returns';
|
26
27
|
import type { OrderSubscription } from './order_subscriptions';
|
28
|
+
import type { OrderFactory } from './order_factories';
|
27
29
|
import type { OrderCopy } from './order_copies';
|
30
|
+
import type { RecurringOrderCopy } from './recurring_order_copies';
|
28
31
|
import type { Attachment } from './attachments';
|
29
32
|
import type { Event } from './events';
|
30
33
|
type OrderRel = ResourceRel & {
|
@@ -63,6 +66,9 @@ type KlarnaPaymentRel = ResourceRel & {
|
|
63
66
|
type PaypalPaymentRel = ResourceRel & {
|
64
67
|
type: 'paypal_payments';
|
65
68
|
};
|
69
|
+
type SatispayPaymentRel = ResourceRel & {
|
70
|
+
type: 'satispay_payments';
|
71
|
+
};
|
66
72
|
type StripePaymentRel = ResourceRel & {
|
67
73
|
type: 'stripe_payments';
|
68
74
|
};
|
@@ -168,6 +174,7 @@ interface Order extends Resource {
|
|
168
174
|
refreshed_at?: string;
|
169
175
|
archived_at?: string;
|
170
176
|
expires_at?: string;
|
177
|
+
subscription_created_at?: string;
|
171
178
|
market?: Market;
|
172
179
|
customer?: Customer;
|
173
180
|
shipping_address?: Address;
|
@@ -177,7 +184,7 @@ interface Order extends Resource {
|
|
177
184
|
available_free_skus?: Sku[];
|
178
185
|
available_free_bundles?: Bundle[];
|
179
186
|
payment_method?: PaymentMethod;
|
180
|
-
payment_source?: AdyenPayment | AxervePayment | BraintreePayment | CheckoutComPayment | ExternalPayment | KlarnaPayment | PaypalPayment | StripePayment | WireTransfer;
|
187
|
+
payment_source?: AdyenPayment | AxervePayment | BraintreePayment | CheckoutComPayment | ExternalPayment | KlarnaPayment | PaypalPayment | SatispayPayment | StripePayment | WireTransfer;
|
181
188
|
line_items?: LineItem[];
|
182
189
|
shipments?: Shipment[];
|
183
190
|
transactions?: Array<Authorization | Void | Capture | Refund>;
|
@@ -187,7 +194,9 @@ interface Order extends Resource {
|
|
187
194
|
refunds?: Refund[];
|
188
195
|
returns?: Return[];
|
189
196
|
order_subscriptions?: OrderSubscription[];
|
197
|
+
order_factories?: OrderFactory[];
|
190
198
|
order_copies?: OrderCopy[];
|
199
|
+
recurring_order_copies?: RecurringOrderCopy[];
|
191
200
|
attachments?: Attachment[];
|
192
201
|
events?: Event[];
|
193
202
|
}
|
@@ -210,7 +219,7 @@ interface OrderCreate extends ResourceCreate {
|
|
210
219
|
shipping_address?: AddressRel;
|
211
220
|
billing_address?: AddressRel;
|
212
221
|
payment_method?: PaymentMethodRel;
|
213
|
-
payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel;
|
222
|
+
payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | SatispayPaymentRel | StripePaymentRel | WireTransferRel;
|
214
223
|
}
|
215
224
|
interface OrderUpdate extends ResourceUpdate {
|
216
225
|
autorefresh?: boolean;
|
@@ -250,12 +259,13 @@ interface OrderUpdate extends ResourceUpdate {
|
|
250
259
|
_save_billing_address_to_customer_address_book?: boolean;
|
251
260
|
_refresh?: boolean;
|
252
261
|
_validate?: boolean;
|
262
|
+
_create_subscriptions?: boolean;
|
253
263
|
market?: MarketRel;
|
254
264
|
customer?: CustomerRel;
|
255
265
|
shipping_address?: AddressRel;
|
256
266
|
billing_address?: AddressRel;
|
257
267
|
payment_method?: PaymentMethodRel;
|
258
|
-
payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel;
|
268
|
+
payment_source?: AdyenPaymentRel | AxervePaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | KlarnaPaymentRel | PaypalPaymentRel | SatispayPaymentRel | StripePaymentRel | WireTransferRel;
|
259
269
|
}
|
260
270
|
declare class Orders extends ApiResource {
|
261
271
|
static readonly TYPE: 'orders';
|
@@ -281,7 +291,9 @@ declare class Orders extends ApiResource {
|
|
281
291
|
refunds(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Refund>>;
|
282
292
|
returns(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Return>>;
|
283
293
|
order_subscriptions(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderSubscription>>;
|
294
|
+
order_factories(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderFactory>>;
|
284
295
|
order_copies(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderCopy>>;
|
296
|
+
recurring_order_copies(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<RecurringOrderCopy>>;
|
285
297
|
attachments(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
286
298
|
events(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
287
299
|
isOrder(resource: any): resource is Order;
|
@@ -84,10 +84,18 @@ class Orders extends ApiResource {
|
|
84
84
|
const _orderId = orderId.id || orderId;
|
85
85
|
return this.resources.fetch({ type: 'order_subscriptions' }, `orders/${_orderId}/order_subscriptions`, params, options);
|
86
86
|
}
|
87
|
+
async order_factories(orderId, params, options) {
|
88
|
+
const _orderId = orderId.id || orderId;
|
89
|
+
return this.resources.fetch({ type: 'order_factories' }, `orders/${_orderId}/order_factories`, params, options);
|
90
|
+
}
|
87
91
|
async order_copies(orderId, params, options) {
|
88
92
|
const _orderId = orderId.id || orderId;
|
89
93
|
return this.resources.fetch({ type: 'order_copies' }, `orders/${_orderId}/order_copies`, params, options);
|
90
94
|
}
|
95
|
+
async recurring_order_copies(orderId, params, options) {
|
96
|
+
const _orderId = orderId.id || orderId;
|
97
|
+
return this.resources.fetch({ type: 'recurring_order_copies' }, `orders/${_orderId}/recurring_order_copies`, params, options);
|
98
|
+
}
|
91
99
|
async attachments(orderId, params, options) {
|
92
100
|
const _orderId = orderId.id || orderId;
|
93
101
|
return this.resources.fetch({ type: 'attachments' }, `orders/${_orderId}/attachments`, params, options);
|
@@ -6,9 +6,9 @@ import type { OrderAmountPromotionRule } from './order_amount_promotion_rules';
|
|
6
6
|
import type { SkuListPromotionRule } from './sku_list_promotion_rules';
|
7
7
|
import type { CouponCodesPromotionRule } from './coupon_codes_promotion_rules';
|
8
8
|
import type { Attachment } from './attachments';
|
9
|
+
import type { Event } from './events';
|
9
10
|
import type { SkuList } from './sku_lists';
|
10
11
|
import type { Sku } from './skus';
|
11
|
-
import type { Event } from './events';
|
12
12
|
type PercentageDiscountPromotionRel = ResourceRel & {
|
13
13
|
type: typeof PercentageDiscountPromotions.TYPE;
|
14
14
|
};
|
@@ -45,9 +45,9 @@ interface PercentageDiscountPromotion extends Resource {
|
|
45
45
|
sku_list_promotion_rule?: SkuListPromotionRule;
|
46
46
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule;
|
47
47
|
attachments?: Attachment[];
|
48
|
+
events?: Event[];
|
48
49
|
sku_list?: SkuList;
|
49
50
|
skus?: Sku[];
|
50
|
-
events?: Event[];
|
51
51
|
}
|
52
52
|
interface PercentageDiscountPromotionCreate extends ResourceCreate {
|
53
53
|
name: string;
|
@@ -89,9 +89,9 @@ declare class PercentageDiscountPromotions extends ApiResource {
|
|
89
89
|
sku_list_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
90
90
|
coupon_codes_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
91
91
|
attachments(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
92
|
+
events(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
92
93
|
sku_list(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
93
94
|
skus(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
94
|
-
events(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
95
95
|
isPercentageDiscountPromotion(resource: any): resource is PercentageDiscountPromotion;
|
96
96
|
relationship(id: string | ResourceId | null): PercentageDiscountPromotionRel;
|
97
97
|
type(): string;
|
@@ -36,6 +36,10 @@ class PercentageDiscountPromotions extends ApiResource {
|
|
36
36
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
37
37
|
return this.resources.fetch({ type: 'attachments' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/attachments`, params, options);
|
38
38
|
}
|
39
|
+
async events(percentageDiscountPromotionId, params, options) {
|
40
|
+
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
41
|
+
return this.resources.fetch({ type: 'events' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/events`, params, options);
|
42
|
+
}
|
39
43
|
async sku_list(percentageDiscountPromotionId, params, options) {
|
40
44
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
41
45
|
return this.resources.fetch({ type: 'sku_lists' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options);
|
@@ -44,10 +48,6 @@ class PercentageDiscountPromotions extends ApiResource {
|
|
44
48
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
45
49
|
return this.resources.fetch({ type: 'skus' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/skus`, params, options);
|
46
50
|
}
|
47
|
-
async events(percentageDiscountPromotionId, params, options) {
|
48
|
-
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
49
|
-
return this.resources.fetch({ type: 'events' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/events`, params, options);
|
50
|
-
}
|
51
51
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
52
52
|
isPercentageDiscountPromotion(resource) {
|
53
53
|
return resource.type && (resource.type === PercentageDiscountPromotions.TYPE);
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
|
2
|
+
import type { QueryParamsList, QueryParamsRetrieve } from '../query';
|
3
|
+
import type { Price } from './prices';
|
4
|
+
import type { Attachment } from './attachments';
|
5
|
+
import type { Event } from './events';
|
6
|
+
type PriceFrequencyTierRel = ResourceRel & {
|
7
|
+
type: typeof PriceFrequencyTiers.TYPE;
|
8
|
+
};
|
9
|
+
type PriceRel = ResourceRel & {
|
10
|
+
type: 'prices';
|
11
|
+
};
|
12
|
+
interface PriceFrequencyTier extends Resource {
|
13
|
+
name?: string;
|
14
|
+
up_to?: number;
|
15
|
+
price_amount_cents?: number;
|
16
|
+
price_amount_float?: number;
|
17
|
+
formatted_price_amount?: string;
|
18
|
+
price?: Price;
|
19
|
+
attachments?: Attachment[];
|
20
|
+
events?: Event[];
|
21
|
+
}
|
22
|
+
interface PriceFrequencyTierCreate extends ResourceCreate {
|
23
|
+
name: string;
|
24
|
+
up_to?: number;
|
25
|
+
price_amount_cents: number;
|
26
|
+
price: PriceRel;
|
27
|
+
}
|
28
|
+
interface PriceFrequencyTierUpdate extends ResourceUpdate {
|
29
|
+
name?: string;
|
30
|
+
up_to?: number;
|
31
|
+
price_amount_cents?: number;
|
32
|
+
price?: PriceRel;
|
33
|
+
}
|
34
|
+
declare class PriceFrequencyTiers extends ApiResource {
|
35
|
+
static readonly TYPE: 'price_frequency_tiers';
|
36
|
+
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PriceFrequencyTier>>;
|
37
|
+
create(resource: PriceFrequencyTierCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PriceFrequencyTier>;
|
38
|
+
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PriceFrequencyTier>;
|
39
|
+
update(resource: PriceFrequencyTierUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PriceFrequencyTier>;
|
40
|
+
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
41
|
+
price(priceFrequencyTierId: string | PriceFrequencyTier, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Price>;
|
42
|
+
attachments(priceFrequencyTierId: string | PriceFrequencyTier, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
43
|
+
events(priceFrequencyTierId: string | PriceFrequencyTier, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
44
|
+
isPriceFrequencyTier(resource: any): resource is PriceFrequencyTier;
|
45
|
+
relationship(id: string | ResourceId | null): PriceFrequencyTierRel;
|
46
|
+
type(): string;
|
47
|
+
}
|
48
|
+
export default PriceFrequencyTiers;
|
49
|
+
export { PriceFrequencyTier, PriceFrequencyTierCreate, PriceFrequencyTierUpdate };
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class PriceFrequencyTiers extends ApiResource {
|
3
|
+
// static readonly PATH = 'price_frequency_tiers'
|
4
|
+
async list(params, options) {
|
5
|
+
return this.resources.list({ type: PriceFrequencyTiers.TYPE }, params, options);
|
6
|
+
}
|
7
|
+
async create(resource, params, options) {
|
8
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: PriceFrequencyTiers.TYPE }), params, options);
|
9
|
+
}
|
10
|
+
async retrieve(id, params, options) {
|
11
|
+
return this.resources.retrieve({ type: PriceFrequencyTiers.TYPE, id }, params, options);
|
12
|
+
}
|
13
|
+
async update(resource, params, options) {
|
14
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: PriceFrequencyTiers.TYPE }), params, options);
|
15
|
+
}
|
16
|
+
async delete(id, options) {
|
17
|
+
await this.resources.delete({ type: PriceFrequencyTiers.TYPE, id }, options);
|
18
|
+
}
|
19
|
+
async price(priceFrequencyTierId, params, options) {
|
20
|
+
const _priceFrequencyTierId = priceFrequencyTierId.id || priceFrequencyTierId;
|
21
|
+
return this.resources.fetch({ type: 'prices' }, `price_frequency_tiers/${_priceFrequencyTierId}/price`, params, options);
|
22
|
+
}
|
23
|
+
async attachments(priceFrequencyTierId, params, options) {
|
24
|
+
const _priceFrequencyTierId = priceFrequencyTierId.id || priceFrequencyTierId;
|
25
|
+
return this.resources.fetch({ type: 'attachments' }, `price_frequency_tiers/${_priceFrequencyTierId}/attachments`, params, options);
|
26
|
+
}
|
27
|
+
async events(priceFrequencyTierId, params, options) {
|
28
|
+
const _priceFrequencyTierId = priceFrequencyTierId.id || priceFrequencyTierId;
|
29
|
+
return this.resources.fetch({ type: 'events' }, `price_frequency_tiers/${_priceFrequencyTierId}/events`, params, options);
|
30
|
+
}
|
31
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
32
|
+
isPriceFrequencyTier(resource) {
|
33
|
+
return resource.type && (resource.type === PriceFrequencyTiers.TYPE);
|
34
|
+
}
|
35
|
+
relationship(id) {
|
36
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: PriceFrequencyTiers.TYPE } : { id: id.id, type: PriceFrequencyTiers.TYPE };
|
37
|
+
}
|
38
|
+
type() {
|
39
|
+
return PriceFrequencyTiers.TYPE;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
PriceFrequencyTiers.TYPE = 'price_frequency_tiers';
|
43
|
+
export default PriceFrequencyTiers;
|
@@ -2,6 +2,7 @@ import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig,
|
|
2
2
|
import type { QueryParamsList, QueryParamsRetrieve } from '../query';
|
3
3
|
import type { Price } from './prices';
|
4
4
|
import type { Attachment } from './attachments';
|
5
|
+
import type { Event } from './events';
|
5
6
|
type PriceVolumeTierRel = ResourceRel & {
|
6
7
|
type: typeof PriceVolumeTiers.TYPE;
|
7
8
|
};
|
@@ -16,6 +17,7 @@ interface PriceVolumeTier extends Resource {
|
|
16
17
|
formatted_price_amount?: string;
|
17
18
|
price?: Price;
|
18
19
|
attachments?: Attachment[];
|
20
|
+
events?: Event[];
|
19
21
|
}
|
20
22
|
interface PriceVolumeTierCreate extends ResourceCreate {
|
21
23
|
name: string;
|
@@ -38,6 +40,7 @@ declare class PriceVolumeTiers extends ApiResource {
|
|
38
40
|
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
39
41
|
price(priceVolumeTierId: string | PriceVolumeTier, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Price>;
|
40
42
|
attachments(priceVolumeTierId: string | PriceVolumeTier, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
43
|
+
events(priceVolumeTierId: string | PriceVolumeTier, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
41
44
|
isPriceVolumeTier(resource: any): resource is PriceVolumeTier;
|
42
45
|
relationship(id: string | ResourceId | null): PriceVolumeTierRel;
|
43
46
|
type(): string;
|
@@ -24,6 +24,10 @@ class PriceVolumeTiers extends ApiResource {
|
|
24
24
|
const _priceVolumeTierId = priceVolumeTierId.id || priceVolumeTierId;
|
25
25
|
return this.resources.fetch({ type: 'attachments' }, `price_volume_tiers/${_priceVolumeTierId}/attachments`, params, options);
|
26
26
|
}
|
27
|
+
async events(priceVolumeTierId, params, options) {
|
28
|
+
const _priceVolumeTierId = priceVolumeTierId.id || priceVolumeTierId;
|
29
|
+
return this.resources.fetch({ type: 'events' }, `price_volume_tiers/${_priceVolumeTierId}/events`, params, options);
|
30
|
+
}
|
27
31
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
28
32
|
isPriceVolumeTier(resource) {
|
29
33
|
return resource.type && (resource.type === PriceVolumeTiers.TYPE);
|
@@ -4,6 +4,7 @@ import type { PriceList } from './price_lists';
|
|
4
4
|
import type { Sku } from './skus';
|
5
5
|
import type { PriceTier } from './price_tiers';
|
6
6
|
import type { PriceVolumeTier } from './price_volume_tiers';
|
7
|
+
import type { PriceFrequencyTier } from './price_frequency_tiers';
|
7
8
|
import type { Attachment } from './attachments';
|
8
9
|
type PriceRel = ResourceRel & {
|
9
10
|
type: typeof Prices.TYPE;
|
@@ -30,6 +31,7 @@ interface Price extends Resource {
|
|
30
31
|
sku?: Sku;
|
31
32
|
price_tiers?: PriceTier[];
|
32
33
|
price_volume_tiers?: PriceVolumeTier[];
|
34
|
+
price_frequency_tiers?: PriceFrequencyTier[];
|
33
35
|
attachments?: Attachment[];
|
34
36
|
}
|
35
37
|
interface PriceCreate extends ResourceCreate {
|
@@ -59,6 +61,7 @@ declare class Prices extends ApiResource {
|
|
59
61
|
sku(priceId: string | Price, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Sku>;
|
60
62
|
price_tiers(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PriceTier>>;
|
61
63
|
price_volume_tiers(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PriceVolumeTier>>;
|
64
|
+
price_frequency_tiers(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PriceFrequencyTier>>;
|
62
65
|
attachments(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
63
66
|
isPrice(resource: any): resource is Price;
|
64
67
|
relationship(id: string | ResourceId | null): PriceRel;
|
@@ -32,6 +32,10 @@ class Prices extends ApiResource {
|
|
32
32
|
const _priceId = priceId.id || priceId;
|
33
33
|
return this.resources.fetch({ type: 'price_volume_tiers' }, `prices/${_priceId}/price_volume_tiers`, params, options);
|
34
34
|
}
|
35
|
+
async price_frequency_tiers(priceId, params, options) {
|
36
|
+
const _priceId = priceId.id || priceId;
|
37
|
+
return this.resources.fetch({ type: 'price_frequency_tiers' }, `prices/${_priceId}/price_frequency_tiers`, params, options);
|
38
|
+
}
|
35
39
|
async attachments(priceId, params, options) {
|
36
40
|
const _priceId = priceId.id || priceId;
|
37
41
|
return this.resources.fetch({ type: 'attachments' }, `prices/${_priceId}/attachments`, params, options);
|
@@ -6,6 +6,7 @@ import type { OrderAmountPromotionRule } from './order_amount_promotion_rules';
|
|
6
6
|
import type { SkuListPromotionRule } from './sku_list_promotion_rules';
|
7
7
|
import type { CouponCodesPromotionRule } from './coupon_codes_promotion_rules';
|
8
8
|
import type { Attachment } from './attachments';
|
9
|
+
import type { Event } from './events';
|
9
10
|
type PromotionRel = ResourceRel & {
|
10
11
|
type: typeof Promotions.TYPE;
|
11
12
|
};
|
@@ -23,6 +24,7 @@ interface Promotion extends Resource {
|
|
23
24
|
sku_list_promotion_rule?: SkuListPromotionRule;
|
24
25
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule;
|
25
26
|
attachments?: Attachment[];
|
27
|
+
events?: Event[];
|
26
28
|
}
|
27
29
|
declare class Promotions extends ApiResource {
|
28
30
|
static readonly TYPE: 'promotions';
|
@@ -33,6 +35,7 @@ declare class Promotions extends ApiResource {
|
|
33
35
|
sku_list_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
34
36
|
coupon_codes_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
35
37
|
attachments(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
38
|
+
events(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
36
39
|
isPromotion(resource: any): resource is Promotion;
|
37
40
|
relationship(id: string | ResourceId | null): PromotionRel;
|
38
41
|
type(): string;
|
@@ -27,6 +27,10 @@ class Promotions extends ApiResource {
|
|
27
27
|
const _promotionId = promotionId.id || promotionId;
|
28
28
|
return this.resources.fetch({ type: 'attachments' }, `promotions/${_promotionId}/attachments`, params, options);
|
29
29
|
}
|
30
|
+
async events(promotionId, params, options) {
|
31
|
+
const _promotionId = promotionId.id || promotionId;
|
32
|
+
return this.resources.fetch({ type: 'events' }, `promotions/${_promotionId}/events`, params, options);
|
33
|
+
}
|
30
34
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
31
35
|
isPromotion(resource) {
|
32
36
|
return resource.type && (resource.type === Promotions.TYPE);
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
|
2
|
+
import type { QueryParamsList, QueryParamsRetrieve } from '../query';
|
3
|
+
import type { Order } from './orders';
|
4
|
+
import type { Event } from './events';
|
5
|
+
import type { OrderSubscription } from './order_subscriptions';
|
6
|
+
type RecurringOrderCopyRel = ResourceRel & {
|
7
|
+
type: typeof RecurringOrderCopies.TYPE;
|
8
|
+
};
|
9
|
+
type OrderRel = ResourceRel & {
|
10
|
+
type: 'orders';
|
11
|
+
};
|
12
|
+
type OrderSubscriptionRel = ResourceRel & {
|
13
|
+
type: 'order_subscriptions';
|
14
|
+
};
|
15
|
+
interface RecurringOrderCopy extends Resource {
|
16
|
+
status?: string;
|
17
|
+
started_at?: string;
|
18
|
+
completed_at?: string;
|
19
|
+
failed_at?: string;
|
20
|
+
errors_log?: object;
|
21
|
+
errors_count?: number;
|
22
|
+
place_target_order?: boolean;
|
23
|
+
reuse_wallet?: boolean;
|
24
|
+
source_order?: Order;
|
25
|
+
target_order?: Order;
|
26
|
+
events?: Event[];
|
27
|
+
order_subscription?: OrderSubscription;
|
28
|
+
}
|
29
|
+
interface RecurringOrderCopyCreate extends ResourceCreate {
|
30
|
+
place_target_order?: boolean;
|
31
|
+
reuse_wallet?: boolean;
|
32
|
+
source_order: OrderRel;
|
33
|
+
order_subscription: OrderSubscriptionRel;
|
34
|
+
}
|
35
|
+
type RecurringOrderCopyUpdate = ResourceUpdate;
|
36
|
+
declare class RecurringOrderCopies extends ApiResource {
|
37
|
+
static readonly TYPE: 'recurring_order_copies';
|
38
|
+
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<RecurringOrderCopy>>;
|
39
|
+
create(resource: RecurringOrderCopyCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<RecurringOrderCopy>;
|
40
|
+
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<RecurringOrderCopy>;
|
41
|
+
update(resource: RecurringOrderCopyUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<RecurringOrderCopy>;
|
42
|
+
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
43
|
+
source_order(recurringOrderCopyId: string | RecurringOrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
44
|
+
target_order(recurringOrderCopyId: string | RecurringOrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
45
|
+
events(recurringOrderCopyId: string | RecurringOrderCopy, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
46
|
+
order_subscription(recurringOrderCopyId: string | RecurringOrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
|
47
|
+
isRecurringOrderCopy(resource: any): resource is RecurringOrderCopy;
|
48
|
+
relationship(id: string | ResourceId | null): RecurringOrderCopyRel;
|
49
|
+
type(): string;
|
50
|
+
}
|
51
|
+
export default RecurringOrderCopies;
|
52
|
+
export { RecurringOrderCopy, RecurringOrderCopyCreate, RecurringOrderCopyUpdate };
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class RecurringOrderCopies extends ApiResource {
|
3
|
+
// static readonly PATH = 'recurring_order_copies'
|
4
|
+
async list(params, options) {
|
5
|
+
return this.resources.list({ type: RecurringOrderCopies.TYPE }, params, options);
|
6
|
+
}
|
7
|
+
async create(resource, params, options) {
|
8
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: RecurringOrderCopies.TYPE }), params, options);
|
9
|
+
}
|
10
|
+
async retrieve(id, params, options) {
|
11
|
+
return this.resources.retrieve({ type: RecurringOrderCopies.TYPE, id }, params, options);
|
12
|
+
}
|
13
|
+
async update(resource, params, options) {
|
14
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: RecurringOrderCopies.TYPE }), params, options);
|
15
|
+
}
|
16
|
+
async delete(id, options) {
|
17
|
+
await this.resources.delete({ type: RecurringOrderCopies.TYPE, id }, options);
|
18
|
+
}
|
19
|
+
async source_order(recurringOrderCopyId, params, options) {
|
20
|
+
const _recurringOrderCopyId = recurringOrderCopyId.id || recurringOrderCopyId;
|
21
|
+
return this.resources.fetch({ type: 'orders' }, `recurring_order_copies/${_recurringOrderCopyId}/source_order`, params, options);
|
22
|
+
}
|
23
|
+
async target_order(recurringOrderCopyId, params, options) {
|
24
|
+
const _recurringOrderCopyId = recurringOrderCopyId.id || recurringOrderCopyId;
|
25
|
+
return this.resources.fetch({ type: 'orders' }, `recurring_order_copies/${_recurringOrderCopyId}/target_order`, params, options);
|
26
|
+
}
|
27
|
+
async events(recurringOrderCopyId, params, options) {
|
28
|
+
const _recurringOrderCopyId = recurringOrderCopyId.id || recurringOrderCopyId;
|
29
|
+
return this.resources.fetch({ type: 'events' }, `recurring_order_copies/${_recurringOrderCopyId}/events`, params, options);
|
30
|
+
}
|
31
|
+
async order_subscription(recurringOrderCopyId, params, options) {
|
32
|
+
const _recurringOrderCopyId = recurringOrderCopyId.id || recurringOrderCopyId;
|
33
|
+
return this.resources.fetch({ type: 'order_subscriptions' }, `recurring_order_copies/${_recurringOrderCopyId}/order_subscription`, params, options);
|
34
|
+
}
|
35
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
36
|
+
isRecurringOrderCopy(resource) {
|
37
|
+
return resource.type && (resource.type === RecurringOrderCopies.TYPE);
|
38
|
+
}
|
39
|
+
relationship(id) {
|
40
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: RecurringOrderCopies.TYPE } : { id: id.id, type: RecurringOrderCopies.TYPE };
|
41
|
+
}
|
42
|
+
type() {
|
43
|
+
return RecurringOrderCopies.TYPE;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
RecurringOrderCopies.TYPE = 'recurring_order_copies';
|
47
|
+
export default RecurringOrderCopies;
|