ebay-mcp 1.13.2 → 1.14.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 (169) hide show
  1. package/README.de.md +3 -3
  2. package/README.es.md +3 -3
  3. package/README.fr.md +3 -3
  4. package/README.ja.md +3 -3
  5. package/README.ko.md +3 -3
  6. package/README.md +163 -41
  7. package/README.pt-BR.md +3 -3
  8. package/README.ru.md +3 -3
  9. package/README.zh-CN.md +3 -3
  10. package/build/api/account-management/account.js +633 -297
  11. package/build/api/analytics-and-report/analytics.js +111 -65
  12. package/build/api/client.js +199 -140
  13. package/build/api/clientRequestError.js +23 -0
  14. package/build/api/clientTrading.js +213 -0
  15. package/build/api/clientTradingError.js +4 -0
  16. package/build/api/communication/feedback.js +147 -59
  17. package/build/api/communication/message.js +134 -81
  18. package/build/api/communication/negotiation.js +65 -53
  19. package/build/api/communication/notification.js +458 -164
  20. package/build/api/developer/developer.js +99 -45
  21. package/build/api/index.js +23 -8
  22. package/build/api/listing-management/inventory.js +884 -338
  23. package/build/api/listing-metadata/metadata.js +416 -170
  24. package/build/api/listing-metadata/taxonomy.js +187 -42
  25. package/build/api/marketing-and-promotions/marketing.js +1392 -598
  26. package/build/api/marketing-and-promotions/recommendation.js +49 -24
  27. package/build/api/order-management/dispute.js +226 -45
  28. package/build/api/order-management/fulfillment.js +144 -71
  29. package/build/api/order-management/orderIssueHelpers.js +61 -0
  30. package/build/api/other/compliance.js +50 -38
  31. package/build/api/other/edelivery.js +603 -159
  32. package/build/api/other/finding.js +280 -0
  33. package/build/api/other/identity.js +30 -15
  34. package/build/api/other/translation.js +29 -14
  35. package/build/api/other/vero.js +113 -27
  36. package/build/api/rateLimitTracker.js +55 -0
  37. package/build/api/shared/request.js +189 -98
  38. package/build/api/trading/trading.js +154 -87
  39. package/build/auth/credentialSession.js +250 -0
  40. package/build/auth/oauth.js +298 -171
  41. package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
  42. package/build/auth/oauthMiddleware.js +104 -0
  43. package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
  44. package/build/auth/tokenVerifier.js +243 -0
  45. package/build/auth/tokenVerifierError.js +21 -0
  46. package/build/config/environment.js +148 -113
  47. package/build/config/{tool-families.js → toolFamilies.js} +30 -14
  48. package/build/index.js +25 -19
  49. package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
  50. package/build/mcp/readOnlyFilter.js +67 -0
  51. package/build/mcp/runtime.js +31 -13
  52. package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
  53. package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
  54. package/build/schemas/account-management/account.js +144 -6
  55. package/build/schemas/analytics/analytics.js +33 -19
  56. package/build/schemas/communication/messages.js +12 -42
  57. package/build/schemas/developer/developer.js +135 -0
  58. package/build/schemas/fulfillment/orders.js +183 -21
  59. package/build/schemas/index.js +27 -19
  60. package/build/schemas/inventory-management/inventory.js +17 -9
  61. package/build/schemas/marketing/marketing.js +480 -25
  62. package/build/schemas/metadata/metadata.js +11 -6
  63. package/build/schemas/other/finding.js +27 -0
  64. package/build/schemas/other/otherApis.js +424 -0
  65. package/build/schemas/taxonomy/taxonomy.js +11 -5
  66. package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
  67. package/build/scripts/{build-ui.js → buildUi.js} +6 -1
  68. package/build/scripts/{dev-sync.js → devSync.js} +169 -110
  69. package/build/scripts/diagnostics.js +52 -44
  70. package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
  71. package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
  72. package/build/scripts/setup.js +241 -178
  73. package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
  74. package/build/scripts/skills.js +35 -27
  75. package/build/scripts/updateApiStatusDoc.js +71 -0
  76. package/build/serverHttp.js +90 -0
  77. package/build/skills/content.js +124 -118
  78. package/build/skills/index.js +22 -10
  79. package/build/skills/install.js +21 -10
  80. package/build/skills/markers.js +50 -15
  81. package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
  82. package/build/skills/render.js +41 -14
  83. package/build/skills/targets.js +49 -17
  84. package/build/tools/categories/account.js +166 -264
  85. package/build/tools/categories/analytics.js +11 -22
  86. package/build/tools/categories/browse.js +17 -0
  87. package/build/tools/categories/communication.js +124 -399
  88. package/build/tools/categories/connector.js +23 -20
  89. package/build/tools/categories/developer.js +46 -159
  90. package/build/tools/categories/fulfillment.js +84 -215
  91. package/build/tools/categories/index.js +6 -14
  92. package/build/tools/categories/inventory.js +238 -293
  93. package/build/tools/categories/marketing.js +677 -39
  94. package/build/tools/categories/metadata.js +190 -117
  95. package/build/tools/categories/other.js +81 -208
  96. package/build/tools/categories/taxonomy.js +29 -20
  97. package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
  98. package/build/tools/categories/trading.js +16 -47
  99. package/build/tools/contracts.js +34 -24
  100. package/build/tools/{define-tool.js → defineTool.js} +44 -29
  101. package/build/tools/registry.js +87 -29
  102. package/build/tools/schemas.js +3 -57
  103. package/build/tools/ui/archetypes.js +1 -0
  104. package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
  105. package/build/tools/ui/maps.js +294 -80
  106. package/build/types/index.js +1 -1
  107. package/build/ui/card.html +14 -14
  108. package/build/ui/chart.html +14 -14
  109. package/build/ui/stat.html +87 -0
  110. package/build/ui/table.html +14 -14
  111. package/build/utils/apiStatusFeed.js +95 -0
  112. package/build/utils/cliOutput.js +15 -0
  113. package/build/utils/cliUi.js +108 -0
  114. package/build/utils/communication/feedback.js +57 -77
  115. package/build/utils/communication/message.js +69 -98
  116. package/build/utils/communication/negotiation.js +30 -57
  117. package/build/utils/communication/notification.js +112 -252
  118. package/build/utils/{date-converter.js → dateConverter.js} +62 -30
  119. package/build/utils/effectSchema.js +203 -0
  120. package/build/utils/effectSchemaAdapter.js +121 -0
  121. package/build/utils/effectSchemaChainMethods.js +146 -0
  122. package/build/utils/effectSchemaRefinements.js +104 -0
  123. package/build/utils/effectSchemaStringMethods.js +63 -0
  124. package/build/utils/effectSchemaTypes.js +47 -0
  125. package/build/utils/{env-parser.js → envParser.js} +10 -2
  126. package/build/utils/errors.js +7 -3
  127. package/build/utils/http.js +148 -89
  128. package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
  129. package/build/utils/logger.js +127 -51
  130. package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
  131. package/build/utils/other/compliance.js +18 -38
  132. package/build/utils/other/identity.js +2 -2
  133. package/build/utils/other/translation.js +4 -4
  134. package/build/utils/other/vero.js +36 -20
  135. package/build/utils/schemaHelpers.js +22 -0
  136. package/build/utils/scopeHelper.js +270 -0
  137. package/build/utils/securityChecker.js +316 -0
  138. package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
  139. package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
  140. package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
  141. package/build/utils/trading/trading.js +35 -0
  142. package/build/utils/typeGuards.js +12 -0
  143. package/build/utils/version.js +65 -29
  144. package/package.json +10 -8
  145. package/build/api/client-trading.js +0 -124
  146. package/build/api/communication/shared.js +0 -59
  147. package/build/api/shared/query-params.js +0 -16
  148. package/build/auth/credential-session.js +0 -166
  149. package/build/auth/oauth-middleware.js +0 -100
  150. package/build/auth/token-verifier.js +0 -186
  151. package/build/schemas/other/other-apis.js +0 -390
  152. package/build/scripts/update-api-status-doc.js +0 -44
  153. package/build/server-http.js +0 -85
  154. package/build/tools/definitions/marketing.js +0 -1381
  155. package/build/tools/tool-handlers/marketing.js +0 -312
  156. package/build/utils/account-management/account.js +0 -818
  157. package/build/utils/api-status-feed.js +0 -84
  158. package/build/utils/cli-ui.js +0 -47
  159. package/build/utils/order-management/dispute.js +0 -369
  160. package/build/utils/order-management/fulfillment.js +0 -205
  161. package/build/utils/other/edelivery.js +0 -235
  162. package/build/utils/schema-helpers.js +0 -13
  163. package/build/utils/scope-helper.js +0 -207
  164. package/build/utils/security-checker.js +0 -248
  165. package/build/utils/type-guards.js +0 -6
  166. /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
  167. /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
  168. /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
  169. /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
@@ -1,8 +1,6 @@
1
- import { withApiError } from '../../api/shared/request.js';
2
- /**
3
- * eDelivery API - International shipping eDelivery
4
- * Based on: docs/sell-apps/other-apis/sell_edelivery_international_shipping_oas3.json
5
- */
1
+ import { buildEndpointParams, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, optionalStringEffect, requestDeleteEffect, requestGetEffect, requestPostEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
2
+ import { Effect } from 'effect';
3
+ /** eDelivery International Shipping API endpoints. */
6
4
  export class EDeliveryApi {
7
5
  client;
8
6
  basePath = '/sell/logistics/v1';
@@ -10,211 +8,657 @@ export class EDeliveryApi {
10
8
  this.client = client;
11
9
  }
12
10
  /**
13
- * Create shipping quote
11
+ * Retrieves actual package weights and costs by tracking numbers or transaction time range.
12
+ *
13
+ * @param input - Optional tracking-number or transaction-time filters.
14
+ * @returns An Effect that succeeds with eBay's GetActualCostResponses.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const costs = await Effect.runPromise(
19
+ * edeliveryApi.getActualCosts({ trackingNumbers: 'ES000000001' }),
20
+ * );
21
+ * ```
22
+ *
23
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/actual_costs/methods/getActualCosts
14
24
  */
15
- async createShippingQuote(shippingQuoteRequest) {
16
- return await withApiError('Failed to create shipping quote', () => this.client.post(`${this.basePath}/shipping_quote`, shippingQuoteRequest));
17
- }
25
+ getActualCosts = (input = {}) => {
26
+ const client = this.client;
27
+ const path = `${this.basePath}/actual_costs`;
28
+ return Effect.gen(function* () {
29
+ const validatedInput = yield* requireObjectEffect(input, 'input');
30
+ const trackingNumbers = yield* optionalStringEffect(validatedInput.trackingNumbers, 'trackingNumbers');
31
+ const transactionBeginTime = yield* optionalStringEffect(validatedInput.transactionBeginTime, 'transactionBeginTime');
32
+ const transactionEndTime = yield* optionalStringEffect(validatedInput.transactionEndTime, 'transactionEndTime');
33
+ const params = buildEndpointParams({
34
+ trackingNumbers: { wireName: 'tracking_numbers', value: trackingNumbers },
35
+ transactionBeginTime: { wireName: 'trans_begin_time', value: transactionBeginTime },
36
+ transactionEndTime: { wireName: 'trans_end_time', value: transactionEndTime },
37
+ });
38
+ return yield* requestGetEffect(client, path, params);
39
+ });
40
+ };
18
41
  /**
19
- * Get shipping quote
42
+ * Retrieves saved ship-from address preferences.
43
+ *
44
+ * @param input - Empty endpoint input object.
45
+ * @returns An Effect that succeeds with eBay's GetAddressPreferenceListResponses.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const preferences = await Effect.runPromise(edeliveryApi.getAddressPreferences({}));
50
+ * ```
51
+ *
52
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/address_preference/methods/getAddressPreferences
20
53
  */
21
- async getShippingQuote(shippingQuoteId) {
22
- return await withApiError('Failed to get shipping quote', () => this.client.get(`${this.basePath}/shipping_quote/${shippingQuoteId}`));
23
- }
24
- // ==================== Cost & Preferences ====================
54
+ getAddressPreferences = (input = {}) => {
55
+ void input;
56
+ return requestGetEffect(this.client, `${this.basePath}/address_preference`);
57
+ };
25
58
  /**
26
- * Get actual costs for shipped packages
27
- * Endpoint: GET /actual_costs
59
+ * Creates a ship-from address preference.
60
+ *
61
+ * @param input - Generated CreateAddressPreferenceRequest body.
62
+ * @returns An Effect that succeeds with eBay's CreateAddressPreferenceResponses.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const address = await Effect.runPromise(
67
+ * edeliveryApi.createAddressPreference({ body: { shipFromAddress: {} } }),
68
+ * );
69
+ * ```
70
+ *
71
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/address_preference/methods/createAddressPreference
28
72
  */
29
- async getActualCosts(params) {
30
- return await withApiError('Failed to get actual costs', () => this.client.get(`${this.basePath}/actual_costs`, params));
31
- }
73
+ createAddressPreference = (input) => {
74
+ const client = this.client;
75
+ const path = `${this.basePath}/address_preference`;
76
+ return Effect.gen(function* () {
77
+ const validatedInput = yield* requireObjectEffect(input, 'input');
78
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
79
+ return yield* requestPostEffect(client, path, body);
80
+ });
81
+ };
32
82
  /**
33
- * Get address preferences
34
- * Endpoint: GET /address_preference
83
+ * Retrieves saved consign preferences.
84
+ *
85
+ * @param input - Empty endpoint input object.
86
+ * @returns An Effect that succeeds with eBay's GetConsignPreferenceListResponses.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const preferences = await Effect.runPromise(edeliveryApi.getConsignPreferences({}));
91
+ * ```
92
+ *
93
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/consign_preference/methods/getConsignPreferences
35
94
  */
36
- async getAddressPreferences() {
37
- return await withApiError('Failed to get address preferences', () => this.client.get(`${this.basePath}/address_preference`));
38
- }
95
+ getConsignPreferences = (input = {}) => {
96
+ void input;
97
+ return requestGetEffect(this.client, `${this.basePath}/consign_preference`);
98
+ };
39
99
  /**
40
- * Create address preference
41
- * Endpoint: POST /address_preference
100
+ * Creates a consign preference.
101
+ *
102
+ * @param input - Generated CreateConsignPreferenceRequest body.
103
+ * @returns An Effect that succeeds with eBay's CreateConsignPreferenceResponses.
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * const preference = await Effect.runPromise(
108
+ * edeliveryApi.createConsignPreference({ body: { consignAddress: {} } }),
109
+ * );
110
+ * ```
111
+ *
112
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/consign_preference/methods/createConsignPreference
42
113
  */
43
- async createAddressPreference(addressPreference) {
44
- return await withApiError('Failed to create address preference', () => this.client.post(`${this.basePath}/address_preference`, addressPreference));
45
- }
114
+ createConsignPreference = (input) => {
115
+ const client = this.client;
116
+ const path = `${this.basePath}/consign_preference`;
117
+ return Effect.gen(function* () {
118
+ const validatedInput = yield* requireObjectEffect(input, 'input');
119
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
120
+ return yield* requestPostEffect(client, path, body);
121
+ });
122
+ };
46
123
  /**
47
- * Get consign preferences
48
- * Endpoint: GET /consign_preference
124
+ * Retrieves available shipping agents.
125
+ *
126
+ * @param input - Optional pagination controls.
127
+ * @returns An Effect that succeeds with eBay's GetAgentListResponses.
128
+ *
129
+ * @example
130
+ * ```ts
131
+ * const agents = await Effect.runPromise(edeliveryApi.getAgents({ limit: 50 }));
132
+ * ```
133
+ *
134
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/agents/methods/getAgents
49
135
  */
50
- async getConsignPreferences() {
51
- return await withApiError('Failed to get consign preferences', () => this.client.get(`${this.basePath}/consign_preference`));
52
- }
136
+ getAgents = (input = {}) => {
137
+ const client = this.client;
138
+ const path = `${this.basePath}/agents`;
139
+ return Effect.gen(function* () {
140
+ const validatedInput = yield* requireObjectEffect(input, 'input');
141
+ const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
142
+ const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
143
+ const params = buildEndpointParams({
144
+ limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
145
+ offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
146
+ });
147
+ return yield* requestGetEffect(client, path, params);
148
+ });
149
+ };
53
150
  /**
54
- * Create consign preference
55
- * Endpoint: POST /consign_preference
151
+ * Retrieves available lithium battery qualifications.
152
+ *
153
+ * @param input - Optional pagination controls.
154
+ * @returns An Effect that succeeds with eBay's GetBatteryQualListResponses.
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * const qualifications = await Effect.runPromise(
159
+ * edeliveryApi.getBatteryQualifications({ limit: 25 }),
160
+ * );
161
+ * ```
162
+ *
163
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/battery_qualifications/methods/getBatteryQualifications
56
164
  */
57
- async createConsignPreference(consignPreference) {
58
- return await withApiError('Failed to create consign preference', () => this.client.post(`${this.basePath}/consign_preference`, consignPreference));
59
- }
60
- // ==================== Agents & Services ====================
165
+ getBatteryQualifications = (input = {}) => {
166
+ const client = this.client;
167
+ const path = `${this.basePath}/battery_qualifications`;
168
+ return Effect.gen(function* () {
169
+ const validatedInput = yield* requireObjectEffect(input, 'input');
170
+ const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
171
+ const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
172
+ const params = buildEndpointParams({
173
+ limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
174
+ offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
175
+ });
176
+ return yield* requestGetEffect(client, path, params);
177
+ });
178
+ };
61
179
  /**
62
- * Get available shipping agents
63
- * Endpoint: GET /agents
180
+ * Retrieves available drop-off sites.
181
+ *
182
+ * @param input - Optional pagination controls.
183
+ * @returns An Effect that succeeds with eBay's GetDropoffSiteListResponses.
184
+ *
185
+ * @example
186
+ * ```ts
187
+ * const sites = await Effect.runPromise(edeliveryApi.getDropoffSites({ offset: 10 }));
188
+ * ```
189
+ *
190
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/dropoff_sites/methods/getDropoffSites
64
191
  */
65
- async getAgents(params) {
66
- return await withApiError('Failed to get agents', () => this.client.get(`${this.basePath}/agents`, params));
67
- }
192
+ getDropoffSites = (input = {}) => {
193
+ const client = this.client;
194
+ const path = `${this.basePath}/dropoff_sites`;
195
+ return Effect.gen(function* () {
196
+ const validatedInput = yield* requireObjectEffect(input, 'input');
197
+ const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
198
+ const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
199
+ const params = buildEndpointParams({
200
+ limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
201
+ offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
202
+ });
203
+ return yield* requestGetEffect(client, path, params);
204
+ });
205
+ };
68
206
  /**
69
- * Get battery qualifications
70
- * Endpoint: GET /battery_qualifications
207
+ * Retrieves available shipping services.
208
+ *
209
+ * @param input - Optional pagination controls.
210
+ * @returns An Effect that succeeds with eBay's GetServiceListResponses.
211
+ *
212
+ * @example
213
+ * ```ts
214
+ * const services = await Effect.runPromise(edeliveryApi.getServices({ limit: 25 }));
215
+ * ```
216
+ *
217
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/services/methods/getServices
71
218
  */
72
- async getBatteryQualifications(params) {
73
- return await withApiError('Failed to get battery qualifications', () => this.client.get(`${this.basePath}/battery_qualifications`, params));
74
- }
219
+ getServices = (input = {}) => {
220
+ const client = this.client;
221
+ const path = `${this.basePath}/services`;
222
+ return Effect.gen(function* () {
223
+ const validatedInput = yield* requireObjectEffect(input, 'input');
224
+ const limit = yield* optionalPositiveNumberEffect(validatedInput.limit, 'limit');
225
+ const offset = yield* optionalNonNegativeNumberEffect(validatedInput.offset, 'offset');
226
+ const params = buildEndpointParams({
227
+ limit: { wireName: 'limit', value: limit === undefined ? undefined : String(limit) },
228
+ offset: { wireName: 'offset', value: offset === undefined ? undefined : String(offset) },
229
+ });
230
+ return yield* requestGetEffect(client, path, params);
231
+ });
232
+ };
75
233
  /**
76
- * Get dropoff sites
77
- * Endpoint: GET /dropoff_sites
234
+ * Creates a bundle from package tracking numbers.
235
+ *
236
+ * @param input - Generated CreateBundleRequest body.
237
+ * @returns An Effect that succeeds with eBay's CreateBundleResponse.
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * const bundle = await Effect.runPromise(
242
+ * edeliveryApi.createBundle({ body: { bundle: { trackingNumbers: 'ES000000001' } } }),
243
+ * );
244
+ * ```
245
+ *
246
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/createBundle
78
247
  */
79
- async getDropoffSites(params) {
80
- return await withApiError('Failed to get dropoff sites', () => this.client.get(`${this.basePath}/dropoff_sites`, params));
81
- }
248
+ createBundle = (input) => {
249
+ const client = this.client;
250
+ const path = `${this.basePath}/bundle`;
251
+ return Effect.gen(function* () {
252
+ const validatedInput = yield* requireObjectEffect(input, 'input');
253
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
254
+ return yield* requestPostEffect(client, path, body);
255
+ });
256
+ };
82
257
  /**
83
- * Get available shipping services
84
- * Endpoint: GET /services
258
+ * Retrieves a bundle by ID.
259
+ *
260
+ * @param input - Bundle identifier.
261
+ * @returns An Effect that succeeds with eBay's BundleDetailResponse.
262
+ *
263
+ * @example
264
+ * ```ts
265
+ * const bundle = await Effect.runPromise(edeliveryApi.getBundle({ bundleId: 'BUNDLE123' }));
266
+ * ```
267
+ *
268
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/getBundle
85
269
  */
86
- async getShippingServices(params) {
87
- return await withApiError('Failed to get shipping services', () => this.client.get(`${this.basePath}/services`, params));
88
- }
89
- // ==================== Bundles ====================
270
+ getBundle = (input) => {
271
+ const client = this.client;
272
+ const basePath = this.basePath;
273
+ return Effect.gen(function* () {
274
+ const validatedInput = yield* requireObjectEffect(input, 'input');
275
+ const bundleId = yield* requireStringEffect(validatedInput.bundleId, 'bundleId');
276
+ return yield* requestGetEffect(client, `${basePath}/bundle/${bundleId}`);
277
+ });
278
+ };
90
279
  /**
91
- * Create a bundle of packages
92
- * Endpoint: POST /bundle
280
+ * Cancels a bundle by ID.
281
+ *
282
+ * @param input - Bundle identifier.
283
+ * @returns An Effect that succeeds when eBay returns no content.
284
+ *
285
+ * @example
286
+ * ```ts
287
+ * await Effect.runPromise(edeliveryApi.cancelBundle({ bundleId: 'BUNDLE123' }));
288
+ * ```
289
+ *
290
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/cancelBundle
93
291
  */
94
- async createBundle(bundleRequest) {
95
- return await withApiError('Failed to create bundle', () => this.client.post(`${this.basePath}/bundle`, bundleRequest));
96
- }
292
+ cancelBundle = (input) => {
293
+ const client = this.client;
294
+ const basePath = this.basePath;
295
+ return Effect.gen(function* () {
296
+ const validatedInput = yield* requireObjectEffect(input, 'input');
297
+ const bundleId = yield* requireStringEffect(validatedInput.bundleId, 'bundleId');
298
+ return yield* requestPostEffect(client, `${basePath}/bundle/${bundleId}/cancel`);
299
+ });
300
+ };
97
301
  /**
98
- * Get bundle by ID
99
- * Endpoint: GET /bundle/{bundle_id}
302
+ * Retrieves the label for a bundle.
303
+ *
304
+ * @param input - Bundle identifier.
305
+ * @returns An Effect that succeeds with eBay's BundleLabelResponse.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * const label = await Effect.runPromise(edeliveryApi.getBundleLabel({ bundleId: 'BUNDLE123' }));
310
+ * ```
311
+ *
312
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/bundle/methods/getBundleLabel
100
313
  */
101
- async getBundle(bundleId) {
102
- return await withApiError('Failed to get bundle', () => this.client.get(`${this.basePath}/bundle/${bundleId}`));
103
- }
314
+ getBundleLabel = (input) => {
315
+ const client = this.client;
316
+ const basePath = this.basePath;
317
+ return Effect.gen(function* () {
318
+ const validatedInput = yield* requireObjectEffect(input, 'input');
319
+ const bundleId = yield* requireStringEffect(validatedInput.bundleId, 'bundleId');
320
+ return yield* requestGetEffect(client, `${basePath}/bundle/${bundleId}/label`);
321
+ });
322
+ };
104
323
  /**
105
- * Cancel a bundle
106
- * Endpoint: POST /bundle/{bundle_id}/cancel
324
+ * Creates a package.
325
+ *
326
+ * @param input - Generated AddPackageRequest body.
327
+ * @returns An Effect that succeeds with eBay's AddPackageResponses.
328
+ *
329
+ * @example
330
+ * ```ts
331
+ * const createdPackage = await Effect.runPromise(
332
+ * edeliveryApi.createPackage({ body: { packageInfo: {} } }),
333
+ * );
334
+ * ```
335
+ *
336
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/createPackage
107
337
  */
108
- async cancelBundle(bundleId) {
109
- return await withApiError('Failed to cancel bundle', () => this.client.post(`${this.basePath}/bundle/${bundleId}/cancel`, {}));
110
- }
338
+ createPackage = (input) => {
339
+ const client = this.client;
340
+ const path = `${this.basePath}/package`;
341
+ return Effect.gen(function* () {
342
+ const validatedInput = yield* requireObjectEffect(input, 'input');
343
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
344
+ return yield* requestPostEffect(client, path, body);
345
+ });
346
+ };
111
347
  /**
112
- * Get bundle label
113
- * Endpoint: GET /bundle/{bundle_id}/label
348
+ * Retrieves a package by ID.
349
+ *
350
+ * @param input - Package identifier.
351
+ * @returns An Effect that succeeds with eBay's GetPackageDetailResponses.
352
+ *
353
+ * @example
354
+ * ```ts
355
+ * const packageDetail = await Effect.runPromise(
356
+ * edeliveryApi.getPackage({ packageId: 'PKG123' }),
357
+ * );
358
+ * ```
359
+ *
360
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/getPackage
114
361
  */
115
- async getBundleLabel(bundleId) {
116
- return await withApiError('Failed to get bundle label', () => this.client.get(`${this.basePath}/bundle/${bundleId}/label`));
117
- }
118
- // ==================== Packages (Single) ====================
362
+ getPackage = (input) => {
363
+ const client = this.client;
364
+ const basePath = this.basePath;
365
+ return Effect.gen(function* () {
366
+ const validatedInput = yield* requireObjectEffect(input, 'input');
367
+ const packageId = yield* requireStringEffect(validatedInput.packageId, 'packageId');
368
+ return yield* requestGetEffect(client, `${basePath}/package/${packageId}`);
369
+ });
370
+ };
119
371
  /**
120
- * Create a package
121
- * Endpoint: POST /package
372
+ * Deletes a package by ID.
373
+ *
374
+ * @param input - Package identifier.
375
+ * @returns An Effect that succeeds when eBay returns no content.
376
+ *
377
+ * @example
378
+ * ```ts
379
+ * await Effect.runPromise(edeliveryApi.deletePackage({ packageId: 'PKG123' }));
380
+ * ```
381
+ *
382
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/deletePackage
122
383
  */
123
- async createPackage(packageRequest) {
124
- return await withApiError('Failed to create package', () => this.client.post(`${this.basePath}/package`, packageRequest));
125
- }
384
+ deletePackage = (input) => {
385
+ const client = this.client;
386
+ const basePath = this.basePath;
387
+ return Effect.gen(function* () {
388
+ const validatedInput = yield* requireObjectEffect(input, 'input');
389
+ const packageId = yield* requireStringEffect(validatedInput.packageId, 'packageId');
390
+ return yield* requestDeleteEffect(client, `${basePath}/package/${packageId}`);
391
+ });
392
+ };
126
393
  /**
127
- * Get package by ID
128
- * Endpoint: GET /package/{package_id}
394
+ * Retrieves packages by fulfillment order line item ID.
395
+ *
396
+ * @param input - Fulfillment order line item identifier.
397
+ * @returns An Effect that succeeds with eBay's GetItemPackageIdResponses.
398
+ *
399
+ * @example
400
+ * ```ts
401
+ * const packages = await Effect.runPromise(
402
+ * edeliveryApi.getPackagesByLineItemId({ orderLineItemId: 'LINE123' }),
403
+ * );
404
+ * ```
405
+ *
406
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/getPackagesByLineItemID
129
407
  */
130
- async getPackage(packageId) {
131
- return await withApiError('Failed to get package', () => this.client.get(`${this.basePath}/package/${packageId}`));
132
- }
408
+ getPackagesByLineItemId = (input) => {
409
+ const client = this.client;
410
+ const basePath = this.basePath;
411
+ return Effect.gen(function* () {
412
+ const validatedInput = yield* requireObjectEffect(input, 'input');
413
+ const orderLineItemId = yield* requireStringEffect(validatedInput.orderLineItemId, 'orderLineItemId');
414
+ return yield* requestGetEffect(client, `${basePath}/package/${orderLineItemId}/item`);
415
+ });
416
+ };
133
417
  /**
134
- * Delete a package
135
- * Endpoint: DELETE /package/{package_id}
418
+ * Cancels a package by ID.
419
+ *
420
+ * @param input - Package identifier.
421
+ * @returns An Effect that succeeds when eBay returns no content.
422
+ *
423
+ * @example
424
+ * ```ts
425
+ * await Effect.runPromise(edeliveryApi.cancelPackage({ packageId: 'PKG123' }));
426
+ * ```
427
+ *
428
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/cancelPackage
136
429
  */
137
- async deletePackage(packageId) {
138
- return await withApiError('Failed to delete package', () => this.client.delete(`${this.basePath}/package/${packageId}`));
139
- }
140
- /**
141
- * Get package by order line item
142
- * Endpoint: GET /package/{order_line_item_id}/item
143
- */
144
- async getPackageByOrderLineItem(orderLineItemId) {
145
- return await withApiError('Failed to get package by order line item', () => this.client.get(`${this.basePath}/package/${orderLineItemId}/item`));
146
- }
430
+ cancelPackage = (input) => {
431
+ const client = this.client;
432
+ const basePath = this.basePath;
433
+ return Effect.gen(function* () {
434
+ const validatedInput = yield* requireObjectEffect(input, 'input');
435
+ const packageId = yield* requireStringEffect(validatedInput.packageId, 'packageId');
436
+ return yield* requestPostEffect(client, `${basePath}/package/${packageId}/cancel`);
437
+ });
438
+ };
147
439
  /**
148
- * Cancel a package
149
- * Endpoint: POST /package/{package_id}/cancel
440
+ * Clones a package by ID.
441
+ *
442
+ * @param input - Package identifier.
443
+ * @returns An Effect that succeeds with eBay's ClonePackageResponses.
444
+ *
445
+ * @example
446
+ * ```ts
447
+ * const clone = await Effect.runPromise(edeliveryApi.clonePackage({ packageId: 'PKG123' }));
448
+ * ```
449
+ *
450
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/clonePackage
150
451
  */
151
- async cancelPackage(packageId) {
152
- return await withApiError('Failed to cancel package', () => this.client.post(`${this.basePath}/package/${packageId}/cancel`, {}));
153
- }
154
- /**
155
- * Clone a package
156
- * Endpoint: POST /package/{package_id}/clone
157
- */
158
- async clonePackage(packageId) {
159
- return await withApiError('Failed to clone package', () => this.client.post(`${this.basePath}/package/${packageId}/clone`, {}));
160
- }
452
+ clonePackage = (input) => {
453
+ const client = this.client;
454
+ const basePath = this.basePath;
455
+ return Effect.gen(function* () {
456
+ const validatedInput = yield* requireObjectEffect(input, 'input');
457
+ const packageId = yield* requireStringEffect(validatedInput.packageId, 'packageId');
458
+ return yield* requestPostEffect(client, `${basePath}/package/${packageId}/clone`);
459
+ });
460
+ };
161
461
  /**
162
- * Confirm a package
163
- * Endpoint: POST /package/{package_id}/confirm
462
+ * Confirms a package by ID.
463
+ *
464
+ * @param input - Package identifier.
465
+ * @returns An Effect that succeeds when eBay returns no content.
466
+ *
467
+ * @example
468
+ * ```ts
469
+ * await Effect.runPromise(edeliveryApi.confirmPackage({ packageId: 'PKG123' }));
470
+ * ```
471
+ *
472
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/confirmPackage
164
473
  */
165
- async confirmPackage(packageId) {
166
- return await withApiError('Failed to confirm package', () => this.client.post(`${this.basePath}/package/${packageId}/confirm`, {}));
167
- }
168
- // ==================== Packages (Bulk) ====================
474
+ confirmPackage = (input) => {
475
+ const client = this.client;
476
+ const basePath = this.basePath;
477
+ return Effect.gen(function* () {
478
+ const validatedInput = yield* requireObjectEffect(input, 'input');
479
+ const packageId = yield* requireStringEffect(validatedInput.packageId, 'packageId');
480
+ return yield* requestPostEffect(client, `${basePath}/package/${packageId}/confirm`);
481
+ });
482
+ };
169
483
  /**
170
- * Bulk cancel packages
171
- * Endpoint: POST /package/bulk_cancel_packages
484
+ * Cancels multiple packages.
485
+ *
486
+ * @param input - Generated CancelPackagesRequest body.
487
+ * @returns An Effect that succeeds with eBay's CancelPackagesResponses.
488
+ *
489
+ * @example
490
+ * ```ts
491
+ * const response = await Effect.runPromise(
492
+ * edeliveryApi.bulkCancelPackages({ body: { requests: { packageIds: 'PKG123' } } }),
493
+ * );
494
+ * ```
495
+ *
496
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/bulkCancelPackages
172
497
  */
173
- async bulkCancelPackages(bulkCancelRequest) {
174
- return await withApiError('Failed to bulk cancel packages', () => this.client.post(`${this.basePath}/package/bulk_cancel_packages`, bulkCancelRequest));
175
- }
498
+ bulkCancelPackages = (input) => {
499
+ const client = this.client;
500
+ const path = `${this.basePath}/package/bulk_cancel_packages`;
501
+ return Effect.gen(function* () {
502
+ const validatedInput = yield* requireObjectEffect(input, 'input');
503
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
504
+ return yield* requestPostEffect(client, path, body);
505
+ });
506
+ };
176
507
  /**
177
- * Bulk confirm packages
178
- * Endpoint: POST /package/bulk_confirm_packages
508
+ * Confirms multiple packages.
509
+ *
510
+ * @param input - Generated ConfirmPackagesRequest body.
511
+ * @returns An Effect that succeeds with eBay's ConfirmPackagesResponses.
512
+ *
513
+ * @example
514
+ * ```ts
515
+ * const response = await Effect.runPromise(
516
+ * edeliveryApi.bulkConfirmPackages({ body: { requests: { packageIds: 'PKG123' } } }),
517
+ * );
518
+ * ```
519
+ *
520
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/bulkConfirmPackages
179
521
  */
180
- async bulkConfirmPackages(bulkConfirmRequest) {
181
- return await withApiError('Failed to bulk confirm packages', () => this.client.post(`${this.basePath}/package/bulk_confirm_packages`, bulkConfirmRequest));
182
- }
522
+ bulkConfirmPackages = (input) => {
523
+ const client = this.client;
524
+ const path = `${this.basePath}/package/bulk_confirm_packages`;
525
+ return Effect.gen(function* () {
526
+ const validatedInput = yield* requireObjectEffect(input, 'input');
527
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
528
+ return yield* requestPostEffect(client, path, body);
529
+ });
530
+ };
183
531
  /**
184
- * Bulk delete packages
185
- * Endpoint: POST /package/bulk_delete_packages
532
+ * Deletes multiple packages.
533
+ *
534
+ * @param input - Generated DeletePackagesRequest body.
535
+ * @returns An Effect that succeeds with eBay's DeletePackagesResponses.
536
+ *
537
+ * @example
538
+ * ```ts
539
+ * const response = await Effect.runPromise(
540
+ * edeliveryApi.bulkDeletePackages({ body: { requests: { packageIds: 'PKG123' } } }),
541
+ * );
542
+ * ```
543
+ *
544
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/package/methods/bulkDeletePackages
186
545
  */
187
- async bulkDeletePackages(bulkDeleteRequest) {
188
- return await withApiError('Failed to bulk delete packages', () => this.client.post(`${this.basePath}/package/bulk_delete_packages`, bulkDeleteRequest));
189
- }
190
- // ==================== Labels & Tracking ====================
546
+ bulkDeletePackages = (input) => {
547
+ const client = this.client;
548
+ const path = `${this.basePath}/package/bulk_delete_packages`;
549
+ return Effect.gen(function* () {
550
+ const validatedInput = yield* requireObjectEffect(input, 'input');
551
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
552
+ return yield* requestPostEffect(client, path, body);
553
+ });
554
+ };
191
555
  /**
192
- * Get labels
193
- * Endpoint: GET /labels
556
+ * Retrieves labels by tracking numbers.
557
+ *
558
+ * @param input - Required tracking numbers and optional label formatting preferences.
559
+ * @returns An Effect that succeeds with eBay's GetLabelListResponses.
560
+ *
561
+ * @example
562
+ * ```ts
563
+ * const labels = await Effect.runPromise(
564
+ * edeliveryApi.getLabels({ trackingNumbers: 'ES000000001', pageSize: 'A4' }),
565
+ * );
566
+ * ```
567
+ *
568
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/labels/methods/getLabels
194
569
  */
195
- async getLabels(params) {
196
- return await withApiError('Failed to get labels', () => this.client.get(`${this.basePath}/labels`, params));
197
- }
570
+ getLabels = (input) => {
571
+ const client = this.client;
572
+ const path = `${this.basePath}/labels`;
573
+ return Effect.gen(function* () {
574
+ const validatedInput = yield* requireObjectEffect(input, 'input');
575
+ const trackingNumbers = yield* requireStringEffect(validatedInput.trackingNumbers, 'trackingNumbers');
576
+ const pageSize = yield* optionalStringEffect(validatedInput.pageSize, 'pageSize');
577
+ const printPreference = yield* optionalStringEffect(validatedInput.printPreference, 'printPreference');
578
+ const params = buildEndpointParams({
579
+ pageSize: { wireName: 'page_size', value: pageSize },
580
+ printPreference: { wireName: 'print_preference', value: printPreference },
581
+ trackingNumbers: { wireName: 'tracking_numbers', value: trackingNumbers },
582
+ });
583
+ return yield* requestGetEffect(client, path, params);
584
+ });
585
+ };
198
586
  /**
199
- * Get handover sheet
200
- * Endpoint: GET /handover_sheet
587
+ * Retrieves a handover sheet by tracking numbers.
588
+ *
589
+ * @param input - Required tracking numbers.
590
+ * @returns An Effect that succeeds with eBay's GetHandoverSheetResponses.
591
+ *
592
+ * @example
593
+ * ```ts
594
+ * const sheet = await Effect.runPromise(
595
+ * edeliveryApi.getHandoverSheet({ trackingNumbers: 'ES000000001' }),
596
+ * );
597
+ * ```
598
+ *
599
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/handover_sheet/methods/getHandoverSheet
201
600
  */
202
- async getHandoverSheet(params) {
203
- return await withApiError('Failed to get handover sheet', () => this.client.get(`${this.basePath}/handover_sheet`, params));
204
- }
601
+ getHandoverSheet = (input) => {
602
+ const client = this.client;
603
+ const path = `${this.basePath}/handover_sheet`;
604
+ return Effect.gen(function* () {
605
+ const validatedInput = yield* requireObjectEffect(input, 'input');
606
+ const trackingNumbers = yield* requireStringEffect(validatedInput.trackingNumbers, 'trackingNumbers');
607
+ const params = buildEndpointParams({
608
+ trackingNumbers: { wireName: 'tracking_numbers', value: trackingNumbers },
609
+ });
610
+ return yield* requestGetEffect(client, path, params);
611
+ });
612
+ };
205
613
  /**
206
- * Get tracking information
207
- * Endpoint: GET /tracking
614
+ * Retrieves tracking details for one tracking number.
615
+ *
616
+ * @param input - Required tracking number.
617
+ * @returns An Effect that succeeds with eBay's GetTrackingDetailResponses.
618
+ *
619
+ * @example
620
+ * ```ts
621
+ * const tracking = await Effect.runPromise(
622
+ * edeliveryApi.getTracking({ trackingNumber: 'ES000000001' }),
623
+ * );
624
+ * ```
625
+ *
626
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/tracking/methods/getTracking
208
627
  */
209
- async getTracking(params) {
210
- return await withApiError('Failed to get tracking', () => this.client.get(`${this.basePath}/tracking`, params));
211
- }
212
- // ==================== Other ====================
628
+ getTracking = (input) => {
629
+ const client = this.client;
630
+ const path = `${this.basePath}/tracking`;
631
+ return Effect.gen(function* () {
632
+ const validatedInput = yield* requireObjectEffect(input, 'input');
633
+ const trackingNumber = yield* requireStringEffect(validatedInput.trackingNumber, 'trackingNumber');
634
+ const params = buildEndpointParams({
635
+ trackingNumber: { wireName: 'tracking_number', value: trackingNumber },
636
+ });
637
+ return yield* requestGetEffect(client, path, params);
638
+ });
639
+ };
213
640
  /**
214
- * Create a complaint
215
- * Endpoint: POST /complaint
641
+ * Creates a complaint for shipment issues.
642
+ *
643
+ * @param input - Generated AddComplaintRequest body.
644
+ * @returns An Effect that succeeds with eBay's empty createComplaint response.
645
+ *
646
+ * @example
647
+ * ```ts
648
+ * const complaint = await Effect.runPromise(
649
+ * edeliveryApi.createComplaint({ body: { complaintRequest: {} } }),
650
+ * );
651
+ * ```
652
+ *
653
+ * @see https://developer.ebay.com/api-docs/sell/edelivery_international_shipping/resources/complaint/methods/createComplaint
216
654
  */
217
- async createComplaint(complaintRequest) {
218
- return await withApiError('Failed to create complaint', () => this.client.post(`${this.basePath}/complaint`, complaintRequest));
219
- }
655
+ createComplaint = (input) => {
656
+ const client = this.client;
657
+ const path = `${this.basePath}/complaint`;
658
+ return Effect.gen(function* () {
659
+ const validatedInput = yield* requireObjectEffect(input, 'input');
660
+ const body = yield* requireObjectEffect(validatedInput.body, 'body');
661
+ return yield* requestPostEffect(client, path, body);
662
+ });
663
+ };
220
664
  }