Documentation
¶
Index ¶
Constants ¶
View Source
const (
ApiUrl = "https://api.telegra.ph/"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Body ¶
type Body struct {
// Ok: if true, request was successful, and result can be found in the Result field.
// If false, error can be explained in Error field.
Ok bool `json:"ok"`
// Error: contains a human-readable description of the error result.
Error string `json:"error"`
// Result: result of requests (if Ok)
Result json.RawMessage `json:"result"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithProxy ¶
func (*Client) Download ¶
Helper to use the client(*http.Client) to download a file from a given URL.
type Node ¶
type Node any
Node is abstract object represents a DOM Node. It can be a String which represents a DOM text node or a NodeElement object.
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.Client
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 represents a DOM element node.
type Page ¶
type Page struct {
// Path to the page.
Path string `json:"path"`
// URL of the page.
Url string `json:"url"`
// Title of the page.
Title string `json:"title"`
// Description of the page.
Description string `json:"description"`
// Optional. Name of the author, displayed below the title.
AuthorName string `json:"author_name,omitempty"`
// Optional. Profile link, opened when users click on the author's name below the title. Can be any link, not necessarily to a Telegram profile or channel.
AuthorUrl string `json:"author_url,omitempty"`
// Optional. Image URL of the page.
ImageUrl string `json:"image_url,omitempty"`
// Optional. Content of the page.
Content []Node `json:"content,omitempty"`
// Number of page views for the page.
Views int64 `json:"views"`
// Optional. Only returned if access_token passed. True, if the target Telegraph account can edit the page.
CanEdit bool `json:"can_edit,omitempty"`
}
Page object represents a page on Telegraph.
Click to show internal directories.
Click to hide internal directories.