telegraph

package module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ShortName   string `json:"short_name"`
	AuthorName  string `json:"author_name"`
	AuthorUrl   string `json:"author_url"`
	AccessToken string `json:"access_token"`
	AuthUrl     string `json:"auth_url"`
	PageCount   int    `json:"page_count"`
}

type NodeElement

type NodeElement struct {
	Tag      string            `json:"tag"`
	Attrs    map[string]string `json:"attrs,omitempty"`
	Children []any             `json:"children"`
}

type Page

type Page struct {
	Path        string        `json:"path"`
	Url         string        `json:"url"`
	Title       string        `json:"title"`
	Description string        `json:"decription"`
	AuthorName  string        `json:"author_name"`
	AuthorUrl   string        `json:"author_url"`
	ImageUrl    string        `json:"image_url"`
	Content     []NodeElement `json:"content"`
	Views       int           `json:"views"`
	CanEdit     bool          `json:"can_edit"`
}

type PageList

type PageList struct {
	TotalCount int    `json:"total_count"`
	Pages      []Page `json:"pages"`
}

type PageViews

type PageViews struct {
	Views int `json:"views"`
}

type Query

type Query struct {
	Name  string
	Value string
}

type Result

type Result struct {
	Ok     bool            `json:"ok"`
	Result json.RawMessage `json:"result"`
	Error  string          `json:"error"`
}

type Telegraph

type Telegraph struct {
	// contains filtered or unexported fields
}

func CreateAccount added in v1.0.3

func CreateAccount(names ...string) (t *Telegraph, err error)

func GetIntoAccount added in v1.0.3

func GetIntoAccount(token string) (t *Telegraph, err error)

func (*Telegraph) CreatePage

func (t *Telegraph) CreatePage(title string, description string, content []NodeElement, author ...string) (np Page, err error)

func (*Telegraph) EditAccountInfo

func (t *Telegraph) EditAccountInfo(short, author, url string) (a Account, err error)

func (*Telegraph) EditPage

func (t *Telegraph) EditPage(op Page, returnConent bool) (np Page, err error)

func (*Telegraph) GetImage added in v1.0.1

func (t *Telegraph) GetImage(link string) ([]byte, error)

func (*Telegraph) GetPage

func (t *Telegraph) GetPage(path string, returnConent bool) (p Page, err error)

func (*Telegraph) GetPageList

func (t *Telegraph) GetPageList(limit, offset int) (pl PageList, err error)

func (*Telegraph) GetToken added in v1.0.2

func (t *Telegraph) GetToken() string

func (*Telegraph) GetViews

func (t *Telegraph) GetViews(path string, year, month, day, hour int) (v PageViews, err error)

func (*Telegraph) RevokeAccessToken

func (t *Telegraph) RevokeAccessToken(short, author, url string) (a Account, err error)

func (*Telegraph) SetImage added in v1.0.1

func (t *Telegraph) SetImage(data []byte, name string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL