Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 1.14 KB

README.md

File metadata and controls

51 lines (36 loc) · 1.14 KB

telegraph-go

是一个封装了 Telegraph APIGolang库。

传入HTML字符串标题数据(当然telegraph-token是必须的),telegraph-go会将它存储到Telegraph上,并返回一个可访问的链接给你。

如何获取telegraph-token?请看上面 Telegraph API 文档

APIs has achieved


  • CreatePage

Getting Started


  1. Download
go get -u github.com/MakeGolangGreat/telegraph-go
  1. 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.