gyazo-api
v0.3.1
Published
API Client for Gyazo.com
Downloads
178
Readme
Gyazo-API
Gyazo API wrapper for Node.js
- https://github.com/shokai/node-gyazo-api
- https://www.npmjs.org/package/gyazo-api
Usage
Register new application and get ACCESS TOKEN, then
upload("filepath") or upload("stream")
var Gyazo = require('gyazo-api');
var client = new Gyazo('ACCESS_TOKEN');
client.upload('/path/to/file.jpg', {
title: "my picture",
desc: "upload from nodejs"
})
.then(function(res){
console.log(res.data.image_id);
console.log(res.data.permalink_url);
})
.catch(function(err){
console.error(err);
});
list
client.list({page: 1, per_page: 50})
.then(function(res){
console.log(res.data[0]);
console.log(res.response.headers['x-current-page']); // => 1
console.log(res.response.headers['x-per-page']); // => 50
})
.catch(function(err){
console.error(err);
});
delete
client.delete(image_id)
.then(function(res){
console.log(res.data.image_id);
});
Test
setup
% npm install
% export GYAZO_TOKEN=a1b2cdef3456 ## set your API Token
run test
% npm test
or
% npm run watch
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request