TopAPI SDK for Node.js
Using Es6 promise, all api return promise.
Platform Compatibility
Using Promise, Generator features of ES6
When using node 0.11.x or greater, you must use the --harmony-generators flag or just --harmony to get access to generators.
When using node 0.10.x and lower or browsers without generator support, you must use gnode and/or regenerator.
io.js is supported out of the box, you can use co without flags or polyfills.
Install
$ npm install topapi-node
Usage
var Top = ; var top = appKey:"" appSecret: "" sessionKey: ""; var params = page_size: 200 fields: "num_iid,title,price,pic_url,num,seller_cids,modified,list_time,has_showcase" top
Extend Top Apis
Since topAPI has huge APIs and this only implements some of them so you have two ways to extend that both of them were fineMaybe the best way is contribute your code into lib/apis file :) First way you can extend the TOPAPI prototype Topprototype { let self = this; let method = "taobao.items.onsale.get"; return { self; };} Second way postAPI to server let method = "taobao.items.onsale.get"; var params = page_size: 200 fields: "num_iid,title,price,pic_url,num,seller_cids,modified,list_time,has_showcase" top
Process Control
Suggest to use CO for process control
License
(c) Fork Ltd. Licensed under the MIT license.
Using ES6 features Promise Array Function Generator