ebay-mcp 1.14.0 → 1.14.2

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 (41) hide show
  1. package/README.de.md +5 -0
  2. package/README.es.md +5 -0
  3. package/README.fr.md +5 -0
  4. package/README.ja.md +5 -0
  5. package/README.ko.md +5 -0
  6. package/README.md +1 -0
  7. package/README.pt-BR.md +5 -0
  8. package/README.ru.md +5 -0
  9. package/README.zh-CN.md +5 -0
  10. package/build/api/clientTrading.js +2 -3
  11. package/build/api/listing-management/inventory.js +7 -888
  12. package/build/api/listing-management/items.js +408 -0
  13. package/build/api/listing-management/locations.js +172 -0
  14. package/build/api/listing-management/offers.js +284 -0
  15. package/build/api/listing-management/shared.js +1 -0
  16. package/build/api/marketing-and-promotions/ads.js +621 -0
  17. package/build/api/marketing-and-promotions/campaigns.js +362 -0
  18. package/build/api/marketing-and-promotions/marketing.js +8 -1530
  19. package/build/api/marketing-and-promotions/promotions.js +422 -0
  20. package/build/api/marketing-and-promotions/reports.js +137 -0
  21. package/build/api/marketing-and-promotions/shared.js +4 -0
  22. package/build/{utils → auth}/oauthHelper.js +1 -1
  23. package/build/config/environment.js +56 -0
  24. package/build/schemas/marketing/ads.js +769 -0
  25. package/build/schemas/marketing/campaigns.js +361 -0
  26. package/build/schemas/marketing/common.js +152 -0
  27. package/build/schemas/marketing/jsonSchemas.js +118 -0
  28. package/build/schemas/marketing/marketing.js +10 -2016
  29. package/build/schemas/marketing/promotions.js +480 -0
  30. package/build/schemas/marketing/reports.js +162 -0
  31. package/build/scripts/devSync.js +28 -23
  32. package/build/scripts/diagnostics.js +3 -3
  33. package/build/scripts/interactiveSetup.js +4 -4
  34. package/build/{utils → scripts}/scopeHelper.js +1 -1
  35. package/build/{utils → scripts}/securityChecker.js +1 -1
  36. package/build/scripts/setup.js +4 -4
  37. package/build/{utils → scripts}/setupValidator.js +2 -2
  38. package/build/{utils → scripts}/setupWizard.js +1 -1
  39. package/package.json +1 -1
  40. package/build/tools/tool-handlers/types.js +0 -1
  41. /package/build/tools/{definitions/types.js → types.js} +0 -0
@@ -0,0 +1,408 @@
1
+ import { buildEndpointParams, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, requestDeleteEffect, requestGetEffect, requestPostEffect, requestPutEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
2
+ import { Effect } from 'effect';
3
+ import { INVENTORY_BASE_PATH } from './shared.js';
4
+ /** Inventory API — items methods closed over a shared client. */
5
+ export const createInventoryItemsMethods = (client) => ({
6
+ /**
7
+ * Retrieves paginated inventory items.
8
+ *
9
+ * @param input - Optional pagination controls.
10
+ * @returns An Effect that succeeds with eBay's InventoryItems response.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const items = await Effect.runPromise(inventoryApi.getInventoryItems({ limit: 25 }));
15
+ * ```
16
+ *
17
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/getInventoryItems
18
+ */
19
+ getInventoryItems: (input = {}) => {
20
+ const path = `${INVENTORY_BASE_PATH}/inventory_item`;
21
+ return Effect.gen(function* () {
22
+ const validatedInput = yield* requireObjectEffect(input, 'input');
23
+ const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
24
+ const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
25
+ const params = buildEndpointParams({
26
+ limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
27
+ offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
28
+ });
29
+ return yield* requestGetEffect(client, path, params);
30
+ });
31
+ },
32
+ /**
33
+ * Retrieves one inventory item by SKU.
34
+ *
35
+ * @param input - Seller-defined SKU value.
36
+ * @returns An Effect that succeeds with eBay's InventoryItemWithSkuLocaleGroupid response.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const item = await Effect.runPromise(inventoryApi.getInventoryItem({ sku: 'SKU-1' }));
41
+ * ```
42
+ *
43
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/getInventoryItem
44
+ */
45
+ getInventoryItem: (input) => {
46
+ const basePath = INVENTORY_BASE_PATH;
47
+ return Effect.gen(function* () {
48
+ const validatedInput = yield* requireObjectEffect(input, 'input');
49
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
50
+ return yield* requestGetEffect(client, `${basePath}/inventory_item/${sku}`);
51
+ });
52
+ },
53
+ /**
54
+ * Creates or replaces one inventory item by SKU.
55
+ *
56
+ * @param input - Seller-defined SKU and generated InventoryItem body.
57
+ * @returns An Effect that succeeds with eBay's BaseResponse.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * await Effect.runPromise(
62
+ * inventoryApi.createOrReplaceInventoryItem({ sku: 'SKU-1', body: { product: {} } }),
63
+ * );
64
+ * ```
65
+ *
66
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/createOrReplaceInventoryItem
67
+ */
68
+ createOrReplaceInventoryItem: (input) => {
69
+ const basePath = INVENTORY_BASE_PATH;
70
+ return Effect.gen(function* () {
71
+ const validatedInput = yield* requireObjectEffect(input, 'input');
72
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
73
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
74
+ return yield* requestPutEffect(client, `${basePath}/inventory_item/${sku}`, body);
75
+ });
76
+ },
77
+ /**
78
+ * Deletes one inventory item by SKU.
79
+ *
80
+ * @param input - Seller-defined SKU value.
81
+ * @returns An Effect that succeeds when eBay returns no content.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * await Effect.runPromise(inventoryApi.deleteInventoryItem({ sku: 'SKU-1' }));
86
+ * ```
87
+ *
88
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/deleteInventoryItem
89
+ */
90
+ deleteInventoryItem: (input) => {
91
+ const basePath = INVENTORY_BASE_PATH;
92
+ return Effect.gen(function* () {
93
+ const validatedInput = yield* requireObjectEffect(input, 'input');
94
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
95
+ return yield* requestDeleteEffect(client, `${basePath}/inventory_item/${sku}`);
96
+ });
97
+ },
98
+ /**
99
+ * Creates or replaces up to 25 inventory items.
100
+ *
101
+ * @param input - Generated BulkInventoryItem body.
102
+ * @returns An Effect that succeeds with eBay's BulkInventoryItemResponse.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const result = await Effect.runPromise(
107
+ * inventoryApi.bulkCreateOrReplaceInventoryItem({ body: { requests: [] } }),
108
+ * );
109
+ * ```
110
+ *
111
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkCreateOrReplaceInventoryItem
112
+ */
113
+ bulkCreateOrReplaceInventoryItem: (input) => {
114
+ const path = `${INVENTORY_BASE_PATH}/bulk_create_or_replace_inventory_item`;
115
+ return Effect.gen(function* () {
116
+ const validatedInput = yield* requireObjectEffect(input, 'input');
117
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
118
+ return yield* requestPostEffect(client, path, body);
119
+ });
120
+ },
121
+ /**
122
+ * Retrieves up to 25 inventory items by SKU.
123
+ *
124
+ * @param input - Generated BulkGetInventoryItem body.
125
+ * @returns An Effect that succeeds with eBay's BulkGetInventoryItemResponse.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * const result = await Effect.runPromise(
130
+ * inventoryApi.bulkGetInventoryItem({ body: { requests: [{ sku: 'SKU-1' }] } }),
131
+ * );
132
+ * ```
133
+ *
134
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkGetInventoryItem
135
+ */
136
+ bulkGetInventoryItem: (input) => {
137
+ const path = `${INVENTORY_BASE_PATH}/bulk_get_inventory_item`;
138
+ return Effect.gen(function* () {
139
+ const validatedInput = yield* requireObjectEffect(input, 'input');
140
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
141
+ return yield* requestPostEffect(client, path, body);
142
+ });
143
+ },
144
+ /**
145
+ * Updates price and quantity for inventory items and offers.
146
+ *
147
+ * @param input - Generated BulkPriceQuantity body.
148
+ * @returns An Effect that succeeds with eBay's BulkPriceQuantityResponse.
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * const result = await Effect.runPromise(
153
+ * inventoryApi.bulkUpdatePriceQuantity({ body: { requests: [] } }),
154
+ * );
155
+ * ```
156
+ *
157
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkUpdatePriceQuantity
158
+ */
159
+ bulkUpdatePriceQuantity: (input) => {
160
+ const path = `${INVENTORY_BASE_PATH}/bulk_update_price_quantity`;
161
+ return Effect.gen(function* () {
162
+ const validatedInput = yield* requireObjectEffect(input, 'input');
163
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
164
+ return yield* requestPostEffect(client, path, body);
165
+ });
166
+ },
167
+ /**
168
+ * Retrieves product compatibility for one SKU.
169
+ *
170
+ * @param input - Seller-defined SKU value.
171
+ * @returns An Effect that succeeds with eBay's Compatibility response.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const compatibility = await Effect.runPromise(
176
+ * inventoryApi.getProductCompatibility({ sku: 'SKU-1' }),
177
+ * );
178
+ * ```
179
+ *
180
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/product_compatibility/methods/getProductCompatibility
181
+ */
182
+ getProductCompatibility: (input) => {
183
+ const basePath = INVENTORY_BASE_PATH;
184
+ return Effect.gen(function* () {
185
+ const validatedInput = yield* requireObjectEffect(input, 'input');
186
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
187
+ return yield* requestGetEffect(client, `${basePath}/inventory_item/${sku}/product_compatibility`);
188
+ });
189
+ },
190
+ /**
191
+ * Creates or replaces product compatibility for one SKU.
192
+ *
193
+ * @param input - Seller-defined SKU and generated Compatibility body.
194
+ * @returns An Effect that succeeds with eBay's BaseResponse.
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * await Effect.runPromise(
199
+ * inventoryApi.createOrReplaceProductCompatibility({ sku: 'SKU-1', body: {} }),
200
+ * );
201
+ * ```
202
+ *
203
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/product_compatibility/methods/createOrReplaceProductCompatibility
204
+ */
205
+ createOrReplaceProductCompatibility: (input) => {
206
+ const basePath = INVENTORY_BASE_PATH;
207
+ return Effect.gen(function* () {
208
+ const validatedInput = yield* requireObjectEffect(input, 'input');
209
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
210
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
211
+ return yield* requestPutEffect(client, `${basePath}/inventory_item/${sku}/product_compatibility`, body);
212
+ });
213
+ },
214
+ /**
215
+ * Deletes product compatibility for one SKU.
216
+ *
217
+ * @param input - Seller-defined SKU value.
218
+ * @returns An Effect that succeeds when eBay returns no content.
219
+ *
220
+ * @example
221
+ * ```ts
222
+ * await Effect.runPromise(inventoryApi.deleteProductCompatibility({ sku: 'SKU-1' }));
223
+ * ```
224
+ *
225
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/product_compatibility/methods/deleteProductCompatibility
226
+ */
227
+ deleteProductCompatibility: (input) => {
228
+ const basePath = INVENTORY_BASE_PATH;
229
+ return Effect.gen(function* () {
230
+ const validatedInput = yield* requireObjectEffect(input, 'input');
231
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
232
+ return yield* requestDeleteEffect(client, `${basePath}/inventory_item/${sku}/product_compatibility`);
233
+ });
234
+ },
235
+ /**
236
+ * Retrieves one inventory item group.
237
+ *
238
+ * @param input - Seller-defined inventory item group key.
239
+ * @returns An Effect that succeeds with eBay's InventoryItemGroup response.
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * const group = await Effect.runPromise(
244
+ * inventoryApi.getInventoryItemGroup({ inventoryItemGroupKey: 'GROUP-1' }),
245
+ * );
246
+ * ```
247
+ *
248
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item_group/methods/getInventoryItemGroup
249
+ */
250
+ getInventoryItemGroup: (input) => {
251
+ const basePath = INVENTORY_BASE_PATH;
252
+ return Effect.gen(function* () {
253
+ const validatedInput = yield* requireObjectEffect(input, 'input');
254
+ const inventoryItemGroupKey = yield* requireStringEffect(validatedInput.inventoryItemGroupKey, 'inventoryItemGroupKey');
255
+ return yield* requestGetEffect(client, `${basePath}/inventory_item_group/${inventoryItemGroupKey}`);
256
+ });
257
+ },
258
+ /**
259
+ * Creates or replaces one inventory item group.
260
+ *
261
+ * @param input - Seller-defined inventory item group key and generated InventoryItemGroup body.
262
+ * @returns An Effect that succeeds with eBay's BaseResponse.
263
+ *
264
+ * @example
265
+ * ```ts
266
+ * await Effect.runPromise(
267
+ * inventoryApi.createOrReplaceInventoryItemGroup({
268
+ * inventoryItemGroupKey: 'GROUP-1',
269
+ * body: { variantSKUs: ['SKU-1'] },
270
+ * }),
271
+ * );
272
+ * ```
273
+ *
274
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item_group/methods/createOrReplaceInventoryItemGroup
275
+ */
276
+ createOrReplaceInventoryItemGroup: (input) => {
277
+ const basePath = INVENTORY_BASE_PATH;
278
+ return Effect.gen(function* () {
279
+ const validatedInput = yield* requireObjectEffect(input, 'input');
280
+ const inventoryItemGroupKey = yield* requireStringEffect(validatedInput.inventoryItemGroupKey, 'inventoryItemGroupKey');
281
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
282
+ return yield* requestPutEffect(client, `${basePath}/inventory_item_group/${inventoryItemGroupKey}`, body);
283
+ });
284
+ },
285
+ /**
286
+ * Deletes one inventory item group.
287
+ *
288
+ * @param input - Seller-defined inventory item group key.
289
+ * @returns An Effect that succeeds when eBay returns no content.
290
+ *
291
+ * @example
292
+ * ```ts
293
+ * await Effect.runPromise(
294
+ * inventoryApi.deleteInventoryItemGroup({ inventoryItemGroupKey: 'GROUP-1' }),
295
+ * );
296
+ * ```
297
+ *
298
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item_group/methods/deleteInventoryItemGroup
299
+ */
300
+ deleteInventoryItemGroup: (input) => {
301
+ const basePath = INVENTORY_BASE_PATH;
302
+ return Effect.gen(function* () {
303
+ const validatedInput = yield* requireObjectEffect(input, 'input');
304
+ const inventoryItemGroupKey = yield* requireStringEffect(validatedInput.inventoryItemGroupKey, 'inventoryItemGroupKey');
305
+ return yield* requestDeleteEffect(client, `${basePath}/inventory_item_group/${inventoryItemGroupKey}`);
306
+ });
307
+ },
308
+ /**
309
+ * Bulk migrates listings into the Inventory API model.
310
+ *
311
+ * @param input - Generated BulkMigrateListing body.
312
+ * @returns An Effect that succeeds with eBay's BulkMigrateListingResponse.
313
+ *
314
+ * @example
315
+ * ```ts
316
+ * const result = await Effect.runPromise(
317
+ * inventoryApi.bulkMigrateListing({ body: { requests: [] } }),
318
+ * );
319
+ * ```
320
+ *
321
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkMigrateListing
322
+ */
323
+ bulkMigrateListing: (input) => {
324
+ const path = `${INVENTORY_BASE_PATH}/bulk_migrate_listing`;
325
+ return Effect.gen(function* () {
326
+ const validatedInput = yield* requireObjectEffect(input, 'input');
327
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
328
+ return yield* requestPostEffect(client, path, body);
329
+ });
330
+ },
331
+ /**
332
+ * Retrieves SKU location mappings for one listing/SKU pair.
333
+ *
334
+ * @param input - Listing ID and seller-defined SKU value.
335
+ * @returns An Effect that succeeds with eBay's LocationMapping response.
336
+ *
337
+ * @example
338
+ * ```ts
339
+ * const mapping = await Effect.runPromise(
340
+ * inventoryApi.getSkuLocationMapping({ listingId: '123', sku: 'SKU-1' }),
341
+ * );
342
+ * ```
343
+ *
344
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/listing/methods/getSkuLocationMapping
345
+ */
346
+ getSkuLocationMapping: (input) => {
347
+ const basePath = INVENTORY_BASE_PATH;
348
+ return Effect.gen(function* () {
349
+ const validatedInput = yield* requireObjectEffect(input, 'input');
350
+ const listingId = yield* requireStringEffect(validatedInput.listingId, 'listingId');
351
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
352
+ return yield* requestGetEffect(client, `${basePath}/listing/${listingId}/sku/${sku}/locations`);
353
+ });
354
+ },
355
+ /**
356
+ * Creates or replaces SKU location mappings for one listing/SKU pair.
357
+ *
358
+ * @param input - Listing ID, SKU, and generated LocationMapping body.
359
+ * @returns An Effect that succeeds when eBay returns no content.
360
+ *
361
+ * @example
362
+ * ```ts
363
+ * await Effect.runPromise(
364
+ * inventoryApi.createOrReplaceSkuLocationMapping({
365
+ * listingId: '123',
366
+ * sku: 'SKU-1',
367
+ * body: { locations: [] },
368
+ * }),
369
+ * );
370
+ * ```
371
+ *
372
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/listing/methods/createOrReplaceSkuLocationMapping
373
+ */
374
+ createOrReplaceSkuLocationMapping: (input) => {
375
+ const basePath = INVENTORY_BASE_PATH;
376
+ return Effect.gen(function* () {
377
+ const validatedInput = yield* requireObjectEffect(input, 'input');
378
+ const listingId = yield* requireStringEffect(validatedInput.listingId, 'listingId');
379
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
380
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
381
+ return yield* requestPutEffect(client, `${basePath}/listing/${listingId}/sku/${sku}/locations`, body);
382
+ });
383
+ },
384
+ /**
385
+ * Deletes SKU location mappings for one listing/SKU pair.
386
+ *
387
+ * @param input - Listing ID and seller-defined SKU value.
388
+ * @returns An Effect that succeeds when eBay returns no content.
389
+ *
390
+ * @example
391
+ * ```ts
392
+ * await Effect.runPromise(
393
+ * inventoryApi.deleteSkuLocationMapping({ listingId: '123', sku: 'SKU-1' }),
394
+ * );
395
+ * ```
396
+ *
397
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/listing/methods/deleteSkuLocationMapping
398
+ */
399
+ deleteSkuLocationMapping: (input) => {
400
+ const basePath = INVENTORY_BASE_PATH;
401
+ return Effect.gen(function* () {
402
+ const validatedInput = yield* requireObjectEffect(input, 'input');
403
+ const listingId = yield* requireStringEffect(validatedInput.listingId, 'listingId');
404
+ const sku = yield* requireStringEffect(validatedInput.sku, 'sku');
405
+ return yield* requestDeleteEffect(client, `${basePath}/listing/${listingId}/sku/${sku}/locations`);
406
+ });
407
+ },
408
+ });
@@ -0,0 +1,172 @@
1
+ import { buildEndpointParams, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, requestDeleteEffect, requestGetEffect, requestPostEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
2
+ import { Effect } from 'effect';
3
+ import { INVENTORY_BASE_PATH } from './shared.js';
4
+ /** Inventory API — locations methods closed over a shared client. */
5
+ export const createInventoryLocationsMethods = (client) => ({
6
+ /**
7
+ * Retrieves one inventory location by merchant location key.
8
+ *
9
+ * @param input - Seller-defined merchant location key.
10
+ * @returns An Effect that succeeds with eBay's InventoryLocationResponse.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const location = await Effect.runPromise(
15
+ * inventoryApi.getInventoryLocation({ merchantLocationKey: 'LOC-1' }),
16
+ * );
17
+ * ```
18
+ *
19
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/getInventoryLocation
20
+ */
21
+ getInventoryLocation: (input) => {
22
+ const basePath = INVENTORY_BASE_PATH;
23
+ return Effect.gen(function* () {
24
+ const validatedInput = yield* requireObjectEffect(input, 'input');
25
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
26
+ return yield* requestGetEffect(client, `${basePath}/location/${merchantLocationKey}`);
27
+ });
28
+ },
29
+ /**
30
+ * Creates one inventory location by merchant location key.
31
+ *
32
+ * @param input - Seller-defined merchant location key and generated InventoryLocationFull body.
33
+ * @returns An Effect that succeeds when eBay returns no content.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * await Effect.runPromise(
38
+ * inventoryApi.createInventoryLocation({ merchantLocationKey: 'LOC-1', body: {} }),
39
+ * );
40
+ * ```
41
+ *
42
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/createInventoryLocation
43
+ */
44
+ createInventoryLocation: (input) => {
45
+ const basePath = INVENTORY_BASE_PATH;
46
+ return Effect.gen(function* () {
47
+ const validatedInput = yield* requireObjectEffect(input, 'input');
48
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
49
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
50
+ return yield* requestPostEffect(client, `${basePath}/location/${merchantLocationKey}`, body);
51
+ });
52
+ },
53
+ /**
54
+ * Deletes one inventory location by merchant location key.
55
+ *
56
+ * @param input - Seller-defined merchant location key.
57
+ * @returns An Effect that succeeds when eBay returns no content.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * await Effect.runPromise(
62
+ * inventoryApi.deleteInventoryLocation({ merchantLocationKey: 'LOC-1' }),
63
+ * );
64
+ * ```
65
+ *
66
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/deleteInventoryLocation
67
+ */
68
+ deleteInventoryLocation: (input) => {
69
+ const basePath = INVENTORY_BASE_PATH;
70
+ return Effect.gen(function* () {
71
+ const validatedInput = yield* requireObjectEffect(input, 'input');
72
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
73
+ return yield* requestDeleteEffect(client, `${basePath}/location/${merchantLocationKey}`);
74
+ });
75
+ },
76
+ /**
77
+ * Disables one inventory location.
78
+ *
79
+ * @param input - Seller-defined merchant location key.
80
+ * @returns An Effect that succeeds with eBay's empty disable response.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * await Effect.runPromise(
85
+ * inventoryApi.disableInventoryLocation({ merchantLocationKey: 'LOC-1' }),
86
+ * );
87
+ * ```
88
+ *
89
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/disableInventoryLocation
90
+ */
91
+ disableInventoryLocation: (input) => {
92
+ const basePath = INVENTORY_BASE_PATH;
93
+ return Effect.gen(function* () {
94
+ const validatedInput = yield* requireObjectEffect(input, 'input');
95
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
96
+ return yield* requestPostEffect(client, `${basePath}/location/${merchantLocationKey}/disable`);
97
+ });
98
+ },
99
+ /**
100
+ * Enables one inventory location.
101
+ *
102
+ * @param input - Seller-defined merchant location key.
103
+ * @returns An Effect that succeeds with eBay's empty enable response.
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * await Effect.runPromise(
108
+ * inventoryApi.enableInventoryLocation({ merchantLocationKey: 'LOC-1' }),
109
+ * );
110
+ * ```
111
+ *
112
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/enableInventoryLocation
113
+ */
114
+ enableInventoryLocation: (input) => {
115
+ const basePath = INVENTORY_BASE_PATH;
116
+ return Effect.gen(function* () {
117
+ const validatedInput = yield* requireObjectEffect(input, 'input');
118
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
119
+ return yield* requestPostEffect(client, `${basePath}/location/${merchantLocationKey}/enable`);
120
+ });
121
+ },
122
+ /**
123
+ * Retrieves paginated inventory locations.
124
+ *
125
+ * @param input - Optional pagination controls.
126
+ * @returns An Effect that succeeds with eBay's LocationResponse.
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * const locations = await Effect.runPromise(inventoryApi.getInventoryLocations({ limit: 50 }));
131
+ * ```
132
+ *
133
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/getInventoryLocations
134
+ */
135
+ getInventoryLocations: (input = {}) => {
136
+ const path = `${INVENTORY_BASE_PATH}/location`;
137
+ return Effect.gen(function* () {
138
+ const validatedInput = yield* requireObjectEffect(input, 'input');
139
+ const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
140
+ const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
141
+ const params = buildEndpointParams({
142
+ limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
143
+ offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
144
+ });
145
+ return yield* requestGetEffect(client, path, params);
146
+ });
147
+ },
148
+ /**
149
+ * Updates details for one inventory location.
150
+ *
151
+ * @param input - Seller-defined merchant location key and generated InventoryLocation body.
152
+ * @returns An Effect that succeeds when eBay returns no content.
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * await Effect.runPromise(
157
+ * inventoryApi.updateInventoryLocation({ merchantLocationKey: 'LOC-1', body: {} }),
158
+ * );
159
+ * ```
160
+ *
161
+ * @see https://developer.ebay.com/api-docs/sell/inventory/resources/location/methods/updateInventoryLocation
162
+ */
163
+ updateInventoryLocation: (input) => {
164
+ const basePath = INVENTORY_BASE_PATH;
165
+ return Effect.gen(function* () {
166
+ const validatedInput = yield* requireObjectEffect(input, 'input');
167
+ const merchantLocationKey = yield* requireStringEffect(validatedInput.merchantLocationKey, 'merchantLocationKey');
168
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
169
+ return yield* requestPostEffect(client, `${basePath}/location/${merchantLocationKey}/update_location_details`, body);
170
+ });
171
+ },
172
+ });