@congminh1254/shopee-sdk 0.10.0 → 1.0.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/README.md +172 -36
- package/lib/fetch.js +13 -0
- package/lib/fetch.js.map +1 -1
- package/lib/managers/add-on-deal.manager.d.ts +140 -0
- package/lib/managers/add-on-deal.manager.js +240 -0
- package/lib/managers/add-on-deal.manager.js.map +1 -0
- package/lib/managers/ads.manager.d.ts +217 -1
- package/lib/managers/ads.manager.js +312 -0
- package/lib/managers/ads.manager.js.map +1 -1
- package/lib/managers/bundle-deal.manager.d.ts +106 -0
- package/lib/managers/bundle-deal.manager.js +178 -0
- package/lib/managers/bundle-deal.manager.js.map +1 -0
- package/lib/managers/discount.manager.d.ts +102 -0
- package/lib/managers/discount.manager.js +167 -0
- package/lib/managers/discount.manager.js.map +1 -0
- package/lib/managers/fbs.manager.d.ts +115 -0
- package/lib/managers/fbs.manager.js +145 -0
- package/lib/managers/fbs.manager.js.map +1 -0
- package/lib/managers/first-mile.manager.d.ts +150 -0
- package/lib/managers/first-mile.manager.js +264 -0
- package/lib/managers/first-mile.manager.js.map +1 -0
- package/lib/managers/follow-prize.manager.d.ts +108 -0
- package/lib/managers/follow-prize.manager.js +152 -0
- package/lib/managers/follow-prize.manager.js.map +1 -0
- package/lib/managers/global-product.manager.d.ts +664 -0
- package/lib/managers/global-product.manager.js +904 -0
- package/lib/managers/global-product.manager.js.map +1 -0
- package/lib/managers/index.d.ts +17 -1
- package/lib/managers/index.js +17 -1
- package/lib/managers/index.js.map +1 -1
- package/lib/managers/livestream.manager.d.ts +377 -0
- package/lib/managers/livestream.manager.js +529 -0
- package/lib/managers/livestream.manager.js.map +1 -0
- package/lib/managers/logistics.manager.d.ts +267 -1
- package/lib/managers/logistics.manager.js +544 -0
- package/lib/managers/logistics.manager.js.map +1 -1
- package/lib/managers/media-space.manager.d.ts +179 -0
- package/lib/managers/media-space.manager.js +220 -0
- package/lib/managers/media-space.manager.js.map +1 -0
- package/lib/managers/media.manager.d.ts +226 -0
- package/lib/managers/media.manager.js +274 -0
- package/lib/managers/media.manager.js.map +1 -0
- package/lib/managers/merchant.manager.d.ts +100 -0
- package/lib/managers/merchant.manager.js +144 -0
- package/lib/managers/merchant.manager.js.map +1 -0
- package/lib/managers/order.manager.d.ts +213 -1
- package/lib/managers/order.manager.js +305 -0
- package/lib/managers/order.manager.js.map +1 -1
- package/lib/managers/payment.manager.d.ts +186 -1
- package/lib/managers/payment.manager.js +288 -0
- package/lib/managers/payment.manager.js.map +1 -1
- package/lib/managers/returns.manager.d.ts +200 -0
- package/lib/managers/returns.manager.js +300 -0
- package/lib/managers/returns.manager.js.map +1 -0
- package/lib/managers/sbs.manager.d.ts +112 -0
- package/lib/managers/sbs.manager.js +149 -0
- package/lib/managers/sbs.manager.js.map +1 -0
- package/lib/managers/shop-category.manager.d.ts +207 -0
- package/lib/managers/shop-category.manager.js +258 -0
- package/lib/managers/shop-category.manager.js.map +1 -0
- package/lib/managers/shop-flash-sale.manager.d.ts +242 -0
- package/lib/managers/shop-flash-sale.manager.js +321 -0
- package/lib/managers/shop-flash-sale.manager.js.map +1 -0
- package/lib/managers/shop.manager.d.ts +173 -0
- package/lib/managers/shop.manager.js +217 -0
- package/lib/managers/shop.manager.js.map +1 -0
- package/lib/managers/top-picks.manager.d.ts +62 -0
- package/lib/managers/top-picks.manager.js +91 -0
- package/lib/managers/top-picks.manager.js.map +1 -0
- package/lib/schemas/add-on-deal.d.ts +390 -0
- package/lib/schemas/add-on-deal.js +45 -0
- package/lib/schemas/add-on-deal.js.map +1 -0
- package/lib/schemas/ads.d.ts +437 -0
- package/lib/schemas/bundle-deal.d.ts +300 -0
- package/lib/schemas/bundle-deal.js +27 -0
- package/lib/schemas/bundle-deal.js.map +1 -0
- package/lib/schemas/discount.d.ts +334 -0
- package/lib/schemas/discount.js +15 -0
- package/lib/schemas/discount.js.map +1 -0
- package/lib/schemas/fbs.d.ts +117 -0
- package/lib/schemas/fbs.js +2 -0
- package/lib/schemas/fbs.js.map +1 -0
- package/lib/schemas/first-mile.d.ts +551 -0
- package/lib/schemas/first-mile.js +2 -0
- package/lib/schemas/first-mile.js.map +1 -0
- package/lib/schemas/follow-prize.d.ts +198 -0
- package/lib/schemas/follow-prize.js +27 -0
- package/lib/schemas/follow-prize.js.map +1 -0
- package/lib/schemas/global-product.d.ts +1127 -0
- package/lib/schemas/global-product.js +2 -0
- package/lib/schemas/global-product.js.map +1 -0
- package/lib/schemas/index.d.ts +13 -0
- package/lib/schemas/index.js +17 -0
- package/lib/schemas/index.js.map +1 -1
- package/lib/schemas/livestream.d.ts +649 -0
- package/lib/schemas/livestream.js +2 -0
- package/lib/schemas/livestream.js.map +1 -0
- package/lib/schemas/logistics.d.ts +979 -0
- package/lib/schemas/logistics.js +13 -0
- package/lib/schemas/logistics.js.map +1 -1
- package/lib/schemas/media-space.d.ts +189 -0
- package/lib/schemas/media-space.js +2 -0
- package/lib/schemas/media-space.js.map +1 -0
- package/lib/schemas/media.d.ts +230 -0
- package/lib/schemas/media.js +2 -0
- package/lib/schemas/media.js.map +1 -0
- package/lib/schemas/merchant.d.ts +236 -0
- package/lib/schemas/merchant.js +2 -0
- package/lib/schemas/merchant.js.map +1 -0
- package/lib/schemas/order.d.ts +431 -0
- package/lib/schemas/payment.d.ts +397 -0
- package/lib/schemas/returns.d.ts +632 -0
- package/lib/schemas/returns.js +63 -0
- package/lib/schemas/returns.js.map +1 -0
- package/lib/schemas/sbs.d.ts +484 -0
- package/lib/schemas/sbs.js +2 -0
- package/lib/schemas/sbs.js.map +1 -0
- package/lib/schemas/shop-category.d.ts +176 -0
- package/lib/schemas/shop-category.js +2 -0
- package/lib/schemas/shop-category.js.map +1 -0
- package/lib/schemas/shop-flash-sale.d.ts +473 -0
- package/lib/schemas/shop-flash-sale.js +43 -0
- package/lib/schemas/shop-flash-sale.js.map +1 -0
- package/lib/schemas/shop.d.ts +250 -0
- package/lib/schemas/shop.js +2 -0
- package/lib/schemas/shop.js.map +1 -0
- package/lib/schemas/top-picks.d.ts +99 -0
- package/lib/schemas/top-picks.js +2 -0
- package/lib/schemas/top-picks.js.map +1 -0
- package/lib/sdk.d.ts +34 -0
- package/lib/sdk.js +34 -0
- package/lib/sdk.js.map +1 -1
- package/package.json +2 -4
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { ShopeeConfig } from "../sdk.js";
|
|
2
|
+
import { BaseManager } from "./base.manager.js";
|
|
3
|
+
import { GetTimeSlotIdParams, GetTimeSlotIdResponse, CreateShopFlashSaleParams, CreateShopFlashSaleResponse, GetShopFlashSaleParams, GetShopFlashSaleResponse, GetShopFlashSaleListParams, GetShopFlashSaleListResponse, UpdateShopFlashSaleParams, UpdateShopFlashSaleResponse, DeleteShopFlashSaleParams, DeleteShopFlashSaleResponse, AddShopFlashSaleItemsParams, AddShopFlashSaleItemsResponse, GetShopFlashSaleItemsParams, GetShopFlashSaleItemsResponse, UpdateShopFlashSaleItemsParams, UpdateShopFlashSaleItemsResponse, DeleteShopFlashSaleItemsParams, DeleteShopFlashSaleItemsResponse, GetItemCriteriaParams, GetItemCriteriaResponse } from "../schemas/shop-flash-sale.js";
|
|
4
|
+
export declare class ShopFlashSaleManager extends BaseManager {
|
|
5
|
+
constructor(config: ShopeeConfig);
|
|
6
|
+
/**
|
|
7
|
+
* Get available time slot IDs
|
|
8
|
+
*
|
|
9
|
+
* Use this API to get available time slots for creating shop flash sales.
|
|
10
|
+
* You can only use time slots that start in the future.
|
|
11
|
+
*
|
|
12
|
+
* @param params - Parameters containing start_time and end_time
|
|
13
|
+
* @returns A promise that resolves to the list of available time slots
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const now = Math.floor(Date.now() / 1000);
|
|
18
|
+
* const slots = await sdk.shopFlashSale.getTimeSlotId({
|
|
19
|
+
* start_time: now,
|
|
20
|
+
* end_time: now + 7 * 86400 // Next 7 days
|
|
21
|
+
* });
|
|
22
|
+
* console.log('Available slots:', slots.response);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
getTimeSlotId(params: GetTimeSlotIdParams): Promise<GetTimeSlotIdResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Create a new shop flash sale
|
|
28
|
+
*
|
|
29
|
+
* Use this API to create a new shop flash sale activity for a specific time slot.
|
|
30
|
+
* The time slot must be obtained from getTimeSlotId() and must start in the future.
|
|
31
|
+
*
|
|
32
|
+
* @param params - Parameters containing timeslot_id
|
|
33
|
+
* @returns A promise that resolves to the created flash sale information
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const flashSale = await sdk.shopFlashSale.createShopFlashSale({
|
|
38
|
+
* timeslot_id: 237859372232704
|
|
39
|
+
* });
|
|
40
|
+
* console.log('Flash sale created:', flashSale.response.flash_sale_id);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
createShopFlashSale(params: CreateShopFlashSaleParams): Promise<CreateShopFlashSaleResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Get shop flash sale details
|
|
46
|
+
*
|
|
47
|
+
* Use this API to get detailed information about a specific shop flash sale.
|
|
48
|
+
*
|
|
49
|
+
* @param params - Parameters containing flash_sale_id
|
|
50
|
+
* @returns A promise that resolves to the flash sale details
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const details = await sdk.shopFlashSale.getShopFlashSale({
|
|
55
|
+
* flash_sale_id: 802063533822541
|
|
56
|
+
* });
|
|
57
|
+
* console.log('Flash sale status:', details.response.status);
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
getShopFlashSale(params: GetShopFlashSaleParams): Promise<GetShopFlashSaleResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Get shop flash sale list
|
|
63
|
+
*
|
|
64
|
+
* Use this API to get a list of shop flash sales with pagination support.
|
|
65
|
+
* You can filter by type (upcoming, ongoing, expired) and time range.
|
|
66
|
+
*
|
|
67
|
+
* @param params - Parameters for filtering and pagination
|
|
68
|
+
* @returns A promise that resolves to the list of flash sales
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const list = await sdk.shopFlashSale.getShopFlashSaleList({
|
|
73
|
+
* type: 1, // upcoming
|
|
74
|
+
* offset: 0,
|
|
75
|
+
* limit: 20
|
|
76
|
+
* });
|
|
77
|
+
* console.log('Total flash sales:', list.response.total_count);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
getShopFlashSaleList(params: GetShopFlashSaleListParams): Promise<GetShopFlashSaleListResponse>;
|
|
81
|
+
/**
|
|
82
|
+
* Update shop flash sale status
|
|
83
|
+
*
|
|
84
|
+
* Use this API to enable or disable a shop flash sale.
|
|
85
|
+
* Disabling a flash sale will disable all items in the session.
|
|
86
|
+
* Cannot edit flash sales with 'system_rejected' status.
|
|
87
|
+
*
|
|
88
|
+
* @param params - Parameters containing flash_sale_id and status
|
|
89
|
+
* @returns A promise that resolves to the updated flash sale information
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const result = await sdk.shopFlashSale.updateShopFlashSale({
|
|
94
|
+
* flash_sale_id: 802063533822541,
|
|
95
|
+
* status: 1 // enable
|
|
96
|
+
* });
|
|
97
|
+
* console.log('Flash sale updated:', result.response.status);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
updateShopFlashSale(params: UpdateShopFlashSaleParams): Promise<UpdateShopFlashSaleResponse>;
|
|
101
|
+
/**
|
|
102
|
+
* Delete shop flash sale
|
|
103
|
+
*
|
|
104
|
+
* Use this API to delete a shop flash sale.
|
|
105
|
+
* Cannot delete ongoing and expired flash sales.
|
|
106
|
+
*
|
|
107
|
+
* @param params - Parameters containing flash_sale_id
|
|
108
|
+
* @returns A promise that resolves to the deleted flash sale information
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const result = await sdk.shopFlashSale.deleteShopFlashSale({
|
|
113
|
+
* flash_sale_id: 802063533822541
|
|
114
|
+
* });
|
|
115
|
+
* console.log('Flash sale deleted, status:', result.response.status);
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
deleteShopFlashSale(params: DeleteShopFlashSaleParams): Promise<DeleteShopFlashSaleResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* Add items to shop flash sale
|
|
121
|
+
*
|
|
122
|
+
* Use this API to add items to a shop flash sale.
|
|
123
|
+
* Maximum 50 enabled items per flash sale.
|
|
124
|
+
* For items with variations, specify model_id and prices for each variation.
|
|
125
|
+
*
|
|
126
|
+
* @param params - Parameters containing flash_sale_id and items
|
|
127
|
+
* @returns A promise that resolves to the result with any failed items
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const result = await sdk.shopFlashSale.addShopFlashSaleItems({
|
|
132
|
+
* flash_sale_id: 802063533822541,
|
|
133
|
+
* items: [
|
|
134
|
+
* {
|
|
135
|
+
* item_id: 3744623870,
|
|
136
|
+
* purchase_limit: 5,
|
|
137
|
+
* models: [
|
|
138
|
+
* {
|
|
139
|
+
* model_id: 5414485721,
|
|
140
|
+
* input_promo_price: 69.3,
|
|
141
|
+
* stock: 100
|
|
142
|
+
* }
|
|
143
|
+
* ]
|
|
144
|
+
* }
|
|
145
|
+
* ]
|
|
146
|
+
* });
|
|
147
|
+
* console.log('Failed items:', result.response.failed_items);
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
addShopFlashSaleItems(params: AddShopFlashSaleItemsParams): Promise<AddShopFlashSaleItemsResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Get shop flash sale items
|
|
153
|
+
*
|
|
154
|
+
* Use this API to get items and their details in a shop flash sale.
|
|
155
|
+
* Returns both item information and model details for items with variations.
|
|
156
|
+
*
|
|
157
|
+
* @param params - Parameters containing flash_sale_id, offset, and limit
|
|
158
|
+
* @returns A promise that resolves to the items and their details
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const items = await sdk.shopFlashSale.getShopFlashSaleItems({
|
|
163
|
+
* flash_sale_id: 802063533822541,
|
|
164
|
+
* offset: 0,
|
|
165
|
+
* limit: 50
|
|
166
|
+
* });
|
|
167
|
+
* console.log('Total items:', items.response.total_count);
|
|
168
|
+
* console.log('Items:', items.response.item_info);
|
|
169
|
+
* console.log('Models:', items.response.models);
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
getShopFlashSaleItems(params: GetShopFlashSaleItemsParams): Promise<GetShopFlashSaleItemsResponse>;
|
|
173
|
+
/**
|
|
174
|
+
* Update shop flash sale items
|
|
175
|
+
*
|
|
176
|
+
* Use this API to update items in a shop flash sale.
|
|
177
|
+
* Can only edit items/models in disabled or enabled status.
|
|
178
|
+
* Cannot modify price or stock of enabled items, must disable first.
|
|
179
|
+
*
|
|
180
|
+
* @param params - Parameters containing flash_sale_id and items
|
|
181
|
+
* @returns A promise that resolves to the result with any failed items
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const result = await sdk.shopFlashSale.updateShopFlashSaleItems({
|
|
186
|
+
* flash_sale_id: 802063533822541,
|
|
187
|
+
* items: [
|
|
188
|
+
* {
|
|
189
|
+
* item_id: 3744623870,
|
|
190
|
+
* purchase_limit: 10,
|
|
191
|
+
* models: [
|
|
192
|
+
* {
|
|
193
|
+
* model_id: 5414485721,
|
|
194
|
+
* status: 1, // enable
|
|
195
|
+
* input_promo_price: 65.0,
|
|
196
|
+
* stock: 150
|
|
197
|
+
* }
|
|
198
|
+
* ]
|
|
199
|
+
* }
|
|
200
|
+
* ]
|
|
201
|
+
* });
|
|
202
|
+
* console.log('Failed items:', result.response.failed_items);
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
updateShopFlashSaleItems(params: UpdateShopFlashSaleItemsParams): Promise<UpdateShopFlashSaleItemsResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Delete items from shop flash sale
|
|
208
|
+
*
|
|
209
|
+
* Use this API to delete items from a shop flash sale.
|
|
210
|
+
* Deleting an item will delete all its models/variations.
|
|
211
|
+
*
|
|
212
|
+
* @param params - Parameters containing flash_sale_id and item_ids
|
|
213
|
+
* @returns A promise that resolves to the result with any failed items
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const result = await sdk.shopFlashSale.deleteShopFlashSaleItems({
|
|
218
|
+
* flash_sale_id: 802063533822541,
|
|
219
|
+
* item_ids: [3744623870, 3744624265]
|
|
220
|
+
* });
|
|
221
|
+
* console.log('Items deleted');
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
deleteShopFlashSaleItems(params: DeleteShopFlashSaleItemsParams): Promise<DeleteShopFlashSaleItemsResponse>;
|
|
225
|
+
/**
|
|
226
|
+
* Get item criteria for shop flash sale
|
|
227
|
+
*
|
|
228
|
+
* Use this API to get the criteria that items must meet to be eligible
|
|
229
|
+
* for shop flash sales. Criteria vary by product category and region.
|
|
230
|
+
*
|
|
231
|
+
* @param params - No parameters required
|
|
232
|
+
* @returns A promise that resolves to the criteria details
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* const criteria = await sdk.shopFlashSale.getItemCriteria({});
|
|
237
|
+
* console.log('Criteria:', criteria.response.criteria);
|
|
238
|
+
* console.log('Category mappings:', criteria.response.pair_ids);
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
getItemCriteria(params?: GetItemCriteriaParams): Promise<GetItemCriteriaResponse>;
|
|
242
|
+
}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { BaseManager } from "./base.manager.js";
|
|
2
|
+
import { ShopeeFetch } from "../fetch.js";
|
|
3
|
+
export class ShopFlashSaleManager extends BaseManager {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
super(config);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get available time slot IDs
|
|
9
|
+
*
|
|
10
|
+
* Use this API to get available time slots for creating shop flash sales.
|
|
11
|
+
* You can only use time slots that start in the future.
|
|
12
|
+
*
|
|
13
|
+
* @param params - Parameters containing start_time and end_time
|
|
14
|
+
* @returns A promise that resolves to the list of available time slots
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const now = Math.floor(Date.now() / 1000);
|
|
19
|
+
* const slots = await sdk.shopFlashSale.getTimeSlotId({
|
|
20
|
+
* start_time: now,
|
|
21
|
+
* end_time: now + 7 * 86400 // Next 7 days
|
|
22
|
+
* });
|
|
23
|
+
* console.log('Available slots:', slots.response);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
async getTimeSlotId(params) {
|
|
27
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/get_time_slot_id", {
|
|
28
|
+
method: "GET",
|
|
29
|
+
auth: true,
|
|
30
|
+
params,
|
|
31
|
+
});
|
|
32
|
+
return response;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a new shop flash sale
|
|
36
|
+
*
|
|
37
|
+
* Use this API to create a new shop flash sale activity for a specific time slot.
|
|
38
|
+
* The time slot must be obtained from getTimeSlotId() and must start in the future.
|
|
39
|
+
*
|
|
40
|
+
* @param params - Parameters containing timeslot_id
|
|
41
|
+
* @returns A promise that resolves to the created flash sale information
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const flashSale = await sdk.shopFlashSale.createShopFlashSale({
|
|
46
|
+
* timeslot_id: 237859372232704
|
|
47
|
+
* });
|
|
48
|
+
* console.log('Flash sale created:', flashSale.response.flash_sale_id);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
async createShopFlashSale(params) {
|
|
52
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/create_shop_flash_sale", {
|
|
53
|
+
method: "POST",
|
|
54
|
+
auth: true,
|
|
55
|
+
body: params,
|
|
56
|
+
});
|
|
57
|
+
return response;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get shop flash sale details
|
|
61
|
+
*
|
|
62
|
+
* Use this API to get detailed information about a specific shop flash sale.
|
|
63
|
+
*
|
|
64
|
+
* @param params - Parameters containing flash_sale_id
|
|
65
|
+
* @returns A promise that resolves to the flash sale details
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const details = await sdk.shopFlashSale.getShopFlashSale({
|
|
70
|
+
* flash_sale_id: 802063533822541
|
|
71
|
+
* });
|
|
72
|
+
* console.log('Flash sale status:', details.response.status);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
async getShopFlashSale(params) {
|
|
76
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/get_shop_flash_sale", {
|
|
77
|
+
method: "GET",
|
|
78
|
+
auth: true,
|
|
79
|
+
params,
|
|
80
|
+
});
|
|
81
|
+
return response;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get shop flash sale list
|
|
85
|
+
*
|
|
86
|
+
* Use this API to get a list of shop flash sales with pagination support.
|
|
87
|
+
* You can filter by type (upcoming, ongoing, expired) and time range.
|
|
88
|
+
*
|
|
89
|
+
* @param params - Parameters for filtering and pagination
|
|
90
|
+
* @returns A promise that resolves to the list of flash sales
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const list = await sdk.shopFlashSale.getShopFlashSaleList({
|
|
95
|
+
* type: 1, // upcoming
|
|
96
|
+
* offset: 0,
|
|
97
|
+
* limit: 20
|
|
98
|
+
* });
|
|
99
|
+
* console.log('Total flash sales:', list.response.total_count);
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
async getShopFlashSaleList(params) {
|
|
103
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/get_shop_flash_sale_list", {
|
|
104
|
+
method: "GET",
|
|
105
|
+
auth: true,
|
|
106
|
+
params,
|
|
107
|
+
});
|
|
108
|
+
return response;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Update shop flash sale status
|
|
112
|
+
*
|
|
113
|
+
* Use this API to enable or disable a shop flash sale.
|
|
114
|
+
* Disabling a flash sale will disable all items in the session.
|
|
115
|
+
* Cannot edit flash sales with 'system_rejected' status.
|
|
116
|
+
*
|
|
117
|
+
* @param params - Parameters containing flash_sale_id and status
|
|
118
|
+
* @returns A promise that resolves to the updated flash sale information
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const result = await sdk.shopFlashSale.updateShopFlashSale({
|
|
123
|
+
* flash_sale_id: 802063533822541,
|
|
124
|
+
* status: 1 // enable
|
|
125
|
+
* });
|
|
126
|
+
* console.log('Flash sale updated:', result.response.status);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
async updateShopFlashSale(params) {
|
|
130
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/update_shop_flash_sale", {
|
|
131
|
+
method: "POST",
|
|
132
|
+
auth: true,
|
|
133
|
+
body: params,
|
|
134
|
+
});
|
|
135
|
+
return response;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Delete shop flash sale
|
|
139
|
+
*
|
|
140
|
+
* Use this API to delete a shop flash sale.
|
|
141
|
+
* Cannot delete ongoing and expired flash sales.
|
|
142
|
+
*
|
|
143
|
+
* @param params - Parameters containing flash_sale_id
|
|
144
|
+
* @returns A promise that resolves to the deleted flash sale information
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const result = await sdk.shopFlashSale.deleteShopFlashSale({
|
|
149
|
+
* flash_sale_id: 802063533822541
|
|
150
|
+
* });
|
|
151
|
+
* console.log('Flash sale deleted, status:', result.response.status);
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
async deleteShopFlashSale(params) {
|
|
155
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/delete_shop_flash_sale", {
|
|
156
|
+
method: "POST",
|
|
157
|
+
auth: true,
|
|
158
|
+
body: params,
|
|
159
|
+
});
|
|
160
|
+
return response;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Add items to shop flash sale
|
|
164
|
+
*
|
|
165
|
+
* Use this API to add items to a shop flash sale.
|
|
166
|
+
* Maximum 50 enabled items per flash sale.
|
|
167
|
+
* For items with variations, specify model_id and prices for each variation.
|
|
168
|
+
*
|
|
169
|
+
* @param params - Parameters containing flash_sale_id and items
|
|
170
|
+
* @returns A promise that resolves to the result with any failed items
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const result = await sdk.shopFlashSale.addShopFlashSaleItems({
|
|
175
|
+
* flash_sale_id: 802063533822541,
|
|
176
|
+
* items: [
|
|
177
|
+
* {
|
|
178
|
+
* item_id: 3744623870,
|
|
179
|
+
* purchase_limit: 5,
|
|
180
|
+
* models: [
|
|
181
|
+
* {
|
|
182
|
+
* model_id: 5414485721,
|
|
183
|
+
* input_promo_price: 69.3,
|
|
184
|
+
* stock: 100
|
|
185
|
+
* }
|
|
186
|
+
* ]
|
|
187
|
+
* }
|
|
188
|
+
* ]
|
|
189
|
+
* });
|
|
190
|
+
* console.log('Failed items:', result.response.failed_items);
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
async addShopFlashSaleItems(params) {
|
|
194
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/add_shop_flash_sale_items", {
|
|
195
|
+
method: "POST",
|
|
196
|
+
auth: true,
|
|
197
|
+
body: params,
|
|
198
|
+
});
|
|
199
|
+
return response;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get shop flash sale items
|
|
203
|
+
*
|
|
204
|
+
* Use this API to get items and their details in a shop flash sale.
|
|
205
|
+
* Returns both item information and model details for items with variations.
|
|
206
|
+
*
|
|
207
|
+
* @param params - Parameters containing flash_sale_id, offset, and limit
|
|
208
|
+
* @returns A promise that resolves to the items and their details
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* const items = await sdk.shopFlashSale.getShopFlashSaleItems({
|
|
213
|
+
* flash_sale_id: 802063533822541,
|
|
214
|
+
* offset: 0,
|
|
215
|
+
* limit: 50
|
|
216
|
+
* });
|
|
217
|
+
* console.log('Total items:', items.response.total_count);
|
|
218
|
+
* console.log('Items:', items.response.item_info);
|
|
219
|
+
* console.log('Models:', items.response.models);
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
async getShopFlashSaleItems(params) {
|
|
223
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/get_shop_flash_sale_items", {
|
|
224
|
+
method: "GET",
|
|
225
|
+
auth: true,
|
|
226
|
+
params,
|
|
227
|
+
});
|
|
228
|
+
return response;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Update shop flash sale items
|
|
232
|
+
*
|
|
233
|
+
* Use this API to update items in a shop flash sale.
|
|
234
|
+
* Can only edit items/models in disabled or enabled status.
|
|
235
|
+
* Cannot modify price or stock of enabled items, must disable first.
|
|
236
|
+
*
|
|
237
|
+
* @param params - Parameters containing flash_sale_id and items
|
|
238
|
+
* @returns A promise that resolves to the result with any failed items
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const result = await sdk.shopFlashSale.updateShopFlashSaleItems({
|
|
243
|
+
* flash_sale_id: 802063533822541,
|
|
244
|
+
* items: [
|
|
245
|
+
* {
|
|
246
|
+
* item_id: 3744623870,
|
|
247
|
+
* purchase_limit: 10,
|
|
248
|
+
* models: [
|
|
249
|
+
* {
|
|
250
|
+
* model_id: 5414485721,
|
|
251
|
+
* status: 1, // enable
|
|
252
|
+
* input_promo_price: 65.0,
|
|
253
|
+
* stock: 150
|
|
254
|
+
* }
|
|
255
|
+
* ]
|
|
256
|
+
* }
|
|
257
|
+
* ]
|
|
258
|
+
* });
|
|
259
|
+
* console.log('Failed items:', result.response.failed_items);
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
async updateShopFlashSaleItems(params) {
|
|
263
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/update_shop_flash_sale_items", {
|
|
264
|
+
method: "POST",
|
|
265
|
+
auth: true,
|
|
266
|
+
body: params,
|
|
267
|
+
});
|
|
268
|
+
return response;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Delete items from shop flash sale
|
|
272
|
+
*
|
|
273
|
+
* Use this API to delete items from a shop flash sale.
|
|
274
|
+
* Deleting an item will delete all its models/variations.
|
|
275
|
+
*
|
|
276
|
+
* @param params - Parameters containing flash_sale_id and item_ids
|
|
277
|
+
* @returns A promise that resolves to the result with any failed items
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* const result = await sdk.shopFlashSale.deleteShopFlashSaleItems({
|
|
282
|
+
* flash_sale_id: 802063533822541,
|
|
283
|
+
* item_ids: [3744623870, 3744624265]
|
|
284
|
+
* });
|
|
285
|
+
* console.log('Items deleted');
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
async deleteShopFlashSaleItems(params) {
|
|
289
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/delete_shop_flash_sale_items", {
|
|
290
|
+
method: "POST",
|
|
291
|
+
auth: true,
|
|
292
|
+
body: params,
|
|
293
|
+
});
|
|
294
|
+
return response;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Get item criteria for shop flash sale
|
|
298
|
+
*
|
|
299
|
+
* Use this API to get the criteria that items must meet to be eligible
|
|
300
|
+
* for shop flash sales. Criteria vary by product category and region.
|
|
301
|
+
*
|
|
302
|
+
* @param params - No parameters required
|
|
303
|
+
* @returns A promise that resolves to the criteria details
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```typescript
|
|
307
|
+
* const criteria = await sdk.shopFlashSale.getItemCriteria({});
|
|
308
|
+
* console.log('Criteria:', criteria.response.criteria);
|
|
309
|
+
* console.log('Category mappings:', criteria.response.pair_ids);
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
async getItemCriteria(params) {
|
|
313
|
+
const response = await ShopeeFetch.fetch(this.config, "/shop_flash_sale/get_item_criteria", {
|
|
314
|
+
method: "GET",
|
|
315
|
+
auth: true,
|
|
316
|
+
params: params || {},
|
|
317
|
+
});
|
|
318
|
+
return response;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
//# sourceMappingURL=shop-flash-sale.manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shop-flash-sale.manager.js","sourceRoot":"","sources":["../../src/managers/shop-flash-sale.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAyBhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,oBAAqB,SAAQ,WAAW;IACnD,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,mCAAmC,EACnC;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,mBAAm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