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,422 @@
|
|
|
1
|
+
import { buildEndpointParams, requestDeleteEffect, requestGetEffect, requestPostEffect, requestPutEffect, } from '../../api/shared/request.js';
|
|
2
|
+
import { MARKETING_BASE_PATH, marketplaceHeader, } from './shared.js';
|
|
3
|
+
/** Marketing API — promotions methods closed over a shared client. */
|
|
4
|
+
export const createMarketingPromotionsMethods = (client) => ({
|
|
5
|
+
/**
|
|
6
|
+
* Create item price markdown promotion through the eBay Marketing API.
|
|
7
|
+
*
|
|
8
|
+
* @param input - Path, query, header, and request body values for createItemPriceMarkdownPromotion.
|
|
9
|
+
* @returns An Effect that succeeds with eBay's generated createItemPriceMarkdownPromotion response DTO.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const response = await Effect.runPromise(marketingApi.createItemPriceMarkdownPromotion({ request: { ... } }));
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_price_markdown/methods/createItemPriceMarkdownPromotion
|
|
17
|
+
*/
|
|
18
|
+
createItemPriceMarkdownPromotion: (input) => {
|
|
19
|
+
const path = `${MARKETING_BASE_PATH}/item_price_markdown`;
|
|
20
|
+
return requestPostEffect(client, path, input.request);
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Get item price markdown promotion through the eBay Marketing API.
|
|
24
|
+
*
|
|
25
|
+
* @param input - Path, query, header, and request body values for getItemPriceMarkdownPromotion.
|
|
26
|
+
* @returns An Effect that succeeds with eBay's generated getItemPriceMarkdownPromotion response DTO.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const response = await Effect.runPromise(marketingApi.getItemPriceMarkdownPromotion({ promotionId: 'promotion-1' }));
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_price_markdown/methods/getItemPriceMarkdownPromotion
|
|
34
|
+
*/
|
|
35
|
+
getItemPriceMarkdownPromotion: (input) => {
|
|
36
|
+
const path = `${MARKETING_BASE_PATH}/item_price_markdown/${input.promotionId}`;
|
|
37
|
+
return requestGetEffect(client, path);
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* Update item price markdown promotion through the eBay Marketing API.
|
|
41
|
+
*
|
|
42
|
+
* @param input - Path, query, header, and request body values for updateItemPriceMarkdownPromotion.
|
|
43
|
+
* @returns An Effect that succeeds with eBay's generated updateItemPriceMarkdownPromotion response DTO.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const response = await Effect.runPromise(marketingApi.updateItemPriceMarkdownPromotion({ promotionId: 'promotion-1', request: { ... } }));
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_price_markdown/methods/updateItemPriceMarkdownPromotion
|
|
51
|
+
*/
|
|
52
|
+
updateItemPriceMarkdownPromotion: (input) => {
|
|
53
|
+
const path = `${MARKETING_BASE_PATH}/item_price_markdown/${input.promotionId}`;
|
|
54
|
+
return requestPutEffect(client, path, input.request);
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Delete item price markdown promotion through the eBay Marketing API.
|
|
58
|
+
*
|
|
59
|
+
* @param input - Path, query, header, and request body values for deleteItemPriceMarkdownPromotion.
|
|
60
|
+
* @returns An Effect that succeeds with eBay's generated deleteItemPriceMarkdownPromotion response DTO.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const response = await Effect.runPromise(marketingApi.deleteItemPriceMarkdownPromotion({ promotionId: 'promotion-1' }));
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_price_markdown/methods/deleteItemPriceMarkdownPromotion
|
|
68
|
+
*/
|
|
69
|
+
deleteItemPriceMarkdownPromotion: (input) => {
|
|
70
|
+
const path = `${MARKETING_BASE_PATH}/item_price_markdown/${input.promotionId}`;
|
|
71
|
+
return requestDeleteEffect(client, path);
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* Create item promotion through the eBay Marketing API.
|
|
75
|
+
*
|
|
76
|
+
* @param input - Path, query, header, and request body values for createItemPromotion.
|
|
77
|
+
* @returns An Effect that succeeds with eBay's generated createItemPromotion response DTO.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const response = await Effect.runPromise(marketingApi.createItemPromotion({ request: { ... } }));
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_promotion/methods/createItemPromotion
|
|
85
|
+
*/
|
|
86
|
+
createItemPromotion: (input) => {
|
|
87
|
+
const path = `${MARKETING_BASE_PATH}/item_promotion`;
|
|
88
|
+
return requestPostEffect(client, path, input.request);
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Get item promotion through the eBay Marketing API.
|
|
92
|
+
*
|
|
93
|
+
* @param input - Path, query, header, and request body values for getItemPromotion.
|
|
94
|
+
* @returns An Effect that succeeds with eBay's generated getItemPromotion response DTO.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const response = await Effect.runPromise(marketingApi.getItemPromotion({ promotionId: 'promotion-1' }));
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_promotion/methods/getItemPromotion
|
|
102
|
+
*/
|
|
103
|
+
getItemPromotion: (input) => {
|
|
104
|
+
const path = `${MARKETING_BASE_PATH}/item_promotion/${input.promotionId}`;
|
|
105
|
+
return requestGetEffect(client, path);
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* Update item promotion through the eBay Marketing API.
|
|
109
|
+
*
|
|
110
|
+
* @param input - Path, query, header, and request body values for updateItemPromotion.
|
|
111
|
+
* @returns An Effect that succeeds with eBay's generated updateItemPromotion response DTO.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const response = await Effect.runPromise(marketingApi.updateItemPromotion({ promotionId: 'promotion-1', request: { ... } }));
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_promotion/methods/updateItemPromotion
|
|
119
|
+
*/
|
|
120
|
+
updateItemPromotion: (input) => {
|
|
121
|
+
const path = `${MARKETING_BASE_PATH}/item_promotion/${input.promotionId}`;
|
|
122
|
+
return requestPutEffect(client, path, input.request);
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Delete item promotion through the eBay Marketing API.
|
|
126
|
+
*
|
|
127
|
+
* @param input - Path, query, header, and request body values for deleteItemPromotion.
|
|
128
|
+
* @returns An Effect that succeeds with eBay's generated deleteItemPromotion response DTO.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* const response = await Effect.runPromise(marketingApi.deleteItemPromotion({ promotionId: 'promotion-1' }));
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/item_promotion/methods/deleteItemPromotion
|
|
136
|
+
*/
|
|
137
|
+
deleteItemPromotion: (input) => {
|
|
138
|
+
const path = `${MARKETING_BASE_PATH}/item_promotion/${input.promotionId}`;
|
|
139
|
+
return requestDeleteEffect(client, path);
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* Get listing set through the eBay Marketing API.
|
|
143
|
+
*
|
|
144
|
+
* @param input - Path, query, header, and request body values for getListingSet.
|
|
145
|
+
* @returns An Effect that succeeds with eBay's generated getListingSet response DTO.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const response = await Effect.runPromise(marketingApi.getListingSet({ promotionId: 'promotion-1' }));
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion/methods/getListingSet
|
|
153
|
+
*/
|
|
154
|
+
getListingSet: (input) => {
|
|
155
|
+
const path = `${MARKETING_BASE_PATH}/promotion/${input.promotionId}/get_listing_set`;
|
|
156
|
+
const params = buildEndpointParams({
|
|
157
|
+
limit: { wireName: 'limit', value: input.limit },
|
|
158
|
+
offset: { wireName: 'offset', value: input.offset },
|
|
159
|
+
q: { wireName: 'q', value: input.q },
|
|
160
|
+
sort: { wireName: 'sort', value: input.sort },
|
|
161
|
+
status: { wireName: 'status', value: input.status },
|
|
162
|
+
});
|
|
163
|
+
return requestGetEffect(client, path, params);
|
|
164
|
+
},
|
|
165
|
+
/**
|
|
166
|
+
* Get promotions through the eBay Marketing API.
|
|
167
|
+
*
|
|
168
|
+
* @param input - Path, query, header, and request body values for getPromotions.
|
|
169
|
+
* @returns An Effect that succeeds with eBay's generated getPromotions response DTO.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* const response = await Effect.runPromise(marketingApi.getPromotions({ marketplaceId: 'marketplace-1' }));
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion/methods/getPromotions
|
|
177
|
+
*/
|
|
178
|
+
getPromotions: (input) => {
|
|
179
|
+
const path = `${MARKETING_BASE_PATH}/promotion`;
|
|
180
|
+
const params = buildEndpointParams({
|
|
181
|
+
limit: { wireName: 'limit', value: input.limit },
|
|
182
|
+
marketplaceId: { wireName: 'marketplace_id', value: input.marketplaceId },
|
|
183
|
+
offset: { wireName: 'offset', value: input.offset },
|
|
184
|
+
promotionStatus: { wireName: 'promotion_status', value: input.promotionStatus },
|
|
185
|
+
promotionType: { wireName: 'promotion_type', value: input.promotionType },
|
|
186
|
+
q: { wireName: 'q', value: input.q },
|
|
187
|
+
sort: { wireName: 'sort', value: input.sort },
|
|
188
|
+
});
|
|
189
|
+
return requestGetEffect(client, path, params);
|
|
190
|
+
},
|
|
191
|
+
/**
|
|
192
|
+
* Pause promotion through the eBay Marketing API.
|
|
193
|
+
*
|
|
194
|
+
* @param input - Path, query, header, and request body values for pausePromotion.
|
|
195
|
+
* @returns An Effect that succeeds with eBay's generated pausePromotion response DTO.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* const response = await Effect.runPromise(marketingApi.pausePromotion({ promotionId: 'promotion-1' }));
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion/methods/pausePromotion
|
|
203
|
+
*/
|
|
204
|
+
pausePromotion: (input) => {
|
|
205
|
+
const path = `${MARKETING_BASE_PATH}/promotion/${input.promotionId}/pause`;
|
|
206
|
+
return requestPostEffect(client, path);
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* Resume promotion through the eBay Marketing API.
|
|
210
|
+
*
|
|
211
|
+
* @param input - Path, query, header, and request body values for resumePromotion.
|
|
212
|
+
* @returns An Effect that succeeds with eBay's generated resumePromotion response DTO.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```ts
|
|
216
|
+
* const response = await Effect.runPromise(marketingApi.resumePromotion({ promotionId: 'promotion-1' }));
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion/methods/resumePromotion
|
|
220
|
+
*/
|
|
221
|
+
resumePromotion: (input) => {
|
|
222
|
+
const path = `${MARKETING_BASE_PATH}/promotion/${input.promotionId}/resume`;
|
|
223
|
+
return requestPostEffect(client, path);
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* Get promotion reports through the eBay Marketing API.
|
|
227
|
+
*
|
|
228
|
+
* @param input - Path, query, header, and request body values for getPromotionReports.
|
|
229
|
+
* @returns An Effect that succeeds with eBay's generated getPromotionReports response DTO.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* const response = await Effect.runPromise(marketingApi.getPromotionReports({ marketplaceId: 'marketplace-1' }));
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion_report/methods/getPromotionReports
|
|
237
|
+
*/
|
|
238
|
+
getPromotionReports: (input) => {
|
|
239
|
+
const path = `${MARKETING_BASE_PATH}/promotion_report`;
|
|
240
|
+
const params = buildEndpointParams({
|
|
241
|
+
limit: { wireName: 'limit', value: input.limit },
|
|
242
|
+
marketplaceId: { wireName: 'marketplace_id', value: input.marketplaceId },
|
|
243
|
+
offset: { wireName: 'offset', value: input.offset },
|
|
244
|
+
promotionStatus: { wireName: 'promotion_status', value: input.promotionStatus },
|
|
245
|
+
promotionType: { wireName: 'promotion_type', value: input.promotionType },
|
|
246
|
+
q: { wireName: 'q', value: input.q },
|
|
247
|
+
});
|
|
248
|
+
return requestGetEffect(client, path, params);
|
|
249
|
+
},
|
|
250
|
+
/**
|
|
251
|
+
* Get promotion summary report through the eBay Marketing API.
|
|
252
|
+
*
|
|
253
|
+
* @param input - Path, query, header, and request body values for getPromotionSummaryReport.
|
|
254
|
+
* @returns An Effect that succeeds with eBay's generated getPromotionSummaryReport response DTO.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* const response = await Effect.runPromise(marketingApi.getPromotionSummaryReport({ marketplaceId: 'marketplace-1' }));
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/promotion_summary_report/methods/getPromotionSummaryReport
|
|
262
|
+
*/
|
|
263
|
+
getPromotionSummaryReport: (input) => {
|
|
264
|
+
const path = `${MARKETING_BASE_PATH}/promotion_summary_report`;
|
|
265
|
+
const params = buildEndpointParams({
|
|
266
|
+
marketplaceId: { wireName: 'marketplace_id', value: input.marketplaceId },
|
|
267
|
+
});
|
|
268
|
+
return requestGetEffect(client, path, params);
|
|
269
|
+
},
|
|
270
|
+
/**
|
|
271
|
+
* Get email campaigns through the eBay Marketing API.
|
|
272
|
+
*
|
|
273
|
+
* @param input - Path, query, header, and request body values for getEmailCampaigns.
|
|
274
|
+
* @returns An Effect that succeeds with eBay's generated getEmailCampaigns response DTO.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* const response = await Effect.runPromise(marketingApi.getEmailCampaigns());
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getEmailCampaigns
|
|
282
|
+
*/
|
|
283
|
+
getEmailCampaigns: (input = {}) => {
|
|
284
|
+
const path = `${MARKETING_BASE_PATH}/email_campaign`;
|
|
285
|
+
const params = buildEndpointParams({
|
|
286
|
+
limit: { wireName: 'limit', value: input.limit },
|
|
287
|
+
offset: { wireName: 'offset', value: input.offset },
|
|
288
|
+
q: { wireName: 'q', value: input.q },
|
|
289
|
+
sort: { wireName: 'sort', value: input.sort },
|
|
290
|
+
});
|
|
291
|
+
return requestGetEffect(client, path, params);
|
|
292
|
+
},
|
|
293
|
+
/**
|
|
294
|
+
* Create email campaign through the eBay Marketing API.
|
|
295
|
+
*
|
|
296
|
+
* @param input - Path, query, header, and request body values for createEmailCampaign.
|
|
297
|
+
* @returns An Effect that succeeds with eBay's generated createEmailCampaign response DTO.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```ts
|
|
301
|
+
* const response = await Effect.runPromise(marketingApi.createEmailCampaign({ marketplaceId: 'EBAY_US', request: { ... } }));
|
|
302
|
+
* ```
|
|
303
|
+
*
|
|
304
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/createEmailCampaign
|
|
305
|
+
*/
|
|
306
|
+
createEmailCampaign: (input) => {
|
|
307
|
+
const path = `${MARKETING_BASE_PATH}/email_campaign`;
|
|
308
|
+
const config = marketplaceHeader(input.marketplaceId);
|
|
309
|
+
return requestPostEffect(client, path, input.request, config);
|
|
310
|
+
},
|
|
311
|
+
/**
|
|
312
|
+
* Get email campaign through the eBay Marketing API.
|
|
313
|
+
*
|
|
314
|
+
* @param input - Path, query, header, and request body values for getEmailCampaign.
|
|
315
|
+
* @returns An Effect that succeeds with eBay's generated getEmailCampaign response DTO.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```ts
|
|
319
|
+
* const response = await Effect.runPromise(marketingApi.getEmailCampaign({ emailCampaignId: 'emailCampaign-1' }));
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getEmailCampaign
|
|
323
|
+
*/
|
|
324
|
+
getEmailCampaign: (input) => {
|
|
325
|
+
const path = `${MARKETING_BASE_PATH}/email_campaign/${input.emailCampaignId}`;
|
|
326
|
+
return requestGetEffect(client, path);
|
|
327
|
+
},
|
|
328
|
+
/**
|
|
329
|
+
* Update email campaign through the eBay Marketing API.
|
|
330
|
+
*
|
|
331
|
+
* @param input - Path, query, header, and request body values for updateEmailCampaign.
|
|
332
|
+
* @returns An Effect that succeeds with eBay's generated updateEmailCampaign response DTO.
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```ts
|
|
336
|
+
* const response = await Effect.runPromise(marketingApi.updateEmailCampaign({ emailCampaignId: 'emailCampaign-1', request: { ... } }));
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/updateEmailCampaign
|
|
340
|
+
*/
|
|
341
|
+
updateEmailCampaign: (input) => {
|
|
342
|
+
const path = `${MARKETING_BASE_PATH}/email_campaign/${input.emailCampaignId}`;
|
|
343
|
+
return requestPutEffect(client, path, input.request);
|
|
344
|
+
},
|
|
345
|
+
/**
|
|
346
|
+
* Delete email campaign through the eBay Marketing API.
|
|
347
|
+
*
|
|
348
|
+
* @param input - Path, query, header, and request body values for deleteEmailCampaign.
|
|
349
|
+
* @returns An Effect that succeeds with eBay's generated deleteEmailCampaign response DTO.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```ts
|
|
353
|
+
* const response = await Effect.runPromise(marketingApi.deleteEmailCampaign({ emailCampaignId: 'emailCampaign-1' }));
|
|
354
|
+
* ```
|
|
355
|
+
*
|
|
356
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/deleteEmailCampaign
|
|
357
|
+
*/
|
|
358
|
+
deleteEmailCampaign: (input) => {
|
|
359
|
+
const path = `${MARKETING_BASE_PATH}/email_campaign/${input.emailCampaignId}`;
|
|
360
|
+
return requestDeleteEffect(client, path);
|
|
361
|
+
},
|
|
362
|
+
/**
|
|
363
|
+
* Get audiences through the eBay Marketing API.
|
|
364
|
+
*
|
|
365
|
+
* @param input - Path, query, header, and request body values for getAudiences.
|
|
366
|
+
* @returns An Effect that succeeds with eBay's generated getAudiences response DTO.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```ts
|
|
370
|
+
* const response = await Effect.runPromise(marketingApi.getAudiences({ emailCampaignType: 'emailCampaignType-1' }));
|
|
371
|
+
* ```
|
|
372
|
+
*
|
|
373
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getAudiences
|
|
374
|
+
*/
|
|
375
|
+
getAudiences: (input) => {
|
|
376
|
+
const path = `${MARKETING_BASE_PATH}/email_campaign/audience`;
|
|
377
|
+
const params = buildEndpointParams({
|
|
378
|
+
emailCampaignType: { wireName: 'emailCampaignType', value: input.emailCampaignType },
|
|
379
|
+
limit: { wireName: 'limit', value: input.limit },
|
|
380
|
+
offset: { wireName: 'offset', value: input.offset },
|
|
381
|
+
});
|
|
382
|
+
return requestGetEffect(client, path, params);
|
|
383
|
+
},
|
|
384
|
+
/**
|
|
385
|
+
* Get email preview through the eBay Marketing API.
|
|
386
|
+
*
|
|
387
|
+
* @param input - Path, query, header, and request body values for getEmailPreview.
|
|
388
|
+
* @returns An Effect that succeeds with eBay's generated getEmailPreview response DTO.
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```ts
|
|
392
|
+
* const response = await Effect.runPromise(marketingApi.getEmailPreview({ emailCampaignId: 'emailCampaign-1' }));
|
|
393
|
+
* ```
|
|
394
|
+
*
|
|
395
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getEmailPreview
|
|
396
|
+
*/
|
|
397
|
+
getEmailPreview: (input) => {
|
|
398
|
+
const path = `${MARKETING_BASE_PATH}/email_campaign/${input.emailCampaignId}/email_preview`;
|
|
399
|
+
return requestGetEffect(client, path);
|
|
400
|
+
},
|
|
401
|
+
/**
|
|
402
|
+
* Get email report through the eBay Marketing API.
|
|
403
|
+
*
|
|
404
|
+
* @param input - Path, query, header, and request body values for getEmailReport.
|
|
405
|
+
* @returns An Effect that succeeds with eBay's generated getEmailReport response DTO.
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```ts
|
|
409
|
+
* const response = await Effect.runPromise(marketingApi.getEmailReport({ endDate: 'endDate-1', startDate: 'startDate-1' }));
|
|
410
|
+
* ```
|
|
411
|
+
*
|
|
412
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/email_campaign/methods/getEmailReport
|
|
413
|
+
*/
|
|
414
|
+
getEmailReport: (input) => {
|
|
415
|
+
const path = `${MARKETING_BASE_PATH}/email_campaign/report`;
|
|
416
|
+
const params = buildEndpointParams({
|
|
417
|
+
endDate: { wireName: 'endDate', value: input.endDate },
|
|
418
|
+
startDate: { wireName: 'startDate', value: input.startDate },
|
|
419
|
+
});
|
|
420
|
+
return requestGetEffect(client, path, params);
|
|
421
|
+
},
|
|
422
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { buildEndpointParams, requestDeleteEffect, requestGetEffect, requestPostEffect, } from '../../api/shared/request.js';
|
|
2
|
+
import { MARKETING_BASE_PATH } from './shared.js';
|
|
3
|
+
/** Marketing API — reports methods closed over a shared client. */
|
|
4
|
+
export const createMarketingReportsMethods = (client) => ({
|
|
5
|
+
/**
|
|
6
|
+
* Get report through the eBay Marketing API.
|
|
7
|
+
*
|
|
8
|
+
* @param input - Path, query, header, and request body values for getReport.
|
|
9
|
+
* @returns An Effect that succeeds with eBay's generated getReport response DTO.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const response = await Effect.runPromise(marketingApi.getReport({ reportId: 'report-1' }));
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report/methods/getReport
|
|
17
|
+
*/
|
|
18
|
+
getReport: (input) => {
|
|
19
|
+
const path = `${MARKETING_BASE_PATH}/ad_report/${input.reportId}`;
|
|
20
|
+
return requestGetEffect(client, path);
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Get report metadata through the eBay Marketing API.
|
|
24
|
+
*
|
|
25
|
+
* @param input - Path, query, header, and request body values for getReportMetadata.
|
|
26
|
+
* @returns An Effect that succeeds with eBay's generated getReportMetadata response DTO.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const response = await Effect.runPromise(marketingApi.getReportMetadata());
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_metadata/methods/getReportMetadata
|
|
34
|
+
*/
|
|
35
|
+
getReportMetadata: (input = {}) => {
|
|
36
|
+
const path = `${MARKETING_BASE_PATH}/ad_report_metadata`;
|
|
37
|
+
const params = buildEndpointParams({
|
|
38
|
+
fundingModel: { wireName: 'funding_model', value: input.fundingModel },
|
|
39
|
+
channel: { wireName: 'channel', value: input.channel },
|
|
40
|
+
});
|
|
41
|
+
return requestGetEffect(client, path, params);
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Get report metadata for report type through the eBay Marketing API.
|
|
45
|
+
*
|
|
46
|
+
* @param input - Path, query, header, and request body values for getReportMetadataForReportType.
|
|
47
|
+
* @returns An Effect that succeeds with eBay's generated getReportMetadataForReportType response DTO.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const response = await Effect.runPromise(marketingApi.getReportMetadataForReportType({ reportType: 'reportType-1' }));
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_metadata/methods/getReportMetadataForReportType
|
|
55
|
+
*/
|
|
56
|
+
getReportMetadataForReportType: (input) => {
|
|
57
|
+
const path = `${MARKETING_BASE_PATH}/ad_report_metadata/${input.reportType}`;
|
|
58
|
+
const params = buildEndpointParams({
|
|
59
|
+
fundingModel: { wireName: 'funding_model', value: input.fundingModel },
|
|
60
|
+
channel: { wireName: 'channel', value: input.channel },
|
|
61
|
+
});
|
|
62
|
+
return requestGetEffect(client, path, params);
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Get report tasks through the eBay Marketing API.
|
|
66
|
+
*
|
|
67
|
+
* @param input - Path, query, header, and request body values for getReportTasks.
|
|
68
|
+
* @returns An Effect that succeeds with eBay's generated getReportTasks response DTO.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const response = await Effect.runPromise(marketingApi.getReportTasks());
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_task/methods/getReportTasks
|
|
76
|
+
*/
|
|
77
|
+
getReportTasks: (input = {}) => {
|
|
78
|
+
const path = `${MARKETING_BASE_PATH}/ad_report_task`;
|
|
79
|
+
const params = buildEndpointParams({
|
|
80
|
+
limit: { wireName: 'limit', value: input.limit },
|
|
81
|
+
offset: { wireName: 'offset', value: input.offset },
|
|
82
|
+
reportTaskStatuses: { wireName: 'report_task_statuses', value: input.reportTaskStatuses },
|
|
83
|
+
});
|
|
84
|
+
return requestGetEffect(client, path, params);
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Create report task through the eBay Marketing API.
|
|
88
|
+
*
|
|
89
|
+
* @param input - Path, query, header, and request body values for createReportTask.
|
|
90
|
+
* @returns An Effect that succeeds with eBay's generated createReportTask response DTO.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* const response = await Effect.runPromise(marketingApi.createReportTask({ request: { ... } }));
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_task/methods/createReportTask
|
|
98
|
+
*/
|
|
99
|
+
createReportTask: (input) => {
|
|
100
|
+
const path = `${MARKETING_BASE_PATH}/ad_report_task`;
|
|
101
|
+
return requestPostEffect(client, path, input.request);
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* Get report task through the eBay Marketing API.
|
|
105
|
+
*
|
|
106
|
+
* @param input - Path, query, header, and request body values for getReportTask.
|
|
107
|
+
* @returns An Effect that succeeds with eBay's generated getReportTask response DTO.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const response = await Effect.runPromise(marketingApi.getReportTask({ reportTaskId: 'reportTask-1' }));
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_task/methods/getReportTask
|
|
115
|
+
*/
|
|
116
|
+
getReportTask: (input) => {
|
|
117
|
+
const path = `${MARKETING_BASE_PATH}/ad_report_task/${input.reportTaskId}`;
|
|
118
|
+
return requestGetEffect(client, path);
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Delete report task through the eBay Marketing API.
|
|
122
|
+
*
|
|
123
|
+
* @param input - Path, query, header, and request body values for deleteReportTask.
|
|
124
|
+
* @returns An Effect that succeeds with eBay's generated deleteReportTask response DTO.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const response = await Effect.runPromise(marketingApi.deleteReportTask({ reportTaskId: 'reportTask-1' }));
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/ad_report_task/methods/deleteReportTask
|
|
132
|
+
*/
|
|
133
|
+
deleteReportTask: (input) => {
|
|
134
|
+
const path = `${MARKETING_BASE_PATH}/ad_report_task/${input.reportTaskId}`;
|
|
135
|
+
return requestDeleteEffect(client, path);
|
|
136
|
+
},
|
|
137
|
+
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { createServer } from 'http';
|
|
6
6
|
import { getOAuthAuthorizationUrl } from '../config/environment.js';
|
|
7
|
-
import { writeCliLine } from '
|
|
7
|
+
import { writeCliLine } from '../utils/cliOutput.js';
|
|
8
8
|
/**
|
|
9
9
|
* Generate terminal hyperlink (if supported)
|
|
10
10
|
*/
|
|
@@ -219,6 +219,62 @@ export const getEbayConfig = () => {
|
|
|
219
219
|
disableAuthHeader,
|
|
220
220
|
};
|
|
221
221
|
};
|
|
222
|
+
/**
|
|
223
|
+
* Trading API site IDs for each REST marketplace ID.
|
|
224
|
+
*
|
|
225
|
+
* The Trading API predates the REST marketplace IDs and identifies a site with
|
|
226
|
+
* a numeric `X-EBAY-API-SITEID` header instead. The mapping is fixed by eBay.
|
|
227
|
+
*
|
|
228
|
+
* @see https://developer.ebay.com/devzone/merchandising/docs/CallRef/Enums/GlobalIdList.html
|
|
229
|
+
*/
|
|
230
|
+
const TRADING_SITE_IDS = {
|
|
231
|
+
EBAY_AT: '16',
|
|
232
|
+
EBAY_AU: '15',
|
|
233
|
+
EBAY_BE: '23',
|
|
234
|
+
EBAY_CA: '2',
|
|
235
|
+
EBAY_CH: '193',
|
|
236
|
+
EBAY_DE: '77',
|
|
237
|
+
EBAY_ES: '186',
|
|
238
|
+
EBAY_FR: '71',
|
|
239
|
+
EBAY_GB: '3',
|
|
240
|
+
EBAY_HK: '201',
|
|
241
|
+
EBAY_IE: '205',
|
|
242
|
+
EBAY_IN: '203',
|
|
243
|
+
EBAY_IT: '101',
|
|
244
|
+
EBAY_MY: '207',
|
|
245
|
+
EBAY_NL: '146',
|
|
246
|
+
EBAY_PH: '211',
|
|
247
|
+
EBAY_PL: '212',
|
|
248
|
+
EBAY_SG: '216',
|
|
249
|
+
EBAY_US: '0',
|
|
250
|
+
};
|
|
251
|
+
const DEFAULT_TRADING_SITE_ID = '0';
|
|
252
|
+
/**
|
|
253
|
+
* Get the Trading API site ID for the configured marketplace.
|
|
254
|
+
*
|
|
255
|
+
* Derived from `EBAY_MARKETPLACE_ID` so a single setting drives both REST and
|
|
256
|
+
* Trading traffic. `EBAY_SITE_ID` overrides it for sites this map does not
|
|
257
|
+
* cover, or when REST and Trading must target different sites.
|
|
258
|
+
*
|
|
259
|
+
* Listing on a non-US site with the wrong site ID fails at eBay: the currency
|
|
260
|
+
* belongs to the marketplace, so an EUR listing sent to site 0 is rejected
|
|
261
|
+
* with "Invalid auction currency".
|
|
262
|
+
*
|
|
263
|
+
* @returns Numeric Trading API site ID sent as `X-EBAY-API-SITEID`.
|
|
264
|
+
* @example
|
|
265
|
+
* ```ts
|
|
266
|
+
* // EBAY_MARKETPLACE_ID=EBAY_DE
|
|
267
|
+
* const siteId = getTradingSiteId(); // '77'
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
export const getTradingSiteId = () => {
|
|
271
|
+
const override = (process.env.EBAY_SITE_ID ?? '').trim();
|
|
272
|
+
if (override !== '') {
|
|
273
|
+
return override;
|
|
274
|
+
}
|
|
275
|
+
const marketplaceId = (process.env.EBAY_MARKETPLACE_ID ?? '').trim() || 'EBAY_US';
|
|
276
|
+
return TRADING_SITE_IDS[marketplaceId] ?? DEFAULT_TRADING_SITE_ID;
|
|
277
|
+
};
|
|
222
278
|
/**
|
|
223
279
|
* Get the eBay REST API base URL for the configured environment.
|
|
224
280
|
*
|