@commercelayer/sdk 4.26.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 +7 -2
- package/lib/cjs/api.js +17 -2
- package/lib/cjs/commercelayer.d.ts +7 -2
- package/lib/cjs/commercelayer.js +6 -1
- package/lib/cjs/model.d.ts +6 -1
- 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 +8 -0
- 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/subscription_models.d.ts +48 -0
- package/lib/cjs/resources/subscription_models.js +45 -0
- package/lib/esm/api.d.ts +7 -2
- package/lib/esm/api.js +10 -0
- package/lib/esm/commercelayer.d.ts +7 -2
- package/lib/esm/commercelayer.js +6 -1
- package/lib/esm/model.d.ts +6 -1
- 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 +8 -0
- 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/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 +3 -3
@@ -0,0 +1,33 @@
|
|
1
|
+
import { ApiResource, Resource, 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
|
+
type OrderFactoryRel = ResourceRel & {
|
6
|
+
type: typeof OrderFactories.TYPE;
|
7
|
+
};
|
8
|
+
interface OrderFactory extends Resource {
|
9
|
+
status?: string;
|
10
|
+
started_at?: string;
|
11
|
+
completed_at?: string;
|
12
|
+
failed_at?: string;
|
13
|
+
errors_log?: object;
|
14
|
+
errors_count?: number;
|
15
|
+
place_target_order?: boolean;
|
16
|
+
reuse_wallet?: boolean;
|
17
|
+
source_order?: Order;
|
18
|
+
target_order?: Order;
|
19
|
+
events?: Event[];
|
20
|
+
}
|
21
|
+
declare class OrderFactories extends ApiResource {
|
22
|
+
static readonly TYPE: 'order_factories';
|
23
|
+
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderFactory>>;
|
24
|
+
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderFactory>;
|
25
|
+
source_order(orderFactoryId: string | OrderFactory, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
26
|
+
target_order(orderFactoryId: string | OrderFactory, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
27
|
+
events(orderFactoryId: string | OrderFactory, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
28
|
+
isOrderFactory(resource: any): resource is OrderFactory;
|
29
|
+
relationship(id: string | ResourceId | null): OrderFactoryRel;
|
30
|
+
type(): string;
|
31
|
+
}
|
32
|
+
export default OrderFactories;
|
33
|
+
export { OrderFactory };
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const resource_1 = require("../resource");
|
4
|
+
class OrderFactories extends resource_1.ApiResource {
|
5
|
+
// static readonly PATH = 'order_factories'
|
6
|
+
async list(params, options) {
|
7
|
+
return this.resources.list({ type: OrderFactories.TYPE }, params, options);
|
8
|
+
}
|
9
|
+
async retrieve(id, params, options) {
|
10
|
+
return this.resources.retrieve({ type: OrderFactories.TYPE, id }, params, options);
|
11
|
+
}
|
12
|
+
async source_order(orderFactoryId, params, options) {
|
13
|
+
const _orderFactoryId = orderFactoryId.id || orderFactoryId;
|
14
|
+
return this.resources.fetch({ type: 'orders' }, `order_factories/${_orderFactoryId}/source_order`, params, options);
|
15
|
+
}
|
16
|
+
async target_order(orderFactoryId, params, options) {
|
17
|
+
const _orderFactoryId = orderFactoryId.id || orderFactoryId;
|
18
|
+
return this.resources.fetch({ type: 'orders' }, `order_factories/${_orderFactoryId}/target_order`, params, options);
|
19
|
+
}
|
20
|
+
async events(orderFactoryId, params, options) {
|
21
|
+
const _orderFactoryId = orderFactoryId.id || orderFactoryId;
|
22
|
+
return this.resources.fetch({ type: 'events' }, `order_factories/${_orderFactoryId}/events`, params, options);
|
23
|
+
}
|
24
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
25
|
+
isOrderFactory(resource) {
|
26
|
+
return resource.type && (resource.type === OrderFactories.TYPE);
|
27
|
+
}
|
28
|
+
relationship(id) {
|
29
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: OrderFactories.TYPE } : { id: id.id, type: OrderFactories.TYPE };
|
30
|
+
}
|
31
|
+
type() {
|
32
|
+
return OrderFactories.TYPE;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
OrderFactories.TYPE = 'order_factories';
|
36
|
+
exports.default = OrderFactories;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
|
2
|
+
import type { QueryParamsList, QueryParamsRetrieve } from '../query';
|
3
|
+
import type { OrderSubscription } from './order_subscriptions';
|
4
|
+
import type { Adjustment } from './adjustments';
|
5
|
+
import type { Bundle } from './bundles';
|
6
|
+
import type { Sku } from './skus';
|
7
|
+
type OrderSubscriptionItemRel = ResourceRel & {
|
8
|
+
type: typeof OrderSubscriptionItems.TYPE;
|
9
|
+
};
|
10
|
+
type OrderSubscriptionRel = ResourceRel & {
|
11
|
+
type: 'order_subscriptions';
|
12
|
+
};
|
13
|
+
type AdjustmentRel = ResourceRel & {
|
14
|
+
type: 'adjustments';
|
15
|
+
};
|
16
|
+
type BundleRel = ResourceRel & {
|
17
|
+
type: 'bundles';
|
18
|
+
};
|
19
|
+
type SkuRel = ResourceRel & {
|
20
|
+
type: 'skus';
|
21
|
+
};
|
22
|
+
interface OrderSubscriptionItem extends Resource {
|
23
|
+
quantity?: number;
|
24
|
+
unit_amount_cents?: number;
|
25
|
+
unit_amount_float?: number;
|
26
|
+
formatted_unit_amount?: string;
|
27
|
+
total_amount_cents?: number;
|
28
|
+
total_amount_float?: number;
|
29
|
+
formatted_total_amount?: string;
|
30
|
+
order_subscription?: OrderSubscription;
|
31
|
+
item?: Adjustment | Bundle | Sku;
|
32
|
+
}
|
33
|
+
interface OrderSubscriptionItemCreate extends ResourceCreate {
|
34
|
+
sku_code?: string;
|
35
|
+
bundle_code?: string;
|
36
|
+
quantity: number;
|
37
|
+
unit_amount_cents?: number;
|
38
|
+
order_subscription: OrderSubscriptionRel;
|
39
|
+
item: AdjustmentRel | BundleRel | SkuRel;
|
40
|
+
}
|
41
|
+
interface OrderSubscriptionItemUpdate extends ResourceUpdate {
|
42
|
+
sku_code?: string;
|
43
|
+
bundle_code?: string;
|
44
|
+
quantity?: number;
|
45
|
+
unit_amount_cents?: number;
|
46
|
+
}
|
47
|
+
declare class OrderSubscriptionItems extends ApiResource {
|
48
|
+
static readonly TYPE: 'order_subscription_items';
|
49
|
+
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderSubscriptionItem>>;
|
50
|
+
create(resource: OrderSubscriptionItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscriptionItem>;
|
51
|
+
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscriptionItem>;
|
52
|
+
update(resource: OrderSubscriptionItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscriptionItem>;
|
53
|
+
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
54
|
+
order_subscription(orderSubscriptionItemId: string | OrderSubscriptionItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
|
55
|
+
isOrderSubscriptionItem(resource: any): resource is OrderSubscriptionItem;
|
56
|
+
relationship(id: string | ResourceId | null): OrderSubscriptionItemRel;
|
57
|
+
type(): string;
|
58
|
+
}
|
59
|
+
export default OrderSubscriptionItems;
|
60
|
+
export { OrderSubscriptionItem, OrderSubscriptionItemCreate, OrderSubscriptionItemUpdate };
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const resource_1 = require("../resource");
|
4
|
+
class OrderSubscriptionItems extends resource_1.ApiResource {
|
5
|
+
// static readonly PATH = 'order_subscription_items'
|
6
|
+
async list(params, options) {
|
7
|
+
return this.resources.list({ type: OrderSubscriptionItems.TYPE }, params, options);
|
8
|
+
}
|
9
|
+
async create(resource, params, options) {
|
10
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: OrderSubscriptionItems.TYPE }), params, options);
|
11
|
+
}
|
12
|
+
async retrieve(id, params, options) {
|
13
|
+
return this.resources.retrieve({ type: OrderSubscriptionItems.TYPE, id }, params, options);
|
14
|
+
}
|
15
|
+
async update(resource, params, options) {
|
16
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: OrderSubscriptionItems.TYPE }), params, options);
|
17
|
+
}
|
18
|
+
async delete(id, options) {
|
19
|
+
await this.resources.delete({ type: OrderSubscriptionItems.TYPE, id }, options);
|
20
|
+
}
|
21
|
+
async order_subscription(orderSubscriptionItemId, params, options) {
|
22
|
+
const _orderSubscriptionItemId = orderSubscriptionItemId.id || orderSubscriptionItemId;
|
23
|
+
return this.resources.fetch({ type: 'order_subscriptions' }, `order_subscription_items/${_orderSubscriptionItemId}/order_subscription`, params, options);
|
24
|
+
}
|
25
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
26
|
+
isOrderSubscriptionItem(resource) {
|
27
|
+
return resource.type && (resource.type === OrderSubscriptionItems.TYPE);
|
28
|
+
}
|
29
|
+
relationship(id) {
|
30
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: OrderSubscriptionItems.TYPE } : { id: id.id, type: OrderSubscriptionItems.TYPE };
|
31
|
+
}
|
32
|
+
type() {
|
33
|
+
return OrderSubscriptionItems.TYPE;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
OrderSubscriptionItems.TYPE = 'order_subscription_items';
|
37
|
+
exports.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;
|
@@ -22,6 +22,10 @@ class OrderSubscriptions extends resource_1.ApiResource {
|
|
22
22
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
23
23
|
return this.resources.fetch({ type: 'markets' }, `order_subscriptions/${_orderSubscriptionId}/market`, params, options);
|
24
24
|
}
|
25
|
+
async subscription_model(orderSubscriptionId, params, options) {
|
26
|
+
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
27
|
+
return this.resources.fetch({ type: 'subscription_models' }, `order_subscriptions/${_orderSubscriptionId}/subscription_model`, params, options);
|
28
|
+
}
|
25
29
|
async source_order(orderSubscriptionId, params, options) {
|
26
30
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
27
31
|
return this.resources.fetch({ type: 'orders' }, `order_subscriptions/${_orderSubscriptionId}/source_order`, params, options);
|
@@ -30,9 +34,21 @@ class OrderSubscriptions extends resource_1.ApiResource {
|
|
30
34
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
31
35
|
return this.resources.fetch({ type: 'customers' }, `order_subscriptions/${_orderSubscriptionId}/customer`, params, options);
|
32
36
|
}
|
33
|
-
async
|
37
|
+
async customer_payment_source(orderSubscriptionId, params, options) {
|
38
|
+
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
39
|
+
return this.resources.fetch({ type: 'customer_payment_sources' }, `order_subscriptions/${_orderSubscriptionId}/customer_payment_source`, params, options);
|
40
|
+
}
|
41
|
+
async order_subscription_items(orderSubscriptionId, params, options) {
|
42
|
+
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
43
|
+
return this.resources.fetch({ type: 'order_subscription_items' }, `order_subscriptions/${_orderSubscriptionId}/order_subscription_items`, params, options);
|
44
|
+
}
|
45
|
+
async order_factories(orderSubscriptionId, params, options) {
|
46
|
+
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
47
|
+
return this.resources.fetch({ type: 'order_factories' }, `order_subscriptions/${_orderSubscriptionId}/order_factories`, params, options);
|
48
|
+
}
|
49
|
+
async recurring_order_copies(orderSubscriptionId, params, options) {
|
34
50
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
35
|
-
return this.resources.fetch({ type: '
|
51
|
+
return this.resources.fetch({ type: 'recurring_order_copies' }, `order_subscriptions/${_orderSubscriptionId}/recurring_order_copies`, params, options);
|
36
52
|
}
|
37
53
|
async orders(orderSubscriptionId, params, options) {
|
38
54
|
const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
|
@@ -25,7 +25,9 @@ import type { Capture } from './captures';
|
|
25
25
|
import type { Refund } from './refunds';
|
26
26
|
import type { Return } from './returns';
|
27
27
|
import type { OrderSubscription } from './order_subscriptions';
|
28
|
+
import type { OrderFactory } from './order_factories';
|
28
29
|
import type { OrderCopy } from './order_copies';
|
30
|
+
import type { RecurringOrderCopy } from './recurring_order_copies';
|
29
31
|
import type { Attachment } from './attachments';
|
30
32
|
import type { Event } from './events';
|
31
33
|
type OrderRel = ResourceRel & {
|
@@ -172,6 +174,7 @@ interface Order extends Resource {
|
|
172
174
|
refreshed_at?: string;
|
173
175
|
archived_at?: string;
|
174
176
|
expires_at?: string;
|
177
|
+
subscription_created_at?: string;
|
175
178
|
market?: Market;
|
176
179
|
customer?: Customer;
|
177
180
|
shipping_address?: Address;
|
@@ -191,7 +194,9 @@ interface Order extends Resource {
|
|
191
194
|
refunds?: Refund[];
|
192
195
|
returns?: Return[];
|
193
196
|
order_subscriptions?: OrderSubscription[];
|
197
|
+
order_factories?: OrderFactory[];
|
194
198
|
order_copies?: OrderCopy[];
|
199
|
+
recurring_order_copies?: RecurringOrderCopy[];
|
195
200
|
attachments?: Attachment[];
|
196
201
|
events?: Event[];
|
197
202
|
}
|
@@ -254,6 +259,7 @@ interface OrderUpdate extends ResourceUpdate {
|
|
254
259
|
_save_billing_address_to_customer_address_book?: boolean;
|
255
260
|
_refresh?: boolean;
|
256
261
|
_validate?: boolean;
|
262
|
+
_create_subscriptions?: boolean;
|
257
263
|
market?: MarketRel;
|
258
264
|
customer?: CustomerRel;
|
259
265
|
shipping_address?: AddressRel;
|
@@ -285,7 +291,9 @@ declare class Orders extends ApiResource {
|
|
285
291
|
refunds(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Refund>>;
|
286
292
|
returns(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Return>>;
|
287
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>>;
|
288
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>>;
|
289
297
|
attachments(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
290
298
|
events(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
291
299
|
isOrder(resource: any): resource is Order;
|
@@ -86,10 +86,18 @@ class Orders extends resource_1.ApiResource {
|
|
86
86
|
const _orderId = orderId.id || orderId;
|
87
87
|
return this.resources.fetch({ type: 'order_subscriptions' }, `orders/${_orderId}/order_subscriptions`, params, options);
|
88
88
|
}
|
89
|
+
async order_factories(orderId, params, options) {
|
90
|
+
const _orderId = orderId.id || orderId;
|
91
|
+
return this.resources.fetch({ type: 'order_factories' }, `orders/${_orderId}/order_factories`, params, options);
|
92
|
+
}
|
89
93
|
async order_copies(orderId, params, options) {
|
90
94
|
const _orderId = orderId.id || orderId;
|
91
95
|
return this.resources.fetch({ type: 'order_copies' }, `orders/${_orderId}/order_copies`, params, options);
|
92
96
|
}
|
97
|
+
async recurring_order_copies(orderId, params, options) {
|
98
|
+
const _orderId = orderId.id || orderId;
|
99
|
+
return this.resources.fetch({ type: 'recurring_order_copies' }, `orders/${_orderId}/recurring_order_copies`, params, options);
|
100
|
+
}
|
93
101
|
async attachments(orderId, params, options) {
|
94
102
|
const _orderId = orderId.id || orderId;
|
95
103
|
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;
|
@@ -38,6 +38,10 @@ class PercentageDiscountPromotions extends resource_1.ApiResource {
|
|
38
38
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
39
39
|
return this.resources.fetch({ type: 'attachments' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/attachments`, params, options);
|
40
40
|
}
|
41
|
+
async events(percentageDiscountPromotionId, params, options) {
|
42
|
+
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
43
|
+
return this.resources.fetch({ type: 'events' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/events`, params, options);
|
44
|
+
}
|
41
45
|
async sku_list(percentageDiscountPromotionId, params, options) {
|
42
46
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
43
47
|
return this.resources.fetch({ type: 'sku_lists' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options);
|
@@ -46,10 +50,6 @@ class PercentageDiscountPromotions extends resource_1.ApiResource {
|
|
46
50
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
47
51
|
return this.resources.fetch({ type: 'skus' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/skus`, params, options);
|
48
52
|
}
|
49
|
-
async events(percentageDiscountPromotionId, params, options) {
|
50
|
-
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
51
|
-
return this.resources.fetch({ type: 'events' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/events`, params, options);
|
52
|
-
}
|
53
53
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
54
54
|
isPercentageDiscountPromotion(resource) {
|
55
55
|
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,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const resource_1 = require("../resource");
|
4
|
+
class PriceFrequencyTiers extends resource_1.ApiResource {
|
5
|
+
// static readonly PATH = 'price_frequency_tiers'
|
6
|
+
async list(params, options) {
|
7
|
+
return this.resources.list({ type: PriceFrequencyTiers.TYPE }, params, options);
|
8
|
+
}
|
9
|
+
async create(resource, params, options) {
|
10
|
+
return this.resources.create(Object.assign(Object.assign({}, resource), { type: PriceFrequencyTiers.TYPE }), params, options);
|
11
|
+
}
|
12
|
+
async retrieve(id, params, options) {
|
13
|
+
return this.resources.retrieve({ type: PriceFrequencyTiers.TYPE, id }, params, options);
|
14
|
+
}
|
15
|
+
async update(resource, params, options) {
|
16
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: PriceFrequencyTiers.TYPE }), params, options);
|
17
|
+
}
|
18
|
+
async delete(id, options) {
|
19
|
+
await this.resources.delete({ type: PriceFrequencyTiers.TYPE, id }, options);
|
20
|
+
}
|
21
|
+
async price(priceFrequencyTierId, params, options) {
|
22
|
+
const _priceFrequencyTierId = priceFrequencyTierId.id || priceFrequencyTierId;
|
23
|
+
return this.resources.fetch({ type: 'prices' }, `price_frequency_tiers/${_priceFrequencyTierId}/price`, params, options);
|
24
|
+
}
|
25
|
+
async attachments(priceFrequencyTierId, params, options) {
|
26
|
+
const _priceFrequencyTierId = priceFrequencyTierId.id || priceFrequencyTierId;
|
27
|
+
return this.resources.fetch({ type: 'attachments' }, `price_frequency_tiers/${_priceFrequencyTierId}/attachments`, params, options);
|
28
|
+
}
|
29
|
+
async events(priceFrequencyTierId, params, options) {
|
30
|
+
const _priceFrequencyTierId = priceFrequencyTierId.id || priceFrequencyTierId;
|
31
|
+
return this.resources.fetch({ type: 'events' }, `price_frequency_tiers/${_priceFrequencyTierId}/events`, params, options);
|
32
|
+
}
|
33
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
34
|
+
isPriceFrequencyTier(resource) {
|
35
|
+
return resource.type && (resource.type === PriceFrequencyTiers.TYPE);
|
36
|
+
}
|
37
|
+
relationship(id) {
|
38
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: PriceFrequencyTiers.TYPE } : { id: id.id, type: PriceFrequencyTiers.TYPE };
|
39
|
+
}
|
40
|
+
type() {
|
41
|
+
return PriceFrequencyTiers.TYPE;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
PriceFrequencyTiers.TYPE = 'price_frequency_tiers';
|
45
|
+
exports.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;
|
@@ -26,6 +26,10 @@ class PriceVolumeTiers extends resource_1.ApiResource {
|
|
26
26
|
const _priceVolumeTierId = priceVolumeTierId.id || priceVolumeTierId;
|
27
27
|
return this.resources.fetch({ type: 'attachments' }, `price_volume_tiers/${_priceVolumeTierId}/attachments`, params, options);
|
28
28
|
}
|
29
|
+
async events(priceVolumeTierId, params, options) {
|
30
|
+
const _priceVolumeTierId = priceVolumeTierId.id || priceVolumeTierId;
|
31
|
+
return this.resources.fetch({ type: 'events' }, `price_volume_tiers/${_priceVolumeTierId}/events`, params, options);
|
32
|
+
}
|
29
33
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
30
34
|
isPriceVolumeTier(resource) {
|
31
35
|
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;
|
@@ -34,6 +34,10 @@ class Prices extends resource_1.ApiResource {
|
|
34
34
|
const _priceId = priceId.id || priceId;
|
35
35
|
return this.resources.fetch({ type: 'price_volume_tiers' }, `prices/${_priceId}/price_volume_tiers`, params, options);
|
36
36
|
}
|
37
|
+
async price_frequency_tiers(priceId, params, options) {
|
38
|
+
const _priceId = priceId.id || priceId;
|
39
|
+
return this.resources.fetch({ type: 'price_frequency_tiers' }, `prices/${_priceId}/price_frequency_tiers`, params, options);
|
40
|
+
}
|
37
41
|
async attachments(priceId, params, options) {
|
38
42
|
const _priceId = priceId.id || priceId;
|
39
43
|
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;
|
@@ -29,6 +29,10 @@ class Promotions extends resource_1.ApiResource {
|
|
29
29
|
const _promotionId = promotionId.id || promotionId;
|
30
30
|
return this.resources.fetch({ type: 'attachments' }, `promotions/${_promotionId}/attachments`, params, options);
|
31
31
|
}
|
32
|
+
async events(promotionId, params, options) {
|
33
|
+
const _promotionId = promotionId.id || promotionId;
|
34
|
+
return this.resources.fetch({ type: 'events' }, `promotions/${_promotionId}/events`, params, options);
|
35
|
+
}
|
32
36
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
33
37
|
isPromotion(resource) {
|
34
38
|
return resource.type && (resource.type === Promotions.TYPE);
|