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.
Files changed (218) hide show
  1. package/LICENSE +18 -19
  2. package/README.md +512 -118
  3. package/lib/api/apiFactory.d.ts +27 -0
  4. package/lib/api/apiFactory.js +100 -0
  5. package/lib/api/apiFactory.js.map +1 -0
  6. package/lib/api/base.d.ts +13 -0
  7. package/lib/api/base.js +25 -0
  8. package/lib/api/base.js.map +1 -0
  9. package/lib/api/index.d.ts +11 -0
  10. package/lib/api/index.js +18 -0
  11. package/lib/api/index.js.map +1 -0
  12. package/lib/api/restful/buy/browse/index.d.ts +84 -0
  13. package/lib/api/restful/buy/browse/index.js +142 -0
  14. package/lib/api/restful/buy/browse/index.js.map +1 -0
  15. package/lib/api/restful/buy/deal/index.d.ts +55 -0
  16. package/lib/api/restful/buy/deal/index.js +80 -0
  17. package/lib/api/restful/buy/deal/index.js.map +1 -0
  18. package/lib/api/restful/buy/feed/index.d.ts +43 -0
  19. package/lib/api/restful/buy/feed/index.js +85 -0
  20. package/lib/api/restful/buy/feed/index.js.map +1 -0
  21. package/lib/api/restful/buy/index.d.ts +17 -0
  22. package/lib/api/restful/buy/index.js +21 -0
  23. package/lib/api/restful/buy/index.js.map +1 -0
  24. package/lib/api/restful/buy/marketing/index.d.ts +27 -0
  25. package/lib/api/restful/buy/marketing/index.js +51 -0
  26. package/lib/api/restful/buy/marketing/index.js.map +1 -0
  27. package/lib/api/restful/buy/marketplaceInsights/index.d.ts +28 -0
  28. package/lib/api/restful/buy/marketplaceInsights/index.js +51 -0
  29. package/lib/api/restful/buy/marketplaceInsights/index.js.map +1 -0
  30. package/lib/api/restful/buy/offer/index.d.ts +23 -0
  31. package/lib/api/restful/buy/offer/index.js +37 -0
  32. package/lib/api/restful/buy/offer/index.js.map +1 -0
  33. package/lib/api/restful/buy/order/index.d.ts +264 -0
  34. package/lib/api/restful/buy/order/index.js +369 -0
  35. package/lib/api/restful/buy/order/index.js.map +1 -0
  36. package/lib/api/restful/commerce/catalog/index.d.ts +73 -0
  37. package/lib/api/restful/commerce/catalog/index.js +108 -0
  38. package/lib/api/restful/commerce/catalog/index.js.map +1 -0
  39. package/lib/api/restful/commerce/charity/index.d.ts +34 -0
  40. package/lib/api/restful/commerce/charity/index.js +56 -0
  41. package/lib/api/restful/commerce/charity/index.js.map +1 -0
  42. package/lib/api/restful/commerce/identity/index.d.ts +14 -0
  43. package/lib/api/restful/commerce/identity/index.js +27 -0
  44. package/lib/api/restful/commerce/identity/index.js.map +1 -0
  45. package/lib/api/restful/commerce/index.d.ts +15 -0
  46. package/lib/api/restful/commerce/index.js +19 -0
  47. package/lib/api/restful/commerce/index.js.map +1 -0
  48. package/lib/api/restful/commerce/notification/index.d.ts +117 -0
  49. package/lib/api/restful/commerce/notification/index.js +187 -0
  50. package/lib/api/restful/commerce/notification/index.js.map +1 -0
  51. package/lib/api/restful/commerce/taxonomy/index.d.ts +78 -0
  52. package/lib/api/restful/commerce/taxonomy/index.js +135 -0
  53. package/lib/api/restful/commerce/taxonomy/index.js.map +1 -0
  54. package/lib/api/restful/commerce/translation/index.d.ts +15 -0
  55. package/lib/api/restful/commerce/translation/index.js +25 -0
  56. package/lib/api/restful/commerce/translation/index.js.map +1 -0
  57. package/lib/api/restful/developer/analytics/index.d.ts +22 -0
  58. package/lib/api/restful/developer/analytics/index.js +45 -0
  59. package/lib/api/restful/developer/analytics/index.js.map +1 -0
  60. package/lib/api/restful/developer/index.d.ts +5 -0
  61. package/lib/api/restful/developer/index.js +9 -0
  62. package/lib/api/restful/developer/index.js.map +1 -0
  63. package/lib/api/restful/index.d.ts +63 -0
  64. package/lib/api/restful/index.js +165 -0
  65. package/lib/api/restful/index.js.map +1 -0
  66. package/lib/api/restful/postOrder/cancellation/index.d.ts +57 -0
  67. package/lib/api/restful/postOrder/cancellation/index.js +95 -0
  68. package/lib/api/restful/postOrder/cancellation/index.js.map +1 -0
  69. package/lib/api/restful/postOrder/case/index.d.ts +63 -0
  70. package/lib/api/restful/postOrder/case/index.js +97 -0
  71. package/lib/api/restful/postOrder/case/index.js.map +1 -0
  72. package/lib/api/restful/postOrder/index.d.ts +11 -0
  73. package/lib/api/restful/postOrder/index.js +15 -0
  74. package/lib/api/restful/postOrder/index.js.map +1 -0
  75. package/lib/api/restful/postOrder/inquiry/index.d.ts +82 -0
  76. package/lib/api/restful/postOrder/inquiry/index.js +131 -0
  77. package/lib/api/restful/postOrder/inquiry/index.js.map +1 -0
  78. package/lib/api/restful/postOrder/return/index.d.ts +231 -0
  79. package/lib/api/restful/postOrder/return/index.js +361 -0
  80. package/lib/api/restful/postOrder/return/index.js.map +1 -0
  81. package/lib/api/restful/sell/account/index.d.ts +217 -0
  82. package/lib/api/restful/sell/account/index.js +337 -0
  83. package/lib/api/restful/sell/account/index.js.map +1 -0
  84. package/lib/api/restful/sell/analytics/index.d.ts +41 -0
  85. package/lib/api/restful/sell/analytics/index.js +61 -0
  86. package/lib/api/restful/sell/analytics/index.js.map +1 -0
  87. package/lib/api/restful/sell/compliance/index.d.ts +37 -0
  88. package/lib/api/restful/sell/compliance/index.js +57 -0
  89. package/lib/api/restful/sell/compliance/index.js.map +1 -0
  90. package/lib/api/restful/sell/feed/index.d.ts +151 -0
  91. package/lib/api/restful/sell/feed/index.js +255 -0
  92. package/lib/api/restful/sell/feed/index.js.map +1 -0
  93. package/lib/api/restful/sell/finances/index.d.ts +74 -0
  94. package/lib/api/restful/sell/finances/index.js +105 -0
  95. package/lib/api/restful/sell/finances/index.js.map +1 -0
  96. package/lib/api/restful/sell/fulfillment/index.d.ts +137 -0
  97. package/lib/api/restful/sell/fulfillment/index.js +199 -0
  98. package/lib/api/restful/sell/fulfillment/index.js.map +1 -0
  99. package/lib/api/restful/sell/index.d.ts +29 -0
  100. package/lib/api/restful/sell/index.js +33 -0
  101. package/lib/api/restful/sell/index.js.map +1 -0
  102. package/lib/api/restful/sell/inventory/index.d.ts +248 -0
  103. package/lib/api/restful/sell/inventory/index.js +346 -0
  104. package/lib/api/restful/sell/inventory/index.js.map +1 -0
  105. package/lib/api/restful/sell/listing/index.d.ts +14 -0
  106. package/lib/api/restful/sell/listing/index.js +25 -0
  107. package/lib/api/restful/sell/listing/index.js.map +1 -0
  108. package/lib/api/restful/sell/logistics/index.d.ts +44 -0
  109. package/lib/api/restful/sell/logistics/index.js +66 -0
  110. package/lib/api/restful/sell/logistics/index.js.map +1 -0
  111. package/lib/api/restful/sell/marketing/index.d.ts +443 -0
  112. package/lib/api/restful/sell/marketing/index.js +609 -0
  113. package/lib/api/restful/sell/marketing/index.js.map +1 -0
  114. package/lib/api/restful/sell/metadata/index.d.ts +77 -0
  115. package/lib/api/restful/sell/metadata/index.js +131 -0
  116. package/lib/api/restful/sell/metadata/index.js.map +1 -0
  117. package/lib/api/restful/sell/negotiation/index.d.ts +24 -0
  118. package/lib/api/restful/sell/negotiation/index.js +39 -0
  119. package/lib/api/restful/sell/negotiation/index.js.map +1 -0
  120. package/lib/api/restful/sell/recommendation/index.d.ts +26 -0
  121. package/lib/api/restful/sell/recommendation/index.js +39 -0
  122. package/lib/api/restful/sell/recommendation/index.js.map +1 -0
  123. package/lib/api/traditional/XMLRequest.d.ts +98 -0
  124. package/lib/api/traditional/XMLRequest.js +191 -0
  125. package/lib/api/traditional/XMLRequest.js.map +1 -0
  126. package/lib/api/traditional/clientAlerts/index.d.ts +9 -0
  127. package/lib/api/traditional/clientAlerts/index.js +15 -0
  128. package/lib/api/traditional/clientAlerts/index.js.map +1 -0
  129. package/lib/api/traditional/clientAlerts/types.d.ts +31 -0
  130. package/lib/api/traditional/clientAlerts/types.js +36 -0
  131. package/lib/api/traditional/clientAlerts/types.js.map +1 -0
  132. package/lib/api/traditional/fields.d.ts +1948 -0
  133. package/lib/api/traditional/fields.js +1949 -0
  134. package/lib/api/traditional/fields.js.map +1 -0
  135. package/lib/api/traditional/finding/index.d.ts +12 -0
  136. package/lib/api/traditional/finding/index.js +16 -0
  137. package/lib/api/traditional/finding/index.js.map +1 -0
  138. package/lib/api/traditional/index.d.ts +17 -0
  139. package/lib/api/traditional/index.js +207 -0
  140. package/lib/api/traditional/index.js.map +1 -0
  141. package/lib/api/traditional/merchandising/index.d.ts +7 -0
  142. package/lib/api/traditional/merchandising/index.js +11 -0
  143. package/lib/api/traditional/merchandising/index.js.map +1 -0
  144. package/lib/api/traditional/shopping/index.d.ts +11 -0
  145. package/lib/api/traditional/shopping/index.js +16 -0
  146. package/lib/api/traditional/shopping/index.js.map +1 -0
  147. package/lib/api/traditional/trading/index.d.ts +142 -0
  148. package/lib/api/traditional/trading/index.js +146 -0
  149. package/lib/api/traditional/trading/index.js.map +1 -0
  150. package/lib/auth/authNAuth.d.ts +49 -0
  151. package/lib/auth/authNAuth.js +122 -0
  152. package/lib/auth/authNAuth.js.map +1 -0
  153. package/lib/auth/index.d.ts +17 -0
  154. package/lib/auth/index.js +32 -0
  155. package/lib/auth/index.js.map +1 -0
  156. package/lib/auth/oAuth2.d.ts +90 -0
  157. package/lib/auth/oAuth2.js +258 -0
  158. package/lib/auth/oAuth2.js.map +1 -0
  159. package/lib/ebay-api.min.js +2 -0
  160. package/lib/ebay-api.min.js.map +1 -0
  161. package/lib/enums/apiEnums.d.ts +49 -0
  162. package/lib/enums/apiEnums.js +55 -0
  163. package/lib/enums/apiEnums.js.map +1 -0
  164. package/lib/enums/index.d.ts +2 -0
  165. package/lib/enums/index.js +15 -0
  166. package/lib/enums/index.js.map +1 -0
  167. package/lib/enums/restfulEnums.d.ts +672 -0
  168. package/lib/enums/restfulEnums.js +714 -0
  169. package/lib/enums/restfulEnums.js.map +1 -0
  170. package/lib/errors/index.d.ts +66 -0
  171. package/lib/errors/index.js +208 -0
  172. package/lib/errors/index.js.map +1 -0
  173. package/lib/index.d.ts +55 -0
  174. package/lib/index.js +98 -0
  175. package/lib/index.js.map +1 -0
  176. package/lib/request.d.ts +26 -0
  177. package/lib/request.js +51 -0
  178. package/lib/request.js.map +1 -0
  179. package/lib/types/apiTypes.d.ts +28 -0
  180. package/lib/types/apiTypes.js +3 -0
  181. package/lib/types/apiTypes.js.map +1 -0
  182. package/lib/types/index.d.ts +3 -0
  183. package/lib/types/index.js +16 -0
  184. package/lib/types/index.js.map +1 -0
  185. package/lib/types/restfulTypes.d.ts +1067 -0
  186. package/lib/types/restfulTypes.js +3 -0
  187. package/lib/types/restfulTypes.js.map +1 -0
  188. package/lib/types/traditonalTypes.d.ts +34 -0
  189. package/lib/types/traditonalTypes.js +3 -0
  190. package/lib/types/traditonalTypes.js.map +1 -0
  191. package/package.json +115 -21
  192. package/.npmignore +0 -17
  193. package/.travis.yml +0 -7
  194. package/examples/Finding-FindItemsByKeywords.js +0 -46
  195. package/examples/Merchandising-GetMostWatchedItemsRequest.js +0 -16
  196. package/examples/Shopping-GetSingleItem.js +0 -18
  197. package/examples/Trading-GetOrders.js +0 -26
  198. package/index.js +0 -10
  199. package/lib/deep-to-array.js +0 -42
  200. package/lib/defaults.js +0 -69
  201. package/lib/errors.js +0 -44
  202. package/lib/json-parser.js +0 -336
  203. package/lib/key-lists.js +0 -64
  204. package/lib/urls.js +0 -64
  205. package/lib/versions.js +0 -35
  206. package/lib/xml-converter.js +0 -21
  207. package/lib/xml-request.js +0 -207
  208. package/scripts/parse-input-xml.js +0 -41
  209. package/test/deep-to-array.test.js +0 -100
  210. package/test/errors.test.js +0 -75
  211. package/test/helpers.js +0 -22
  212. package/test/mocha.opts +0 -1
  213. package/test/mocks/GetMultipleItems.xml +0 -115
  214. package/test/mocks/GetOrders-empty.xml +0 -17
  215. package/test/mocks/GetOrders.xml +0 -463
  216. package/test/pagination.test.js +0 -5
  217. package/test/parsing.test.js +0 -248
  218. package/test/xml-request.test.js +0 -447
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=restfulTypes.js.map
@@ -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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=traditonalTypes.js.map
@@ -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
- "description": "eBay API Client",
4
- "version": "1.13.4",
5
- "homepage": "https://github.com/benbuckman/nodejs-ebay-api",
6
- "author": "Ben Buckman",
7
- "repository": {
8
- "url": "git://github.com/benbuckman/nodejs-ebay-api.git"
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
- "async": "1.5.2",
13
- "debug": "2.2.0",
14
- "lodash": "3.10.1",
15
- "request": "2.72.0",
16
- "xml": "1.0.1",
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
- "chai": "3.5.0",
21
- "mocha": "2.5.3",
22
- "sinon": "1.17.4",
23
- "sinon-chai": "2.8.0"
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
- "scripts": {
26
- "test": "mocha"
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.10"
30
- }
120
+ "node": ">= 14.0.0"
121
+ },
122
+ "files": [
123
+ "lib"
124
+ ]
31
125
  }
package/.npmignore DELETED
@@ -1,17 +0,0 @@
1
- lib-cov
2
- *.seed
3
- *.log
4
- *.csv
5
- *.dat
6
- *.out
7
- *.pid
8
- *.gz
9
-
10
- pids
11
- logs
12
- results
13
-
14
- node_modules
15
- npm-debug.log
16
-
17
- .idea
package/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- sudo: false
2
- language: node_js
3
- node_js:
4
- - "4.1"
5
- - "4.0"
6
- - "0.12"
7
- - "0.10"
@@ -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
@@ -1,10 +0,0 @@
1
- // eBay API client for Node.js
2
-
3
- var _ = require('lodash');
4
-
5
- module.exports = _.extend({},
6
- require('./lib/xml-request'),
7
- require('./lib/xml-converter'),
8
- require('./lib/json-parser'),
9
- require('./lib/errors')
10
- );
@@ -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
- };