Skip to content

Latest commit

 

History

History
82 lines (55 loc) · 2.47 KB

README.md

File metadata and controls

82 lines (55 loc) · 2.47 KB

go-gyazo

Build Status Coverage Status Go Report Card GoDoc Reference MIT License

go-gyazo is a library for Go for accessing the Gyazo API.

Installation

Use go get:

$ go get -d github.com/tomohiro/go-gyazo

Usage

Create a client to accessing the Gyazo API

Import this package like this:

import "github.com/tomohiro/go-gyazo/gyazo"

Create a client with your Gyazo access token:

gyazo, err := gyazo.NewClient("your access token")
if err != nil {
	panic(err)
}

List

list, _ := gyazo.List(&gyazo.ListOptions{Page: 1, PerPage: 50})
fmt.Println(list.Meta.TotalCount) // Total count of specified user's images
for _, img := range *list.Images {
	fmt.Println(img.PermalinkURL) // http://gyazo.com/8980c52421e452ac3355ca3e5cfe7a0c
}

Upload

file, _ := os.Open("/your/image/file.png")
defer file.Close()
image, _ := gyazo.Upload(file)
fmt.Println(image.PermalinkURL) // http://gyazo.com/8980c52421e452ac3355ca3e5cfe7a0c

Delete

result, _ := gyazo.Delete("8980c52421e452ac3355ca3e5cfe7a0c")

For complete usage of go-gyazo, see the full package docs.

Contributing

Please check out the CONTIRBUTING guideline.

LICENSE

© 2015 - 2019 Tomohiro Taira.

This project is licensed under the MIT license. See LICENSE for details.