是一个封装了 Telegraph API 的
Golang
库。传入
HTML字符串
和标题
数据(当然telegraph-token
是必须的),telegraph-go会将它存储到Telegraph上,并返回一个可访问的链接给你。如何获取
telegraph-token
?请看上面 Telegraph API 文档
-
CreatePage
- Download
go get -u github.com/MakeGolangGreat/telegraph-go
test.go
package main
imoprt "github.com/MakeGolangGreat/telegraph-go"
func main(){
page := &telegraph.Page{
AccessToken: "......<telegraph-token>......",
AuthorURL: "https://github.com/MakeGolangGreat/telegraph-go",
AuthorName: "telegraph-go",
Title: "Title here",
Data: "<h1>Put html strings here.</h1>",
}
link, err := page.CreatePage()
if err != nil {
fmt.Println("Create Page Failed: ", err)
}else{
fmt.Println(link)
}
}
It's a very simple sample above. You maybe want to look this archive project that using telegraph-go
now.