ebay-mcp-remote-edition 1.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/LICENSE +21 -0
- package/README.md +755 -0
- package/build/api/account-management/account.js +301 -0
- package/build/api/analytics-and-report/analytics.js +102 -0
- package/build/api/client-trading.js +96 -0
- package/build/api/client.js +173 -0
- package/build/api/communication/feedback.js +119 -0
- package/build/api/communication/message.js +131 -0
- package/build/api/communication/negotiation.js +97 -0
- package/build/api/communication/notification.js +373 -0
- package/build/api/developer/developer.js +81 -0
- package/build/api/index.js +109 -0
- package/build/api/listing-management/inventory.js +640 -0
- package/build/api/listing-metadata/metadata.js +485 -0
- package/build/api/listing-metadata/taxonomy.js +58 -0
- package/build/api/marketing-and-promotions/marketing.js +768 -0
- package/build/api/marketing-and-promotions/recommendation.js +32 -0
- package/build/api/order-management/dispute.js +69 -0
- package/build/api/order-management/fulfillment.js +89 -0
- package/build/api/other/compliance.js +47 -0
- package/build/api/other/edelivery.js +219 -0
- package/build/api/other/identity.js +24 -0
- package/build/api/other/translation.js +22 -0
- package/build/api/other/vero.js +48 -0
- package/build/api/trading/trading.js +78 -0
- package/build/auth/kv-store.js +40 -0
- package/build/auth/multi-user-store.js +120 -0
- package/build/auth/oauth-metadata.js +59 -0
- package/build/auth/oauth-middleware.js +99 -0
- package/build/auth/oauth-types.js +4 -0
- package/build/auth/oauth.js +235 -0
- package/build/auth/scope-utils.js +304 -0
- package/build/auth/token-store.js +46 -0
- package/build/auth/token-verifier.js +172 -0
- package/build/config/environment.js +297 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +129 -0
- package/build/schemas/account-management/account.js +375 -0
- package/build/schemas/analytics/analytics.js +191 -0
- package/build/schemas/communication/messages.js +345 -0
- package/build/schemas/fulfillment/orders.js +338 -0
- package/build/schemas/index.js +68 -0
- package/build/schemas/inventory-management/inventory.js +471 -0
- package/build/schemas/marketing/marketing.js +1103 -0
- package/build/schemas/metadata/metadata.js +618 -0
- package/build/schemas/other/other-apis.js +390 -0
- package/build/schemas/taxonomy/taxonomy.js +575 -0
- package/build/scripts/auto-setup.js +364 -0
- package/build/scripts/dev-sync.js +512 -0
- package/build/scripts/diagnostics.js +301 -0
- package/build/scripts/download-specs.js +116 -0
- package/build/scripts/interactive-setup.js +757 -0
- package/build/scripts/setup.js +1515 -0
- package/build/scripts/update-api-status-doc.js +44 -0
- package/build/server-http.d.ts +1 -0
- package/build/server-http.js +581 -0
- package/build/tools/definitions/account-with-schemas.js +170 -0
- package/build/tools/definitions/account.js +428 -0
- package/build/tools/definitions/analytics.js +66 -0
- package/build/tools/definitions/communication.js +394 -0
- package/build/tools/definitions/developer.js +195 -0
- package/build/tools/definitions/fulfillment.js +326 -0
- package/build/tools/definitions/index.js +41 -0
- package/build/tools/definitions/inventory.js +464 -0
- package/build/tools/definitions/marketing.js +1486 -0
- package/build/tools/definitions/metadata.js +188 -0
- package/build/tools/definitions/other.js +309 -0
- package/build/tools/definitions/taxonomy.js +64 -0
- package/build/tools/definitions/token-management.js +148 -0
- package/build/tools/definitions/trading.js +71 -0
- package/build/tools/index.js +1200 -0
- package/build/tools/schemas.js +667 -0
- package/build/tools/tool-definitions.js +3534 -0
- package/build/types/application-settings/developerAnalyticsV1BetaOas3.js +5 -0
- package/build/types/application-settings/developerClientRegistrationV1Oas3.js +5 -0
- package/build/types/application-settings/developerKeyManagementV1Oas3.js +5 -0
- package/build/types/ebay-enums.js +1330 -0
- package/build/types/ebay.js +123 -0
- package/build/types/index.js +10 -0
- package/build/types/sell-apps/account-management/sellAccountV1Oas3.js +5 -0
- package/build/types/sell-apps/analytics-and-report/sellAnalyticsV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/commerceFeedbackV1BetaOas3.js +5 -0
- package/build/types/sell-apps/communication/commerceMessageV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/commerceNotificationV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/sellNegotiationV1Oas3.js +5 -0
- package/build/types/sell-apps/listing-management/sellInventoryV1Oas3.js +5 -0
- package/build/types/sell-apps/listing-metadata/sellMetadataV1Oas3.js +5 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellMarketingV1Oas3.js +5 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellRecommendationV1Oas3.js +5 -0
- package/build/types/sell-apps/order-management/sellFulfillmentV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceIdentityV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceTranslationV1BetaOas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceVeroV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellComplianceV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellEdeliveryInternationalShippingOas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellMarketingV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellRecommendationV1Oas3.js +5 -0
- package/build/utils/account-management/account.js +831 -0
- package/build/utils/api-status-feed.js +83 -0
- package/build/utils/communication/feedback.js +216 -0
- package/build/utils/communication/message.js +242 -0
- package/build/utils/communication/negotiation.js +150 -0
- package/build/utils/communication/notification.js +369 -0
- package/build/utils/date-converter.js +160 -0
- package/build/utils/llm-client-detector.js +758 -0
- package/build/utils/logger.js +198 -0
- package/build/utils/oauth-helper.js +315 -0
- package/build/utils/order-management/dispute.js +369 -0
- package/build/utils/order-management/fulfillment.js +205 -0
- package/build/utils/other/compliance.js +76 -0
- package/build/utils/other/edelivery.js +241 -0
- package/build/utils/other/identity.js +13 -0
- package/build/utils/other/translation.js +41 -0
- package/build/utils/other/vero.js +90 -0
- package/build/utils/scope-helper.js +207 -0
- package/build/utils/security-checker.js +248 -0
- package/build/utils/setup-validator.js +305 -0
- package/build/utils/token-utils.js +40 -0
- package/build/utils/version.js +56 -0
- package/docs/auth/production_scopes.json +111 -0
- package/docs/auth/sandbox_scopes.json +142 -0
- package/package.json +122 -0
- package/public/icons/1024x1024.png +0 -0
- package/public/icons/128x128.png +0 -0
- package/public/icons/16x16.png +0 -0
- package/public/icons/256x256.png +0 -0
- package/public/icons/32x32.png +0 -0
- package/public/icons/48x48.png +0 -0
- package/public/icons/512x512.png +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches and parses the eBay API Status RSS feed (public, no auth).
|
|
3
|
+
* Used by the ebay_get_api_status MCP tool and optionally by the docs sync script.
|
|
4
|
+
*/
|
|
5
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
6
|
+
import axios from 'axios';
|
|
7
|
+
const RSS_URL = 'https://developer.ebay.com/rss/api-status';
|
|
8
|
+
function stripHtml(html) {
|
|
9
|
+
return html
|
|
10
|
+
.replace(/<[^>]+>/g, ' ')
|
|
11
|
+
.replace(/\s+/g, ' ')
|
|
12
|
+
.trim();
|
|
13
|
+
}
|
|
14
|
+
function normalizeString(value) {
|
|
15
|
+
if (value == null)
|
|
16
|
+
return '';
|
|
17
|
+
if (typeof value === 'string')
|
|
18
|
+
return value.trim();
|
|
19
|
+
if (typeof value === 'number' || typeof value === 'boolean')
|
|
20
|
+
return String(value).trim();
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
function parseItem(raw) {
|
|
24
|
+
const summary = normalizeString(raw.summary) || stripHtml(normalizeString(raw.description)).slice(0, 300) || '';
|
|
25
|
+
return {
|
|
26
|
+
title: normalizeString(raw.title) || 'Untitled',
|
|
27
|
+
summary: summary || normalizeString(raw.title),
|
|
28
|
+
link: normalizeString(raw.link) || '',
|
|
29
|
+
api: normalizeString(raw.api) || '',
|
|
30
|
+
site: normalizeString(raw.site) || '',
|
|
31
|
+
status: normalizeString(raw.status) || '',
|
|
32
|
+
lastUpdated: normalizeString(raw.lastUpdated) || '',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function ensureArray(value) {
|
|
36
|
+
if (value == null)
|
|
37
|
+
return [];
|
|
38
|
+
return Array.isArray(value) ? value : [value];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Fetches the eBay API Status RSS feed, parses it, and returns items
|
|
42
|
+
* optionally filtered by status and API name, limited to `limit` items.
|
|
43
|
+
*/
|
|
44
|
+
export async function getApiStatusFeed(options = {}) {
|
|
45
|
+
const { limit = 20, status: statusFilter, api: apiFilter } = options;
|
|
46
|
+
try {
|
|
47
|
+
const response = await axios.get(RSS_URL, {
|
|
48
|
+
timeout: 15_000,
|
|
49
|
+
responseType: 'text',
|
|
50
|
+
headers: { Accept: 'application/rss+xml, application/xml, text/xml' },
|
|
51
|
+
});
|
|
52
|
+
const xml = response.data;
|
|
53
|
+
const parser = new XMLParser({
|
|
54
|
+
ignoreAttributes: true,
|
|
55
|
+
trimValues: true,
|
|
56
|
+
parseTagValue: false,
|
|
57
|
+
});
|
|
58
|
+
const parsed = parser.parse(xml);
|
|
59
|
+
const channel = parsed?.rss?.channel;
|
|
60
|
+
if (!channel) {
|
|
61
|
+
return { items: [], error: 'RSS feed missing channel' };
|
|
62
|
+
}
|
|
63
|
+
const rawItems = ensureArray(channel.item);
|
|
64
|
+
let items = rawItems.map(parseItem);
|
|
65
|
+
if (statusFilter) {
|
|
66
|
+
items = items.filter((i) => i.status.toLowerCase() === statusFilter.toLowerCase());
|
|
67
|
+
}
|
|
68
|
+
if (apiFilter?.trim()) {
|
|
69
|
+
const needle = apiFilter.trim().toLowerCase();
|
|
70
|
+
items = items.filter((i) => i.api.toLowerCase().includes(needle));
|
|
71
|
+
}
|
|
72
|
+
items = items.slice(0, Math.min(limit, 50));
|
|
73
|
+
return { items };
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
const message = axios.isAxiosError(err) && err.response?.status
|
|
77
|
+
? `Feed unavailable (HTTP ${err.response.status})`
|
|
78
|
+
: err instanceof Error
|
|
79
|
+
? err.message
|
|
80
|
+
: 'Failed to fetch API status feed';
|
|
81
|
+
return { items: [], error: message };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for Feedback API input validation
|
|
4
|
+
* Based on: src/api/communication/feedback.ts
|
|
5
|
+
* OpenAPI spec: docs/sell-apps/communication/commerce_feedback_v1_beta_oas3.json
|
|
6
|
+
* Types from: src/types/commerce_feedback_v1_beta_oas3.ts
|
|
7
|
+
*/
|
|
8
|
+
// Reusable schema for filter parameter
|
|
9
|
+
const filterSchema = z
|
|
10
|
+
.string({
|
|
11
|
+
message: 'Filter must be a string',
|
|
12
|
+
invalid_type_error: 'filter must be a string',
|
|
13
|
+
description: 'Filter criteria for the query',
|
|
14
|
+
})
|
|
15
|
+
.optional();
|
|
16
|
+
// Reusable schema for limit parameter (string in API, converted to number)
|
|
17
|
+
const limitSchema = z
|
|
18
|
+
.string({
|
|
19
|
+
invalid_type_error: 'limit must be a string',
|
|
20
|
+
description: 'Maximum number of items to return per page (25-200)',
|
|
21
|
+
})
|
|
22
|
+
.optional();
|
|
23
|
+
// Reusable schema for offset parameter (string in API, converted to number)
|
|
24
|
+
const offsetSchema = z
|
|
25
|
+
.string({
|
|
26
|
+
invalid_type_error: 'offset must be a string',
|
|
27
|
+
description: 'Number of items to skip',
|
|
28
|
+
})
|
|
29
|
+
.optional();
|
|
30
|
+
// Reusable schema for sort parameter
|
|
31
|
+
const sortSchema = z
|
|
32
|
+
.string({
|
|
33
|
+
invalid_type_error: 'sort must be a string',
|
|
34
|
+
description: 'Sort order for results',
|
|
35
|
+
})
|
|
36
|
+
.optional();
|
|
37
|
+
/**
|
|
38
|
+
* Schema for getAwaitingFeedback method
|
|
39
|
+
* Endpoint: GET /awaiting_feedback
|
|
40
|
+
* Params: GetAwaitingFeedbackParams - filter, limit, offset, sort
|
|
41
|
+
*/
|
|
42
|
+
export const getAwaitingFeedbackSchema = z.object({
|
|
43
|
+
filter: filterSchema,
|
|
44
|
+
limit: limitSchema,
|
|
45
|
+
offset: offsetSchema,
|
|
46
|
+
sort: sortSchema,
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Schema for getFeedback method
|
|
50
|
+
* Endpoint: GET /feedback
|
|
51
|
+
* Params: GetFeedbackParams - user_id (required), feedback_type (required), feedback_id, filter, limit, listing_id, offset, order_line_item_id, sort, transaction_id
|
|
52
|
+
*/
|
|
53
|
+
export const getFeedbackSchema = z.object({
|
|
54
|
+
user_id: z.string({
|
|
55
|
+
message: 'User ID is required',
|
|
56
|
+
required_error: 'user_id is required',
|
|
57
|
+
invalid_type_error: 'user_id must be a string',
|
|
58
|
+
description: 'The unique identifier (eBay username) of the user',
|
|
59
|
+
}),
|
|
60
|
+
feedback_type: z.string({
|
|
61
|
+
message: 'Feedback type is required',
|
|
62
|
+
required_error: 'feedback_type is required',
|
|
63
|
+
invalid_type_error: 'feedback_type must be a string',
|
|
64
|
+
description: 'Type of feedback (FEEDBACK_RECEIVED or FEEDBACK_SENT)',
|
|
65
|
+
}),
|
|
66
|
+
feedback_id: z
|
|
67
|
+
.string({
|
|
68
|
+
invalid_type_error: 'feedback_id must be a string',
|
|
69
|
+
description: 'Filter by specific feedback ID',
|
|
70
|
+
})
|
|
71
|
+
.optional(),
|
|
72
|
+
filter: filterSchema,
|
|
73
|
+
limit: limitSchema,
|
|
74
|
+
listing_id: z
|
|
75
|
+
.string({
|
|
76
|
+
invalid_type_error: 'listing_id must be a string',
|
|
77
|
+
description: 'Filter by listing ID',
|
|
78
|
+
})
|
|
79
|
+
.optional(),
|
|
80
|
+
offset: offsetSchema,
|
|
81
|
+
order_line_item_id: z
|
|
82
|
+
.string({
|
|
83
|
+
invalid_type_error: 'order_line_item_id must be a string',
|
|
84
|
+
description: 'Filter by order line item ID',
|
|
85
|
+
})
|
|
86
|
+
.optional(),
|
|
87
|
+
sort: sortSchema,
|
|
88
|
+
transaction_id: z
|
|
89
|
+
.string({
|
|
90
|
+
invalid_type_error: 'transaction_id must be a string',
|
|
91
|
+
description: 'Filter by transaction ID',
|
|
92
|
+
})
|
|
93
|
+
.optional(),
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* Schema for getFeedbackRatingSummary method
|
|
97
|
+
* Endpoint: GET /feedback_rating_summary
|
|
98
|
+
* Params: GetFeedbackRatingSummaryParams - user_id (required), filter (required)
|
|
99
|
+
*/
|
|
100
|
+
export const getFeedbackRatingSummarySchema = z.object({
|
|
101
|
+
user_id: z.string({
|
|
102
|
+
message: 'User ID is required',
|
|
103
|
+
required_error: 'user_id is required',
|
|
104
|
+
invalid_type_error: 'user_id must be a string',
|
|
105
|
+
description: 'The unique identifier of the eBay user',
|
|
106
|
+
}),
|
|
107
|
+
filter: z.string({
|
|
108
|
+
message: 'Filter is required (must include ratingType)',
|
|
109
|
+
required_error: 'filter is required',
|
|
110
|
+
invalid_type_error: 'filter must be a string',
|
|
111
|
+
description: 'Filter with required ratingType parameter',
|
|
112
|
+
}),
|
|
113
|
+
});
|
|
114
|
+
/**
|
|
115
|
+
* Schema for leaveFeedbackForBuyer method
|
|
116
|
+
* Endpoint: POST /feedback
|
|
117
|
+
* Body: LeaveFeedbackRequest - commentText, commentType, images, listingId, orderLineItemId, sellerRatings, transactionId
|
|
118
|
+
*/
|
|
119
|
+
export const leaveFeedbackForBuyerSchema = z.object({
|
|
120
|
+
comment_text: z
|
|
121
|
+
.string({
|
|
122
|
+
invalid_type_error: 'comment_text must be a string',
|
|
123
|
+
description: 'The feedback comment text (max 500 characters)',
|
|
124
|
+
})
|
|
125
|
+
.max(500, 'comment_text must be 500 characters or less')
|
|
126
|
+
.optional(),
|
|
127
|
+
comment_type: z
|
|
128
|
+
.string({
|
|
129
|
+
invalid_type_error: 'comment_type must be a string',
|
|
130
|
+
description: 'Overall rating: POSITIVE, NEUTRAL, or NEGATIVE',
|
|
131
|
+
})
|
|
132
|
+
.optional(),
|
|
133
|
+
images: z
|
|
134
|
+
.array(z.object({
|
|
135
|
+
url: z
|
|
136
|
+
.string({
|
|
137
|
+
invalid_type_error: 'image url must be a string',
|
|
138
|
+
description: 'URL of the image',
|
|
139
|
+
})
|
|
140
|
+
.optional(),
|
|
141
|
+
}), {
|
|
142
|
+
invalid_type_error: 'images must be an array',
|
|
143
|
+
description: 'Array of up to 5 images',
|
|
144
|
+
})
|
|
145
|
+
.max(5, 'Maximum 5 images allowed')
|
|
146
|
+
.optional(),
|
|
147
|
+
listing_id: z
|
|
148
|
+
.string({
|
|
149
|
+
invalid_type_error: 'listing_id must be a string',
|
|
150
|
+
description: 'The listing ID related to the transaction',
|
|
151
|
+
})
|
|
152
|
+
.optional(),
|
|
153
|
+
order_line_item_id: z
|
|
154
|
+
.string({
|
|
155
|
+
invalid_type_error: 'order_line_item_id must be a string',
|
|
156
|
+
description: 'The unique identifier of the line item',
|
|
157
|
+
})
|
|
158
|
+
.optional(),
|
|
159
|
+
seller_ratings: z
|
|
160
|
+
.array(z.object({
|
|
161
|
+
key: z
|
|
162
|
+
.string({
|
|
163
|
+
invalid_type_error: 'seller rating key must be a string',
|
|
164
|
+
description: 'Rating category (e.g., ON_TIME_DELIVERY, ITEM_AS_DESCRIBED)',
|
|
165
|
+
})
|
|
166
|
+
.optional(),
|
|
167
|
+
value: z
|
|
168
|
+
.string({
|
|
169
|
+
invalid_type_error: 'seller rating value must be a string',
|
|
170
|
+
description: 'Rating value (1-5)',
|
|
171
|
+
})
|
|
172
|
+
.optional(),
|
|
173
|
+
}), {
|
|
174
|
+
invalid_type_error: 'seller_ratings must be an array',
|
|
175
|
+
description: 'Array of seller performance ratings',
|
|
176
|
+
})
|
|
177
|
+
.optional(),
|
|
178
|
+
transaction_id: z
|
|
179
|
+
.string({
|
|
180
|
+
invalid_type_error: 'transaction_id must be a string',
|
|
181
|
+
description: 'The unique identifier of the transaction',
|
|
182
|
+
})
|
|
183
|
+
.optional(),
|
|
184
|
+
});
|
|
185
|
+
/**
|
|
186
|
+
* Schema for respondToFeedback method
|
|
187
|
+
* Endpoint: POST /respond_to_feedback
|
|
188
|
+
* Body: RespondToFeedbackRequest - feedbackId, recipientUserId, responseText, responseType
|
|
189
|
+
*/
|
|
190
|
+
export const respondToFeedbackSchema = z.object({
|
|
191
|
+
feedback_id: z
|
|
192
|
+
.string({
|
|
193
|
+
invalid_type_error: 'feedback_id must be a string',
|
|
194
|
+
description: 'The unique identifier of the feedback being responded to',
|
|
195
|
+
})
|
|
196
|
+
.optional(),
|
|
197
|
+
recipient_user_id: z
|
|
198
|
+
.string({
|
|
199
|
+
invalid_type_error: 'recipient_user_id must be a string',
|
|
200
|
+
description: 'The user ID of the feedback provider',
|
|
201
|
+
})
|
|
202
|
+
.optional(),
|
|
203
|
+
response_text: z
|
|
204
|
+
.string({
|
|
205
|
+
invalid_type_error: 'response_text must be a string',
|
|
206
|
+
description: 'The text content of the response (max 500 characters)',
|
|
207
|
+
})
|
|
208
|
+
.max(500, 'response_text must be 500 characters or less')
|
|
209
|
+
.optional(),
|
|
210
|
+
response_type: z
|
|
211
|
+
.string({
|
|
212
|
+
invalid_type_error: 'response_type must be a string',
|
|
213
|
+
description: 'The type of response: REPLY or FOLLOW_UP',
|
|
214
|
+
})
|
|
215
|
+
.optional(),
|
|
216
|
+
});
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for Message API input validation
|
|
4
|
+
* Based on: src/api/communication/message.ts
|
|
5
|
+
* OpenAPI spec: docs/sell-apps/communication/commerce_message_v1_oas3.json
|
|
6
|
+
* Types from: src/types/commerce_message_v1_oas3.ts
|
|
7
|
+
*/
|
|
8
|
+
// Reusable schema for filter parameter
|
|
9
|
+
const _filterSchema = z
|
|
10
|
+
.string({
|
|
11
|
+
message: 'Filter must be a string',
|
|
12
|
+
invalid_type_error: 'filter must be a string',
|
|
13
|
+
description: 'Filter criteria for the query',
|
|
14
|
+
})
|
|
15
|
+
.optional();
|
|
16
|
+
// Reusable schema for limit parameter (string in API)
|
|
17
|
+
const limitSchema = z
|
|
18
|
+
.string({
|
|
19
|
+
invalid_type_error: 'limit must be a string',
|
|
20
|
+
description: 'Maximum number of items to return (25-50)',
|
|
21
|
+
})
|
|
22
|
+
.optional();
|
|
23
|
+
// Reusable schema for offset parameter (string in API)
|
|
24
|
+
const offsetSchema = z
|
|
25
|
+
.string({
|
|
26
|
+
invalid_type_error: 'offset must be a string',
|
|
27
|
+
description: 'Number of items to skip',
|
|
28
|
+
})
|
|
29
|
+
.optional();
|
|
30
|
+
/**
|
|
31
|
+
* Schema for bulkUpdateConversation method
|
|
32
|
+
* Endpoint: POST /bulk_update_conversation
|
|
33
|
+
* Body: BulkUpdateConversationsRequest - conversations array
|
|
34
|
+
*/
|
|
35
|
+
export const bulkUpdateConversationSchema = z.object({
|
|
36
|
+
conversations: z
|
|
37
|
+
.array(z.object({
|
|
38
|
+
conversation_id: z
|
|
39
|
+
.string({
|
|
40
|
+
invalid_type_error: 'conversation_id must be a string',
|
|
41
|
+
description: 'The unique identifier of the conversation',
|
|
42
|
+
})
|
|
43
|
+
.optional(),
|
|
44
|
+
conversation_status: z
|
|
45
|
+
.string({
|
|
46
|
+
invalid_type_error: 'conversation_status must be a string',
|
|
47
|
+
description: 'The updated status: ACTIVE, ARCHIVE, DELETE, READ, UNREAD',
|
|
48
|
+
})
|
|
49
|
+
.optional(),
|
|
50
|
+
conversation_type: z
|
|
51
|
+
.string({
|
|
52
|
+
invalid_type_error: 'conversation_type must be a string',
|
|
53
|
+
description: 'The existing type: FROM_MEMBERS or FROM_EBAY (required but cannot be updated)',
|
|
54
|
+
})
|
|
55
|
+
.optional(),
|
|
56
|
+
}), {
|
|
57
|
+
invalid_type_error: 'conversations must be an array',
|
|
58
|
+
description: 'Array of conversations to update',
|
|
59
|
+
})
|
|
60
|
+
.optional(),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Schema for getConversations method
|
|
64
|
+
* Endpoint: GET /conversation
|
|
65
|
+
* Params: GetConversationsParams - conversation_type (required), conversation_status, end_time, limit, offset, other_party_username, reference_id, reference_type, start_time
|
|
66
|
+
*/
|
|
67
|
+
export const getConversationsSchema = z.object({
|
|
68
|
+
conversation_type: z.string({
|
|
69
|
+
message: 'Conversation type is required',
|
|
70
|
+
required_error: 'conversation_type is required',
|
|
71
|
+
invalid_type_error: 'conversation_type must be a string',
|
|
72
|
+
description: 'Type of conversation: FROM_EBAY or FROM_MEMBERS',
|
|
73
|
+
}),
|
|
74
|
+
conversation_status: z
|
|
75
|
+
.string({
|
|
76
|
+
invalid_type_error: 'conversation_status must be a string',
|
|
77
|
+
description: 'Filter by status: ACTIVE, ARCHIVE, DELETE, READ, UNREAD',
|
|
78
|
+
})
|
|
79
|
+
.optional(),
|
|
80
|
+
end_time: z
|
|
81
|
+
.string({
|
|
82
|
+
invalid_type_error: 'end_time must be a string',
|
|
83
|
+
description: 'End time for retrieving conversations (ISO 8601 format)',
|
|
84
|
+
})
|
|
85
|
+
.optional(),
|
|
86
|
+
limit: limitSchema,
|
|
87
|
+
offset: offsetSchema,
|
|
88
|
+
other_party_username: z
|
|
89
|
+
.string({
|
|
90
|
+
invalid_type_error: 'other_party_username must be a string',
|
|
91
|
+
description: 'Filter by specific eBay user',
|
|
92
|
+
})
|
|
93
|
+
.optional(),
|
|
94
|
+
reference_id: z
|
|
95
|
+
.string({
|
|
96
|
+
invalid_type_error: 'reference_id must be a string',
|
|
97
|
+
description: 'Filter by reference ID (e.g., listing ID)',
|
|
98
|
+
})
|
|
99
|
+
.optional(),
|
|
100
|
+
reference_type: z
|
|
101
|
+
.string({
|
|
102
|
+
invalid_type_error: 'reference_type must be a string',
|
|
103
|
+
description: 'Reference type (currently only LISTING is supported)',
|
|
104
|
+
})
|
|
105
|
+
.optional(),
|
|
106
|
+
start_time: z
|
|
107
|
+
.string({
|
|
108
|
+
invalid_type_error: 'start_time must be a string',
|
|
109
|
+
description: 'Start time for retrieving conversations (ISO 8601 format)',
|
|
110
|
+
})
|
|
111
|
+
.optional(),
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* Schema for getConversation method
|
|
115
|
+
* Endpoint: GET /conversation/{conversation_id}
|
|
116
|
+
* Path: conversation_id (required)
|
|
117
|
+
* Query: conversation_type (required), limit, offset
|
|
118
|
+
*/
|
|
119
|
+
export const getConversationSchema = z.object({
|
|
120
|
+
conversation_id: z.string({
|
|
121
|
+
message: 'Conversation ID is required',
|
|
122
|
+
required_error: 'conversation_id is required',
|
|
123
|
+
invalid_type_error: 'conversation_id must be a string',
|
|
124
|
+
description: 'The unique identifier for the conversation',
|
|
125
|
+
}),
|
|
126
|
+
conversation_type: z.string({
|
|
127
|
+
message: 'Conversation type is required',
|
|
128
|
+
required_error: 'conversation_type is required',
|
|
129
|
+
invalid_type_error: 'conversation_type must be a string',
|
|
130
|
+
description: 'Type of conversation: FROM_EBAY or FROM_MEMBERS',
|
|
131
|
+
}),
|
|
132
|
+
limit: limitSchema,
|
|
133
|
+
offset: offsetSchema,
|
|
134
|
+
});
|
|
135
|
+
/**
|
|
136
|
+
* Schema for sendMessage method
|
|
137
|
+
* Endpoint: POST /send_message
|
|
138
|
+
* Body: SendMessageRequest - conversationId, emailCopyToSender, messageMedia, messageText, otherPartyUsername, reference
|
|
139
|
+
*/
|
|
140
|
+
export const sendMessageSchema = z.object({
|
|
141
|
+
conversation_id: z
|
|
142
|
+
.string({
|
|
143
|
+
invalid_type_error: 'conversation_id must be a string',
|
|
144
|
+
description: 'ID of existing conversation (required if sending in existing conversation)',
|
|
145
|
+
})
|
|
146
|
+
.optional(),
|
|
147
|
+
email_copy_to_sender: z
|
|
148
|
+
.boolean({
|
|
149
|
+
invalid_type_error: 'email_copy_to_sender must be a boolean',
|
|
150
|
+
description: 'Whether to email a copy to the sender',
|
|
151
|
+
})
|
|
152
|
+
.optional(),
|
|
153
|
+
message_media: z
|
|
154
|
+
.array(z.object({
|
|
155
|
+
media_name: z
|
|
156
|
+
.string({
|
|
157
|
+
invalid_type_error: 'media_name must be a string',
|
|
158
|
+
description: 'Name of the media',
|
|
159
|
+
})
|
|
160
|
+
.optional(),
|
|
161
|
+
media_type: z
|
|
162
|
+
.string({
|
|
163
|
+
invalid_type_error: 'media_type must be a string',
|
|
164
|
+
description: 'Type of media: IMAGE, PDF, DOC, TXT',
|
|
165
|
+
})
|
|
166
|
+
.optional(),
|
|
167
|
+
media_url: z
|
|
168
|
+
.string({
|
|
169
|
+
invalid_type_error: 'media_url must be a string',
|
|
170
|
+
description: 'HTTPS URL of the self-hosted media',
|
|
171
|
+
})
|
|
172
|
+
.optional(),
|
|
173
|
+
}), {
|
|
174
|
+
invalid_type_error: 'message_media must be an array',
|
|
175
|
+
description: 'Array of up to 5 media attachments',
|
|
176
|
+
})
|
|
177
|
+
.max(5, 'Maximum 5 media attachments allowed')
|
|
178
|
+
.optional(),
|
|
179
|
+
message_text: z
|
|
180
|
+
.string({
|
|
181
|
+
invalid_type_error: 'message_text must be a string',
|
|
182
|
+
description: 'The text of the message (max 2000 characters)',
|
|
183
|
+
})
|
|
184
|
+
.max(2000, 'message_text must be 2000 characters or less')
|
|
185
|
+
.optional(),
|
|
186
|
+
other_party_username: z
|
|
187
|
+
.string({
|
|
188
|
+
invalid_type_error: 'other_party_username must be a string',
|
|
189
|
+
description: 'eBay username to send message to (required for new conversations)',
|
|
190
|
+
})
|
|
191
|
+
.optional(),
|
|
192
|
+
reference: z
|
|
193
|
+
.object({
|
|
194
|
+
reference_id: z
|
|
195
|
+
.string({
|
|
196
|
+
invalid_type_error: 'reference_id must be a string',
|
|
197
|
+
description: 'The reference ID (e.g., item ID for LISTING)',
|
|
198
|
+
})
|
|
199
|
+
.optional(),
|
|
200
|
+
reference_type: z
|
|
201
|
+
.string({
|
|
202
|
+
invalid_type_error: 'reference_type must be a string',
|
|
203
|
+
description: 'The reference type (currently only LISTING is supported)',
|
|
204
|
+
})
|
|
205
|
+
.optional(),
|
|
206
|
+
}, {
|
|
207
|
+
invalid_type_error: 'reference must be an object',
|
|
208
|
+
description: 'Reference to associate with the conversation',
|
|
209
|
+
})
|
|
210
|
+
.optional(),
|
|
211
|
+
});
|
|
212
|
+
/**
|
|
213
|
+
* Schema for updateConversation method
|
|
214
|
+
* Endpoint: POST /update_conversation
|
|
215
|
+
* Body: UpdateConversationRequest - conversationId, conversationStatus, conversationType, read
|
|
216
|
+
*/
|
|
217
|
+
export const updateConversationSchema = z.object({
|
|
218
|
+
conversation_id: z
|
|
219
|
+
.string({
|
|
220
|
+
invalid_type_error: 'conversation_id must be a string',
|
|
221
|
+
description: 'The unique identifier of the conversation',
|
|
222
|
+
})
|
|
223
|
+
.optional(),
|
|
224
|
+
conversation_status: z
|
|
225
|
+
.string({
|
|
226
|
+
invalid_type_error: 'conversation_status must be a string',
|
|
227
|
+
description: 'The updated status: ACTIVE, ARCHIVE, DELETE',
|
|
228
|
+
})
|
|
229
|
+
.optional(),
|
|
230
|
+
conversation_type: z
|
|
231
|
+
.string({
|
|
232
|
+
invalid_type_error: 'conversation_type must be a string',
|
|
233
|
+
description: 'The existing type: FROM_MEMBERS or FROM_EBAY (required but cannot be updated)',
|
|
234
|
+
})
|
|
235
|
+
.optional(),
|
|
236
|
+
read: z
|
|
237
|
+
.boolean({
|
|
238
|
+
invalid_type_error: 'read must be a boolean',
|
|
239
|
+
description: 'The read status to set (true = read, false = unread)',
|
|
240
|
+
})
|
|
241
|
+
.optional(),
|
|
242
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for Negotiation API input validation
|
|
4
|
+
* Based on: src/api/communication/negotiation.ts
|
|
5
|
+
* OpenAPI spec: docs/sell-apps/communication/sell_negotiation_v1_oas3.json
|
|
6
|
+
* Types from: src/types/sell_negotiation_v1_oas3.ts
|
|
7
|
+
*/
|
|
8
|
+
// Reusable schema for filter parameter
|
|
9
|
+
const filterSchema = z
|
|
10
|
+
.string({
|
|
11
|
+
message: 'Filter must be a string',
|
|
12
|
+
invalid_type_error: 'filter must be a string',
|
|
13
|
+
description: 'Filter criteria for the query',
|
|
14
|
+
})
|
|
15
|
+
.optional();
|
|
16
|
+
// Reusable schema for limit parameter (string in API)
|
|
17
|
+
const limitSchema = z
|
|
18
|
+
.string({
|
|
19
|
+
invalid_type_error: 'limit must be a string',
|
|
20
|
+
description: 'Maximum number of items to return (1-200)',
|
|
21
|
+
})
|
|
22
|
+
.optional();
|
|
23
|
+
// Reusable schema for offset parameter (string in API)
|
|
24
|
+
const offsetSchema = z
|
|
25
|
+
.string({
|
|
26
|
+
invalid_type_error: 'offset must be a string',
|
|
27
|
+
description: 'Number of items to skip',
|
|
28
|
+
})
|
|
29
|
+
.optional();
|
|
30
|
+
/**
|
|
31
|
+
* Schema for findEligibleItems method
|
|
32
|
+
* Endpoint: GET /find_eligible_items
|
|
33
|
+
* Query Params: FindEligibleItemsParams - limit, offset
|
|
34
|
+
* Headers: X-EBAY-C-MARKETPLACE-ID (required)
|
|
35
|
+
*/
|
|
36
|
+
export const findEligibleItemsSchema = z.object({
|
|
37
|
+
limit: limitSchema,
|
|
38
|
+
offset: offsetSchema,
|
|
39
|
+
marketplace_id: z
|
|
40
|
+
.string({
|
|
41
|
+
invalid_type_error: 'marketplace_id must be a string',
|
|
42
|
+
description: 'The eBay marketplace ID (X-EBAY-C-MARKETPLACE-ID header)',
|
|
43
|
+
})
|
|
44
|
+
.optional(),
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Schema for sendOfferToInterestedBuyers method
|
|
48
|
+
* Endpoint: POST /send_offer_to_interested_buyers
|
|
49
|
+
* Body: CreateOffersRequest - allowCounterOffer, message, offerDuration, offeredItems
|
|
50
|
+
* Headers: X-EBAY-C-MARKETPLACE-ID (required)
|
|
51
|
+
*/
|
|
52
|
+
export const sendOfferToInterestedBuyersSchema = z.object({
|
|
53
|
+
allow_counter_offer: z
|
|
54
|
+
.boolean({
|
|
55
|
+
invalid_type_error: 'allow_counter_offer must be a boolean',
|
|
56
|
+
description: 'Whether to allow counter-offers (currently must be false)',
|
|
57
|
+
})
|
|
58
|
+
.optional(),
|
|
59
|
+
message: z
|
|
60
|
+
.string({
|
|
61
|
+
invalid_type_error: 'message must be a string',
|
|
62
|
+
description: 'Seller-defined message to buyers (max 2000 characters)',
|
|
63
|
+
})
|
|
64
|
+
.max(2000, 'message must be 2000 characters or less')
|
|
65
|
+
.optional(),
|
|
66
|
+
offer_duration: z
|
|
67
|
+
.object({
|
|
68
|
+
unit: z
|
|
69
|
+
.string({
|
|
70
|
+
invalid_type_error: 'unit must be a string',
|
|
71
|
+
description: 'Time unit (currently must be DAY)',
|
|
72
|
+
})
|
|
73
|
+
.optional(),
|
|
74
|
+
value: z
|
|
75
|
+
.number({
|
|
76
|
+
invalid_type_error: 'value must be a number',
|
|
77
|
+
description: 'Duration value (currently must be 2)',
|
|
78
|
+
})
|
|
79
|
+
.int({
|
|
80
|
+
message: 'value must be an integer',
|
|
81
|
+
})
|
|
82
|
+
.optional(),
|
|
83
|
+
}, {
|
|
84
|
+
invalid_type_error: 'offer_duration must be an object',
|
|
85
|
+
description: 'Duration the offer is valid (default: 2 days)',
|
|
86
|
+
})
|
|
87
|
+
.optional(),
|
|
88
|
+
offered_items: z
|
|
89
|
+
.array(z.object({
|
|
90
|
+
discount_percentage: z
|
|
91
|
+
.string({
|
|
92
|
+
invalid_type_error: 'discount_percentage must be a string',
|
|
93
|
+
description: 'Percentage discount (minimum 5)',
|
|
94
|
+
})
|
|
95
|
+
.optional(),
|
|
96
|
+
listing_id: z
|
|
97
|
+
.string({
|
|
98
|
+
invalid_type_error: 'listing_id must be a string',
|
|
99
|
+
description: 'The unique eBay listing ID',
|
|
100
|
+
})
|
|
101
|
+
.optional(),
|
|
102
|
+
price: z
|
|
103
|
+
.object({
|
|
104
|
+
currency: z
|
|
105
|
+
.string({
|
|
106
|
+
invalid_type_error: 'currency must be a string',
|
|
107
|
+
description: '3-letter ISO 4217 currency code',
|
|
108
|
+
})
|
|
109
|
+
.optional(),
|
|
110
|
+
value: z
|
|
111
|
+
.string({
|
|
112
|
+
invalid_type_error: 'value must be a string',
|
|
113
|
+
description: 'The monetary amount',
|
|
114
|
+
})
|
|
115
|
+
.optional(),
|
|
116
|
+
}, {
|
|
117
|
+
invalid_type_error: 'price must be an object',
|
|
118
|
+
description: 'The discounted price',
|
|
119
|
+
})
|
|
120
|
+
.optional(),
|
|
121
|
+
quantity: z
|
|
122
|
+
.number({
|
|
123
|
+
invalid_type_error: 'quantity must be a number',
|
|
124
|
+
description: 'Number of items (all-or-nothing offer)',
|
|
125
|
+
})
|
|
126
|
+
.int({
|
|
127
|
+
message: 'quantity must be an integer',
|
|
128
|
+
})
|
|
129
|
+
.optional(),
|
|
130
|
+
}), {
|
|
131
|
+
invalid_type_error: 'offered_items must be an array',
|
|
132
|
+
description: 'Array of items to offer (currently limited to one item)',
|
|
133
|
+
})
|
|
134
|
+
.optional(),
|
|
135
|
+
marketplace_id: z
|
|
136
|
+
.string({
|
|
137
|
+
invalid_type_error: 'marketplace_id must be a string',
|
|
138
|
+
description: 'The eBay marketplace ID (X-EBAY-C-MARKETPLACE-ID header)',
|
|
139
|
+
})
|
|
140
|
+
.optional(),
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* Schema for getOffersToBuyers method (deprecated)
|
|
144
|
+
* Note: This method does not match any endpoint in the OpenAPI spec
|
|
145
|
+
*/
|
|
146
|
+
export const getOffersToBuyersSchema = z.object({
|
|
147
|
+
filter: filterSchema,
|
|
148
|
+
limit: limitSchema,
|
|
149
|
+
offset: offsetSchema,
|
|
150
|
+
});
|