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.
- package/README.de.md +3 -3
- package/README.es.md +3 -3
- package/README.fr.md +3 -3
- package/README.ja.md +3 -3
- package/README.ko.md +3 -3
- package/README.md +163 -41
- package/README.pt-BR.md +3 -3
- package/README.ru.md +3 -3
- package/README.zh-CN.md +3 -3
- package/build/api/account-management/account.js +633 -297
- package/build/api/analytics-and-report/analytics.js +111 -65
- package/build/api/client.js +199 -140
- package/build/api/clientRequestError.js +23 -0
- package/build/api/clientTrading.js +213 -0
- package/build/api/clientTradingError.js +4 -0
- package/build/api/communication/feedback.js +147 -59
- package/build/api/communication/message.js +134 -81
- package/build/api/communication/negotiation.js +65 -53
- package/build/api/communication/notification.js +458 -164
- package/build/api/developer/developer.js +99 -45
- package/build/api/index.js +23 -8
- package/build/api/listing-management/inventory.js +884 -338
- package/build/api/listing-metadata/metadata.js +416 -170
- package/build/api/listing-metadata/taxonomy.js +187 -42
- package/build/api/marketing-and-promotions/marketing.js +1392 -598
- package/build/api/marketing-and-promotions/recommendation.js +49 -24
- package/build/api/order-management/dispute.js +226 -45
- package/build/api/order-management/fulfillment.js +144 -71
- package/build/api/order-management/orderIssueHelpers.js +61 -0
- package/build/api/other/compliance.js +50 -38
- package/build/api/other/edelivery.js +603 -159
- package/build/api/other/finding.js +280 -0
- package/build/api/other/identity.js +30 -15
- package/build/api/other/translation.js +29 -14
- package/build/api/other/vero.js +113 -27
- package/build/api/rateLimitTracker.js +55 -0
- package/build/api/shared/request.js +189 -98
- package/build/api/trading/trading.js +154 -87
- package/build/auth/credentialSession.js +250 -0
- package/build/auth/oauth.js +298 -171
- package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
- package/build/auth/oauthMiddleware.js +104 -0
- package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
- package/build/auth/tokenVerifier.js +243 -0
- package/build/auth/tokenVerifierError.js +21 -0
- package/build/config/environment.js +148 -113
- package/build/config/{tool-families.js → toolFamilies.js} +30 -14
- package/build/index.js +25 -19
- package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
- package/build/mcp/readOnlyFilter.js +67 -0
- package/build/mcp/runtime.js +31 -13
- package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
- package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
- package/build/schemas/account-management/account.js +144 -6
- package/build/schemas/analytics/analytics.js +33 -19
- package/build/schemas/communication/messages.js +12 -42
- package/build/schemas/developer/developer.js +135 -0
- package/build/schemas/fulfillment/orders.js +183 -21
- package/build/schemas/index.js +27 -19
- package/build/schemas/inventory-management/inventory.js +17 -9
- package/build/schemas/marketing/marketing.js +480 -25
- package/build/schemas/metadata/metadata.js +11 -6
- package/build/schemas/other/finding.js +27 -0
- package/build/schemas/other/otherApis.js +424 -0
- package/build/schemas/taxonomy/taxonomy.js +11 -5
- package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
- package/build/scripts/{build-ui.js → buildUi.js} +6 -1
- package/build/scripts/{dev-sync.js → devSync.js} +169 -110
- package/build/scripts/diagnostics.js +52 -44
- package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
- package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
- package/build/scripts/setup.js +241 -178
- package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
- package/build/scripts/skills.js +35 -27
- package/build/scripts/updateApiStatusDoc.js +71 -0
- package/build/serverHttp.js +90 -0
- package/build/skills/content.js +124 -118
- package/build/skills/index.js +22 -10
- package/build/skills/install.js +21 -10
- package/build/skills/markers.js +50 -15
- package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
- package/build/skills/render.js +41 -14
- package/build/skills/targets.js +49 -17
- package/build/tools/categories/account.js +166 -264
- package/build/tools/categories/analytics.js +11 -22
- package/build/tools/categories/browse.js +17 -0
- package/build/tools/categories/communication.js +124 -399
- package/build/tools/categories/connector.js +23 -20
- package/build/tools/categories/developer.js +46 -159
- package/build/tools/categories/fulfillment.js +84 -215
- package/build/tools/categories/index.js +6 -14
- package/build/tools/categories/inventory.js +238 -293
- package/build/tools/categories/marketing.js +677 -39
- package/build/tools/categories/metadata.js +190 -117
- package/build/tools/categories/other.js +81 -208
- package/build/tools/categories/taxonomy.js +29 -20
- package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
- package/build/tools/categories/trading.js +16 -47
- package/build/tools/contracts.js +34 -24
- package/build/tools/{define-tool.js → defineTool.js} +44 -29
- package/build/tools/registry.js +87 -29
- package/build/tools/schemas.js +3 -57
- package/build/tools/ui/archetypes.js +1 -0
- package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
- package/build/tools/ui/maps.js +294 -80
- package/build/types/index.js +1 -1
- package/build/ui/card.html +14 -14
- package/build/ui/chart.html +14 -14
- package/build/ui/stat.html +87 -0
- package/build/ui/table.html +14 -14
- package/build/utils/apiStatusFeed.js +95 -0
- package/build/utils/cliOutput.js +15 -0
- package/build/utils/cliUi.js +108 -0
- package/build/utils/communication/feedback.js +57 -77
- package/build/utils/communication/message.js +69 -98
- package/build/utils/communication/negotiation.js +30 -57
- package/build/utils/communication/notification.js +112 -252
- package/build/utils/{date-converter.js → dateConverter.js} +62 -30
- package/build/utils/effectSchema.js +203 -0
- package/build/utils/effectSchemaAdapter.js +121 -0
- package/build/utils/effectSchemaChainMethods.js +146 -0
- package/build/utils/effectSchemaRefinements.js +104 -0
- package/build/utils/effectSchemaStringMethods.js +63 -0
- package/build/utils/effectSchemaTypes.js +47 -0
- package/build/utils/{env-parser.js → envParser.js} +10 -2
- package/build/utils/errors.js +7 -3
- package/build/utils/http.js +148 -89
- package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
- package/build/utils/logger.js +127 -51
- package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
- package/build/utils/other/compliance.js +18 -38
- package/build/utils/other/identity.js +2 -2
- package/build/utils/other/translation.js +4 -4
- package/build/utils/other/vero.js +36 -20
- package/build/utils/schemaHelpers.js +22 -0
- package/build/utils/scopeHelper.js +270 -0
- package/build/utils/securityChecker.js +316 -0
- package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
- package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
- package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
- package/build/utils/trading/trading.js +35 -0
- package/build/utils/typeGuards.js +12 -0
- package/build/utils/version.js +65 -29
- package/package.json +10 -8
- package/build/api/client-trading.js +0 -124
- package/build/api/communication/shared.js +0 -59
- package/build/api/shared/query-params.js +0 -16
- package/build/auth/credential-session.js +0 -166
- package/build/auth/oauth-middleware.js +0 -100
- package/build/auth/token-verifier.js +0 -186
- package/build/schemas/other/other-apis.js +0 -390
- package/build/scripts/update-api-status-doc.js +0 -44
- package/build/server-http.js +0 -85
- package/build/tools/definitions/marketing.js +0 -1381
- package/build/tools/tool-handlers/marketing.js +0 -312
- package/build/utils/account-management/account.js +0 -818
- package/build/utils/api-status-feed.js +0 -84
- package/build/utils/cli-ui.js +0 -47
- package/build/utils/order-management/dispute.js +0 -369
- package/build/utils/order-management/fulfillment.js +0 -205
- package/build/utils/other/edelivery.js +0 -235
- package/build/utils/schema-helpers.js +0 -13
- package/build/utils/scope-helper.js +0 -207
- package/build/utils/security-checker.js +0 -248
- package/build/utils/type-guards.js +0 -6
- /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
- /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
- /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
- /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
|
@@ -1,221 +1,467 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* @
|
|
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
|
-
|
|
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
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* @
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* @
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* @
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* @
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* @
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* @
|
|
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
|
-
|
|
219
|
-
|
|
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
|
+
});
|