Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodeElement ¶
type NodeElement struct { // Name of the DOM element. Available tags: a, aside, b, blockquote, br, code, em, figcaption, figure, // h3, h4, hr, i, iframe, img, li, ol, p, pre, s, strong, u, ul, video. Tag string `json:"tag"` // Attributes of the DOM element. Key of object represents name of attribute, value represents value // of attribute. Available attributes: href, src. Attrs map[string]string `json:"attrs,omitempty"` // List of child nodes for the DOM element. Children []Node `json:"children,omitempty"` }
NodeElement 表示一个元素,因为Telegraph的限制,只允许这三个属性
type Page ¶
type Page struct { AccessToken string `json:"access_token" validate:"required"` Title string `json:"title" validate:"max=10,min=1,required"` Content interface{} `json:"content" validate:"required"` ReturnContent string `json:"return_content,omitempty"` Data string `json:"-"` Debug bool `json:"-"` AttachInfo *NodeElement `json:"-"` AuthorName string `json:"author_name,omitempty"` AuthorURL string `json:"author_url,omitempty"` }
Page 是创建文章时的请求类型,内含创建文章需要的请求数据
func (*Page) CreatePage ¶ added in v1.1.0
CreatePage 将文本数据保存到Telegrah,并返回一个Telegraph链接。 具体实现和说明请看:CreatePageWithClient 这里只是一层简单的封装,传入一个默认的Client
func (*Page) CreatePageWithClient ¶ added in v1.1.0
CreatePageWithClient 将文本数据保存到Telegrah,并返回一个Telegraph链接。 由于Telegraph存在内容大小限制(64kb,utf-8),CreatePageWithClient将会把文本数据分割成多篇文章发表。 但放心,第一篇文章尾部将会存在指向第二篇文章的链接(「下一页」) 提供一个Client参数,方便调用者传入一个自定义的Client(其实就是代理,让程序可以翻墙)
Click to show internal directories.
Click to hide internal directories.