node package manager

hatena-blog-api

hatena-blog-api

Hatena::Blog AtomPub API wrapper for Node.js (unofficial)

Installation

$ npm install hatena-blog-api

Usage

See examples/.

Coding style (Callback/Promise)

Callback style

var blog = require('hatena-blog-api');
 
var client = blog({
  type: 'wsse',
  username: 'username',
  blogId: 'blog id',
  apiKey: 'api key'
});
var options = { title: 'bouzuya\'s entry', content: 'fun is justice!' };
 
client.create(options, function(err) {
  if (err) {
    console.error(err);
  } else {
    console.log('uploaded');
  }
});

Promise style

var blog = /* ... */;
var client = /* ... */;
var options = /* ... */;
 
client.create(options).then(function() {
  console.log('uploaded');
}, function(err) {
  console.error(err);
});

Configuration (WSSE/OAuth)

WSSE

See "How to use Hatena WSSE".

  • username ... Your username.
  • blogId ... Your blod id.
  • apiKey ... See AtomPub API key.

OAuth

See "How to use Hatena OAuth".

Application scope is "read_private" and "write_private".

var blog = require('hatena-blog-api');
 
var client = blog({
  type: 'oauth',
  blogId: 'blog id',
  consumerKey: 'consumer key',
  consumerSecret: 'consumer secret',
  accessToken: 'access token',
  accessTokenSecret: 'access token secret'
});
 
// ... 

API Docs

See Hatena::Blog AtomPub API, test/ and examples/.

Development

npm run

License

MIT

Author

bouzuya <m@bouzuya.net> (http://bouzuya.net)

Badges

Build Status Dependencies status Coverage Status