telegraph

package
v0.0.0-...-83ac00d Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 0 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 {
	// Account name, helps users with several accounts remember
	// which they are currently using. Displayed to the user
	// above the "Edit/Publish" button on Telegra.ph,
	// other users don't see this name.
	ShortName string `json:"short_name"`

	// Default author name used when creating new articles.
	AuthorName string `json:"author_name"`

	// 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"`

	// Optional. Only returned by the createAccount and revokeAccessToken method.
	// Access token of the Telegraph account.
	AccessToken string `json:"access_token"`

	// Optional. URL to authorize a browser on telegra.ph and connect it to a Telegraph account.
	// This URL is valid for only one use and for 5 minutes only.
	AuthUrl string `json:"auth_url"`

	// Optional. Number of pages belonging to the Telegraph account.
	PageCount int `json:"page_count"`
}

This object represents a Telegraph account.

type ApiReq

type ApiReq struct {
	// Endpoint to which we address our API request
	Endpoint string

	// Params of the API request
	Params interface{}

	// Model for the API request
	Model interface{}
}

type ApiRes

type ApiRes struct {
	// If ok equals true, the request was successful,
	// and the result of the query can be found in the result field.
	OK bool `json:"ok"`

	// Result of the API query execution
	Result interface{} `json:"result"`

	// In case of an unsuccessful request, ok equals false,
	// and the error is explained in the error field
	Error string `json:"error"`
}

type Node

type Node interface{}

This 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.
	Tag string `json:"tag,omitempty"`

	// Optional. 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"`

	// Optional. List of child nodes for the DOM element.
	Children []Node `json:"children,omitempty"`
}

This object 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"`

	// 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"`

	// Optional. Image URL of the page.
	ImageUrl string `json:"image_url"`

	// Optional. Content of the page.
	Content []Node `json:"content"`

	// Number of page views for the page.
	Views int `json:"views"`

	// Optional. Only returned if access_token passed.
	// True, if the target Telegraph account can edit the page.
	CanEdit bool `json:"can_edit"`
}

This object represents a page on Telegraph.

type PageList

type PageList struct {
	// Total number of pages belonging to the target Telegraph account.
	TotalCount int `json:"total_count"`

	// Requested pages of the target Telegraph account.
	Pages []Page `json:"pages"`
}

This object represents a list of Telegraph articles belonging to an account. Most recently created articles first.

type PageViews

type PageViews struct {
	// Number of page views for the target page.
	Views int `json:"views"`
}

This object represents the number of page views for a Telegraph article.

Jump to

Keyboard shortcuts

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