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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Data } from 'effect';
|
|
2
|
+
/** Tagged failure raised inside the REST client's request/retry Effect. */
|
|
3
|
+
export class EbayClientRequestError extends Data.TaggedError('EbayClientRequestError') {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Builds a tagged REST-client request error while omitting absent optional fields.
|
|
7
|
+
*
|
|
8
|
+
* @param input - Request failure fields captured by the REST client.
|
|
9
|
+
* @returns Tagged client request error used as the internal request Effect failure.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* clientRequestError({ kind: 'httpStatus', method: 'GET', url, message, status: 429 });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export const clientRequestError = ({ kind, method, url, message, status, cause, }) => new EbayClientRequestError({
|
|
17
|
+
kind,
|
|
18
|
+
method,
|
|
19
|
+
url,
|
|
20
|
+
message,
|
|
21
|
+
...(status === undefined ? {} : { status }),
|
|
22
|
+
...(cause === undefined ? {} : { cause }),
|
|
23
|
+
});
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import XmlBuilder from 'fast-xml-builder';
|
|
2
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
3
|
+
import { TradingApiFailure } from '../api/clientTradingError.js';
|
|
4
|
+
import { EbayApiError } from '../api/shared/request.js';
|
|
5
|
+
import { getBaseUrl } from '../config/environment.js';
|
|
6
|
+
import { getErrorMessage } from '../utils/errors.js';
|
|
7
|
+
import { httpRequestEffect } from '../utils/http.js';
|
|
8
|
+
import { apiLogger } from '../utils/logger.js';
|
|
9
|
+
import { isRecord } from '../utils/typeGuards.js';
|
|
10
|
+
import { Effect } from 'effect';
|
|
11
|
+
const COMPAT_LEVEL = '1451';
|
|
12
|
+
const SITE_ID = '0';
|
|
13
|
+
const TRADING_ENDPOINT_PATH = '/ws/api.dll';
|
|
14
|
+
const TRADING_XMLNS = 'urn:ebay:apis:eBLBaseComponents';
|
|
15
|
+
const buildTradingPath = (baseUrl) => `${baseUrl}${TRADING_ENDPOINT_PATH}`;
|
|
16
|
+
const buildTradingHeaders = (callName) => ({
|
|
17
|
+
'X-EBAY-API-SITEID': SITE_ID,
|
|
18
|
+
'X-EBAY-API-COMPATIBILITY-LEVEL': COMPAT_LEVEL,
|
|
19
|
+
'X-EBAY-API-CALL-NAME': callName,
|
|
20
|
+
'Content-Type': 'text/xml',
|
|
21
|
+
});
|
|
22
|
+
const buildTradingXmlBody = (builder, requestTag, params) => {
|
|
23
|
+
const xmlObject = {
|
|
24
|
+
[requestTag]: {
|
|
25
|
+
'@_xmlns': TRADING_XMLNS,
|
|
26
|
+
...params,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
return `<?xml version="1.0" encoding="utf-8"?>\n${builder.build(xmlObject)}`;
|
|
30
|
+
};
|
|
31
|
+
const createTradingApiError = ({ callName, path }, message, cause) => new EbayApiError({
|
|
32
|
+
method: 'POST',
|
|
33
|
+
path,
|
|
34
|
+
cause: new TradingApiFailure({
|
|
35
|
+
callName,
|
|
36
|
+
path,
|
|
37
|
+
message: `Trading API ${callName} ${message}`,
|
|
38
|
+
...(cause === undefined ? {} : { cause }),
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
const authorizeTradingHeaders = ({ restClient, headers, callName, path, }) => {
|
|
42
|
+
if (restClient.getConfig().disableAuthHeader) {
|
|
43
|
+
return Effect.succeed(headers);
|
|
44
|
+
}
|
|
45
|
+
return restClient
|
|
46
|
+
.getOAuthClient()
|
|
47
|
+
.getAccessToken()
|
|
48
|
+
.pipe(Effect.mapError((error) => createTradingApiError({ callName, path }, `token acquisition failed: ${getErrorMessage(error)}`)), Effect.map((token) => ({ ...headers, 'X-EBAY-API-IAF-TOKEN': token })));
|
|
49
|
+
};
|
|
50
|
+
const postTradingXml = ({ path, headers, xmlBody, callName, }) => httpRequestEffect({
|
|
51
|
+
method: 'POST',
|
|
52
|
+
url: path,
|
|
53
|
+
headers,
|
|
54
|
+
body: xmlBody,
|
|
55
|
+
timeoutMs: 30_000,
|
|
56
|
+
responseType: 'text',
|
|
57
|
+
}).pipe(Effect.mapError((error) => createTradingApiError({ callName, path }, `request failed: ${getErrorMessage(error)}`)));
|
|
58
|
+
const parseTradingXml = ({ parser, responseText, callName, path, }) => Effect.try({
|
|
59
|
+
try: () => parser.parse(responseText),
|
|
60
|
+
catch: (error) => new EbayApiError({
|
|
61
|
+
method: 'POST',
|
|
62
|
+
path,
|
|
63
|
+
cause: new TradingApiFailure({
|
|
64
|
+
callName,
|
|
65
|
+
path,
|
|
66
|
+
message: `Failed to parse Trading API ${callName} response: ${getErrorMessage(error)}`,
|
|
67
|
+
cause: error,
|
|
68
|
+
}),
|
|
69
|
+
}),
|
|
70
|
+
}).pipe(Effect.flatMap((parsedValue) => {
|
|
71
|
+
if (isRecord(parsedValue)) {
|
|
72
|
+
return Effect.succeed(parsedValue);
|
|
73
|
+
}
|
|
74
|
+
return Effect.fail(createTradingApiError({ callName, path }, 'response must be an object'));
|
|
75
|
+
}));
|
|
76
|
+
const readTradingPayload = (parsed, responseTag, { callName, path }) => {
|
|
77
|
+
const resultValue = parsed[responseTag] === undefined ? parsed : parsed[responseTag];
|
|
78
|
+
if (isRecord(resultValue)) {
|
|
79
|
+
return Effect.succeed(resultValue);
|
|
80
|
+
}
|
|
81
|
+
return Effect.fail(createTradingApiError({ callName, path }, 'response payload is not an object'));
|
|
82
|
+
};
|
|
83
|
+
const extractTradingErrorMessage = (errors) => {
|
|
84
|
+
const firstError = Array.isArray(errors) ? errors[0] : errors;
|
|
85
|
+
if (!isRecord(firstError)) {
|
|
86
|
+
return 'Trading API returned a failure without an error message';
|
|
87
|
+
}
|
|
88
|
+
const shortMessage = firstError.ShortMessage;
|
|
89
|
+
if (typeof shortMessage === 'string' && shortMessage !== '') {
|
|
90
|
+
return shortMessage;
|
|
91
|
+
}
|
|
92
|
+
const longMessage = firstError.LongMessage;
|
|
93
|
+
if (typeof longMessage === 'string' && longMessage !== '') {
|
|
94
|
+
return longMessage;
|
|
95
|
+
}
|
|
96
|
+
return 'Trading API returned a failure without an error message';
|
|
97
|
+
};
|
|
98
|
+
const validateTradingAck = (result, { callName, path }) => {
|
|
99
|
+
if (result.Ack === 'Warning') {
|
|
100
|
+
apiLogger.warn(`Trading API ${callName} returned warnings`, {
|
|
101
|
+
errors: result.Errors,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (result.Ack === 'Failure' || result.Ack === 'PartialFailure') {
|
|
105
|
+
return Effect.fail(new EbayApiError({
|
|
106
|
+
method: 'POST',
|
|
107
|
+
path,
|
|
108
|
+
cause: new TradingApiFailure({
|
|
109
|
+
callName,
|
|
110
|
+
path,
|
|
111
|
+
message: extractTradingErrorMessage(result.Errors),
|
|
112
|
+
cause: result.Errors,
|
|
113
|
+
}),
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
return Effect.succeed(result);
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* XML-based client for eBay Trading API calls that are not covered by REST APIs.
|
|
120
|
+
*/
|
|
121
|
+
export class TradingApiClient {
|
|
122
|
+
restClient;
|
|
123
|
+
baseUrl;
|
|
124
|
+
parser;
|
|
125
|
+
builder;
|
|
126
|
+
constructor(restClient) {
|
|
127
|
+
this.restClient = restClient;
|
|
128
|
+
const config = restClient.getConfig();
|
|
129
|
+
this.baseUrl = getBaseUrl(config.environment, config.apiBaseUrl);
|
|
130
|
+
this.parser = new XMLParser({
|
|
131
|
+
ignoreAttributes: false,
|
|
132
|
+
removeNSPrefix: true,
|
|
133
|
+
parseTagValue: true,
|
|
134
|
+
isArray: (_name) => {
|
|
135
|
+
const arrayTags = [
|
|
136
|
+
'Item',
|
|
137
|
+
'Errors',
|
|
138
|
+
'Error',
|
|
139
|
+
'NameValueList',
|
|
140
|
+
'Value',
|
|
141
|
+
'ShippingServiceOptions',
|
|
142
|
+
'InternationalShippingServiceOption',
|
|
143
|
+
'PaymentMethods',
|
|
144
|
+
'PictureURL',
|
|
145
|
+
'CompatibilityList',
|
|
146
|
+
'Variation',
|
|
147
|
+
];
|
|
148
|
+
return arrayTags.includes(_name);
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
this.builder = new XmlBuilder({
|
|
152
|
+
ignoreAttributes: false,
|
|
153
|
+
format: true,
|
|
154
|
+
suppressEmptyNode: true,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Return the Trading API base URL for the configured eBay environment.
|
|
159
|
+
*
|
|
160
|
+
* @returns The Trading API base URL derived from the configured environment.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* const baseUrl = tradingClient.getTradingBaseUrl();
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
getTradingBaseUrl = () => this.baseUrl;
|
|
168
|
+
/**
|
|
169
|
+
* Execute a named Trading API call with XML request/response conversion.
|
|
170
|
+
*
|
|
171
|
+
* @param callName - Trading API call name, such as GetItem or AddFixedPriceItem.
|
|
172
|
+
* @param params - XML request payload fields nested under the generated request tag.
|
|
173
|
+
* @returns An Effect that succeeds with the parsed response payload.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* const result = await Effect.runPromise(
|
|
178
|
+
* tradingClient.execute('GetItem', { ItemID: '12345' }),
|
|
179
|
+
* );
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
execute = (callName, params) => {
|
|
183
|
+
const tradingClient = this;
|
|
184
|
+
const requestTag = `${callName}Request`;
|
|
185
|
+
const responseTag = `${callName}Response`;
|
|
186
|
+
const path = buildTradingPath(tradingClient.baseUrl);
|
|
187
|
+
const headers = buildTradingHeaders(callName);
|
|
188
|
+
const xmlBody = buildTradingXmlBody(tradingClient.builder, requestTag, params);
|
|
189
|
+
apiLogger.debug(`Trading API ${callName}`, { xmlBody });
|
|
190
|
+
return Effect.gen(function* () {
|
|
191
|
+
const authorizedHeaders = yield* authorizeTradingHeaders({
|
|
192
|
+
restClient: tradingClient.restClient,
|
|
193
|
+
headers,
|
|
194
|
+
callName,
|
|
195
|
+
path,
|
|
196
|
+
});
|
|
197
|
+
const response = yield* postTradingXml({
|
|
198
|
+
path,
|
|
199
|
+
headers: authorizedHeaders,
|
|
200
|
+
xmlBody,
|
|
201
|
+
callName,
|
|
202
|
+
});
|
|
203
|
+
const parsed = yield* parseTradingXml({
|
|
204
|
+
parser: tradingClient.parser,
|
|
205
|
+
responseText: response.data,
|
|
206
|
+
callName,
|
|
207
|
+
path,
|
|
208
|
+
});
|
|
209
|
+
const result = yield* readTradingPayload(parsed, responseTag, { callName, path });
|
|
210
|
+
return yield* validateTradingAck(result, { callName, path });
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { buildEndpointParams, optionalNonNegativeNumberEffect, optionalPositiveNumberEffect, optionalStringEffect, requestGetEffect, requestPostEffect, requireObjectEffect, requireStringEffect, } from '../../api/shared/request.js';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
3
|
/**
|
|
4
4
|
* Feedback API - Manage buyer and seller feedback
|
|
5
5
|
* Based on: docs/sell-apps/communication/commerce_feedback_v1_beta_oas3.json
|
|
@@ -11,70 +11,158 @@ export class FeedbackApi {
|
|
|
11
11
|
this.client = client;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
* @
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
14
|
+
* Retrieves line items awaiting feedback.
|
|
15
|
+
*
|
|
16
|
+
* @param input - Optional filter, pagination, and sort query parameters.
|
|
17
|
+
* @returns An Effect that succeeds with eBay's generated AwaitingFeedbackResponse.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const awaiting = await Effect.runPromise(
|
|
22
|
+
* feedbackApi.getAwaitingFeedback({ filter: 'userRole:SELLER', limit: 25 }),
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see https://developer.ebay.com/api-docs/commerce/feedback/resources/awaiting_feedback/methods/getItemsAwaitingFeedback
|
|
20
27
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
getAwaitingFeedback = (input = {}) => {
|
|
29
|
+
const client = this.client;
|
|
30
|
+
const path = `${this.basePath}/awaiting_feedback`;
|
|
31
|
+
return Effect.gen(function* () {
|
|
32
|
+
const filter = yield* optionalStringEffect(input.filter, 'filter');
|
|
33
|
+
const limit = yield* optionalPositiveNumberEffect(input.limit, 'limit');
|
|
34
|
+
const offset = yield* optionalNonNegativeNumberEffect(input.offset, 'offset');
|
|
35
|
+
const sort = yield* optionalStringEffect(input.sort, 'sort');
|
|
36
|
+
const params = buildEndpointParams({
|
|
37
|
+
filter: { wireName: 'filter', value: filter },
|
|
38
|
+
limit: { wireName: 'limit', value: limit },
|
|
39
|
+
offset: { wireName: 'offset', value: offset },
|
|
40
|
+
sort: { wireName: 'sort', value: sort },
|
|
41
|
+
});
|
|
42
|
+
return yield* requestGetEffect(client, path, params);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
37
45
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @
|
|
46
|
+
* Retrieves feedback for a specified eBay user.
|
|
47
|
+
*
|
|
48
|
+
* @param input - Required user and feedback type plus optional endpoint filters.
|
|
49
|
+
* @returns An Effect that succeeds with eBay's generated GetFeedbackResponse.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const feedback = await Effect.runPromise(
|
|
54
|
+
* feedbackApi.getFeedback({ userId: 'seller_123', feedbackType: 'FEEDBACK_RECEIVED' }),
|
|
55
|
+
* );
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @see https://developer.ebay.com/api-docs/commerce/feedback/resources/feedback/methods/getFeedback
|
|
41
59
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
getFeedback = (input) => {
|
|
61
|
+
const client = this.client;
|
|
62
|
+
const path = `${this.basePath}/feedback`;
|
|
63
|
+
return Effect.gen(function* () {
|
|
64
|
+
const request = yield* requireObjectEffect(input, 'input');
|
|
65
|
+
const userId = yield* requireStringEffect(request.userId, 'userId');
|
|
66
|
+
const feedbackType = yield* requireStringEffect(request.feedbackType, 'feedbackType');
|
|
67
|
+
const feedbackId = yield* optionalStringEffect(request.feedbackId, 'feedbackId');
|
|
68
|
+
const filter = yield* optionalStringEffect(request.filter, 'filter');
|
|
69
|
+
const limit = yield* optionalPositiveNumberEffect(request.limit, 'limit');
|
|
70
|
+
const listingId = yield* optionalStringEffect(request.listingId, 'listingId');
|
|
71
|
+
const offset = yield* optionalNonNegativeNumberEffect(request.offset, 'offset');
|
|
72
|
+
const orderLineItemId = yield* optionalStringEffect(request.orderLineItemId, 'orderLineItemId');
|
|
73
|
+
const sort = yield* optionalStringEffect(request.sort, 'sort');
|
|
74
|
+
const transactionId = yield* optionalStringEffect(request.transactionId, 'transactionId');
|
|
75
|
+
const params = buildEndpointParams({
|
|
76
|
+
userId: { wireName: 'user_id', value: userId },
|
|
77
|
+
feedbackType: { wireName: 'feedback_type', value: feedbackType },
|
|
78
|
+
feedbackId: { wireName: 'feedback_id', value: feedbackId },
|
|
79
|
+
filter: { wireName: 'filter', value: filter },
|
|
80
|
+
limit: { wireName: 'limit', value: limit },
|
|
81
|
+
listingId: { wireName: 'listing_id', value: listingId },
|
|
82
|
+
offset: { wireName: 'offset', value: offset },
|
|
83
|
+
orderLineItemId: { wireName: 'order_line_item_id', value: orderLineItemId },
|
|
84
|
+
sort: { wireName: 'sort', value: sort },
|
|
85
|
+
transactionId: { wireName: 'transaction_id', value: transactionId },
|
|
86
|
+
});
|
|
87
|
+
return yield* requestGetEffect(client, path, params);
|
|
88
|
+
});
|
|
89
|
+
};
|
|
45
90
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @
|
|
91
|
+
* Retrieves a feedback rating summary for a user.
|
|
92
|
+
*
|
|
93
|
+
* @param input - Required eBay user ID and rating summary filter.
|
|
94
|
+
* @returns An Effect that succeeds with eBay's generated GetFeedbackRatingSummaryResponse.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const summary = await Effect.runPromise(
|
|
99
|
+
* feedbackApi.getFeedbackRatingSummary({
|
|
100
|
+
* userId: 'seller_123',
|
|
101
|
+
* filter: 'ratingType:OVERALL_EXPERIENCE',
|
|
102
|
+
* }),
|
|
103
|
+
* );
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @see https://developer.ebay.com/api-docs/commerce/feedback/resources/feedback_rating_summary/methods/getFeedbackRatingSummary
|
|
49
107
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
108
|
+
getFeedbackRatingSummary = (input) => {
|
|
109
|
+
const client = this.client;
|
|
110
|
+
const path = `${this.basePath}/feedback_rating_summary`;
|
|
111
|
+
return Effect.gen(function* () {
|
|
112
|
+
const request = yield* requireObjectEffect(input, 'input');
|
|
113
|
+
const userId = yield* requireStringEffect(request.userId, 'userId');
|
|
114
|
+
const filter = yield* requireStringEffect(request.filter, 'filter');
|
|
115
|
+
const params = buildEndpointParams({
|
|
116
|
+
userId: { wireName: 'user_id', value: userId },
|
|
117
|
+
filter: { wireName: 'filter', value: filter },
|
|
118
|
+
});
|
|
119
|
+
return yield* requestGetEffect(client, path, params);
|
|
120
|
+
});
|
|
121
|
+
};
|
|
56
122
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @
|
|
123
|
+
* Leaves feedback for the user's order partner.
|
|
124
|
+
*
|
|
125
|
+
* @param feedbackData - Generated LeaveFeedbackRequest body.
|
|
126
|
+
* @returns An Effect that succeeds with eBay's generated LeaveFeedbackResponse.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* const feedback = await Effect.runPromise(
|
|
131
|
+
* feedbackApi.leaveFeedbackForBuyer({ commentText: 'Great buyer', commentType: 'POSITIVE' }),
|
|
132
|
+
* );
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @see https://developer.ebay.com/api-docs/commerce/feedback/resources/feedback/methods/leaveFeedback
|
|
60
136
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
feedback_id: feedbackId,
|
|
70
|
-
response_text: responseText,
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
137
|
+
leaveFeedbackForBuyer = (feedbackData) => {
|
|
138
|
+
const client = this.client;
|
|
139
|
+
const path = `${this.basePath}/feedback`;
|
|
140
|
+
return Effect.gen(function* () {
|
|
141
|
+
const body = yield* requireObjectEffect(feedbackData, 'feedbackData');
|
|
142
|
+
return yield* requestPostEffect(client, path, body);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
73
145
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
146
|
+
* Responds to feedback received from another eBay user.
|
|
147
|
+
*
|
|
148
|
+
* @param response - Generated RespondToFeedbackRequest body.
|
|
149
|
+
* @returns An Effect that succeeds with eBay's generated empty response.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* await Effect.runPromise(
|
|
154
|
+
* feedbackApi.respondToFeedback({ feedbackId: 'feedback-1', responseText: 'Thank you' }),
|
|
155
|
+
* );
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @see https://developer.ebay.com/api-docs/commerce/feedback/resources/respond_to_feedback/methods/respondToFeedback
|
|
76
159
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
160
|
+
respondToFeedback = (response) => {
|
|
161
|
+
const client = this.client;
|
|
162
|
+
const path = `${this.basePath}/respond_to_feedback`;
|
|
163
|
+
return Effect.gen(function* () {
|
|
164
|
+
const body = yield* requireObjectEffect(response, 'response');
|
|
165
|
+
return yield* requestPostEffect(client, path, body);
|
|
166
|
+
});
|
|
167
|
+
};
|
|
80
168
|
}
|