@congminh1254/shopee-sdk 0.9.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.
Files changed (137) hide show
  1. package/README.md +178 -36
  2. package/lib/fetch.js +13 -0
  3. package/lib/fetch.js.map +1 -1
  4. package/lib/managers/add-on-deal.manager.d.ts +140 -0
  5. package/lib/managers/add-on-deal.manager.js +240 -0
  6. package/lib/managers/add-on-deal.manager.js.map +1 -0
  7. package/lib/managers/ads.manager.d.ts +217 -1
  8. package/lib/managers/ads.manager.js +312 -0
  9. package/lib/managers/ads.manager.js.map +1 -1
  10. package/lib/managers/bundle-deal.manager.d.ts +106 -0
  11. package/lib/managers/bundle-deal.manager.js +178 -0
  12. package/lib/managers/bundle-deal.manager.js.map +1 -0
  13. package/lib/managers/discount.manager.d.ts +102 -0
  14. package/lib/managers/discount.manager.js +167 -0
  15. package/lib/managers/discount.manager.js.map +1 -0
  16. package/lib/managers/fbs.manager.d.ts +115 -0
  17. package/lib/managers/fbs.manager.js +145 -0
  18. package/lib/managers/fbs.manager.js.map +1 -0
  19. package/lib/managers/first-mile.manager.d.ts +150 -0
  20. package/lib/managers/first-mile.manager.js +264 -0
  21. package/lib/managers/first-mile.manager.js.map +1 -0
  22. package/lib/managers/follow-prize.manager.d.ts +108 -0
  23. package/lib/managers/follow-prize.manager.js +152 -0
  24. package/lib/managers/follow-prize.manager.js.map +1 -0
  25. package/lib/managers/global-product.manager.d.ts +664 -0
  26. package/lib/managers/global-product.manager.js +904 -0
  27. package/lib/managers/global-product.manager.js.map +1 -0
  28. package/lib/managers/index.d.ts +17 -1
  29. package/lib/managers/index.js +17 -1
  30. package/lib/managers/index.js.map +1 -1
  31. package/lib/managers/livestream.manager.d.ts +377 -0
  32. package/lib/managers/livestream.manager.js +529 -0
  33. package/lib/managers/livestream.manager.js.map +1 -0
  34. package/lib/managers/logistics.manager.d.ts +267 -1
  35. package/lib/managers/logistics.manager.js +544 -0
  36. package/lib/managers/logistics.manager.js.map +1 -1
  37. package/lib/managers/media-space.manager.d.ts +179 -0
  38. package/lib/managers/media-space.manager.js +220 -0
  39. package/lib/managers/media-space.manager.js.map +1 -0
  40. package/lib/managers/media.manager.d.ts +226 -0
  41. package/lib/managers/media.manager.js +274 -0
  42. package/lib/managers/media.manager.js.map +1 -0
  43. package/lib/managers/merchant.manager.d.ts +100 -0
  44. package/lib/managers/merchant.manager.js +144 -0
  45. package/lib/managers/merchant.manager.js.map +1 -0
  46. package/lib/managers/order.manager.d.ts +213 -1
  47. package/lib/managers/order.manager.js +305 -0
  48. package/lib/managers/order.manager.js.map +1 -1
  49. package/lib/managers/payment.manager.d.ts +186 -1
  50. package/lib/managers/payment.manager.js +288 -0
  51. package/lib/managers/payment.manager.js.map +1 -1
  52. package/lib/managers/product.manager.d.ts +346 -1
  53. package/lib/managers/product.manager.js +718 -0
  54. package/lib/managers/product.manager.js.map +1 -1
  55. package/lib/managers/returns.manager.d.ts +200 -0
  56. package/lib/managers/returns.manager.js +300 -0
  57. package/lib/managers/returns.manager.js.map +1 -0
  58. package/lib/managers/sbs.manager.d.ts +112 -0
  59. package/lib/managers/sbs.manager.js +149 -0
  60. package/lib/managers/sbs.manager.js.map +1 -0
  61. package/lib/managers/shop-category.manager.d.ts +207 -0
  62. package/lib/managers/shop-category.manager.js +258 -0
  63. package/lib/managers/shop-category.manager.js.map +1 -0
  64. package/lib/managers/shop-flash-sale.manager.d.ts +242 -0
  65. package/lib/managers/shop-flash-sale.manager.js +321 -0
  66. package/lib/managers/shop-flash-sale.manager.js.map +1 -0
  67. package/lib/managers/shop.manager.d.ts +173 -0
  68. package/lib/managers/shop.manager.js +217 -0
  69. package/lib/managers/shop.manager.js.map +1 -0
  70. package/lib/managers/top-picks.manager.d.ts +62 -0
  71. package/lib/managers/top-picks.manager.js +91 -0
  72. package/lib/managers/top-picks.manager.js.map +1 -0
  73. package/lib/schemas/add-on-deal.d.ts +390 -0
  74. package/lib/schemas/add-on-deal.js +45 -0
  75. package/lib/schemas/add-on-deal.js.map +1 -0
  76. package/lib/schemas/ads.d.ts +437 -0
  77. package/lib/schemas/bundle-deal.d.ts +300 -0
  78. package/lib/schemas/bundle-deal.js +27 -0
  79. package/lib/schemas/bundle-deal.js.map +1 -0
  80. package/lib/schemas/discount.d.ts +334 -0
  81. package/lib/schemas/discount.js +15 -0
  82. package/lib/schemas/discount.js.map +1 -0
  83. package/lib/schemas/fbs.d.ts +117 -0
  84. package/lib/schemas/fbs.js +2 -0
  85. package/lib/schemas/fbs.js.map +1 -0
  86. package/lib/schemas/first-mile.d.ts +551 -0
  87. package/lib/schemas/first-mile.js +2 -0
  88. package/lib/schemas/first-mile.js.map +1 -0
  89. package/lib/schemas/follow-prize.d.ts +198 -0
  90. package/lib/schemas/follow-prize.js +27 -0
  91. package/lib/schemas/follow-prize.js.map +1 -0
  92. package/lib/schemas/global-product.d.ts +1127 -0
  93. package/lib/schemas/global-product.js +2 -0
  94. package/lib/schemas/global-product.js.map +1 -0
  95. package/lib/schemas/index.d.ts +13 -0
  96. package/lib/schemas/index.js +17 -0
  97. package/lib/schemas/index.js.map +1 -1
  98. package/lib/schemas/livestream.d.ts +649 -0
  99. package/lib/schemas/livestream.js +2 -0
  100. package/lib/schemas/livestream.js.map +1 -0
  101. package/lib/schemas/logistics.d.ts +979 -0
  102. package/lib/schemas/logistics.js +13 -0
  103. package/lib/schemas/logistics.js.map +1 -1
  104. package/lib/schemas/media-space.d.ts +189 -0
  105. package/lib/schemas/media-space.js +2 -0
  106. package/lib/schemas/media-space.js.map +1 -0
  107. package/lib/schemas/media.d.ts +230 -0
  108. package/lib/schemas/media.js +2 -0
  109. package/lib/schemas/media.js.map +1 -0
  110. package/lib/schemas/merchant.d.ts +236 -0
  111. package/lib/schemas/merchant.js +2 -0
  112. package/lib/schemas/merchant.js.map +1 -0
  113. package/lib/schemas/order.d.ts +431 -0
  114. package/lib/schemas/payment.d.ts +397 -0
  115. package/lib/schemas/product.d.ts +1157 -0
  116. package/lib/schemas/returns.d.ts +632 -0
  117. package/lib/schemas/returns.js +63 -0
  118. package/lib/schemas/returns.js.map +1 -0
  119. package/lib/schemas/sbs.d.ts +484 -0
  120. package/lib/schemas/sbs.js +2 -0
  121. package/lib/schemas/sbs.js.map +1 -0
  122. package/lib/schemas/shop-category.d.ts +176 -0
  123. package/lib/schemas/shop-category.js +2 -0
  124. package/lib/schemas/shop-category.js.map +1 -0
  125. package/lib/schemas/shop-flash-sale.d.ts +473 -0
  126. package/lib/schemas/shop-flash-sale.js +43 -0
  127. package/lib/schemas/shop-flash-sale.js.map +1 -0
  128. package/lib/schemas/shop.d.ts +250 -0
  129. package/lib/schemas/shop.js +2 -0
  130. package/lib/schemas/shop.js.map +1 -0
  131. package/lib/schemas/top-picks.d.ts +99 -0
  132. package/lib/schemas/top-picks.js +2 -0
  133. package/lib/schemas/top-picks.js.map +1 -0
  134. package/lib/sdk.d.ts +34 -0
  135. package/lib/sdk.js +34 -0
  136. package/lib/sdk.js.map +1 -1
  137. package/package.json +7 -4
@@ -0,0 +1,149 @@
1
+ import { BaseManager } from "./base.manager.js";
2
+ import { ShopeeFetch } from "../fetch.js";
3
+ export class SbsManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ /**
8
+ * Get bound warehouse by shop id.
9
+ *
10
+ * @param params - Parameters for getting bound warehouse info (empty object)
11
+ *
12
+ * @returns A promise that resolves to the bound warehouse info response containing:
13
+ * - list: List of shops with bound warehouses
14
+ *
15
+ * @throws {Error} When the API request fails or returns an error
16
+ */
17
+ async getBoundWhsInfo(params = {}) {
18
+ const response = await ShopeeFetch.fetch(this.config, "/sbs/get_bound_whs_info", {
19
+ method: "GET",
20
+ auth: true,
21
+ params,
22
+ });
23
+ return response;
24
+ }
25
+ /**
26
+ * Get Seller Center Current Inventory Page Data.
27
+ * This API provides detailed inventory information including sellable, reserved,
28
+ * and unsellable quantities across different warehouses.
29
+ *
30
+ * @param params - Parameters for getting current inventory
31
+ * @param params.whs_region - Warehouse region (required): BR, CN, ID, MY, MX, TH, TW, PH, VN, SG
32
+ * @param params.page_no - Page number (default: 1)
33
+ * @param params.page_size - Page size, 1-100 (default: 10)
34
+ * @param params.search_type - Search type: 0=All data; 1=Product Name; 2=SKU ID; 3=Variations; 4=Item ID
35
+ * @param params.keyword - Search keyword
36
+ * @param params.whs_ids - Warehouse IDs, comma-separated
37
+ * @param params.not_moving_tag - Not moving tag: Blank=All; 0=No; 1=Yes
38
+ * @param params.inbound_pending_approval - Inbound pending approval: Blank=All; 0=No; 1=Yes
39
+ * @param params.products_with_inventory - Products with inventory: Blank=All; 0=No; 1=Yes
40
+ * @param params.category_id - Category id (first-tier)
41
+ * @param params.stock_levels - Stock levels (comma-separated): 1=Low Stock & No Sellable stock; 2=Low Stock & To replenish; 3=Low Stock & Replenished; 4=Excess
42
+ *
43
+ * @returns A promise that resolves to the current inventory response containing:
44
+ * - cursor: Pagination cursor
45
+ * - item_list: List of items with inventory details
46
+ *
47
+ * @throws {Error} When the API request fails or returns an error
48
+ */
49
+ async getCurrentInventory(params) {
50
+ const response = await ShopeeFetch.fetch(this.config, "/sbs/get_current_inventory", {
51
+ method: "POST",
52
+ auth: true,
53
+ body: params,
54
+ });
55
+ return response;
56
+ }
57
+ /**
58
+ * Get Seller Center Expiry Report page data.
59
+ * This API provides information about expiring, expired, and damaged stocks.
60
+ *
61
+ * @param params - Parameters for getting expiry report
62
+ * @param params.whs_region - Warehouse region (required): BR, CN, ID, MY, MX, TH, TW, PH, VN, SG
63
+ * @param params.page_no - Page number (default: 1)
64
+ * @param params.page_size - Page size, 1-40 (default: 10)
65
+ * @param params.whs_ids - Warehouse IDs, comma-separated
66
+ * @param params.expiry_status - Expiry status (comma-separated): 0=Expired, 2=Expiring, 4=expiry_blocked, 5=damaged, 6=normal
67
+ * @param params.category_id_l1 - Only Level 1 Category can be filtered
68
+ * @param params.sku_id - SKU ID
69
+ * @param params.item_id - Item ID
70
+ * @param params.variation - Variation
71
+ * @param params.item_name - Item name
72
+ *
73
+ * @returns A promise that resolves to the expiry report response containing:
74
+ * - item_list: List of items with expiry information
75
+ *
76
+ * @throws {Error} When the API request fails or returns an error
77
+ */
78
+ async getExpiryReport(params) {
79
+ const response = await ShopeeFetch.fetch(this.config, "/sbs/get_expiry_report", {
80
+ method: "POST",
81
+ auth: true,
82
+ body: params,
83
+ });
84
+ return response;
85
+ }
86
+ /**
87
+ * Get Seller Center Stock Aging page data.
88
+ * This API provides stock aging information showing how long items have been in stock.
89
+ *
90
+ * @param params - Parameters for getting stock aging
91
+ * @param params.whs_region - Warehouse region (required): BR, CN, ID, MY, MX, TH, TW, PH, VN, SG
92
+ * @param params.page_no - Page number (default: 1)
93
+ * @param params.page_size - Page size, 1-100 (default: 10)
94
+ * @param params.search_type - Search type: 1=Product Name; 2=SKU ID; 3=Variations; 4=Item ID
95
+ * @param params.keyword - Search keyword
96
+ * @param params.whs_ids - Warehouse IDs, comma-separated
97
+ * @param params.aging_storage_tag - Aging storage tag: 0=false; 1=true
98
+ * @param params.excess_storage_tag - Excess storage tag: 0=false; 1=true
99
+ * @param params.category_id - L1-level product category ID
100
+ *
101
+ * @returns A promise that resolves to the stock aging response containing:
102
+ * - item_list: List of items with stock aging details
103
+ *
104
+ * @throws {Error} When the API request fails or returns an error
105
+ */
106
+ async getStockAging(params) {
107
+ const response = await ShopeeFetch.fetch(this.config, "/sbs/get_stock_aging", {
108
+ method: "POST",
109
+ auth: true,
110
+ body: params,
111
+ });
112
+ return response;
113
+ }
114
+ /**
115
+ * Get Seller Center Stock Movement page data.
116
+ * This API provides stock movement information including inbound, outbound, and adjustments.
117
+ *
118
+ * @param params - Parameters for getting stock movement
119
+ * @param params.start_time - Start date in YYYY-MM-DD format (required)
120
+ * @param params.end_time - End date in YYYY-MM-DD format (required)
121
+ * @param params.whs_region - Warehouse region (required): BR, CN, ID, MY, MX, TH, TW, PH, VN, SG
122
+ * @param params.page_no - Page number (default: 1)
123
+ * @param params.page_size - Page size, 1-20 (default: 10)
124
+ * @param params.whs_ids - Warehouse IDs, comma-separated
125
+ * @param params.category_id_l1 - L1-level category_id
126
+ * @param params.sku_id - SKU ID
127
+ * @param params.item_id - Item ID
128
+ * @param params.item_name - Item name
129
+ * @param params.variation - Variation
130
+ *
131
+ * @returns A promise that resolves to the stock movement response containing:
132
+ * - total: Total number of items
133
+ * - start_time: Start time
134
+ * - end_time: End time
135
+ * - query_end_time: Query end time
136
+ * - item_list: List of items with stock movement details
137
+ *
138
+ * @throws {Error} When the API request fails or returns an error
139
+ */
140
+ async getStockMovement(params) {
141
+ const response = await ShopeeFetch.fetch(this.config, "/sbs/get_stock_movement", {
142
+ method: "POST",
143
+ auth: true,
144
+ body: params,
145
+ });
146
+ return response;
147
+ }
148
+ }
149
+ //# sourceMappingURL=sbs.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sbs.manager.js","sourceRoot":"","sources":["../../src/managers/sbs.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAahD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,eAAe,CAAC,SAAgC,EAAE;QACtD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,yBAAyB,EACzB;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,mBAAmB,CACvB,MAAiC;QAEjC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,4BAA4B,EAC5B;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,eAAe,CAAC,MAA6B;QACjD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,wBAAwB,EACxB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,sBAAsB,EACtB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAA8B;QACnD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,yBAAyB,EACzB;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,207 @@
1
+ import { ShopeeConfig } from "../sdk.js";
2
+ import { BaseManager } from "./base.manager.js";
3
+ import { GetShopCategoryListParams, GetShopCategoryListResponse, AddShopCategoryParams, AddShopCategoryResponse, UpdateShopCategoryParams, UpdateShopCategoryResponse, DeleteShopCategoryParams, DeleteShopCategoryResponse, AddItemListParams, AddItemListResponse, DeleteItemListParams, DeleteItemListResponse, GetShopCategoryItemListParams, GetShopCategoryItemListResponse } from "../schemas/shop-category.js";
4
+ export declare class ShopCategoryManager extends BaseManager {
5
+ constructor(config: ShopeeConfig);
6
+ /**
7
+ * Get list of shop categories
8
+ *
9
+ * Use this call to get list of shop categories
10
+ *
11
+ * @param params - Parameters for getting shop category list
12
+ * @param params.page_size - Total returned data per entry. Range: [1, 100]
13
+ * @param params.page_no - Starting entry of data to return. Range: [1, 2147483647]
14
+ *
15
+ * @returns A promise that resolves to the shop category list response containing:
16
+ * - shop_categorys: List of shop categories with id, status, name, and sort_weight
17
+ * - total_count: Total number of shop categories
18
+ * - more: Whether there are more pages
19
+ *
20
+ * @throws {Error} When the API request fails or returns an error:
21
+ * - error_param: Invalid parameters
22
+ * - error_auth: Invalid access_token or partner_id
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const categories = await sdk.shopCategory.getShopCategoryList({
27
+ * page_size: 100,
28
+ * page_no: 1
29
+ * });
30
+ * console.log('Total categories:', categories.response.total_count);
31
+ * ```
32
+ */
33
+ getShopCategoryList(params: GetShopCategoryListParams): Promise<GetShopCategoryListResponse>;
34
+ /**
35
+ * Add a new shop category
36
+ *
37
+ * Use this call to add a new shop collection
38
+ *
39
+ * @param params - Parameters for adding a shop category
40
+ * @param params.name - ShopCategory's name (max 40 characters)
41
+ * @param params.sort_weight - ShopCategory's sort weight (optional, max 2147483546)
42
+ *
43
+ * @returns A promise that resolves to the add shop category response containing:
44
+ * - shop_category_id: The newly created shop category ID
45
+ *
46
+ * @throws {Error} When the API request fails or returns an error:
47
+ * - error_param: ShopCategory name is duplicated or exceeds 40 characters
48
+ * - error_param: Sort_weight should be between [0, 2147483546]
49
+ * - error_param: Maximum number of categories (1500) reached
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const result = await sdk.shopCategory.addShopCategory({
54
+ * name: 'Summer Collection',
55
+ * sort_weight: 10
56
+ * });
57
+ * console.log('Category ID:', result.response.shop_category_id);
58
+ * ```
59
+ */
60
+ addShopCategory(params: AddShopCategoryParams): Promise<AddShopCategoryResponse>;
61
+ /**
62
+ * Update an existing shop category
63
+ *
64
+ * Use this call to update an existing collection
65
+ *
66
+ * @param params - Parameters for updating a shop category
67
+ * @param params.shop_category_id - ShopCategory's unique identifier
68
+ * @param params.name - ShopCategory's name (optional)
69
+ * @param params.sort_weight - ShopCategory's sort weight (optional)
70
+ * @param params.status - ShopCategory's status (optional): NORMAL, INACTIVE, DELETED
71
+ *
72
+ * @returns A promise that resolves to the update shop category response containing:
73
+ * - shop_category_id: The updated shop category ID
74
+ * - name: Updated name
75
+ * - sort_weight: Updated sort weight
76
+ * - status: Updated status
77
+ *
78
+ * @throws {Error} When the API request fails or returns an error:
79
+ * - error_param: ShopCategory name is duplicated
80
+ * - error_param: Shopee category cannot edit name and sort_weight
81
+ * - error_service: Shop category id is not found
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const result = await sdk.shopCategory.updateShopCategory({
86
+ * shop_category_id: 12345,
87
+ * name: 'Winter Collection',
88
+ * status: 'NORMAL'
89
+ * });
90
+ * ```
91
+ */
92
+ updateShopCategory(params: UpdateShopCategoryParams): Promise<UpdateShopCategoryResponse>;
93
+ /**
94
+ * Delete an existing shop category
95
+ *
96
+ * Use this call to delete an existing shop collection
97
+ *
98
+ * @param params - Parameters for deleting a shop category
99
+ * @param params.shop_category_id - ShopCategory's unique identifier
100
+ *
101
+ * @returns A promise that resolves to the delete shop category response containing:
102
+ * - shop_category_id: The deleted shop category ID
103
+ * - msg: Result message
104
+ *
105
+ * @throws {Error} When the API request fails or returns an error:
106
+ * - error_param: Automatic & shopee category cannot be deleted
107
+ * - error_service: Shop category id is not found
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * const result = await sdk.shopCategory.deleteShopCategory({
112
+ * shop_category_id: 12345
113
+ * });
114
+ * console.log('Deleted category:', result.response.shop_category_id);
115
+ * ```
116
+ */
117
+ deleteShopCategory(params: DeleteShopCategoryParams): Promise<DeleteShopCategoryResponse>;
118
+ /**
119
+ * Add items to a shop category
120
+ *
121
+ * Use this call to add items list to certain shop_category
122
+ *
123
+ * @param params - Parameters for adding items
124
+ * @param params.shop_category_id - ShopCategory's unique identifier
125
+ * @param params.item_list - List of item IDs (max 100 items per request)
126
+ *
127
+ * @returns A promise that resolves to the add item list response containing:
128
+ * - shop_category_id: The shop category ID
129
+ * - current_count: Count of items after addition
130
+ * - invalid_item_id_list: List of invalid item IDs with error details
131
+ *
132
+ * @throws {Error} When the API request fails or returns an error:
133
+ * - error_param: Total item number exceeds limit (5000)
134
+ * - error_param: Automatic & shopee category cannot add items
135
+ * - error_service: Shop category id is not found
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * const result = await sdk.shopCategory.addItemList({
140
+ * shop_category_id: 12345,
141
+ * item_list: [100001, 100002, 100003]
142
+ * });
143
+ * console.log('Items in category:', result.response.current_count);
144
+ * ```
145
+ */
146
+ addItemList(params: AddItemListParams): Promise<AddItemListResponse>;
147
+ /**
148
+ * Delete items from a shop category
149
+ *
150
+ * Use this api to delete items from shop category
151
+ *
152
+ * @param params - Parameters for deleting items
153
+ * @param params.shop_category_id - ShopCategory's unique identifier
154
+ * @param params.item_list - List of item IDs to delete (max 100 items per request)
155
+ *
156
+ * @returns A promise that resolves to the delete item list response containing:
157
+ * - shop_category_id: The shop category ID
158
+ * - current_count: Count of items after deletion
159
+ * - invalid_item_id_list: List of invalid item IDs with error details
160
+ *
161
+ * @throws {Error} When the API request fails or returns an error:
162
+ * - error_param: Automatic & shopee category cannot delete items
163
+ * - error_param: At most 100 items can be deleted per operation
164
+ * - error_service: Shop category id is not found
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const result = await sdk.shopCategory.deleteItemList({
169
+ * shop_category_id: 12345,
170
+ * item_list: [100001, 100002]
171
+ * });
172
+ * console.log('Remaining items:', result.response.current_count);
173
+ * ```
174
+ */
175
+ deleteItemList(params: DeleteItemListParams): Promise<DeleteItemListResponse>;
176
+ /**
177
+ * Get items in a shop category
178
+ *
179
+ * Use this call to get items list of certain shop_category
180
+ *
181
+ * @param params - Parameters for getting items
182
+ * @param params.shop_category_id - ShopCategory's unique identifier
183
+ * @param params.page_size - Results per page (optional, default: 1000, range: [0, 1000])
184
+ * @param params.page_no - Page number (optional, default: 0)
185
+ *
186
+ * @returns A promise that resolves to the get item list response containing:
187
+ * - item_list: List of item IDs
188
+ * - total_count: Total number of items in this category
189
+ * - more: Whether there are more pages
190
+ *
191
+ * @throws {Error} When the API request fails or returns an error:
192
+ * - error_service: Shop category id is not found
193
+ * - error_param: Page number should be [1, 2147483446/page_size]
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * const result = await sdk.shopCategory.getItemList({
198
+ * shop_category_id: 12345,
199
+ * page_size: 100,
200
+ * page_no: 1
201
+ * });
202
+ * console.log('Items:', result.response.item_list);
203
+ * console.log('Has more:', result.response.more);
204
+ * ```
205
+ */
206
+ getItemList(params: GetShopCategoryItemListParams): Promise<GetShopCategoryItemListResponse>;
207
+ }
@@ -0,0 +1,258 @@
1
+ import { BaseManager } from "./base.manager.js";
2
+ import { ShopeeFetch } from "../fetch.js";
3
+ export class ShopCategoryManager extends BaseManager {
4
+ constructor(config) {
5
+ super(config);
6
+ }
7
+ /**
8
+ * Get list of shop categories
9
+ *
10
+ * Use this call to get list of shop categories
11
+ *
12
+ * @param params - Parameters for getting shop category list
13
+ * @param params.page_size - Total returned data per entry. Range: [1, 100]
14
+ * @param params.page_no - Starting entry of data to return. Range: [1, 2147483647]
15
+ *
16
+ * @returns A promise that resolves to the shop category list response containing:
17
+ * - shop_categorys: List of shop categories with id, status, name, and sort_weight
18
+ * - total_count: Total number of shop categories
19
+ * - more: Whether there are more pages
20
+ *
21
+ * @throws {Error} When the API request fails or returns an error:
22
+ * - error_param: Invalid parameters
23
+ * - error_auth: Invalid access_token or partner_id
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * const categories = await sdk.shopCategory.getShopCategoryList({
28
+ * page_size: 100,
29
+ * page_no: 1
30
+ * });
31
+ * console.log('Total categories:', categories.response.total_count);
32
+ * ```
33
+ */
34
+ async getShopCategoryList(params) {
35
+ const response = await ShopeeFetch.fetch(this.config, "/shop_category/get_shop_category_list", {
36
+ method: "GET",
37
+ auth: true,
38
+ params,
39
+ });
40
+ return response;
41
+ }
42
+ /**
43
+ * Add a new shop category
44
+ *
45
+ * Use this call to add a new shop collection
46
+ *
47
+ * @param params - Parameters for adding a shop category
48
+ * @param params.name - ShopCategory's name (max 40 characters)
49
+ * @param params.sort_weight - ShopCategory's sort weight (optional, max 2147483546)
50
+ *
51
+ * @returns A promise that resolves to the add shop category response containing:
52
+ * - shop_category_id: The newly created shop category ID
53
+ *
54
+ * @throws {Error} When the API request fails or returns an error:
55
+ * - error_param: ShopCategory name is duplicated or exceeds 40 characters
56
+ * - error_param: Sort_weight should be between [0, 2147483546]
57
+ * - error_param: Maximum number of categories (1500) reached
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const result = await sdk.shopCategory.addShopCategory({
62
+ * name: 'Summer Collection',
63
+ * sort_weight: 10
64
+ * });
65
+ * console.log('Category ID:', result.response.shop_category_id);
66
+ * ```
67
+ */
68
+ async addShopCategory(params) {
69
+ const response = await ShopeeFetch.fetch(this.config, "/shop_category/add_shop_category", {
70
+ method: "POST",
71
+ auth: true,
72
+ body: params,
73
+ });
74
+ return response;
75
+ }
76
+ /**
77
+ * Update an existing shop category
78
+ *
79
+ * Use this call to update an existing collection
80
+ *
81
+ * @param params - Parameters for updating a shop category
82
+ * @param params.shop_category_id - ShopCategory's unique identifier
83
+ * @param params.name - ShopCategory's name (optional)
84
+ * @param params.sort_weight - ShopCategory's sort weight (optional)
85
+ * @param params.status - ShopCategory's status (optional): NORMAL, INACTIVE, DELETED
86
+ *
87
+ * @returns A promise that resolves to the update shop category response containing:
88
+ * - shop_category_id: The updated shop category ID
89
+ * - name: Updated name
90
+ * - sort_weight: Updated sort weight
91
+ * - status: Updated status
92
+ *
93
+ * @throws {Error} When the API request fails or returns an error:
94
+ * - error_param: ShopCategory name is duplicated
95
+ * - error_param: Shopee category cannot edit name and sort_weight
96
+ * - error_service: Shop category id is not found
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * const result = await sdk.shopCategory.updateShopCategory({
101
+ * shop_category_id: 12345,
102
+ * name: 'Winter Collection',
103
+ * status: 'NORMAL'
104
+ * });
105
+ * ```
106
+ */
107
+ async updateShopCategory(params) {
108
+ const response = await ShopeeFetch.fetch(this.config, "/shop_category/update_shop_category", {
109
+ method: "POST",
110
+ auth: true,
111
+ body: params,
112
+ });
113
+ return response;
114
+ }
115
+ /**
116
+ * Delete an existing shop category
117
+ *
118
+ * Use this call to delete an existing shop collection
119
+ *
120
+ * @param params - Parameters for deleting a shop category
121
+ * @param params.shop_category_id - ShopCategory's unique identifier
122
+ *
123
+ * @returns A promise that resolves to the delete shop category response containing:
124
+ * - shop_category_id: The deleted shop category ID
125
+ * - msg: Result message
126
+ *
127
+ * @throws {Error} When the API request fails or returns an error:
128
+ * - error_param: Automatic & shopee category cannot be deleted
129
+ * - error_service: Shop category id is not found
130
+ *
131
+ * @example
132
+ * ```typescript
133
+ * const result = await sdk.shopCategory.deleteShopCategory({
134
+ * shop_category_id: 12345
135
+ * });
136
+ * console.log('Deleted category:', result.response.shop_category_id);
137
+ * ```
138
+ */
139
+ async deleteShopCategory(params) {
140
+ const response = await ShopeeFetch.fetch(this.config, "/shop_category/delete_shop_category", {
141
+ method: "POST",
142
+ auth: true,
143
+ body: params,
144
+ });
145
+ return response;
146
+ }
147
+ /**
148
+ * Add items to a shop category
149
+ *
150
+ * Use this call to add items list to certain shop_category
151
+ *
152
+ * @param params - Parameters for adding items
153
+ * @param params.shop_category_id - ShopCategory's unique identifier
154
+ * @param params.item_list - List of item IDs (max 100 items per request)
155
+ *
156
+ * @returns A promise that resolves to the add item list response containing:
157
+ * - shop_category_id: The shop category ID
158
+ * - current_count: Count of items after addition
159
+ * - invalid_item_id_list: List of invalid item IDs with error details
160
+ *
161
+ * @throws {Error} When the API request fails or returns an error:
162
+ * - error_param: Total item number exceeds limit (5000)
163
+ * - error_param: Automatic & shopee category cannot add items
164
+ * - error_service: Shop category id is not found
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const result = await sdk.shopCategory.addItemList({
169
+ * shop_category_id: 12345,
170
+ * item_list: [100001, 100002, 100003]
171
+ * });
172
+ * console.log('Items in category:', result.response.current_count);
173
+ * ```
174
+ */
175
+ async addItemList(params) {
176
+ const response = await ShopeeFetch.fetch(this.config, "/shop_category/add_item_list", {
177
+ method: "POST",
178
+ auth: true,
179
+ body: params,
180
+ });
181
+ return response;
182
+ }
183
+ /**
184
+ * Delete items from a shop category
185
+ *
186
+ * Use this api to delete items from shop category
187
+ *
188
+ * @param params - Parameters for deleting items
189
+ * @param params.shop_category_id - ShopCategory's unique identifier
190
+ * @param params.item_list - List of item IDs to delete (max 100 items per request)
191
+ *
192
+ * @returns A promise that resolves to the delete item list response containing:
193
+ * - shop_category_id: The shop category ID
194
+ * - current_count: Count of items after deletion
195
+ * - invalid_item_id_list: List of invalid item IDs with error details
196
+ *
197
+ * @throws {Error} When the API request fails or returns an error:
198
+ * - error_param: Automatic & shopee category cannot delete items
199
+ * - error_param: At most 100 items can be deleted per operation
200
+ * - error_service: Shop category id is not found
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * const result = await sdk.shopCategory.deleteItemList({
205
+ * shop_category_id: 12345,
206
+ * item_list: [100001, 100002]
207
+ * });
208
+ * console.log('Remaining items:', result.response.current_count);
209
+ * ```
210
+ */
211
+ async deleteItemList(params) {
212
+ const response = await ShopeeFetch.fetch(this.config, "/shop_category/delete_item_list", {
213
+ method: "POST",
214
+ auth: true,
215
+ body: params,
216
+ });
217
+ return response;
218
+ }
219
+ /**
220
+ * Get items in a shop category
221
+ *
222
+ * Use this call to get items list of certain shop_category
223
+ *
224
+ * @param params - Parameters for getting items
225
+ * @param params.shop_category_id - ShopCategory's unique identifier
226
+ * @param params.page_size - Results per page (optional, default: 1000, range: [0, 1000])
227
+ * @param params.page_no - Page number (optional, default: 0)
228
+ *
229
+ * @returns A promise that resolves to the get item list response containing:
230
+ * - item_list: List of item IDs
231
+ * - total_count: Total number of items in this category
232
+ * - more: Whether there are more pages
233
+ *
234
+ * @throws {Error} When the API request fails or returns an error:
235
+ * - error_service: Shop category id is not found
236
+ * - error_param: Page number should be [1, 2147483446/page_size]
237
+ *
238
+ * @example
239
+ * ```typescript
240
+ * const result = await sdk.shopCategory.getItemList({
241
+ * shop_category_id: 12345,
242
+ * page_size: 100,
243
+ * page_no: 1
244
+ * });
245
+ * console.log('Items:', result.response.item_list);
246
+ * console.log('Has more:', result.response.more);
247
+ * ```
248
+ */
249
+ async getItemList(params) {
250
+ const response = await ShopeeFetch.fetch(this.config, "/shop_category/get_item_list", {
251
+ method: "GET",
252
+ auth: true,
253
+ params,
254
+ });
255
+ return response;
256
+ }
257
+ }
258
+ //# sourceMappingURL=shop-category.manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shop-category.manager.js","sourceRoot":"","sources":["../../src/managers/shop-category.manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAiBhD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAClD,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,KAAK,CAAC,mBAAmB,CACvB,MAAiC;QAEjC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,uCAAuC,EACvC;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,KAAK,CAAC,eAAe,CAAC,MAA6B;QACjD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,kCAAkC,EAClC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,KAAK,CAAC,kBAAkB,CAAC,MAAgC;QACvD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,qCAAqC,EACrC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,CAAC,kBAAkB,CAAC,MAAgC;QACvD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,qCAAqC,EACrC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,WAAW,CAAC,MAAyB;QACzC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,8BAA8B,EAC9B;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,cAAc,CAAC,MAA4B;QAC/C,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,iCAAiC,EACjC;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;SACb,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,WAAW,CACf,MAAqC;QAErC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CACtC,IAAI,CAAC,MAAM,EACX,8BAA8B,EAC9B;YACE,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,MAAM;SACP,CACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}