@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
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const resource_1 = require("../resource");
|
4
|
+
class CustomPromotionRules extends resource_1.ApiResource {
|
5
|
+
async create(resource, params, options) {
|
6
|
+
return this.resources.create({ ...resource, type: CustomPromotionRules.TYPE }, params, options);
|
7
|
+
}
|
8
|
+
async update(resource, params, options) {
|
9
|
+
return this.resources.update({ ...resource, type: CustomPromotionRules.TYPE }, params, options);
|
10
|
+
}
|
11
|
+
async delete(id, options) {
|
12
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: CustomPromotionRules.TYPE } : id, options);
|
13
|
+
}
|
14
|
+
async versions(customPromotionRuleId, params, options) {
|
15
|
+
const _customPromotionRuleId = customPromotionRuleId.id || customPromotionRuleId;
|
16
|
+
return this.resources.fetch({ type: 'versions' }, `custom_promotion_rules/${_customPromotionRuleId}/versions`, params, options);
|
17
|
+
}
|
18
|
+
isCustomPromotionRule(resource) {
|
19
|
+
return resource.type && (resource.type === CustomPromotionRules.TYPE);
|
20
|
+
}
|
21
|
+
relationship(id) {
|
22
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: CustomPromotionRules.TYPE } : { id: id.id, type: CustomPromotionRules.TYPE };
|
23
|
+
}
|
24
|
+
type() {
|
25
|
+
return CustomPromotionRules.TYPE;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
CustomPromotionRules.TYPE = 'custom_promotion_rules';
|
29
|
+
exports.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;
|
@@ -27,6 +27,10 @@ class ExternalPromotions extends resource_1.ApiResource {
|
|
27
27
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
28
28
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `external_promotions/${_externalPromotionId}/coupon_codes_promotion_rule`, params, options);
|
29
29
|
}
|
30
|
+
async coupons(externalPromotionId, params, options) {
|
31
|
+
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
32
|
+
return this.resources.fetch({ type: 'coupons' }, `external_promotions/${_externalPromotionId}/coupons`, params, options);
|
33
|
+
}
|
30
34
|
async sku_list(externalPromotionId, params, options) {
|
31
35
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
32
36
|
return this.resources.fetch({ type: 'sku_lists' }, `external_promotions/${_externalPromotionId}/sku_list`, params, options);
|
@@ -47,6 +51,16 @@ class ExternalPromotions extends resource_1.ApiResource {
|
|
47
51
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
48
52
|
return this.resources.fetch({ type: 'versions' }, `external_promotions/${_externalPromotionId}/versions`, params, options);
|
49
53
|
}
|
54
|
+
async skus(externalPromotionId, params, options) {
|
55
|
+
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
56
|
+
return this.resources.fetch({ type: 'skus' }, `external_promotions/${_externalPromotionId}/skus`, params, options);
|
57
|
+
}
|
58
|
+
async _disable(id, params, options) {
|
59
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _disable: true }, params, options);
|
60
|
+
}
|
61
|
+
async _enable(id, params, options) {
|
62
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: ExternalPromotions.TYPE, _enable: true }, params, options);
|
63
|
+
}
|
50
64
|
isExternalPromotion(resource) {
|
51
65
|
return resource.type && (resource.type === ExternalPromotions.TYPE);
|
52
66
|
}
|
@@ -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;
|
@@ -27,6 +27,10 @@ class FixedAmountPromotions extends resource_1.ApiResource {
|
|
27
27
|
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
28
28
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/coupon_codes_promotion_rule`, params, options);
|
29
29
|
}
|
30
|
+
async coupons(fixedAmountPromotionId, params, options) {
|
31
|
+
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
32
|
+
return this.resources.fetch({ type: 'coupons' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/coupons`, params, options);
|
33
|
+
}
|
30
34
|
async sku_list(fixedAmountPromotionId, params, options) {
|
31
35
|
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
32
36
|
return this.resources.fetch({ type: 'sku_lists' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/sku_list`, params, options);
|
@@ -47,6 +51,16 @@ class FixedAmountPromotions extends resource_1.ApiResource {
|
|
47
51
|
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
48
52
|
return this.resources.fetch({ type: 'versions' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/versions`, params, options);
|
49
53
|
}
|
54
|
+
async skus(fixedAmountPromotionId, params, options) {
|
55
|
+
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
56
|
+
return this.resources.fetch({ type: 'skus' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/skus`, params, options);
|
57
|
+
}
|
58
|
+
async _disable(id, params, options) {
|
59
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedAmountPromotions.TYPE, _disable: true }, params, options);
|
60
|
+
}
|
61
|
+
async _enable(id, params, options) {
|
62
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedAmountPromotions.TYPE, _enable: true }, params, options);
|
63
|
+
}
|
50
64
|
isFixedAmountPromotion(resource) {
|
51
65
|
return resource.type && (resource.type === FixedAmountPromotions.TYPE);
|
52
66
|
}
|
@@ -6,6 +6,7 @@ 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 { Coupon, CouponType } from './coupons';
|
9
10
|
import type { SkuList, SkuListType } from './sku_lists';
|
10
11
|
import type { Attachment } from './attachments';
|
11
12
|
import type { Event } from './events';
|
@@ -31,6 +32,9 @@ type SkuListPromotionRuleRel = ResourceRel & {
|
|
31
32
|
type CouponCodesPromotionRuleRel = ResourceRel & {
|
32
33
|
type: CouponCodesPromotionRuleType;
|
33
34
|
};
|
35
|
+
type CouponRel = ResourceRel & {
|
36
|
+
type: CouponType;
|
37
|
+
};
|
34
38
|
type SkuListRel = ResourceRel & {
|
35
39
|
type: SkuListType;
|
36
40
|
};
|
@@ -41,11 +45,14 @@ interface FixedPricePromotion extends Resource {
|
|
41
45
|
readonly type: FixedPricePromotionType;
|
42
46
|
name: string;
|
43
47
|
currency_code?: string | null;
|
48
|
+
exclusive?: boolean | null;
|
49
|
+
priority?: number | null;
|
44
50
|
starts_at: string;
|
45
51
|
expires_at: string;
|
46
52
|
total_usage_limit: number;
|
47
53
|
total_usage_count?: number | null;
|
48
54
|
active?: boolean | null;
|
55
|
+
disabled_at?: string | null;
|
49
56
|
fixed_amount_cents: number;
|
50
57
|
fixed_amount_float?: number | null;
|
51
58
|
formatted_fixed_amount?: string | null;
|
@@ -54,6 +61,7 @@ interface FixedPricePromotion extends Resource {
|
|
54
61
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
55
62
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
56
63
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
64
|
+
coupons?: Coupon[] | null;
|
57
65
|
sku_list?: SkuList | null;
|
58
66
|
attachments?: Attachment[] | null;
|
59
67
|
events?: Event[] | null;
|
@@ -64,6 +72,8 @@ interface FixedPricePromotion extends Resource {
|
|
64
72
|
interface FixedPricePromotionCreate extends ResourceCreate {
|
65
73
|
name: string;
|
66
74
|
currency_code?: string | null;
|
75
|
+
exclusive?: boolean | null;
|
76
|
+
priority?: number | null;
|
67
77
|
starts_at: string;
|
68
78
|
expires_at: string;
|
69
79
|
total_usage_limit: number;
|
@@ -73,21 +83,27 @@ interface FixedPricePromotionCreate extends ResourceCreate {
|
|
73
83
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
74
84
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
75
85
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
86
|
+
coupons?: CouponRel[] | null;
|
76
87
|
sku_list: SkuListRel;
|
77
88
|
tags?: TagRel[] | null;
|
78
89
|
}
|
79
90
|
interface FixedPricePromotionUpdate extends ResourceUpdate {
|
80
91
|
name?: string | null;
|
81
92
|
currency_code?: string | null;
|
93
|
+
exclusive?: boolean | null;
|
94
|
+
priority?: number | null;
|
82
95
|
starts_at?: string | null;
|
83
96
|
expires_at?: string | null;
|
84
97
|
total_usage_limit?: number | null;
|
98
|
+
_disable?: boolean | null;
|
99
|
+
_enable?: boolean | null;
|
85
100
|
fixed_amount_cents?: number | null;
|
86
101
|
market?: MarketRel | null;
|
87
102
|
promotion_rules?: PromotionRuleRel[] | null;
|
88
103
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
89
104
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
90
105
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
106
|
+
coupons?: CouponRel[] | null;
|
91
107
|
sku_list?: SkuListRel | null;
|
92
108
|
tags?: TagRel[] | null;
|
93
109
|
}
|
@@ -100,12 +116,15 @@ declare class FixedPricePromotions extends ApiResource<FixedPricePromotion> {
|
|
100
116
|
order_amount_promotion_rule(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
101
117
|
sku_list_promotion_rule(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
102
118
|
coupon_codes_promotion_rule(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
119
|
+
coupons(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
103
120
|
sku_list(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
104
121
|
attachments(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
105
122
|
events(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
106
123
|
tags(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
107
124
|
versions(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
108
125
|
skus(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
126
|
+
_disable(id: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FixedPricePromotion>;
|
127
|
+
_enable(id: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FixedPricePromotion>;
|
109
128
|
isFixedPricePromotion(resource: any): resource is FixedPricePromotion;
|
110
129
|
relationship(id: string | ResourceId | null): FixedPricePromotionRel;
|
111
130
|
type(): FixedPricePromotionType;
|
@@ -27,6 +27,10 @@ class FixedPricePromotions extends resource_1.ApiResource {
|
|
27
27
|
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
28
28
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `fixed_price_promotions/${_fixedPricePromotionId}/coupon_codes_promotion_rule`, params, options);
|
29
29
|
}
|
30
|
+
async coupons(fixedPricePromotionId, params, options) {
|
31
|
+
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
32
|
+
return this.resources.fetch({ type: 'coupons' }, `fixed_price_promotions/${_fixedPricePromotionId}/coupons`, params, options);
|
33
|
+
}
|
30
34
|
async sku_list(fixedPricePromotionId, params, options) {
|
31
35
|
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
32
36
|
return this.resources.fetch({ type: 'sku_lists' }, `fixed_price_promotions/${_fixedPricePromotionId}/sku_list`, params, options);
|
@@ -51,6 +55,12 @@ class FixedPricePromotions extends resource_1.ApiResource {
|
|
51
55
|
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
52
56
|
return this.resources.fetch({ type: 'skus' }, `fixed_price_promotions/${_fixedPricePromotionId}/skus`, params, options);
|
53
57
|
}
|
58
|
+
async _disable(id, params, options) {
|
59
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedPricePromotions.TYPE, _disable: true }, params, options);
|
60
|
+
}
|
61
|
+
async _enable(id, params, options) {
|
62
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FixedPricePromotions.TYPE, _enable: true }, params, options);
|
63
|
+
}
|
54
64
|
isFixedPricePromotion(resource) {
|
55
65
|
return resource.type && (resource.type === FixedPricePromotions.TYPE);
|
56
66
|
}
|
@@ -6,6 +6,7 @@ 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 { Coupon, CouponType } from './coupons';
|
9
10
|
import type { SkuList, SkuListType } from './sku_lists';
|
10
11
|
import type { Attachment } from './attachments';
|
11
12
|
import type { Event } from './events';
|
@@ -31,6 +32,9 @@ type SkuListPromotionRuleRel = ResourceRel & {
|
|
31
32
|
type CouponCodesPromotionRuleRel = ResourceRel & {
|
32
33
|
type: CouponCodesPromotionRuleType;
|
33
34
|
};
|
35
|
+
type CouponRel = ResourceRel & {
|
36
|
+
type: CouponType;
|
37
|
+
};
|
34
38
|
type SkuListRel = ResourceRel & {
|
35
39
|
type: SkuListType;
|
36
40
|
};
|
@@ -41,17 +45,21 @@ interface FreeGiftPromotion extends Resource {
|
|
41
45
|
readonly type: FreeGiftPromotionType;
|
42
46
|
name: string;
|
43
47
|
currency_code?: string | null;
|
48
|
+
exclusive?: boolean | null;
|
49
|
+
priority?: number | null;
|
44
50
|
starts_at: string;
|
45
51
|
expires_at: string;
|
46
52
|
total_usage_limit: number;
|
47
53
|
total_usage_count?: number | null;
|
48
54
|
active?: boolean | null;
|
55
|
+
disabled_at?: string | null;
|
49
56
|
max_quantity?: number | null;
|
50
57
|
market?: Market | null;
|
51
58
|
promotion_rules?: PromotionRule[] | null;
|
52
59
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
53
60
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
54
61
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
62
|
+
coupons?: Coupon[] | null;
|
55
63
|
sku_list?: SkuList | null;
|
56
64
|
attachments?: Attachment[] | null;
|
57
65
|
events?: Event[] | null;
|
@@ -62,6 +70,8 @@ interface FreeGiftPromotion extends Resource {
|
|
62
70
|
interface FreeGiftPromotionCreate extends ResourceCreate {
|
63
71
|
name: string;
|
64
72
|
currency_code?: string | null;
|
73
|
+
exclusive?: boolean | null;
|
74
|
+
priority?: number | null;
|
65
75
|
starts_at: string;
|
66
76
|
expires_at: string;
|
67
77
|
total_usage_limit: number;
|
@@ -71,21 +81,27 @@ interface FreeGiftPromotionCreate extends ResourceCreate {
|
|
71
81
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
72
82
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
73
83
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
84
|
+
coupons?: CouponRel[] | null;
|
74
85
|
sku_list: SkuListRel;
|
75
86
|
tags?: TagRel[] | null;
|
76
87
|
}
|
77
88
|
interface FreeGiftPromotionUpdate extends ResourceUpdate {
|
78
89
|
name?: string | null;
|
79
90
|
currency_code?: string | null;
|
91
|
+
exclusive?: boolean | null;
|
92
|
+
priority?: number | null;
|
80
93
|
starts_at?: string | null;
|
81
94
|
expires_at?: string | null;
|
82
95
|
total_usage_limit?: number | null;
|
96
|
+
_disable?: boolean | null;
|
97
|
+
_enable?: boolean | null;
|
83
98
|
max_quantity?: number | null;
|
84
99
|
market?: MarketRel | null;
|
85
100
|
promotion_rules?: PromotionRuleRel[] | null;
|
86
101
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
87
102
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
88
103
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
104
|
+
coupons?: CouponRel[] | null;
|
89
105
|
sku_list?: SkuListRel | null;
|
90
106
|
tags?: TagRel[] | null;
|
91
107
|
}
|
@@ -98,12 +114,15 @@ declare class FreeGiftPromotions extends ApiResource<FreeGiftPromotion> {
|
|
98
114
|
order_amount_promotion_rule(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
99
115
|
sku_list_promotion_rule(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
100
116
|
coupon_codes_promotion_rule(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
117
|
+
coupons(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
101
118
|
sku_list(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
102
119
|
attachments(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
103
120
|
events(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
104
121
|
tags(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
105
122
|
versions(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
106
123
|
skus(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
124
|
+
_disable(id: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FreeGiftPromotion>;
|
125
|
+
_enable(id: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FreeGiftPromotion>;
|
107
126
|
isFreeGiftPromotion(resource: any): resource is FreeGiftPromotion;
|
108
127
|
relationship(id: string | ResourceId | null): FreeGiftPromotionRel;
|
109
128
|
type(): FreeGiftPromotionType;
|
@@ -27,6 +27,10 @@ class FreeGiftPromotions extends resource_1.ApiResource {
|
|
27
27
|
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
28
28
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `free_gift_promotions/${_freeGiftPromotionId}/coupon_codes_promotion_rule`, params, options);
|
29
29
|
}
|
30
|
+
async coupons(freeGiftPromotionId, params, options) {
|
31
|
+
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
32
|
+
return this.resources.fetch({ type: 'coupons' }, `free_gift_promotions/${_freeGiftPromotionId}/coupons`, params, options);
|
33
|
+
}
|
30
34
|
async sku_list(freeGiftPromotionId, params, options) {
|
31
35
|
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
32
36
|
return this.resources.fetch({ type: 'sku_lists' }, `free_gift_promotions/${_freeGiftPromotionId}/sku_list`, params, options);
|
@@ -51,6 +55,12 @@ class FreeGiftPromotions extends resource_1.ApiResource {
|
|
51
55
|
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
52
56
|
return this.resources.fetch({ type: 'skus' }, `free_gift_promotions/${_freeGiftPromotionId}/skus`, params, options);
|
53
57
|
}
|
58
|
+
async _disable(id, params, options) {
|
59
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeGiftPromotions.TYPE, _disable: true }, params, options);
|
60
|
+
}
|
61
|
+
async _enable(id, params, options) {
|
62
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeGiftPromotions.TYPE, _enable: true }, params, options);
|
63
|
+
}
|
54
64
|
isFreeGiftPromotion(resource) {
|
55
65
|
return resource.type && (resource.type === FreeGiftPromotions.TYPE);
|
56
66
|
}
|
@@ -6,6 +6,7 @@ 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 { Coupon, CouponType } from './coupons';
|
9
10
|
import type { SkuList } from './sku_lists';
|
10
11
|
import type { Attachment } from './attachments';
|
11
12
|
import type { Event } from './events';
|
@@ -30,6 +31,9 @@ type SkuListPromotionRuleRel = ResourceRel & {
|
|
30
31
|
type CouponCodesPromotionRuleRel = ResourceRel & {
|
31
32
|
type: CouponCodesPromotionRuleType;
|
32
33
|
};
|
34
|
+
type CouponRel = ResourceRel & {
|
35
|
+
type: CouponType;
|
36
|
+
};
|
33
37
|
type TagRel = ResourceRel & {
|
34
38
|
type: TagType;
|
35
39
|
};
|
@@ -37,16 +41,20 @@ interface FreeShippingPromotion extends Resource {
|
|
37
41
|
readonly type: FreeShippingPromotionType;
|
38
42
|
name: string;
|
39
43
|
currency_code?: string | null;
|
44
|
+
exclusive?: boolean | null;
|
45
|
+
priority?: number | null;
|
40
46
|
starts_at: string;
|
41
47
|
expires_at: string;
|
42
48
|
total_usage_limit: number;
|
43
49
|
total_usage_count?: number | null;
|
44
50
|
active?: boolean | null;
|
51
|
+
disabled_at?: string | null;
|
45
52
|
market?: Market | null;
|
46
53
|
promotion_rules?: PromotionRule[] | null;
|
47
54
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
48
55
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
49
56
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
57
|
+
coupons?: Coupon[] | null;
|
50
58
|
sku_list?: SkuList | null;
|
51
59
|
attachments?: Attachment[] | null;
|
52
60
|
events?: Event[] | null;
|
@@ -56,6 +64,8 @@ interface FreeShippingPromotion extends Resource {
|
|
56
64
|
interface FreeShippingPromotionCreate extends ResourceCreate {
|
57
65
|
name: string;
|
58
66
|
currency_code?: string | null;
|
67
|
+
exclusive?: boolean | null;
|
68
|
+
priority?: number | null;
|
59
69
|
starts_at: string;
|
60
70
|
expires_at: string;
|
61
71
|
total_usage_limit: number;
|
@@ -64,19 +74,25 @@ interface FreeShippingPromotionCreate extends ResourceCreate {
|
|
64
74
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
65
75
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
66
76
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
77
|
+
coupons?: CouponRel[] | null;
|
67
78
|
tags?: TagRel[] | null;
|
68
79
|
}
|
69
80
|
interface FreeShippingPromotionUpdate extends ResourceUpdate {
|
70
81
|
name?: string | null;
|
71
82
|
currency_code?: string | null;
|
83
|
+
exclusive?: boolean | null;
|
84
|
+
priority?: number | null;
|
72
85
|
starts_at?: string | null;
|
73
86
|
expires_at?: string | null;
|
74
87
|
total_usage_limit?: number | null;
|
88
|
+
_disable?: boolean | null;
|
89
|
+
_enable?: boolean | null;
|
75
90
|
market?: MarketRel | null;
|
76
91
|
promotion_rules?: PromotionRuleRel[] | null;
|
77
92
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
78
93
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
79
94
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
95
|
+
coupons?: CouponRel[] | null;
|
80
96
|
tags?: TagRel[] | null;
|
81
97
|
}
|
82
98
|
declare class FreeShippingPromotions extends ApiResource<FreeShippingPromotion> {
|
@@ -88,11 +104,14 @@ declare class FreeShippingPromotions extends ApiResource<FreeShippingPromotion>
|
|
88
104
|
order_amount_promotion_rule(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
89
105
|
sku_list_promotion_rule(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
90
106
|
coupon_codes_promotion_rule(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
107
|
+
coupons(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
91
108
|
sku_list(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
92
109
|
attachments(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
93
110
|
events(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
94
111
|
tags(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
95
112
|
versions(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
|
113
|
+
_disable(id: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FreeShippingPromotion>;
|
114
|
+
_enable(id: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<FreeShippingPromotion>;
|
96
115
|
isFreeShippingPromotion(resource: any): resource is FreeShippingPromotion;
|
97
116
|
relationship(id: string | ResourceId | null): FreeShippingPromotionRel;
|
98
117
|
type(): FreeShippingPromotionType;
|
@@ -27,6 +27,10 @@ class FreeShippingPromotions extends resource_1.ApiResource {
|
|
27
27
|
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
28
28
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `free_shipping_promotions/${_freeShippingPromotionId}/coupon_codes_promotion_rule`, params, options);
|
29
29
|
}
|
30
|
+
async coupons(freeShippingPromotionId, params, options) {
|
31
|
+
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
32
|
+
return this.resources.fetch({ type: 'coupons' }, `free_shipping_promotions/${_freeShippingPromotionId}/coupons`, params, options);
|
33
|
+
}
|
30
34
|
async sku_list(freeShippingPromotionId, params, options) {
|
31
35
|
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
32
36
|
return this.resources.fetch({ type: 'sku_lists' }, `free_shipping_promotions/${_freeShippingPromotionId}/sku_list`, params, options);
|
@@ -47,6 +51,12 @@ class FreeShippingPromotions extends resource_1.ApiResource {
|
|
47
51
|
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
48
52
|
return this.resources.fetch({ type: 'versions' }, `free_shipping_promotions/${_freeShippingPromotionId}/versions`, params, options);
|
49
53
|
}
|
54
|
+
async _disable(id, params, options) {
|
55
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeShippingPromotions.TYPE, _disable: true }, params, options);
|
56
|
+
}
|
57
|
+
async _enable(id, params, options) {
|
58
|
+
return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: FreeShippingPromotions.TYPE, _enable: true }, params, options);
|
59
|
+
}
|
50
60
|
isFreeShippingPromotion(resource) {
|
51
61
|
return resource.type && (resource.type === FreeShippingPromotions.TYPE);
|
52
62
|
}
|