Based on official API definition and written with minimum dependencies.
- Support promise.
- Support piping top response to writable stream.
- Auto-generated validator for each api stub, and support
useValidators
options to turn it on/off. - Upload Picture (beta)
- Parse large numbers from top api result (gt. Number.MAX_SAFE_INTEGER or lt Number.MIN_SAFE_INTEGER) into strings
- TypeScript module definition
new TopClient(key, secret, {
endpoint: 'https://eco.taobao.com/router/rest',
useValidators: true,
rawResponse: false
});
(async function() {
const data = await client.execute('taobao.mixnick.get', { nick: 'test' });
console.log(data.nick);
})();
// const app = express();
app.get((req, res) => {
client.execute('taobao.mixnick.get', { nick: req.query.nick }).pipe(res);
});
(async function() {
const data = await client.execute('taobao.picture.upload', {
session: session,
picture_category_id: 0,
img: fs.createReadStream(path.join(__dirname, 'ok.png')),
image_input_title: 'ok.png',
title: 'topsdk test image'
}, 'FILE_UPLOAD');
console.log(data);
})();
This project welcomes contributions from the community. Contributions are accepted using GitHub pull requests. If you're not familiar with making GitHub pull requests, please refer to the GitHub documentation "Creating a pull request".