qiita

1.2.0 • Public • Published

node-qiita

Qiita API の nodejs wrapper

インストール

npm install --save qiita

使い方

Qiita = require "qiita"
# インスタンス化 
= new Qiita token: "xxxxxxxxx" # tokenはオプショナル 
 
# インスタンス化 (qiita teamの場合) 
= new Qiita team: "team_id"token: "xxxxxxxxx"
 
# id, passwordからトークン取得 
q.auth.post url_name: "myname"password: "abcdedg"(err, res, data) ->
  console.log data.token
 
# 投稿の作成 
q.items.post
  title: "吾輩は猫である"
  body: "吾輩は猫である。名前はまだ無い。どこで生れたかとんと見当が....."
  tags: [{name: "小説"}]
(err, res, body) ->
  # リクエスト結果の検証 
  throw err if err?
  console.log "successfully posted to Qiita."
 
# タグ一覧の取得 
q.tags.get (err, res, tags) -> console.log tags
 
# 特定ユーザの投稿一覧の取得 (ネストしたリソース) 
q.users.items.get url_name: "sakatam"(err, res, items) -> console.log items

これからやる

  • pagination への対応

Readme

Keywords

Package Sidebar

Install

npm i qiita

Weekly Downloads

1

Version

1.2.0

License

MIT

Last publish

Collaborators

  • sakatam