Documentation ¶
Index ¶
- func HTMLToNodeString(html string) string
- func Prettify(t interface{}) string
- func Upload(f io.Reader, mediaType string) (string, error)
- type Account
- type AllValueTypes
- type CreateAccountOpts
- type CreatePageOpts
- type EditAccountInfoOpts
- type EditPageOpts
- type Error
- type GetAccountInfoOpts
- type GetPageListOpts
- type GetPageOpts
- type GetViewsOpts
- type Page
- type PageList
- type PageViews
- type ResultStruct
- type RevokeAccessTokenOpts
- type Source
- type Telegraph
- type UploadResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTMLToNodeString ¶
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 int64 `json:"page_count"` }
Account implements the Account type of Telegraph API
func CreateAccount ¶
func CreateAccount(opts *CreateAccountOpts) (acc *Account, err error)
CreateAccount using Telegraph API. Returns Account object
func EditAccountInfo ¶
func EditAccountInfo(opts *EditAccountInfoOpts) (acc *Account, err error)
EditAccountInfo using Telegraph API. Returns Account object
func GetAccountInfo ¶
func GetAccountInfo(opts *GetAccountInfoOpts) (acc *Account, err error)
GetAccountInfo using Telegraph API. Returns Account object
func RevokeAccessToken ¶
func RevokeAccessToken(opts *RevokeAccessTokenOpts) (acc *Account, err error)
RevokeAccessToken using Telegraph API. Returns Account object
type AllValueTypes ¶
type AllValueTypes 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 int64 `json:"page_count"` TotalCount int64 `json:"total_count"` Pages []Page `json:"pages"` Path string `json:"path"` URL string `json:"url"` Title string `json:"title"` Description string `json:"description"` ImageURL string `json:"image_url"` Content string `json:"content"` Views int64 `json:"views"` CanEdit bool `json:"can_edit"` }
A way to set defaults to their zero types instead of nil Know a better way to do this?
type CreateAccountOpts ¶
type CreateAccountOpts struct { // Required. 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 // Optional. Default author name used when creating new articles. AuthorName string // Optional. Default 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 }
CreateAccountOpts is the set of fields for 'Telegraph.CreateAccount'
type CreatePageOpts ¶
type CreatePageOpts struct { // Required. Access token of the Telegraph account. AccessToken string // Required. Page title. Title string // Optional. Author name, displayed below the article's title. AuthorName string // 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 // Required. Content of the page. Content string // Optional. If true, a content field will be returned in the Page object (see: Content format). ReturnContent bool }
CreatePageOpts is the set of fields for 'Telegraph.CreatePage'
type EditAccountInfoOpts ¶
type EditAccountInfoOpts struct { // Required. Access token of the Telegraph account. AccessToken string // Optional. New account name. ShortName string // Optional. New default author name used when creating new articles. AuthorName string // Optional. New default 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 }
EditAccountInfoOpts is the set of fields for 'Telegraph.EditAccountInfo'
type EditPageOpts ¶
type EditPageOpts struct { // Required. Access token of the Telegraph account. AccessToken string // Required. Path to the page. Path string // Required. Page title. Title string // Required. Content of the page. Content string // Optional. Author name, displayed below the article's title. AuthorName string // 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 // Optional. If�true, a content field will be returned in the Page object. ReturnContent bool }
EditPageOpts is the set of fields for 'Telegraph.EditPage'
type GetAccountInfoOpts ¶
type GetAccountInfoOpts struct { // Required. Access token of the Telegraph account. AccessToken string // Optional. List of account fields to return. Available fields: short_name, author_name, author_url, auth_url, page_count. Fields []string }
GetAccountInfoOpts is the set of fields for 'Telegraph.GetAccountInfo'
type GetPageListOpts ¶
type GetPageListOpts struct { // Required. Access token of the Telegraph account. AccessToken string // Optional. Sequential number of the first page to be returned. Offset int64 // Optional. Limits the number of pages to be retrieved. Limit int64 }
GetPageListOpts is the set of fields for 'Telegraph.GetPageList'
type GetPageOpts ¶
type GetPageOpts struct { // Required. Path to the Telegraph page (in the format Title-12-31, i.e. everything that comes after http://telegra.ph/). Path string // Optional. If�true, content field will be returned in Page object. ReturnContent bool }
GetPageOpts is the set of fields for 'Telegraph.GetPage'
type GetViewsOpts ¶
type GetViewsOpts struct { // Required. Path to the Telegraph page (in the format Title-12-31, where 12 is the month and 31 the day the article was first published). Path string // Required if month is passed. If passed, the number of page views for the requested year will be returned. Year int64 // Required if day is passed. If passed, the number of page views for the requested month will be returned. Month int64 // Required if hour is passed. If passed, the number of page views for the requested day will be returned. Day int64 // Optional. If passed, the number of page views for the requested hour will be returned. Hour int64 }
GetViewsOpts is the set of fields for 'Telegraph.GetViews'
type Page ¶
type Page struct { Path string `json:"path"` URL string `json:"url"` Title string `json:"title"` Description string `json:"description"` AuthorName string `json:"author_name"` AuthorURL string `json:"author_url"` ImageURL string `json:"image_url"` Content string `json:"content"` Views int64 `json:"views"` CanEdit bool `json:"can_edit"` }
Page implements the Page type of Telegraph API
func CreatePage ¶
func CreatePage(opts *CreatePageOpts) (page *Page, err error)
CreatePage using Telegraph API. Returns Page object
func EditPage ¶
func EditPage(opts *EditPageOpts) (page *Page, err error)
EditPage using Telegraph API. Returns Page object
func GetPage ¶
func GetPage(opts *GetPageOpts) (page *Page, err error)
GetPage using Telegraph API. Returns Page object
type PageList ¶
PageList implements the PageList type of Telegraph API
func GetPageList ¶
func GetPageList(opts *GetPageListOpts) (pl *PageList, err error)
GetPageList using Telegraph API. Returns PageList object
type PageViews ¶
type PageViews struct {
Views int64 `json:"views"`
}
PageViews implements the PageViews type of Telegraph API
func GetViews ¶
func GetViews(opts *GetViewsOpts) (views *PageViews, err error)
GetViews using Telegraph API. Returns PageViews object
type ResultStruct ¶
type ResultStruct struct { Ok bool `json:"ok"` Result AllValueTypes `json:"result,omitempty"` Error string `json:"error,omitempty"` }
type RevokeAccessTokenOpts ¶
type RevokeAccessTokenOpts struct { // Required. Access token of the Telegraph account. AccessToken string }
RevokeAccessTokenOpts is the set of fields for 'Telegraph.RevokeAccessToken'
type UploadResult ¶
type UploadResult struct {
Source []Source
}