ebay-api 1.13.4 → 6.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/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 +672 -0
- package/lib/enums/restfulEnums.js +714 -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 +55 -0
- package/lib/index.js +98 -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 +1067 -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 @@
|
|
|
1
|
+
{"version":3,"file":"restfulTypes.js","sourceRoot":"","sources":["../../src/types/restfulTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import ClientAlertsCalls from '../api/traditional/clientAlerts';
|
|
2
|
+
import { Fields } from '../api/traditional/fields';
|
|
3
|
+
import FindingCalls from '../api/traditional/finding';
|
|
4
|
+
import ShoppingCalls from '../api/traditional/shopping';
|
|
5
|
+
import TradingCalls from '../api/traditional/trading';
|
|
6
|
+
import MerchandisingCalls from '../api/traditional/merchandising';
|
|
7
|
+
import { Options } from '../api/traditional/XMLRequest';
|
|
8
|
+
export declare type XMLApiCall = (fields?: Fields, options?: Options) => Promise<any>;
|
|
9
|
+
export declare type Trading = {
|
|
10
|
+
[key in typeof TradingCalls[number]]: XMLApiCall;
|
|
11
|
+
};
|
|
12
|
+
export declare type Shopping = {
|
|
13
|
+
[key in typeof ShoppingCalls[number]]: XMLApiCall;
|
|
14
|
+
};
|
|
15
|
+
export declare type Finding = {
|
|
16
|
+
[key in typeof FindingCalls[number]]: XMLApiCall;
|
|
17
|
+
};
|
|
18
|
+
export declare type ClientAlerts = {
|
|
19
|
+
[key in typeof ClientAlertsCalls[number]]: (fields?: object, options?: Options) => Promise<any>;
|
|
20
|
+
};
|
|
21
|
+
export declare type Merchandising = {
|
|
22
|
+
[key in typeof MerchandisingCalls[number]]: (fields?: object, options?: Options) => Promise<any>;
|
|
23
|
+
};
|
|
24
|
+
declare type Endpoint = {
|
|
25
|
+
production: string;
|
|
26
|
+
sandbox: string;
|
|
27
|
+
};
|
|
28
|
+
export declare type TraditionalApi = {
|
|
29
|
+
endpoint: Endpoint;
|
|
30
|
+
xmlns: string;
|
|
31
|
+
calls: typeof TradingCalls | typeof ShoppingCalls | typeof FindingCalls | typeof ClientAlertsCalls | typeof MerchandisingCalls;
|
|
32
|
+
headers: (callName: string, accessToken?: string) => object;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traditonalTypes.js","sourceRoot":"","sources":["../../src/types/traditonalTypes.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,31 +1,125 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ebay-api",
|
|
3
|
-
"
|
|
4
|
-
"version": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
3
|
+
"author": "Daniil Tomilow",
|
|
4
|
+
"version": "6.0.0",
|
|
5
|
+
"description": "eBay TypeScript/JavaScript API for Node and Browser",
|
|
6
|
+
"browser": "./lib/ebay-api.min.js",
|
|
7
|
+
"main": "./lib/index.js",
|
|
8
|
+
"types": "./lib/index.d.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "rimraf lib && tsc && rollup -c",
|
|
11
|
+
"prepare": "npm run build",
|
|
12
|
+
"coverage": "codecov",
|
|
13
|
+
"tslint": "tslint -c tslint.json '{src,test,examples}/**/*.ts'",
|
|
14
|
+
"test": "mocha -r ts-node/register 'test/**/*.spec.ts' --reporter=dot",
|
|
15
|
+
"report": "nyc npm run test",
|
|
16
|
+
"report:summary": "nyc --reporter=lcov --reporter=text-summary npm run test",
|
|
17
|
+
"prerelease": "npm run tslint && npm run test && npm run build",
|
|
18
|
+
"release": "standard-version",
|
|
19
|
+
"rc": "npm run release -- --prerelease RC && git push --follow-tags origin next"
|
|
9
20
|
},
|
|
10
|
-
"main": "index.js",
|
|
11
21
|
"dependencies": {
|
|
12
|
-
"
|
|
13
|
-
"debug": "2.
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"xml2js": "0.4.16"
|
|
22
|
+
"axios": "^0.21.4",
|
|
23
|
+
"debug": "^2.1.1",
|
|
24
|
+
"fast-xml-parser": "^3.19.0",
|
|
25
|
+
"nanoevents": "^2.0.0",
|
|
26
|
+
"qs": "^6.8.0"
|
|
18
27
|
},
|
|
19
28
|
"devDependencies": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
29
|
+
"@rollup/plugin-commonjs": "^15.1.0",
|
|
30
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
31
|
+
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
32
|
+
"@rollup/plugin-strip": "^2.0.0",
|
|
33
|
+
"@types/chai": "^4.2.3",
|
|
34
|
+
"@types/debug": "^4.1.5",
|
|
35
|
+
"@types/mocha": "^5.2.7",
|
|
36
|
+
"@types/nanoevents": "^1.0.0",
|
|
37
|
+
"@types/node": "^12.7.4",
|
|
38
|
+
"@types/qs": "^6.5.3",
|
|
39
|
+
"@types/sinon": "^7.0.13",
|
|
40
|
+
"chai": "^3.5.0",
|
|
41
|
+
"form-data": "^4.0.0",
|
|
42
|
+
"mocha": "^9.1.2",
|
|
43
|
+
"nyc": "^15.1.0",
|
|
44
|
+
"readline": "^1.3.0",
|
|
45
|
+
"rimraf": "^3.0.2",
|
|
46
|
+
"rollup": "^2.28.2",
|
|
47
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
48
|
+
"sinon": "^7.4.2",
|
|
49
|
+
"standard-version": "^9.0.0",
|
|
50
|
+
"ts-node": "^8.4.1",
|
|
51
|
+
"tslint": "^6.1.0",
|
|
52
|
+
"typescript": "^4.0.3"
|
|
24
53
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+ssh://git@github.com/hendt/ebay-api.git"
|
|
57
|
+
},
|
|
58
|
+
"keywords": [
|
|
59
|
+
"api",
|
|
60
|
+
"eBay",
|
|
61
|
+
"Shopping",
|
|
62
|
+
"Searching",
|
|
63
|
+
"products",
|
|
64
|
+
"Browse",
|
|
65
|
+
"Category",
|
|
66
|
+
"FindingApi",
|
|
67
|
+
"node-api",
|
|
68
|
+
"eBay Traditional API",
|
|
69
|
+
"eBay Full API",
|
|
70
|
+
"eBay Account API",
|
|
71
|
+
"eBay Inventory API",
|
|
72
|
+
"eBay Compliance API",
|
|
73
|
+
"eBay Marketing API",
|
|
74
|
+
"eBay Fulfillment API",
|
|
75
|
+
"eBay Marketing API",
|
|
76
|
+
"eBay Analytics API",
|
|
77
|
+
"eBay Metadata API",
|
|
78
|
+
"eBay Browse API",
|
|
79
|
+
"eBay Feed API",
|
|
80
|
+
"eBay Order API",
|
|
81
|
+
"eBay Marketplace Insights API",
|
|
82
|
+
"eBay Taxonomy API",
|
|
83
|
+
"eBay Catalog API",
|
|
84
|
+
"eBay Translation API",
|
|
85
|
+
"eBay Analytics API",
|
|
86
|
+
"eBay Finding API",
|
|
87
|
+
"eBay Shopping API",
|
|
88
|
+
"eBay Merchandising API",
|
|
89
|
+
"eBay Trading API",
|
|
90
|
+
"eBay Product Services",
|
|
91
|
+
"eBay Client Alerts API",
|
|
92
|
+
"ebay-node",
|
|
93
|
+
"eBay-node-api",
|
|
94
|
+
"eBay-node-client",
|
|
95
|
+
"eBay-typescript",
|
|
96
|
+
"eBay-await",
|
|
97
|
+
"eBay-async",
|
|
98
|
+
"eBay-promises",
|
|
99
|
+
"eBay-products",
|
|
100
|
+
"eBay-sellers",
|
|
101
|
+
"eBay-orders",
|
|
102
|
+
"eBay-finances",
|
|
103
|
+
"eBay-inventory",
|
|
104
|
+
"eBay-shipment",
|
|
105
|
+
"eBay-api",
|
|
106
|
+
"eBay-sdk",
|
|
107
|
+
"eBay-client",
|
|
108
|
+
"eBay-node-api",
|
|
109
|
+
"eBay-node"
|
|
110
|
+
],
|
|
111
|
+
"license": "MIT",
|
|
112
|
+
"bugs": {
|
|
113
|
+
"url": "https://github.com/hendt/ebay-api/issues"
|
|
114
|
+
},
|
|
115
|
+
"homepage": "https://github.com/hendt/ebay-api#readme",
|
|
116
|
+
"directories": {
|
|
117
|
+
"test": "test"
|
|
27
118
|
},
|
|
28
119
|
"engines": {
|
|
29
|
-
"node": ">= 0.
|
|
30
|
-
}
|
|
120
|
+
"node": ">= 14.0.0"
|
|
121
|
+
},
|
|
122
|
+
"files": [
|
|
123
|
+
"lib"
|
|
124
|
+
]
|
|
31
125
|
}
|
package/.npmignore
DELETED
package/.travis.yml
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* example eBay API request to FindingService:findItemsByKeywords
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
var ebay = require('../index.js');
|
|
6
|
-
|
|
7
|
-
var params = {
|
|
8
|
-
keywords: ["Canon", "Powershot"],
|
|
9
|
-
|
|
10
|
-
// add additional fields
|
|
11
|
-
outputSelector: ['AspectHistogram'],
|
|
12
|
-
|
|
13
|
-
paginationInput: {
|
|
14
|
-
entriesPerPage: 10
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
itemFilter: [
|
|
18
|
-
{name: 'FreeShippingOnly', value: true},
|
|
19
|
-
{name: 'MaxPrice', value: '150'}
|
|
20
|
-
],
|
|
21
|
-
|
|
22
|
-
domainFilter: [
|
|
23
|
-
{name: 'domainName', value: 'Digital_Cameras'}
|
|
24
|
-
]
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
ebay.xmlRequest({
|
|
28
|
-
serviceName: 'Finding',
|
|
29
|
-
opType: 'findItemsByKeywords',
|
|
30
|
-
appId: '......................', // FILL IN YOUR OWN APP KEY, GET ONE HERE: https://publisher.ebaypartnernetwork.com/PublisherToolsAPI
|
|
31
|
-
params: params,
|
|
32
|
-
parser: ebay.parseResponseJson // (default)
|
|
33
|
-
},
|
|
34
|
-
// gets all the items together in a merged array
|
|
35
|
-
function itemsCallback(error, itemsResponse) {
|
|
36
|
-
if (error) throw error;
|
|
37
|
-
|
|
38
|
-
var items = itemsResponse.searchResult.item;
|
|
39
|
-
|
|
40
|
-
console.log('Found', items.length, 'items');
|
|
41
|
-
|
|
42
|
-
for (var i = 0; i < items.length; i++) {
|
|
43
|
-
console.log('- ' + items[i].title);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* example ebay API request to Merchandising:getMostWatchedItems
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
var ebay = require('../index.js');
|
|
6
|
-
|
|
7
|
-
ebay.xmlRequest({
|
|
8
|
-
'serviceName': 'Merchandising',
|
|
9
|
-
'opType': 'getMostWatchedItems',
|
|
10
|
-
'appId': '......................', // FILL IN YOUR OWN APP KEY, GET ONE HERE: https://publisher.ebaypartnernetwork.com/PublisherToolsAPI
|
|
11
|
-
|
|
12
|
-
params: {}
|
|
13
|
-
},
|
|
14
|
-
function(error, data) {
|
|
15
|
-
// ...
|
|
16
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* example ebay API request to Shopping:GetSingleItem
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
var ebay = require('../index.js');
|
|
6
|
-
|
|
7
|
-
ebay.xmlRequest({
|
|
8
|
-
'serviceName': 'Shopping',
|
|
9
|
-
'opType': 'GetSingleItem',
|
|
10
|
-
'appId': '......................', // FILL IN YOUR OWN APP KEY, GET ONE HERE: https://publisher.ebaypartnernetwork.com/PublisherToolsAPI
|
|
11
|
-
|
|
12
|
-
params: {
|
|
13
|
-
'ItemID': '1234567890' // FILL IN A REAL ItemID
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
function(error, data) {
|
|
17
|
-
// ...
|
|
18
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* example ebay API request to Trading:GetOrders
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
var ebay = require('../index.js');
|
|
6
|
-
|
|
7
|
-
ebay.xmlRequest({
|
|
8
|
-
serviceName : 'Trading',
|
|
9
|
-
opType : 'GetOrders',
|
|
10
|
-
|
|
11
|
-
// app/environment
|
|
12
|
-
devId: '...........',
|
|
13
|
-
certId: '...........',
|
|
14
|
-
appId: '...........',
|
|
15
|
-
sandbox: true,
|
|
16
|
-
|
|
17
|
-
// per user
|
|
18
|
-
authToken: '...........',
|
|
19
|
-
|
|
20
|
-
params: {
|
|
21
|
-
'OrderStatus': 'Active',
|
|
22
|
-
'NumberOfDays': 1
|
|
23
|
-
}
|
|
24
|
-
}, function(error, results) {
|
|
25
|
-
// ...
|
|
26
|
-
});
|
package/index.js
DELETED
package/lib/deep-to-array.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
var _ = require('lodash');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* handle quirk of 'xml' module:
|
|
5
|
-
* need arrays all the way down,
|
|
6
|
-
* and objects can only have a single key:value,
|
|
7
|
-
* e.g. {k1:v1,k2:v2} need to become [{k1:[v1]}, {k2:[v2]}].
|
|
8
|
-
* @see tests in xml-request.test.js.
|
|
9
|
-
*/
|
|
10
|
-
exports.deepToArray = function deepToArray(obj) {
|
|
11
|
-
var key, value, arr = [];
|
|
12
|
-
|
|
13
|
-
if (_.isArray(obj)) {
|
|
14
|
-
// not sure about this: arrays within objects are handled below;
|
|
15
|
-
// top level should never be an array;
|
|
16
|
-
// but seems ok. change/fix if a scenario comes up that this breaks.
|
|
17
|
-
return obj.map(function(value) {
|
|
18
|
-
return deepToArray(value);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
else if (_.isObject(obj)) {
|
|
22
|
-
for (key in obj) {
|
|
23
|
-
if (obj.hasOwnProperty(key)) {
|
|
24
|
-
value = obj[key];
|
|
25
|
-
|
|
26
|
-
// `{foo: [a,b,c]}` => `[{foo:a},{foo:b},{foo:c}]`
|
|
27
|
-
if (_.isArray(value)) {
|
|
28
|
-
value.forEach(function(subValue) {
|
|
29
|
-
arr.push(_.set({}, key, deepToArray(subValue)));
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
arr.push(_.set({}, key, deepToArray(value)));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
arr = [obj];
|
|
40
|
-
}
|
|
41
|
-
return arr;
|
|
42
|
-
};
|
package/lib/defaults.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var
|
|
2
|
-
_ = require('lodash'),
|
|
3
|
-
debug = require('debug')('ebay:defaults');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
default params per service type.
|
|
8
|
-
@param {object} options: request context. see `xmlRequest()` docs, and code below.
|
|
9
|
-
*/
|
|
10
|
-
exports.getDefaultHeaders = function(options) {
|
|
11
|
-
if (!options || !options.serviceName) throw new Error("Need serviceName for default params");
|
|
12
|
-
|
|
13
|
-
switch (options.serviceName) {
|
|
14
|
-
case 'Finding':
|
|
15
|
-
return {
|
|
16
|
-
'X-EBAY-SOA-SECURITY-APPNAME': options.appId ? options.appId : null,
|
|
17
|
-
'X-EBAY-SOA-REQUEST-DATA-FORMAT': 'XML',
|
|
18
|
-
'X-EBAY-SOA-RESPONSE-DATA-FORMAT': 'XML',
|
|
19
|
-
'X-EBAY-SOA-GLOBAL-ID': options.globalId ? options.globalId : 'EBAY-US',
|
|
20
|
-
'X-EBAY-SOA-SERVICE-VERSION': options.version ? options.version : '1.13.0',
|
|
21
|
-
'X-EBAY-SOA-OPERATION-NAME': options.opType
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
case 'Product':
|
|
25
|
-
return {
|
|
26
|
-
'SERVICE-NAME': options.opType,
|
|
27
|
-
'SECURITY-APPNAME': options.appId ? options.appId : null,
|
|
28
|
-
// based on response data
|
|
29
|
-
'SERVICE-VERSION': options.version ? options.version : '1.5.0',
|
|
30
|
-
'OPERATION-NAME': options.opType,
|
|
31
|
-
'GLOBAL-ID': options.globalId ? options.globalId : 'EBAY-US',
|
|
32
|
-
'RESPONSE-DATA-FORMAT': 'XML',
|
|
33
|
-
'REST-PAYLOAD': null // (not sure what this does)
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
case 'Merchandising':
|
|
37
|
-
return {
|
|
38
|
-
'X-EBAY-SOA-SERVICE-NAME': 'MerchandisingService',
|
|
39
|
-
'X-EBAY-SOA-OPERATION-NAME': options.opType,
|
|
40
|
-
'EBAY-SOA-CONSUMER-ID': options.appId ? options.appId : null,
|
|
41
|
-
'SERVICE-VERSION': options.version ? options.version : '1.5.0',
|
|
42
|
-
'X-EBAY-SOA-REQUEST-DATA-FORMAT': 'XML',
|
|
43
|
-
//'RESPONSE-DATA-FORMAT': 'XML',
|
|
44
|
-
//'REST-PAYLOAD': null // (not sure what this does)
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
case 'Shopping':
|
|
48
|
-
return {
|
|
49
|
-
'X-EBAY-API-APP-ID': options.appId ? options.appId : null,
|
|
50
|
-
'X-EBAY-API-CALL-NAME': options.opType,
|
|
51
|
-
'X-EBAY-API-VERSION': options.version ? options.version : '897',
|
|
52
|
-
'X-EBAY-API-SITE-ID': options.siteId ? options.siteId : '0', // US
|
|
53
|
-
'X-EBAY-API-REQUEST-ENCODING': 'XML',
|
|
54
|
-
'X-EBAY-API-RESPONSE-ENCODING': 'XML',
|
|
55
|
-
'Content-Type': 'text/xml',
|
|
56
|
-
//'Accept': 'text/xml'
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
case 'Trading':
|
|
60
|
-
return {
|
|
61
|
-
'X-EBAY-API-APP-NAME': options.appId,
|
|
62
|
-
'X-EBAY-API-CALL-NAME': options.opType,
|
|
63
|
-
'X-EBAY-API-COMPATIBILITY-LEVEL': options.version ? options.version : '775',
|
|
64
|
-
'X-EBAY-API-SITEID': options.siteId ? options.siteId : '0', // US
|
|
65
|
-
'X-EBAY-API-DEV-NAME': options.devId,
|
|
66
|
-
'X-EBAY-API-CERT-NAME': options.certId,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
};
|
package/lib/errors.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom error types to differentiate eBay response errors and client-level errors.
|
|
3
|
-
*
|
|
4
|
-
* @see http://developer.ebay.com/devzone/xml/docs/Reference/ebay/Errors/ErrorMessages.htm
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
inherits = require('util').inherits,
|
|
9
|
-
_ = require('lodash');
|
|
10
|
-
|
|
11
|
-
function EbayClientError(message, extraProps) {
|
|
12
|
-
Error.apply(this, arguments);
|
|
13
|
-
Error.captureStackTrace(this, this.constructor);
|
|
14
|
-
this.name = this.constructor.name;
|
|
15
|
-
this.message = message;
|
|
16
|
-
_.defaults(this, extraProps);
|
|
17
|
-
}
|
|
18
|
-
inherits(EbayClientError, Error);
|
|
19
|
-
|
|
20
|
-
function EbaySystemError(message, extraProps) {
|
|
21
|
-
EbayClientError.apply(this, arguments);
|
|
22
|
-
this.name = this.constructor.name;
|
|
23
|
-
}
|
|
24
|
-
inherits(EbaySystemError, EbayClientError);
|
|
25
|
-
|
|
26
|
-
function EbayRequestError(message) {
|
|
27
|
-
EbayClientError.apply(this, arguments);
|
|
28
|
-
this.name = this.constructor.name;
|
|
29
|
-
}
|
|
30
|
-
inherits(EbayRequestError, EbayClientError);
|
|
31
|
-
|
|
32
|
-
function EbayAuthenticationError(message) {
|
|
33
|
-
EbayClientError.apply(this, arguments);
|
|
34
|
-
this.name = this.constructor.name;
|
|
35
|
-
}
|
|
36
|
-
inherits(EbayAuthenticationError, EbayClientError);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
module.exports = {
|
|
40
|
-
EbayClientError: EbayClientError,
|
|
41
|
-
EbaySystemError: EbaySystemError,
|
|
42
|
-
EbayRequestError: EbayRequestError,
|
|
43
|
-
EbayAuthenticationError: EbayAuthenticationError,
|
|
44
|
-
};
|