ebay-mcp-remote-edition 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 (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +755 -0
  3. package/build/api/account-management/account.js +301 -0
  4. package/build/api/analytics-and-report/analytics.js +102 -0
  5. package/build/api/client-trading.js +96 -0
  6. package/build/api/client.js +173 -0
  7. package/build/api/communication/feedback.js +119 -0
  8. package/build/api/communication/message.js +131 -0
  9. package/build/api/communication/negotiation.js +97 -0
  10. package/build/api/communication/notification.js +373 -0
  11. package/build/api/developer/developer.js +81 -0
  12. package/build/api/index.js +109 -0
  13. package/build/api/listing-management/inventory.js +640 -0
  14. package/build/api/listing-metadata/metadata.js +485 -0
  15. package/build/api/listing-metadata/taxonomy.js +58 -0
  16. package/build/api/marketing-and-promotions/marketing.js +768 -0
  17. package/build/api/marketing-and-promotions/recommendation.js +32 -0
  18. package/build/api/order-management/dispute.js +69 -0
  19. package/build/api/order-management/fulfillment.js +89 -0
  20. package/build/api/other/compliance.js +47 -0
  21. package/build/api/other/edelivery.js +219 -0
  22. package/build/api/other/identity.js +24 -0
  23. package/build/api/other/translation.js +22 -0
  24. package/build/api/other/vero.js +48 -0
  25. package/build/api/trading/trading.js +78 -0
  26. package/build/auth/kv-store.js +40 -0
  27. package/build/auth/multi-user-store.js +120 -0
  28. package/build/auth/oauth-metadata.js +59 -0
  29. package/build/auth/oauth-middleware.js +99 -0
  30. package/build/auth/oauth-types.js +4 -0
  31. package/build/auth/oauth.js +235 -0
  32. package/build/auth/scope-utils.js +304 -0
  33. package/build/auth/token-store.js +46 -0
  34. package/build/auth/token-verifier.js +172 -0
  35. package/build/config/environment.js +297 -0
  36. package/build/index.d.ts +1 -0
  37. package/build/index.js +129 -0
  38. package/build/schemas/account-management/account.js +375 -0
  39. package/build/schemas/analytics/analytics.js +191 -0
  40. package/build/schemas/communication/messages.js +345 -0
  41. package/build/schemas/fulfillment/orders.js +338 -0
  42. package/build/schemas/index.js +68 -0
  43. package/build/schemas/inventory-management/inventory.js +471 -0
  44. package/build/schemas/marketing/marketing.js +1103 -0
  45. package/build/schemas/metadata/metadata.js +618 -0
  46. package/build/schemas/other/other-apis.js +390 -0
  47. package/build/schemas/taxonomy/taxonomy.js +575 -0
  48. package/build/scripts/auto-setup.js +364 -0
  49. package/build/scripts/dev-sync.js +512 -0
  50. package/build/scripts/diagnostics.js +301 -0
  51. package/build/scripts/download-specs.js +116 -0
  52. package/build/scripts/interactive-setup.js +757 -0
  53. package/build/scripts/setup.js +1515 -0
  54. package/build/scripts/update-api-status-doc.js +44 -0
  55. package/build/server-http.d.ts +1 -0
  56. package/build/server-http.js +581 -0
  57. package/build/tools/definitions/account-with-schemas.js +170 -0
  58. package/build/tools/definitions/account.js +428 -0
  59. package/build/tools/definitions/analytics.js +66 -0
  60. package/build/tools/definitions/communication.js +394 -0
  61. package/build/tools/definitions/developer.js +195 -0
  62. package/build/tools/definitions/fulfillment.js +326 -0
  63. package/build/tools/definitions/index.js +41 -0
  64. package/build/tools/definitions/inventory.js +464 -0
  65. package/build/tools/definitions/marketing.js +1486 -0
  66. package/build/tools/definitions/metadata.js +188 -0
  67. package/build/tools/definitions/other.js +309 -0
  68. package/build/tools/definitions/taxonomy.js +64 -0
  69. package/build/tools/definitions/token-management.js +148 -0
  70. package/build/tools/definitions/trading.js +71 -0
  71. package/build/tools/index.js +1200 -0
  72. package/build/tools/schemas.js +667 -0
  73. package/build/tools/tool-definitions.js +3534 -0
  74. package/build/types/application-settings/developerAnalyticsV1BetaOas3.js +5 -0
  75. package/build/types/application-settings/developerClientRegistrationV1Oas3.js +5 -0
  76. package/build/types/application-settings/developerKeyManagementV1Oas3.js +5 -0
  77. package/build/types/ebay-enums.js +1330 -0
  78. package/build/types/ebay.js +123 -0
  79. package/build/types/index.js +10 -0
  80. package/build/types/sell-apps/account-management/sellAccountV1Oas3.js +5 -0
  81. package/build/types/sell-apps/analytics-and-report/sellAnalyticsV1Oas3.js +5 -0
  82. package/build/types/sell-apps/communication/commerceFeedbackV1BetaOas3.js +5 -0
  83. package/build/types/sell-apps/communication/commerceMessageV1Oas3.js +5 -0
  84. package/build/types/sell-apps/communication/commerceNotificationV1Oas3.js +5 -0
  85. package/build/types/sell-apps/communication/sellNegotiationV1Oas3.js +5 -0
  86. package/build/types/sell-apps/listing-management/sellInventoryV1Oas3.js +5 -0
  87. package/build/types/sell-apps/listing-metadata/sellMetadataV1Oas3.js +5 -0
  88. package/build/types/sell-apps/markeitng-and-promotions/sellMarketingV1Oas3.js +5 -0
  89. package/build/types/sell-apps/markeitng-and-promotions/sellRecommendationV1Oas3.js +5 -0
  90. package/build/types/sell-apps/order-management/sellFulfillmentV1Oas3.js +5 -0
  91. package/build/types/sell-apps/other-apis/commerceIdentityV1Oas3.js +5 -0
  92. package/build/types/sell-apps/other-apis/commerceTranslationV1BetaOas3.js +5 -0
  93. package/build/types/sell-apps/other-apis/commerceVeroV1Oas3.js +5 -0
  94. package/build/types/sell-apps/other-apis/sellComplianceV1Oas3.js +5 -0
  95. package/build/types/sell-apps/other-apis/sellEdeliveryInternationalShippingOas3.js +5 -0
  96. package/build/types/sell-apps/other-apis/sellMarketingV1Oas3.js +5 -0
  97. package/build/types/sell-apps/other-apis/sellRecommendationV1Oas3.js +5 -0
  98. package/build/utils/account-management/account.js +831 -0
  99. package/build/utils/api-status-feed.js +83 -0
  100. package/build/utils/communication/feedback.js +216 -0
  101. package/build/utils/communication/message.js +242 -0
  102. package/build/utils/communication/negotiation.js +150 -0
  103. package/build/utils/communication/notification.js +369 -0
  104. package/build/utils/date-converter.js +160 -0
  105. package/build/utils/llm-client-detector.js +758 -0
  106. package/build/utils/logger.js +198 -0
  107. package/build/utils/oauth-helper.js +315 -0
  108. package/build/utils/order-management/dispute.js +369 -0
  109. package/build/utils/order-management/fulfillment.js +205 -0
  110. package/build/utils/other/compliance.js +76 -0
  111. package/build/utils/other/edelivery.js +241 -0
  112. package/build/utils/other/identity.js +13 -0
  113. package/build/utils/other/translation.js +41 -0
  114. package/build/utils/other/vero.js +90 -0
  115. package/build/utils/scope-helper.js +207 -0
  116. package/build/utils/security-checker.js +248 -0
  117. package/build/utils/setup-validator.js +305 -0
  118. package/build/utils/token-utils.js +40 -0
  119. package/build/utils/version.js +56 -0
  120. package/docs/auth/production_scopes.json +111 -0
  121. package/docs/auth/sandbox_scopes.json +142 -0
  122. package/package.json +122 -0
  123. package/public/icons/1024x1024.png +0 -0
  124. package/public/icons/128x128.png +0 -0
  125. package/public/icons/16x16.png +0 -0
  126. package/public/icons/256x256.png +0 -0
  127. package/public/icons/32x32.png +0 -0
  128. package/public/icons/48x48.png +0 -0
  129. package/public/icons/512x512.png +0 -0
@@ -0,0 +1,640 @@
1
+ /**
2
+ * Inventory API - Manage listings and inventory
3
+ * Based on: docs/sell-apps/listing-management/sell_inventory_v1_oas3.json
4
+ */
5
+ export class InventoryApi {
6
+ client;
7
+ basePath = '/sell/inventory/v1';
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /**
12
+ * Get all inventory items
13
+ * @throws Error if parameters are invalid
14
+ */
15
+ async getInventoryItems(limit, offset) {
16
+ const params = {};
17
+ if (limit !== undefined) {
18
+ if (typeof limit !== 'number' || limit < 1) {
19
+ throw new Error('limit must be a positive number when provided');
20
+ }
21
+ params.limit = limit;
22
+ }
23
+ if (offset !== undefined) {
24
+ if (typeof offset !== 'number' || offset < 0) {
25
+ throw new Error('offset must be a non-negative number when provided');
26
+ }
27
+ params.offset = offset;
28
+ }
29
+ try {
30
+ return await this.client.get(`${this.basePath}/inventory_item`, params);
31
+ }
32
+ catch (error) {
33
+ throw new Error(`Failed to get inventory items: ${error instanceof Error ? error.message : 'Unknown error'}`);
34
+ }
35
+ }
36
+ /**
37
+ * Get a specific inventory item
38
+ * @throws Error if required parameters are missing or invalid
39
+ */
40
+ async getInventoryItem(sku) {
41
+ if (!sku || typeof sku !== 'string') {
42
+ throw new Error('sku is required and must be a string');
43
+ }
44
+ try {
45
+ return await this.client.get(`${this.basePath}/inventory_item/${sku}`);
46
+ }
47
+ catch (error) {
48
+ throw new Error(`Failed to get inventory item: ${error instanceof Error ? error.message : 'Unknown error'}`);
49
+ }
50
+ }
51
+ /**
52
+ * Create or replace an inventory item
53
+ * @throws Error if required parameters are missing or invalid
54
+ */
55
+ async createOrReplaceInventoryItem(sku, inventoryItem) {
56
+ if (!sku || typeof sku !== 'string') {
57
+ throw new Error('sku is required and must be a string');
58
+ }
59
+ if (!inventoryItem || typeof inventoryItem !== 'object') {
60
+ throw new Error('inventoryItem is required and must be an object');
61
+ }
62
+ try {
63
+ return await this.client.put(`${this.basePath}/inventory_item/${sku}`, inventoryItem);
64
+ }
65
+ catch (error) {
66
+ throw new Error(`Failed to create or replace inventory item: ${error instanceof Error ? error.message : 'Unknown error'}`);
67
+ }
68
+ }
69
+ /**
70
+ * Delete an inventory item
71
+ * @throws Error if required parameters are missing or invalid
72
+ */
73
+ async deleteInventoryItem(sku) {
74
+ if (!sku || typeof sku !== 'string') {
75
+ throw new Error('sku is required and must be a string');
76
+ }
77
+ try {
78
+ return await this.client.delete(`${this.basePath}/inventory_item/${sku}`);
79
+ }
80
+ catch (error) {
81
+ throw new Error(`Failed to delete inventory item: ${error instanceof Error ? error.message : 'Unknown error'}`);
82
+ }
83
+ }
84
+ /**
85
+ * Bulk create or replace inventory items
86
+ * Endpoint: POST /bulk_create_or_replace_inventory_item
87
+ * @throws Error if required parameters are missing or invalid
88
+ */
89
+ async bulkCreateOrReplaceInventoryItem(requests) {
90
+ if (!requests || typeof requests !== 'object') {
91
+ throw new Error('requests is required and must be an object');
92
+ }
93
+ try {
94
+ return await this.client.post(`${this.basePath}/bulk_create_or_replace_inventory_item`, requests);
95
+ }
96
+ catch (error) {
97
+ throw new Error(`Failed to bulk create or replace inventory items: ${error instanceof Error ? error.message : 'Unknown error'}`);
98
+ }
99
+ }
100
+ /**
101
+ * Bulk get inventory items
102
+ * Endpoint: POST /bulk_get_inventory_item
103
+ * @throws Error if required parameters are missing or invalid
104
+ */
105
+ async bulkGetInventoryItem(requests) {
106
+ if (!requests || typeof requests !== 'object') {
107
+ throw new Error('requests is required and must be an object');
108
+ }
109
+ try {
110
+ return await this.client.post(`${this.basePath}/bulk_get_inventory_item`, requests);
111
+ }
112
+ catch (error) {
113
+ throw new Error(`Failed to bulk get inventory items: ${error instanceof Error ? error.message : 'Unknown error'}`);
114
+ }
115
+ }
116
+ /**
117
+ * Bulk update price and quantity
118
+ * Endpoint: POST /bulk_update_price_quantity
119
+ * @throws Error if required parameters are missing or invalid
120
+ */
121
+ async bulkUpdatePriceQuantity(requests) {
122
+ if (!requests || typeof requests !== 'object') {
123
+ throw new Error('requests is required and must be an object');
124
+ }
125
+ try {
126
+ return await this.client.post(`${this.basePath}/bulk_update_price_quantity`, requests);
127
+ }
128
+ catch (error) {
129
+ throw new Error(`Failed to bulk update price and quantity: ${error instanceof Error ? error.message : 'Unknown error'}`);
130
+ }
131
+ }
132
+ /**
133
+ * Get product compatibility for an inventory item
134
+ * Endpoint: GET /inventory_item/{sku}/product_compatibility
135
+ * @throws Error if required parameters are missing or invalid
136
+ */
137
+ async getProductCompatibility(sku) {
138
+ if (!sku || typeof sku !== 'string') {
139
+ throw new Error('sku is required and must be a string');
140
+ }
141
+ try {
142
+ return await this.client.get(`${this.basePath}/inventory_item/${sku}/product_compatibility`);
143
+ }
144
+ catch (error) {
145
+ throw new Error(`Failed to get product compatibility: ${error instanceof Error ? error.message : 'Unknown error'}`);
146
+ }
147
+ }
148
+ /**
149
+ * Create or replace product compatibility for an inventory item
150
+ * Endpoint: PUT /inventory_item/{sku}/product_compatibility
151
+ * @throws Error if required parameters are missing or invalid
152
+ */
153
+ async createOrReplaceProductCompatibility(sku, compatibility) {
154
+ if (!sku || typeof sku !== 'string') {
155
+ throw new Error('sku is required and must be a string');
156
+ }
157
+ if (!compatibility || typeof compatibility !== 'object') {
158
+ throw new Error('compatibility is required and must be an object');
159
+ }
160
+ try {
161
+ return await this.client.put(`${this.basePath}/inventory_item/${sku}/product_compatibility`, compatibility);
162
+ }
163
+ catch (error) {
164
+ throw new Error(`Failed to create or replace product compatibility: ${error instanceof Error ? error.message : 'Unknown error'}`);
165
+ }
166
+ }
167
+ /**
168
+ * Delete product compatibility for an inventory item
169
+ * Endpoint: DELETE /inventory_item/{sku}/product_compatibility
170
+ * @throws Error if required parameters are missing or invalid
171
+ */
172
+ async deleteProductCompatibility(sku) {
173
+ if (!sku || typeof sku !== 'string') {
174
+ throw new Error('sku is required and must be a string');
175
+ }
176
+ try {
177
+ return await this.client.delete(`${this.basePath}/inventory_item/${sku}/product_compatibility`);
178
+ }
179
+ catch (error) {
180
+ throw new Error(`Failed to delete product compatibility: ${error instanceof Error ? error.message : 'Unknown error'}`);
181
+ }
182
+ }
183
+ /**
184
+ * Get an inventory item group
185
+ * Endpoint: GET /inventory_item_group/{inventoryItemGroupKey}
186
+ * @throws Error if required parameters are missing or invalid
187
+ */
188
+ async getInventoryItemGroup(inventoryItemGroupKey) {
189
+ if (!inventoryItemGroupKey || typeof inventoryItemGroupKey !== 'string') {
190
+ throw new Error('inventoryItemGroupKey is required and must be a string');
191
+ }
192
+ try {
193
+ return await this.client.get(`${this.basePath}/inventory_item_group/${inventoryItemGroupKey}`);
194
+ }
195
+ catch (error) {
196
+ throw new Error(`Failed to get inventory item group: ${error instanceof Error ? error.message : 'Unknown error'}`);
197
+ }
198
+ }
199
+ /**
200
+ * Create or replace an inventory item group
201
+ * Endpoint: PUT /inventory_item_group/{inventoryItemGroupKey}
202
+ * @throws Error if required parameters are missing or invalid
203
+ */
204
+ async createOrReplaceInventoryItemGroup(inventoryItemGroupKey, inventoryItemGroup) {
205
+ if (!inventoryItemGroupKey || typeof inventoryItemGroupKey !== 'string') {
206
+ throw new Error('inventoryItemGroupKey is required and must be a string');
207
+ }
208
+ if (!inventoryItemGroup || typeof inventoryItemGroup !== 'object') {
209
+ throw new Error('inventoryItemGroup is required and must be an object');
210
+ }
211
+ try {
212
+ return await this.client.put(`${this.basePath}/inventory_item_group/${inventoryItemGroupKey}`, inventoryItemGroup);
213
+ }
214
+ catch (error) {
215
+ throw new Error(`Failed to create or replace inventory item group: ${error instanceof Error ? error.message : 'Unknown error'}`);
216
+ }
217
+ }
218
+ /**
219
+ * Delete an inventory item group
220
+ * Endpoint: DELETE /inventory_item_group/{inventoryItemGroupKey}
221
+ * @throws Error if required parameters are missing or invalid
222
+ */
223
+ async deleteInventoryItemGroup(inventoryItemGroupKey) {
224
+ if (!inventoryItemGroupKey || typeof inventoryItemGroupKey !== 'string') {
225
+ throw new Error('inventoryItemGroupKey is required and must be a string');
226
+ }
227
+ try {
228
+ return await this.client.delete(`${this.basePath}/inventory_item_group/${inventoryItemGroupKey}`);
229
+ }
230
+ catch (error) {
231
+ throw new Error(`Failed to delete inventory item group: ${error instanceof Error ? error.message : 'Unknown error'}`);
232
+ }
233
+ }
234
+ /**
235
+ * Get all inventory locations
236
+ * Endpoint: GET /location
237
+ * @throws Error if parameters are invalid
238
+ */
239
+ async getInventoryLocations(limit, offset) {
240
+ const params = {};
241
+ if (limit !== undefined) {
242
+ if (typeof limit !== 'number' || limit < 1) {
243
+ throw new Error('limit must be a positive number when provided');
244
+ }
245
+ params.limit = limit;
246
+ }
247
+ if (offset !== undefined) {
248
+ if (typeof offset !== 'number' || offset < 0) {
249
+ throw new Error('offset must be a non-negative number when provided');
250
+ }
251
+ params.offset = offset;
252
+ }
253
+ try {
254
+ return await this.client.get(`${this.basePath}/location`, params);
255
+ }
256
+ catch (error) {
257
+ throw new Error(`Failed to get inventory locations: ${error instanceof Error ? error.message : 'Unknown error'}`);
258
+ }
259
+ }
260
+ /**
261
+ * Get a specific inventory location
262
+ * Endpoint: GET /location/{merchantLocationKey}
263
+ * @throws Error if required parameters are missing or invalid
264
+ */
265
+ async getInventoryLocation(merchantLocationKey) {
266
+ if (!merchantLocationKey || typeof merchantLocationKey !== 'string') {
267
+ throw new Error('merchantLocationKey is required and must be a string');
268
+ }
269
+ try {
270
+ return await this.client.get(`${this.basePath}/location/${merchantLocationKey}`);
271
+ }
272
+ catch (error) {
273
+ throw new Error(`Failed to get inventory location: ${error instanceof Error ? error.message : 'Unknown error'}`);
274
+ }
275
+ }
276
+ /**
277
+ * Create or replace an inventory location
278
+ * Endpoint: POST /location/{merchantLocationKey}
279
+ * @throws Error if required parameters are missing or invalid
280
+ */
281
+ async createOrReplaceInventoryLocation(merchantLocationKey, location) {
282
+ if (!merchantLocationKey || typeof merchantLocationKey !== 'string') {
283
+ throw new Error('merchantLocationKey is required and must be a string');
284
+ }
285
+ if (!location || typeof location !== 'object') {
286
+ throw new Error('location is required and must be an object');
287
+ }
288
+ try {
289
+ return await this.client.post(`${this.basePath}/location/${merchantLocationKey}`, location);
290
+ }
291
+ catch (error) {
292
+ throw new Error(`Failed to create or replace inventory location: ${error instanceof Error ? error.message : 'Unknown error'}`);
293
+ }
294
+ }
295
+ /**
296
+ * Delete an inventory location
297
+ * Endpoint: DELETE /location/{merchantLocationKey}
298
+ * @throws Error if required parameters are missing or invalid
299
+ */
300
+ async deleteInventoryLocation(merchantLocationKey) {
301
+ if (!merchantLocationKey || typeof merchantLocationKey !== 'string') {
302
+ throw new Error('merchantLocationKey is required and must be a string');
303
+ }
304
+ try {
305
+ return await this.client.delete(`${this.basePath}/location/${merchantLocationKey}`);
306
+ }
307
+ catch (error) {
308
+ throw new Error(`Failed to delete inventory location: ${error instanceof Error ? error.message : 'Unknown error'}`);
309
+ }
310
+ }
311
+ /**
312
+ * Disable an inventory location
313
+ * Endpoint: POST /location/{merchantLocationKey}/disable
314
+ * @throws Error if required parameters are missing or invalid
315
+ */
316
+ async disableInventoryLocation(merchantLocationKey) {
317
+ if (!merchantLocationKey || typeof merchantLocationKey !== 'string') {
318
+ throw new Error('merchantLocationKey is required and must be a string');
319
+ }
320
+ try {
321
+ return await this.client.post(`${this.basePath}/location/${merchantLocationKey}/disable`, {});
322
+ }
323
+ catch (error) {
324
+ throw new Error(`Failed to disable inventory location: ${error instanceof Error ? error.message : 'Unknown error'}`);
325
+ }
326
+ }
327
+ /**
328
+ * Enable an inventory location
329
+ * Endpoint: POST /location/{merchantLocationKey}/enable
330
+ * @throws Error if required parameters are missing or invalid
331
+ */
332
+ async enableInventoryLocation(merchantLocationKey) {
333
+ if (!merchantLocationKey || typeof merchantLocationKey !== 'string') {
334
+ throw new Error('merchantLocationKey is required and must be a string');
335
+ }
336
+ try {
337
+ return await this.client.post(`${this.basePath}/location/${merchantLocationKey}/enable`, {});
338
+ }
339
+ catch (error) {
340
+ throw new Error(`Failed to enable inventory location: ${error instanceof Error ? error.message : 'Unknown error'}`);
341
+ }
342
+ }
343
+ /**
344
+ * Update location details
345
+ * Endpoint: POST /location/{merchantLocationKey}/update_location_details
346
+ * @throws Error if required parameters are missing or invalid
347
+ */
348
+ async updateLocationDetails(merchantLocationKey, locationDetails) {
349
+ if (!merchantLocationKey || typeof merchantLocationKey !== 'string') {
350
+ throw new Error('merchantLocationKey is required and must be a string');
351
+ }
352
+ if (!locationDetails || typeof locationDetails !== 'object') {
353
+ throw new Error('locationDetails is required and must be an object');
354
+ }
355
+ try {
356
+ return await this.client.post(`${this.basePath}/location/${merchantLocationKey}/update_location_details`, locationDetails);
357
+ }
358
+ catch (error) {
359
+ throw new Error(`Failed to update location details: ${error instanceof Error ? error.message : 'Unknown error'}`);
360
+ }
361
+ }
362
+ /**
363
+ * Get all offers
364
+ * @throws Error if parameters are invalid
365
+ */
366
+ async getOffers(sku, marketplaceId, limit) {
367
+ const params = {};
368
+ if (sku !== undefined) {
369
+ if (typeof sku !== 'string') {
370
+ throw new Error('sku must be a string when provided');
371
+ }
372
+ params.sku = sku;
373
+ }
374
+ if (marketplaceId !== undefined) {
375
+ if (typeof marketplaceId !== 'string') {
376
+ throw new Error('marketplaceId must be a string when provided');
377
+ }
378
+ params.marketplace_id = marketplaceId;
379
+ }
380
+ if (limit !== undefined) {
381
+ if (typeof limit !== 'number' || limit < 1) {
382
+ throw new Error('limit must be a positive number when provided');
383
+ }
384
+ params.limit = limit;
385
+ }
386
+ try {
387
+ return await this.client.get(`${this.basePath}/offer`, params);
388
+ }
389
+ catch (error) {
390
+ throw new Error(`Failed to get offers: ${error instanceof Error ? error.message : 'Unknown error'}`);
391
+ }
392
+ }
393
+ /**
394
+ * Get a specific offer
395
+ * Endpoint: GET /offer/{offerId}
396
+ * @throws Error if required parameters are missing or invalid
397
+ */
398
+ async getOffer(offerId) {
399
+ if (!offerId || typeof offerId !== 'string') {
400
+ throw new Error('offerId is required and must be a string');
401
+ }
402
+ try {
403
+ return await this.client.get(`${this.basePath}/offer/${offerId}`);
404
+ }
405
+ catch (error) {
406
+ throw new Error(`Failed to get offer: ${error instanceof Error ? error.message : 'Unknown error'}`);
407
+ }
408
+ }
409
+ /**
410
+ * Create an offer
411
+ * @throws Error if required parameters are missing or invalid
412
+ */
413
+ async createOffer(offer) {
414
+ if (!offer || typeof offer !== 'object') {
415
+ throw new Error('offer is required and must be an object');
416
+ }
417
+ try {
418
+ return await this.client.post(`${this.basePath}/offer`, offer);
419
+ }
420
+ catch (error) {
421
+ throw new Error(`Failed to create offer: ${error instanceof Error ? error.message : 'Unknown error'}`);
422
+ }
423
+ }
424
+ /**
425
+ * Update an offer
426
+ * Endpoint: PUT /offer/{offerId}
427
+ * @throws Error if required parameters are missing or invalid
428
+ */
429
+ async updateOffer(offerId, offer) {
430
+ if (!offerId || typeof offerId !== 'string') {
431
+ throw new Error('offerId is required and must be a string');
432
+ }
433
+ if (!offer || typeof offer !== 'object') {
434
+ throw new Error('offer is required and must be an object');
435
+ }
436
+ try {
437
+ return await this.client.put(`${this.basePath}/offer/${offerId}`, offer);
438
+ }
439
+ catch (error) {
440
+ throw new Error(`Failed to update offer: ${error instanceof Error ? error.message : 'Unknown error'}`);
441
+ }
442
+ }
443
+ /**
444
+ * Delete an offer
445
+ * Endpoint: DELETE /offer/{offerId}
446
+ * @throws Error if required parameters are missing or invalid
447
+ */
448
+ async deleteOffer(offerId) {
449
+ if (!offerId || typeof offerId !== 'string') {
450
+ throw new Error('offerId is required and must be a string');
451
+ }
452
+ try {
453
+ return await this.client.delete(`${this.basePath}/offer/${offerId}`);
454
+ }
455
+ catch (error) {
456
+ throw new Error(`Failed to delete offer: ${error instanceof Error ? error.message : 'Unknown error'}`);
457
+ }
458
+ }
459
+ /**
460
+ * Publish an offer
461
+ * @throws Error if required parameters are missing or invalid
462
+ */
463
+ async publishOffer(offerId) {
464
+ if (!offerId || typeof offerId !== 'string') {
465
+ throw new Error('offerId is required and must be a string');
466
+ }
467
+ try {
468
+ return await this.client.post(`${this.basePath}/offer/${offerId}/publish`);
469
+ }
470
+ catch (error) {
471
+ throw new Error(`Failed to publish offer: ${error instanceof Error ? error.message : 'Unknown error'}`);
472
+ }
473
+ }
474
+ /**
475
+ * Withdraw an offer
476
+ * Endpoint: POST /offer/{offerId}/withdraw
477
+ * @throws Error if required parameters are missing or invalid
478
+ */
479
+ async withdrawOffer(offerId) {
480
+ if (!offerId || typeof offerId !== 'string') {
481
+ throw new Error('offerId is required and must be a string');
482
+ }
483
+ try {
484
+ return await this.client.post(`${this.basePath}/offer/${offerId}/withdraw`, {});
485
+ }
486
+ catch (error) {
487
+ throw new Error(`Failed to withdraw offer: ${error instanceof Error ? error.message : 'Unknown error'}`);
488
+ }
489
+ }
490
+ /**
491
+ * Bulk create offers
492
+ * Endpoint: POST /bulk_create_offer
493
+ * @throws Error if required parameters are missing or invalid
494
+ */
495
+ async bulkCreateOffer(requests) {
496
+ if (!requests || typeof requests !== 'object') {
497
+ throw new Error('requests is required and must be an object');
498
+ }
499
+ try {
500
+ return await this.client.post(`${this.basePath}/bulk_create_offer`, requests);
501
+ }
502
+ catch (error) {
503
+ throw new Error(`Failed to bulk create offers: ${error instanceof Error ? error.message : 'Unknown error'}`);
504
+ }
505
+ }
506
+ /**
507
+ * Bulk publish offers
508
+ * Endpoint: POST /bulk_publish_offer
509
+ * @throws Error if required parameters are missing or invalid
510
+ */
511
+ async bulkPublishOffer(requests) {
512
+ if (!requests || typeof requests !== 'object') {
513
+ throw new Error('requests is required and must be an object');
514
+ }
515
+ try {
516
+ return await this.client.post(`${this.basePath}/bulk_publish_offer`, requests);
517
+ }
518
+ catch (error) {
519
+ throw new Error(`Failed to bulk publish offers: ${error instanceof Error ? error.message : 'Unknown error'}`);
520
+ }
521
+ }
522
+ /**
523
+ * Get listing fees for offers
524
+ * Endpoint: POST /offer/get_listing_fees
525
+ * @throws Error if required parameters are missing or invalid
526
+ */
527
+ async getListingFees(offers) {
528
+ if (!offers || typeof offers !== 'object') {
529
+ throw new Error('offers is required and must be an object');
530
+ }
531
+ try {
532
+ return await this.client.post(`${this.basePath}/offer/get_listing_fees`, offers);
533
+ }
534
+ catch (error) {
535
+ throw new Error(`Failed to get listing fees: ${error instanceof Error ? error.message : 'Unknown error'}`);
536
+ }
537
+ }
538
+ /**
539
+ * Bulk migrate listings
540
+ * Endpoint: POST /bulk_migrate_listing
541
+ * @throws Error if required parameters are missing or invalid
542
+ */
543
+ async bulkMigrateListing(requests) {
544
+ if (!requests || typeof requests !== 'object') {
545
+ throw new Error('requests is required and must be an object');
546
+ }
547
+ try {
548
+ return await this.client.post(`${this.basePath}/bulk_migrate_listing`, requests);
549
+ }
550
+ catch (error) {
551
+ throw new Error(`Failed to bulk migrate listings: ${error instanceof Error ? error.message : 'Unknown error'}`);
552
+ }
553
+ }
554
+ /**
555
+ * Get listing's inventory locations (SKU location mapping)
556
+ * Endpoint: GET /listing/{listingId}/sku/{sku}/locations
557
+ * @throws Error if required parameters are missing or invalid
558
+ */
559
+ async getListingLocations(listingId, sku) {
560
+ if (!listingId || typeof listingId !== 'string') {
561
+ throw new Error('listingId is required and must be a string');
562
+ }
563
+ if (!sku || typeof sku !== 'string') {
564
+ throw new Error('sku is required and must be a string');
565
+ }
566
+ try {
567
+ return await this.client.get(`${this.basePath}/listing/${listingId}/sku/${sku}/locations`);
568
+ }
569
+ catch (error) {
570
+ throw new Error(`Failed to get listing locations: ${error instanceof Error ? error.message : 'Unknown error'}`);
571
+ }
572
+ }
573
+ async createOrReplaceSkuLocationMapping(listingId, sku, locationMapping) {
574
+ if (!listingId || typeof listingId !== 'string') {
575
+ throw new Error('listingId is required and must be a string');
576
+ }
577
+ if (!sku || typeof sku !== 'string') {
578
+ throw new Error('sku is required and must be a string');
579
+ }
580
+ if (!locationMapping || typeof locationMapping !== 'object') {
581
+ throw new Error('locationMapping is required and must be an object');
582
+ }
583
+ try {
584
+ return await this.client.put(`${this.basePath}/listing/${listingId}/sku/${sku}/locations`, locationMapping, {
585
+ headers: {
586
+ 'Content-Type': 'application/json',
587
+ },
588
+ });
589
+ }
590
+ catch (error) {
591
+ throw new Error(`Failed to create or replace SKU location mapping: ${error instanceof Error ? error.message : 'Unknown error'}`);
592
+ }
593
+ }
594
+ async deleteSkuLocationMapping(listingId, sku) {
595
+ if (!listingId || typeof listingId !== 'string') {
596
+ throw new Error('listingId is required and must be a string');
597
+ }
598
+ if (!sku || typeof sku !== 'string') {
599
+ throw new Error('sku is required and must be a string');
600
+ }
601
+ try {
602
+ return await this.client.delete(`${this.basePath}/listing/${listingId}/sku/${sku}/locations`);
603
+ }
604
+ catch (error) {
605
+ throw new Error(`Failed to delete SKU location mapping: ${error instanceof Error ? error.message : 'Unknown error'}`);
606
+ }
607
+ }
608
+ /**
609
+ * Publish offer by inventory item group
610
+ * Endpoint: POST /offer/publish_by_inventory_item_group
611
+ * @throws Error if required parameters are missing or invalid
612
+ */
613
+ async publishOfferByInventoryItemGroup(request) {
614
+ if (!request || typeof request !== 'object') {
615
+ throw new Error('request is required and must be an object');
616
+ }
617
+ try {
618
+ return await this.client.post(`${this.basePath}/offer/publish_by_inventory_item_group`, request);
619
+ }
620
+ catch (error) {
621
+ throw new Error(`Failed to publish offer by inventory item group: ${error instanceof Error ? error.message : 'Unknown error'}`);
622
+ }
623
+ }
624
+ /**
625
+ * Withdraw offer by inventory item group
626
+ * Endpoint: POST /offer/withdraw_by_inventory_item_group
627
+ * @throws Error if required parameters are missing or invalid
628
+ */
629
+ async withdrawOfferByInventoryItemGroup(request) {
630
+ if (!request || typeof request !== 'object') {
631
+ throw new Error('request is required and must be an object');
632
+ }
633
+ try {
634
+ return await this.client.post(`${this.basePath}/offer/withdraw_by_inventory_item_group`, request);
635
+ }
636
+ catch (error) {
637
+ throw new Error(`Failed to withdraw offer by inventory item group: ${error instanceof Error ? error.message : 'Unknown error'}`);
638
+ }
639
+ }
640
+ }