ebay-api 7.1.3 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -53
- package/dist/api/apiFactory.d.ts +27 -0
- package/dist/api/apiFactory.js +94 -0
- package/dist/api/base.d.ts +10 -0
- package/dist/api/base.js +10 -0
- package/dist/api/index.d.ts +11 -0
- package/dist/api/index.js +11 -0
- package/dist/api/restful/buy/browse/index.d.ts +84 -0
- package/dist/api/restful/buy/browse/index.js +135 -0
- package/dist/api/restful/buy/deal/index.d.ts +55 -0
- package/dist/api/restful/buy/deal/index.js +73 -0
- package/dist/api/restful/buy/feed/index.d.ts +43 -0
- package/dist/api/restful/buy/feed/index.js +78 -0
- package/dist/api/restful/buy/index.d.ts +17 -0
- package/dist/api/restful/buy/index.js +8 -0
- package/dist/api/restful/buy/marketing/index.d.ts +27 -0
- package/dist/api/restful/buy/marketing/index.js +44 -0
- package/dist/api/restful/buy/marketplaceInsights/index.d.ts +28 -0
- package/dist/api/restful/buy/marketplaceInsights/index.js +44 -0
- package/dist/api/restful/buy/offer/index.d.ts +23 -0
- package/dist/api/restful/buy/offer/index.js +30 -0
- package/dist/api/restful/buy/order/index.d.ts +264 -0
- package/dist/api/restful/buy/order/index.js +362 -0
- package/dist/api/restful/commerce/catalog/index.d.ts +73 -0
- package/dist/api/restful/commerce/catalog/index.js +101 -0
- package/dist/api/restful/commerce/charity/index.d.ts +34 -0
- package/dist/api/restful/commerce/charity/index.js +49 -0
- package/dist/api/restful/commerce/identity/index.d.ts +14 -0
- package/dist/api/restful/commerce/identity/index.js +20 -0
- package/dist/api/restful/commerce/index.d.ts +15 -0
- package/dist/api/restful/commerce/index.js +7 -0
- package/dist/api/restful/commerce/notification/index.d.ts +117 -0
- package/dist/api/restful/commerce/notification/index.js +180 -0
- package/dist/api/restful/commerce/taxonomy/index.d.ts +78 -0
- package/dist/api/restful/commerce/taxonomy/index.js +128 -0
- package/dist/api/restful/commerce/translation/index.d.ts +15 -0
- package/dist/api/restful/commerce/translation/index.js +18 -0
- package/dist/api/restful/developer/analytics/index.d.ts +22 -0
- package/dist/api/restful/developer/analytics/index.js +38 -0
- package/dist/api/restful/developer/index.d.ts +7 -0
- package/dist/api/restful/developer/index.js +3 -0
- package/dist/api/restful/developer/keyManagement/index.d.ts +26 -0
- package/dist/api/restful/developer/keyManagement/index.js +34 -0
- package/dist/api/restful/index.d.ts +62 -0
- package/dist/api/restful/index.js +164 -0
- package/dist/api/restful/postOrder/cancellation/index.d.ts +57 -0
- package/dist/api/restful/postOrder/cancellation/index.js +88 -0
- package/dist/api/restful/postOrder/case/index.d.ts +63 -0
- package/dist/api/restful/postOrder/case/index.js +88 -0
- package/dist/api/restful/postOrder/index.d.ts +11 -0
- package/dist/api/restful/postOrder/index.js +5 -0
- package/dist/api/restful/postOrder/inquiry/index.d.ts +82 -0
- package/dist/api/restful/postOrder/inquiry/index.js +124 -0
- package/dist/api/restful/postOrder/return/index.d.ts +231 -0
- package/dist/api/restful/postOrder/return/index.js +354 -0
- package/dist/api/restful/sell/account/index.d.ts +217 -0
- package/dist/api/restful/sell/account/index.js +330 -0
- package/dist/api/restful/sell/analytics/index.d.ts +41 -0
- package/dist/api/restful/sell/analytics/index.js +54 -0
- package/dist/api/restful/sell/compliance/index.d.ts +37 -0
- package/dist/api/restful/sell/compliance/index.js +50 -0
- package/dist/api/restful/sell/feed/index.d.ts +151 -0
- package/dist/api/restful/sell/feed/index.js +248 -0
- package/dist/api/restful/sell/finances/index.d.ts +78 -0
- package/dist/api/restful/sell/finances/index.js +102 -0
- package/dist/api/restful/sell/fulfillment/index.d.ts +137 -0
- package/dist/api/restful/sell/fulfillment/index.js +192 -0
- package/dist/api/restful/sell/index.d.ts +29 -0
- package/dist/api/restful/sell/index.js +14 -0
- package/dist/api/restful/sell/inventory/index.d.ts +248 -0
- package/dist/api/restful/sell/inventory/index.js +339 -0
- package/dist/api/restful/sell/listing/index.d.ts +14 -0
- package/dist/api/restful/sell/listing/index.js +18 -0
- package/dist/api/restful/sell/logistics/index.d.ts +44 -0
- package/dist/api/restful/sell/logistics/index.js +59 -0
- package/dist/api/restful/sell/marketing/index.d.ts +443 -0
- package/dist/api/restful/sell/marketing/index.js +602 -0
- package/dist/api/restful/sell/metadata/index.d.ts +77 -0
- package/dist/api/restful/sell/metadata/index.js +124 -0
- package/dist/api/restful/sell/negotiation/index.d.ts +24 -0
- package/dist/api/restful/sell/negotiation/index.js +32 -0
- package/dist/api/restful/sell/recommendation/index.d.ts +26 -0
- package/dist/api/restful/sell/recommendation/index.js +32 -0
- package/dist/api/traditional/XMLRequest.d.ts +107 -0
- package/dist/api/traditional/XMLRequest.js +173 -0
- package/dist/api/traditional/clientAlerts/index.d.ts +9 -0
- package/dist/api/traditional/clientAlerts/index.js +11 -0
- package/dist/api/traditional/clientAlerts/types.d.ts +31 -0
- package/dist/api/traditional/clientAlerts/types.js +32 -0
- package/dist/api/traditional/fields.d.ts +1948 -0
- package/dist/api/traditional/fields.js +1946 -0
- package/dist/api/traditional/finding/index.d.ts +12 -0
- package/dist/api/traditional/finding/index.js +13 -0
- package/dist/api/traditional/index.d.ts +17 -0
- package/dist/api/traditional/index.js +181 -0
- package/dist/api/traditional/merchandising/index.d.ts +7 -0
- package/dist/api/traditional/merchandising/index.js +8 -0
- package/dist/api/traditional/shopping/index.d.ts +11 -0
- package/dist/api/traditional/shopping/index.js +13 -0
- package/dist/api/traditional/trading/index.d.ts +142 -0
- package/dist/api/traditional/trading/index.js +143 -0
- package/dist/auth/authNAuth.d.ts +49 -0
- package/dist/auth/authNAuth.js +116 -0
- package/dist/auth/index.d.ts +17 -0
- package/dist/auth/index.js +25 -0
- package/dist/auth/oAuth2.d.ts +95 -0
- package/dist/auth/oAuth2.js +259 -0
- package/dist/eBayApi.d.ts +58 -0
- package/dist/eBayApi.js +93 -0
- package/dist/ebay-api.min.mjs +1 -0
- package/dist/enums/apiEnums.d.ts +49 -0
- package/dist/enums/apiEnums.js +51 -0
- package/dist/enums/index.d.ts +2 -0
- package/dist/enums/index.js +2 -0
- package/dist/enums/restfulEnums.d.ts +970 -0
- package/dist/enums/restfulEnums.js +1013 -0
- package/dist/errors/index.d.ts +66 -0
- package/dist/errors/index.js +184 -0
- package/dist/nanoevents.d.ts +6 -0
- package/dist/nanoevents.js +20 -0
- package/dist/request.d.ts +26 -0
- package/dist/request.js +43 -0
- package/dist/types/apiTypes.d.ts +33 -0
- package/dist/types/apiTypes.js +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/restfulTypes.d.ts +1082 -0
- package/dist/types/restfulTypes.js +1 -0
- package/dist/types/traditonalTypes.d.ts +34 -0
- package/dist/types/traditonalTypes.js +1 -0
- package/lib/api/apiFactory.d.ts +8 -8
- package/lib/api/apiFactory.js +41 -42
- package/lib/api/base.d.ts +3 -6
- package/lib/api/base.js +3 -15
- package/lib/api/index.d.ts +4 -4
- package/lib/api/index.js +4 -5
- package/lib/api/restful/buy/browse/index.d.ts +2 -2
- package/lib/api/restful/buy/browse/index.js +2 -3
- package/lib/api/restful/buy/deal/index.d.ts +1 -1
- package/lib/api/restful/buy/deal/index.js +2 -3
- package/lib/api/restful/buy/feed/index.d.ts +2 -2
- package/lib/api/restful/buy/feed/index.js +2 -3
- package/lib/api/restful/buy/index.d.ts +8 -8
- package/lib/api/restful/buy/index.js +14 -15
- package/lib/api/restful/buy/marketing/index.d.ts +2 -2
- package/lib/api/restful/buy/marketing/index.js +2 -3
- package/lib/api/restful/buy/marketplaceInsights/index.d.ts +2 -2
- package/lib/api/restful/buy/marketplaceInsights/index.js +2 -3
- package/lib/api/restful/buy/offer/index.d.ts +2 -2
- package/lib/api/restful/buy/offer/index.js +2 -3
- package/lib/api/restful/buy/order/index.d.ts +3 -3
- package/lib/api/restful/buy/order/index.js +3 -4
- package/lib/api/restful/commerce/catalog/index.d.ts +2 -2
- package/lib/api/restful/commerce/catalog/index.js +2 -3
- package/lib/api/restful/commerce/charity/index.d.ts +1 -1
- package/lib/api/restful/commerce/charity/index.js +2 -3
- package/lib/api/restful/commerce/identity/index.d.ts +1 -1
- package/lib/api/restful/commerce/identity/index.js +2 -3
- package/lib/api/restful/commerce/index.d.ts +7 -7
- package/lib/api/restful/commerce/index.js +12 -13
- package/lib/api/restful/commerce/notification/index.d.ts +2 -2
- package/lib/api/restful/commerce/notification/index.js +2 -3
- package/lib/api/restful/commerce/taxonomy/index.d.ts +1 -1
- package/lib/api/restful/commerce/taxonomy/index.js +2 -3
- package/lib/api/restful/commerce/translation/index.d.ts +2 -2
- package/lib/api/restful/commerce/translation/index.js +2 -3
- package/lib/api/restful/developer/analytics/index.d.ts +1 -1
- package/lib/api/restful/developer/analytics/index.js +2 -3
- package/lib/api/restful/developer/index.d.ts +3 -3
- package/lib/api/restful/developer/index.js +4 -5
- package/lib/api/restful/developer/keyManagement/index.d.ts +1 -1
- package/lib/api/restful/developer/keyManagement/index.js +2 -3
- package/lib/api/restful/index.d.ts +6 -6
- package/lib/api/restful/index.js +5 -6
- package/lib/api/restful/postOrder/cancellation/index.d.ts +2 -2
- package/lib/api/restful/postOrder/cancellation/index.js +2 -3
- package/lib/api/restful/postOrder/case/index.d.ts +2 -2
- package/lib/api/restful/postOrder/case/index.js +2 -3
- package/lib/api/restful/postOrder/index.d.ts +5 -5
- package/lib/api/restful/postOrder/index.js +8 -9
- package/lib/api/restful/postOrder/inquiry/index.d.ts +2 -2
- package/lib/api/restful/postOrder/inquiry/index.js +2 -3
- package/lib/api/restful/postOrder/return/index.d.ts +3 -3
- package/lib/api/restful/postOrder/return/index.js +2 -3
- package/lib/api/restful/sell/account/index.d.ts +3 -3
- package/lib/api/restful/sell/account/index.js +2 -3
- package/lib/api/restful/sell/analytics/index.d.ts +2 -2
- package/lib/api/restful/sell/analytics/index.js +2 -3
- package/lib/api/restful/sell/compliance/index.d.ts +2 -2
- package/lib/api/restful/sell/compliance/index.js +2 -3
- package/lib/api/restful/sell/feed/index.d.ts +2 -2
- package/lib/api/restful/sell/feed/index.js +4 -5
- package/lib/api/restful/sell/finances/index.d.ts +1 -1
- package/lib/api/restful/sell/finances/index.js +2 -3
- package/lib/api/restful/sell/fulfillment/index.d.ts +2 -2
- package/lib/api/restful/sell/fulfillment/index.js +4 -5
- package/lib/api/restful/sell/index.d.ts +14 -14
- package/lib/api/restful/sell/index.js +26 -27
- package/lib/api/restful/sell/inventory/index.d.ts +2 -2
- package/lib/api/restful/sell/inventory/index.js +2 -3
- package/lib/api/restful/sell/listing/index.d.ts +1 -1
- package/lib/api/restful/sell/listing/index.js +2 -3
- package/lib/api/restful/sell/logistics/index.d.ts +1 -1
- package/lib/api/restful/sell/logistics/index.js +2 -3
- package/lib/api/restful/sell/marketing/index.d.ts +2 -2
- package/lib/api/restful/sell/marketing/index.js +2 -3
- package/lib/api/restful/sell/metadata/index.d.ts +1 -1
- package/lib/api/restful/sell/metadata/index.js +2 -3
- package/lib/api/restful/sell/negotiation/index.d.ts +1 -1
- package/lib/api/restful/sell/negotiation/index.js +2 -3
- package/lib/api/restful/sell/recommendation/index.d.ts +2 -2
- package/lib/api/restful/sell/recommendation/index.js +2 -3
- package/lib/api/traditional/XMLRequest.d.ts +15 -11
- package/lib/api/traditional/XMLRequest.js +17 -33
- package/lib/api/traditional/clientAlerts/index.d.ts +1 -1
- package/lib/api/traditional/clientAlerts/index.js +2 -3
- package/lib/api/traditional/clientAlerts/types.js +0 -1
- package/lib/api/traditional/fields.d.ts +1 -1
- package/lib/api/traditional/fields.js +0 -1
- package/lib/api/traditional/finding/index.js +0 -1
- package/lib/api/traditional/index.d.ts +2 -2
- package/lib/api/traditional/index.js +26 -21
- package/lib/api/traditional/merchandising/index.js +0 -1
- package/lib/api/traditional/shopping/index.js +0 -1
- package/lib/api/traditional/trading/index.js +0 -1
- package/lib/auth/authNAuth.d.ts +4 -4
- package/lib/auth/authNAuth.js +12 -13
- package/lib/auth/index.d.ts +5 -5
- package/lib/auth/index.js +6 -7
- package/lib/auth/oAuth2.d.ts +11 -6
- package/lib/auth/oAuth2.js +11 -7
- package/lib/eBayApi.d.ts +58 -0
- package/lib/eBayApi.js +130 -0
- package/lib/ebay-api.min.js +1 -2
- package/lib/enums/apiEnums.js +0 -1
- package/lib/enums/index.d.ts +2 -2
- package/lib/enums/index.js +7 -4
- package/lib/enums/restfulEnums.js +0 -1
- package/lib/errors/index.js +0 -1
- package/lib/index.d.ts +1 -55
- package/lib/index.js +2 -92
- package/lib/nanoevents.d.ts +6 -0
- package/lib/nanoevents.js +24 -0
- package/lib/package.json +3 -0
- package/lib/request.d.ts +6 -6
- package/lib/request.js +2 -3
- package/lib/types/apiTypes.d.ts +10 -10
- package/lib/types/apiTypes.js +0 -1
- package/lib/types/index.d.ts +3 -3
- package/lib/types/index.js +8 -5
- package/lib/types/restfulTypes.d.ts +191 -191
- package/lib/types/restfulTypes.js +0 -1
- package/lib/types/traditonalTypes.d.ts +15 -15
- package/lib/types/traditonalTypes.js +0 -1
- package/package.json +98 -33
- package/lib/api/apiFactory.js.map +0 -1
- package/lib/api/base.js.map +0 -1
- package/lib/api/index.js.map +0 -1
- package/lib/api/restful/buy/browse/index.js.map +0 -1
- package/lib/api/restful/buy/deal/index.js.map +0 -1
- package/lib/api/restful/buy/feed/index.js.map +0 -1
- package/lib/api/restful/buy/index.js.map +0 -1
- package/lib/api/restful/buy/marketing/index.js.map +0 -1
- package/lib/api/restful/buy/marketplaceInsights/index.js.map +0 -1
- package/lib/api/restful/buy/offer/index.js.map +0 -1
- package/lib/api/restful/buy/order/index.js.map +0 -1
- package/lib/api/restful/commerce/catalog/index.js.map +0 -1
- package/lib/api/restful/commerce/charity/index.js.map +0 -1
- package/lib/api/restful/commerce/identity/index.js.map +0 -1
- package/lib/api/restful/commerce/index.js.map +0 -1
- package/lib/api/restful/commerce/notification/index.js.map +0 -1
- package/lib/api/restful/commerce/taxonomy/index.js.map +0 -1
- package/lib/api/restful/commerce/translation/index.js.map +0 -1
- package/lib/api/restful/developer/analytics/index.js.map +0 -1
- package/lib/api/restful/developer/index.js.map +0 -1
- package/lib/api/restful/developer/keyManagement/index.js.map +0 -1
- package/lib/api/restful/index.js.map +0 -1
- package/lib/api/restful/postOrder/cancellation/index.js.map +0 -1
- package/lib/api/restful/postOrder/case/index.js.map +0 -1
- package/lib/api/restful/postOrder/index.js.map +0 -1
- package/lib/api/restful/postOrder/inquiry/index.js.map +0 -1
- package/lib/api/restful/postOrder/return/index.js.map +0 -1
- package/lib/api/restful/sell/account/index.js.map +0 -1
- package/lib/api/restful/sell/analytics/index.js.map +0 -1
- package/lib/api/restful/sell/compliance/index.js.map +0 -1
- package/lib/api/restful/sell/feed/index.js.map +0 -1
- package/lib/api/restful/sell/finances/index.js.map +0 -1
- package/lib/api/restful/sell/fulfillment/index.js.map +0 -1
- package/lib/api/restful/sell/index.js.map +0 -1
- package/lib/api/restful/sell/inventory/index.js.map +0 -1
- package/lib/api/restful/sell/listing/index.js.map +0 -1
- package/lib/api/restful/sell/logistics/index.js.map +0 -1
- package/lib/api/restful/sell/marketing/index.js.map +0 -1
- package/lib/api/restful/sell/metadata/index.js.map +0 -1
- package/lib/api/restful/sell/negotiation/index.js.map +0 -1
- package/lib/api/restful/sell/recommendation/index.js.map +0 -1
- package/lib/api/traditional/XMLRequest.js.map +0 -1
- package/lib/api/traditional/clientAlerts/index.js.map +0 -1
- package/lib/api/traditional/clientAlerts/types.js.map +0 -1
- package/lib/api/traditional/fields.js.map +0 -1
- package/lib/api/traditional/finding/index.js.map +0 -1
- package/lib/api/traditional/index.js.map +0 -1
- package/lib/api/traditional/merchandising/index.js.map +0 -1
- package/lib/api/traditional/shopping/index.js.map +0 -1
- package/lib/api/traditional/trading/index.js.map +0 -1
- package/lib/auth/authNAuth.js.map +0 -1
- package/lib/auth/index.js.map +0 -1
- package/lib/auth/oAuth2.js.map +0 -1
- package/lib/ebay-api.min.js.map +0 -1
- package/lib/enums/apiEnums.js.map +0 -1
- package/lib/enums/index.js.map +0 -1
- package/lib/enums/restfulEnums.js.map +0 -1
- package/lib/errors/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/request.js.map +0 -1
- package/lib/types/apiTypes.js.map +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib/types/restfulTypes.js.map +0 -1
- package/lib/types/traditonalTypes.js.map +0 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import Restful from '../../index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Use the Taxonomy API to discover the most appropriate eBay categories under which sellers can offer inventory items
|
|
5
|
+
* for sale, and the most likely categories under which buyers can browse or search for items to purchase.
|
|
6
|
+
*/
|
|
7
|
+
export default class Taxonomy extends Restful {
|
|
8
|
+
static id: string;
|
|
9
|
+
get basePath(): string;
|
|
10
|
+
/**
|
|
11
|
+
* A given eBay marketplace might use multiple category trees, but one of those trees is considered to be the
|
|
12
|
+
* default for that marketplace.
|
|
13
|
+
*
|
|
14
|
+
* @param marketplaceId The ID of the eBay marketplace for which the category tree ID is being requested.
|
|
15
|
+
*/
|
|
16
|
+
getDefaultCategoryTreeId(marketplaceId: string): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* This call retrieves the complete category tree that is identified by the category_tree_id parameter.
|
|
19
|
+
*
|
|
20
|
+
* @param categoryTreeId
|
|
21
|
+
*/
|
|
22
|
+
getCategoryTree(categoryTreeId: string): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* This call retrieves the details of all nodes of the category tree hierarchy (the subtree) below a specified
|
|
25
|
+
* category of a category tree.
|
|
26
|
+
*
|
|
27
|
+
* @param categoryTreeId The unique identifier of the eBay category tree from which a category subtree is being
|
|
28
|
+
* requested.
|
|
29
|
+
* @param categoryId The unique identifier of the category at the top of the subtree being requested.
|
|
30
|
+
*/
|
|
31
|
+
getCategorySubtree(categoryTreeId: string, categoryId: string): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* This call returns an array of category tree leaf nodes in the specified category tree that are considered by eBay
|
|
34
|
+
* to most closely correspond to the query string q.
|
|
35
|
+
*
|
|
36
|
+
* @param categoryTreeId The unique identifier of the eBay category tree for which suggested nodes are being
|
|
37
|
+
* requested.
|
|
38
|
+
* @param q A quoted string that describes or characterizes the item being offered for sale.
|
|
39
|
+
*/
|
|
40
|
+
getCategorySuggestions(categoryTreeId: string, q: string): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* This call returns a list of aspects that are appropriate or necessary for accurately describing items in the
|
|
43
|
+
* specified leaf category.
|
|
44
|
+
*
|
|
45
|
+
* @param categoryTreeId The unique identifier of the eBay category tree from which the specified category's
|
|
46
|
+
* aspects are being requested.
|
|
47
|
+
* @param categoryId The unique identifier of the leaf category for which aspects are being requested.
|
|
48
|
+
*/
|
|
49
|
+
getItemAspectsForCategory(categoryTreeId: string, categoryId: string): Promise<any>;
|
|
50
|
+
/**
|
|
51
|
+
* This call retrieves the compatible vehicle aspects that are used to define a motor vehicle that is compatible
|
|
52
|
+
* with a motor vehicle part or accessory.
|
|
53
|
+
*
|
|
54
|
+
* @param categoryTreeId This is the unique identifier of category tree. The following is the list of
|
|
55
|
+
* category_tree_id values and the eBay marketplaces that they represent.
|
|
56
|
+
*
|
|
57
|
+
* @param categoryId The unique identifier of an eBay category.
|
|
58
|
+
*/
|
|
59
|
+
getCompatibilityProperties(categoryTreeId: string, categoryId: string): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* This call retrieves applicable compatible vehicle property values based on the specified eBay marketplace,
|
|
62
|
+
* specified eBay category, and filters used in the request.
|
|
63
|
+
*
|
|
64
|
+
* @param categoryTreeId This is the unique identifier of the category tree.
|
|
65
|
+
* @param categoryId The unique identifier of an eBay category.
|
|
66
|
+
* @param compatibilityProperty One compatible vehicle property applicable to the specified eBay marketplace and
|
|
67
|
+
* eBay category is specified in this required filter.
|
|
68
|
+
*/
|
|
69
|
+
getCompatibilityPropertyValues(categoryTreeId: string, categoryId: string, compatibilityProperty: string): Promise<any>;
|
|
70
|
+
/**
|
|
71
|
+
* This call returns a complete list of aspects for all of the leaf categories that belong to an eBay marketplace.
|
|
72
|
+
*
|
|
73
|
+
* @param categoryTreeId
|
|
74
|
+
*
|
|
75
|
+
* @return A JSON GZIP compressed file buffer
|
|
76
|
+
*/
|
|
77
|
+
fetchItemAspects(categoryTreeId: string): Promise<Buffer>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import Restful from '../../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Use the Taxonomy API to discover the most appropriate eBay categories under which sellers can offer inventory items
|
|
4
|
+
* for sale, and the most likely categories under which buyers can browse or search for items to purchase.
|
|
5
|
+
*/
|
|
6
|
+
export default class Taxonomy extends Restful {
|
|
7
|
+
get basePath() {
|
|
8
|
+
return '/commerce/taxonomy/v1';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A given eBay marketplace might use multiple category trees, but one of those trees is considered to be the
|
|
12
|
+
* default for that marketplace.
|
|
13
|
+
*
|
|
14
|
+
* @param marketplaceId The ID of the eBay marketplace for which the category tree ID is being requested.
|
|
15
|
+
*/
|
|
16
|
+
getDefaultCategoryTreeId(marketplaceId) {
|
|
17
|
+
return this.get(`/get_default_category_tree_id`, {
|
|
18
|
+
params: {
|
|
19
|
+
marketplace_id: marketplaceId
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This call retrieves the complete category tree that is identified by the category_tree_id parameter.
|
|
25
|
+
*
|
|
26
|
+
* @param categoryTreeId
|
|
27
|
+
*/
|
|
28
|
+
getCategoryTree(categoryTreeId) {
|
|
29
|
+
const cId = encodeURIComponent(categoryTreeId);
|
|
30
|
+
return this.get(`/category_tree/${cId}`);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* This call retrieves the details of all nodes of the category tree hierarchy (the subtree) below a specified
|
|
34
|
+
* category of a category tree.
|
|
35
|
+
*
|
|
36
|
+
* @param categoryTreeId The unique identifier of the eBay category tree from which a category subtree is being
|
|
37
|
+
* requested.
|
|
38
|
+
* @param categoryId The unique identifier of the category at the top of the subtree being requested.
|
|
39
|
+
*/
|
|
40
|
+
getCategorySubtree(categoryTreeId, categoryId) {
|
|
41
|
+
categoryTreeId = encodeURIComponent(categoryTreeId);
|
|
42
|
+
return this.get(`/category_tree/${categoryTreeId}/get_category_subtree`, {
|
|
43
|
+
params: {
|
|
44
|
+
category_id: categoryId
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* This call returns an array of category tree leaf nodes in the specified category tree that are considered by eBay
|
|
50
|
+
* to most closely correspond to the query string q.
|
|
51
|
+
*
|
|
52
|
+
* @param categoryTreeId The unique identifier of the eBay category tree for which suggested nodes are being
|
|
53
|
+
* requested.
|
|
54
|
+
* @param q A quoted string that describes or characterizes the item being offered for sale.
|
|
55
|
+
*/
|
|
56
|
+
getCategorySuggestions(categoryTreeId, q) {
|
|
57
|
+
return this.get(`/category_tree/${categoryTreeId}/get_category_suggestions`, {
|
|
58
|
+
params: {
|
|
59
|
+
q
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* This call returns a list of aspects that are appropriate or necessary for accurately describing items in the
|
|
65
|
+
* specified leaf category.
|
|
66
|
+
*
|
|
67
|
+
* @param categoryTreeId The unique identifier of the eBay category tree from which the specified category's
|
|
68
|
+
* aspects are being requested.
|
|
69
|
+
* @param categoryId The unique identifier of the leaf category for which aspects are being requested.
|
|
70
|
+
*/
|
|
71
|
+
getItemAspectsForCategory(categoryTreeId, categoryId) {
|
|
72
|
+
categoryTreeId = encodeURIComponent(categoryTreeId);
|
|
73
|
+
return this.get(`/category_tree/${categoryTreeId}/get_item_aspects_for_category`, {
|
|
74
|
+
params: {
|
|
75
|
+
category_id: categoryId
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* This call retrieves the compatible vehicle aspects that are used to define a motor vehicle that is compatible
|
|
81
|
+
* with a motor vehicle part or accessory.
|
|
82
|
+
*
|
|
83
|
+
* @param categoryTreeId This is the unique identifier of category tree. The following is the list of
|
|
84
|
+
* category_tree_id values and the eBay marketplaces that they represent.
|
|
85
|
+
*
|
|
86
|
+
* @param categoryId The unique identifier of an eBay category.
|
|
87
|
+
*/
|
|
88
|
+
getCompatibilityProperties(categoryTreeId, categoryId) {
|
|
89
|
+
categoryTreeId = encodeURIComponent(categoryTreeId);
|
|
90
|
+
return this.get(`/category_tree/${categoryTreeId}/get_compatibility_properties`, {
|
|
91
|
+
params: {
|
|
92
|
+
category_id: categoryId
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* This call retrieves applicable compatible vehicle property values based on the specified eBay marketplace,
|
|
98
|
+
* specified eBay category, and filters used in the request.
|
|
99
|
+
*
|
|
100
|
+
* @param categoryTreeId This is the unique identifier of the category tree.
|
|
101
|
+
* @param categoryId The unique identifier of an eBay category.
|
|
102
|
+
* @param compatibilityProperty One compatible vehicle property applicable to the specified eBay marketplace and
|
|
103
|
+
* eBay category is specified in this required filter.
|
|
104
|
+
*/
|
|
105
|
+
getCompatibilityPropertyValues(categoryTreeId, categoryId, compatibilityProperty) {
|
|
106
|
+
categoryTreeId = encodeURIComponent(categoryTreeId);
|
|
107
|
+
return this.get(`/category_tree/${categoryTreeId}/get_compatibility_property_values`, {
|
|
108
|
+
params: {
|
|
109
|
+
category_id: categoryId,
|
|
110
|
+
compatibility_property: compatibilityProperty
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* This call returns a complete list of aspects for all of the leaf categories that belong to an eBay marketplace.
|
|
116
|
+
*
|
|
117
|
+
* @param categoryTreeId
|
|
118
|
+
*
|
|
119
|
+
* @return A JSON GZIP compressed file buffer
|
|
120
|
+
*/
|
|
121
|
+
fetchItemAspects(categoryTreeId) {
|
|
122
|
+
categoryTreeId = encodeURIComponent(categoryTreeId);
|
|
123
|
+
return this.get(`/category_tree/${categoryTreeId}/fetch_item_aspects`, {
|
|
124
|
+
responseType: 'arraybuffer'
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
Taxonomy.id = 'Taxonomy';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Restful from '../../index.js';
|
|
2
|
+
import { TranslateRequest } from '../../../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* This API allows 3rd party developers to translate item title, description, search query.
|
|
5
|
+
*/
|
|
6
|
+
export default class Translation extends Restful {
|
|
7
|
+
static id: string;
|
|
8
|
+
get basePath(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Translates input text inot a given language.
|
|
11
|
+
*
|
|
12
|
+
* @param body TranslateRequest
|
|
13
|
+
*/
|
|
14
|
+
translate(body: TranslateRequest): Promise<any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Restful from '../../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* This API allows 3rd party developers to translate item title, description, search query.
|
|
4
|
+
*/
|
|
5
|
+
export default class Translation extends Restful {
|
|
6
|
+
get basePath() {
|
|
7
|
+
return '/commerce/translation/v1_beta';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Translates input text inot a given language.
|
|
11
|
+
*
|
|
12
|
+
* @param body TranslateRequest
|
|
13
|
+
*/
|
|
14
|
+
translate(body) {
|
|
15
|
+
return this.post(`/translate`, body);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
Translation.id = 'Translation';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Restful from '../../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* This method retrieves the call limit and utilization data for an application.
|
|
4
|
+
*/
|
|
5
|
+
export default class Analytics extends Restful {
|
|
6
|
+
static id: string;
|
|
7
|
+
get basePath(): string;
|
|
8
|
+
/**
|
|
9
|
+
* This method retrieves the call limit and utilization data for an application.
|
|
10
|
+
*
|
|
11
|
+
* @param apiContext This optional query parameter filters the result to include only the specified API context.
|
|
12
|
+
* @param apiName This optional query parameter filters the result to include only the APIs specified.
|
|
13
|
+
*/
|
|
14
|
+
getRateLimits(apiContext: string, apiName: string): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* This method retrieves the call limit and utilization data for an application user.
|
|
17
|
+
*
|
|
18
|
+
* @param apiContext This optional query parameter filters the result to include only the specified API context.
|
|
19
|
+
* @param apiName This optional query parameter filters the result to include only the APIs specified.
|
|
20
|
+
*/
|
|
21
|
+
getUserRateLimits(apiContext: string, apiName: string): Promise<any>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Restful from '../../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* This method retrieves the call limit and utilization data for an application.
|
|
4
|
+
*/
|
|
5
|
+
export default class Analytics extends Restful {
|
|
6
|
+
get basePath() {
|
|
7
|
+
return '/developer/analytics/v1_beta';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* This method retrieves the call limit and utilization data for an application.
|
|
11
|
+
*
|
|
12
|
+
* @param apiContext This optional query parameter filters the result to include only the specified API context.
|
|
13
|
+
* @param apiName This optional query parameter filters the result to include only the APIs specified.
|
|
14
|
+
*/
|
|
15
|
+
getRateLimits(apiContext, apiName) {
|
|
16
|
+
return this.get(`/rate_limit/`, {
|
|
17
|
+
params: {
|
|
18
|
+
api_context: apiContext,
|
|
19
|
+
api_name: apiName
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This method retrieves the call limit and utilization data for an application user.
|
|
25
|
+
*
|
|
26
|
+
* @param apiContext This optional query parameter filters the result to include only the specified API context.
|
|
27
|
+
* @param apiName This optional query parameter filters the result to include only the APIs specified.
|
|
28
|
+
*/
|
|
29
|
+
getUserRateLimits(apiContext, apiName) {
|
|
30
|
+
return this.get(`/user_rate_limit/`, {
|
|
31
|
+
params: {
|
|
32
|
+
api_context: apiContext,
|
|
33
|
+
api_name: apiName
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
Analytics.id = 'Analytics';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Restful from '../../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* This method retrieves the call limit and utilization data for an application.
|
|
4
|
+
*/
|
|
5
|
+
export default class KeyManagement extends Restful {
|
|
6
|
+
static id: string;
|
|
7
|
+
get subdomain(): string;
|
|
8
|
+
get basePath(): string;
|
|
9
|
+
/**
|
|
10
|
+
* This method returns the <b>Public Key</b>, <b>Public Key as JWE</b>,
|
|
11
|
+
* and metadata for all keypairs associated with the application key making the call.
|
|
12
|
+
*/
|
|
13
|
+
getSigningKeys(): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* his method creates keypairs.
|
|
16
|
+
*/
|
|
17
|
+
createSigningKey(data: {
|
|
18
|
+
signingKeyCipher: string;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* This method returns the <b>Public Key</b>, <b>Public Key as JWE</b>,
|
|
22
|
+
* and metadata for a specified <code>signingKeyId</code> associated with the application key making the call.
|
|
23
|
+
* @param signingKeyId the signin key
|
|
24
|
+
*/
|
|
25
|
+
getSigningKey(signingKeyId: string): Promise<any>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Restful from '../../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* This method retrieves the call limit and utilization data for an application.
|
|
4
|
+
*/
|
|
5
|
+
export default class KeyManagement extends Restful {
|
|
6
|
+
get subdomain() {
|
|
7
|
+
return 'apiz';
|
|
8
|
+
}
|
|
9
|
+
get basePath() {
|
|
10
|
+
return '/developer/key_management/v1';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* This method returns the <b>Public Key</b>, <b>Public Key as JWE</b>,
|
|
14
|
+
* and metadata for all keypairs associated with the application key making the call.
|
|
15
|
+
*/
|
|
16
|
+
getSigningKeys() {
|
|
17
|
+
return this.get(`/signing_key`);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* his method creates keypairs.
|
|
21
|
+
*/
|
|
22
|
+
createSigningKey(data) {
|
|
23
|
+
return this.post(`/signing_key`, data);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* This method returns the <b>Public Key</b>, <b>Public Key as JWE</b>,
|
|
27
|
+
* and metadata for a specified <code>signingKeyId</code> associated with the application key making the call.
|
|
28
|
+
* @param signingKeyId the signin key
|
|
29
|
+
*/
|
|
30
|
+
getSigningKey(signingKeyId) {
|
|
31
|
+
return this.get(`/signing_key/${signingKeyId}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
KeyManagement.id = 'KeyManagement';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Api from '../index.js';
|
|
2
|
+
import Auth from '../../auth/index.js';
|
|
3
|
+
import { IEBayApiRequest } from '../../request.js';
|
|
4
|
+
import { ApiRequestConfig, AppConfig } from '../../types/index.js';
|
|
5
|
+
export declare const defaultApiHeaders: Record<string, string>;
|
|
6
|
+
export type RestfulApiConfig = {
|
|
7
|
+
subdomain?: string;
|
|
8
|
+
useIaf?: boolean;
|
|
9
|
+
apiVersion?: string;
|
|
10
|
+
basePath?: string;
|
|
11
|
+
schema?: string;
|
|
12
|
+
sandbox?: boolean;
|
|
13
|
+
tld?: string;
|
|
14
|
+
} & ApiRequestConfig;
|
|
15
|
+
export type ApiRequest = {
|
|
16
|
+
method: keyof IEBayApiRequest;
|
|
17
|
+
url: string;
|
|
18
|
+
config?: any;
|
|
19
|
+
data?: any;
|
|
20
|
+
};
|
|
21
|
+
export interface IRestful {
|
|
22
|
+
new (config: AppConfig, req?: IEBayApiRequest, auth?: Auth, apiConfig?: RestfulApiConfig): Restful;
|
|
23
|
+
id: string;
|
|
24
|
+
}
|
|
25
|
+
export default abstract class Restful extends Api {
|
|
26
|
+
readonly apiConfig: Required<RestfulApiConfig>;
|
|
27
|
+
constructor(config: AppConfig, req?: IEBayApiRequest, auth?: Auth, apiConfig?: RestfulApiConfig);
|
|
28
|
+
static buildServerUrl(schema: string, subdomain: string, sandbox: boolean, tld: string): string;
|
|
29
|
+
abstract get basePath(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Enable to supports the use of OAuth tokens for user authorization.
|
|
32
|
+
*/
|
|
33
|
+
get useIaf(): boolean;
|
|
34
|
+
get schema(): string;
|
|
35
|
+
get subdomain(): string;
|
|
36
|
+
get apiVersionPath(): string;
|
|
37
|
+
getServerUrl({ schema, subdomain, apiVersion, basePath, sandbox, tld }: Required<RestfulApiConfig>): string;
|
|
38
|
+
getApiConfig(): Required<RestfulApiConfig>;
|
|
39
|
+
get baseUrl(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new instances of it self with specified api config.
|
|
42
|
+
* @param apiConfig
|
|
43
|
+
*/
|
|
44
|
+
api(apiConfig: RestfulApiConfig): this;
|
|
45
|
+
/**
|
|
46
|
+
* Use "apix" subdomain
|
|
47
|
+
*/
|
|
48
|
+
get apix(): this;
|
|
49
|
+
/**
|
|
50
|
+
* Use "apiz" subdomain
|
|
51
|
+
*/
|
|
52
|
+
get apiz(): this;
|
|
53
|
+
get(url: string, config?: any, apiConfig?: RestfulApiConfig): Promise<any>;
|
|
54
|
+
delete(url: string, config?: any, apiConfig?: RestfulApiConfig): Promise<any>;
|
|
55
|
+
post(url: string, data?: any, config?: any, apiConfig?: RestfulApiConfig): Promise<any>;
|
|
56
|
+
put(url: string, data?: any, config?: any, apiConfig?: RestfulApiConfig): Promise<any>;
|
|
57
|
+
get additionalHeaders(): any;
|
|
58
|
+
enrichRequestConfig(config?: any, apiConfig?: Required<RestfulApiConfig>): Promise<any>;
|
|
59
|
+
private doRequest;
|
|
60
|
+
private shouldRefreshToken;
|
|
61
|
+
private request;
|
|
62
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import Api from '../index.js';
|
|
2
|
+
import { EBayInvalidAccessToken, handleEBayError } from '../../errors/index.js';
|
|
3
|
+
export const defaultApiHeaders = {
|
|
4
|
+
'Content-Type': 'application/json',
|
|
5
|
+
'Cache-Control': 'no-cache',
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
...(typeof window === 'undefined' ? {
|
|
8
|
+
'Accept-Encoding': 'application/gzip'
|
|
9
|
+
} : {})
|
|
10
|
+
};
|
|
11
|
+
const additionalHeaders = {
|
|
12
|
+
marketplaceId: 'X-EBAY-C-MARKETPLACE-ID',
|
|
13
|
+
endUserCtx: 'X-EBAY-C-ENDUSERCTX',
|
|
14
|
+
acceptLanguage: 'Accept-Language',
|
|
15
|
+
contentLanguage: 'Content-Language',
|
|
16
|
+
};
|
|
17
|
+
export default class Restful extends Api {
|
|
18
|
+
constructor(config, req, auth, apiConfig = {}) {
|
|
19
|
+
super(config, req, auth);
|
|
20
|
+
this.apiConfig = {
|
|
21
|
+
...this.getApiConfig(),
|
|
22
|
+
...apiConfig
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
static buildServerUrl(schema, subdomain, sandbox, tld) {
|
|
26
|
+
return `${schema}${subdomain}.${sandbox ? 'sandbox.' : ''}${tld}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Enable to supports the use of OAuth tokens for user authorization.
|
|
30
|
+
*/
|
|
31
|
+
get useIaf() {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
get schema() {
|
|
35
|
+
return 'https://';
|
|
36
|
+
}
|
|
37
|
+
get subdomain() {
|
|
38
|
+
return 'api';
|
|
39
|
+
}
|
|
40
|
+
get apiVersionPath() {
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
getServerUrl({ schema, subdomain, apiVersion, basePath, sandbox, tld }) {
|
|
44
|
+
return Restful.buildServerUrl(schema, subdomain, sandbox, tld) + apiVersion + basePath;
|
|
45
|
+
}
|
|
46
|
+
getApiConfig() {
|
|
47
|
+
return {
|
|
48
|
+
subdomain: this.subdomain,
|
|
49
|
+
useIaf: this.useIaf,
|
|
50
|
+
apiVersion: this.apiVersionPath,
|
|
51
|
+
basePath: this.basePath,
|
|
52
|
+
schema: this.schema,
|
|
53
|
+
sandbox: this.config.sandbox,
|
|
54
|
+
tld: 'ebay.com',
|
|
55
|
+
headers: {},
|
|
56
|
+
returnResponse: false
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
get baseUrl() {
|
|
60
|
+
return this.getServerUrl(this.apiConfig);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a new instances of it self with specified api config.
|
|
64
|
+
* @param apiConfig
|
|
65
|
+
*/
|
|
66
|
+
api(apiConfig) {
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
return new this.constructor(this.config, this.req, this.auth, apiConfig);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Use "apix" subdomain
|
|
72
|
+
*/
|
|
73
|
+
get apix() {
|
|
74
|
+
return this.api({ subdomain: 'apix' });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Use "apiz" subdomain
|
|
78
|
+
*/
|
|
79
|
+
get apiz() {
|
|
80
|
+
return this.api({ subdomain: 'apiz' });
|
|
81
|
+
}
|
|
82
|
+
async get(url, config = {}, apiConfig) {
|
|
83
|
+
return this.doRequest({ method: 'get', url, config }, apiConfig);
|
|
84
|
+
}
|
|
85
|
+
async delete(url, config = {}, apiConfig) {
|
|
86
|
+
return this.doRequest({ method: 'delete', url, config }, apiConfig);
|
|
87
|
+
}
|
|
88
|
+
async post(url, data, config = {}, apiConfig) {
|
|
89
|
+
return this.doRequest({ method: 'post', url, data, config }, apiConfig);
|
|
90
|
+
}
|
|
91
|
+
async put(url, data, config = {}, apiConfig) {
|
|
92
|
+
return this.doRequest({ method: 'put', url, data, config }, apiConfig);
|
|
93
|
+
}
|
|
94
|
+
get additionalHeaders() {
|
|
95
|
+
return Object.keys(additionalHeaders)
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
.filter(key => typeof this.config[key] !== 'undefined')
|
|
98
|
+
.reduce((headers, key) => {
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
headers[additionalHeaders[key]] = this.config[key];
|
|
101
|
+
return headers;
|
|
102
|
+
}, {});
|
|
103
|
+
}
|
|
104
|
+
async enrichRequestConfig(config = {}, apiConfig = this.apiConfig) {
|
|
105
|
+
const authHeader = await this.auth.getHeaderAuthorization(apiConfig.useIaf);
|
|
106
|
+
const headers = {
|
|
107
|
+
...defaultApiHeaders,
|
|
108
|
+
...this.additionalHeaders,
|
|
109
|
+
...authHeader,
|
|
110
|
+
...apiConfig.headers
|
|
111
|
+
};
|
|
112
|
+
return {
|
|
113
|
+
...config,
|
|
114
|
+
headers: {
|
|
115
|
+
...(config.headers || {}),
|
|
116
|
+
...headers
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
async doRequest(payload, apiConfig) {
|
|
121
|
+
try {
|
|
122
|
+
return await this.request(payload, apiConfig);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
if (this.shouldRefreshToken(error)) {
|
|
126
|
+
// Try again and refresh token
|
|
127
|
+
return await this.request(payload, apiConfig, true /* refresh token */);
|
|
128
|
+
}
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
shouldRefreshToken(error) {
|
|
133
|
+
if (!this.config.autoRefreshToken) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
if (error.name === EBayInvalidAccessToken.name) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
return error?.meta?.res?.status === 401 && this.apiConfig.basePath === '/post-order/v2';
|
|
140
|
+
}
|
|
141
|
+
async request(apiRequest, apiConfig = this.apiConfig, refreshToken = false) {
|
|
142
|
+
const { url, method, data, config } = apiRequest;
|
|
143
|
+
const apiCfg = { ...this.apiConfig, ...apiConfig };
|
|
144
|
+
const endpoint = this.getServerUrl(apiCfg) + url;
|
|
145
|
+
try {
|
|
146
|
+
if (refreshToken) {
|
|
147
|
+
await this.auth.OAuth2.refreshToken();
|
|
148
|
+
}
|
|
149
|
+
const enrichedConfig = await this.enrichRequestConfig(config, apiCfg);
|
|
150
|
+
const args = ['get', 'delete'].includes(method) ? [enrichedConfig] : [data, enrichedConfig];
|
|
151
|
+
// @ts-ignore
|
|
152
|
+
const response = await this.req[method](endpoint, ...args);
|
|
153
|
+
if (this.apiConfig.returnResponse) {
|
|
154
|
+
return response;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
return response.data;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (ex) {
|
|
161
|
+
handleEBayError(ex);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import Restful from '../../index.js';
|
|
2
|
+
import { CancellationSearchParams, ConfirmRefundRequest, CreateCancelRequest, RejectCancelRequest } from '../../../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Post-Order Cancellation API
|
|
5
|
+
*/
|
|
6
|
+
export default class Cancellation extends Restful {
|
|
7
|
+
static id: string;
|
|
8
|
+
get basePath(): string;
|
|
9
|
+
get useIaf(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Seller approves a cancellation request
|
|
12
|
+
*
|
|
13
|
+
* @param cancelId The unique eBay-assigned identifier of the cancellation request to be approved.
|
|
14
|
+
*/
|
|
15
|
+
approveCancellationRequest(cancelId: string): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Check the eligibility of an order cancellation
|
|
18
|
+
*
|
|
19
|
+
* @param legacyOrderId The unique ID of the order being canceled or the order being considered for cancellation.
|
|
20
|
+
*/
|
|
21
|
+
checkCancellationEligibility(legacyOrderId: string): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Buyer confirms the refund from a cancellation was received
|
|
24
|
+
*
|
|
25
|
+
* @param cancelId The unique eBay-assigned identifier of the cancellation/refund being confirmed.
|
|
26
|
+
* @param payload the ConfirmRefundReceivedPayload
|
|
27
|
+
*/
|
|
28
|
+
confirmRefundReceived(cancelId: string, payload?: ConfirmRefundRequest): Promise<any>;
|
|
29
|
+
/**
|
|
30
|
+
* Request or perform an order cancellation.
|
|
31
|
+
*
|
|
32
|
+
* @param payload the CreateCancelRequest
|
|
33
|
+
*/
|
|
34
|
+
createCancellation(payload: CreateCancelRequest): Promise<any>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve the details of an order cancellation.
|
|
37
|
+
*
|
|
38
|
+
* @param cancelId Supply in this path parameter the unique eBay-assigned ID of the cancellation request to
|
|
39
|
+
* retrieve.
|
|
40
|
+
* @param fieldGroups The value set in this query parameter controls the level of detail that is returned in the
|
|
41
|
+
* response.
|
|
42
|
+
*/
|
|
43
|
+
getCancellation(cancelId: string, fieldGroups?: string): Promise<any>;
|
|
44
|
+
/**
|
|
45
|
+
* Seller rejects a cancellation request.
|
|
46
|
+
*
|
|
47
|
+
* @param cancelId The unique eBay-assigned identifier of the cancellation request to be rejected.
|
|
48
|
+
* @param payload the RejectCancelRequest
|
|
49
|
+
*/
|
|
50
|
+
rejectCancellationRequest(cancelId: string, payload?: RejectCancelRequest): Promise<any>;
|
|
51
|
+
/**
|
|
52
|
+
* Search for cancellations.
|
|
53
|
+
*
|
|
54
|
+
* @param params the SearchParams
|
|
55
|
+
*/
|
|
56
|
+
search(params: CancellationSearchParams): Promise<any>;
|
|
57
|
+
}
|