ebay-api 1.13.7 → 6.2.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/LICENSE +18 -19
- package/README.md +512 -118
- package/lib/api/apiFactory.d.ts +27 -0
- package/lib/api/apiFactory.js +100 -0
- package/lib/api/apiFactory.js.map +1 -0
- package/lib/api/base.d.ts +13 -0
- package/lib/api/base.js +25 -0
- package/lib/api/base.js.map +1 -0
- package/lib/api/index.d.ts +11 -0
- package/lib/api/index.js +18 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/restful/buy/browse/index.d.ts +84 -0
- package/lib/api/restful/buy/browse/index.js +142 -0
- package/lib/api/restful/buy/browse/index.js.map +1 -0
- package/lib/api/restful/buy/deal/index.d.ts +55 -0
- package/lib/api/restful/buy/deal/index.js +80 -0
- package/lib/api/restful/buy/deal/index.js.map +1 -0
- package/lib/api/restful/buy/feed/index.d.ts +43 -0
- package/lib/api/restful/buy/feed/index.js +85 -0
- package/lib/api/restful/buy/feed/index.js.map +1 -0
- package/lib/api/restful/buy/index.d.ts +17 -0
- package/lib/api/restful/buy/index.js +21 -0
- package/lib/api/restful/buy/index.js.map +1 -0
- package/lib/api/restful/buy/marketing/index.d.ts +27 -0
- package/lib/api/restful/buy/marketing/index.js +51 -0
- package/lib/api/restful/buy/marketing/index.js.map +1 -0
- package/lib/api/restful/buy/marketplaceInsights/index.d.ts +28 -0
- package/lib/api/restful/buy/marketplaceInsights/index.js +51 -0
- package/lib/api/restful/buy/marketplaceInsights/index.js.map +1 -0
- package/lib/api/restful/buy/offer/index.d.ts +23 -0
- package/lib/api/restful/buy/offer/index.js +37 -0
- package/lib/api/restful/buy/offer/index.js.map +1 -0
- package/lib/api/restful/buy/order/index.d.ts +264 -0
- package/lib/api/restful/buy/order/index.js +369 -0
- package/lib/api/restful/buy/order/index.js.map +1 -0
- package/lib/api/restful/commerce/catalog/index.d.ts +73 -0
- package/lib/api/restful/commerce/catalog/index.js +108 -0
- package/lib/api/restful/commerce/catalog/index.js.map +1 -0
- package/lib/api/restful/commerce/charity/index.d.ts +34 -0
- package/lib/api/restful/commerce/charity/index.js +56 -0
- package/lib/api/restful/commerce/charity/index.js.map +1 -0
- package/lib/api/restful/commerce/identity/index.d.ts +14 -0
- package/lib/api/restful/commerce/identity/index.js +27 -0
- package/lib/api/restful/commerce/identity/index.js.map +1 -0
- package/lib/api/restful/commerce/index.d.ts +15 -0
- package/lib/api/restful/commerce/index.js +19 -0
- package/lib/api/restful/commerce/index.js.map +1 -0
- package/lib/api/restful/commerce/notification/index.d.ts +117 -0
- package/lib/api/restful/commerce/notification/index.js +187 -0
- package/lib/api/restful/commerce/notification/index.js.map +1 -0
- package/lib/api/restful/commerce/taxonomy/index.d.ts +78 -0
- package/lib/api/restful/commerce/taxonomy/index.js +135 -0
- package/lib/api/restful/commerce/taxonomy/index.js.map +1 -0
- package/lib/api/restful/commerce/translation/index.d.ts +15 -0
- package/lib/api/restful/commerce/translation/index.js +25 -0
- package/lib/api/restful/commerce/translation/index.js.map +1 -0
- package/lib/api/restful/developer/analytics/index.d.ts +22 -0
- package/lib/api/restful/developer/analytics/index.js +45 -0
- package/lib/api/restful/developer/analytics/index.js.map +1 -0
- package/lib/api/restful/developer/index.d.ts +5 -0
- package/lib/api/restful/developer/index.js +9 -0
- package/lib/api/restful/developer/index.js.map +1 -0
- package/lib/api/restful/index.d.ts +63 -0
- package/lib/api/restful/index.js +165 -0
- package/lib/api/restful/index.js.map +1 -0
- package/lib/api/restful/postOrder/cancellation/index.d.ts +57 -0
- package/lib/api/restful/postOrder/cancellation/index.js +95 -0
- package/lib/api/restful/postOrder/cancellation/index.js.map +1 -0
- package/lib/api/restful/postOrder/case/index.d.ts +63 -0
- package/lib/api/restful/postOrder/case/index.js +97 -0
- package/lib/api/restful/postOrder/case/index.js.map +1 -0
- package/lib/api/restful/postOrder/index.d.ts +11 -0
- package/lib/api/restful/postOrder/index.js +15 -0
- package/lib/api/restful/postOrder/index.js.map +1 -0
- package/lib/api/restful/postOrder/inquiry/index.d.ts +82 -0
- package/lib/api/restful/postOrder/inquiry/index.js +131 -0
- package/lib/api/restful/postOrder/inquiry/index.js.map +1 -0
- package/lib/api/restful/postOrder/return/index.d.ts +231 -0
- package/lib/api/restful/postOrder/return/index.js +361 -0
- package/lib/api/restful/postOrder/return/index.js.map +1 -0
- package/lib/api/restful/sell/account/index.d.ts +217 -0
- package/lib/api/restful/sell/account/index.js +337 -0
- package/lib/api/restful/sell/account/index.js.map +1 -0
- package/lib/api/restful/sell/analytics/index.d.ts +41 -0
- package/lib/api/restful/sell/analytics/index.js +61 -0
- package/lib/api/restful/sell/analytics/index.js.map +1 -0
- package/lib/api/restful/sell/compliance/index.d.ts +37 -0
- package/lib/api/restful/sell/compliance/index.js +57 -0
- package/lib/api/restful/sell/compliance/index.js.map +1 -0
- package/lib/api/restful/sell/feed/index.d.ts +151 -0
- package/lib/api/restful/sell/feed/index.js +255 -0
- package/lib/api/restful/sell/feed/index.js.map +1 -0
- package/lib/api/restful/sell/finances/index.d.ts +74 -0
- package/lib/api/restful/sell/finances/index.js +105 -0
- package/lib/api/restful/sell/finances/index.js.map +1 -0
- package/lib/api/restful/sell/fulfillment/index.d.ts +137 -0
- package/lib/api/restful/sell/fulfillment/index.js +199 -0
- package/lib/api/restful/sell/fulfillment/index.js.map +1 -0
- package/lib/api/restful/sell/index.d.ts +29 -0
- package/lib/api/restful/sell/index.js +33 -0
- package/lib/api/restful/sell/index.js.map +1 -0
- package/lib/api/restful/sell/inventory/index.d.ts +248 -0
- package/lib/api/restful/sell/inventory/index.js +346 -0
- package/lib/api/restful/sell/inventory/index.js.map +1 -0
- package/lib/api/restful/sell/listing/index.d.ts +14 -0
- package/lib/api/restful/sell/listing/index.js +25 -0
- package/lib/api/restful/sell/listing/index.js.map +1 -0
- package/lib/api/restful/sell/logistics/index.d.ts +44 -0
- package/lib/api/restful/sell/logistics/index.js +66 -0
- package/lib/api/restful/sell/logistics/index.js.map +1 -0
- package/lib/api/restful/sell/marketing/index.d.ts +443 -0
- package/lib/api/restful/sell/marketing/index.js +609 -0
- package/lib/api/restful/sell/marketing/index.js.map +1 -0
- package/lib/api/restful/sell/metadata/index.d.ts +77 -0
- package/lib/api/restful/sell/metadata/index.js +131 -0
- package/lib/api/restful/sell/metadata/index.js.map +1 -0
- package/lib/api/restful/sell/negotiation/index.d.ts +24 -0
- package/lib/api/restful/sell/negotiation/index.js +39 -0
- package/lib/api/restful/sell/negotiation/index.js.map +1 -0
- package/lib/api/restful/sell/recommendation/index.d.ts +26 -0
- package/lib/api/restful/sell/recommendation/index.js +39 -0
- package/lib/api/restful/sell/recommendation/index.js.map +1 -0
- package/lib/api/traditional/XMLRequest.d.ts +98 -0
- package/lib/api/traditional/XMLRequest.js +191 -0
- package/lib/api/traditional/XMLRequest.js.map +1 -0
- package/lib/api/traditional/clientAlerts/index.d.ts +9 -0
- package/lib/api/traditional/clientAlerts/index.js +15 -0
- package/lib/api/traditional/clientAlerts/index.js.map +1 -0
- package/lib/api/traditional/clientAlerts/types.d.ts +31 -0
- package/lib/api/traditional/clientAlerts/types.js +36 -0
- package/lib/api/traditional/clientAlerts/types.js.map +1 -0
- package/lib/api/traditional/fields.d.ts +1948 -0
- package/lib/api/traditional/fields.js +1949 -0
- package/lib/api/traditional/fields.js.map +1 -0
- package/lib/api/traditional/finding/index.d.ts +12 -0
- package/lib/api/traditional/finding/index.js +16 -0
- package/lib/api/traditional/finding/index.js.map +1 -0
- package/lib/api/traditional/index.d.ts +17 -0
- package/lib/api/traditional/index.js +207 -0
- package/lib/api/traditional/index.js.map +1 -0
- package/lib/api/traditional/merchandising/index.d.ts +7 -0
- package/lib/api/traditional/merchandising/index.js +11 -0
- package/lib/api/traditional/merchandising/index.js.map +1 -0
- package/lib/api/traditional/shopping/index.d.ts +11 -0
- package/lib/api/traditional/shopping/index.js +16 -0
- package/lib/api/traditional/shopping/index.js.map +1 -0
- package/lib/api/traditional/trading/index.d.ts +142 -0
- package/lib/api/traditional/trading/index.js +146 -0
- package/lib/api/traditional/trading/index.js.map +1 -0
- package/lib/auth/authNAuth.d.ts +49 -0
- package/lib/auth/authNAuth.js +122 -0
- package/lib/auth/authNAuth.js.map +1 -0
- package/lib/auth/index.d.ts +17 -0
- package/lib/auth/index.js +32 -0
- package/lib/auth/index.js.map +1 -0
- package/lib/auth/oAuth2.d.ts +90 -0
- package/lib/auth/oAuth2.js +258 -0
- package/lib/auth/oAuth2.js.map +1 -0
- package/lib/ebay-api.min.js +2 -0
- package/lib/ebay-api.min.js.map +1 -0
- package/lib/enums/apiEnums.d.ts +49 -0
- package/lib/enums/apiEnums.js +55 -0
- package/lib/enums/apiEnums.js.map +1 -0
- package/lib/enums/index.d.ts +2 -0
- package/lib/enums/index.js +15 -0
- package/lib/enums/index.js.map +1 -0
- package/lib/enums/restfulEnums.d.ts +966 -0
- package/lib/enums/restfulEnums.js +1012 -0
- package/lib/enums/restfulEnums.js.map +1 -0
- package/lib/errors/index.d.ts +66 -0
- package/lib/errors/index.js +208 -0
- package/lib/errors/index.js.map +1 -0
- package/lib/index.d.ts +56 -0
- package/lib/index.js +99 -0
- package/lib/index.js.map +1 -0
- package/lib/request.d.ts +26 -0
- package/lib/request.js +51 -0
- package/lib/request.js.map +1 -0
- package/lib/types/apiTypes.d.ts +28 -0
- package/lib/types/apiTypes.js +3 -0
- package/lib/types/apiTypes.js.map +1 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.js +16 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/restfulTypes.d.ts +1082 -0
- package/lib/types/restfulTypes.js +3 -0
- package/lib/types/restfulTypes.js.map +1 -0
- package/lib/types/traditonalTypes.d.ts +34 -0
- package/lib/types/traditonalTypes.js +3 -0
- package/lib/types/traditonalTypes.js.map +1 -0
- package/package.json +115 -21
- package/.npmignore +0 -17
- package/.travis.yml +0 -7
- package/examples/Finding-FindItemsByKeywords.js +0 -46
- package/examples/Merchandising-GetMostWatchedItemsRequest.js +0 -16
- package/examples/Shopping-GetSingleItem.js +0 -18
- package/examples/Trading-GetOrders.js +0 -26
- package/index.js +0 -10
- package/lib/deep-to-array.js +0 -42
- package/lib/defaults.js +0 -69
- package/lib/errors.js +0 -44
- package/lib/json-parser.js +0 -336
- package/lib/key-lists.js +0 -64
- package/lib/urls.js +0 -64
- package/lib/versions.js +0 -35
- package/lib/xml-converter.js +0 -21
- package/lib/xml-request.js +0 -207
- package/scripts/parse-input-xml.js +0 -41
- package/test/deep-to-array.test.js +0 -100
- package/test/errors.test.js +0 -75
- package/test/helpers.js +0 -22
- package/test/mocha.opts +0 -1
- package/test/mocks/GetMultipleItems.xml +0 -115
- package/test/mocks/GetOrders-empty.xml +0 -17
- package/test/mocks/GetOrders.xml +0 -463
- package/test/pagination.test.js +0 -5
- package/test/parsing.test.js +0 -248
- package/test/xml-request.test.js +0 -447
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import Restful from '../../';
|
|
2
|
+
/**
|
|
3
|
+
* The Metadata API has operations that retrieve configuration details pertaining to the different eBay marketplaces.
|
|
4
|
+
*/
|
|
5
|
+
export default class Metadata extends Restful {
|
|
6
|
+
static id: string;
|
|
7
|
+
get basePath(): string;
|
|
8
|
+
/**
|
|
9
|
+
* This method retrieves all the sales tax jurisdictions for the country that you specify in the countryCode path
|
|
10
|
+
* parameter.
|
|
11
|
+
*
|
|
12
|
+
* @param countryCode This path parameter specifies the two-letter ISO 3166-1 Alpha-2 country code for the country
|
|
13
|
+
* whose jurisdictions you want to retrieve.
|
|
14
|
+
*/
|
|
15
|
+
getSalesTaxJurisdictions(countryCode: string): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* This method returns the eBay policies that define how to list automotive-parts-compatibility items in the
|
|
18
|
+
* categories of a specific marketplace.
|
|
19
|
+
*
|
|
20
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
21
|
+
* retrieved.
|
|
22
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
23
|
+
* categories specified by this parameter.
|
|
24
|
+
*/
|
|
25
|
+
getAutomotivePartsCompatibilityPolicies(marketplaceId: string, filter?: string): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* This method returns the eBay policies that define how to specify item conditions in the categories of a specific
|
|
28
|
+
* marketplace.
|
|
29
|
+
*
|
|
30
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
31
|
+
* retrieved.
|
|
32
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
33
|
+
* categories specified by this parameter.
|
|
34
|
+
*/
|
|
35
|
+
getItemConditionPolicies(marketplaceId: string, filter?: string): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* This method returns the eBay policies that define the allowed listing structures for the categories of a
|
|
38
|
+
* specific marketplace.
|
|
39
|
+
*
|
|
40
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
41
|
+
* retrieved.
|
|
42
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
43
|
+
* categories specified by this parameter.
|
|
44
|
+
*/
|
|
45
|
+
getListingStructurePolicies(marketplaceId: string, filter?: string): Promise<any>;
|
|
46
|
+
/**
|
|
47
|
+
* This method returns the eBay policies that define the supported negotiated price features (like "best
|
|
48
|
+
* offer") for the categories of a specific marketplace.
|
|
49
|
+
*
|
|
50
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
51
|
+
* retrieved.
|
|
52
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
53
|
+
* categories specified by this parameter.
|
|
54
|
+
*/
|
|
55
|
+
getNegotiatedPricePolicies(marketplaceId: string, filter?: string): Promise<any>;
|
|
56
|
+
/**
|
|
57
|
+
* This method retrieves a list of leaf categories for a marketplace and identifies the categories that require
|
|
58
|
+
* items to have an eBay product ID value in order to be listed in those categories.
|
|
59
|
+
*
|
|
60
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
61
|
+
* retrieved.
|
|
62
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
63
|
+
* categories specified by this parameter.
|
|
64
|
+
*/
|
|
65
|
+
getProductAdoptionPolicies(marketplaceId: string, filter?: string): Promise<any>;
|
|
66
|
+
/**
|
|
67
|
+
* This method returns the eBay policies that define whether or not you must include a return policy for the
|
|
68
|
+
* items you list in the categories of a specific marketplace, plus the guidelines for creating domestic and
|
|
69
|
+
* international return policies in the different eBay categories.
|
|
70
|
+
*
|
|
71
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
72
|
+
* retrieved.
|
|
73
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
74
|
+
* categories specified by this parameter.
|
|
75
|
+
*/
|
|
76
|
+
getReturnPolicies(marketplaceId: string, filter?: string): Promise<any>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const __1 = __importDefault(require("../../"));
|
|
7
|
+
/**
|
|
8
|
+
* The Metadata API has operations that retrieve configuration details pertaining to the different eBay marketplaces.
|
|
9
|
+
*/
|
|
10
|
+
class Metadata extends __1.default {
|
|
11
|
+
get basePath() {
|
|
12
|
+
return '/sell/metadata/v1';
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This method retrieves all the sales tax jurisdictions for the country that you specify in the countryCode path
|
|
16
|
+
* parameter.
|
|
17
|
+
*
|
|
18
|
+
* @param countryCode This path parameter specifies the two-letter ISO 3166-1 Alpha-2 country code for the country
|
|
19
|
+
* whose jurisdictions you want to retrieve.
|
|
20
|
+
*/
|
|
21
|
+
getSalesTaxJurisdictions(countryCode) {
|
|
22
|
+
countryCode = encodeURIComponent(countryCode);
|
|
23
|
+
return this.get(`/country/${countryCode}/sales_tax_jurisdiction`);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* This method returns the eBay policies that define how to list automotive-parts-compatibility items in the
|
|
27
|
+
* categories of a specific marketplace.
|
|
28
|
+
*
|
|
29
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
30
|
+
* retrieved.
|
|
31
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
32
|
+
* categories specified by this parameter.
|
|
33
|
+
*/
|
|
34
|
+
getAutomotivePartsCompatibilityPolicies(marketplaceId, filter) {
|
|
35
|
+
marketplaceId = encodeURIComponent(marketplaceId);
|
|
36
|
+
return this.get(`/marketplace/${marketplaceId}/get_automotive_parts_compatibility_policies`, {
|
|
37
|
+
params: {
|
|
38
|
+
filter
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* This method returns the eBay policies that define how to specify item conditions in the categories of a specific
|
|
44
|
+
* marketplace.
|
|
45
|
+
*
|
|
46
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
47
|
+
* retrieved.
|
|
48
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
49
|
+
* categories specified by this parameter.
|
|
50
|
+
*/
|
|
51
|
+
getItemConditionPolicies(marketplaceId, filter) {
|
|
52
|
+
marketplaceId = encodeURIComponent(marketplaceId);
|
|
53
|
+
return this.get(`/marketplace/${marketplaceId}/get_item_condition_policies`, {
|
|
54
|
+
params: {
|
|
55
|
+
filter
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* This method returns the eBay policies that define the allowed listing structures for the categories of a
|
|
61
|
+
* specific marketplace.
|
|
62
|
+
*
|
|
63
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
64
|
+
* retrieved.
|
|
65
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
66
|
+
* categories specified by this parameter.
|
|
67
|
+
*/
|
|
68
|
+
getListingStructurePolicies(marketplaceId, filter) {
|
|
69
|
+
marketplaceId = encodeURIComponent(marketplaceId);
|
|
70
|
+
return this.get(`/marketplace/${marketplaceId}/get_listing_structure_policies`, {
|
|
71
|
+
params: {
|
|
72
|
+
filter
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* This method returns the eBay policies that define the supported negotiated price features (like "best
|
|
78
|
+
* offer") for the categories of a specific marketplace.
|
|
79
|
+
*
|
|
80
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
81
|
+
* retrieved.
|
|
82
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
83
|
+
* categories specified by this parameter.
|
|
84
|
+
*/
|
|
85
|
+
getNegotiatedPricePolicies(marketplaceId, filter) {
|
|
86
|
+
marketplaceId = encodeURIComponent(marketplaceId);
|
|
87
|
+
return this.get(`/marketplace/${marketplaceId}/get_negotiated_price_policies`, {
|
|
88
|
+
params: {
|
|
89
|
+
filter
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* This method retrieves a list of leaf categories for a marketplace and identifies the categories that require
|
|
95
|
+
* items to have an eBay product ID value in order to be listed in those categories.
|
|
96
|
+
*
|
|
97
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
98
|
+
* retrieved.
|
|
99
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
100
|
+
* categories specified by this parameter.
|
|
101
|
+
*/
|
|
102
|
+
getProductAdoptionPolicies(marketplaceId, filter) {
|
|
103
|
+
marketplaceId = encodeURIComponent(marketplaceId);
|
|
104
|
+
return this.get(`/marketplace/${marketplaceId}/get_product_adoption_policies`, {
|
|
105
|
+
params: {
|
|
106
|
+
filter
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* This method returns the eBay policies that define whether or not you must include a return policy for the
|
|
112
|
+
* items you list in the categories of a specific marketplace, plus the guidelines for creating domestic and
|
|
113
|
+
* international return policies in the different eBay categories.
|
|
114
|
+
*
|
|
115
|
+
* @param marketplaceId This path parameter specifies the eBay marketplace for which policy information is
|
|
116
|
+
* retrieved.
|
|
117
|
+
* @param filter This query parameter limits the response by returning eBay policy information for only the leaf
|
|
118
|
+
* categories specified by this parameter.
|
|
119
|
+
*/
|
|
120
|
+
getReturnPolicies(marketplaceId, filter) {
|
|
121
|
+
marketplaceId = encodeURIComponent(marketplaceId);
|
|
122
|
+
return this.get(`/marketplace/${marketplaceId}/get_return_policies`, {
|
|
123
|
+
params: {
|
|
124
|
+
filter
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.default = Metadata;
|
|
130
|
+
Metadata.id = 'Metadata';
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/restful/sell/metadata/index.ts"],"names":[],"mappings":";;;;;AAAA,+CAA6B;AAE7B;;GAEG;AACH,MAAqB,QAAS,SAAQ,WAAO;IAI3C,IAAI,QAAQ;QACV,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACI,wBAAwB,CAAC,WAAmB;QACjD,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,WAAW,yBAAyB,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;OAQG;IACI,uCAAuC,CAAC,aAAqB,EAAE,MAAe;QACnF,aAAa,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,GAAG,CAAC,gBAAgB,aAAa,8CAA8C,EAAE;YAC3F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IACL,CAAC;;AA/HH,2BAgIC;AA9HQ,WAAE,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Restful from '../../';
|
|
2
|
+
/**
|
|
3
|
+
* The <b>Negotiations API</b> gives sellers the ability to proactively send discount offers to buyers who have shown an "interest" in their listings.
|
|
4
|
+
*/
|
|
5
|
+
export default class Negotiation extends Restful {
|
|
6
|
+
static id: string;
|
|
7
|
+
get basePath(): string;
|
|
8
|
+
/**
|
|
9
|
+
* This method evaluates a seller's current listings and returns the set of IDs that are eligible for a seller-initiated discount offer to a buyer.
|
|
10
|
+
*
|
|
11
|
+
* @param limit This query parameter specifies the maximum number of items to return from the result set on a page in the paginated response.
|
|
12
|
+
* @param offset This query parameter specifies the number of results to skip in the result set before returning the first result in the paginated response.
|
|
13
|
+
*/
|
|
14
|
+
findEligibleItems({ limit, offset }?: {
|
|
15
|
+
limit?: string;
|
|
16
|
+
offset?: string;
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* This method sends eligible buyers offers to purchase items in a listing at a discount.
|
|
20
|
+
*
|
|
21
|
+
* @param data The CreateOffersRequest
|
|
22
|
+
*/
|
|
23
|
+
sendOfferToInterestedBuyers(data: any): Promise<any>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const __1 = __importDefault(require("../../"));
|
|
7
|
+
/**
|
|
8
|
+
* The <b>Negotiations API</b> gives sellers the ability to proactively send discount offers to buyers who have shown an "interest" in their listings.
|
|
9
|
+
*/
|
|
10
|
+
class Negotiation extends __1.default {
|
|
11
|
+
get basePath() {
|
|
12
|
+
return '/sell/negotiation/v1';
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This method evaluates a seller's current listings and returns the set of IDs that are eligible for a seller-initiated discount offer to a buyer.
|
|
16
|
+
*
|
|
17
|
+
* @param limit This query parameter specifies the maximum number of items to return from the result set on a page in the paginated response.
|
|
18
|
+
* @param offset This query parameter specifies the number of results to skip in the result set before returning the first result in the paginated response.
|
|
19
|
+
*/
|
|
20
|
+
findEligibleItems({ limit, offset } = {}) {
|
|
21
|
+
return this.get(`/find_eligible_items`, {
|
|
22
|
+
params: {
|
|
23
|
+
limit,
|
|
24
|
+
offset
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This method sends eligible buyers offers to purchase items in a listing at a discount.
|
|
30
|
+
*
|
|
31
|
+
* @param data The CreateOffersRequest
|
|
32
|
+
*/
|
|
33
|
+
sendOfferToInterestedBuyers(data) {
|
|
34
|
+
return this.post(`/send_offer_to_interested_buyers`, data);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = Negotiation;
|
|
38
|
+
Negotiation.id = 'Negotiation';
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/restful/sell/negotiation/index.ts"],"names":[],"mappings":";;;;;AAAA,+CAA6B;AAE7B;;GAEG;AACH,MAAqB,WAAY,SAAQ,WAAO;IAI9C,IAAI,QAAQ;QACV,OAAO,sBAAsB,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAC,EAAC,KAAK,EAAE,MAAM,KAAyC,EAAE;QAChF,OAAO,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE;YACtC,MAAM,EAAE;gBACN,KAAK;gBACL,MAAM;aACP;SACF,CAAC,CAAA;IACJ,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAAC,IAAS;QAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAA;IAC5D,CAAC;;AA9BH,8BA+BC;AA7BQ,cAAE,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Restful from '../../';
|
|
2
|
+
import { FindListingRecommendationRequest } from '../../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* The <b>Recommendation API</b> returns information that sellers can use to optimize the configuration of their
|
|
5
|
+
* listings on eBay.
|
|
6
|
+
*/
|
|
7
|
+
export default class Recommendation extends Restful {
|
|
8
|
+
static id: string;
|
|
9
|
+
get basePath(): string;
|
|
10
|
+
/**
|
|
11
|
+
* The find method returns recommendations and information that sellers can use to optimize their listing
|
|
12
|
+
* configurations.
|
|
13
|
+
*
|
|
14
|
+
* @param filter Provide a list of key-value pairs to specify the criteria you want to use to filter the response.
|
|
15
|
+
* @param limit Use this query parameter to set the maximum number of ads to return on a page from the paginated
|
|
16
|
+
* response. Default: 10 Maximum: 500
|
|
17
|
+
* @param offset Specifies the number of ads to skip in the result set before returning the first ad in the
|
|
18
|
+
* paginated response.
|
|
19
|
+
* @param body FindListingRecommendationRequest
|
|
20
|
+
*/
|
|
21
|
+
findListingRecommendations({ filter, limit, offset }?: {
|
|
22
|
+
filter?: string;
|
|
23
|
+
limit?: number;
|
|
24
|
+
offset?: number;
|
|
25
|
+
}, body?: FindListingRecommendationRequest): Promise<any>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const __1 = __importDefault(require("../../"));
|
|
7
|
+
/**
|
|
8
|
+
* The <b>Recommendation API</b> returns information that sellers can use to optimize the configuration of their
|
|
9
|
+
* listings on eBay.
|
|
10
|
+
*/
|
|
11
|
+
class Recommendation extends __1.default {
|
|
12
|
+
get basePath() {
|
|
13
|
+
return '/sell/recommendation/v1';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The find method returns recommendations and information that sellers can use to optimize their listing
|
|
17
|
+
* configurations.
|
|
18
|
+
*
|
|
19
|
+
* @param filter Provide a list of key-value pairs to specify the criteria you want to use to filter the response.
|
|
20
|
+
* @param limit Use this query parameter to set the maximum number of ads to return on a page from the paginated
|
|
21
|
+
* response. Default: 10 Maximum: 500
|
|
22
|
+
* @param offset Specifies the number of ads to skip in the result set before returning the first ad in the
|
|
23
|
+
* paginated response.
|
|
24
|
+
* @param body FindListingRecommendationRequest
|
|
25
|
+
*/
|
|
26
|
+
findListingRecommendations({ filter, limit, offset } = {}, body) {
|
|
27
|
+
return this.post(`/find`, {
|
|
28
|
+
data: body,
|
|
29
|
+
params: {
|
|
30
|
+
filter,
|
|
31
|
+
limit,
|
|
32
|
+
offset
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = Recommendation;
|
|
38
|
+
Recommendation.id = 'Recommendation';
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/restful/sell/recommendation/index.ts"],"names":[],"mappings":";;;;;AAAA,+CAA6B;AAG7B;;;GAGG;AACH,MAAqB,cAAe,SAAQ,WAAO;IAIjD,IAAI,QAAQ;QACV,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED;;;;;;;;;;OAUG;IACI,0BAA0B,CAAC,EAAC,MAAM,EAAE,KAAK,EAAE,MAAM,KAA0D,EAAE,EAClH,IAAuC;QAEvC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACxB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE;gBACN,MAAM;gBACN,KAAK;gBACL,MAAM;aACP;SACF,CAAC,CAAC;IACL,CAAC;;AA9BH,iCA+BC;AA7BQ,iBAAE,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import xmlParser from 'fast-xml-parser';
|
|
2
|
+
import { IEBayApiRequest } from '../../request';
|
|
3
|
+
import { Fields } from './fields';
|
|
4
|
+
export declare const defaultXML2JSONParseOptions: {
|
|
5
|
+
attributeNamePrefix: string;
|
|
6
|
+
textNodeName: string;
|
|
7
|
+
ignoreAttributes: boolean;
|
|
8
|
+
parseAttributeValue: boolean;
|
|
9
|
+
parseNodeValue: boolean;
|
|
10
|
+
ignoreNameSpace: boolean;
|
|
11
|
+
parseTrueNumberOnly: boolean;
|
|
12
|
+
arrayMode: (_: string, parentTageName: string) => boolean;
|
|
13
|
+
};
|
|
14
|
+
declare type Headers = {
|
|
15
|
+
[key: string]: string | number | undefined;
|
|
16
|
+
};
|
|
17
|
+
export declare type BodyHeaders = {
|
|
18
|
+
body: any;
|
|
19
|
+
headers?: Headers;
|
|
20
|
+
};
|
|
21
|
+
export declare type Options = {
|
|
22
|
+
raw?: boolean;
|
|
23
|
+
parseOptions?: object;
|
|
24
|
+
useIaf?: boolean;
|
|
25
|
+
headers?: Headers;
|
|
26
|
+
hook?: (xml: string) => BodyHeaders;
|
|
27
|
+
};
|
|
28
|
+
export declare type XMLReqConfig = Options & {
|
|
29
|
+
headers: Headers;
|
|
30
|
+
endpoint: string;
|
|
31
|
+
xmlns: string;
|
|
32
|
+
eBayAuthToken?: string | null;
|
|
33
|
+
};
|
|
34
|
+
export declare const defaultOptions: Required<Omit<Options, 'hook'>>;
|
|
35
|
+
export declare const defaultHeaders: {
|
|
36
|
+
'Content-Type': string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* XML request for making eBay API call.
|
|
40
|
+
*/
|
|
41
|
+
export default class XMLRequest {
|
|
42
|
+
private readonly callName;
|
|
43
|
+
private readonly fields;
|
|
44
|
+
private readonly config;
|
|
45
|
+
private readonly req;
|
|
46
|
+
static j2x: xmlParser.j2xParser;
|
|
47
|
+
/**
|
|
48
|
+
* Creates the new Request object
|
|
49
|
+
*
|
|
50
|
+
* @private
|
|
51
|
+
* @param {string} callName the callname
|
|
52
|
+
* @param {Object} fields the fields
|
|
53
|
+
* @param {Object} req the request
|
|
54
|
+
* @param {XMLReqConfig} config
|
|
55
|
+
*/
|
|
56
|
+
constructor(callName: string, fields: Fields, config: XMLReqConfig, req: IEBayApiRequest);
|
|
57
|
+
/**
|
|
58
|
+
* returns the expected name of XML node of a Request
|
|
59
|
+
*
|
|
60
|
+
* @private
|
|
61
|
+
* @return {String} callnameReponse
|
|
62
|
+
*/
|
|
63
|
+
private getResponseWrapper;
|
|
64
|
+
/**
|
|
65
|
+
* returns the XML structure for the SOAP auth
|
|
66
|
+
*
|
|
67
|
+
* @private
|
|
68
|
+
* @return {Object} the RequesterCredentials
|
|
69
|
+
*/
|
|
70
|
+
private getCredentials;
|
|
71
|
+
private getParseOptions;
|
|
72
|
+
private getHeaders;
|
|
73
|
+
/**
|
|
74
|
+
* Converts an XML response to JSON
|
|
75
|
+
*
|
|
76
|
+
* @param {string} xml the xml
|
|
77
|
+
* @return {JSON} resolves to a JSON representation of the HTML
|
|
78
|
+
*/
|
|
79
|
+
toJSON(xml: string): any;
|
|
80
|
+
/**
|
|
81
|
+
* returns the XML document for the request
|
|
82
|
+
*
|
|
83
|
+
* @private
|
|
84
|
+
* @param {Fields} fields the fields
|
|
85
|
+
* @return {String} The XML string of the Request
|
|
86
|
+
*/
|
|
87
|
+
toXML(fields: Fields): string;
|
|
88
|
+
/**
|
|
89
|
+
* Call the xml api endpoint.
|
|
90
|
+
*
|
|
91
|
+
* @private
|
|
92
|
+
* @return {Promise} resolves to the response
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
request(): Promise<any>;
|
|
96
|
+
xml2JSON(xml: string): any;
|
|
97
|
+
}
|
|
98
|
+
export {};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.defaultHeaders = exports.defaultOptions = exports.defaultXML2JSONParseOptions = void 0;
|
|
26
|
+
const debug_1 = __importDefault(require("debug"));
|
|
27
|
+
const fast_xml_parser_1 = __importStar(require("fast-xml-parser"));
|
|
28
|
+
const errors_1 = require("../../errors");
|
|
29
|
+
const log = (0, debug_1.default)('ebay:xml:request');
|
|
30
|
+
const defaultJSON2XMLOptions = {
|
|
31
|
+
attributeNamePrefix: '@_',
|
|
32
|
+
textNodeName: '#value',
|
|
33
|
+
ignoreAttributes: false,
|
|
34
|
+
cdataTagName: '__cdata',
|
|
35
|
+
cdataPositionChar: '\\c',
|
|
36
|
+
format: false,
|
|
37
|
+
indentBy: ' ',
|
|
38
|
+
suppressEmptyNode: false
|
|
39
|
+
};
|
|
40
|
+
exports.defaultXML2JSONParseOptions = {
|
|
41
|
+
attributeNamePrefix: '',
|
|
42
|
+
textNodeName: 'value',
|
|
43
|
+
ignoreAttributes: false,
|
|
44
|
+
parseAttributeValue: true,
|
|
45
|
+
parseNodeValue: true,
|
|
46
|
+
ignoreNameSpace: true,
|
|
47
|
+
parseTrueNumberOnly: true,
|
|
48
|
+
arrayMode: (_, parentTageName) => {
|
|
49
|
+
return /Array$/.test(parentTageName);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.defaultOptions = {
|
|
53
|
+
raw: false,
|
|
54
|
+
parseOptions: exports.defaultXML2JSONParseOptions,
|
|
55
|
+
useIaf: true,
|
|
56
|
+
headers: {}
|
|
57
|
+
};
|
|
58
|
+
exports.defaultHeaders = {
|
|
59
|
+
'Content-Type': 'text/xml'
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* XML request for making eBay API call.
|
|
63
|
+
*/
|
|
64
|
+
class XMLRequest {
|
|
65
|
+
/**
|
|
66
|
+
* Creates the new Request object
|
|
67
|
+
*
|
|
68
|
+
* @private
|
|
69
|
+
* @param {string} callName the callname
|
|
70
|
+
* @param {Object} fields the fields
|
|
71
|
+
* @param {Object} req the request
|
|
72
|
+
* @param {XMLReqConfig} config
|
|
73
|
+
*/
|
|
74
|
+
constructor(callName, fields, config, req) {
|
|
75
|
+
if (!callName) {
|
|
76
|
+
throw new errors_1.EbayNoCallError();
|
|
77
|
+
}
|
|
78
|
+
this.callName = callName;
|
|
79
|
+
this.fields = fields || {};
|
|
80
|
+
this.config = { ...exports.defaultOptions, ...config };
|
|
81
|
+
this.req = req;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* returns the expected name of XML node of a Request
|
|
85
|
+
*
|
|
86
|
+
* @private
|
|
87
|
+
* @return {String} callnameReponse
|
|
88
|
+
*/
|
|
89
|
+
getResponseWrapper() {
|
|
90
|
+
return `${this.callName}Response`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* returns the XML structure for the SOAP auth
|
|
94
|
+
*
|
|
95
|
+
* @private
|
|
96
|
+
* @return {Object} the RequesterCredentials
|
|
97
|
+
*/
|
|
98
|
+
getCredentials() {
|
|
99
|
+
return this.config.eBayAuthToken ? {
|
|
100
|
+
RequesterCredentials: {
|
|
101
|
+
eBayAuthToken: this.config.eBayAuthToken
|
|
102
|
+
}
|
|
103
|
+
} : {};
|
|
104
|
+
}
|
|
105
|
+
getParseOptions() {
|
|
106
|
+
return {
|
|
107
|
+
...exports.defaultXML2JSONParseOptions,
|
|
108
|
+
...this.config.parseOptions
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
getHeaders() {
|
|
112
|
+
return {
|
|
113
|
+
...exports.defaultHeaders,
|
|
114
|
+
...this.config.headers,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Converts an XML response to JSON
|
|
119
|
+
*
|
|
120
|
+
* @param {string} xml the xml
|
|
121
|
+
* @return {JSON} resolves to a JSON representation of the HTML
|
|
122
|
+
*/
|
|
123
|
+
toJSON(xml) {
|
|
124
|
+
const parseOptions = this.getParseOptions();
|
|
125
|
+
log('parseOption', parseOptions);
|
|
126
|
+
return fast_xml_parser_1.default.parse(xml, parseOptions);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* returns the XML document for the request
|
|
130
|
+
*
|
|
131
|
+
* @private
|
|
132
|
+
* @param {Fields} fields the fields
|
|
133
|
+
* @return {String} The XML string of the Request
|
|
134
|
+
*/
|
|
135
|
+
toXML(fields) {
|
|
136
|
+
const HEADING = '<?xml version="1.0" encoding="utf-8"?>';
|
|
137
|
+
return HEADING + XMLRequest.j2x.parse({
|
|
138
|
+
[this.callName + 'Request']: {
|
|
139
|
+
'@_xmlns': this.config.xmlns,
|
|
140
|
+
...this.getCredentials(),
|
|
141
|
+
...fields
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Call the xml api endpoint.
|
|
147
|
+
*
|
|
148
|
+
* @private
|
|
149
|
+
* @return {Promise} resolves to the response
|
|
150
|
+
*
|
|
151
|
+
*/
|
|
152
|
+
async request() {
|
|
153
|
+
const xml = this.toXML(this.fields);
|
|
154
|
+
log('xml', xml);
|
|
155
|
+
try {
|
|
156
|
+
const { body, headers = {} } = this.config.hook?.(xml) ?? { body: xml };
|
|
157
|
+
const config = {
|
|
158
|
+
headers: {
|
|
159
|
+
...this.getHeaders(),
|
|
160
|
+
...(headers ? headers : {})
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
log('config', config);
|
|
164
|
+
const response = await this.req.post(this.config.endpoint, body, config);
|
|
165
|
+
log('response', response);
|
|
166
|
+
// resolve to raw XML
|
|
167
|
+
if (this.config.raw) {
|
|
168
|
+
return response;
|
|
169
|
+
}
|
|
170
|
+
const json = this.xml2JSON(response);
|
|
171
|
+
(0, errors_1.checkEBayResponse)(json);
|
|
172
|
+
return json;
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
log('error', error);
|
|
176
|
+
if (error.response?.data) {
|
|
177
|
+
const json = this.toJSON(error.response.data);
|
|
178
|
+
(0, errors_1.checkEBayResponse)(json);
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
xml2JSON(xml) {
|
|
184
|
+
const json = this.toJSON(xml);
|
|
185
|
+
// Unwrap
|
|
186
|
+
return json[this.getResponseWrapper()] ?? json;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.default = XMLRequest;
|
|
190
|
+
XMLRequest.j2x = new fast_xml_parser_1.j2xParser(defaultJSON2XMLOptions);
|
|
191
|
+
//# sourceMappingURL=XMLRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XMLRequest.js","sourceRoot":"","sources":["../../../src/api/traditional/XMLRequest.ts"],"names":[],"mappings":";;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