Skip to content

Warashi/qiita-go

Repository files navigation

Qiita

Go wrapper for Qiita API v1.

Installation

go get -u github.com/Warashi/qiita-go

and

import "github.com/Warashi/qiita-go"

Usage

Get user's items

c := qiita.NewClient()
UserName := "saveji"
params := map[string]interface{}{}
items,err := c.UserItems(UserName,params)

Get tag's items

c := qiita.NewClient()
tag := "Go"
params := map[string]interface{}{}
items,err := c.TagItems(tag,params)

Get a specified item with comments and raw markdown content

c := qiita.NewClient()
uuid = "1234567890abcdefg"
item,err := c.Item(uuid)

Authenticated requests

Login with "username & password" or "token"

c := qiita.NewClient()
err := c.Login("UserName","Password")

or

c := qiita.NewClientWithToken("Token")

Get my items

params := map[string]interface{}{}
items,err := c.MyItems(params)

Post/Update/Delete an item

post

params := map[string]interface{}{
			"title": "Hello",
			"tags": []map[string]interface{}{{
				"name": "Tag",
                "versions": []string{"1.1","1.2"}
			}},
			"body":    "markdown text",
			"private": false,
}
item,err := c.PostItem(param)

update

params := map[string]interface{}{
			"title": "modified",
}
item,err := c.UpdateItem("uuid",param)

delete

err := c.DeleteItem("uuid")

Running Test

if you want to run go test, you must fill constants in const_test.go.

About

Go wrapper for Qiita API v1.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages