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.
Files changed (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +755 -0
  3. package/build/api/account-management/account.js +301 -0
  4. package/build/api/analytics-and-report/analytics.js +102 -0
  5. package/build/api/client-trading.js +96 -0
  6. package/build/api/client.js +173 -0
  7. package/build/api/communication/feedback.js +119 -0
  8. package/build/api/communication/message.js +131 -0
  9. package/build/api/communication/negotiation.js +97 -0
  10. package/build/api/communication/notification.js +373 -0
  11. package/build/api/developer/developer.js +81 -0
  12. package/build/api/index.js +109 -0
  13. package/build/api/listing-management/inventory.js +640 -0
  14. package/build/api/listing-metadata/metadata.js +485 -0
  15. package/build/api/listing-metadata/taxonomy.js +58 -0
  16. package/build/api/marketing-and-promotions/marketing.js +768 -0
  17. package/build/api/marketing-and-promotions/recommendation.js +32 -0
  18. package/build/api/order-management/dispute.js +69 -0
  19. package/build/api/order-management/fulfillment.js +89 -0
  20. package/build/api/other/compliance.js +47 -0
  21. package/build/api/other/edelivery.js +219 -0
  22. package/build/api/other/identity.js +24 -0
  23. package/build/api/other/translation.js +22 -0
  24. package/build/api/other/vero.js +48 -0
  25. package/build/api/trading/trading.js +78 -0
  26. package/build/auth/kv-store.js +40 -0
  27. package/build/auth/multi-user-store.js +120 -0
  28. package/build/auth/oauth-metadata.js +59 -0
  29. package/build/auth/oauth-middleware.js +99 -0
  30. package/build/auth/oauth-types.js +4 -0
  31. package/build/auth/oauth.js +235 -0
  32. package/build/auth/scope-utils.js +304 -0
  33. package/build/auth/token-store.js +46 -0
  34. package/build/auth/token-verifier.js +172 -0
  35. package/build/config/environment.js +297 -0
  36. package/build/index.d.ts +1 -0
  37. package/build/index.js +129 -0
  38. package/build/schemas/account-management/account.js +375 -0
  39. package/build/schemas/analytics/analytics.js +191 -0
  40. package/build/schemas/communication/messages.js +345 -0
  41. package/build/schemas/fulfillment/orders.js +338 -0
  42. package/build/schemas/index.js +68 -0
  43. package/build/schemas/inventory-management/inventory.js +471 -0
  44. package/build/schemas/marketing/marketing.js +1103 -0
  45. package/build/schemas/metadata/metadata.js +618 -0
  46. package/build/schemas/other/other-apis.js +390 -0
  47. package/build/schemas/taxonomy/taxonomy.js +575 -0
  48. package/build/scripts/auto-setup.js +364 -0
  49. package/build/scripts/dev-sync.js +512 -0
  50. package/build/scripts/diagnostics.js +301 -0
  51. package/build/scripts/download-specs.js +116 -0
  52. package/build/scripts/interactive-setup.js +757 -0
  53. package/build/scripts/setup.js +1515 -0
  54. package/build/scripts/update-api-status-doc.js +44 -0
  55. package/build/server-http.d.ts +1 -0
  56. package/build/server-http.js +581 -0
  57. package/build/tools/definitions/account-with-schemas.js +170 -0
  58. package/build/tools/definitions/account.js +428 -0
  59. package/build/tools/definitions/analytics.js +66 -0
  60. package/build/tools/definitions/communication.js +394 -0
  61. package/build/tools/definitions/developer.js +195 -0
  62. package/build/tools/definitions/fulfillment.js +326 -0
  63. package/build/tools/definitions/index.js +41 -0
  64. package/build/tools/definitions/inventory.js +464 -0
  65. package/build/tools/definitions/marketing.js +1486 -0
  66. package/build/tools/definitions/metadata.js +188 -0
  67. package/build/tools/definitions/other.js +309 -0
  68. package/build/tools/definitions/taxonomy.js +64 -0
  69. package/build/tools/definitions/token-management.js +148 -0
  70. package/build/tools/definitions/trading.js +71 -0
  71. package/build/tools/index.js +1200 -0
  72. package/build/tools/schemas.js +667 -0
  73. package/build/tools/tool-definitions.js +3534 -0
  74. package/build/types/application-settings/developerAnalyticsV1BetaOas3.js +5 -0
  75. package/build/types/application-settings/developerClientRegistrationV1Oas3.js +5 -0
  76. package/build/types/application-settings/developerKeyManagementV1Oas3.js +5 -0
  77. package/build/types/ebay-enums.js +1330 -0
  78. package/build/types/ebay.js +123 -0
  79. package/build/types/index.js +10 -0
  80. package/build/types/sell-apps/account-management/sellAccountV1Oas3.js +5 -0
  81. package/build/types/sell-apps/analytics-and-report/sellAnalyticsV1Oas3.js +5 -0
  82. package/build/types/sell-apps/communication/commerceFeedbackV1BetaOas3.js +5 -0
  83. package/build/types/sell-apps/communication/commerceMessageV1Oas3.js +5 -0
  84. package/build/types/sell-apps/communication/commerceNotificationV1Oas3.js +5 -0
  85. package/build/types/sell-apps/communication/sellNegotiationV1Oas3.js +5 -0
  86. package/build/types/sell-apps/listing-management/sellInventoryV1Oas3.js +5 -0
  87. package/build/types/sell-apps/listing-metadata/sellMetadataV1Oas3.js +5 -0
  88. package/build/types/sell-apps/markeitng-and-promotions/sellMarketingV1Oas3.js +5 -0
  89. package/build/types/sell-apps/markeitng-and-promotions/sellRecommendationV1Oas3.js +5 -0
  90. package/build/types/sell-apps/order-management/sellFulfillmentV1Oas3.js +5 -0
  91. package/build/types/sell-apps/other-apis/commerceIdentityV1Oas3.js +5 -0
  92. package/build/types/sell-apps/other-apis/commerceTranslationV1BetaOas3.js +5 -0
  93. package/build/types/sell-apps/other-apis/commerceVeroV1Oas3.js +5 -0
  94. package/build/types/sell-apps/other-apis/sellComplianceV1Oas3.js +5 -0
  95. package/build/types/sell-apps/other-apis/sellEdeliveryInternationalShippingOas3.js +5 -0
  96. package/build/types/sell-apps/other-apis/sellMarketingV1Oas3.js +5 -0
  97. package/build/types/sell-apps/other-apis/sellRecommendationV1Oas3.js +5 -0
  98. package/build/utils/account-management/account.js +831 -0
  99. package/build/utils/api-status-feed.js +83 -0
  100. package/build/utils/communication/feedback.js +216 -0
  101. package/build/utils/communication/message.js +242 -0
  102. package/build/utils/communication/negotiation.js +150 -0
  103. package/build/utils/communication/notification.js +369 -0
  104. package/build/utils/date-converter.js +160 -0
  105. package/build/utils/llm-client-detector.js +758 -0
  106. package/build/utils/logger.js +198 -0
  107. package/build/utils/oauth-helper.js +315 -0
  108. package/build/utils/order-management/dispute.js +369 -0
  109. package/build/utils/order-management/fulfillment.js +205 -0
  110. package/build/utils/other/compliance.js +76 -0
  111. package/build/utils/other/edelivery.js +241 -0
  112. package/build/utils/other/identity.js +13 -0
  113. package/build/utils/other/translation.js +41 -0
  114. package/build/utils/other/vero.js +90 -0
  115. package/build/utils/scope-helper.js +207 -0
  116. package/build/utils/security-checker.js +248 -0
  117. package/build/utils/setup-validator.js +305 -0
  118. package/build/utils/token-utils.js +40 -0
  119. package/build/utils/version.js +56 -0
  120. package/docs/auth/production_scopes.json +111 -0
  121. package/docs/auth/sandbox_scopes.json +142 -0
  122. package/package.json +122 -0
  123. package/public/icons/1024x1024.png +0 -0
  124. package/public/icons/128x128.png +0 -0
  125. package/public/icons/16x16.png +0 -0
  126. package/public/icons/256x256.png +0 -0
  127. package/public/icons/32x32.png +0 -0
  128. package/public/icons/48x48.png +0 -0
  129. package/public/icons/512x512.png +0 -0
@@ -0,0 +1,369 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Zod schemas for Dispute API input validation
4
+ * Based on: src/api/order-management/dispute.ts
5
+ * OpenAPI spec: docs/sell-apps/order-management/sell_fulfillment_v1_oas3.json
6
+ * Types from: src/types/sell_fulfillment_v1_oas3.ts
7
+ */
8
+ // Reusable schema for payment dispute ID
9
+ const paymentDisputeIdSchema = z.string({
10
+ message: 'Payment dispute ID is required',
11
+ required_error: 'payment_dispute_id is required',
12
+ invalid_type_error: 'payment_dispute_id must be a string',
13
+ description: 'The unique identifier of the payment dispute',
14
+ });
15
+ // Reusable schema for evidence ID
16
+ const evidenceIdSchema = z.string({
17
+ message: 'Evidence ID is required',
18
+ required_error: 'evidence_id is required',
19
+ invalid_type_error: 'evidence_id must be a string',
20
+ description: 'The unique identifier of the evidence file set',
21
+ });
22
+ // Reusable schema for file ID
23
+ const fileIdSchema = z.string({
24
+ message: 'File ID is required',
25
+ required_error: 'file_id is required',
26
+ invalid_type_error: 'file_id must be a string',
27
+ description: 'The unique identifier of an evidential file',
28
+ });
29
+ // Reusable schema for limit parameter (number in API)
30
+ const limitSchema = z
31
+ .number({
32
+ invalid_type_error: 'limit must be a number',
33
+ description: 'Maximum number of payment disputes to return (default: 200, max: 200)',
34
+ })
35
+ .optional();
36
+ // Reusable schema for offset parameter (number in API)
37
+ const offsetSchema = z
38
+ .number({
39
+ invalid_type_error: 'offset must be a number',
40
+ description: 'Number of payment disputes to skip (zero-based index)',
41
+ })
42
+ .optional();
43
+ /**
44
+ * Schema for getPaymentDispute method
45
+ * Endpoint: GET /payment_dispute/{payment_dispute_id}
46
+ * Path: payment_dispute_id (required)
47
+ */
48
+ export const getPaymentDisputeSchema = z.object({
49
+ payment_dispute_id: paymentDisputeIdSchema,
50
+ });
51
+ /**
52
+ * Schema for fetchEvidenceContent method
53
+ * Endpoint: GET /payment_dispute/{payment_dispute_id}/fetch_evidence_content
54
+ * Path: payment_dispute_id (required)
55
+ * Query: evidence_id (required), file_id (required)
56
+ */
57
+ export const fetchEvidenceContentSchema = z.object({
58
+ payment_dispute_id: paymentDisputeIdSchema,
59
+ evidence_id: evidenceIdSchema,
60
+ file_id: fileIdSchema,
61
+ });
62
+ /**
63
+ * Schema for getActivities method
64
+ * Endpoint: GET /payment_dispute/{payment_dispute_id}/activity
65
+ * Path: payment_dispute_id (required)
66
+ */
67
+ export const getActivitiesSchema = z.object({
68
+ payment_dispute_id: paymentDisputeIdSchema,
69
+ });
70
+ /**
71
+ * Schema for getPaymentDisputeSummaries method
72
+ * Endpoint: GET /payment_dispute_summary
73
+ * Query: order_id, buyer_username, open_date_from, open_date_to, payment_dispute_status, limit, offset
74
+ */
75
+ export const getPaymentDisputeSummariesSchema = z.object({
76
+ order_id: z
77
+ .string({
78
+ invalid_type_error: 'order_id must be a string',
79
+ description: 'Filter by a specific order ID',
80
+ })
81
+ .optional(),
82
+ buyer_username: z
83
+ .string({
84
+ invalid_type_error: 'buyer_username must be a string',
85
+ description: "Filter by buyer's eBay username",
86
+ })
87
+ .optional(),
88
+ open_date_from: z
89
+ .string({
90
+ invalid_type_error: 'open_date_from must be a string',
91
+ description: 'Filter disputes opened on or after this date (ISO 8601 format)',
92
+ })
93
+ .optional(),
94
+ open_date_to: z
95
+ .string({
96
+ invalid_type_error: 'open_date_to must be a string',
97
+ description: 'Filter disputes opened on or before this date (ISO 8601 format)',
98
+ })
99
+ .optional(),
100
+ payment_dispute_status: z
101
+ .string({
102
+ invalid_type_error: 'payment_dispute_status must be a string',
103
+ description: 'Filter by dispute status (e.g., OPEN, ACTION_NEEDED, CLOSED)',
104
+ })
105
+ .optional(),
106
+ limit: limitSchema,
107
+ offset: offsetSchema,
108
+ });
109
+ /**
110
+ * Schema for contestPaymentDispute method
111
+ * Endpoint: POST /payment_dispute/{payment_dispute_id}/contest
112
+ * Path: payment_dispute_id (required)
113
+ * Body: ContestPaymentDisputeRequest (optional) - note, returnAddress, revision
114
+ */
115
+ export const contestPaymentDisputeSchema = z.object({
116
+ payment_dispute_id: paymentDisputeIdSchema,
117
+ note: z
118
+ .string({
119
+ invalid_type_error: 'note must be a string',
120
+ description: 'Information about the dispute (max 1000 characters)',
121
+ })
122
+ .max(1000, 'Note must not exceed 1000 characters')
123
+ .optional(),
124
+ return_address: z
125
+ .object({
126
+ full_name: z
127
+ .string({
128
+ invalid_type_error: 'full_name must be a string',
129
+ description: 'Full name of the person at the return address',
130
+ })
131
+ .optional(),
132
+ primary_phone: z
133
+ .object({
134
+ phone_number: z
135
+ .string({
136
+ invalid_type_error: 'phone_number must be a string',
137
+ description: 'Primary phone number',
138
+ })
139
+ .optional(),
140
+ })
141
+ .optional(),
142
+ address_line1: z
143
+ .string({
144
+ invalid_type_error: 'address_line1 must be a string',
145
+ description: 'First line of the street address',
146
+ })
147
+ .optional(),
148
+ address_line2: z
149
+ .string({
150
+ invalid_type_error: 'address_line2 must be a string',
151
+ description: 'Second line of the street address',
152
+ })
153
+ .optional(),
154
+ city: z
155
+ .string({
156
+ invalid_type_error: 'city must be a string',
157
+ description: 'City',
158
+ })
159
+ .optional(),
160
+ state_or_province: z
161
+ .string({
162
+ invalid_type_error: 'state_or_province must be a string',
163
+ description: 'State or province',
164
+ })
165
+ .optional(),
166
+ postal_code: z
167
+ .string({
168
+ invalid_type_error: 'postal_code must be a string',
169
+ description: 'Postal code',
170
+ })
171
+ .optional(),
172
+ country_code: z
173
+ .string({
174
+ invalid_type_error: 'country_code must be a string',
175
+ description: 'Two-letter ISO 3166-1 alpha-2 country code',
176
+ })
177
+ .optional(),
178
+ })
179
+ .optional(),
180
+ revision: z
181
+ .number({
182
+ invalid_type_error: 'revision must be a number',
183
+ description: 'Revision number of the payment dispute (required)',
184
+ })
185
+ .optional(),
186
+ });
187
+ /**
188
+ * Schema for acceptPaymentDispute method
189
+ * Endpoint: POST /payment_dispute/{payment_dispute_id}/accept
190
+ * Path: payment_dispute_id (required)
191
+ * Body: AcceptPaymentDisputeRequest (optional) - returnAddress, revision
192
+ */
193
+ export const acceptPaymentDisputeSchema = z.object({
194
+ payment_dispute_id: paymentDisputeIdSchema,
195
+ return_address: z
196
+ .object({
197
+ full_name: z
198
+ .string({
199
+ invalid_type_error: 'full_name must be a string',
200
+ description: 'Full name of the person at the return address',
201
+ })
202
+ .optional(),
203
+ primary_phone: z
204
+ .object({
205
+ phone_number: z
206
+ .string({
207
+ invalid_type_error: 'phone_number must be a string',
208
+ description: 'Primary phone number',
209
+ })
210
+ .optional(),
211
+ })
212
+ .optional(),
213
+ address_line1: z
214
+ .string({
215
+ invalid_type_error: 'address_line1 must be a string',
216
+ description: 'First line of the street address',
217
+ })
218
+ .optional(),
219
+ address_line2: z
220
+ .string({
221
+ invalid_type_error: 'address_line2 must be a string',
222
+ description: 'Second line of the street address',
223
+ })
224
+ .optional(),
225
+ city: z
226
+ .string({
227
+ invalid_type_error: 'city must be a string',
228
+ description: 'City',
229
+ })
230
+ .optional(),
231
+ state_or_province: z
232
+ .string({
233
+ invalid_type_error: 'state_or_province must be a string',
234
+ description: 'State or province',
235
+ })
236
+ .optional(),
237
+ postal_code: z
238
+ .string({
239
+ invalid_type_error: 'postal_code must be a string',
240
+ description: 'Postal code',
241
+ })
242
+ .optional(),
243
+ country_code: z
244
+ .string({
245
+ invalid_type_error: 'country_code must be a string',
246
+ description: 'Two-letter ISO 3166-1 alpha-2 country code',
247
+ })
248
+ .optional(),
249
+ })
250
+ .optional(),
251
+ revision: z
252
+ .number({
253
+ invalid_type_error: 'revision must be a number',
254
+ description: 'Revision number of the payment dispute (required)',
255
+ })
256
+ .optional(),
257
+ });
258
+ /**
259
+ * Schema for uploadEvidenceFile method
260
+ * Endpoint: POST /payment_dispute/{payment_dispute_id}/upload_evidence_file
261
+ * Path: payment_dispute_id (required)
262
+ * Body: ArrayBuffer (binary file data)
263
+ */
264
+ export const uploadEvidenceFileSchema = z.object({
265
+ payment_dispute_id: paymentDisputeIdSchema,
266
+ file_data: z.instanceof(ArrayBuffer, {
267
+ message: 'File data must be an ArrayBuffer',
268
+ }),
269
+ });
270
+ /**
271
+ * Schema for addEvidence method
272
+ * Endpoint: POST /payment_dispute/{payment_dispute_id}/add_evidence
273
+ * Path: payment_dispute_id (required)
274
+ * Body: AddEvidencePaymentDisputeRequest - evidenceType, files, lineItems
275
+ */
276
+ export const addEvidenceSchema = z.object({
277
+ payment_dispute_id: paymentDisputeIdSchema,
278
+ evidence_type: z
279
+ .string({
280
+ invalid_type_error: 'evidence_type must be a string',
281
+ description: 'Type of evidence (e.g., PROOF_OF_DELIVERY, PROOF_OF_AUTHENTICATION)',
282
+ })
283
+ .optional(),
284
+ files: z
285
+ .array(z.object({
286
+ file_id: z
287
+ .string({
288
+ invalid_type_error: 'file_id must be a string',
289
+ description: 'Unique identifier of the evidence file',
290
+ })
291
+ .optional(),
292
+ }), {
293
+ invalid_type_error: 'files must be an array',
294
+ description: 'Array of evidence files',
295
+ })
296
+ .optional(),
297
+ line_items: z
298
+ .array(z.object({
299
+ item_id: z
300
+ .string({
301
+ invalid_type_error: 'item_id must be a string',
302
+ description: 'eBay listing ID',
303
+ })
304
+ .optional(),
305
+ line_item_id: z
306
+ .string({
307
+ invalid_type_error: 'line_item_id must be a string',
308
+ description: 'Unique identifier of the line item',
309
+ })
310
+ .optional(),
311
+ }), {
312
+ invalid_type_error: 'line_items must be an array',
313
+ description: 'Array of order line items',
314
+ })
315
+ .optional(),
316
+ });
317
+ /**
318
+ * Schema for updateEvidence method
319
+ * Endpoint: POST /payment_dispute/{payment_dispute_id}/update_evidence
320
+ * Path: payment_dispute_id (required)
321
+ * Body: UpdateEvidencePaymentDisputeRequest - evidenceId, evidenceType, files, lineItems
322
+ */
323
+ export const updateEvidenceSchema = z.object({
324
+ payment_dispute_id: paymentDisputeIdSchema,
325
+ evidence_id: z
326
+ .string({
327
+ invalid_type_error: 'evidence_id must be a string',
328
+ description: 'Unique identifier of the evidence set to update',
329
+ })
330
+ .optional(),
331
+ evidence_type: z
332
+ .string({
333
+ invalid_type_error: 'evidence_type must be a string',
334
+ description: 'Type of evidence (e.g., PROOF_OF_DELIVERY, PROOF_OF_AUTHENTICATION)',
335
+ })
336
+ .optional(),
337
+ files: z
338
+ .array(z.object({
339
+ file_id: z
340
+ .string({
341
+ invalid_type_error: 'file_id must be a string',
342
+ description: 'Unique identifier of the evidence file',
343
+ })
344
+ .optional(),
345
+ }), {
346
+ invalid_type_error: 'files must be an array',
347
+ description: 'Array of evidence files',
348
+ })
349
+ .optional(),
350
+ line_items: z
351
+ .array(z.object({
352
+ item_id: z
353
+ .string({
354
+ invalid_type_error: 'item_id must be a string',
355
+ description: 'eBay listing ID',
356
+ })
357
+ .optional(),
358
+ line_item_id: z
359
+ .string({
360
+ invalid_type_error: 'line_item_id must be a string',
361
+ description: 'Unique identifier of the line item',
362
+ })
363
+ .optional(),
364
+ }), {
365
+ invalid_type_error: 'line_items must be an array',
366
+ description: 'Array of order line items',
367
+ })
368
+ .optional(),
369
+ });
@@ -0,0 +1,205 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Zod schemas for Fulfillment API input validation
4
+ * Based on: src/api/order-management/fulfillment.ts
5
+ * OpenAPI spec: docs/sell-apps/order-management/sell_fulfillment_v1_oas3.json
6
+ * Types from: src/types/sell_fulfillment_v1_oas3.ts
7
+ */
8
+ // Reusable schema for order ID
9
+ const orderIdSchema = z.string({
10
+ message: 'Order ID is required',
11
+ required_error: 'order_id is required',
12
+ invalid_type_error: 'order_id must be a string',
13
+ description: 'The unique identifier of the order',
14
+ });
15
+ // Reusable schema for fulfillment ID
16
+ const fulfillmentIdSchema = z.string({
17
+ message: 'Fulfillment ID is required',
18
+ required_error: 'fulfillment_id is required',
19
+ invalid_type_error: 'fulfillment_id must be a string',
20
+ description: 'The unique identifier of the shipping fulfillment',
21
+ });
22
+ // Reusable schema for filter parameter
23
+ const filterSchema = z
24
+ .string({
25
+ invalid_type_error: 'filter must be a string',
26
+ description: 'Filter criteria for orders (e.g., orderfulfillmentstatus:{NOT_STARTED|IN_PROGRESS}, creationdate:[2020-01-01T00:00:00.000Z..2020-12-31T23:59:59.999Z])',
27
+ })
28
+ .optional();
29
+ // Reusable schema for limit parameter (number in API)
30
+ const limitSchema = z
31
+ .number({
32
+ invalid_type_error: 'limit must be a number',
33
+ description: 'Maximum number of orders to return (default: 50)',
34
+ })
35
+ .optional();
36
+ // Reusable schema for offset parameter (number in API)
37
+ const offsetSchema = z
38
+ .number({
39
+ invalid_type_error: 'offset must be a number',
40
+ description: 'Number of orders to skip (zero-based index)',
41
+ })
42
+ .optional();
43
+ /**
44
+ * Schema for getOrders method
45
+ * Endpoint: GET /order
46
+ * Query: filter, limit, offset
47
+ */
48
+ export const getOrdersSchema = z.object({
49
+ filter: filterSchema,
50
+ limit: limitSchema,
51
+ offset: offsetSchema,
52
+ });
53
+ /**
54
+ * Schema for getOrder method
55
+ * Endpoint: GET /order/{orderId}
56
+ * Path: orderId (required)
57
+ */
58
+ export const getOrderSchema = z.object({
59
+ order_id: orderIdSchema,
60
+ });
61
+ /**
62
+ * Schema for createShippingFulfillment method
63
+ * Endpoint: POST /order/{orderId}/shipping_fulfillment
64
+ * Path: orderId (required)
65
+ * Body: ShippingFulfillmentDetails - lineItems, shippedDate, shippingCarrierCode, trackingNumber
66
+ */
67
+ export const createShippingFulfillmentSchema = z.object({
68
+ order_id: orderIdSchema,
69
+ line_items: z
70
+ .array(z.object({
71
+ line_item_id: z
72
+ .string({
73
+ invalid_type_error: 'line_item_id must be a string',
74
+ description: 'Unique identifier of the line item',
75
+ })
76
+ .optional(),
77
+ quantity: z
78
+ .number({
79
+ invalid_type_error: 'quantity must be a number',
80
+ description: 'Number of units being fulfilled',
81
+ })
82
+ .optional(),
83
+ }), {
84
+ invalid_type_error: 'line_items must be an array',
85
+ description: 'Array of line items to fulfill (required)',
86
+ })
87
+ .optional(),
88
+ shipped_date: z
89
+ .string({
90
+ invalid_type_error: 'shipped_date must be a string',
91
+ description: 'Date/time the order was shipped (ISO 8601 format, defaults to current time)',
92
+ })
93
+ .optional(),
94
+ shipping_carrier_code: z
95
+ .string({
96
+ invalid_type_error: 'shipping_carrier_code must be a string',
97
+ description: 'Shipping carrier code (e.g., USPS, UPS, FEDEX)',
98
+ })
99
+ .optional(),
100
+ tracking_number: z
101
+ .string({
102
+ invalid_type_error: 'tracking_number must be a string',
103
+ description: 'Shipment tracking number',
104
+ })
105
+ .optional(),
106
+ });
107
+ /**
108
+ * Schema for getShippingFulfillments method
109
+ * Endpoint: GET /order/{orderId}/shipping_fulfillment
110
+ * Path: orderId (required)
111
+ */
112
+ export const getShippingFulfillmentsSchema = z.object({
113
+ order_id: orderIdSchema,
114
+ });
115
+ /**
116
+ * Schema for getShippingFulfillment method
117
+ * Endpoint: GET /order/{orderId}/shipping_fulfillment/{fulfillmentId}
118
+ * Path: orderId (required), fulfillmentId (required)
119
+ */
120
+ export const getShippingFulfillmentSchema = z.object({
121
+ order_id: orderIdSchema,
122
+ fulfillment_id: fulfillmentIdSchema,
123
+ });
124
+ /**
125
+ * Schema for issueRefund method
126
+ * Endpoint: POST /order/{orderId}/issue_refund
127
+ * Path: orderId (required)
128
+ * Body: IssueRefundRequest - reasonForRefund, comment, refundItems, orderLevelRefundAmount
129
+ */
130
+ export const issueRefundSchema = z.object({
131
+ order_id: orderIdSchema,
132
+ reason_for_refund: z
133
+ .string({
134
+ invalid_type_error: 'reason_for_refund must be a string',
135
+ description: 'Reason for issuing the refund (e.g., BUYER_CANCEL, OUT_OF_STOCK)',
136
+ })
137
+ .optional(),
138
+ comment: z
139
+ .string({
140
+ invalid_type_error: 'comment must be a string',
141
+ description: 'Optional comment about the refund',
142
+ })
143
+ .optional(),
144
+ refund_items: z
145
+ .array(z.object({
146
+ line_item_id: z
147
+ .string({
148
+ invalid_type_error: 'line_item_id must be a string',
149
+ description: 'Unique identifier of the line item to refund',
150
+ })
151
+ .optional(),
152
+ refund_amount: z
153
+ .object({
154
+ value: z
155
+ .string({
156
+ invalid_type_error: 'value must be a string',
157
+ description: 'Monetary amount',
158
+ })
159
+ .optional(),
160
+ currency: z
161
+ .string({
162
+ invalid_type_error: 'currency must be a string',
163
+ description: 'Three-letter ISO 4217 currency code',
164
+ })
165
+ .optional(),
166
+ })
167
+ .optional(),
168
+ legacy_reference: z
169
+ .object({
170
+ legacy_item_id: z
171
+ .string({
172
+ invalid_type_error: 'legacy_item_id must be a string',
173
+ description: 'Legacy eBay item ID',
174
+ })
175
+ .optional(),
176
+ legacy_transaction_id: z
177
+ .string({
178
+ invalid_type_error: 'legacy_transaction_id must be a string',
179
+ description: 'Legacy transaction ID',
180
+ })
181
+ .optional(),
182
+ })
183
+ .optional(),
184
+ }), {
185
+ invalid_type_error: 'refund_items must be an array',
186
+ description: 'Array of line items to refund',
187
+ })
188
+ .optional(),
189
+ order_level_refund_amount: z
190
+ .object({
191
+ value: z
192
+ .string({
193
+ invalid_type_error: 'value must be a string',
194
+ description: 'Monetary amount',
195
+ })
196
+ .optional(),
197
+ currency: z
198
+ .string({
199
+ invalid_type_error: 'currency must be a string',
200
+ description: 'Three-letter ISO 4217 currency code',
201
+ })
202
+ .optional(),
203
+ })
204
+ .optional(),
205
+ });
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Zod schemas for Compliance API input validation
4
+ * Based on: src/api/other/compliance.ts
5
+ * OpenAPI spec: docs/sell-apps/other-apis/sell_compliance_v1_oas3.json
6
+ * Types from: src/types/sell_compliance_v1_oas3.ts
7
+ */
8
+ // Reusable schema for compliance_type parameter
9
+ const complianceTypeSchema = z
10
+ .string({
11
+ invalid_type_error: 'compliance_type must be a string',
12
+ description: 'Compliance type(s) to filter violations (e.g., ASPECTS_ADOPTION, HTTPS, OUTSIDE_EBAY_BUYING_AND_SELLING, RETURNS_POLICY)',
13
+ })
14
+ .optional();
15
+ // Reusable schema for offset parameter (string in API)
16
+ const offsetSchema = z
17
+ .string({
18
+ invalid_type_error: 'offset must be a string',
19
+ description: 'Number of items to skip (zero-based index)',
20
+ })
21
+ .optional();
22
+ // Reusable schema for limit parameter (string in API)
23
+ const limitSchema = z
24
+ .string({
25
+ invalid_type_error: 'limit must be a string',
26
+ description: 'Maximum number of items to return (default: 100, max: 200)',
27
+ })
28
+ .optional();
29
+ /**
30
+ * Schema for getListingViolations method
31
+ * Endpoint: GET /listing_violation
32
+ * Query: GetListingViolationsParams - compliance_type (required), offset, limit, listing_id, filter
33
+ */
34
+ export const getListingViolationsSchema = z.object({
35
+ compliance_type: z.string({
36
+ message: 'Compliance type is required',
37
+ required_error: 'compliance_type is required',
38
+ invalid_type_error: 'compliance_type must be a string',
39
+ description: 'The compliance type of violations to retrieve (only one type allowed per call)',
40
+ }),
41
+ offset: offsetSchema,
42
+ limit: limitSchema,
43
+ listing_id: z
44
+ .string({
45
+ invalid_type_error: 'listing_id must be a string',
46
+ description: 'Filter by specific eBay listing ID (not yet supported)',
47
+ })
48
+ .optional(),
49
+ filter: z
50
+ .string({
51
+ invalid_type_error: 'filter must be a string',
52
+ description: 'Filter by compliance state (e.g., complianceState:{OUT_OF_COMPLIANCE})',
53
+ })
54
+ .optional(),
55
+ });
56
+ /**
57
+ * Schema for getListingViolationsSummary method
58
+ * Endpoint: GET /listing_violation_summary
59
+ * Query: GetListingViolationsSummaryParams - compliance_type
60
+ */
61
+ export const getListingViolationsSummarySchema = z.object({
62
+ compliance_type: complianceTypeSchema,
63
+ });
64
+ /**
65
+ * Schema for suppressViolation method
66
+ * Endpoint: POST /suppress_violation
67
+ * Body: listing_violation_id (required)
68
+ */
69
+ export const suppressViolationSchema = z.object({
70
+ listing_violation_id: z.string({
71
+ message: 'Listing violation ID is required',
72
+ required_error: 'listing_violation_id is required',
73
+ invalid_type_error: 'listing_violation_id must be a string',
74
+ description: 'The unique identifier of the listing violation to suppress',
75
+ }),
76
+ });