ebay-mcp 1.13.2 → 1.14.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 (169) hide show
  1. package/README.de.md +3 -3
  2. package/README.es.md +3 -3
  3. package/README.fr.md +3 -3
  4. package/README.ja.md +3 -3
  5. package/README.ko.md +3 -3
  6. package/README.md +163 -41
  7. package/README.pt-BR.md +3 -3
  8. package/README.ru.md +3 -3
  9. package/README.zh-CN.md +3 -3
  10. package/build/api/account-management/account.js +633 -297
  11. package/build/api/analytics-and-report/analytics.js +111 -65
  12. package/build/api/client.js +199 -140
  13. package/build/api/clientRequestError.js +23 -0
  14. package/build/api/clientTrading.js +213 -0
  15. package/build/api/clientTradingError.js +4 -0
  16. package/build/api/communication/feedback.js +147 -59
  17. package/build/api/communication/message.js +134 -81
  18. package/build/api/communication/negotiation.js +65 -53
  19. package/build/api/communication/notification.js +458 -164
  20. package/build/api/developer/developer.js +99 -45
  21. package/build/api/index.js +23 -8
  22. package/build/api/listing-management/inventory.js +884 -338
  23. package/build/api/listing-metadata/metadata.js +416 -170
  24. package/build/api/listing-metadata/taxonomy.js +187 -42
  25. package/build/api/marketing-and-promotions/marketing.js +1392 -598
  26. package/build/api/marketing-and-promotions/recommendation.js +49 -24
  27. package/build/api/order-management/dispute.js +226 -45
  28. package/build/api/order-management/fulfillment.js +144 -71
  29. package/build/api/order-management/orderIssueHelpers.js +61 -0
  30. package/build/api/other/compliance.js +50 -38
  31. package/build/api/other/edelivery.js +603 -159
  32. package/build/api/other/finding.js +280 -0
  33. package/build/api/other/identity.js +30 -15
  34. package/build/api/other/translation.js +29 -14
  35. package/build/api/other/vero.js +113 -27
  36. package/build/api/rateLimitTracker.js +55 -0
  37. package/build/api/shared/request.js +189 -98
  38. package/build/api/trading/trading.js +154 -87
  39. package/build/auth/credentialSession.js +250 -0
  40. package/build/auth/oauth.js +298 -171
  41. package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
  42. package/build/auth/oauthMiddleware.js +104 -0
  43. package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
  44. package/build/auth/tokenVerifier.js +243 -0
  45. package/build/auth/tokenVerifierError.js +21 -0
  46. package/build/config/environment.js +148 -113
  47. package/build/config/{tool-families.js → toolFamilies.js} +30 -14
  48. package/build/index.js +25 -19
  49. package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
  50. package/build/mcp/readOnlyFilter.js +67 -0
  51. package/build/mcp/runtime.js +31 -13
  52. package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
  53. package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
  54. package/build/schemas/account-management/account.js +144 -6
  55. package/build/schemas/analytics/analytics.js +33 -19
  56. package/build/schemas/communication/messages.js +12 -42
  57. package/build/schemas/developer/developer.js +135 -0
  58. package/build/schemas/fulfillment/orders.js +183 -21
  59. package/build/schemas/index.js +27 -19
  60. package/build/schemas/inventory-management/inventory.js +17 -9
  61. package/build/schemas/marketing/marketing.js +480 -25
  62. package/build/schemas/metadata/metadata.js +11 -6
  63. package/build/schemas/other/finding.js +27 -0
  64. package/build/schemas/other/otherApis.js +424 -0
  65. package/build/schemas/taxonomy/taxonomy.js +11 -5
  66. package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
  67. package/build/scripts/{build-ui.js → buildUi.js} +6 -1
  68. package/build/scripts/{dev-sync.js → devSync.js} +169 -110
  69. package/build/scripts/diagnostics.js +52 -44
  70. package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
  71. package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
  72. package/build/scripts/setup.js +241 -178
  73. package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
  74. package/build/scripts/skills.js +35 -27
  75. package/build/scripts/updateApiStatusDoc.js +71 -0
  76. package/build/serverHttp.js +90 -0
  77. package/build/skills/content.js +124 -118
  78. package/build/skills/index.js +22 -10
  79. package/build/skills/install.js +21 -10
  80. package/build/skills/markers.js +50 -15
  81. package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
  82. package/build/skills/render.js +41 -14
  83. package/build/skills/targets.js +49 -17
  84. package/build/tools/categories/account.js +166 -264
  85. package/build/tools/categories/analytics.js +11 -22
  86. package/build/tools/categories/browse.js +17 -0
  87. package/build/tools/categories/communication.js +124 -399
  88. package/build/tools/categories/connector.js +23 -20
  89. package/build/tools/categories/developer.js +46 -159
  90. package/build/tools/categories/fulfillment.js +84 -215
  91. package/build/tools/categories/index.js +6 -14
  92. package/build/tools/categories/inventory.js +238 -293
  93. package/build/tools/categories/marketing.js +677 -39
  94. package/build/tools/categories/metadata.js +190 -117
  95. package/build/tools/categories/other.js +81 -208
  96. package/build/tools/categories/taxonomy.js +29 -20
  97. package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
  98. package/build/tools/categories/trading.js +16 -47
  99. package/build/tools/contracts.js +34 -24
  100. package/build/tools/{define-tool.js → defineTool.js} +44 -29
  101. package/build/tools/registry.js +87 -29
  102. package/build/tools/schemas.js +3 -57
  103. package/build/tools/ui/archetypes.js +1 -0
  104. package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
  105. package/build/tools/ui/maps.js +294 -80
  106. package/build/types/index.js +1 -1
  107. package/build/ui/card.html +14 -14
  108. package/build/ui/chart.html +14 -14
  109. package/build/ui/stat.html +87 -0
  110. package/build/ui/table.html +14 -14
  111. package/build/utils/apiStatusFeed.js +95 -0
  112. package/build/utils/cliOutput.js +15 -0
  113. package/build/utils/cliUi.js +108 -0
  114. package/build/utils/communication/feedback.js +57 -77
  115. package/build/utils/communication/message.js +69 -98
  116. package/build/utils/communication/negotiation.js +30 -57
  117. package/build/utils/communication/notification.js +112 -252
  118. package/build/utils/{date-converter.js → dateConverter.js} +62 -30
  119. package/build/utils/effectSchema.js +203 -0
  120. package/build/utils/effectSchemaAdapter.js +121 -0
  121. package/build/utils/effectSchemaChainMethods.js +146 -0
  122. package/build/utils/effectSchemaRefinements.js +104 -0
  123. package/build/utils/effectSchemaStringMethods.js +63 -0
  124. package/build/utils/effectSchemaTypes.js +47 -0
  125. package/build/utils/{env-parser.js → envParser.js} +10 -2
  126. package/build/utils/errors.js +7 -3
  127. package/build/utils/http.js +148 -89
  128. package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
  129. package/build/utils/logger.js +127 -51
  130. package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
  131. package/build/utils/other/compliance.js +18 -38
  132. package/build/utils/other/identity.js +2 -2
  133. package/build/utils/other/translation.js +4 -4
  134. package/build/utils/other/vero.js +36 -20
  135. package/build/utils/schemaHelpers.js +22 -0
  136. package/build/utils/scopeHelper.js +270 -0
  137. package/build/utils/securityChecker.js +316 -0
  138. package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
  139. package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
  140. package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
  141. package/build/utils/trading/trading.js +35 -0
  142. package/build/utils/typeGuards.js +12 -0
  143. package/build/utils/version.js +65 -29
  144. package/package.json +10 -8
  145. package/build/api/client-trading.js +0 -124
  146. package/build/api/communication/shared.js +0 -59
  147. package/build/api/shared/query-params.js +0 -16
  148. package/build/auth/credential-session.js +0 -166
  149. package/build/auth/oauth-middleware.js +0 -100
  150. package/build/auth/token-verifier.js +0 -186
  151. package/build/schemas/other/other-apis.js +0 -390
  152. package/build/scripts/update-api-status-doc.js +0 -44
  153. package/build/server-http.js +0 -85
  154. package/build/tools/definitions/marketing.js +0 -1381
  155. package/build/tools/tool-handlers/marketing.js +0 -312
  156. package/build/utils/account-management/account.js +0 -818
  157. package/build/utils/api-status-feed.js +0 -84
  158. package/build/utils/cli-ui.js +0 -47
  159. package/build/utils/order-management/dispute.js +0 -369
  160. package/build/utils/order-management/fulfillment.js +0 -205
  161. package/build/utils/other/edelivery.js +0 -235
  162. package/build/utils/schema-helpers.js +0 -13
  163. package/build/utils/scope-helper.js +0 -207
  164. package/build/utils/security-checker.js +0 -248
  165. package/build/utils/type-guards.js +0 -6
  166. /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
  167. /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
  168. /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
  169. /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
@@ -1,346 +1,892 @@
1
- import { buildOptionalStringParams, buildValidatedPaginatedParams, optionalStringParam, requireObject, requireString, withApiError, } from '../shared/request.js';
2
- /**
3
- * Inventory API - Manage listings and inventory
4
- * Based on: docs/sell-apps/listing-management/sell_inventory_v1_oas3.json
5
- */
1
+ import { buildEndpointParams, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, optionalStringEffect, requestDeleteEffect, requestGetEffect, requestPostEffect, requestPutEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
2
+ import { Effect } from 'effect';
3
+ /** Inventory API - seller inventory, offers, locations, and SKU location mappings. */
6
4
  export class InventoryApi {
7
5
  client;
8
6
  basePath = '/sell/inventory/v1';
9
7
  constructor(client) {
10
8
  this.client = client;
11
9
  }
12
- async request(failureMessage, operation) {
13
- return await withApiError(failureMessage, operation);
14
- }
15
- /**
16
- * Get all inventory items
17
- * @throws Error if parameters are invalid
18
- */
19
- async getInventoryItems(limit, offset) {
20
- const params = buildValidatedPaginatedParams(undefined, limit, offset);
21
- return await this.request('Failed to get inventory items', () => this.client.get(`${this.basePath}/inventory_item`, params));
22
- }
23
- /**
24
- * Get a specific inventory item
25
- * @throws Error if required parameters are missing or invalid
26
- */
27
- async getInventoryItem(sku) {
28
- requireString(sku, 'sku');
29
- return await this.request('Failed to get inventory item', () => this.client.get(`${this.basePath}/inventory_item/${sku}`));
30
- }
31
- /**
32
- * Create or replace an inventory item
33
- * @throws Error if required parameters are missing or invalid
34
- */
35
- async createOrReplaceInventoryItem(sku, inventoryItem) {
36
- requireString(sku, 'sku');
37
- requireObject(inventoryItem, 'inventoryItem');
38
- return await this.request('Failed to create or replace inventory item', () => this.client.put(`${this.basePath}/inventory_item/${sku}`, inventoryItem));
39
- }
40
- /**
41
- * Delete an inventory item
42
- * @throws Error if required parameters are missing or invalid
43
- */
44
- async deleteInventoryItem(sku) {
45
- requireString(sku, 'sku');
46
- return await this.request('Failed to delete inventory item', () => this.client.delete(`${this.basePath}/inventory_item/${sku}`));
47
- }
48
- /**
49
- * Bulk create or replace inventory items
50
- * Endpoint: POST /bulk_create_or_replace_inventory_item
51
- * @throws Error if required parameters are missing or invalid
52
- */
53
- async bulkCreateOrReplaceInventoryItem(requests) {
54
- requireObject(requests, 'requests');
55
- return await this.request('Failed to bulk create or replace inventory items', () => this.client.post(`${this.basePath}/bulk_create_or_replace_inventory_item`, requests));
56
- }
57
- /**
58
- * Bulk get inventory items
59
- * Endpoint: POST /bulk_get_inventory_item
60
- * @throws Error if required parameters are missing or invalid
61
- */
62
- async bulkGetInventoryItem(requests) {
63
- requireObject(requests, 'requests');
64
- return await this.request('Failed to bulk get inventory items', () => this.client.post(`${this.basePath}/bulk_get_inventory_item`, requests));
65
- }
66
- /**
67
- * Bulk update price and quantity
68
- * Endpoint: POST /bulk_update_price_quantity
69
- * @throws Error if required parameters are missing or invalid
70
- */
71
- async bulkUpdatePriceQuantity(requests) {
72
- requireObject(requests, 'requests');
73
- return await this.request('Failed to bulk update price and quantity', () => this.client.post(`${this.basePath}/bulk_update_price_quantity`, requests));
74
- }
75
- /**
76
- * Get product compatibility for an inventory item
77
- * Endpoint: GET /inventory_item/{sku}/product_compatibility
78
- * @throws Error if required parameters are missing or invalid
79
- */
80
- async getProductCompatibility(sku) {
81
- requireString(sku, 'sku');
82
- return await this.request('Failed to get product compatibility', () => this.client.get(`${this.basePath}/inventory_item/${sku}/product_compatibility`));
83
- }
84
- /**
85
- * Create or replace product compatibility for an inventory item
86
- * Endpoint: PUT /inventory_item/{sku}/product_compatibility
87
- * @throws Error if required parameters are missing or invalid
88
- */
89
- async createOrReplaceProductCompatibility(sku, compatibility) {
90
- requireString(sku, 'sku');
91
- requireObject(compatibility, 'compatibility');
92
- return await this.request('Failed to create or replace product compatibility', () => this.client.put(`${this.basePath}/inventory_item/${sku}/product_compatibility`, compatibility));
93
- }
94
- /**
95
- * Delete product compatibility for an inventory item
96
- * Endpoint: DELETE /inventory_item/{sku}/product_compatibility
97
- * @throws Error if required parameters are missing or invalid
98
- */
99
- async deleteProductCompatibility(sku) {
100
- requireString(sku, 'sku');
101
- return await this.request('Failed to delete product compatibility', () => this.client.delete(`${this.basePath}/inventory_item/${sku}/product_compatibility`));
102
- }
103
- /**
104
- * Get an inventory item group
105
- * Endpoint: GET /inventory_item_group/{inventoryItemGroupKey}
106
- * @throws Error if required parameters are missing or invalid
107
- */
108
- async getInventoryItemGroup(inventoryItemGroupKey) {
109
- requireString(inventoryItemGroupKey, 'inventoryItemGroupKey');
110
- return await this.request('Failed to get inventory item group', () => this.client.get(`${this.basePath}/inventory_item_group/${inventoryItemGroupKey}`));
111
- }
112
- /**
113
- * Create or replace an inventory item group
114
- * Endpoint: PUT /inventory_item_group/{inventoryItemGroupKey}
115
- * @throws Error if required parameters are missing or invalid
116
- */
117
- async createOrReplaceInventoryItemGroup(inventoryItemGroupKey, inventoryItemGroup) {
118
- requireString(inventoryItemGroupKey, 'inventoryItemGroupKey');
119
- requireObject(inventoryItemGroup, 'inventoryItemGroup');
120
- return await this.request('Failed to create or replace inventory item group', () => this.client.put(`${this.basePath}/inventory_item_group/${inventoryItemGroupKey}`, inventoryItemGroup));
121
- }
122
- /**
123
- * Delete an inventory item group
124
- * Endpoint: DELETE /inventory_item_group/{inventoryItemGroupKey}
125
- * @throws Error if required parameters are missing or invalid
126
- */
127
- async deleteInventoryItemGroup(inventoryItemGroupKey) {
128
- requireString(inventoryItemGroupKey, 'inventoryItemGroupKey');
129
- return await this.request('Failed to delete inventory item group', () => this.client.delete(`${this.basePath}/inventory_item_group/${inventoryItemGroupKey}`));
130
- }
131
- /**
132
- * Get all inventory locations
133
- * Endpoint: GET /location
134
- * @throws Error if parameters are invalid
135
- */
136
- async getInventoryLocations(limit, offset) {
137
- const params = buildValidatedPaginatedParams(undefined, limit, offset);
138
- return await this.request('Failed to get inventory locations', () => this.client.get(`${this.basePath}/location`, params));
139
- }
140
- /**
141
- * Get a specific inventory location
142
- * Endpoint: GET /location/{merchantLocationKey}
143
- * @throws Error if required parameters are missing or invalid
144
- */
145
- async getInventoryLocation(merchantLocationKey) {
146
- requireString(merchantLocationKey, 'merchantLocationKey');
147
- return await this.request('Failed to get inventory location', () => this.client.get(`${this.basePath}/location/${merchantLocationKey}`));
148
- }
149
- /**
150
- * Create or replace an inventory location
151
- * Endpoint: POST /location/{merchantLocationKey}
152
- * @throws Error if required parameters are missing or invalid
153
- */
154
- async createOrReplaceInventoryLocation(merchantLocationKey, location) {
155
- requireString(merchantLocationKey, 'merchantLocationKey');
156
- requireObject(location, 'location');
157
- return await this.request('Failed to create or replace inventory location', () => this.client.post(`${this.basePath}/location/${merchantLocationKey}`, location));
158
- }
159
- /**
160
- * Delete an inventory location
161
- * Endpoint: DELETE /location/{merchantLocationKey}
162
- * @throws Error if required parameters are missing or invalid
163
- */
164
- async deleteInventoryLocation(merchantLocationKey) {
165
- requireString(merchantLocationKey, 'merchantLocationKey');
166
- return await this.request('Failed to delete inventory location', () => this.client.delete(`${this.basePath}/location/${merchantLocationKey}`));
167
- }
168
10
  /**
169
- * Disable an inventory location
170
- * Endpoint: POST /location/{merchantLocationKey}/disable
171
- * @throws Error if required parameters are missing or invalid
172
- */
173
- async disableInventoryLocation(merchantLocationKey) {
174
- requireString(merchantLocationKey, 'merchantLocationKey');
175
- return await this.request('Failed to disable inventory location', () => this.client.post(`${this.basePath}/location/${merchantLocationKey}/disable`, {}));
176
- }
177
- /**
178
- * Enable an inventory location
179
- * Endpoint: POST /location/{merchantLocationKey}/enable
180
- * @throws Error if required parameters are missing or invalid
181
- */
182
- async enableInventoryLocation(merchantLocationKey) {
183
- requireString(merchantLocationKey, 'merchantLocationKey');
184
- return await this.request('Failed to enable inventory location', () => this.client.post(`${this.basePath}/location/${merchantLocationKey}/enable`, {}));
185
- }
186
- /**
187
- * Update location details
188
- * Endpoint: POST /location/{merchantLocationKey}/update_location_details
189
- * @throws Error if required parameters are missing or invalid
190
- */
191
- async updateLocationDetails(merchantLocationKey, locationDetails) {
192
- requireString(merchantLocationKey, 'merchantLocationKey');
193
- requireObject(locationDetails, 'locationDetails');
194
- return await this.request('Failed to update location details', () => this.client.post(`${this.basePath}/location/${merchantLocationKey}/update_location_details`, locationDetails));
195
- }
196
- /**
197
- * Get all offers
198
- * @throws Error if parameters are invalid
199
- */
200
- async getOffers(sku, marketplaceId, limit) {
201
- const params = buildOptionalStringParams({ sku });
202
- const marketplaceIdParam = optionalStringParam(marketplaceId, 'marketplaceId');
203
- if (marketplaceIdParam) {
204
- params.marketplace_id = marketplaceIdParam;
205
- }
206
- if (limit !== undefined) {
207
- if (typeof limit !== 'number' || limit < 1) {
208
- throw new Error('limit must be a positive number when provided');
209
- }
210
- params.limit = limit;
211
- }
212
- return await this.request('Failed to get offers', () => this.client.get(`${this.basePath}/offer`, params));
213
- }
214
- /**
215
- * Get a specific offer
216
- * Endpoint: GET /offer/{offerId}
217
- * @throws Error if required parameters are missing or invalid
218
- */
219
- async getOffer(offerId) {
220
- requireString(offerId, 'offerId');
221
- return await this.request('Failed to get offer', () => this.client.get(`${this.basePath}/offer/${offerId}`));
222
- }
223
- /**
224
- * Create an offer
225
- * @throws Error if required parameters are missing or invalid
226
- */
227
- async createOffer(offer) {
228
- requireObject(offer, 'offer');
229
- return await this.request('Failed to create offer', () => this.client.post(`${this.basePath}/offer`, offer));
230
- }
231
- /**
232
- * Update an offer
233
- * Endpoint: PUT /offer/{offerId}
234
- * @throws Error if required parameters are missing or invalid
235
- */
236
- async updateOffer(offerId, offer) {
237
- requireString(offerId, 'offerId');
238
- requireObject(offer, 'offer');
239
- return await this.request('Failed to update offer', () => this.client.put(`${this.basePath}/offer/${offerId}`, offer));
240
- }
241
- /**
242
- * Delete an offer
243
- * Endpoint: DELETE /offer/{offerId}
244
- * @throws Error if required parameters are missing or invalid
245
- */
246
- async deleteOffer(offerId) {
247
- requireString(offerId, 'offerId');
248
- return await this.request('Failed to delete offer', () => this.client.delete(`${this.basePath}/offer/${offerId}`));
249
- }
250
- /**
251
- * Publish an offer
252
- * @throws Error if required parameters are missing or invalid
253
- */
254
- async publishOffer(offerId) {
255
- requireString(offerId, 'offerId');
256
- return await this.request('Failed to publish offer', () => this.client.post(`${this.basePath}/offer/${offerId}/publish`));
257
- }
258
- /**
259
- * Withdraw an offer
260
- * Endpoint: POST /offer/{offerId}/withdraw
261
- * @throws Error if required parameters are missing or invalid
262
- */
263
- async withdrawOffer(offerId) {
264
- requireString(offerId, 'offerId');
265
- return await this.request('Failed to withdraw offer', () => this.client.post(`${this.basePath}/offer/${offerId}/withdraw`, {}));
266
- }
267
- /**
268
- * Bulk create offers
269
- * Endpoint: POST /bulk_create_offer
270
- * @throws Error if required parameters are missing or invalid
271
- */
272
- async bulkCreateOffer(requests) {
273
- requireObject(requests, 'requests');
274
- return await this.request('Failed to bulk create offers', () => this.client.post(`${this.basePath}/bulk_create_offer`, requests));
275
- }
276
- /**
277
- * Bulk publish offers
278
- * Endpoint: POST /bulk_publish_offer
279
- * @throws Error if required parameters are missing or invalid
280
- */
281
- async bulkPublishOffer(requests) {
282
- requireObject(requests, 'requests');
283
- return await this.request('Failed to bulk publish offers', () => this.client.post(`${this.basePath}/bulk_publish_offer`, requests));
284
- }
285
- /**
286
- * Get listing fees for offers
287
- * Endpoint: POST /offer/get_listing_fees
288
- * @throws Error if required parameters are missing or invalid
289
- */
290
- async getListingFees(offers) {
291
- requireObject(offers, 'offers');
292
- return await this.request('Failed to get listing fees', () => this.client.post(`${this.basePath}/offer/get_listing_fees`, offers));
293
- }
294
- /**
295
- * Bulk migrate listings
296
- * Endpoint: POST /bulk_migrate_listing
297
- * @throws Error if required parameters are missing or invalid
298
- */
299
- async bulkMigrateListing(requests) {
300
- requireObject(requests, 'requests');
301
- return await this.request('Failed to bulk migrate listings', () => this.client.post(`${this.basePath}/bulk_migrate_listing`, requests));
302
- }
303
- /**
304
- * Get listing's inventory locations (SKU location mapping)
305
- * Endpoint: GET /listing/{listingId}/sku/{sku}/locations
306
- * @throws Error if required parameters are missing or invalid
307
- */
308
- async getListingLocations(listingId, sku) {
309
- requireString(listingId, 'listingId');
310
- requireString(sku, 'sku');
311
- return await this.request('Failed to get listing locations', () => this.client.get(`${this.basePath}/listing/${listingId}/sku/${sku}/locations`));
312
- }
313
- async createOrReplaceSkuLocationMapping(listingId, sku, locationMapping) {
314
- requireString(listingId, 'listingId');
315
- requireString(sku, 'sku');
316
- requireObject(locationMapping, 'locationMapping');
317
- return await this.request('Failed to create or replace SKU location mapping', () => this.client.put(`${this.basePath}/listing/${listingId}/sku/${sku}/locations`, locationMapping, {
318
- headers: {
319
- 'Content-Type': 'application/json',
320
- },
321
- }));
322
- }
323
- async deleteSkuLocationMapping(listingId, sku) {
324
- requireString(listingId, 'listingId');
325
- requireString(sku, 'sku');
326
- return await this.request('Failed to delete SKU location mapping', () => this.client.delete(`${this.basePath}/listing/${listingId}/sku/${sku}/locations`));
327
- }
328
- /**
329
- * Publish offer by inventory item group
330
- * Endpoint: POST /offer/publish_by_inventory_item_group
331
- * @throws Error if required parameters are missing or invalid
332
- */
333
- async publishOfferByInventoryItemGroup(request) {
334
- requireObject(request, 'request');
335
- return await this.request('Failed to publish offer by inventory item group', () => this.client.post(`${this.basePath}/offer/publish_by_inventory_item_group`, request));
336
- }
337
- /**
338
- * Withdraw offer by inventory item group
339
- * Endpoint: POST /offer/withdraw_by_inventory_item_group
340
- * @throws Error if required parameters are missing or invalid
341
- */
342
- async withdrawOfferByInventoryItemGroup(request) {
343
- requireObject(request, 'request');
344
- return await this.request('Failed to withdraw offer by inventory item group', () => this.client.post(`${this.basePath}/offer/withdraw_by_inventory_item_group`, request));
345
- }
11
+ * Retrieves paginated inventory items.
12
+ *
13
+ * @param input - Optional pagination controls.
14
+ * @returns An Effect that succeeds with eBay's InventoryItems response.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const items = await Effect.runPromise(inventoryApi.getInventoryItems({ limit: 25 }));
19
+ * ```
20
+ *
21
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/getInventoryItems
22
+ */
23
+ getInventoryItems = (input = {}) => {
24
+ const client = this.client;
25
+ const path = `${this.basePath}/inventory_item`;
26
+ return Effect.gen(function* () {
27
+ const validatedInput = yield* requireObjectEffect(input, 'input');
28
+ const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
29
+ const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
30
+ const params = buildEndpointParams({
31
+ limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
32
+ offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
33
+ });
34
+ return yield* requestGetEffect(client, path, params);
35
+ });
36
+ };
37
+ /**
38
+ * Retrieves one inventory item by SKU.
39
+ *
40
+ * @param input - Seller-defined SKU value.
41
+ * @returns An Effect that succeeds with eBay's InventoryItemWithSkuLocaleGroupid response.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const item = await Effect.runPromise(inventoryApi.getInventoryItem({ sku: 'SKU-1' }));
46
+ * ```
47
+ *
48
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/getInventoryItem
49
+ */
50
+ getInventoryItem = (input) => {
51
+ const client = this.client;
52
+ const basePath = this.basePath;
53
+ return Effect.gen(function* () {
54
+ const validatedInput = yield* requireObjectEffect(input, 'input');
55
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
56
+ return yield* requestGetEffect(client, `${basePath}/inventory_item/${sku}`);
57
+ });
58
+ };
59
+ /**
60
+ * Creates or replaces one inventory item by SKU.
61
+ *
62
+ * @param input - Seller-defined SKU and generated InventoryItem body.
63
+ * @returns An Effect that succeeds with eBay's BaseResponse.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * await Effect.runPromise(
68
+ * inventoryApi.createOrReplaceInventoryItem({ sku: 'SKU-1', body: { product: {} } }),
69
+ * );
70
+ * ```
71
+ *
72
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/createOrReplaceInventoryItem
73
+ */
74
+ createOrReplaceInventoryItem = (input) => {
75
+ const client = this.client;
76
+ const basePath = this.basePath;
77
+ return Effect.gen(function* () {
78
+ const validatedInput = yield* requireObjectEffect(input, 'input');
79
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
80
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
81
+ return yield* requestPutEffect(client, `${basePath}/inventory_item/${sku}`, body);
82
+ });
83
+ };
84
+ /**
85
+ * Deletes one inventory item by SKU.
86
+ *
87
+ * @param input - Seller-defined SKU value.
88
+ * @returns An Effect that succeeds when eBay returns no content.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * await Effect.runPromise(inventoryApi.deleteInventoryItem({ sku: 'SKU-1' }));
93
+ * ```
94
+ *
95
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/deleteInventoryItem
96
+ */
97
+ deleteInventoryItem = (input) => {
98
+ const client = this.client;
99
+ const basePath = this.basePath;
100
+ return Effect.gen(function* () {
101
+ const validatedInput = yield* requireObjectEffect(input, 'input');
102
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
103
+ return yield* requestDeleteEffect(client, `${basePath}/inventory_item/${sku}`);
104
+ });
105
+ };
106
+ /**
107
+ * Creates or replaces up to 25 inventory items.
108
+ *
109
+ * @param input - Generated BulkInventoryItem body.
110
+ * @returns An Effect that succeeds with eBay's BulkInventoryItemResponse.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * const result = await Effect.runPromise(
115
+ * inventoryApi.bulkCreateOrReplaceInventoryItem({ body: { requests: [] } }),
116
+ * );
117
+ * ```
118
+ *
119
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkCreateOrReplaceInventoryItem
120
+ */
121
+ bulkCreateOrReplaceInventoryItem = (input) => {
122
+ const client = this.client;
123
+ const path = `${this.basePath}/bulk_create_or_replace_inventory_item`;
124
+ return Effect.gen(function* () {
125
+ const validatedInput = yield* requireObjectEffect(input, 'input');
126
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
127
+ return yield* requestPostEffect(client, path, body);
128
+ });
129
+ };
130
+ /**
131
+ * Retrieves up to 25 inventory items by SKU.
132
+ *
133
+ * @param input - Generated BulkGetInventoryItem body.
134
+ * @returns An Effect that succeeds with eBay's BulkGetInventoryItemResponse.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * const result = await Effect.runPromise(
139
+ * inventoryApi.bulkGetInventoryItem({ body: { requests: [{ sku: 'SKU-1' }] } }),
140
+ * );
141
+ * ```
142
+ *
143
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkGetInventoryItem
144
+ */
145
+ bulkGetInventoryItem = (input) => {
146
+ const client = this.client;
147
+ const path = `${this.basePath}/bulk_get_inventory_item`;
148
+ return Effect.gen(function* () {
149
+ const validatedInput = yield* requireObjectEffect(input, 'input');
150
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
151
+ return yield* requestPostEffect(client, path, body);
152
+ });
153
+ };
154
+ /**
155
+ * Updates price and quantity for inventory items and offers.
156
+ *
157
+ * @param input - Generated BulkPriceQuantity body.
158
+ * @returns An Effect that succeeds with eBay's BulkPriceQuantityResponse.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * const result = await Effect.runPromise(
163
+ * inventoryApi.bulkUpdatePriceQuantity({ body: { requests: [] } }),
164
+ * );
165
+ * ```
166
+ *
167
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkUpdatePriceQuantity
168
+ */
169
+ bulkUpdatePriceQuantity = (input) => {
170
+ const client = this.client;
171
+ const path = `${this.basePath}/bulk_update_price_quantity`;
172
+ return Effect.gen(function* () {
173
+ const validatedInput = yield* requireObjectEffect(input, 'input');
174
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
175
+ return yield* requestPostEffect(client, path, body);
176
+ });
177
+ };
178
+ /**
179
+ * Retrieves product compatibility for one SKU.
180
+ *
181
+ * @param input - Seller-defined SKU value.
182
+ * @returns An Effect that succeeds with eBay's Compatibility response.
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * const compatibility = await Effect.runPromise(
187
+ * inventoryApi.getProductCompatibility({ sku: 'SKU-1' }),
188
+ * );
189
+ * ```
190
+ *
191
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/product_compatibility/methods/getProductCompatibility
192
+ */
193
+ getProductCompatibility = (input) => {
194
+ const client = this.client;
195
+ const basePath = this.basePath;
196
+ return Effect.gen(function* () {
197
+ const validatedInput = yield* requireObjectEffect(input, 'input');
198
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
199
+ return yield* requestGetEffect(client, `${basePath}/inventory_item/${sku}/product_compatibility`);
200
+ });
201
+ };
202
+ /**
203
+ * Creates or replaces product compatibility for one SKU.
204
+ *
205
+ * @param input - Seller-defined SKU and generated Compatibility body.
206
+ * @returns An Effect that succeeds with eBay's BaseResponse.
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * await Effect.runPromise(
211
+ * inventoryApi.createOrReplaceProductCompatibility({ sku: 'SKU-1', body: {} }),
212
+ * );
213
+ * ```
214
+ *
215
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/product_compatibility/methods/createOrReplaceProductCompatibility
216
+ */
217
+ createOrReplaceProductCompatibility = (input) => {
218
+ const client = this.client;
219
+ const basePath = this.basePath;
220
+ return Effect.gen(function* () {
221
+ const validatedInput = yield* requireObjectEffect(input, 'input');
222
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
223
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
224
+ return yield* requestPutEffect(client, `${basePath}/inventory_item/${sku}/product_compatibility`, body);
225
+ });
226
+ };
227
+ /**
228
+ * Deletes product compatibility for one SKU.
229
+ *
230
+ * @param input - Seller-defined SKU value.
231
+ * @returns An Effect that succeeds when eBay returns no content.
232
+ *
233
+ * @example
234
+ * ```ts
235
+ * await Effect.runPromise(inventoryApi.deleteProductCompatibility({ sku: 'SKU-1' }));
236
+ * ```
237
+ *
238
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/product_compatibility/methods/deleteProductCompatibility
239
+ */
240
+ deleteProductCompatibility = (input) => {
241
+ const client = this.client;
242
+ const basePath = this.basePath;
243
+ return Effect.gen(function* () {
244
+ const validatedInput = yield* requireObjectEffect(input, 'input');
245
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
246
+ return yield* requestDeleteEffect(client, `${basePath}/inventory_item/${sku}/product_compatibility`);
247
+ });
248
+ };
249
+ /**
250
+ * Retrieves one inventory item group.
251
+ *
252
+ * @param input - Seller-defined inventory item group key.
253
+ * @returns An Effect that succeeds with eBay's InventoryItemGroup response.
254
+ *
255
+ * @example
256
+ * ```ts
257
+ * const group = await Effect.runPromise(
258
+ * inventoryApi.getInventoryItemGroup({ inventoryItemGroupKey: 'GROUP-1' }),
259
+ * );
260
+ * ```
261
+ *
262
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item_group/methods/getInventoryItemGroup
263
+ */
264
+ getInventoryItemGroup = (input) => {
265
+ const client = this.client;
266
+ const basePath = this.basePath;
267
+ return Effect.gen(function* () {
268
+ const validatedInput = yield* requireObjectEffect(input, 'input');
269
+ const inventoryItemGroupKey = yield* requireStringEffect(validatedInput.inventoryItemGroupKey, 'inventoryItemGroupKey');
270
+ return yield* requestGetEffect(client, `${basePath}/inventory_item_group/${inventoryItemGroupKey}`);
271
+ });
272
+ };
273
+ /**
274
+ * Creates or replaces one inventory item group.
275
+ *
276
+ * @param input - Seller-defined inventory item group key and generated InventoryItemGroup body.
277
+ * @returns An Effect that succeeds with eBay's BaseResponse.
278
+ *
279
+ * @example
280
+ * ```ts
281
+ * await Effect.runPromise(
282
+ * inventoryApi.createOrReplaceInventoryItemGroup({
283
+ * inventoryItemGroupKey: 'GROUP-1',
284
+ * body: { variantSKUs: ['SKU-1'] },
285
+ * }),
286
+ * );
287
+ * ```
288
+ *
289
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item_group/methods/createOrReplaceInventoryItemGroup
290
+ */
291
+ createOrReplaceInventoryItemGroup = (input) => {
292
+ const client = this.client;
293
+ const basePath = this.basePath;
294
+ return Effect.gen(function* () {
295
+ const validatedInput = yield* requireObjectEffect(input, 'input');
296
+ const inventoryItemGroupKey = yield* requireStringEffect(validatedInput.inventoryItemGroupKey, 'inventoryItemGroupKey');
297
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
298
+ return yield* requestPutEffect(client, `${basePath}/inventory_item_group/${inventoryItemGroupKey}`, body);
299
+ });
300
+ };
301
+ /**
302
+ * Deletes one inventory item group.
303
+ *
304
+ * @param input - Seller-defined inventory item group key.
305
+ * @returns An Effect that succeeds when eBay returns no content.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * await Effect.runPromise(
310
+ * inventoryApi.deleteInventoryItemGroup({ inventoryItemGroupKey: 'GROUP-1' }),
311
+ * );
312
+ * ```
313
+ *
314
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item_group/methods/deleteInventoryItemGroup
315
+ */
316
+ deleteInventoryItemGroup = (input) => {
317
+ const client = this.client;
318
+ const basePath = this.basePath;
319
+ return Effect.gen(function* () {
320
+ const validatedInput = yield* requireObjectEffect(input, 'input');
321
+ const inventoryItemGroupKey = yield* requireStringEffect(validatedInput.inventoryItemGroupKey, 'inventoryItemGroupKey');
322
+ return yield* requestDeleteEffect(client, `${basePath}/inventory_item_group/${inventoryItemGroupKey}`);
323
+ });
324
+ };
325
+ /**
326
+ * Bulk migrates listings into the Inventory API model.
327
+ *
328
+ * @param input - Generated BulkMigrateListing body.
329
+ * @returns An Effect that succeeds with eBay's BulkMigrateListingResponse.
330
+ *
331
+ * @example
332
+ * ```ts
333
+ * const result = await Effect.runPromise(
334
+ * inventoryApi.bulkMigrateListing({ body: { requests: [] } }),
335
+ * );
336
+ * ```
337
+ *
338
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkMigrateListing
339
+ */
340
+ bulkMigrateListing = (input) => {
341
+ const client = this.client;
342
+ const path = `${this.basePath}/bulk_migrate_listing`;
343
+ return Effect.gen(function* () {
344
+ const validatedInput = yield* requireObjectEffect(input, 'input');
345
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
346
+ return yield* requestPostEffect(client, path, body);
347
+ });
348
+ };
349
+ /**
350
+ * Retrieves SKU location mappings for one listing/SKU pair.
351
+ *
352
+ * @param input - Listing ID and seller-defined SKU value.
353
+ * @returns An Effect that succeeds with eBay's LocationMapping response.
354
+ *
355
+ * @example
356
+ * ```ts
357
+ * const mapping = await Effect.runPromise(
358
+ * inventoryApi.getSkuLocationMapping({ listingId: '123', sku: 'SKU-1' }),
359
+ * );
360
+ * ```
361
+ *
362
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/listing/methods/getSkuLocationMapping
363
+ */
364
+ getSkuLocationMapping = (input) => {
365
+ const client = this.client;
366
+ const basePath = this.basePath;
367
+ return Effect.gen(function* () {
368
+ const validatedInput = yield* requireObjectEffect(input, 'input');
369
+ const listingId = yield* requireStringEffect(validatedInput.listingId, 'listingId');
370
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
371
+ return yield* requestGetEffect(client, `${basePath}/listing/${listingId}/sku/${sku}/locations`);
372
+ });
373
+ };
374
+ /**
375
+ * Creates or replaces SKU location mappings for one listing/SKU pair.
376
+ *
377
+ * @param input - Listing ID, SKU, and generated LocationMapping body.
378
+ * @returns An Effect that succeeds when eBay returns no content.
379
+ *
380
+ * @example
381
+ * ```ts
382
+ * await Effect.runPromise(
383
+ * inventoryApi.createOrReplaceSkuLocationMapping({
384
+ * listingId: '123',
385
+ * sku: 'SKU-1',
386
+ * body: { locations: [] },
387
+ * }),
388
+ * );
389
+ * ```
390
+ *
391
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/listing/methods/createOrReplaceSkuLocationMapping
392
+ */
393
+ createOrReplaceSkuLocationMapping = (input) => {
394
+ const client = this.client;
395
+ const basePath = this.basePath;
396
+ return Effect.gen(function* () {
397
+ const validatedInput = yield* requireObjectEffect(input, 'input');
398
+ const listingId = yield* requireStringEffect(validatedInput.listingId, 'listingId');
399
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
400
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
401
+ return yield* requestPutEffect(client, `${basePath}/listing/${listingId}/sku/${sku}/locations`, body);
402
+ });
403
+ };
404
+ /**
405
+ * Deletes SKU location mappings for one listing/SKU pair.
406
+ *
407
+ * @param input - Listing ID and seller-defined SKU value.
408
+ * @returns An Effect that succeeds when eBay returns no content.
409
+ *
410
+ * @example
411
+ * ```ts
412
+ * await Effect.runPromise(
413
+ * inventoryApi.deleteSkuLocationMapping({ listingId: '123', sku: 'SKU-1' }),
414
+ * );
415
+ * ```
416
+ *
417
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/listing/methods/deleteSkuLocationMapping
418
+ */
419
+ deleteSkuLocationMapping = (input) => {
420
+ const client = this.client;
421
+ const basePath = this.basePath;
422
+ return Effect.gen(function* () {
423
+ const validatedInput = yield* requireObjectEffect(input, 'input');
424
+ const listingId = yield* requireStringEffect(validatedInput.listingId, 'listingId');
425
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
426
+ return yield* requestDeleteEffect(client, `${basePath}/listing/${listingId}/sku/${sku}/locations`);
427
+ });
428
+ };
429
+ /**
430
+ * Creates multiple offers.
431
+ *
432
+ * @param input - Generated BulkEbayOfferDetailsWithKeys body.
433
+ * @returns An Effect that succeeds with eBay's BulkOfferResponse.
434
+ *
435
+ * @example
436
+ * ```ts
437
+ * const result = await Effect.runPromise(inventoryApi.bulkCreateOffer({ body: { requests: [] } }));
438
+ * ```
439
+ *
440
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/bulkCreateOffer
441
+ */
442
+ bulkCreateOffer = (input) => {
443
+ const client = this.client;
444
+ const path = `${this.basePath}/bulk_create_offer`;
445
+ return Effect.gen(function* () {
446
+ const validatedInput = yield* requireObjectEffect(input, 'input');
447
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
448
+ return yield* requestPostEffect(client, path, body);
449
+ });
450
+ };
451
+ /**
452
+ * Publishes multiple offers.
453
+ *
454
+ * @param input - Generated BulkOffer body.
455
+ * @returns An Effect that succeeds with eBay's BulkPublishResponse.
456
+ *
457
+ * @example
458
+ * ```ts
459
+ * const result = await Effect.runPromise(inventoryApi.bulkPublishOffer({ body: { offers: [] } }));
460
+ * ```
461
+ *
462
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/bulkPublishOffer
463
+ */
464
+ bulkPublishOffer = (input) => {
465
+ const client = this.client;
466
+ const path = `${this.basePath}/bulk_publish_offer`;
467
+ return Effect.gen(function* () {
468
+ const validatedInput = yield* requireObjectEffect(input, 'input');
469
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
470
+ return yield* requestPostEffect(client, path, body);
471
+ });
472
+ };
473
+ /**
474
+ * Retrieves offers with optional filters.
475
+ *
476
+ * @param input - Optional offer filters and pagination controls.
477
+ * @returns An Effect that succeeds with eBay's Offers response.
478
+ *
479
+ * @example
480
+ * ```ts
481
+ * const offers = await Effect.runPromise(
482
+ * inventoryApi.getOffers({ sku: 'SKU-1', marketplaceId: 'EBAY_US' }),
483
+ * );
484
+ * ```
485
+ *
486
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/getOffers
487
+ */
488
+ getOffers = (input = {}) => {
489
+ const client = this.client;
490
+ const path = `${this.basePath}/offer`;
491
+ return Effect.gen(function* () {
492
+ const validatedInput = yield* requireObjectEffect(input, 'input');
493
+ const format = yield* optionalStringEffect(validatedInput.format, 'format');
494
+ const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
495
+ const marketplaceId = yield* optionalStringEffect(validatedInput.marketplaceId, 'marketplaceId');
496
+ const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
497
+ const sku = yield* optionalStringEffect(validatedInput.sku, 'sku');
498
+ const params = buildEndpointParams({
499
+ format: { wireName: 'format', value: format },
500
+ limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
501
+ marketplaceId: { wireName: 'marketplace_id', value: marketplaceId },
502
+ offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
503
+ sku: { wireName: 'sku', value: sku },
504
+ });
505
+ return yield* requestGetEffect(client, path, params);
506
+ });
507
+ };
508
+ /**
509
+ * Creates one offer.
510
+ *
511
+ * @param input - Generated EbayOfferDetailsWithKeys body.
512
+ * @returns An Effect that succeeds with eBay's OfferResponse.
513
+ *
514
+ * @example
515
+ * ```ts
516
+ * const offer = await Effect.runPromise(inventoryApi.createOffer({ body: { sku: 'SKU-1' } }));
517
+ * ```
518
+ *
519
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/createOffer
520
+ */
521
+ createOffer = (input) => {
522
+ const client = this.client;
523
+ const path = `${this.basePath}/offer`;
524
+ return Effect.gen(function* () {
525
+ const validatedInput = yield* requireObjectEffect(input, 'input');
526
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
527
+ return yield* requestPostEffect(client, path, body);
528
+ });
529
+ };
530
+ /**
531
+ * Retrieves one offer by ID.
532
+ *
533
+ * @param input - eBay offer identifier.
534
+ * @returns An Effect that succeeds with eBay's EbayOfferDetailsWithAll response.
535
+ *
536
+ * @example
537
+ * ```ts
538
+ * const offer = await Effect.runPromise(inventoryApi.getOffer({ offerId: 'OFFER-1' }));
539
+ * ```
540
+ *
541
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/getOffer
542
+ */
543
+ getOffer = (input) => {
544
+ const client = this.client;
545
+ const basePath = this.basePath;
546
+ return Effect.gen(function* () {
547
+ const validatedInput = yield* requireObjectEffect(input, 'input');
548
+ const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
549
+ return yield* requestGetEffect(client, `${basePath}/offer/${offerId}`);
550
+ });
551
+ };
552
+ /**
553
+ * Updates one offer by ID.
554
+ *
555
+ * @param input - eBay offer identifier and generated EbayOfferDetailsWithId body.
556
+ * @returns An Effect that succeeds with eBay's OfferResponse.
557
+ *
558
+ * @example
559
+ * ```ts
560
+ * await Effect.runPromise(
561
+ * inventoryApi.updateOffer({ offerId: 'OFFER-1', body: { offerId: 'OFFER-1' } }),
562
+ * );
563
+ * ```
564
+ *
565
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/updateOffer
566
+ */
567
+ updateOffer = (input) => {
568
+ const client = this.client;
569
+ const basePath = this.basePath;
570
+ return Effect.gen(function* () {
571
+ const validatedInput = yield* requireObjectEffect(input, 'input');
572
+ const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
573
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
574
+ return yield* requestPutEffect(client, `${basePath}/offer/${offerId}`, body);
575
+ });
576
+ };
577
+ /**
578
+ * Deletes one offer by ID.
579
+ *
580
+ * @param input - eBay offer identifier.
581
+ * @returns An Effect that succeeds when eBay returns no content.
582
+ *
583
+ * @example
584
+ * ```ts
585
+ * await Effect.runPromise(inventoryApi.deleteOffer({ offerId: 'OFFER-1' }));
586
+ * ```
587
+ *
588
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/deleteOffer
589
+ */
590
+ deleteOffer = (input) => {
591
+ const client = this.client;
592
+ const basePath = this.basePath;
593
+ return Effect.gen(function* () {
594
+ const validatedInput = yield* requireObjectEffect(input, 'input');
595
+ const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
596
+ return yield* requestDeleteEffect(client, `${basePath}/offer/${offerId}`);
597
+ });
598
+ };
599
+ /**
600
+ * Retrieves listing fees for unpublished offers.
601
+ *
602
+ * @param input - Generated OfferKeysWithId body.
603
+ * @returns An Effect that succeeds with eBay's FeesSummaryResponse.
604
+ *
605
+ * @example
606
+ * ```ts
607
+ * const fees = await Effect.runPromise(
608
+ * inventoryApi.getListingFees({ body: { offers: [{ offerId: 'OFFER-1' }] } }),
609
+ * );
610
+ * ```
611
+ *
612
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/getListingFees
613
+ */
614
+ getListingFees = (input) => {
615
+ const client = this.client;
616
+ const path = `${this.basePath}/offer/get_listing_fees`;
617
+ return Effect.gen(function* () {
618
+ const validatedInput = yield* requireObjectEffect(input, 'input');
619
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
620
+ return yield* requestPostEffect(client, path, body);
621
+ });
622
+ };
623
+ /**
624
+ * Publishes one offer by ID.
625
+ *
626
+ * @param input - eBay offer identifier.
627
+ * @returns An Effect that succeeds with eBay's PublishResponse.
628
+ *
629
+ * @example
630
+ * ```ts
631
+ * const publish = await Effect.runPromise(inventoryApi.publishOffer({ offerId: 'OFFER-1' }));
632
+ * ```
633
+ *
634
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/publishOffer
635
+ */
636
+ publishOffer = (input) => {
637
+ const client = this.client;
638
+ const basePath = this.basePath;
639
+ return Effect.gen(function* () {
640
+ const validatedInput = yield* requireObjectEffect(input, 'input');
641
+ const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
642
+ return yield* requestPostEffect(client, `${basePath}/offer/${offerId}/publish`);
643
+ });
644
+ };
645
+ /**
646
+ * Publishes offers for one inventory item group.
647
+ *
648
+ * @param input - Generated PublishByInventoryItemGroupRequest body.
649
+ * @returns An Effect that succeeds with eBay's PublishResponse.
650
+ *
651
+ * @example
652
+ * ```ts
653
+ * const publish = await Effect.runPromise(
654
+ * inventoryApi.publishOfferByInventoryItemGroup({
655
+ * body: { inventoryItemGroupKey: 'GROUP-1', marketplaceId: 'EBAY_US' },
656
+ * }),
657
+ * );
658
+ * ```
659
+ *
660
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/publishOfferByInventoryItemGroup
661
+ */
662
+ publishOfferByInventoryItemGroup = (input) => {
663
+ const client = this.client;
664
+ const path = `${this.basePath}/offer/publish_by_inventory_item_group`;
665
+ return Effect.gen(function* () {
666
+ const validatedInput = yield* requireObjectEffect(input, 'input');
667
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
668
+ return yield* requestPostEffect(client, path, body);
669
+ });
670
+ };
671
+ /**
672
+ * Withdraws one offer by ID.
673
+ *
674
+ * @param input - eBay offer identifier.
675
+ * @returns An Effect that succeeds with eBay's WithdrawResponse.
676
+ *
677
+ * @example
678
+ * ```ts
679
+ * const withdraw = await Effect.runPromise(inventoryApi.withdrawOffer({ offerId: 'OFFER-1' }));
680
+ * ```
681
+ *
682
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/withdrawOffer
683
+ */
684
+ withdrawOffer = (input) => {
685
+ const client = this.client;
686
+ const basePath = this.basePath;
687
+ return Effect.gen(function* () {
688
+ const validatedInput = yield* requireObjectEffect(input, 'input');
689
+ const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
690
+ return yield* requestPostEffect(client, `${basePath}/offer/${offerId}/withdraw`);
691
+ });
692
+ };
693
+ /**
694
+ * Withdraws offers for one inventory item group.
695
+ *
696
+ * @param input - Generated WithdrawByInventoryItemGroupRequest body.
697
+ * @returns An Effect that succeeds when eBay returns no content.
698
+ *
699
+ * @example
700
+ * ```ts
701
+ * await Effect.runPromise(
702
+ * inventoryApi.withdrawOfferByInventoryItemGroup({
703
+ * body: { inventoryItemGroupKey: 'GROUP-1', marketplaceId: 'EBAY_US' },
704
+ * }),
705
+ * );
706
+ * ```
707
+ *
708
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/withdrawOfferByInventoryItemGroup
709
+ */
710
+ withdrawOfferByInventoryItemGroup = (input) => {
711
+ const client = this.client;
712
+ const path = `${this.basePath}/offer/withdraw_by_inventory_item_group`;
713
+ return Effect.gen(function* () {
714
+ const validatedInput = yield* requireObjectEffect(input, 'input');
715
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
716
+ return yield* requestPostEffect(client, path, body);
717
+ });
718
+ };
719
+ /**
720
+ * Retrieves one inventory location by merchant location key.
721
+ *
722
+ * @param input - Seller-defined merchant location key.
723
+ * @returns An Effect that succeeds with eBay's InventoryLocationResponse.
724
+ *
725
+ * @example
726
+ * ```ts
727
+ * const location = await Effect.runPromise(
728
+ * inventoryApi.getInventoryLocation({ merchantLocationKey: 'LOC-1' }),
729
+ * );
730
+ * ```
731
+ *
732
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/getInventoryLocation
733
+ */
734
+ getInventoryLocation = (input) => {
735
+ const client = this.client;
736
+ const basePath = this.basePath;
737
+ return Effect.gen(function* () {
738
+ const validatedInput = yield* requireObjectEffect(input, 'input');
739
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
740
+ return yield* requestGetEffect(client, `${basePath}/location/${merchantLocationKey}`);
741
+ });
742
+ };
743
+ /**
744
+ * Creates one inventory location by merchant location key.
745
+ *
746
+ * @param input - Seller-defined merchant location key and generated InventoryLocationFull body.
747
+ * @returns An Effect that succeeds when eBay returns no content.
748
+ *
749
+ * @example
750
+ * ```ts
751
+ * await Effect.runPromise(
752
+ * inventoryApi.createInventoryLocation({ merchantLocationKey: 'LOC-1', body: {} }),
753
+ * );
754
+ * ```
755
+ *
756
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/createInventoryLocation
757
+ */
758
+ createInventoryLocation = (input) => {
759
+ const client = this.client;
760
+ const basePath = this.basePath;
761
+ return Effect.gen(function* () {
762
+ const validatedInput = yield* requireObjectEffect(input, 'input');
763
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
764
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
765
+ return yield* requestPostEffect(client, `${basePath}/location/${merchantLocationKey}`, body);
766
+ });
767
+ };
768
+ /**
769
+ * Deletes one inventory location by merchant location key.
770
+ *
771
+ * @param input - Seller-defined merchant location key.
772
+ * @returns An Effect that succeeds when eBay returns no content.
773
+ *
774
+ * @example
775
+ * ```ts
776
+ * await Effect.runPromise(
777
+ * inventoryApi.deleteInventoryLocation({ merchantLocationKey: 'LOC-1' }),
778
+ * );
779
+ * ```
780
+ *
781
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/deleteInventoryLocation
782
+ */
783
+ deleteInventoryLocation = (input) => {
784
+ const client = this.client;
785
+ const basePath = this.basePath;
786
+ return Effect.gen(function* () {
787
+ const validatedInput = yield* requireObjectEffect(input, 'input');
788
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
789
+ return yield* requestDeleteEffect(client, `${basePath}/location/${merchantLocationKey}`);
790
+ });
791
+ };
792
+ /**
793
+ * Disables one inventory location.
794
+ *
795
+ * @param input - Seller-defined merchant location key.
796
+ * @returns An Effect that succeeds with eBay's empty disable response.
797
+ *
798
+ * @example
799
+ * ```ts
800
+ * await Effect.runPromise(
801
+ * inventoryApi.disableInventoryLocation({ merchantLocationKey: 'LOC-1' }),
802
+ * );
803
+ * ```
804
+ *
805
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/disableInventoryLocation
806
+ */
807
+ disableInventoryLocation = (input) => {
808
+ const client = this.client;
809
+ const basePath = this.basePath;
810
+ return Effect.gen(function* () {
811
+ const validatedInput = yield* requireObjectEffect(input, 'input');
812
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
813
+ return yield* requestPostEffect(client, `${basePath}/location/${merchantLocationKey}/disable`);
814
+ });
815
+ };
816
+ /**
817
+ * Enables one inventory location.
818
+ *
819
+ * @param input - Seller-defined merchant location key.
820
+ * @returns An Effect that succeeds with eBay's empty enable response.
821
+ *
822
+ * @example
823
+ * ```ts
824
+ * await Effect.runPromise(
825
+ * inventoryApi.enableInventoryLocation({ merchantLocationKey: 'LOC-1' }),
826
+ * );
827
+ * ```
828
+ *
829
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/enableInventoryLocation
830
+ */
831
+ enableInventoryLocation = (input) => {
832
+ const client = this.client;
833
+ const basePath = this.basePath;
834
+ return Effect.gen(function* () {
835
+ const validatedInput = yield* requireObjectEffect(input, 'input');
836
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
837
+ return yield* requestPostEffect(client, `${basePath}/location/${merchantLocationKey}/enable`);
838
+ });
839
+ };
840
+ /**
841
+ * Retrieves paginated inventory locations.
842
+ *
843
+ * @param input - Optional pagination controls.
844
+ * @returns An Effect that succeeds with eBay's LocationResponse.
845
+ *
846
+ * @example
847
+ * ```ts
848
+ * const locations = await Effect.runPromise(inventoryApi.getInventoryLocations({ limit: 50 }));
849
+ * ```
850
+ *
851
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/getInventoryLocations
852
+ */
853
+ getInventoryLocations = (input = {}) => {
854
+ const client = this.client;
855
+ const path = `${this.basePath}/location`;
856
+ return Effect.gen(function* () {
857
+ const validatedInput = yield* requireObjectEffect(input, 'input');
858
+ const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
859
+ const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
860
+ const params = buildEndpointParams({
861
+ limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
862
+ offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
863
+ });
864
+ return yield* requestGetEffect(client, path, params);
865
+ });
866
+ };
867
+ /**
868
+ * Updates details for one inventory location.
869
+ *
870
+ * @param input - Seller-defined merchant location key and generated InventoryLocation body.
871
+ * @returns An Effect that succeeds when eBay returns no content.
872
+ *
873
+ * @example
874
+ * ```ts
875
+ * await Effect.runPromise(
876
+ * inventoryApi.updateInventoryLocation({ merchantLocationKey: 'LOC-1', body: {} }),
877
+ * );
878
+ * ```
879
+ *
880
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/updateInventoryLocation
881
+ */
882
+ updateInventoryLocation = (input) => {
883
+ const client = this.client;
884
+ const basePath = this.basePath;
885
+ return Effect.gen(function* () {
886
+ const validatedInput = yield* requireObjectEffect(input, 'input');
887
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
888
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
889
+ return yield* requestPostEffect(client, `${basePath}/location/${merchantLocationKey}/update_location_details`, body);
890
+ });
891
+ };
346
892
  }