parent
7d9e3b38ae
commit
5f83fd5342
|
@ -1,8 +1,6 @@
|
||||||
package telegraph
|
package telegraph
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
json "github.com/pquerna/ffjson/ffjson"
|
json "github.com/pquerna/ffjson/ffjson"
|
||||||
http "github.com/valyala/fasthttp"
|
http "github.com/valyala/fasthttp"
|
||||||
)
|
)
|
||||||
|
@ -53,8 +51,7 @@ func CreateAccount(account *Account) (*Account, error) {
|
||||||
// or channel.
|
// or channel.
|
||||||
args.Add("author_url", account.AuthorURL)
|
args.Add("author_url", account.AuthorURL)
|
||||||
|
|
||||||
url := fmt.Sprintf(APIEndpoint, "createAccount")
|
body, err := request("createAccount", "", args)
|
||||||
body, err := request(url, &args)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package telegraph
|
package telegraph
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
json "github.com/pquerna/ffjson/ffjson"
|
json "github.com/pquerna/ffjson/ffjson"
|
||||||
|
@ -75,8 +74,7 @@ func (account *Account) CreatePage(page *Page, returnContent bool) (*Page, error
|
||||||
// Content of the page.
|
// Content of the page.
|
||||||
args.Add("content", string(content)) // required
|
args.Add("content", string(content)) // required
|
||||||
|
|
||||||
url := fmt.Sprintf(APIEndpoint, "createPage")
|
body, err := request("createPage", "", args)
|
||||||
body, err := request(url, &args)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package telegraph
|
package telegraph
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
json "github.com/pquerna/ffjson/ffjson"
|
json "github.com/pquerna/ffjson/ffjson"
|
||||||
http "github.com/valyala/fasthttp"
|
http "github.com/valyala/fasthttp"
|
||||||
)
|
)
|
||||||
|
@ -27,8 +25,7 @@ func (account *Account) EditAccountInfo(update *Account) (*Account, error) {
|
||||||
// or channel.
|
// or channel.
|
||||||
args.Add("author_url", update.AuthorURL)
|
args.Add("author_url", update.AuthorURL)
|
||||||
|
|
||||||
url := fmt.Sprintf(APIEndpoint, "editAccountInfo")
|
body, err := request("editAccountInfo", "", args)
|
||||||
body, err := request(url, &args)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package telegraph
|
package telegraph
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
json "github.com/pquerna/ffjson/ffjson"
|
json "github.com/pquerna/ffjson/ffjson"
|
||||||
|
@ -42,8 +41,7 @@ func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error
|
||||||
// Content of the page.
|
// Content of the page.
|
||||||
args.Add("content", string(content)) // required
|
args.Add("content", string(content)) // required
|
||||||
|
|
||||||
url := fmt.Sprintf(PathEndpoint, "editPage", update.Path)
|
body, err := request("editPage", update.Path, args)
|
||||||
body, err := request(url, &args)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,7 @@ func (account *Account) GetAccountInfo(fields ...string) (*Account, error) {
|
||||||
// author_name, author_url, auth_url, page_count.
|
// author_name, author_url, auth_url, page_count.
|
||||||
args.Add("fields", fmt.Sprint(`["`, strings.Join(fields, `","`), `"]`))
|
args.Add("fields", fmt.Sprint(`["`, strings.Join(fields, `","`), `"]`))
|
||||||
|
|
||||||
url := fmt.Sprintf(APIEndpoint, "getAccountInfo")
|
body, err := request("getAccountInfo", "", args)
|
||||||
body, err := request(url, &args)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package telegraph
|
package telegraph
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
json "github.com/pquerna/ffjson/ffjson"
|
json "github.com/pquerna/ffjson/ffjson"
|
||||||
|
@ -15,8 +14,7 @@ func GetPage(path string, returnContent bool) (*Page, error) {
|
||||||
// If true, content field will be returned in Page object.
|
// If true, content field will be returned in Page object.
|
||||||
args.Add("return_content", strconv.FormatBool(returnContent))
|
args.Add("return_content", strconv.FormatBool(returnContent))
|
||||||
|
|
||||||
url := fmt.Sprintf(PathEndpoint, "getPage", path)
|
body, err := request("getPage", path, args)
|
||||||
body, err := request(url, &args)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package telegraph
|
package telegraph
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
json "github.com/pquerna/ffjson/ffjson"
|
json "github.com/pquerna/ffjson/ffjson"
|
||||||
|
@ -32,8 +31,7 @@ func (account *Account) GetPageList(offset, limit int) (*PageList, error) {
|
||||||
// Limits the number of pages to be retrieved.
|
// Limits the number of pages to be retrieved.
|
||||||
args.Add("limit", strconv.Itoa(limit))
|
args.Add("limit", strconv.Itoa(limit))
|
||||||
|
|
||||||
url := fmt.Sprintf(APIEndpoint, "getPageList")
|
body, err := request("getPageList", "", args)
|
||||||
body, err := request(url, &args)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package telegraph
|
package telegraph
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
json "github.com/pquerna/ffjson/ffjson"
|
json "github.com/pquerna/ffjson/ffjson"
|
||||||
|
@ -43,8 +42,7 @@ func GetViews(path string, hour, day, month, year int) (*PageViews, error) {
|
||||||
args.Add("year", strconv.Itoa(year))
|
args.Add("year", strconv.Itoa(year))
|
||||||
}
|
}
|
||||||
|
|
||||||
url := fmt.Sprintf(PathEndpoint, "getViews", path)
|
body, err := request("getViews", path, args)
|
||||||
body, err := request(url, &args)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package telegraph
|
package telegraph
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
json "github.com/pquerna/ffjson/ffjson"
|
json "github.com/pquerna/ffjson/ffjson"
|
||||||
http "github.com/valyala/fasthttp"
|
http "github.com/valyala/fasthttp"
|
||||||
)
|
)
|
||||||
|
@ -17,8 +15,7 @@ func (account *Account) RevokeAccessToken() (*Account, error) {
|
||||||
// Access token of the Telegraph account.
|
// Access token of the Telegraph account.
|
||||||
args.Add("access_token", account.AccessToken) // required
|
args.Add("access_token", account.AccessToken) // required
|
||||||
|
|
||||||
url := fmt.Sprintf(APIEndpoint, "revokeAccessToken")
|
body, err := request("revokeAccessToken", "", args)
|
||||||
body, err := request(url, &args)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue