tomohiro / go-gyazo

Go library for accessing the Gyazo API

Home Page:https://tomohiro.me/go-gyazo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Go library for accessing the Gyazo API

https://tomohiro.me/go-gyazo

License:MIT License


Languages

Language:Go 94.6%Language:Makefile 5.4%