Gyazo API wrapper for Node.js
Register new application and get ACCESS TOKEN, then
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);
});
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);
});
client.delete(image_id)
.then(function(res){
console.log(res.data.image_id);
});
setup
% npm install
% export GYAZO_TOKEN=a1b2cdef3456 ## set your API Token
run test
% npm test
or
% npm run watch
- 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