@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
@@ -1,8 +1,8 @@
|
|
1
|
-
import { ApiResource, Resource, ResourceCreate, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
|
1
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ResourceRel, ListResponse } from '../resource';
|
2
2
|
import type { QueryParamsList, QueryParamsRetrieve } from '../query';
|
3
3
|
import type { Order } from './orders';
|
4
|
-
import type { OrderSubscription } from './order_subscriptions';
|
5
4
|
import type { Event } from './events';
|
5
|
+
import type { OrderSubscription } from './order_subscriptions';
|
6
6
|
type OrderCopyRel = ResourceRel & {
|
7
7
|
type: typeof OrderCopies.TYPE;
|
8
8
|
};
|
@@ -14,35 +14,37 @@ interface OrderCopy extends Resource {
|
|
14
14
|
started_at?: string;
|
15
15
|
completed_at?: string;
|
16
16
|
failed_at?: string;
|
17
|
-
place_target_order?: boolean;
|
18
|
-
cancel_source_order?: boolean;
|
19
|
-
reuse_wallet?: boolean;
|
20
17
|
errors_log?: object;
|
21
18
|
errors_count?: number;
|
19
|
+
place_target_order?: boolean;
|
20
|
+
reuse_wallet?: boolean;
|
21
|
+
cancel_source_order?: boolean;
|
22
22
|
source_order?: Order;
|
23
23
|
target_order?: Order;
|
24
|
-
order_subscription?: OrderSubscription;
|
25
24
|
events?: Event[];
|
25
|
+
order_subscription?: OrderSubscription;
|
26
26
|
}
|
27
27
|
interface OrderCopyCreate extends ResourceCreate {
|
28
28
|
place_target_order?: boolean;
|
29
|
-
cancel_source_order?: boolean;
|
30
29
|
reuse_wallet?: boolean;
|
30
|
+
cancel_source_order?: boolean;
|
31
31
|
source_order: OrderRel;
|
32
32
|
}
|
33
|
+
type OrderCopyUpdate = ResourceUpdate;
|
33
34
|
declare class OrderCopies extends ApiResource {
|
34
35
|
static readonly TYPE: 'order_copies';
|
35
36
|
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderCopy>>;
|
36
37
|
create(resource: OrderCopyCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderCopy>;
|
37
38
|
retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderCopy>;
|
39
|
+
update(resource: OrderCopyUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderCopy>;
|
38
40
|
delete(id: string, options?: ResourcesConfig): Promise<void>;
|
39
41
|
source_order(orderCopyId: string | OrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
40
42
|
target_order(orderCopyId: string | OrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
41
|
-
order_subscription(orderCopyId: string | OrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
|
42
43
|
events(orderCopyId: string | OrderCopy, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
44
|
+
order_subscription(orderCopyId: string | OrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
|
43
45
|
isOrderCopy(resource: any): resource is OrderCopy;
|
44
46
|
relationship(id: string | ResourceId | null): OrderCopyRel;
|
45
47
|
type(): string;
|
46
48
|
}
|
47
49
|
export default OrderCopies;
|
48
|
-
export { OrderCopy, OrderCopyCreate };
|
50
|
+
export { OrderCopy, OrderCopyCreate, OrderCopyUpdate };
|
@@ -12,6 +12,9 @@ class OrderCopies extends resource_1.ApiResource {
|
|
12
12
|
async retrieve(id, params, options) {
|
13
13
|
return this.resources.retrieve({ type: OrderCopies.TYPE, id }, params, options);
|
14
14
|
}
|
15
|
+
async update(resource, params, options) {
|
16
|
+
return this.resources.update(Object.assign(Object.assign({}, resource), { type: OrderCopies.TYPE }), params, options);
|
17
|
+
}
|
15
18
|
async delete(id, options) {
|
16
19
|
await this.resources.delete({ type: OrderCopies.TYPE, id }, options);
|
17
20
|
}
|
@@ -23,14 +26,14 @@ class OrderCopies extends resource_1.ApiResource {
|
|
23
26
|
const _orderCopyId = orderCopyId.id || orderCopyId;
|
24
27
|
return this.resources.fetch({ type: 'orders' }, `order_copies/${_orderCopyId}/target_order`, params, options);
|
25
28
|
}
|
26
|
-
async order_subscription(orderCopyId, params, options) {
|
27
|
-
const _orderCopyId = orderCopyId.id || orderCopyId;
|
28
|
-
return this.resources.fetch({ type: 'order_subscriptions' }, `order_copies/${_orderCopyId}/order_subscription`, params, options);
|
29
|
-
}
|
30
29
|
async events(orderCopyId, params, options) {
|
31
30
|
const _orderCopyId = orderCopyId.id || orderCopyId;
|
32
31
|
return this.resources.fetch({ type: 'events' }, `order_copies/${_orderCopyId}/events`, params, options);
|
33
32
|
}
|
33
|
+
async order_subscription(orderCopyId, params, options) {
|
34
|
+
const _orderCopyId = orderCopyId.id || orderCopyId;
|
35
|
+
return this.resources.fetch({ type: 'order_subscriptions' }, `order_copies/${_orderCopyId}/order_subscription`, params, options);
|
36
|
+
}
|
34
37
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
35
38
|
isOrderCopy(resource) {
|
36
39
|
return resource.type && (resource.type === OrderCopies.TYPE);
|
@@ -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;
|
@@ -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;
|
@@ -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;
|