@commercelayer/sdk 5.31.0 → 5.32.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/commercelayer.d.ts +2 -2
- package/lib/cjs/commercelayer.js +1 -1
- package/lib/cjs/query.js +8 -4
- package/lib/cjs/resource.d.ts +5 -2
- package/lib/cjs/resource.js +15 -8
- package/lib/cjs/resources/buy_x_pay_y_promotions.d.ts +4 -14
- package/lib/cjs/resources/buy_x_pay_y_promotions.js +4 -4
- package/lib/cjs/resources/external_promotions.d.ts +4 -14
- package/lib/cjs/resources/external_promotions.js +4 -4
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +4 -14
- package/lib/cjs/resources/fixed_amount_promotions.js +4 -4
- package/lib/cjs/resources/fixed_price_promotions.d.ts +4 -14
- package/lib/cjs/resources/fixed_price_promotions.js +4 -4
- package/lib/cjs/resources/free_gift_promotions.d.ts +4 -14
- package/lib/cjs/resources/free_gift_promotions.js +4 -4
- package/lib/cjs/resources/free_shipping_promotions.d.ts +9 -14
- package/lib/cjs/resources/free_shipping_promotions.js +4 -4
- package/lib/cjs/resources/payment_methods.d.ts +3 -0
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +4 -14
- package/lib/cjs/resources/percentage_discount_promotions.js +4 -4
- package/lib/cjs/resources/promotions.d.ts +3 -3
- package/lib/cjs/resources/promotions.js +4 -4
- package/lib/cjs/resources/stock_transfers.d.ts +1 -1
- package/lib/cjs/resources/stripe_payments.d.ts +4 -1
- package/lib/esm/commercelayer.d.ts +2 -2
- package/lib/esm/commercelayer.js +1 -1
- package/lib/esm/query.js +8 -4
- package/lib/esm/resource.d.ts +5 -2
- package/lib/esm/resource.js +15 -8
- package/lib/esm/resources/buy_x_pay_y_promotions.d.ts +4 -14
- package/lib/esm/resources/buy_x_pay_y_promotions.js +4 -4
- package/lib/esm/resources/external_promotions.d.ts +4 -14
- package/lib/esm/resources/external_promotions.js +4 -4
- package/lib/esm/resources/fixed_amount_promotions.d.ts +4 -14
- package/lib/esm/resources/fixed_amount_promotions.js +4 -4
- package/lib/esm/resources/fixed_price_promotions.d.ts +4 -14
- package/lib/esm/resources/fixed_price_promotions.js +4 -4
- package/lib/esm/resources/free_gift_promotions.d.ts +4 -14
- package/lib/esm/resources/free_gift_promotions.js +4 -4
- package/lib/esm/resources/free_shipping_promotions.d.ts +9 -14
- package/lib/esm/resources/free_shipping_promotions.js +4 -4
- package/lib/esm/resources/payment_methods.d.ts +3 -0
- package/lib/esm/resources/percentage_discount_promotions.d.ts +4 -14
- package/lib/esm/resources/percentage_discount_promotions.js +4 -4
- package/lib/esm/resources/promotions.d.ts +3 -3
- package/lib/esm/resources/promotions.js +4 -4
- package/lib/esm/resources/stock_transfers.d.ts +1 -1
- package/lib/esm/resources/stripe_payments.d.ts +4 -1
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
@@ -2,13 +2,13 @@ import { ApiResource } from '../resource';
|
|
2
2
|
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { Market, MarketType } from './markets';
|
5
|
-
import type { PromotionRule
|
5
|
+
import type { PromotionRule } 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
9
|
import type { CustomPromotionRule, CustomPromotionRuleType } from './custom_promotion_rules';
|
10
|
-
import type {
|
11
|
-
import type {
|
10
|
+
import type { SkuList, SkuListType } from './sku_lists';
|
11
|
+
import type { Coupon } from './coupons';
|
12
12
|
import type { Attachment } from './attachments';
|
13
13
|
import type { Event } from './events';
|
14
14
|
import type { Tag, TagType } from './tags';
|
@@ -20,9 +20,6 @@ type FreeShippingPromotionRel = ResourceRel & {
|
|
20
20
|
type MarketRel = ResourceRel & {
|
21
21
|
type: MarketType;
|
22
22
|
};
|
23
|
-
type PromotionRuleRel = ResourceRel & {
|
24
|
-
type: PromotionRuleType;
|
25
|
-
};
|
26
23
|
type OrderAmountPromotionRuleRel = ResourceRel & {
|
27
24
|
type: OrderAmountPromotionRuleType;
|
28
25
|
};
|
@@ -35,8 +32,8 @@ type CouponCodesPromotionRuleRel = ResourceRel & {
|
|
35
32
|
type CustomPromotionRuleRel = ResourceRel & {
|
36
33
|
type: CustomPromotionRuleType;
|
37
34
|
};
|
38
|
-
type
|
39
|
-
type:
|
35
|
+
type SkuListRel = ResourceRel & {
|
36
|
+
type: SkuListType;
|
40
37
|
};
|
41
38
|
type TagRel = ResourceRel & {
|
42
39
|
type: TagType;
|
@@ -59,8 +56,8 @@ interface FreeShippingPromotion extends Resource {
|
|
59
56
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
60
57
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
61
58
|
custom_promotion_rule?: CustomPromotionRule | null;
|
62
|
-
coupons?: Coupon[] | null;
|
63
59
|
sku_list?: SkuList | null;
|
60
|
+
coupons?: Coupon[] | null;
|
64
61
|
attachments?: Attachment[] | null;
|
65
62
|
events?: Event[] | null;
|
66
63
|
tags?: Tag[] | null;
|
@@ -77,12 +74,11 @@ interface FreeShippingPromotionCreate extends ResourceCreate {
|
|
77
74
|
_disable?: boolean | null;
|
78
75
|
_enable?: boolean | null;
|
79
76
|
market?: MarketRel | null;
|
80
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
81
77
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
82
78
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
83
79
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
84
80
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
85
|
-
|
81
|
+
sku_list?: SkuListRel | null;
|
86
82
|
tags?: TagRel[] | null;
|
87
83
|
}
|
88
84
|
interface FreeShippingPromotionUpdate extends ResourceUpdate {
|
@@ -96,12 +92,11 @@ interface FreeShippingPromotionUpdate extends ResourceUpdate {
|
|
96
92
|
_disable?: boolean | null;
|
97
93
|
_enable?: boolean | null;
|
98
94
|
market?: MarketRel | null;
|
99
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
100
95
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
101
96
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
102
97
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
103
98
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
104
|
-
|
99
|
+
sku_list?: SkuListRel | null;
|
105
100
|
tags?: TagRel[] | null;
|
106
101
|
}
|
107
102
|
declare class FreeShippingPromotions extends ApiResource<FreeShippingPromotion> {
|
@@ -114,8 +109,8 @@ declare class FreeShippingPromotions extends ApiResource<FreeShippingPromotion>
|
|
114
109
|
sku_list_promotion_rule(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
115
110
|
coupon_codes_promotion_rule(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
116
111
|
custom_promotion_rule(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
117
|
-
coupons(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
118
112
|
sku_list(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
113
|
+
coupons(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
119
114
|
attachments(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
120
115
|
events(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
121
116
|
tags(freeShippingPromotionId: string | FreeShippingPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -31,14 +31,14 @@ class FreeShippingPromotions extends resource_1.ApiResource {
|
|
31
31
|
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
32
32
|
return this.resources.fetch({ type: 'custom_promotion_rules' }, `free_shipping_promotions/${_freeShippingPromotionId}/custom_promotion_rule`, params, options);
|
33
33
|
}
|
34
|
-
async coupons(freeShippingPromotionId, params, options) {
|
35
|
-
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
36
|
-
return this.resources.fetch({ type: 'coupons' }, `free_shipping_promotions/${_freeShippingPromotionId}/coupons`, params, options);
|
37
|
-
}
|
38
34
|
async sku_list(freeShippingPromotionId, params, options) {
|
39
35
|
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
40
36
|
return this.resources.fetch({ type: 'sku_lists' }, `free_shipping_promotions/${_freeShippingPromotionId}/sku_list`, params, options);
|
41
37
|
}
|
38
|
+
async coupons(freeShippingPromotionId, params, options) {
|
39
|
+
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
40
|
+
return this.resources.fetch({ type: 'coupons' }, `free_shipping_promotions/${_freeShippingPromotionId}/coupons`, params, options);
|
41
|
+
}
|
42
42
|
async attachments(freeShippingPromotionId, params, options) {
|
43
43
|
const _freeShippingPromotionId = freeShippingPromotionId.id || freeShippingPromotionId;
|
44
44
|
return this.resources.fetch({ type: 'attachments' }, `free_shipping_promotions/${_freeShippingPromotionId}/attachments`, params, options);
|
@@ -22,6 +22,7 @@ interface PaymentMethod extends Resource {
|
|
22
22
|
currency_code?: string | null;
|
23
23
|
moto?: boolean | null;
|
24
24
|
require_capture?: boolean | null;
|
25
|
+
auto_place?: boolean | null;
|
25
26
|
auto_capture?: boolean | null;
|
26
27
|
disabled_at?: string | null;
|
27
28
|
price_amount_cents: number;
|
@@ -40,6 +41,7 @@ interface PaymentMethodCreate extends ResourceCreate {
|
|
40
41
|
currency_code?: string | null;
|
41
42
|
moto?: boolean | null;
|
42
43
|
require_capture?: boolean | null;
|
44
|
+
auto_place?: boolean | null;
|
43
45
|
auto_capture?: boolean | null;
|
44
46
|
_disable?: boolean | null;
|
45
47
|
_enable?: boolean | null;
|
@@ -53,6 +55,7 @@ interface PaymentMethodUpdate extends ResourceUpdate {
|
|
53
55
|
currency_code?: string | null;
|
54
56
|
moto?: boolean | null;
|
55
57
|
require_capture?: boolean | null;
|
58
|
+
auto_place?: boolean | null;
|
56
59
|
auto_capture?: boolean | null;
|
57
60
|
_disable?: boolean | null;
|
58
61
|
_enable?: boolean | null;
|
@@ -2,13 +2,13 @@ import { ApiResource } from '../resource';
|
|
2
2
|
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { Market, MarketType } from './markets';
|
5
|
-
import type { PromotionRule
|
5
|
+
import type { PromotionRule } 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
9
|
import type { CustomPromotionRule, CustomPromotionRuleType } from './custom_promotion_rules';
|
10
|
-
import type { Coupon, CouponType } from './coupons';
|
11
10
|
import type { SkuList, SkuListType } from './sku_lists';
|
11
|
+
import type { Coupon } from './coupons';
|
12
12
|
import type { Attachment } from './attachments';
|
13
13
|
import type { Event } from './events';
|
14
14
|
import type { Tag, TagType } from './tags';
|
@@ -21,9 +21,6 @@ type PercentageDiscountPromotionRel = ResourceRel & {
|
|
21
21
|
type MarketRel = ResourceRel & {
|
22
22
|
type: MarketType;
|
23
23
|
};
|
24
|
-
type PromotionRuleRel = ResourceRel & {
|
25
|
-
type: PromotionRuleType;
|
26
|
-
};
|
27
24
|
type OrderAmountPromotionRuleRel = ResourceRel & {
|
28
25
|
type: OrderAmountPromotionRuleType;
|
29
26
|
};
|
@@ -36,9 +33,6 @@ type CouponCodesPromotionRuleRel = ResourceRel & {
|
|
36
33
|
type CustomPromotionRuleRel = ResourceRel & {
|
37
34
|
type: CustomPromotionRuleType;
|
38
35
|
};
|
39
|
-
type CouponRel = ResourceRel & {
|
40
|
-
type: CouponType;
|
41
|
-
};
|
42
36
|
type SkuListRel = ResourceRel & {
|
43
37
|
type: SkuListType;
|
44
38
|
};
|
@@ -64,8 +58,8 @@ interface PercentageDiscountPromotion extends Resource {
|
|
64
58
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
65
59
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
66
60
|
custom_promotion_rule?: CustomPromotionRule | null;
|
67
|
-
coupons?: Coupon[] | null;
|
68
61
|
sku_list?: SkuList | null;
|
62
|
+
coupons?: Coupon[] | null;
|
69
63
|
attachments?: Attachment[] | null;
|
70
64
|
events?: Event[] | null;
|
71
65
|
tags?: Tag[] | null;
|
@@ -84,12 +78,10 @@ interface PercentageDiscountPromotionCreate extends ResourceCreate {
|
|
84
78
|
_enable?: boolean | null;
|
85
79
|
percentage: number;
|
86
80
|
market?: MarketRel | null;
|
87
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
88
81
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
89
82
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
90
83
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
91
84
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
92
|
-
coupons?: CouponRel[] | null;
|
93
85
|
sku_list?: SkuListRel | null;
|
94
86
|
tags?: TagRel[] | null;
|
95
87
|
}
|
@@ -105,12 +97,10 @@ interface PercentageDiscountPromotionUpdate extends ResourceUpdate {
|
|
105
97
|
_enable?: boolean | null;
|
106
98
|
percentage?: number | null;
|
107
99
|
market?: MarketRel | null;
|
108
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
109
100
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
110
101
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
111
102
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
112
103
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
113
|
-
coupons?: CouponRel[] | null;
|
114
104
|
sku_list?: SkuListRel | null;
|
115
105
|
tags?: TagRel[] | null;
|
116
106
|
}
|
@@ -124,8 +114,8 @@ declare class PercentageDiscountPromotions extends ApiResource<PercentageDiscoun
|
|
124
114
|
sku_list_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
125
115
|
coupon_codes_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
126
116
|
custom_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
127
|
-
coupons(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
128
117
|
sku_list(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
118
|
+
coupons(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
129
119
|
attachments(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
130
120
|
events(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
131
121
|
tags(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -31,14 +31,14 @@ class PercentageDiscountPromotions extends resource_1.ApiResource {
|
|
31
31
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
32
32
|
return this.resources.fetch({ type: 'custom_promotion_rules' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/custom_promotion_rule`, params, options);
|
33
33
|
}
|
34
|
-
async coupons(percentageDiscountPromotionId, params, options) {
|
35
|
-
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
36
|
-
return this.resources.fetch({ type: 'coupons' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupons`, params, options);
|
37
|
-
}
|
38
34
|
async sku_list(percentageDiscountPromotionId, params, options) {
|
39
35
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
40
36
|
return this.resources.fetch({ type: 'sku_lists' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options);
|
41
37
|
}
|
38
|
+
async coupons(percentageDiscountPromotionId, params, options) {
|
39
|
+
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
40
|
+
return this.resources.fetch({ type: 'coupons' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupons`, params, options);
|
41
|
+
}
|
42
42
|
async attachments(percentageDiscountPromotionId, params, options) {
|
43
43
|
const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
|
44
44
|
return this.resources.fetch({ type: 'attachments' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/attachments`, params, options);
|
@@ -7,8 +7,8 @@ import type { OrderAmountPromotionRule } from './order_amount_promotion_rules';
|
|
7
7
|
import type { SkuListPromotionRule } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule } from './coupon_codes_promotion_rules';
|
9
9
|
import type { CustomPromotionRule } from './custom_promotion_rules';
|
10
|
-
import type { Coupon } from './coupons';
|
11
10
|
import type { SkuList } from './sku_lists';
|
11
|
+
import type { Coupon } from './coupons';
|
12
12
|
import type { Attachment } from './attachments';
|
13
13
|
import type { Event } from './events';
|
14
14
|
import type { Tag } from './tags';
|
@@ -35,8 +35,8 @@ interface Promotion extends Resource {
|
|
35
35
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
36
36
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
37
37
|
custom_promotion_rule?: CustomPromotionRule | null;
|
38
|
-
coupons?: Coupon[] | null;
|
39
38
|
sku_list?: SkuList | null;
|
39
|
+
coupons?: Coupon[] | null;
|
40
40
|
attachments?: Attachment[] | null;
|
41
41
|
events?: Event[] | null;
|
42
42
|
tags?: Tag[] | null;
|
@@ -49,8 +49,8 @@ declare class Promotions extends ApiResource<Promotion> {
|
|
49
49
|
sku_list_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
50
50
|
coupon_codes_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
51
51
|
custom_promotion_rule(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
52
|
-
coupons(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
53
52
|
sku_list(promotionId: string | Promotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
53
|
+
coupons(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
54
54
|
attachments(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
55
55
|
events(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
56
56
|
tags(promotionId: string | Promotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -22,14 +22,14 @@ class Promotions extends resource_1.ApiResource {
|
|
22
22
|
const _promotionId = promotionId.id || promotionId;
|
23
23
|
return this.resources.fetch({ type: 'custom_promotion_rules' }, `promotions/${_promotionId}/custom_promotion_rule`, params, options);
|
24
24
|
}
|
25
|
-
async coupons(promotionId, params, options) {
|
26
|
-
const _promotionId = promotionId.id || promotionId;
|
27
|
-
return this.resources.fetch({ type: 'coupons' }, `promotions/${_promotionId}/coupons`, params, options);
|
28
|
-
}
|
29
25
|
async sku_list(promotionId, params, options) {
|
30
26
|
const _promotionId = promotionId.id || promotionId;
|
31
27
|
return this.resources.fetch({ type: 'sku_lists' }, `promotions/${_promotionId}/sku_list`, params, options);
|
32
28
|
}
|
29
|
+
async coupons(promotionId, params, options) {
|
30
|
+
const _promotionId = promotionId.id || promotionId;
|
31
|
+
return this.resources.fetch({ type: 'coupons' }, `promotions/${_promotionId}/coupons`, params, options);
|
32
|
+
}
|
33
33
|
async attachments(promotionId, params, options) {
|
34
34
|
const _promotionId = promotionId.id || promotionId;
|
35
35
|
return this.resources.fetch({ type: 'attachments' }, `promotions/${_promotionId}/attachments`, params, options);
|
@@ -25,7 +25,7 @@ type LineItemRel = ResourceRel & {
|
|
25
25
|
};
|
26
26
|
interface StockTransfer extends Resource {
|
27
27
|
readonly type: StockTransferType;
|
28
|
-
number?:
|
28
|
+
number?: string | null;
|
29
29
|
sku_code?: string | null;
|
30
30
|
status: 'draft' | 'upcoming' | 'on_hold' | 'picking' | 'in_transit' | 'completed' | 'cancelled';
|
31
31
|
quantity: number;
|
@@ -13,7 +13,8 @@ type OrderRel = ResourceRel & {
|
|
13
13
|
};
|
14
14
|
interface StripePayment extends Resource {
|
15
15
|
readonly type: StripePaymentType;
|
16
|
-
|
16
|
+
stripe_id?: string | null;
|
17
|
+
client_secret?: string | null;
|
17
18
|
publishable_key?: string | null;
|
18
19
|
options?: Record<string, any> | null;
|
19
20
|
payment_method?: Record<string, any> | null;
|
@@ -29,6 +30,8 @@ interface StripePayment extends Resource {
|
|
29
30
|
versions?: Version[] | null;
|
30
31
|
}
|
31
32
|
interface StripePaymentCreate extends ResourceCreate {
|
33
|
+
stripe_id?: string | null;
|
34
|
+
client_secret?: string | null;
|
32
35
|
options?: Record<string, any> | null;
|
33
36
|
return_url?: string | null;
|
34
37
|
receipt_email?: string | null;
|
@@ -2,14 +2,14 @@ import * as api from './api';
|
|
2
2
|
import type { ApiError } from './error';
|
3
3
|
import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
|
4
4
|
import { type ResourcesInitConfig } from './resource';
|
5
|
-
declare const OPEN_API_SCHEMA_VERSION = "4.
|
5
|
+
declare const OPEN_API_SCHEMA_VERSION = "4.26.0";
|
6
6
|
export { OPEN_API_SCHEMA_VERSION };
|
7
7
|
type SdkConfig = {};
|
8
8
|
type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
|
9
9
|
type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
|
10
10
|
declare class CommerceLayerClient {
|
11
11
|
#private;
|
12
|
-
readonly openApiSchemaVersion = "4.
|
12
|
+
readonly openApiSchemaVersion = "4.26.0";
|
13
13
|
addresses: api.Addresses;
|
14
14
|
adjustments: api.Adjustments;
|
15
15
|
adyen_gateways: api.AdyenGateways;
|
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.26.0';
|
20
20
|
export { OPEN_API_SCHEMA_VERSION };
|
21
21
|
class CommerceLayerClient {
|
22
22
|
// ##__CL_RESOURCES_DEF_STOP__##
|
package/lib/esm/query.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import Debug from './debug';
|
2
|
-
|
2
|
+
import { ErrorType, SdkError } from "./error";
|
3
3
|
const debug = Debug('query');
|
4
|
+
const arrayFilters = ['_any', '_all', '_in'];
|
5
|
+
const objectFilters = ['_jcont'];
|
4
6
|
const isParamsList = (params) => {
|
5
7
|
return params && (params.filters || params.pageNumber || params.pageSize || params.sort);
|
6
8
|
};
|
@@ -36,14 +38,16 @@ const generateQueryStringParams = (params, res) => {
|
|
36
38
|
// Filters
|
37
39
|
if (params.filters) {
|
38
40
|
Object.entries(params.filters).forEach(([p, v]) => {
|
39
|
-
|
41
|
+
const filter = p.substring(p.lastIndexOf('_'));
|
40
42
|
let val;
|
41
43
|
if (Array.isArray(v)) {
|
42
|
-
|
44
|
+
if (!arrayFilters.includes(filter))
|
45
|
+
throw new SdkError({ message: `Wrong ${filter} filter: Array value is supported only for the following filters: ${arrayFilters.join(', ')}`, type: ErrorType.REQUEST });
|
43
46
|
val = v.join(',');
|
44
47
|
}
|
45
48
|
else if (typeof v === 'object') {
|
46
|
-
|
49
|
+
if (!objectFilters.includes(filter))
|
50
|
+
throw new SdkError({ message: `Wrong ${filter} filter: Object value is supported only for the following filters: ${objectFilters.join(', ')}`, type: ErrorType.REQUEST });
|
47
51
|
val = JSON.stringify(v);
|
48
52
|
}
|
49
53
|
else
|
package/lib/esm/resource.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type ApiClientInitConfig } from './client';
|
1
|
+
import ApiClient, { type ApiClientInitConfig } from './client';
|
2
2
|
import type { QueryParamsRetrieve, QueryParamsList, QueryFilter, QueryParams } from './query';
|
3
3
|
import type { ResourceTypeLock } from './api';
|
4
4
|
import type { InterceptorManager } from './interceptor';
|
@@ -56,6 +56,7 @@ declare class ResourceAdapter {
|
|
56
56
|
get interceptors(): InterceptorManager;
|
57
57
|
private localConfig;
|
58
58
|
config(config: ResourcesConfig): ResourceAdapter;
|
59
|
+
get client(): Readonly<ApiClient>;
|
59
60
|
singleton<R extends Resource>(resource: ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
60
61
|
retrieve<R extends Resource>(resource: ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
61
62
|
list<R extends Resource>(resource: ResourceType, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
|
@@ -70,7 +71,9 @@ declare abstract class ApiResourceBase<R extends Resource> {
|
|
70
71
|
constructor(adapter: ResourceAdapter);
|
71
72
|
abstract relationship(id: string | ResourceId | null): ResourceRel;
|
72
73
|
abstract type(): ResourceTypeLock;
|
73
|
-
parse(resource: string
|
74
|
+
parse(resource: string, options?: {
|
75
|
+
ignoreSlug?: boolean;
|
76
|
+
}): R | R[];
|
74
77
|
update(resource: ResourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
75
78
|
}
|
76
79
|
declare abstract class ApiResource<R extends Resource> extends ApiResourceBase<R> {
|
package/lib/esm/resource.js
CHANGED
@@ -51,11 +51,9 @@ class ResourceAdapter {
|
|
51
51
|
__classPrivateFieldGet(this, _ResourceAdapter_client, "f").config(config);
|
52
52
|
return this;
|
53
53
|
}
|
54
|
-
|
55
|
-
|
56
|
-
return this.#client
|
54
|
+
get client() {
|
55
|
+
return __classPrivateFieldGet(this, _ResourceAdapter_client, "f");
|
57
56
|
}
|
58
|
-
*/
|
59
57
|
async singleton(resource, params, options) {
|
60
58
|
debug('singleton: %o, %O, %O', resource, params || {}, options || {});
|
61
59
|
const queryParams = generateQueryStringParams(params, resource);
|
@@ -142,12 +140,21 @@ class ApiResourceBase {
|
|
142
140
|
debug('new resource instance: %s', this.type());
|
143
141
|
this.resources = adapter;
|
144
142
|
}
|
145
|
-
parse(resource) {
|
146
|
-
var _a
|
143
|
+
parse(resource, options) {
|
144
|
+
var _a;
|
147
145
|
try {
|
148
146
|
const res = JSON.parse(resource);
|
149
|
-
|
150
|
-
|
147
|
+
// Resource type always checked
|
148
|
+
const rtype = (_a = res.data) === null || _a === void 0 ? void 0 : _a.type;
|
149
|
+
if (rtype !== this.type())
|
150
|
+
throw new SdkError({ message: `Invalid resource type [${rtype}]`, type: ErrorType.PARSE });
|
151
|
+
// Parse options
|
152
|
+
const { ignoreSlug } = options || {};
|
153
|
+
if (!ignoreSlug) {
|
154
|
+
const links = res.data.links.self;
|
155
|
+
if (!links || !String(links).match(`^${this.resources.client.baseUrl}/${this.type()}/*`))
|
156
|
+
throw new SdkError({ message: `Resource contains invalid links [${links}]`, type: ErrorType.PARSE });
|
157
|
+
}
|
151
158
|
return denormalize(res);
|
152
159
|
}
|
153
160
|
catch (error) {
|
@@ -2,13 +2,13 @@ import { ApiResource } from '../resource';
|
|
2
2
|
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { Market, MarketType } from './markets';
|
5
|
-
import type { PromotionRule
|
5
|
+
import type { PromotionRule } 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
9
|
import type { CustomPromotionRule, CustomPromotionRuleType } from './custom_promotion_rules';
|
10
|
-
import type { Coupon, CouponType } from './coupons';
|
11
10
|
import type { SkuList, SkuListType } from './sku_lists';
|
11
|
+
import type { Coupon } from './coupons';
|
12
12
|
import type { Attachment } from './attachments';
|
13
13
|
import type { Event } from './events';
|
14
14
|
import type { Tag, TagType } from './tags';
|
@@ -21,9 +21,6 @@ type BuyXPayYPromotionRel = ResourceRel & {
|
|
21
21
|
type MarketRel = ResourceRel & {
|
22
22
|
type: MarketType;
|
23
23
|
};
|
24
|
-
type PromotionRuleRel = ResourceRel & {
|
25
|
-
type: PromotionRuleType;
|
26
|
-
};
|
27
24
|
type OrderAmountPromotionRuleRel = ResourceRel & {
|
28
25
|
type: OrderAmountPromotionRuleType;
|
29
26
|
};
|
@@ -36,9 +33,6 @@ type CouponCodesPromotionRuleRel = ResourceRel & {
|
|
36
33
|
type CustomPromotionRuleRel = ResourceRel & {
|
37
34
|
type: CustomPromotionRuleType;
|
38
35
|
};
|
39
|
-
type CouponRel = ResourceRel & {
|
40
|
-
type: CouponType;
|
41
|
-
};
|
42
36
|
type SkuListRel = ResourceRel & {
|
43
37
|
type: SkuListType;
|
44
38
|
};
|
@@ -66,8 +60,8 @@ interface BuyXPayYPromotion extends Resource {
|
|
66
60
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
67
61
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
68
62
|
custom_promotion_rule?: CustomPromotionRule | null;
|
69
|
-
coupons?: Coupon[] | null;
|
70
63
|
sku_list?: SkuList | null;
|
64
|
+
coupons?: Coupon[] | null;
|
71
65
|
attachments?: Attachment[] | null;
|
72
66
|
events?: Event[] | null;
|
73
67
|
tags?: Tag[] | null;
|
@@ -88,12 +82,10 @@ interface BuyXPayYPromotionCreate extends ResourceCreate {
|
|
88
82
|
y: number;
|
89
83
|
cheapest_free?: boolean | null;
|
90
84
|
market?: MarketRel | null;
|
91
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
92
85
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
93
86
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
94
87
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
95
88
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
96
|
-
coupons?: CouponRel[] | null;
|
97
89
|
sku_list: SkuListRel;
|
98
90
|
tags?: TagRel[] | null;
|
99
91
|
}
|
@@ -111,12 +103,10 @@ interface BuyXPayYPromotionUpdate extends ResourceUpdate {
|
|
111
103
|
y?: number | null;
|
112
104
|
cheapest_free?: boolean | null;
|
113
105
|
market?: MarketRel | null;
|
114
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
115
106
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
116
107
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
117
108
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
118
109
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
119
|
-
coupons?: CouponRel[] | null;
|
120
110
|
sku_list?: SkuListRel | null;
|
121
111
|
tags?: TagRel[] | null;
|
122
112
|
}
|
@@ -130,8 +120,8 @@ declare class BuyXPayYPromotions extends ApiResource<BuyXPayYPromotion> {
|
|
130
120
|
sku_list_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
131
121
|
coupon_codes_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
132
122
|
custom_promotion_rule(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
133
|
-
coupons(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
134
123
|
sku_list(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
124
|
+
coupons(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
135
125
|
attachments(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
136
126
|
events(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
137
127
|
tags(buyXPayYPromotionId: string | BuyXPayYPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -29,14 +29,14 @@ class BuyXPayYPromotions extends ApiResource {
|
|
29
29
|
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
30
30
|
return this.resources.fetch({ type: 'custom_promotion_rules' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/custom_promotion_rule`, params, options);
|
31
31
|
}
|
32
|
-
async coupons(buyXPayYPromotionId, params, options) {
|
33
|
-
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
34
|
-
return this.resources.fetch({ type: 'coupons' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/coupons`, params, options);
|
35
|
-
}
|
36
32
|
async sku_list(buyXPayYPromotionId, params, options) {
|
37
33
|
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
38
34
|
return this.resources.fetch({ type: 'sku_lists' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/sku_list`, params, options);
|
39
35
|
}
|
36
|
+
async coupons(buyXPayYPromotionId, params, options) {
|
37
|
+
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
38
|
+
return this.resources.fetch({ type: 'coupons' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/coupons`, params, options);
|
39
|
+
}
|
40
40
|
async attachments(buyXPayYPromotionId, params, options) {
|
41
41
|
const _buyXPayYPromotionId = buyXPayYPromotionId.id || buyXPayYPromotionId;
|
42
42
|
return this.resources.fetch({ type: 'attachments' }, `buy_x_pay_y_promotions/${_buyXPayYPromotionId}/attachments`, params, options);
|
@@ -2,13 +2,13 @@ import { ApiResource } from '../resource';
|
|
2
2
|
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { Market, MarketType } from './markets';
|
5
|
-
import type { PromotionRule
|
5
|
+
import type { PromotionRule } 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
9
|
import type { CustomPromotionRule, CustomPromotionRuleType } from './custom_promotion_rules';
|
10
|
-
import type { Coupon, CouponType } from './coupons';
|
11
10
|
import type { SkuList, SkuListType } from './sku_lists';
|
11
|
+
import type { Coupon } from './coupons';
|
12
12
|
import type { Attachment } from './attachments';
|
13
13
|
import type { Event } from './events';
|
14
14
|
import type { Tag, TagType } from './tags';
|
@@ -21,9 +21,6 @@ type ExternalPromotionRel = ResourceRel & {
|
|
21
21
|
type MarketRel = ResourceRel & {
|
22
22
|
type: MarketType;
|
23
23
|
};
|
24
|
-
type PromotionRuleRel = ResourceRel & {
|
25
|
-
type: PromotionRuleType;
|
26
|
-
};
|
27
24
|
type OrderAmountPromotionRuleRel = ResourceRel & {
|
28
25
|
type: OrderAmountPromotionRuleType;
|
29
26
|
};
|
@@ -36,9 +33,6 @@ type CouponCodesPromotionRuleRel = ResourceRel & {
|
|
36
33
|
type CustomPromotionRuleRel = ResourceRel & {
|
37
34
|
type: CustomPromotionRuleType;
|
38
35
|
};
|
39
|
-
type CouponRel = ResourceRel & {
|
40
|
-
type: CouponType;
|
41
|
-
};
|
42
36
|
type SkuListRel = ResourceRel & {
|
43
37
|
type: SkuListType;
|
44
38
|
};
|
@@ -65,8 +59,8 @@ interface ExternalPromotion extends Resource {
|
|
65
59
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
66
60
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
67
61
|
custom_promotion_rule?: CustomPromotionRule | null;
|
68
|
-
coupons?: Coupon[] | null;
|
69
62
|
sku_list?: SkuList | null;
|
63
|
+
coupons?: Coupon[] | null;
|
70
64
|
attachments?: Attachment[] | null;
|
71
65
|
events?: Event[] | null;
|
72
66
|
tags?: Tag[] | null;
|
@@ -85,12 +79,10 @@ interface ExternalPromotionCreate extends ResourceCreate {
|
|
85
79
|
_enable?: boolean | null;
|
86
80
|
promotion_url: string;
|
87
81
|
market?: MarketRel | null;
|
88
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
89
82
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
90
83
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
91
84
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
92
85
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
93
|
-
coupons?: CouponRel[] | null;
|
94
86
|
sku_list?: SkuListRel | null;
|
95
87
|
tags?: TagRel[] | null;
|
96
88
|
}
|
@@ -106,12 +98,10 @@ interface ExternalPromotionUpdate extends ResourceUpdate {
|
|
106
98
|
_enable?: boolean | null;
|
107
99
|
promotion_url?: string | null;
|
108
100
|
market?: MarketRel | null;
|
109
|
-
promotion_rules?: PromotionRuleRel[] | null;
|
110
101
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
111
102
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
112
103
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
113
104
|
custom_promotion_rule?: CustomPromotionRuleRel | null;
|
114
|
-
coupons?: CouponRel[] | null;
|
115
105
|
sku_list?: SkuListRel | null;
|
116
106
|
tags?: TagRel[] | null;
|
117
107
|
}
|
@@ -125,8 +115,8 @@ declare class ExternalPromotions extends ApiResource<ExternalPromotion> {
|
|
125
115
|
sku_list_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
126
116
|
coupon_codes_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
127
117
|
custom_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomPromotionRule>;
|
128
|
-
coupons(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
129
118
|
sku_list(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
119
|
+
coupons(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Coupon>>;
|
130
120
|
attachments(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
131
121
|
events(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
132
122
|
tags(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -29,14 +29,14 @@ class ExternalPromotions extends ApiResource {
|
|
29
29
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
30
30
|
return this.resources.fetch({ type: 'custom_promotion_rules' }, `external_promotions/${_externalPromotionId}/custom_promotion_rule`, params, options);
|
31
31
|
}
|
32
|
-
async coupons(externalPromotionId, params, options) {
|
33
|
-
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
34
|
-
return this.resources.fetch({ type: 'coupons' }, `external_promotions/${_externalPromotionId}/coupons`, params, options);
|
35
|
-
}
|
36
32
|
async sku_list(externalPromotionId, params, options) {
|
37
33
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
38
34
|
return this.resources.fetch({ type: 'sku_lists' }, `external_promotions/${_externalPromotionId}/sku_list`, params, options);
|
39
35
|
}
|
36
|
+
async coupons(externalPromotionId, params, options) {
|
37
|
+
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
38
|
+
return this.resources.fetch({ type: 'coupons' }, `external_promotions/${_externalPromotionId}/coupons`, params, options);
|
39
|
+
}
|
40
40
|
async attachments(externalPromotionId, params, options) {
|
41
41
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
42
42
|
return this.resources.fetch({ type: 'attachments' }, `external_promotions/${_externalPromotionId}/attachments`, params, options);
|