@commercelayer/sdk 5.13.2 → 5.15.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 -7
- package/lib/cjs/api.js +9 -3
- package/lib/cjs/commercelayer.d.ts +4 -2
- package/lib/cjs/commercelayer.js +3 -1
- package/lib/cjs/model.d.ts +2 -0
- package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +137 -0
- package/lib/cjs/resources/buy_x_pay_y_promotions.js +75 -0
- package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +7 -3
- package/lib/cjs/resources/coupons.d.ts +3 -0
- package/lib/cjs/resources/custom_promotion_rules.d.ts +62 -0
- package/lib/cjs/resources/custom_promotion_rules.js +29 -0
- package/lib/cjs/resources/external_promotions.d.ts +28 -1
- package/lib/cjs/resources/external_promotions.js +14 -0
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +28 -1
- package/lib/cjs/resources/fixed_amount_promotions.js +14 -0
- package/lib/cjs/resources/fixed_price_promotions.d.ts +19 -0
- package/lib/cjs/resources/fixed_price_promotions.js +10 -0
- package/lib/cjs/resources/free_gift_promotions.d.ts +19 -0
- package/lib/cjs/resources/free_gift_promotions.js +10 -0
- package/lib/cjs/resources/free_shipping_promotions.d.ts +19 -0
- package/lib/cjs/resources/free_shipping_promotions.js +10 -0
- package/lib/cjs/resources/imports.d.ts +3 -0
- package/lib/cjs/resources/line_items.d.ts +5 -0
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +7 -3
- package/lib/cjs/resources/order_subscription_items.d.ts +4 -0
- package/lib/cjs/resources/orders.d.ts +23 -0
- package/lib/cjs/resources/orders.js +16 -0
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +19 -0
- package/lib/cjs/resources/percentage_discount_promotions.js +10 -0
- package/lib/cjs/resources/promotion_rules.d.ts +2 -1
- package/lib/cjs/resources/promotions.d.ts +6 -0
- package/lib/cjs/resources/promotions.js +4 -0
- package/lib/cjs/resources/sku_list_promotion_rules.d.ts +7 -3
- package/lib/esm/api.d.ts +9 -7
- package/lib/esm/api.js +4 -0
- package/lib/esm/commercelayer.d.ts +4 -2
- package/lib/esm/commercelayer.js +3 -1
- package/lib/esm/model.d.ts +2 -0
- package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +137 -0
- package/lib/esm/resources/buy_x_pay_y_promotions.js +73 -0
- package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +7 -3
- package/lib/esm/resources/coupons.d.ts +3 -0
- package/lib/esm/resources/custom_promotion_rules.d.ts +62 -0
- package/lib/esm/resources/custom_promotion_rules.js +27 -0
- package/lib/esm/resources/external_promotions.d.ts +28 -1
- package/lib/esm/resources/external_promotions.js +14 -0
- package/lib/esm/resources/fixed_amount_promotions.d.ts +28 -1
- package/lib/esm/resources/fixed_amount_promotions.js +14 -0
- package/lib/esm/resources/fixed_price_promotions.d.ts +19 -0
- package/lib/esm/resources/fixed_price_promotions.js +10 -0
- package/lib/esm/resources/free_gift_promotions.d.ts +19 -0
- package/lib/esm/resources/free_gift_promotions.js +10 -0
- package/lib/esm/resources/free_shipping_promotions.d.ts +19 -0
- package/lib/esm/resources/free_shipping_promotions.js +10 -0
- package/lib/esm/resources/imports.d.ts +3 -0
- package/lib/esm/resources/line_items.d.ts +5 -0
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +7 -3
- package/lib/esm/resources/order_subscription_items.d.ts +4 -0
- package/lib/esm/resources/orders.d.ts +23 -0
- package/lib/esm/resources/orders.js +16 -0
- package/lib/esm/resources/percentage_discount_promotions.d.ts +19 -0
- package/lib/esm/resources/percentage_discount_promotions.js +10 -0
- package/lib/esm/resources/promotion_rules.d.ts +2 -1
- package/lib/esm/resources/promotions.d.ts +6 -0
- package/lib/esm/resources/promotions.js +4 -0
- package/lib/esm/resources/sku_list_promotion_rules.d.ts +7 -3
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
package/lib/esm/commercelayer.js
CHANGED
@@ -16,7 +16,7 @@ import ResourceAdapter from './resource';
|
|
16
16
|
import Debug from './debug';
|
17
17
|
const debug = Debug('commercelayer');
|
18
18
|
// Autogenerated schema version number, do not remove this line
|
19
|
-
const OPEN_API_SCHEMA_VERSION = '4.
|
19
|
+
const OPEN_API_SCHEMA_VERSION = '4.13.0';
|
20
20
|
export { OPEN_API_SCHEMA_VERSION };
|
21
21
|
class CommerceLayerClient {
|
22
22
|
// ##__CL_RESOURCES_DEF_STOP__##
|
@@ -46,6 +46,7 @@ class CommerceLayerClient {
|
|
46
46
|
this.braintree_gateways = new api.BraintreeGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
47
47
|
this.braintree_payments = new api.BraintreePayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
48
48
|
this.bundles = new api.Bundles(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
49
|
+
this.buy_x_pay_y_promotions = new api.BuyXPayYPromotions(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
49
50
|
this.captures = new api.Captures(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
50
51
|
this.carrier_accounts = new api.CarrierAccounts(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
51
52
|
this.checkout_com_gateways = new api.CheckoutComGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
@@ -54,6 +55,7 @@ class CommerceLayerClient {
|
|
54
55
|
this.coupon_codes_promotion_rules = new api.CouponCodesPromotionRules(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
55
56
|
this.coupon_recipients = new api.CouponRecipients(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
56
57
|
this.coupons = new api.Coupons(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
58
|
+
this.custom_promotion_rules = new api.CustomPromotionRules(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
57
59
|
this.customer_addresses = new api.CustomerAddresses(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
58
60
|
this.customer_groups = new api.CustomerGroups(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
59
61
|
this.customer_password_resets = new api.CustomerPasswordResets(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
package/lib/esm/model.d.ts
CHANGED
@@ -16,6 +16,7 @@ export type { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate } from './res
|
|
16
16
|
export type { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate } from './resources/braintree_gateways';
|
17
17
|
export type { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate } from './resources/braintree_payments';
|
18
18
|
export type { Bundle, BundleCreate, BundleUpdate } from './resources/bundles';
|
19
|
+
export type { BuyXPayYPromotion, BuyXPayYPromotionCreate, BuyXPayYPromotionUpdate } from './resources/buy_x_pay_y_promotions';
|
19
20
|
export type { Capture, CaptureUpdate } from './resources/captures';
|
20
21
|
export type { CarrierAccount } from './resources/carrier_accounts';
|
21
22
|
export type { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate } from './resources/checkout_com_gateways';
|
@@ -24,6 +25,7 @@ export type { Cleanup, CleanupCreate } from './resources/cleanups';
|
|
24
25
|
export type { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate } from './resources/coupon_codes_promotion_rules';
|
25
26
|
export type { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate } from './resources/coupon_recipients';
|
26
27
|
export type { Coupon, CouponCreate, CouponUpdate } from './resources/coupons';
|
28
|
+
export type { CustomPromotionRule, CustomPromotionRuleCreate, CustomPromotionRuleUpdate } from './resources/custom_promotion_rules';
|
27
29
|
export type { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate } from './resources/customer_addresses';
|
28
30
|
export type { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate } from './resources/customer_groups';
|
29
31
|
export type { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate } from './resources/customer_password_resets';
|
@@ -0,0 +1,137 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
|
+
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
|
+
import type { Market, MarketType } from './markets';
|
5
|
+
import type { PromotionRule, PromotionRuleType } from './promotion_rules';
|
6
|
+
import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
|
7
|
+
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
|
+
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
|
+
import type { Coupon, CouponType } from './coupons';
|
10
|
+
import type { SkuList, SkuListType } from './sku_lists';
|
11
|
+
import type { Attachment } from './attachments';
|
12
|
+
import type { Event } from './events';
|
13
|
+
import type { Tag, TagType } from './tags';
|
14
|
+
import type { Version } from './versions';
|
15
|
+
import type { Sku } from './skus';
|
16
|
+
type BuyXPayYPromotionType = 'buy_x_pay_y_promotions';
|
17
|
+
type BuyXPayYPromotionRel = ResourceRel & {
|
18
|
+
type: BuyXPayYPromotionType;
|
19
|
+
};
|
20
|
+
type MarketRel = ResourceRel & {
|
21
|
+
type: MarketType;
|
22
|
+
};
|
23
|
+
type PromotionRuleRel = ResourceRel & {
|
24
|
+
type: PromotionRuleType;
|
25
|
+
};
|
26
|
+
type OrderAmountPromotionRuleRel = ResourceRel & {
|
27
|
+
type: OrderAmountPromotionRuleType;
|
28
|
+
};
|
29
|
+
type SkuListPromotionRuleRel = ResourceRel & {
|
30
|
+
type: SkuListPromotionRuleType;
|
31
|
+
};
|
32
|
+
type CouponCodesPromotionRuleRel = ResourceRel & {
|
33
|
+
type: CouponCodesPromotionRuleType;
|
34
|
+
};
|
35
|
+
type CouponRel = ResourceRel & {
|
36
|
+
type: CouponType;
|
37
|
+
};
|
38
|
+
type SkuListRel = ResourceRel & {
|
39
|
+
type: SkuListType;
|
40
|
+
};
|
41
|
+
type TagRel = ResourceRel & {
|
42
|
+
type: TagType;
|
43
|
+
};
|
44
|
+
interface BuyXPayYPromotion extends Resource {
|
45
|
+
readonly type: BuyXPayYPromotionType;
|
46
|
+
name: string;
|
47
|
+
currency_code?: string | null;
|
48
|
+
exclusive?: boolean | null;
|
49
|
+
priority?: number | null;
|
50
|
+
starts_at: string;
|
51
|
+
expires_at: string;
|
52
|
+
total_usage_limit: number;
|
53
|
+
total_usage_count?: number | null;
|
54
|
+
active?: boolean | null;
|
55
|
+
disabled_at?: string | null;
|
56
|
+
x: number;
|
57
|
+
y: number;
|
58
|
+
cheapest_free?: boolean | null;
|
59
|
+
market?: Market | null;
|
60
|
+
promotion_rules?: PromotionRule[] | null;
|
61
|
+
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
62
|
+
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
63
|
+
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
64
|
+
coupons?: Coupon[] | null;
|
65
|
+
sku_list?: SkuList | null;
|
66
|
+
attachments?: Attachment[] | null;
|
67
|
+
events?: Event[] | null;
|
68
|
+
tags?: Tag[] | null;
|
69
|
+
versions?: Version[] | null;
|
70
|
+
skus?: Sku[] | null;
|
71
|
+
}
|
72
|
+
interface BuyXPayYPromotionCreate extends ResourceCreate {
|
73
|
+
name: string;
|
74
|
+
currency_code?: string | null;
|
75
|
+
exclusive?: boolean | null;
|
76
|
+
priority?: number | null;
|
77
|
+
starts_at: string;
|
78
|
+
expires_at: string;
|
79
|
+
total_usage_limit: number;
|
80
|
+
x: number;
|
81
|
+
y: number;
|
82
|
+
cheapest_free?: boolean | null;
|
83
|
+
market?: MarketRel | null;
|
84
|
+
promotion_rules?: PromotionRuleRel[] | null;
|
85
|
+
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
86
|
+
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
87
|
+
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
88
|
+
coupons?: CouponRel[] | null;
|
89
|
+
sku_list: SkuListRel;
|
90
|
+
tags?: TagRel[] | null;
|
91
|
+
}
|
92
|
+
interface BuyXPayYPromotionUpdate extends ResourceUpdate {
|
93
|
+
name?: string | null;
|
94
|
+
currency_code?: string | null;
|
95
|
+
exclusive?: boolean | null;
|
96
|
+
priority?: number | null;
|
97
|
+
starts_at?: string | null;
|
98
|
+
expires_at?: string | null;
|
99
|
+
total_usage_limit?: number | null;
|
100
|
+
_disable?: boolean | null;
|
101
|
+
_enable?: boolean | null;
|
102
|
+
x?: number | null;
|
103
|
+
y?: number | null;
|
104
|
+
cheapest_free?: boolean | null;
|
105
|
+
market?: MarketRel | null;
|
106
|
+
promotion_rules?: PromotionRuleRel[] | null;
|
107
|
+
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
108
|
+
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
109
|
+
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
110
|
+
coupons?: CouponRel[] | null;
|
111
|
+
sku_list?: SkuListRel | null;
|
112
|
+
tags?: TagRel[] | null;
|
113
|
+
}
|
114
|
+
declare class BuyXPayYPromotions extends ApiResource<BuyXPayYPromotion> {
|
115
|
+
static readonly TYPE: BuyXPayYPromotionType;
|
116
|
+
create(resource: BuyXPayYPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<BuyXPayYPromotion>;
|
117
|
+
update(resource: BuyXPayYPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<BuyXPayYPromotion>;
|
118
|
+
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
119
|
+
market(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Market>;
|
120
|
+
order_amount_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
121
|
+
sku_list_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
122
|
+
coupon_codes_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
123
|
+
coupons(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
124
|
+
sku_list(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
125
|
+
attachments(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
126
|
+
events(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
127
|
+
tags(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
128
|
+
versions(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
129
|
+
skus(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
130
|
+
_disable(id: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<BuyXPayYPromotion>;
|
131
|
+
_enable(id: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<BuyXPayYPromotion>;
|
132
|
+
isBuyXPayYPromotion(resource: any): resource is BuyXPayYPromotion;
|
133
|
+
relationship(id: string | ResourceId | null): BuyXPayYPromotionRel;
|
134
|
+
type(): BuyXPayYPromotionType;
|
135
|
+
}
|
136
|
+
export default BuyXPayYPromotions;
|
137
|
+
export type { BuyXPayYPromotion, BuyXPayYPromotionCreate, BuyXPayYPromotionUpdate, BuyXPayYPromotionType };
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class BuyXPayYPromotions extends ApiResource {
|
3
|
+
async create(resource, params, options) {
|
4
|
+
return this.resources.create({ ...resource, type: BuyXPayYPromotions.TYPE }, params, options);
|
5
|
+
}
|
6
|
+
async update(resource, params, options) {
|
7
|
+
return this.resources.update({ ...resource, type: BuyXPayYPromotions.TYPE }, params, options);
|
8
|
+
}
|
9
|
+
async delete(id, options) {
|
10
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: BuyXPayYPromotions.TYPE } : id, options);
|
11
|
+
}
|
12
|
+
async market(buyXPayYPromotionId, params, options) {
|
13
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
14
|
+
return this.resources.fetch({ type: 'markets' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/market`, params, options);
|
15
|
+
}
|
16
|
+
async order_amount_promotion_rule(buyXPayYPromotionId, params, options) {
|
17
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
18
|
+
return this.resources.fetch({ type: 'order_amount_promotion_rules' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/order_amount_promotion_rule`, params, options);
|
19
|
+
}
|
20
|
+
async sku_list_promotion_rule(buyXPayYPromotionId, params, options) {
|
21
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
22
|
+
return this.resources.fetch({ type: 'sku_list_promotion_rules' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/sku_list_promotion_rule`, params, options);
|
23
|
+
}
|
24
|
+
async coupon_codes_promotion_rule(buyXPayYPromotionId, params, options) {
|
25
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
26
|
+
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/coupon_codes_promotion_rule`, params, options);
|
27
|
+
}
|
28
|
+
async coupons(buyXPayYPromotionId, params, options) {
|
29
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
30
|
+
return this.resources.fetch({ type: 'coupons' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/coupons`, params, options);
|
31
|
+
}
|
32
|
+
async sku_list(buyXPayYPromotionId, params, options) {
|
33
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
34
|
+
return this.resources.fetch({ type: 'sku_lists' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/sku_list`, params, options);
|
35
|
+
}
|
36
|
+
async attachments(buyXPayYPromotionId, params, options) {
|
37
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
38
|
+
return this.resources.fetch({ type: 'attachments' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/attachments`, params, options);
|
39
|
+
}
|
40
|
+
async events(buyXPayYPromotionId, params, options) {
|
41
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
42
|
+
return this.resources.fetch({ type: 'events' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/events`, params, options);
|
43
|
+
}
|
44
|
+
async tags(buyXPayYPromotionId, params, options) {
|
45
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
46
|
+
return this.resources.fetch({ type: 'tags' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/tags`, params, options);
|
47
|
+
}
|
48
|
+
async versions(buyXPayYPromotionId, params, options) {
|
49
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
50
|
+
return this.resources.fetch({ type: 'versions' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/versions`, params, options);
|
51
|
+
}
|
52
|
+
async skus(buyXPayYPromotionId, params, options) {
|
53
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
54
|
+
return this.resources.fetch({ type: 'skus' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/skus`, params, options);
|
55
|
+
}
|
56
|
+
async _disable(id, params, options) {
|
57
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: BuyXPayYPromotions.TYPE, _disable: true }, params, options);
|
58
|
+
}
|
59
|
+
async _enable(id, params, options) {
|
60
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: BuyXPayYPromotions.TYPE, _enable: true }, params, options);
|
61
|
+
}
|
62
|
+
isBuyXPayYPromotion(resource) {
|
63
|
+
return resource.type && (resource.type === BuyXPayYPromotions.TYPE);
|
64
|
+
}
|
65
|
+
relationship(id) {
|
66
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: BuyXPayYPromotions.TYPE } : { id: id.id, type: BuyXPayYPromotions.TYPE };
|
67
|
+
}
|
68
|
+
type() {
|
69
|
+
return BuyXPayYPromotions.TYPE;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
BuyXPayYPromotions.TYPE = 'buy_x_pay_y_promotions';
|
73
|
+
export default BuyXPayYPromotions;
|
@@ -3,6 +3,7 @@ import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesCon
|
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { PercentageDiscountPromotion, PercentageDiscountPromotionType } from './percentage_discount_promotions';
|
5
5
|
import type { FreeShippingPromotion, FreeShippingPromotionType } from './free_shipping_promotions';
|
6
|
+
import type { BuyXPayYPromotion, BuyXPayYPromotionType } from './buy_x_pay_y_promotions';
|
6
7
|
import type { FreeGiftPromotion, FreeGiftPromotionType } from './free_gift_promotions';
|
7
8
|
import type { FixedPricePromotion, FixedPricePromotionType } from './fixed_price_promotions';
|
8
9
|
import type { ExternalPromotion, ExternalPromotionType } from './external_promotions';
|
@@ -19,6 +20,9 @@ type PercentageDiscountPromotionRel = ResourceRel & {
|
|
19
20
|
type FreeShippingPromotionRel = ResourceRel & {
|
20
21
|
type: FreeShippingPromotionType;
|
21
22
|
};
|
23
|
+
type BuyXPayYPromotionRel = ResourceRel & {
|
24
|
+
type: BuyXPayYPromotionType;
|
25
|
+
};
|
22
26
|
type FreeGiftPromotionRel = ResourceRel & {
|
23
27
|
type: FreeGiftPromotionType;
|
24
28
|
};
|
@@ -36,16 +40,16 @@ type CouponRel = ResourceRel & {
|
|
36
40
|
};
|
37
41
|
interface CouponCodesPromotionRule extends Resource {
|
38
42
|
readonly type: CouponCodesPromotionRuleType;
|
39
|
-
promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion | FixedAmountPromotion | null;
|
43
|
+
promotion?: PercentageDiscountPromotion | FreeShippingPromotion | BuyXPayYPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion | FixedAmountPromotion | null;
|
40
44
|
versions?: Version[] | null;
|
41
45
|
coupons?: Coupon[] | null;
|
42
46
|
}
|
43
47
|
interface CouponCodesPromotionRuleCreate extends ResourceCreate {
|
44
|
-
promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel;
|
48
|
+
promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | BuyXPayYPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel;
|
45
49
|
coupons?: CouponRel[] | null;
|
46
50
|
}
|
47
51
|
interface CouponCodesPromotionRuleUpdate extends ResourceUpdate {
|
48
|
-
promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel | null;
|
52
|
+
promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | BuyXPayYPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel | null;
|
49
53
|
coupons?: CouponRel[] | null;
|
50
54
|
}
|
51
55
|
declare class CouponCodesPromotionRules extends ApiResource<CouponCodesPromotionRule> {
|
@@ -26,6 +26,7 @@ interface Coupon extends Resource {
|
|
26
26
|
usage_limit?: number | null;
|
27
27
|
usage_count?: number | null;
|
28
28
|
recipient_email?: string | null;
|
29
|
+
expires_at?: string | null;
|
29
30
|
promotion_rule?: CouponCodesPromotionRule | null;
|
30
31
|
coupon_recipient?: CouponRecipient | null;
|
31
32
|
events?: Event[] | null;
|
@@ -37,6 +38,7 @@ interface CouponCreate extends ResourceCreate {
|
|
37
38
|
customer_single_use?: boolean | null;
|
38
39
|
usage_limit?: number | null;
|
39
40
|
recipient_email?: string | null;
|
41
|
+
expires_at?: string | null;
|
40
42
|
promotion_rule: CouponCodesPromotionRuleRel;
|
41
43
|
coupon_recipient?: CouponRecipientRel | null;
|
42
44
|
tags?: TagRel[] | null;
|
@@ -46,6 +48,7 @@ interface CouponUpdate extends ResourceUpdate {
|
|
46
48
|
customer_single_use?: boolean | null;
|
47
49
|
usage_limit?: number | null;
|
48
50
|
recipient_email?: string | null;
|
51
|
+
expires_at?: string | null;
|
49
52
|
promotion_rule?: CouponCodesPromotionRuleRel | null;
|
50
53
|
coupon_recipient?: CouponRecipientRel | null;
|
51
54
|
tags?: TagRel[] | null;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
|
+
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
|
+
import type { PercentageDiscountPromotion, PercentageDiscountPromotionType } from './percentage_discount_promotions';
|
5
|
+
import type { FreeShippingPromotion, FreeShippingPromotionType } from './free_shipping_promotions';
|
6
|
+
import type { BuyXPayYPromotion, BuyXPayYPromotionType } from './buy_x_pay_y_promotions';
|
7
|
+
import type { FreeGiftPromotion, FreeGiftPromotionType } from './free_gift_promotions';
|
8
|
+
import type { FixedPricePromotion, FixedPricePromotionType } from './fixed_price_promotions';
|
9
|
+
import type { ExternalPromotion, ExternalPromotionType } from './external_promotions';
|
10
|
+
import type { FixedAmountPromotion, FixedAmountPromotionType } from './fixed_amount_promotions';
|
11
|
+
import type { Version } from './versions';
|
12
|
+
type CustomPromotionRuleType = 'custom_promotion_rules';
|
13
|
+
type CustomPromotionRuleRel = ResourceRel & {
|
14
|
+
type: CustomPromotionRuleType;
|
15
|
+
};
|
16
|
+
type PercentageDiscountPromotionRel = ResourceRel & {
|
17
|
+
type: PercentageDiscountPromotionType;
|
18
|
+
};
|
19
|
+
type FreeShippingPromotionRel = ResourceRel & {
|
20
|
+
type: FreeShippingPromotionType;
|
21
|
+
};
|
22
|
+
type BuyXPayYPromotionRel = ResourceRel & {
|
23
|
+
type: BuyXPayYPromotionType;
|
24
|
+
};
|
25
|
+
type FreeGiftPromotionRel = ResourceRel & {
|
26
|
+
type: FreeGiftPromotionType;
|
27
|
+
};
|
28
|
+
type FixedPricePromotionRel = ResourceRel & {
|
29
|
+
type: FixedPricePromotionType;
|
30
|
+
};
|
31
|
+
type ExternalPromotionRel = ResourceRel & {
|
32
|
+
type: ExternalPromotionType;
|
33
|
+
};
|
34
|
+
type FixedAmountPromotionRel = ResourceRel & {
|
35
|
+
type: FixedAmountPromotionType;
|
36
|
+
};
|
37
|
+
interface CustomPromotionRule extends Resource {
|
38
|
+
readonly type: CustomPromotionRuleType;
|
39
|
+
filters?: Record<string, any> | null;
|
40
|
+
promotion?: PercentageDiscountPromotion | FreeShippingPromotion | BuyXPayYPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion | FixedAmountPromotion | null;
|
41
|
+
versions?: Version[] | null;
|
42
|
+
}
|
43
|
+
interface CustomPromotionRuleCreate extends ResourceCreate {
|
44
|
+
filters?: Record<string, any> | null;
|
45
|
+
promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | BuyXPayYPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel;
|
46
|
+
}
|
47
|
+
interface CustomPromotionRuleUpdate extends ResourceUpdate {
|
48
|
+
filters?: Record<string, any> | null;
|
49
|
+
promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | BuyXPayYPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel | FixedAmountPromotionRel | null;
|
50
|
+
}
|
51
|
+
declare class CustomPromotionRules extends ApiResource<CustomPromotionRule> {
|
52
|
+
static readonly TYPE: CustomPromotionRuleType;
|
53
|
+
create(resource: CustomPromotionRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
54
|
+
update(resource: CustomPromotionRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
55
|
+
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
56
|
+
versions(customPromotionRuleId: string | CustomPromotionRule, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
57
|
+
isCustomPromotionRule(resource: any): resource is CustomPromotionRule;
|
58
|
+
relationship(id: string | ResourceId | null): CustomPromotionRuleRel;
|
59
|
+
type(): CustomPromotionRuleType;
|
60
|
+
}
|
61
|
+
export default CustomPromotionRules;
|
62
|
+
export type { CustomPromotionRule, CustomPromotionRuleCreate, CustomPromotionRuleUpdate, CustomPromotionRuleType };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class CustomPromotionRules extends ApiResource {
|
3
|
+
async create(resource, params, options) {
|
4
|
+
return this.resources.create({ ...resource, type: CustomPromotionRules.TYPE }, params, options);
|
5
|
+
}
|
6
|
+
async update(resource, params, options) {
|
7
|
+
return this.resources.update({ ...resource, type: CustomPromotionRules.TYPE }, params, options);
|
8
|
+
}
|
9
|
+
async delete(id, options) {
|
10
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: CustomPromotionRules.TYPE } : id, options);
|
11
|
+
}
|
12
|
+
async versions(customPromotionRuleId, params, options) {
|
13
|
+
const _customPromotionRuleId = customPromotionRuleId.id || customPromotionRuleId;
|
14
|
+
return this.resources.fetch({ type: 'versions' }, `custom_promotion_rules/${_customPromotionRuleId}/versions`, params, options);
|
15
|
+
}
|
16
|
+
isCustomPromotionRule(resource) {
|
17
|
+
return resource.type && (resource.type === CustomPromotionRules.TYPE);
|
18
|
+
}
|
19
|
+
relationship(id) {
|
20
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: CustomPromotionRules.TYPE } : { id: id.id, type: CustomPromotionRules.TYPE };
|
21
|
+
}
|
22
|
+
type() {
|
23
|
+
return CustomPromotionRules.TYPE;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
CustomPromotionRules.TYPE = 'custom_promotion_rules';
|
27
|
+
export default CustomPromotionRules;
|
@@ -6,11 +6,13 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
|
|
6
6
|
import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
|
7
7
|
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
|
-
import type {
|
9
|
+
import type { Coupon, CouponType } from './coupons';
|
10
|
+
import type { SkuList, SkuListType } from './sku_lists';
|
10
11
|
import type { Attachment } from './attachments';
|
11
12
|
import type { Event } from './events';
|
12
13
|
import type { Tag, TagType } from './tags';
|
13
14
|
import type { Version } from './versions';
|
15
|
+
import type { Sku } from './skus';
|
14
16
|
type ExternalPromotionType = 'external_promotions';
|
15
17
|
type ExternalPromotionRel = ResourceRel & {
|
16
18
|
type: ExternalPromotionType;
|
@@ -30,6 +32,12 @@ type SkuListPromotionRuleRel = ResourceRel & {
|
|
30
32
|
type CouponCodesPromotionRuleRel = ResourceRel & {
|
31
33
|
type: CouponCodesPromotionRuleType;
|
32
34
|
};
|
35
|
+
type CouponRel = ResourceRel & {
|
36
|
+
type: CouponType;
|
37
|
+
};
|
38
|
+
type SkuListRel = ResourceRel & {
|
39
|
+
type: SkuListType;
|
40
|
+
};
|
33
41
|
type TagRel = ResourceRel & {
|
34
42
|
type: TagType;
|
35
43
|
};
|
@@ -37,11 +45,14 @@ interface ExternalPromotion extends Resource {
|
|
37
45
|
readonly type: ExternalPromotionType;
|
38
46
|
name: string;
|
39
47
|
currency_code?: string | null;
|
48
|
+
exclusive?: boolean | null;
|
49
|
+
priority?: number | null;
|
40
50
|
starts_at: string;
|
41
51
|
expires_at: string;
|
42
52
|
total_usage_limit: number;
|
43
53
|
total_usage_count?: number | null;
|
44
54
|
active?: boolean | null;
|
55
|
+
disabled_at?: string | null;
|
45
56
|
promotion_url: string;
|
46
57
|
shared_secret: string;
|
47
58
|
market?: Market | null;
|
@@ -49,15 +60,19 @@ interface ExternalPromotion extends Resource {
|
|
49
60
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
50
61
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
51
62
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
63
|
+
coupons?: Coupon[] | null;
|
52
64
|
sku_list?: SkuList | null;
|
53
65
|
attachments?: Attachment[] | null;
|
54
66
|
events?: Event[] | null;
|
55
67
|
tags?: Tag[] | null;
|
56
68
|
versions?: Version[] | null;
|
69
|
+
skus?: Sku[] | null;
|
57
70
|
}
|
58
71
|
interface ExternalPromotionCreate extends ResourceCreate {
|
59
72
|
name: string;
|
60
73
|
currency_code?: string | null;
|
74
|
+
exclusive?: boolean | null;
|
75
|
+
priority?: number | null;
|
61
76
|
starts_at: string;
|
62
77
|
expires_at: string;
|
63
78
|
total_usage_limit: number;
|
@@ -67,20 +82,28 @@ interface ExternalPromotionCreate extends ResourceCreate {
|
|
67
82
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
68
83
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
69
84
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
85
|
+
coupons?: CouponRel[] | null;
|
86
|
+
sku_list?: SkuListRel | null;
|
70
87
|
tags?: TagRel[] | null;
|
71
88
|
}
|
72
89
|
interface ExternalPromotionUpdate extends ResourceUpdate {
|
73
90
|
name?: string | null;
|
74
91
|
currency_code?: string | null;
|
92
|
+
exclusive?: boolean | null;
|
93
|
+
priority?: number | null;
|
75
94
|
starts_at?: string | null;
|
76
95
|
expires_at?: string | null;
|
77
96
|
total_usage_limit?: number | null;
|
97
|
+
_disable?: boolean | null;
|
98
|
+
_enable?: boolean | null;
|
78
99
|
promotion_url?: string | null;
|
79
100
|
market?: MarketRel | null;
|
80
101
|
promotion_rules?: PromotionRuleRel[] | null;
|
81
102
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
82
103
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
83
104
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
105
|
+
coupons?: CouponRel[] | null;
|
106
|
+
sku_list?: SkuListRel | null;
|
84
107
|
tags?: TagRel[] | null;
|
85
108
|
}
|
86
109
|
declare class ExternalPromotions extends ApiResource<ExternalPromotion> {
|
@@ -92,11 +115,15 @@ declare class ExternalPromotions extends ApiResource<ExternalPromotion> {
|
|
92
115
|
order_amount_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
93
116
|
sku_list_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
94
117
|
coupon_codes_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
118
|
+
coupons(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
95
119
|
sku_list(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
96
120
|
attachments(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
97
121
|
events(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
98
122
|
tags(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
99
123
|
versions(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
124
|
+
skus(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
125
|
+
_disable(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
126
|
+
_enable(id: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<ExternalPromotion>;
|
100
127
|
isExternalPromotion(resource: any): resource is ExternalPromotion;
|
101
128
|
relationship(id: string | ResourceId | null): ExternalPromotionRel;
|
102
129
|
type(): ExternalPromotionType;
|
@@ -25,6 +25,10 @@ class ExternalPromotions extends ApiResource {
|
|
25
25
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
26
26
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `external_promotions/${_externalPromotionId}/coupon_codes_promotion_rule`, params, options);
|
27
27
|
}
|
28
|
+
async coupons(externalPromotionId, params, options) {
|
29
|
+
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
30
|
+
return this.resources.fetch({ type: 'coupons' }, `external_promotions/${_externalPromotionId}/coupons`, params, options);
|
31
|
+
}
|
28
32
|
async sku_list(externalPromotionId, params, options) {
|
29
33
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
30
34
|
return this.resources.fetch({ type: 'sku_lists' }, `external_promotions/${_externalPromotionId}/sku_list`, params, options);
|
@@ -45,6 +49,16 @@ class ExternalPromotions extends ApiResource {
|
|
45
49
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
46
50
|
return this.resources.fetch({ type: 'versions' }, `external_promotions/${_externalPromotionId}/versions`, params, options);
|
47
51
|
}
|
52
|
+
async skus(externalPromotionId, params, options) {
|
53
|
+
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
54
|
+
return this.resources.fetch({ type: 'skus' }, `external_promotions/${_externalPromotionId}/skus`, params, options);
|
55
|
+
}
|
56
|
+
async _disable(id, params, options) {
|
57
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _disable: true }, params, options);
|
58
|
+
}
|
59
|
+
async _enable(id, params, options) {
|
60
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _enable: true }, params, options);
|
61
|
+
}
|
48
62
|
isExternalPromotion(resource) {
|
49
63
|
return resource.type && (resource.type === ExternalPromotions.TYPE);
|
50
64
|
}
|
@@ -6,11 +6,13 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
|
|
6
6
|
import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
|
7
7
|
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
|
-
import type {
|
9
|
+
import type { Coupon, CouponType } from './coupons';
|
10
|
+
import type { SkuList, SkuListType } from './sku_lists';
|
10
11
|
import type { Attachment } from './attachments';
|
11
12
|
import type { Event } from './events';
|
12
13
|
import type { Tag, TagType } from './tags';
|
13
14
|
import type { Version } from './versions';
|
15
|
+
import type { Sku } from './skus';
|
14
16
|
type FixedAmountPromotionType = 'fixed_amount_promotions';
|
15
17
|
type FixedAmountPromotionRel = ResourceRel & {
|
16
18
|
type: FixedAmountPromotionType;
|
@@ -30,6 +32,12 @@ type SkuListPromotionRuleRel = ResourceRel & {
|
|
30
32
|
type CouponCodesPromotionRuleRel = ResourceRel & {
|
31
33
|
type: CouponCodesPromotionRuleType;
|
32
34
|
};
|
35
|
+
type CouponRel = ResourceRel & {
|
36
|
+
type: CouponType;
|
37
|
+
};
|
38
|
+
type SkuListRel = ResourceRel & {
|
39
|
+
type: SkuListType;
|
40
|
+
};
|
33
41
|
type TagRel = ResourceRel & {
|
34
42
|
type: TagType;
|
35
43
|
};
|
@@ -37,11 +45,14 @@ interface FixedAmountPromotion extends Resource {
|
|
37
45
|
readonly type: FixedAmountPromotionType;
|
38
46
|
name: string;
|
39
47
|
currency_code?: string | null;
|
48
|
+
exclusive?: boolean | null;
|
49
|
+
priority?: number | null;
|
40
50
|
starts_at: string;
|
41
51
|
expires_at: string;
|
42
52
|
total_usage_limit: number;
|
43
53
|
total_usage_count?: number | null;
|
44
54
|
active?: boolean | null;
|
55
|
+
disabled_at?: string | null;
|
45
56
|
fixed_amount_cents: number;
|
46
57
|
fixed_amount_float?: number | null;
|
47
58
|
formatted_fixed_amount?: string | null;
|
@@ -50,15 +61,19 @@ interface FixedAmountPromotion extends Resource {
|
|
50
61
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
51
62
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
52
63
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
64
|
+
coupons?: Coupon[] | null;
|
53
65
|
sku_list?: SkuList | null;
|
54
66
|
attachments?: Attachment[] | null;
|
55
67
|
events?: Event[] | null;
|
56
68
|
tags?: Tag[] | null;
|
57
69
|
versions?: Version[] | null;
|
70
|
+
skus?: Sku[] | null;
|
58
71
|
}
|
59
72
|
interface FixedAmountPromotionCreate extends ResourceCreate {
|
60
73
|
name: string;
|
61
74
|
currency_code?: string | null;
|
75
|
+
exclusive?: boolean | null;
|
76
|
+
priority?: number | null;
|
62
77
|
starts_at: string;
|
63
78
|
expires_at: string;
|
64
79
|
total_usage_limit: number;
|
@@ -68,20 +83,28 @@ interface FixedAmountPromotionCreate extends ResourceCreate {
|
|
68
83
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
69
84
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
70
85
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
86
|
+
coupons?: CouponRel[] | null;
|
87
|
+
sku_list?: SkuListRel | null;
|
71
88
|
tags?: TagRel[] | null;
|
72
89
|
}
|
73
90
|
interface FixedAmountPromotionUpdate extends ResourceUpdate {
|
74
91
|
name?: string | null;
|
75
92
|
currency_code?: string | null;
|
93
|
+
exclusive?: boolean | null;
|
94
|
+
priority?: number | null;
|
76
95
|
starts_at?: string | null;
|
77
96
|
expires_at?: string | null;
|
78
97
|
total_usage_limit?: number | null;
|
98
|
+
_disable?: boolean | null;
|
99
|
+
_enable?: boolean | null;
|
79
100
|
fixed_amount_cents?: number | null;
|
80
101
|
market?: MarketRel | null;
|
81
102
|
promotion_rules?: PromotionRuleRel[] | null;
|
82
103
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
83
104
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
84
105
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
106
|
+
coupons?: CouponRel[] | null;
|
107
|
+
sku_list?: SkuListRel | null;
|
85
108
|
tags?: TagRel[] | null;
|
86
109
|
}
|
87
110
|
declare class FixedAmountPromotions extends ApiResource<FixedAmountPromotion> {
|
@@ -93,11 +116,15 @@ declare class FixedAmountPromotions extends ApiResource<FixedAmountPromotion> {
|
|
93
116
|
order_amount_promotion_rule(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
94
117
|
sku_list_promotion_rule(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
95
118
|
coupon_codes_promotion_rule(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
119
|
+
coupons(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
96
120
|
sku_list(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
97
121
|
attachments(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
98
122
|
events(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
99
123
|
tags(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
100
124
|
versions(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
125
|
+
skus(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
126
|
+
_disable(id: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FixedAmountPromotion>;
|
127
|
+
_enable(id: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FixedAmountPromotion>;
|
101
128
|
isFixedAmountPromotion(resource: any): resource is FixedAmountPromotion;
|
102
129
|
relationship(id: string | ResourceId | null): FixedAmountPromotionRel;
|
103
130
|
type(): FixedAmountPromotionType;
|