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.
- package/README.de.md +5 -0
- package/README.es.md +5 -0
- package/README.fr.md +5 -0
- package/README.ja.md +5 -0
- package/README.ko.md +5 -0
- package/README.md +1 -0
- package/README.pt-BR.md +5 -0
- package/README.ru.md +5 -0
- package/README.zh-CN.md +5 -0
- package/build/api/clientTrading.js +2 -3
- package/build/api/listing-management/inventory.js +7 -888
- package/build/api/listing-management/items.js +408 -0
- package/build/api/listing-management/locations.js +172 -0
- package/build/api/listing-management/offers.js +284 -0
- package/build/api/listing-management/shared.js +1 -0
- package/build/api/marketing-and-promotions/ads.js +621 -0
- package/build/api/marketing-and-promotions/campaigns.js +362 -0
- package/build/api/marketing-and-promotions/marketing.js +8 -1530
- package/build/api/marketing-and-promotions/promotions.js +422 -0
- package/build/api/marketing-and-promotions/reports.js +137 -0
- package/build/api/marketing-and-promotions/shared.js +4 -0
- package/build/{utils → auth}/oauthHelper.js +1 -1
- package/build/config/environment.js +56 -0
- package/build/schemas/marketing/ads.js +769 -0
- package/build/schemas/marketing/campaigns.js +361 -0
- package/build/schemas/marketing/common.js +152 -0
- package/build/schemas/marketing/jsonSchemas.js +118 -0
- package/build/schemas/marketing/marketing.js +10 -2016
- package/build/schemas/marketing/promotions.js +480 -0
- package/build/schemas/marketing/reports.js +162 -0
- package/build/scripts/devSync.js +28 -23
- package/build/scripts/diagnostics.js +3 -3
- package/build/scripts/interactiveSetup.js +4 -4
- package/build/{utils → scripts}/scopeHelper.js +1 -1
- package/build/{utils → scripts}/securityChecker.js +1 -1
- package/build/scripts/setup.js +4 -4
- package/build/{utils → scripts}/setupValidator.js +2 -2
- package/build/{utils → scripts}/setupWizard.js +1 -1
- package/package.json +1 -1
- package/build/tools/tool-handlers/types.js +0 -1
- /package/build/tools/{definitions/types.js → types.js} +0 -0
|
@@ -1,892 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { createInventoryItemsMethods } from './items.js';
|
|
2
|
+
import { createInventoryLocationsMethods } from './locations.js';
|
|
3
|
+
import { createInventoryOffersMethods } from './offers.js';
|
|
4
|
+
/**
|
|
5
|
+
* Composes Inventory subdomain method maps onto one facade instance.
|
|
6
|
+
*/
|
|
4
7
|
export class InventoryApi {
|
|
5
|
-
client;
|
|
6
|
-
basePath = '/sell/inventory/v1';
|
|
7
8
|
constructor(client) {
|
|
8
|
-
this
|
|
9
|
+
Object.assign(this, createInventoryItemsMethods(client), createInventoryOffersMethods(client), createInventoryLocationsMethods(client));
|
|
9
10
|
}
|
|
10
|
-
/**
|
|
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
|
-
};
|
|
892
11
|
}
|