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,221 +1,467 @@
1
- import { buildOptionalStringParams, requireObject, requireString, withApiError, } from '../shared/request.js';
2
- /**
3
- * Metadata API - Marketplace policies and configurations
4
- * Based on: docs/sell-apps/listing-metadata/sell_metadata_v1_oas3.json
5
- */
1
+ import { buildEndpointParams, requestGetEffect, requestPostEffect, requireObjectEffect, requireStringEffect, optionalStringEffect, } from '../../api/shared/request.js';
2
+ import { Effect } from 'effect';
3
+ /** Metadata API - marketplace policies, compatibility metadata, and tax jurisdictions. */
6
4
  export class MetadataApi {
7
5
  client;
8
6
  basePath = '/sell/metadata/v1';
9
7
  constructor(client) {
10
8
  this.client = client;
11
9
  }
12
- async getMarketplacePolicy(endpoint, marketplaceId, failureMessage) {
13
- requireString(marketplaceId, 'marketplaceId');
14
- const path = `${this.basePath}/marketplace/${marketplaceId}/${endpoint}`;
15
- return await withApiError(failureMessage, () => this.client.get(path));
16
- }
17
- async getFilteredMarketplacePolicy(endpoint, marketplaceId, failureMessage, filter) {
18
- requireString(marketplaceId, 'marketplaceId');
19
- const params = buildOptionalStringParams({ filter });
20
- const path = `${this.basePath}/marketplace/${marketplaceId}/${endpoint}`;
21
- return await withApiError(failureMessage, () => this.client.get(path, params));
22
- }
23
10
  /**
24
- * Get automotive parts compatibility policies for a marketplace
25
- * Endpoint: GET /marketplace/{marketplace_id}/get_automotive_parts_compatibility_policies
26
- * @throws Error if marketplaceId is missing or invalid
11
+ * Retrieves automotive parts compatibility policies for a marketplace.
12
+ *
13
+ * @param input - Marketplace and optional category filter.
14
+ * @returns An Effect that succeeds with eBay's AutomotivePartsCompatibilityPolicyResponse.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const policies = await Effect.runPromise(
19
+ * metadataApi.getAutomotivePartsCompatibilityPolicies({ marketplaceId: 'EBAY_US' }),
20
+ * );
21
+ * ```
22
+ *
23
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getAutomotivePartsCompatibilityPolicies
27
24
  */
28
- async getAutomotivePartsCompatibilityPolicies(marketplaceId, filter) {
29
- return await this.getFilteredMarketplacePolicy('get_automotive_parts_compatibility_policies', marketplaceId, 'Failed to get automotive parts compatibility policies', filter);
30
- }
25
+ getAutomotivePartsCompatibilityPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_automotive_parts_compatibility_policies', 'getAutomotivePartsCompatibilityPolicies');
31
26
  /**
32
- * Get category policies for a marketplace
33
- * Endpoint: GET /marketplace/{marketplace_id}/get_category_policies
34
- * @throws Error if marketplaceId is missing or invalid
27
+ * Retrieves category policies for a marketplace.
28
+ *
29
+ * @param input - Marketplace and optional category filter.
30
+ * @returns An Effect that succeeds with eBay's CategoryPolicyResponse.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const policies = await Effect.runPromise(
35
+ * metadataApi.getCategoryPolicies({ marketplaceId: 'EBAY_US' }),
36
+ * );
37
+ * ```
38
+ *
39
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getCategoryPolicies
35
40
  */
36
- async getCategoryPolicies(marketplaceId, filter) {
37
- return await this.getFilteredMarketplacePolicy('get_category_policies', marketplaceId, 'Failed to get category policies', filter);
38
- }
41
+ getCategoryPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_category_policies', 'getCategoryPolicies');
39
42
  /**
40
- * Get extended producer responsibility policies
41
- * Endpoint: GET /marketplace/{marketplace_id}/get_extended_producer_responsibility_policies
42
- * @throws Error if marketplaceId is missing or invalid
43
+ * Retrieves extended producer responsibility policies for a marketplace.
44
+ *
45
+ * @param input - Marketplace and optional category filter.
46
+ * @returns An Effect that succeeds with eBay's ExtendedProducerResponsibilityPolicyResponse.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const policies = await Effect.runPromise(
51
+ * metadataApi.getExtendedProducerResponsibilityPolicies({ marketplaceId: 'EBAY_DE' }),
52
+ * );
53
+ * ```
54
+ *
55
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getExtendedProducerResponsibilityPolicies
43
56
  */
44
- async getExtendedProducerResponsibilityPolicies(marketplaceId, filter) {
45
- return await this.getFilteredMarketplacePolicy('get_extended_producer_responsibility_policies', marketplaceId, 'Failed to get extended producer responsibility policies', filter);
46
- }
57
+ getExtendedProducerResponsibilityPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_extended_producer_responsibility_policies', 'getExtendedProducerResponsibilityPolicies');
47
58
  /**
48
- * Get hazardous materials labels
49
- * Endpoint: GET /marketplace/{marketplace_id}/get_hazardous_materials_labels
50
- * @throws Error if marketplaceId is missing or invalid
59
+ * Retrieves hazardous materials labels for a marketplace.
60
+ *
61
+ * @param input - Marketplace identifier.
62
+ * @returns An Effect that succeeds with eBay's HazardousMaterialDetailsResponse.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const labels = await Effect.runPromise(
67
+ * metadataApi.getHazardousMaterialsLabels({ marketplaceId: 'EBAY_US' }),
68
+ * );
69
+ * ```
70
+ *
71
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getHazardousMaterialsLabels
51
72
  */
52
- async getHazardousMaterialsLabels(marketplaceId) {
53
- return await this.getMarketplacePolicy('get_hazardous_materials_labels', marketplaceId, 'Failed to get hazardous materials labels');
54
- }
73
+ getHazardousMaterialsLabels = (input) => this.getMarketplaceResource(input, 'get_hazardous_materials_labels', 'getHazardousMaterialsLabels');
55
74
  /**
56
- * Get item condition policies for a marketplace
57
- * Endpoint: GET /marketplace/{marketplace_id}/get_item_condition_policies
58
- * @throws Error if marketplaceId is missing or invalid
75
+ * Retrieves item condition policies for a marketplace.
76
+ *
77
+ * @param input - Marketplace and optional category filter.
78
+ * @returns An Effect that succeeds with eBay's ItemConditionPolicyResponse.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const policies = await Effect.runPromise(
83
+ * metadataApi.getItemConditionPolicies({ marketplaceId: 'EBAY_US' }),
84
+ * );
85
+ * ```
86
+ *
87
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getItemConditionPolicies
59
88
  */
60
- async getItemConditionPolicies(marketplaceId, filter) {
61
- return await this.getFilteredMarketplacePolicy('get_item_condition_policies', marketplaceId, 'Failed to get item condition policies', filter);
62
- }
89
+ getItemConditionPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_item_condition_policies', 'getItemConditionPolicies');
63
90
  /**
64
- * Get listing structure policies
65
- * Endpoint: GET /marketplace/{marketplace_id}/get_listing_structure_policies
66
- * @throws Error if marketplaceId is missing or invalid
91
+ * Retrieves listing structure policies for a marketplace.
92
+ *
93
+ * @param input - Marketplace and optional category filter.
94
+ * @returns An Effect that succeeds with eBay's ListingStructurePolicyResponse.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const policies = await Effect.runPromise(
99
+ * metadataApi.getListingStructurePolicies({ marketplaceId: 'EBAY_GB' }),
100
+ * );
101
+ * ```
102
+ *
103
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getListingStructurePolicies
67
104
  */
68
- async getListingStructurePolicies(marketplaceId, filter) {
69
- return await this.getFilteredMarketplacePolicy('get_listing_structure_policies', marketplaceId, 'Failed to get listing structure policies', filter);
70
- }
71
- /**
72
- * Get negotiated price policies
73
- * Endpoint: GET /marketplace/{marketplace_id}/get_negotiated_price_policies
74
- * @throws Error if marketplaceId is missing or invalid
75
- */
76
- async getNegotiatedPricePolicies(marketplaceId, filter) {
77
- return await this.getFilteredMarketplacePolicy('get_negotiated_price_policies', marketplaceId, 'Failed to get negotiated price policies', filter);
78
- }
105
+ getListingStructurePolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_listing_structure_policies', 'getListingStructurePolicies');
79
106
  /**
80
- * Get product safety labels
81
- * Endpoint: GET /marketplace/{marketplace_id}/get_product_safety_labels
82
- * @throws Error if marketplaceId is missing or invalid
107
+ * Retrieves negotiated price policies for a marketplace.
108
+ *
109
+ * @param input - Marketplace and optional category filter.
110
+ * @returns An Effect that succeeds with eBay's NegotiatedPricePolicyResponse.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * const policies = await Effect.runPromise(
115
+ * metadataApi.getNegotiatedPricePolicies({ marketplaceId: 'EBAY_US' }),
116
+ * );
117
+ * ```
118
+ *
119
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getNegotiatedPricePolicies
83
120
  */
84
- async getProductSafetyLabels(marketplaceId) {
85
- return await this.getMarketplacePolicy('get_product_safety_labels', marketplaceId, 'Failed to get product safety labels');
86
- }
87
- /**
88
- * Get regulatory policies
89
- * Endpoint: GET /marketplace/{marketplace_id}/get_regulatory_policies
90
- * @throws Error if marketplaceId is missing or invalid
91
- */
92
- async getRegulatoryPolicies(marketplaceId, filter) {
93
- return await this.getFilteredMarketplacePolicy('get_regulatory_policies', marketplaceId, 'Failed to get regulatory policies', filter);
94
- }
121
+ getNegotiatedPricePolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_negotiated_price_policies', 'getNegotiatedPricePolicies');
95
122
  /**
96
- * Get return policies for a marketplace
97
- * Endpoint: GET /marketplace/{marketplace_id}/get_return_policies
98
- * @throws Error if marketplaceId is missing or invalid
123
+ * Retrieves product safety labels for a marketplace.
124
+ *
125
+ * @param input - Marketplace identifier.
126
+ * @returns An Effect that succeeds with eBay's ProductSafetyLabelsResponse.
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * const labels = await Effect.runPromise(
131
+ * metadataApi.getProductSafetyLabels({ marketplaceId: 'EBAY_DE' }),
132
+ * );
133
+ * ```
134
+ *
135
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getProductSafetyLabels
99
136
  */
100
- async getReturnPolicies(marketplaceId, filter) {
101
- return await this.getFilteredMarketplacePolicy('get_return_policies', marketplaceId, 'Failed to get return policies', filter);
102
- }
137
+ getProductSafetyLabels = (input) => this.getMarketplaceResource(input, 'get_product_safety_labels', 'getProductSafetyLabels');
103
138
  /**
104
- * Get shipping cost type policies
105
- * Endpoint: GET /marketplace/{marketplace_id}/get_shipping_cost_type_policies
106
- * @throws Error if marketplaceId is missing or invalid
139
+ * Retrieves regulatory policies for a marketplace.
140
+ *
141
+ * @param input - Marketplace and optional category filter.
142
+ * @returns An Effect that succeeds with eBay's RegulatoryPolicyResponse.
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * const policies = await Effect.runPromise(
147
+ * metadataApi.getRegulatoryPolicies({ marketplaceId: 'EBAY_US' }),
148
+ * );
149
+ * ```
150
+ *
151
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getRegulatoryPolicies
107
152
  */
108
- async getShippingCostTypePolicies(marketplaceId, filter) {
109
- return await this.getFilteredMarketplacePolicy('get_shipping_cost_type_policies', marketplaceId, 'Failed to get shipping cost type policies', filter);
110
- }
153
+ getRegulatoryPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_regulatory_policies', 'getRegulatoryPolicies');
111
154
  /**
112
- * Get classified ad policies for a marketplace
113
- * Endpoint: GET /marketplace/{marketplace_id}/get_classified_ad_policies
114
- * @throws Error if marketplaceId is missing or invalid
155
+ * Retrieves return policy metadata for a marketplace.
156
+ *
157
+ * @param input - Marketplace and optional category filter.
158
+ * @returns An Effect that succeeds with eBay's ReturnPolicyResponse.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * const policies = await Effect.runPromise(
163
+ * metadataApi.getReturnPolicies({ marketplaceId: 'EBAY_US' }),
164
+ * );
165
+ * ```
166
+ *
167
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getReturnPolicies
115
168
  */
116
- async getClassifiedAdPolicies(marketplaceId, filter) {
117
- return await this.getFilteredMarketplacePolicy('get_classified_ad_policies', marketplaceId, 'Failed to get classified ad policies', filter);
118
- }
169
+ getReturnPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_return_policies', 'getReturnPolicies');
119
170
  /**
120
- * Get currencies for a marketplace
121
- * Endpoint: GET /marketplace/{marketplace_id}/get_currencies
122
- * @throws Error if marketplaceId is missing or invalid
171
+ * Retrieves classified ad policies for a marketplace.
172
+ *
173
+ * @param input - Marketplace and optional category filter.
174
+ * @returns An Effect that succeeds with eBay's ClassifiedAdPolicyResponse.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * const policies = await Effect.runPromise(
179
+ * metadataApi.getClassifiedAdPolicies({ marketplaceId: 'EBAY_MOTORS_US' }),
180
+ * );
181
+ * ```
182
+ *
183
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getClassifiedAdPolicies
123
184
  */
124
- async getCurrencies(marketplaceId) {
125
- return await this.getMarketplacePolicy('get_currencies', marketplaceId, 'Failed to get currencies');
126
- }
185
+ getClassifiedAdPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_classified_ad_policies', 'getClassifiedAdPolicies');
127
186
  /**
128
- * Get listing type policies for a marketplace
129
- * Endpoint: GET /marketplace/{marketplace_id}/get_listing_type_policies
130
- * @throws Error if marketplaceId is missing or invalid
187
+ * Retrieves currency metadata for a marketplace.
188
+ *
189
+ * @param input - Marketplace identifier.
190
+ * @returns An Effect that succeeds with eBay's GetCurrenciesResponse.
191
+ *
192
+ * @example
193
+ * ```ts
194
+ * const currencies = await Effect.runPromise(metadataApi.getCurrencies({ marketplaceId: 'EBAY_US' }));
195
+ * ```
196
+ *
197
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getCurrencies
131
198
  */
132
- async getListingTypePolicies(marketplaceId, filter) {
133
- return await this.getFilteredMarketplacePolicy('get_listing_type_policies', marketplaceId, 'Failed to get listing type policies', filter);
134
- }
199
+ getCurrencies = (input) => this.getMarketplaceResource(input, 'get_currencies', 'getCurrencies');
135
200
  /**
136
- * Get motors listing policies for a marketplace
137
- * Endpoint: GET /marketplace/{marketplace_id}/get_motors_listing_policies
138
- * @throws Error if marketplaceId is missing or invalid
201
+ * Retrieves listing type policies for a marketplace.
202
+ *
203
+ * @param input - Marketplace and optional category filter.
204
+ * @returns An Effect that succeeds with eBay's ListingTypePoliciesResponse.
205
+ *
206
+ * @example
207
+ * ```ts
208
+ * const policies = await Effect.runPromise(
209
+ * metadataApi.getListingTypePolicies({ marketplaceId: 'EBAY_US' }),
210
+ * );
211
+ * ```
212
+ *
213
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getListingTypePolicies
139
214
  */
140
- async getMotorsListingPolicies(marketplaceId, filter) {
141
- return await this.getFilteredMarketplacePolicy('get_motors_listing_policies', marketplaceId, 'Failed to get motors listing policies', filter);
142
- }
215
+ getListingTypePolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_listing_type_policies', 'getListingTypePolicies');
143
216
  /**
144
- * Get shipping policies for a marketplace
145
- * Endpoint: GET /marketplace/{marketplace_id}/get_shipping_policies
146
- * @throws Error if marketplaceId is missing or invalid
217
+ * Retrieves Motors listing policies for a marketplace.
218
+ *
219
+ * @param input - Marketplace and optional category filter.
220
+ * @returns An Effect that succeeds with eBay's MotorsListingPoliciesResponse.
221
+ *
222
+ * @example
223
+ * ```ts
224
+ * const policies = await Effect.runPromise(
225
+ * metadataApi.getMotorsListingPolicies({ marketplaceId: 'EBAY_MOTORS_US' }),
226
+ * );
227
+ * ```
228
+ *
229
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getMotorsListingPolicies
147
230
  */
148
- async getShippingPolicies(marketplaceId, filter) {
149
- return await this.getFilteredMarketplacePolicy('get_shipping_policies', marketplaceId, 'Failed to get shipping policies', filter);
150
- }
231
+ getMotorsListingPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_motors_listing_policies', 'getMotorsListingPolicies');
151
232
  /**
152
- * Get site visibility policies for a marketplace
153
- * Endpoint: GET /marketplace/{marketplace_id}/get_site_visibility_policies
154
- * @throws Error if marketplaceId is missing or invalid
233
+ * Retrieves shipping policies for a marketplace.
234
+ *
235
+ * @param input - Marketplace and optional category filter.
236
+ * @returns An Effect that succeeds with eBay's ShippingPoliciesResponse.
237
+ *
238
+ * @example
239
+ * ```ts
240
+ * const policies = await Effect.runPromise(
241
+ * metadataApi.getShippingPolicies({ marketplaceId: 'EBAY_US' }),
242
+ * );
243
+ * ```
244
+ *
245
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getShippingPolicies
155
246
  */
156
- async getSiteVisibilityPolicies(marketplaceId, filter) {
157
- return await this.getFilteredMarketplacePolicy('get_site_visibility_policies', marketplaceId, 'Failed to get site visibility policies', filter);
158
- }
247
+ getShippingPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_shipping_policies', 'getShippingPolicies');
159
248
  /**
160
- * Get compatibilities by specification
161
- * Endpoint: POST /compatibilities/get_compatibilities_by_specification
162
- * @throws Error if specification is missing or invalid
249
+ * Retrieves site visibility policies for a marketplace.
250
+ *
251
+ * @param input - Marketplace and optional category filter.
252
+ * @returns An Effect that succeeds with eBay's SiteVisibilityPoliciesResponse.
253
+ *
254
+ * @example
255
+ * ```ts
256
+ * const policies = await Effect.runPromise(
257
+ * metadataApi.getSiteVisibilityPolicies({ marketplaceId: 'EBAY_US' }),
258
+ * );
259
+ * ```
260
+ *
261
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/marketplace/methods/getSiteVisibilityPolicies
163
262
  */
164
- async getCompatibilitiesBySpecification(specification) {
165
- requireObject(specification, 'specification');
166
- return await withApiError('Failed to get compatibilities by specification', () => this.client.post(`${this.basePath}/compatibilities/get_compatibilities_by_specification`, specification));
167
- }
263
+ getSiteVisibilityPolicies = (input) => this.getFilteredMarketplaceResource(input, 'get_site_visibility_policies', 'getSiteVisibilityPolicies');
168
264
  /**
169
- * Get compatibility property names
170
- * Endpoint: POST /compatibilities/get_compatibility_property_names
171
- * @throws Error if request data is missing or invalid
265
+ * Retrieves compatibility records matching part specifications.
266
+ *
267
+ * @param input - Marketplace header and generated SpecificationRequest body.
268
+ * @returns An Effect that succeeds with eBay's SpecificationResponse.
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * const compatibilities = await Effect.runPromise(
273
+ * metadataApi.getCompatibilitiesBySpecification({
274
+ * marketplaceId: 'EBAY_US',
275
+ * specification: { categoryId: '6016' },
276
+ * }),
277
+ * );
278
+ * ```
279
+ *
280
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/compatibilities/methods/getCompatibilitiesBySpecification
172
281
  */
173
- async getCompatibilityPropertyNames(data) {
174
- requireObject(data, 'data');
175
- return await withApiError('Failed to get compatibility property names', () => this.client.post(`${this.basePath}/compatibilities/get_compatibility_property_names`, data));
176
- }
282
+ getCompatibilitiesBySpecification = (input) => {
283
+ const client = this.client;
284
+ const path = `${this.basePath}/compatibilities/get_compatibilities_by_specification`;
285
+ return Effect.gen(function* () {
286
+ const validatedInput = yield* requireObjectEffect(input, 'input');
287
+ const marketplaceId = yield* requireStringEffect(validatedInput.marketplaceId, 'marketplaceId');
288
+ const body = yield* requireObjectEffect(validatedInput.specification, 'specification');
289
+ return yield* requestPostEffect(client, path, body, compatibilityHeaders(marketplaceId));
290
+ });
291
+ };
177
292
  /**
178
- * Get compatibility property values
179
- * Endpoint: POST /compatibilities/get_compatibility_property_values
180
- * @throws Error if request data is missing or invalid
293
+ * Retrieves compatibility property names for a compatibility-enabled category.
294
+ *
295
+ * @param input - Marketplace header and generated PropertyNamesRequest body.
296
+ * @returns An Effect that succeeds with eBay's PropertyNamesResponse.
297
+ *
298
+ * @example
299
+ * ```ts
300
+ * const names = await Effect.runPromise(
301
+ * metadataApi.getCompatibilityPropertyNames({
302
+ * marketplaceId: 'EBAY_US',
303
+ * data: { categoryId: '6016' },
304
+ * }),
305
+ * );
306
+ * ```
307
+ *
308
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/compatibilities/methods/getCompatibilityPropertyNames
181
309
  */
182
- async getCompatibilityPropertyValues(data) {
183
- requireObject(data, 'data');
184
- return await withApiError('Failed to get compatibility property values', () => this.client.post(`${this.basePath}/compatibilities/get_compatibility_property_values`, data));
185
- }
310
+ getCompatibilityPropertyNames = (input) => {
311
+ const client = this.client;
312
+ const path = `${this.basePath}/compatibilities/get_compatibility_property_names`;
313
+ return Effect.gen(function* () {
314
+ const validatedInput = yield* requireObjectEffect(input, 'input');
315
+ const marketplaceId = yield* requireStringEffect(validatedInput.marketplaceId, 'marketplaceId');
316
+ const body = yield* requireObjectEffect(validatedInput.data, 'data');
317
+ return yield* requestPostEffect(client, path, body, compatibilityHeaders(marketplaceId));
318
+ });
319
+ };
186
320
  /**
187
- * Get multi compatibility property values
188
- * Endpoint: POST /compatibilities/get_multi_compatibility_property_values
189
- * @throws Error if request data is missing or invalid
321
+ * Retrieves compatibility property values for one property.
322
+ *
323
+ * @param input - Marketplace header and generated PropertyValuesRequest body.
324
+ * @returns An Effect that succeeds with eBay's PropertyValuesResponse.
325
+ *
326
+ * @example
327
+ * ```ts
328
+ * const values = await Effect.runPromise(
329
+ * metadataApi.getCompatibilityPropertyValues({
330
+ * marketplaceId: 'EBAY_US',
331
+ * data: { categoryId: '6016', propertyName: 'Make' },
332
+ * }),
333
+ * );
334
+ * ```
335
+ *
336
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/compatibilities/methods/getCompatibilityPropertyValues
190
337
  */
191
- async getMultiCompatibilityPropertyValues(data) {
192
- requireObject(data, 'data');
193
- return await withApiError('Failed to get multi compatibility property values', () => this.client.post(`${this.basePath}/compatibilities/get_multi_compatibility_property_values`, data));
194
- }
338
+ getCompatibilityPropertyValues = (input) => {
339
+ const client = this.client;
340
+ const path = `${this.basePath}/compatibilities/get_compatibility_property_values`;
341
+ return Effect.gen(function* () {
342
+ const validatedInput = yield* requireObjectEffect(input, 'input');
343
+ const marketplaceId = yield* requireStringEffect(validatedInput.marketplaceId, 'marketplaceId');
344
+ const body = yield* requireObjectEffect(validatedInput.data, 'data');
345
+ return yield* requestPostEffect(client, path, body, compatibilityHeaders(marketplaceId));
346
+ });
347
+ };
195
348
  /**
196
- * Get product compatibilities
197
- * Endpoint: POST /compatibilities/get_product_compatibilities
198
- * @throws Error if request data is missing or invalid
349
+ * Retrieves values for multiple compatibility properties.
350
+ *
351
+ * @param input - Marketplace header and generated MultiCompatibilityPropertyValuesRequest body.
352
+ * @returns An Effect that succeeds with eBay's MultiCompatibilityPropertyValuesResponse.
353
+ *
354
+ * @example
355
+ * ```ts
356
+ * const values = await Effect.runPromise(
357
+ * metadataApi.getMultiCompatibilityPropertyValues({
358
+ * marketplaceId: 'EBAY_US',
359
+ * data: { categoryId: '6016', propertyNames: ['Make', 'Model'] },
360
+ * }),
361
+ * );
362
+ * ```
363
+ *
364
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/compatibilities/methods/getMultiCompatibilityPropertyValues
199
365
  */
200
- async getProductCompatibilities(data) {
201
- requireObject(data, 'data');
202
- return await withApiError('Failed to get product compatibilities', () => this.client.post(`${this.basePath}/compatibilities/get_product_compatibilities`, data));
203
- }
366
+ getMultiCompatibilityPropertyValues = (input) => {
367
+ const client = this.client;
368
+ const path = `${this.basePath}/compatibilities/get_multi_compatibility_property_values`;
369
+ return Effect.gen(function* () {
370
+ const validatedInput = yield* requireObjectEffect(input, 'input');
371
+ const marketplaceId = yield* requireStringEffect(validatedInput.marketplaceId, 'marketplaceId');
372
+ const body = yield* requireObjectEffect(validatedInput.data, 'data');
373
+ return yield* requestPostEffect(client, path, body, compatibilityHeaders(marketplaceId));
374
+ });
375
+ };
204
376
  /**
205
- * Get sales tax jurisdictions for a country
206
- * Endpoint: GET /country/{countryCode}/sales_tax_jurisdiction
207
- * @throws Error if countryCode is missing or invalid
377
+ * Retrieves product compatibility metadata.
378
+ *
379
+ * @param input - Marketplace header and generated ProductRequest body.
380
+ * @returns An Effect that succeeds with eBay's ProductResponse.
381
+ *
382
+ * @example
383
+ * ```ts
384
+ * const products = await Effect.runPromise(
385
+ * metadataApi.getProductCompatibilities({
386
+ * marketplaceId: 'EBAY_US',
387
+ * data: { categoryId: '6016' },
388
+ * }),
389
+ * );
390
+ * ```
391
+ *
392
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/compatibilities/methods/getProductCompatibilities
208
393
  */
209
- async getSalesTaxJurisdictions(countryCode) {
210
- requireString(countryCode, 'countryCode');
211
- return await withApiError('Failed to get sales tax jurisdictions', () => this.client.get(`${this.basePath}/country/${countryCode}/sales_tax_jurisdiction`));
212
- }
394
+ getProductCompatibilities = (input) => {
395
+ const client = this.client;
396
+ const path = `${this.basePath}/compatibilities/get_product_compatibilities`;
397
+ return Effect.gen(function* () {
398
+ const validatedInput = yield* requireObjectEffect(input, 'input');
399
+ const marketplaceId = yield* requireStringEffect(validatedInput.marketplaceId, 'marketplaceId');
400
+ const body = yield* requireObjectEffect(validatedInput.data, 'data');
401
+ return yield* requestPostEffect(client, path, body, compatibilityHeaders(marketplaceId));
402
+ });
403
+ };
213
404
  /**
214
- * Get product compliance policies
215
- * Endpoint: GET /marketplace/{marketplace_id}/get_product_compliance_policies
216
- * @throws Error if marketplaceId is missing or invalid
405
+ * Retrieves sales-tax jurisdictions for a country.
406
+ *
407
+ * @param input - Country code whose sales-tax jurisdictions should be returned.
408
+ * @returns An Effect that succeeds with eBay's SalesTaxJurisdictions response.
409
+ *
410
+ * @example
411
+ * ```ts
412
+ * const jurisdictions = await Effect.runPromise(
413
+ * metadataApi.getSalesTaxJurisdictions({ countryCode: 'US' }),
414
+ * );
415
+ * ```
416
+ *
417
+ * @see https://developer.ebay.com/api-docs/sell/metadata/resources/country/methods/getSalesTaxJurisdictions
217
418
  */
218
- async getProductCompliancePolicies(marketplaceId, filter) {
219
- return await this.getFilteredMarketplacePolicy('get_product_compliance_policies', marketplaceId, 'Failed to get product compliance policies', filter);
220
- }
419
+ getSalesTaxJurisdictions = (input) => {
420
+ const client = this.client;
421
+ const basePath = this.basePath;
422
+ return Effect.gen(function* () {
423
+ const validatedInput = yield* requireObjectEffect(input, 'input');
424
+ const countryCode = yield* requireStringEffect(validatedInput.countryCode, 'countryCode');
425
+ return yield* requestGetEffect(client, `${basePath}/country/${countryCode}/sales_tax_jurisdiction`);
426
+ });
427
+ };
428
+ getMarketplaceResource = (input, endpoint, parameterName) => {
429
+ const client = this.client;
430
+ const basePath = this.basePath;
431
+ return Effect.gen(function* () {
432
+ const validatedInput = yield* requireObjectEffect(input, 'input');
433
+ const marketplaceId = yield* requireStringEffect(validatedInput.marketplaceId, 'marketplaceId');
434
+ return yield* requestGetEffect(client, `${basePath}/marketplace/${marketplaceId}/${endpoint}`);
435
+ }).pipe(Effect.withSpan(`metadata.${parameterName}`));
436
+ };
437
+ getFilteredMarketplaceResource = (input, endpoint, parameterName) => {
438
+ const client = this.client;
439
+ const basePath = this.basePath;
440
+ return Effect.gen(function* () {
441
+ const validatedInput = yield* requireObjectEffect(input, 'input');
442
+ const marketplaceId = yield* requireStringEffect(validatedInput.marketplaceId, 'marketplaceId');
443
+ const filter = yield* optionalStringEffect(validatedInput.filter, 'filter');
444
+ const params = buildEndpointParams({
445
+ filter: { wireName: 'filter', value: filter },
446
+ });
447
+ return yield* requestGetEffect(client, `${basePath}/marketplace/${marketplaceId}/${endpoint}`, params);
448
+ }).pipe(Effect.withSpan(`metadata.${parameterName}`));
449
+ };
221
450
  }
451
+ /**
452
+ * Builds required headers for Metadata compatibility POST endpoints.
453
+ *
454
+ * @param marketplaceId - eBay marketplace identifier sent as X-EBAY-C-MARKETPLACE-ID.
455
+ * @returns Request config with the compatibility headers required by the OpenAPI spec.
456
+ *
457
+ * @example
458
+ * ```ts
459
+ * const config = compatibilityHeaders('EBAY_US');
460
+ * ```
461
+ */
462
+ export const compatibilityHeaders = (marketplaceId) => ({
463
+ headers: {
464
+ 'Content-Type': 'application/json',
465
+ 'X-EBAY-C-MARKETPLACE-ID': marketplaceId,
466
+ },
467
+ });