parent
97ea0772e7
commit
ffbe39bb83
|
@ -78,7 +78,8 @@ func domToNode(domNode *html.Node) interface{} {
|
|||
|
||||
var nodeElement NodeElement
|
||||
switch strings.ToLower(domNode.Data) {
|
||||
case "a", "aside", "b", "blockquote", "br", "code", "em", "figcaption", "figure", "h3", "h4", "hr", "i", "iframe", "img", "li", "ol", "p", "pre", "s", "strong", "u", "ul", "video":
|
||||
case "a", "aside", "b", "blockquote", "br", "code", "em", "figcaption", "figure", "h3", "h4",
|
||||
"hr", "i", "iframe", "img", "li", "ol", "p", "pre", "s", "strong", "u", "ul", "video":
|
||||
nodeElement.Tag = domNode.Data
|
||||
|
||||
for i := range domNode.Attr {
|
||||
|
|
|
@ -38,17 +38,16 @@ type Account struct {
|
|||
func CreateAccount(account *Account) (*Account, error) {
|
||||
args := http.AcquireArgs()
|
||||
|
||||
// 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.
|
||||
// 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.
|
||||
args.Add("short_name", account.ShortName) // required
|
||||
|
||||
// Default author name used when creating new articles.
|
||||
args.Add("author_name", account.AuthorName)
|
||||
|
||||
// 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.
|
||||
// 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.
|
||||
args.Add("author_url", account.AuthorURL)
|
||||
|
||||
body, err := request("createAccount", "", args)
|
||||
|
|
|
@ -57,9 +57,8 @@ func (account *Account) CreatePage(page *Page, returnContent bool) (*Page, error
|
|||
}
|
||||
|
||||
if page.AuthorURL != "" {
|
||||
// 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.
|
||||
// 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.
|
||||
args.Add("author_url", page.AuthorURL)
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@ import (
|
|||
http "github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// EditAccountInfo update information about a Telegraph account. Pass only the
|
||||
// parameters that you want to edit. On success, returns an Account object
|
||||
// with the default fields.
|
||||
// EditAccountInfo update information about a Telegraph account. Pass only the parameters that you
|
||||
// want to edit. On success, returns an Account object with the default fields.
|
||||
func (account *Account) EditAccountInfo(update *Account) (*Account, error) {
|
||||
args := http.AcquireArgs()
|
||||
|
||||
|
@ -20,9 +19,8 @@ func (account *Account) EditAccountInfo(update *Account) (*Account, error) {
|
|||
// New default author name used when creating new articles.
|
||||
args.Add("author_name", update.AuthorName)
|
||||
|
||||
// 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.
|
||||
// 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.
|
||||
args.Add("author_url", update.AuthorURL)
|
||||
|
||||
body, err := request("editAccountInfo", "", args)
|
||||
|
|
|
@ -7,8 +7,7 @@ import (
|
|||
http "github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// EditPage edit an existing Telegraph page. On success, returns a Page
|
||||
// object.
|
||||
// EditPage edit an existing Telegraph page. On success, returns a Page object.
|
||||
func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error) {
|
||||
args := http.AcquireArgs()
|
||||
|
||||
|
@ -24,9 +23,8 @@ func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error
|
|||
}
|
||||
|
||||
if update.AuthorURL != "" {
|
||||
// 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.
|
||||
// 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.
|
||||
args.Add("author_url", update.AuthorURL)
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ func (account *Account) GetAccountInfo(fields ...string) (*Account, error) {
|
|||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
||||
// List of account fields to return. Available fields: short_name,
|
||||
// author_name, author_url, auth_url, page_count.
|
||||
// List of account fields to return.
|
||||
// Available fields: short_name, author_name, author_url, auth_url, page_count.
|
||||
args.Add("fields", fmt.Sprint(`["`, strings.Join(fields, `","`), `"]`))
|
||||
|
||||
body, err := request("getAccountInfo", "", args)
|
||||
|
|
15
get_views.go
15
get_views.go
|
@ -19,26 +19,25 @@ func GetViews(path string, hour, day, month, year int) (*PageViews, error) {
|
|||
args := http.AcquireArgs()
|
||||
|
||||
if hour > -1 {
|
||||
// If passed, the number of page views for the requested hour will
|
||||
// be returned.
|
||||
// If passed, the number of page views for the requested hour will be returned.
|
||||
args.Add("hour", strconv.Itoa(hour))
|
||||
}
|
||||
|
||||
if day > 0 {
|
||||
// Required if hour is passed. If passed, the number of page views
|
||||
// for the requested day will be returned.
|
||||
// Required if hour is passed. If passed, the number of page views for the requested day will
|
||||
// be returned.
|
||||
args.Add("day", strconv.Itoa(day))
|
||||
}
|
||||
|
||||
if month > 0 {
|
||||
// Required if day is passed. If passed, the number of page views
|
||||
// for the requested month will be returned.
|
||||
// Required if day is passed. If passed, the number of page views for the requested month will
|
||||
// be returned.
|
||||
args.Add("month", strconv.Itoa(month))
|
||||
}
|
||||
|
||||
if year > 0 {
|
||||
// Required if month is passed. If passed, the number of page views
|
||||
// for the requested year will be returned.
|
||||
// Required if month is passed. If passed, the number of page views for the requested year
|
||||
// will be returned.
|
||||
args.Add("year", strconv.Itoa(year))
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,9 @@ import (
|
|||
http "github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// RevokeAccessToken revoke access_token and generate a new one, for example,
|
||||
// if the user would like to reset all connected sessions, or you have reasons
|
||||
// to believe the token was compromised. On success, returns an Account object
|
||||
// with new access_token and auth_url fields.
|
||||
// RevokeAccessToken revoke access_token and generate a new one, for example, if the user would
|
||||
// like to reset all connected sessions, or you have reasons to believe the token was compromised. On
|
||||
// success, returns an Account object with new access_token and auth_url fields.
|
||||
func (account *Account) RevokeAccessToken() (*Account, error) {
|
||||
args := http.AcquireArgs()
|
||||
|
||||
|
|
Loading…
Reference in New Issue