ebay-mcp 1.18.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -16
- package/build/api/account-management/account.js +2 -2
- package/build/api/account-management/accountV2.js +0 -6
- package/build/api/account-management/finances.js +7 -5
- package/build/api/client/ebayApiClient.js +111 -10
- package/build/api/client/signEbayRequest.js +124 -0
- package/build/api/communication/feedback.js +4 -4
- package/build/api/developer/developer.js +43 -7
- package/build/api/ebaySellerApi.js +0 -4
- package/build/api/marketing-and-promotions/campaigns.js +0 -34
- package/build/api/order-management/dispute.js +29 -20
- package/build/api/order-management/fulfillment.js +2 -1
- package/build/api/other/edelivery.js +3 -3
- package/build/api/other/translation.js +1 -1
- package/build/config/environment.js +31 -3
- package/build/schemas/account-management/account.js +1 -1
- package/build/schemas/account-management/accountV2.js +3 -4
- package/build/schemas/communication/messages.js +2 -2
- package/build/schemas/marketing/campaigns.js +0 -21
- package/build/schemas/other/otherApis.js +2 -85
- package/build/scripts/devSync.js +75 -225
- package/build/scripts/specCoverage.js +78 -0
- package/build/scripts/specDownload.js +42 -0
- package/build/scripts/specRefs.js +2 -3
- package/build/scripts/specSources.js +4 -6
- package/build/scripts/specTypeNames.js +23 -0
- package/build/skills/content.js +2 -2
- package/build/tools/categories/account.js +3 -3
- package/build/tools/categories/communication.js +5 -5
- package/build/tools/categories/developer.js +1 -1
- package/build/tools/categories/finances.js +2 -2
- package/build/tools/categories/marketing.js +0 -16
- package/build/tools/categories/other.js +3 -17
- package/build/types/ebay.js +0 -1
- package/build/types/ebayEnums.js +0 -40
- package/build/ui/card.html +23 -23
- package/build/ui/chart.html +22 -22
- package/build/ui/stat.html +23 -23
- package/build/ui/table.html +21 -21
- package/build/utils/communication/feedback.js +3 -3
- package/build/utils/errors.js +1 -0
- package/package.json +5 -5
- package/build/api/other/compliance.js +0 -60
- package/build/utils/other/compliance.js +0 -56
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { buildEndpointParams, requestGetEffect, requestPostEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
|
|
1
|
+
import { buildEndpointParams, EbayApiError, requestGetEffect, requestPostEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
|
|
2
|
+
import { getClientRegistrationBaseUrl, getIdentityBaseUrl } from '../../config/environment.js';
|
|
2
3
|
import { Effect } from 'effect';
|
|
3
4
|
/**
|
|
4
5
|
* Developer API - Rate limits, client registration, and signing keys
|
|
@@ -10,8 +11,29 @@ import { Effect } from 'effect';
|
|
|
10
11
|
export class DeveloperApi {
|
|
11
12
|
client;
|
|
12
13
|
analyticsBasePath = '/developer/analytics/v1_beta';
|
|
13
|
-
clientBasePath = '/developer/
|
|
14
|
+
clientBasePath = '/developer/registration/v1';
|
|
14
15
|
keyBasePath = '/developer/key_management/v1';
|
|
16
|
+
/**
|
|
17
|
+
* Key Management is served from the apiz host (api.ebay.com answers 404) and
|
|
18
|
+
* authenticates with a client-credentials application token.
|
|
19
|
+
*/
|
|
20
|
+
keyRequestConfig = {
|
|
21
|
+
absolute: true,
|
|
22
|
+
tokenType: 'application',
|
|
23
|
+
};
|
|
24
|
+
/** Full apiz URL for a Key Management path, honouring EBAY_MCP_API_BASE_URL. */
|
|
25
|
+
keyUrl = (path) => {
|
|
26
|
+
const { environment, apiBaseUrl } = this.client.getConfig();
|
|
27
|
+
const identityBaseUrl = getIdentityBaseUrl(environment, apiBaseUrl);
|
|
28
|
+
return `${identityBaseUrl}${path}`;
|
|
29
|
+
};
|
|
30
|
+
getFromKeyManagement = (path) => Effect.tryPromise({
|
|
31
|
+
try: () => {
|
|
32
|
+
const url = this.keyUrl(path);
|
|
33
|
+
return this.client.get(url, undefined, this.keyRequestConfig);
|
|
34
|
+
},
|
|
35
|
+
catch: (cause) => new EbayApiError({ method: 'GET', path, cause }), // allow-duplicate
|
|
36
|
+
});
|
|
15
37
|
constructor(client) {
|
|
16
38
|
this.client = client;
|
|
17
39
|
}
|
|
@@ -64,7 +86,7 @@ export class DeveloperApi {
|
|
|
64
86
|
// CLIENT REGISTRATION
|
|
65
87
|
// ========================================
|
|
66
88
|
/**
|
|
67
|
-
* Registers a third-party financial application with eBay.
|
|
89
|
+
* Registers a third-party financial application with eBay through the tppz host.
|
|
68
90
|
*
|
|
69
91
|
* @param input - Generated ClientSettings request body.
|
|
70
92
|
* @returns An Effect that succeeds with eBay's generated ClientDetails response.
|
|
@@ -78,7 +100,11 @@ export class DeveloperApi {
|
|
|
78
100
|
*
|
|
79
101
|
* @see https://developer.ebay.com/api-docs/developer/client_registration/resources/client/methods/registerClient
|
|
80
102
|
*/
|
|
81
|
-
registerClient = (input) =>
|
|
103
|
+
registerClient = (input) => {
|
|
104
|
+
const { environment, apiBaseUrl } = this.client.getConfig();
|
|
105
|
+
const registrationBaseUrl = getClientRegistrationBaseUrl(environment, apiBaseUrl);
|
|
106
|
+
return requestPostEffect(this.client, `${registrationBaseUrl}${this.clientBasePath}/client/register`, input.clientSettings, { absolute: true });
|
|
107
|
+
};
|
|
82
108
|
// ========================================
|
|
83
109
|
// SIGNING KEY MANAGEMENT
|
|
84
110
|
// ========================================
|
|
@@ -97,7 +123,7 @@ export class DeveloperApi {
|
|
|
97
123
|
*/
|
|
98
124
|
getSigningKeys = (input = {}) => {
|
|
99
125
|
void input;
|
|
100
|
-
return
|
|
126
|
+
return this.getFromKeyManagement(`${this.keyBasePath}/signing_key`);
|
|
101
127
|
};
|
|
102
128
|
/**
|
|
103
129
|
* Creates a signing keypair for API digital signatures.
|
|
@@ -114,7 +140,17 @@ export class DeveloperApi {
|
|
|
114
140
|
*
|
|
115
141
|
* @see https://developer.ebay.com/api-docs/developer/key_management/resources/signing_key/methods/createSigningKey
|
|
116
142
|
*/
|
|
117
|
-
createSigningKey = (input = {}) =>
|
|
143
|
+
createSigningKey = (input = {}) => {
|
|
144
|
+
const path = `${this.keyBasePath}/signing_key`;
|
|
145
|
+
const signingKeyRequest = input.request || {};
|
|
146
|
+
return Effect.tryPromise({
|
|
147
|
+
try: () => {
|
|
148
|
+
const url = this.keyUrl(path);
|
|
149
|
+
return this.client.post(url, signingKeyRequest, this.keyRequestConfig);
|
|
150
|
+
},
|
|
151
|
+
catch: (cause) => new EbayApiError({ method: 'POST', path, cause }), // allow-duplicate
|
|
152
|
+
});
|
|
153
|
+
};
|
|
118
154
|
/**
|
|
119
155
|
* Retrieves a specific signing key by eBay signing key ID.
|
|
120
156
|
*
|
|
@@ -131,6 +167,6 @@ export class DeveloperApi {
|
|
|
131
167
|
getSigningKey = (input) => Effect.gen(this, function* () {
|
|
132
168
|
const endpointInput = yield* requireObjectEffect(input, 'input');
|
|
133
169
|
const signingKeyId = yield* requireStringEffect(endpointInput.signingKeyId, 'signingKeyId');
|
|
134
|
-
return yield*
|
|
170
|
+
return yield* this.getFromKeyManagement(`${this.keyBasePath}/signing_key/${encodeURIComponent(signingKeyId)}`);
|
|
135
171
|
});
|
|
136
172
|
}
|
|
@@ -20,7 +20,6 @@ import { RecommendationApi } from '../api/marketing-and-promotions/recommendatio
|
|
|
20
20
|
import { DisputeApi } from '../api/order-management/dispute.js';
|
|
21
21
|
import { FulfillmentApi } from '../api/order-management/fulfillment.js';
|
|
22
22
|
import { LogisticsApi } from '../api/order-management/logistics.js';
|
|
23
|
-
import { ComplianceApi } from '../api/other/compliance.js';
|
|
24
23
|
import { EDeliveryApi } from '../api/other/edelivery.js';
|
|
25
24
|
import { BrowseApi } from '../api/other/browse.js';
|
|
26
25
|
import { FindingApi } from '../api/other/finding.js';
|
|
@@ -57,7 +56,6 @@ export class EbaySellerApi {
|
|
|
57
56
|
notification;
|
|
58
57
|
feedback;
|
|
59
58
|
identity;
|
|
60
|
-
compliance;
|
|
61
59
|
vero;
|
|
62
60
|
translation;
|
|
63
61
|
edelivery;
|
|
@@ -90,7 +88,6 @@ export class EbaySellerApi {
|
|
|
90
88
|
this.notification = new NotificationApi(this.client);
|
|
91
89
|
this.feedback = new FeedbackApi(this.client);
|
|
92
90
|
this.identity = new IdentityApi(this.client);
|
|
93
|
-
this.compliance = new ComplianceApi(this.client);
|
|
94
91
|
this.vero = new VeroApi(this.client);
|
|
95
92
|
this.translation = new TranslationApi(this.client);
|
|
96
93
|
this.edelivery = new EDeliveryApi(this.client);
|
|
@@ -168,7 +165,6 @@ export * from '../api/marketing-and-promotions/recommendation.js';
|
|
|
168
165
|
export * from '../api/order-management/dispute.js';
|
|
169
166
|
export * from '../api/order-management/fulfillment.js';
|
|
170
167
|
export * from '../api/order-management/logistics.js';
|
|
171
|
-
export * from '../api/other/compliance.js';
|
|
172
168
|
export * from '../api/other/edelivery.js';
|
|
173
169
|
export { BrowseApi } from '../api/other/browse.js';
|
|
174
170
|
export { buildBrowseFilter, requireNoPriceFilterConflict } from '../api/other/browseFilter.js';
|
|
@@ -166,23 +166,6 @@ export const createMarketingCampaignsMethods = (client) => ({
|
|
|
166
166
|
});
|
|
167
167
|
return requestGetEffect(client, path, params);
|
|
168
168
|
},
|
|
169
|
-
/**
|
|
170
|
-
* Launch campaign through the eBay Marketing API.
|
|
171
|
-
*
|
|
172
|
-
* @param input - Path, query, header, and request body values for launchCampaign.
|
|
173
|
-
* @returns An Effect that succeeds with eBay's generated launchCampaign response DTO.
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* ```ts
|
|
177
|
-
* await Effect.runPromise(marketingApi.launchCampaign({ campaignId: 'campaign-1' }));
|
|
178
|
-
* ```
|
|
179
|
-
*
|
|
180
|
-
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/launchCampaign
|
|
181
|
-
*/
|
|
182
|
-
launchCampaign: (input) => {
|
|
183
|
-
const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/launch`;
|
|
184
|
-
return requestPostEffect(client, path);
|
|
185
|
-
},
|
|
186
169
|
/**
|
|
187
170
|
* Pause campaign through the eBay Marketing API.
|
|
188
171
|
*
|
|
@@ -217,23 +200,6 @@ export const createMarketingCampaignsMethods = (client) => ({
|
|
|
217
200
|
const path = `${MARKETING_BASE_PATH}/ad_campaign/${input.campaignId}/resume`;
|
|
218
201
|
return requestPostEffect(client, path);
|
|
219
202
|
},
|
|
220
|
-
/**
|
|
221
|
-
* Setup quick campaign through the eBay Marketing API.
|
|
222
|
-
*
|
|
223
|
-
* @param input - Path, query, header, and request body values for setupQuickCampaign.
|
|
224
|
-
* @returns An Effect that succeeds with eBay's generated setupQuickCampaign response DTO.
|
|
225
|
-
*
|
|
226
|
-
* @example
|
|
227
|
-
* ```ts
|
|
228
|
-
* const quickCampaign = await Effect.runPromise(marketingApi.setupQuickCampaign({ request: { ... } }));
|
|
229
|
-
* ```
|
|
230
|
-
*
|
|
231
|
-
* @see https://developer.ebay.com/api-docs/sell/marketing/resources/campaign/methods/setupQuickCampaign
|
|
232
|
-
*/
|
|
233
|
-
setupQuickCampaign: (input) => {
|
|
234
|
-
const path = `${MARKETING_BASE_PATH}/ad_campaign/setup_quick_campaign`;
|
|
235
|
-
return requestPostEffect(client, path, input.request);
|
|
236
|
-
},
|
|
237
203
|
/**
|
|
238
204
|
* Suggest budget through the eBay Marketing API.
|
|
239
205
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { buildEndpointParams, EndpointInputError, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, optionalStringEffect, requestGetEffect, requestPostEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
|
|
2
|
+
import { getIdentityBaseUrl } from '../../config/environment.js';
|
|
2
3
|
import { isRecord } from '../../utils/typeGuards.js';
|
|
3
4
|
import { Effect } from 'effect';
|
|
4
5
|
const requireUploadEvidenceFileBodyEffect = (evidenceFile) => {
|
|
@@ -12,10 +13,16 @@ const requireUploadEvidenceFileBodyEffect = (evidenceFile) => {
|
|
|
12
13
|
message: 'body is required and must be binary data or a multipart-compatible object',
|
|
13
14
|
}));
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
+
const FULFILLMENT_BASE_PATH = '/sell/fulfillment/v1';
|
|
17
|
+
const APIZ_REQUEST = { absolute: true };
|
|
18
|
+
const apizUrl = (client, path) => {
|
|
19
|
+
const { environment, apiBaseUrl } = client.getConfig();
|
|
20
|
+
const apizBaseUrl = getIdentityBaseUrl(environment, apiBaseUrl);
|
|
21
|
+
return `${apizBaseUrl}${FULFILLMENT_BASE_PATH}${path}`;
|
|
22
|
+
};
|
|
23
|
+
/** eBay Fulfillment payment dispute endpoints, served from the apiz host only. */
|
|
16
24
|
export class DisputeApi {
|
|
17
25
|
client;
|
|
18
|
-
basePath = '/sell/fulfillment/v1';
|
|
19
26
|
constructor(client) {
|
|
20
27
|
this.client = client;
|
|
21
28
|
}
|
|
@@ -36,8 +43,8 @@ export class DisputeApi {
|
|
|
36
43
|
*/
|
|
37
44
|
getPaymentDispute = (input) => Effect.gen(this, function* () {
|
|
38
45
|
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
39
|
-
const
|
|
40
|
-
return yield* requestGetEffect(this.client,
|
|
46
|
+
const url = apizUrl(this.client, `/payment_dispute/${paymentDisputeId}`);
|
|
47
|
+
return yield* requestGetEffect(this.client, url, undefined, APIZ_REQUEST);
|
|
41
48
|
});
|
|
42
49
|
/**
|
|
43
50
|
* Downloads one evidence file attached to a payment dispute.
|
|
@@ -62,12 +69,13 @@ export class DisputeApi {
|
|
|
62
69
|
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
63
70
|
const evidenceId = yield* requireStringEffect(input.evidenceId, 'evidenceId');
|
|
64
71
|
const fileId = yield* requireStringEffect(input.fileId, 'fileId');
|
|
65
|
-
const
|
|
72
|
+
const url = apizUrl(this.client, `/payment_dispute/${paymentDisputeId}/fetch_evidence_content`);
|
|
66
73
|
const params = buildEndpointParams({
|
|
67
74
|
evidenceId: { wireName: 'evidence_id', value: evidenceId },
|
|
68
75
|
fileId: { wireName: 'file_id', value: fileId },
|
|
69
76
|
});
|
|
70
|
-
return yield* requestGetEffect(this.client,
|
|
77
|
+
return yield* requestGetEffect(this.client, url, params, {
|
|
78
|
+
absolute: true,
|
|
71
79
|
headers: { Accept: 'application/octet-stream' },
|
|
72
80
|
responseType: 'arraybuffer',
|
|
73
81
|
});
|
|
@@ -89,8 +97,8 @@ export class DisputeApi {
|
|
|
89
97
|
*/
|
|
90
98
|
getActivities = (input) => Effect.gen(this, function* () {
|
|
91
99
|
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
92
|
-
const
|
|
93
|
-
return yield* requestGetEffect(this.client,
|
|
100
|
+
const url = apizUrl(this.client, `/payment_dispute/${paymentDisputeId}/activity`);
|
|
101
|
+
return yield* requestGetEffect(this.client, url, undefined, APIZ_REQUEST);
|
|
94
102
|
});
|
|
95
103
|
/**
|
|
96
104
|
* Searches payment disputes using the filters supported by eBay.
|
|
@@ -115,7 +123,7 @@ export class DisputeApi {
|
|
|
115
123
|
const paymentDisputeStatus = yield* optionalStringEffect(input.paymentDisputeStatus, 'paymentDisputeStatus');
|
|
116
124
|
const limit = yield* optionalPositiveNumberEffect(input.limit, 'limit');
|
|
117
125
|
const offset = yield* optionalNonNegativeNumberEffect(input.offset, 'offset');
|
|
118
|
-
const
|
|
126
|
+
const url = apizUrl(this.client, '/payment_dispute_summary');
|
|
119
127
|
const params = buildEndpointParams({
|
|
120
128
|
orderId: { wireName: 'order_id', value: orderId },
|
|
121
129
|
buyerUsername: { wireName: 'buyer_username', value: buyerUsername },
|
|
@@ -128,7 +136,7 @@ export class DisputeApi {
|
|
|
128
136
|
limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
|
|
129
137
|
offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
|
|
130
138
|
});
|
|
131
|
-
return yield* requestGetEffect(this.client,
|
|
139
|
+
return yield* requestGetEffect(this.client, url, params, APIZ_REQUEST);
|
|
132
140
|
});
|
|
133
141
|
/**
|
|
134
142
|
* Accepts one payment dispute.
|
|
@@ -150,8 +158,8 @@ export class DisputeApi {
|
|
|
150
158
|
*/
|
|
151
159
|
acceptPaymentDispute = (input) => Effect.gen(this, function* () {
|
|
152
160
|
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
153
|
-
const
|
|
154
|
-
return yield* requestPostEffect(this.client,
|
|
161
|
+
const url = apizUrl(this.client, `/payment_dispute/${paymentDisputeId}/accept`);
|
|
162
|
+
return yield* requestPostEffect(this.client, url, input.body, APIZ_REQUEST);
|
|
155
163
|
});
|
|
156
164
|
/**
|
|
157
165
|
* Contests one payment dispute.
|
|
@@ -173,8 +181,8 @@ export class DisputeApi {
|
|
|
173
181
|
*/
|
|
174
182
|
contestPaymentDispute = (input) => Effect.gen(this, function* () {
|
|
175
183
|
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
176
|
-
const
|
|
177
|
-
return yield* requestPostEffect(this.client,
|
|
184
|
+
const url = apizUrl(this.client, `/payment_dispute/${paymentDisputeId}/contest`);
|
|
185
|
+
return yield* requestPostEffect(this.client, url, input.body, APIZ_REQUEST);
|
|
178
186
|
});
|
|
179
187
|
/**
|
|
180
188
|
* Uploads one evidence file for a payment dispute.
|
|
@@ -197,8 +205,9 @@ export class DisputeApi {
|
|
|
197
205
|
uploadEvidenceFile = (input) => Effect.gen(this, function* () {
|
|
198
206
|
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
199
207
|
const evidenceFile = yield* requireUploadEvidenceFileBodyEffect(input.body);
|
|
200
|
-
const
|
|
201
|
-
return yield* requestPostEffect(this.client,
|
|
208
|
+
const url = apizUrl(this.client, `/payment_dispute/${paymentDisputeId}/upload_evidence_file`);
|
|
209
|
+
return yield* requestPostEffect(this.client, url, evidenceFile, {
|
|
210
|
+
absolute: true,
|
|
202
211
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
203
212
|
});
|
|
204
213
|
});
|
|
@@ -223,8 +232,8 @@ export class DisputeApi {
|
|
|
223
232
|
addEvidence = (input) => Effect.gen(this, function* () {
|
|
224
233
|
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
225
234
|
const addEvidenceRequest = yield* requireObjectEffect(input.body, 'body');
|
|
226
|
-
const
|
|
227
|
-
return yield* requestPostEffect(this.client,
|
|
235
|
+
const url = apizUrl(this.client, `/payment_dispute/${paymentDisputeId}/add_evidence`);
|
|
236
|
+
return yield* requestPostEffect(this.client, url, addEvidenceRequest, APIZ_REQUEST);
|
|
228
237
|
});
|
|
229
238
|
/**
|
|
230
239
|
* Updates evidence on one payment dispute.
|
|
@@ -247,7 +256,7 @@ export class DisputeApi {
|
|
|
247
256
|
updateEvidence = (input) => Effect.gen(this, function* () {
|
|
248
257
|
const paymentDisputeId = yield* requireStringEffect(input.paymentDisputeId, 'paymentDisputeId');
|
|
249
258
|
const updateEvidenceRequest = yield* requireObjectEffect(input.body, 'body');
|
|
250
|
-
const
|
|
251
|
-
return yield* requestPostEffect(this.client,
|
|
259
|
+
const url = apizUrl(this.client, `/payment_dispute/${paymentDisputeId}/update_evidence`);
|
|
260
|
+
return yield* requestPostEffect(this.client, url, updateEvidenceRequest, APIZ_REQUEST);
|
|
252
261
|
});
|
|
253
262
|
}
|
|
@@ -158,6 +158,7 @@ export class FulfillmentApi {
|
|
|
158
158
|
const orderId = yield* requireStringEffect(input.orderId, 'orderId');
|
|
159
159
|
const refundRequest = yield* requireObjectEffect(input.body, 'body');
|
|
160
160
|
const path = `${this.basePath}/order/${orderId}/issue_refund`;
|
|
161
|
-
|
|
161
|
+
// eBay requires a digital signature on issueRefund for EU/UK sellers.
|
|
162
|
+
return yield* requestPostEffect(this.client, path, refundRequest, { signed: true });
|
|
162
163
|
});
|
|
163
164
|
}
|
|
@@ -3,7 +3,7 @@ import { Effect } from 'effect';
|
|
|
3
3
|
/** eDelivery International Shipping API endpoints. */
|
|
4
4
|
export class EDeliveryApi {
|
|
5
5
|
client;
|
|
6
|
-
basePath = '/sell/
|
|
6
|
+
basePath = '/sell/edelivery_international_shipping/v1';
|
|
7
7
|
constructor(client) {
|
|
8
8
|
this.client = client;
|
|
9
9
|
}
|
|
@@ -399,13 +399,13 @@ export class EDeliveryApi {
|
|
|
399
399
|
* @example
|
|
400
400
|
* ```ts
|
|
401
401
|
* const packages = await Effect.runPromise(
|
|
402
|
-
* edeliveryApi.
|
|
402
|
+
* edeliveryApi.getPackagesByLineItemID({ orderLineItemId: 'LINE123' }),
|
|
403
403
|
* );
|
|
404
404
|
* ```
|
|
405
405
|
*
|
|
406
406
|
* @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/getPackagesByLineItemID
|
|
407
407
|
*/
|
|
408
|
-
|
|
408
|
+
getPackagesByLineItemID = (input) => {
|
|
409
409
|
const client = this.client;
|
|
410
410
|
const basePath = this.basePath;
|
|
411
411
|
return Effect.gen(function* () {
|
|
@@ -3,7 +3,7 @@ import { Effect } from 'effect';
|
|
|
3
3
|
/** Translation API - listing title and description translation. */
|
|
4
4
|
export class TranslationApi {
|
|
5
5
|
client;
|
|
6
|
-
basePath = '/commerce/translation/
|
|
6
|
+
basePath = '/commerce/translation/v1_beta';
|
|
7
7
|
constructor(client) {
|
|
8
8
|
this.client = client;
|
|
9
9
|
}
|
|
@@ -52,9 +52,9 @@ export const getUiRuntimeConfig = () => ({
|
|
|
52
52
|
* const scopes = getDefaultScopes('production');
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export const getDefaultScopes = (environment) =>
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
export const getDefaultScopes = (environment) => [
|
|
56
|
+
...(environment === 'production' ? productionScopes : sandboxScopes),
|
|
57
|
+
];
|
|
58
58
|
/** Optional scope requiring keyset eligibility and fresh user consent. */
|
|
59
59
|
export const POST_ORDER_DOCUMENT_SCOPE = 'https://api.ebay.com/oauth/api_scope/commerce.post_order.document';
|
|
60
60
|
/** Optional Finances API scope for order earnings; requested only through `EBAY_OAUTH_SCOPES`. */
|
|
@@ -245,6 +245,7 @@ export const getEbayConfig = () => {
|
|
|
245
245
|
appAccessToken,
|
|
246
246
|
apiBaseUrl,
|
|
247
247
|
disableAuthHeader,
|
|
248
|
+
signing: getSigningConfig(),
|
|
248
249
|
};
|
|
249
250
|
};
|
|
250
251
|
/**
|
|
@@ -354,6 +355,23 @@ export const getMediaBaseUrl = (environment, overrideBaseUrl) => {
|
|
|
354
355
|
}
|
|
355
356
|
return environment === 'production' ? 'https://apim.ebay.com' : 'https://apim.sandbox.ebay.com';
|
|
356
357
|
};
|
|
358
|
+
/**
|
|
359
|
+
* Get base URL for the Client Registration API (uses the tppz subdomain).
|
|
360
|
+
*
|
|
361
|
+
* @param environment eBay environment used when no override is configured.
|
|
362
|
+
* @param overrideBaseUrl Base URL override from `EBAY_MCP_API_BASE_URL`.
|
|
363
|
+
* @returns Client Registration API base URL for direct eBay or proxy traffic.
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* const registrationBaseUrl = getClientRegistrationBaseUrl('production');
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
export const getClientRegistrationBaseUrl = (environment, overrideBaseUrl) => {
|
|
370
|
+
if (overrideBaseUrl) {
|
|
371
|
+
return overrideBaseUrl;
|
|
372
|
+
}
|
|
373
|
+
return environment === 'production' ? 'https://tppz.ebay.com' : 'https://tppz.sandbox.ebay.com';
|
|
374
|
+
};
|
|
357
375
|
/** Hosts treated as loopback when deciding whether a cleartext base URL is safe. */
|
|
358
376
|
const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '::1', '[::1]', '0.0.0.0']);
|
|
359
377
|
/**
|
|
@@ -413,6 +431,16 @@ export const getProxyAuthConfig = () => {
|
|
|
413
431
|
}
|
|
414
432
|
return { apiBaseUrl, disableAuthHeader, warnings, errors, infos };
|
|
415
433
|
};
|
|
434
|
+
const getSigningConfig = () => {
|
|
435
|
+
const keyJwe = process.env.EBAY_SIGNING_KEY_JWE?.trim();
|
|
436
|
+
const privateKey = process.env.EBAY_SIGNING_PRIVATE_KEY?.trim();
|
|
437
|
+
if (keyJwe && privateKey) {
|
|
438
|
+
return { keyJwe, privateKey };
|
|
439
|
+
}
|
|
440
|
+
if (keyJwe || privateKey) {
|
|
441
|
+
writeConfigDiagnostic('Digital signatures need both EBAY_SIGNING_KEY_JWE and EBAY_SIGNING_PRIVATE_KEY; only one is set, so requests will not be signed.');
|
|
442
|
+
}
|
|
443
|
+
};
|
|
416
444
|
/**
|
|
417
445
|
* Generate the OAuth authorization URL for user consent
|
|
418
446
|
* This URL should be opened in a browser for the user to grant permissions
|
|
@@ -504,7 +504,7 @@ export const kycOutputSchema = z.object({
|
|
|
504
504
|
warnings: z.array(errorSchema).optional(),
|
|
505
505
|
});
|
|
506
506
|
/** Validates the Account Management API get KYC request payload. */
|
|
507
|
-
export const
|
|
507
|
+
export const getKYCInputSchema = z.object({});
|
|
508
508
|
/** Validates the Account Management API payments program request payload. */
|
|
509
509
|
export const getPaymentsProgramInputSchema = z.object({
|
|
510
510
|
marketplaceId: z.nativeEnum(MarketplaceId).describe('The eBay marketplace ID'),
|
|
@@ -120,10 +120,9 @@ const endOfAuctionEmailPreferencesSchema = z.object({
|
|
|
120
120
|
textCustomized: z.boolean().optional().describe('Use customized text in winning-bidder emails'),
|
|
121
121
|
});
|
|
122
122
|
/**
|
|
123
|
-
* PATCH body for setUserPreferences
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* with SetItemsAwaitingPaymentPreferencesType for unpaid-item settings).
|
|
123
|
+
* PATCH body for setUserPreferences, mirroring the generated SetUserPreferencesRequest
|
|
124
|
+
* (the GetUserPreferencesResponse `*PreferencesType` containers, with
|
|
125
|
+
* SetItemsAwaitingPaymentPreferencesType for unpaid-item settings).
|
|
127
126
|
*/
|
|
128
127
|
const setUserPreferencesSchema = z.object({
|
|
129
128
|
combinedPaymentPreferences: z
|
|
@@ -184,7 +184,7 @@ export const getFeedbackSummaryOutputSchema = z.object({
|
|
|
184
184
|
/**
|
|
185
185
|
* Validates the Communication API get awaiting feedback request payload.
|
|
186
186
|
*/
|
|
187
|
-
export const
|
|
187
|
+
export const getItemsAwaitingFeedbackInputSchema = z.object({
|
|
188
188
|
filter: z.string().optional().describe('Filter criteria for awaiting feedback'),
|
|
189
189
|
limit: z.number().optional().describe('Number of items to return'),
|
|
190
190
|
offset: z.number().optional().describe('Number of items to skip'),
|
|
@@ -192,7 +192,7 @@ export const getAwaitingFeedbackInputSchema = z.object({
|
|
|
192
192
|
/**
|
|
193
193
|
* Validates the Communication API get awaiting feedback response payload.
|
|
194
194
|
*/
|
|
195
|
-
export const
|
|
195
|
+
export const getItemsAwaitingFeedbackOutputSchema = z.object({
|
|
196
196
|
items: z
|
|
197
197
|
.array(z.object({
|
|
198
198
|
orderLineItemId: z.string().optional(),
|
|
@@ -243,19 +243,6 @@ export const dynamicAdRatePreferenceSchema = z.object({
|
|
|
243
243
|
maxAdRate: z.string().optional(),
|
|
244
244
|
minAdRate: z.string().optional(),
|
|
245
245
|
});
|
|
246
|
-
// Quick Setup Schema
|
|
247
|
-
/**
|
|
248
|
-
* Validates the Marketing API quick setup request model.
|
|
249
|
-
*/
|
|
250
|
-
export const quickSetupRequestSchema = z.object({
|
|
251
|
-
campaignName: z.string(),
|
|
252
|
-
dailyBudget: amountSchema.optional(),
|
|
253
|
-
endDate: z.string().optional(),
|
|
254
|
-
fundingStrategy: fundingStrategySchema.optional(),
|
|
255
|
-
listingIds: z.array(z.string()).optional(),
|
|
256
|
-
marketplaceId: z.string(),
|
|
257
|
-
startDate: z.string().optional(),
|
|
258
|
-
});
|
|
259
246
|
export const cloneCampaignInputSchema = z.object({
|
|
260
247
|
campaignId: z.string().describe('campaignId required endpoint parameter'),
|
|
261
248
|
request: cloneCampaignRequestSchema.describe('Clone campaign request body'),
|
|
@@ -307,10 +294,6 @@ export const findCampaignByAdReferenceInputSchema = z.object({
|
|
|
307
294
|
export const getCampaignByNameInputSchema = z.object({
|
|
308
295
|
campaignName: z.string().describe('campaignName required endpoint parameter'),
|
|
309
296
|
});
|
|
310
|
-
/** Validates the Marketing API launchCampaign endpoint input. */
|
|
311
|
-
export const launchCampaignInputSchema = z.object({
|
|
312
|
-
campaignId: z.string().describe('campaignId required endpoint parameter'),
|
|
313
|
-
});
|
|
314
297
|
/** Validates the Marketing API pauseCampaign endpoint input. */
|
|
315
298
|
export const pauseCampaignInputSchema = z.object({
|
|
316
299
|
campaignId: z.string().describe('campaignId required endpoint parameter'),
|
|
@@ -319,10 +302,6 @@ export const pauseCampaignInputSchema = z.object({
|
|
|
319
302
|
export const resumeCampaignInputSchema = z.object({
|
|
320
303
|
campaignId: z.string().describe('campaignId required endpoint parameter'),
|
|
321
304
|
});
|
|
322
|
-
/** Validates the Marketing API setupQuickCampaign endpoint input. */
|
|
323
|
-
export const setupQuickCampaignInputSchema = z.object({
|
|
324
|
-
request: quickSetupRequestSchema.describe('Setup quick campaign request body'),
|
|
325
|
-
});
|
|
326
305
|
/** Validates the Marketing API suggestBudget endpoint input. */
|
|
327
306
|
export const suggestBudgetInputSchema = z.object({
|
|
328
307
|
marketplaceId: z.string().describe('Marketplace ID sent as X-EBAY-C-MARKETPLACE-ID'),
|
|
@@ -4,7 +4,6 @@ import { z } from 'zod';
|
|
|
4
4
|
*
|
|
5
5
|
* This file contains Zod schemas for various eBay APIs including:
|
|
6
6
|
* - Commerce Identity API
|
|
7
|
-
* - Sell Compliance API
|
|
8
7
|
* - Commerce Translation API
|
|
9
8
|
* - Commerce VERO API
|
|
10
9
|
* - Sell eDelivery International Shipping API
|
|
@@ -38,77 +37,6 @@ const getUserConsentResponseSchema = z.object({
|
|
|
38
37
|
consents: z.array(userConsentSchema).optional(),
|
|
39
38
|
});
|
|
40
39
|
// ============================================================================
|
|
41
|
-
// Sell Compliance API Schemas
|
|
42
|
-
// ============================================================================
|
|
43
|
-
const nameValueListSchema = z.object({
|
|
44
|
-
name: z.string().optional(),
|
|
45
|
-
value: z.string().optional(),
|
|
46
|
-
});
|
|
47
|
-
const correctiveRecommendationsSchema = z.object({
|
|
48
|
-
complianceDetail: z.string().optional(),
|
|
49
|
-
complianceDetailDescription: z.string().optional(),
|
|
50
|
-
correctiveActionDetails: z.string().optional(),
|
|
51
|
-
productRecommendation: z
|
|
52
|
-
.object({
|
|
53
|
-
epid: z.string().optional(),
|
|
54
|
-
})
|
|
55
|
-
.optional(),
|
|
56
|
-
});
|
|
57
|
-
const variationDetailsSchema = z.object({
|
|
58
|
-
sku: z.string().optional(),
|
|
59
|
-
variationAspects: z.array(nameValueListSchema).optional(),
|
|
60
|
-
});
|
|
61
|
-
const complianceDetailSchema = z.object({
|
|
62
|
-
complianceState: z.string().optional(),
|
|
63
|
-
complianceType: z.string().optional(),
|
|
64
|
-
message: z.string().optional(),
|
|
65
|
-
reasons: z
|
|
66
|
-
.array(z.object({
|
|
67
|
-
complianceDetailType: z.string().optional(),
|
|
68
|
-
message: z.string().optional(),
|
|
69
|
-
variation: variationDetailsSchema.optional(),
|
|
70
|
-
violationData: z.array(nameValueListSchema).optional(),
|
|
71
|
-
}))
|
|
72
|
-
.optional(),
|
|
73
|
-
correctiveRecommendations: correctiveRecommendationsSchema.optional(),
|
|
74
|
-
});
|
|
75
|
-
const complianceSummaryInfoSchema = z.object({
|
|
76
|
-
complianceSummary: z
|
|
77
|
-
.object({
|
|
78
|
-
violationSummaries: z
|
|
79
|
-
.array(z.object({
|
|
80
|
-
complianceType: z.string().optional(),
|
|
81
|
-
listingCount: z.number().int().optional(),
|
|
82
|
-
}))
|
|
83
|
-
.optional(),
|
|
84
|
-
})
|
|
85
|
-
.optional(),
|
|
86
|
-
});
|
|
87
|
-
const complianceViolationSchema = z.object({
|
|
88
|
-
listingId: z.string().optional(),
|
|
89
|
-
offerId: z.string().optional(),
|
|
90
|
-
sku: z.string().optional(),
|
|
91
|
-
complianceType: z.string().optional(),
|
|
92
|
-
complianceDetails: z.array(complianceDetailSchema).optional(),
|
|
93
|
-
});
|
|
94
|
-
const pageMetadataSchema = z.object({
|
|
95
|
-
href: z.string().optional(),
|
|
96
|
-
limit: z.number().int().optional(),
|
|
97
|
-
next: z.string().optional(),
|
|
98
|
-
offset: z.number().int().optional(),
|
|
99
|
-
prev: z.string().optional(),
|
|
100
|
-
total: z.number().int().optional(),
|
|
101
|
-
});
|
|
102
|
-
const listingViolationSummaryResponseSchema = z.object({
|
|
103
|
-
href: z.string().optional(),
|
|
104
|
-
limit: z.number().int().optional(),
|
|
105
|
-
listingViolations: z.array(complianceViolationSchema).optional(),
|
|
106
|
-
next: z.string().optional(),
|
|
107
|
-
offset: z.number().int().optional(),
|
|
108
|
-
prev: z.string().optional(),
|
|
109
|
-
total: z.number().int().optional(),
|
|
110
|
-
});
|
|
111
|
-
// ============================================================================
|
|
112
40
|
// Commerce Translation API Schemas
|
|
113
41
|
// ============================================================================
|
|
114
42
|
const translationSchema = z.object({
|
|
@@ -249,8 +177,8 @@ export const bundleIdInputSchema = z.object({
|
|
|
249
177
|
export const packageIdInputSchema = z.object({
|
|
250
178
|
packageId: z.string(),
|
|
251
179
|
});
|
|
252
|
-
/** Input schema for eDelivery
|
|
253
|
-
export const
|
|
180
|
+
/** Input schema for eDelivery getPackagesByLineItemID. */
|
|
181
|
+
export const getPackagesByLineItemIDInputSchema = z.object({
|
|
254
182
|
orderLineItemId: z.string(),
|
|
255
183
|
});
|
|
256
184
|
/** Input schema for eDelivery getLabels. */
|
|
@@ -272,17 +200,6 @@ export const getTrackingInputSchema = z.object({
|
|
|
272
200
|
// ============================================================================
|
|
273
201
|
/** Empty input schema for Commerce Identity API getUser. */
|
|
274
202
|
export const getUserInputSchema = z.object({});
|
|
275
|
-
/** Input schema for Sell Compliance API getListingViolations. */
|
|
276
|
-
export const getListingViolationsInputSchema = z.object({
|
|
277
|
-
complianceType: z.string().optional(),
|
|
278
|
-
offset: z.number().int().optional(),
|
|
279
|
-
limit: z.number().int().optional(),
|
|
280
|
-
filter: z.string().optional(),
|
|
281
|
-
});
|
|
282
|
-
/** Input schema for Sell Compliance API getListingViolationsSummary. */
|
|
283
|
-
export const getListingViolationsSummaryInputSchema = z.object({
|
|
284
|
-
complianceType: z.string().optional(),
|
|
285
|
-
});
|
|
286
203
|
/** Empty input schema for eDelivery getAddressPreferences. */
|
|
287
204
|
export const getAddressPreferencesInputSchema = z.object({});
|
|
288
205
|
/** Empty input schema for eDelivery getConsignPreferences. */
|