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
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { buildEndpointParams, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, optionalStringEffect, 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 — offers methods closed over a shared client. */
|
|
5
|
+
export const createInventoryOffersMethods = (client) => ({
|
|
6
|
+
/**
|
|
7
|
+
* Creates multiple offers.
|
|
8
|
+
*
|
|
9
|
+
* @param input - Generated BulkEbayOfferDetailsWithKeys body.
|
|
10
|
+
* @returns An Effect that succeeds with eBay's BulkOfferResponse.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const result = await Effect.runPromise(inventoryApi.bulkCreateOffer({ body: { requests: [] } }));
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/bulkCreateOffer
|
|
18
|
+
*/
|
|
19
|
+
bulkCreateOffer: (input) => {
|
|
20
|
+
const path = `${INVENTORY_BASE_PATH}/bulk_create_offer`;
|
|
21
|
+
return Effect.gen(function* () {
|
|
22
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
23
|
+
const body = yield* requireObjectEffect(validatedInput.body, 'body');
|
|
24
|
+
return yield* requestPostEffect(client, path, body);
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Publishes multiple offers.
|
|
29
|
+
*
|
|
30
|
+
* @param input - Generated BulkOffer body.
|
|
31
|
+
* @returns An Effect that succeeds with eBay's BulkPublishResponse.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const result = await Effect.runPromise(inventoryApi.bulkPublishOffer({ body: { offers: [] } }));
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/bulkPublishOffer
|
|
39
|
+
*/
|
|
40
|
+
bulkPublishOffer: (input) => {
|
|
41
|
+
const path = `${INVENTORY_BASE_PATH}/bulk_publish_offer`;
|
|
42
|
+
return Effect.gen(function* () {
|
|
43
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
44
|
+
const body = yield* requireObjectEffect(validatedInput.body, 'body');
|
|
45
|
+
return yield* requestPostEffect(client, path, body);
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves offers with optional filters.
|
|
50
|
+
*
|
|
51
|
+
* @param input - Optional offer filters and pagination controls.
|
|
52
|
+
* @returns An Effect that succeeds with eBay's Offers response.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const offers = await Effect.runPromise(
|
|
57
|
+
* inventoryApi.getOffers({ sku: 'SKU-1', marketplaceId: 'EBAY_US' }),
|
|
58
|
+
* );
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/getOffers
|
|
62
|
+
*/
|
|
63
|
+
getOffers: (input = {}) => {
|
|
64
|
+
const path = `${INVENTORY_BASE_PATH}/offer`;
|
|
65
|
+
return Effect.gen(function* () {
|
|
66
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
67
|
+
const format = yield* optionalStringEffect(validatedInput.format, 'format');
|
|
68
|
+
const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
|
|
69
|
+
const marketplaceId = yield* optionalStringEffect(validatedInput.marketplaceId, 'marketplaceId');
|
|
70
|
+
const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
|
|
71
|
+
const sku = yield* optionalStringEffect(validatedInput.sku, 'sku');
|
|
72
|
+
const params = buildEndpointParams({
|
|
73
|
+
format: { wireName: 'format', value: format },
|
|
74
|
+
limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
|
|
75
|
+
marketplaceId: { wireName: 'marketplace_id', value: marketplaceId },
|
|
76
|
+
offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
|
|
77
|
+
sku: { wireName: 'sku', value: sku },
|
|
78
|
+
});
|
|
79
|
+
return yield* requestGetEffect(client, path, params);
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Creates one offer.
|
|
84
|
+
*
|
|
85
|
+
* @param input - Generated EbayOfferDetailsWithKeys body.
|
|
86
|
+
* @returns An Effect that succeeds with eBay's OfferResponse.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const offer = await Effect.runPromise(inventoryApi.createOffer({ body: { sku: 'SKU-1' } }));
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/createOffer
|
|
94
|
+
*/
|
|
95
|
+
createOffer: (input) => {
|
|
96
|
+
const path = `${INVENTORY_BASE_PATH}/offer`;
|
|
97
|
+
return Effect.gen(function* () {
|
|
98
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
99
|
+
const body = yield* requireObjectEffect(validatedInput.body, 'body');
|
|
100
|
+
return yield* requestPostEffect(client, path, body);
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* Retrieves one offer by ID.
|
|
105
|
+
*
|
|
106
|
+
* @param input - eBay offer identifier.
|
|
107
|
+
* @returns An Effect that succeeds with eBay's EbayOfferDetailsWithAll response.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const offer = await Effect.runPromise(inventoryApi.getOffer({ offerId: 'OFFER-1' }));
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/getOffer
|
|
115
|
+
*/
|
|
116
|
+
getOffer: (input) => {
|
|
117
|
+
const basePath = INVENTORY_BASE_PATH;
|
|
118
|
+
return Effect.gen(function* () {
|
|
119
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
120
|
+
const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
|
|
121
|
+
return yield* requestGetEffect(client, `${basePath}/offer/${offerId}`);
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Updates one offer by ID.
|
|
126
|
+
*
|
|
127
|
+
* @param input - eBay offer identifier and generated EbayOfferDetailsWithId body.
|
|
128
|
+
* @returns An Effect that succeeds with eBay's OfferResponse.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* await Effect.runPromise(
|
|
133
|
+
* inventoryApi.updateOffer({ offerId: 'OFFER-1', body: { offerId: 'OFFER-1' } }),
|
|
134
|
+
* );
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/updateOffer
|
|
138
|
+
*/
|
|
139
|
+
updateOffer: (input) => {
|
|
140
|
+
const basePath = INVENTORY_BASE_PATH;
|
|
141
|
+
return Effect.gen(function* () {
|
|
142
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
143
|
+
const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
|
|
144
|
+
const body = yield* requireObjectEffect(validatedInput.body, 'body');
|
|
145
|
+
return yield* requestPutEffect(client, `${basePath}/offer/${offerId}`, body);
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* Deletes one offer by ID.
|
|
150
|
+
*
|
|
151
|
+
* @param input - eBay offer identifier.
|
|
152
|
+
* @returns An Effect that succeeds when eBay returns no content.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* await Effect.runPromise(inventoryApi.deleteOffer({ offerId: 'OFFER-1' }));
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/deleteOffer
|
|
160
|
+
*/
|
|
161
|
+
deleteOffer: (input) => {
|
|
162
|
+
const basePath = INVENTORY_BASE_PATH;
|
|
163
|
+
return Effect.gen(function* () {
|
|
164
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
165
|
+
const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
|
|
166
|
+
return yield* requestDeleteEffect(client, `${basePath}/offer/${offerId}`);
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* Retrieves listing fees for unpublished offers.
|
|
171
|
+
*
|
|
172
|
+
* @param input - Generated OfferKeysWithId body.
|
|
173
|
+
* @returns An Effect that succeeds with eBay's FeesSummaryResponse.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* const fees = await Effect.runPromise(
|
|
178
|
+
* inventoryApi.getListingFees({ body: { offers: [{ offerId: 'OFFER-1' }] } }),
|
|
179
|
+
* );
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/getListingFees
|
|
183
|
+
*/
|
|
184
|
+
getListingFees: (input) => {
|
|
185
|
+
const path = `${INVENTORY_BASE_PATH}/offer/get_listing_fees`;
|
|
186
|
+
return Effect.gen(function* () {
|
|
187
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
188
|
+
const body = yield* requireObjectEffect(validatedInput.body, 'body');
|
|
189
|
+
return yield* requestPostEffect(client, path, body);
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* Publishes one offer by ID.
|
|
194
|
+
*
|
|
195
|
+
* @param input - eBay offer identifier.
|
|
196
|
+
* @returns An Effect that succeeds with eBay's PublishResponse.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* const publish = await Effect.runPromise(inventoryApi.publishOffer({ offerId: 'OFFER-1' }));
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/publishOffer
|
|
204
|
+
*/
|
|
205
|
+
publishOffer: (input) => {
|
|
206
|
+
const basePath = INVENTORY_BASE_PATH;
|
|
207
|
+
return Effect.gen(function* () {
|
|
208
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
209
|
+
const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
|
|
210
|
+
return yield* requestPostEffect(client, `${basePath}/offer/${offerId}/publish`);
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Publishes offers for one inventory item group.
|
|
215
|
+
*
|
|
216
|
+
* @param input - Generated PublishByInventoryItemGroupRequest body.
|
|
217
|
+
* @returns An Effect that succeeds with eBay's PublishResponse.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```ts
|
|
221
|
+
* const publish = await Effect.runPromise(
|
|
222
|
+
* inventoryApi.publishOfferByInventoryItemGroup({
|
|
223
|
+
* body: { inventoryItemGroupKey: 'GROUP-1', marketplaceId: 'EBAY_US' },
|
|
224
|
+
* }),
|
|
225
|
+
* );
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/publishOfferByInventoryItemGroup
|
|
229
|
+
*/
|
|
230
|
+
publishOfferByInventoryItemGroup: (input) => {
|
|
231
|
+
const path = `${INVENTORY_BASE_PATH}/offer/publish_by_inventory_item_group`;
|
|
232
|
+
return Effect.gen(function* () {
|
|
233
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
234
|
+
const body = yield* requireObjectEffect(validatedInput.body, 'body');
|
|
235
|
+
return yield* requestPostEffect(client, path, body);
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* Withdraws one offer by ID.
|
|
240
|
+
*
|
|
241
|
+
* @param input - eBay offer identifier.
|
|
242
|
+
* @returns An Effect that succeeds with eBay's WithdrawResponse.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* const withdraw = await Effect.runPromise(inventoryApi.withdrawOffer({ offerId: 'OFFER-1' }));
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/withdrawOffer
|
|
250
|
+
*/
|
|
251
|
+
withdrawOffer: (input) => {
|
|
252
|
+
const basePath = INVENTORY_BASE_PATH;
|
|
253
|
+
return Effect.gen(function* () {
|
|
254
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
255
|
+
const offerId = yield* requireStringEffect(validatedInput.offerId, 'offerId');
|
|
256
|
+
return yield* requestPostEffect(client, `${basePath}/offer/${offerId}/withdraw`);
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
/**
|
|
260
|
+
* Withdraws offers for one inventory item group.
|
|
261
|
+
*
|
|
262
|
+
* @param input - Generated WithdrawByInventoryItemGroupRequest body.
|
|
263
|
+
* @returns An Effect that succeeds when eBay returns no content.
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* await Effect.runPromise(
|
|
268
|
+
* inventoryApi.withdrawOfferByInventoryItemGroup({
|
|
269
|
+
* body: { inventoryItemGroupKey: 'GROUP-1', marketplaceId: 'EBAY_US' },
|
|
270
|
+
* }),
|
|
271
|
+
* );
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* @see https://developer.ebay.com/api-docs/sell/inventory/resources/offer/methods/withdrawOfferByInventoryItemGroup
|
|
275
|
+
*/
|
|
276
|
+
withdrawOfferByInventoryItemGroup: (input) => {
|
|
277
|
+
const path = `${INVENTORY_BASE_PATH}/offer/withdraw_by_inventory_item_group`;
|
|
278
|
+
return Effect.gen(function* () {
|
|
279
|
+
const validatedInput = yield* requireObjectEffect(input, 'input');
|
|
280
|
+
const body = yield* requireObjectEffect(validatedInput.body, 'body');
|
|
281
|
+
return yield* requestPostEffect(client, path, body);
|
|
282
|
+
});
|
|
283
|
+
},
|
|
284
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const INVENTORY_BASE_PATH = '/sell/inventory/v1';
|