🎨 Code format
This commit is contained in:
parent
1c4ba0aed4
commit
8f940594c4
10
account.go
10
account.go
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
http "github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// CreateAccount create a new Telegraph account. Most users only need one
|
||||
|
@ -14,7 +14,7 @@ import (
|
|||
// channels. On success, returns an Account object with the regular fields and
|
||||
// an additional access_token field.
|
||||
func CreateAccount(shortName string, authorName string, authorURL string) (*Account, error) {
|
||||
var args fasthttp.Args
|
||||
var args http.Args
|
||||
|
||||
// Account name, helps users with several accounts remember which they are
|
||||
// currently using. Displayed to the user above the "Edit/Publish" button
|
||||
|
@ -47,7 +47,7 @@ func CreateAccount(shortName string, authorName string, authorURL string) (*Acco
|
|||
// parameters that you want to edit. On success, returns an Account object
|
||||
// with the default fields.
|
||||
func (account *Account) EditAccountInfo(update *Account) (*Account, error) {
|
||||
var args fasthttp.Args
|
||||
var args http.Args
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
@ -80,7 +80,7 @@ func (account *Account) EditAccountInfo(update *Account) (*Account, error) {
|
|||
// GetAccountInfo get information about a Telegraph account. Returns an
|
||||
// Account object on success.
|
||||
func (account *Account) GetAccountInfo(fields []string) (*Account, error) {
|
||||
var args fasthttp.Args
|
||||
var args http.Args
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
@ -108,7 +108,7 @@ func (account *Account) GetAccountInfo(fields []string) (*Account, error) {
|
|||
// 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) {
|
||||
var args fasthttp.Args
|
||||
var args http.Args
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/html"
|
||||
html "golang.org/x/net/html"
|
||||
)
|
||||
|
||||
var availableTags = map[string]bool{
|
||||
|
|
12
page.go
12
page.go
|
@ -5,12 +5,12 @@ import (
|
|||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
http "github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// CreatePage create a new Telegraph page. On success, returns a Page object.
|
||||
func (account *Account) CreatePage(page *Page, returnContent bool) (*Page, error) {
|
||||
var args fasthttp.Args
|
||||
var args http.Args
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
@ -58,7 +58,7 @@ func (account *Account) CreatePage(page *Page, returnContent bool) (*Page, error
|
|||
// EditPage edit an existing Telegraph page. On success, returns a Page
|
||||
// object.
|
||||
func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error) {
|
||||
var args fasthttp.Args
|
||||
var args http.Args
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
@ -105,7 +105,7 @@ func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error
|
|||
|
||||
// GetPage get a Telegraph page. Returns a Page object on success.
|
||||
func GetPage(path string, returnContent bool) (*Page, error) {
|
||||
var args fasthttp.Args
|
||||
var args http.Args
|
||||
|
||||
// If true, content field will be returned in Page object.
|
||||
args.Add("return_content", strconv.FormatBool(returnContent))
|
||||
|
@ -127,7 +127,7 @@ func GetPage(path string, returnContent bool) (*Page, error) {
|
|||
// GetPageList get a list of pages belonging to a Telegraph account. Returns
|
||||
// a PageList object, sorted by most recently created pages first.
|
||||
func (account *Account) GetPageList(offset int, limit int) (*PageList, error) {
|
||||
var args fasthttp.Args
|
||||
var args http.Args
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
@ -156,7 +156,7 @@ func (account *Account) GetPageList(offset int, limit int) (*PageList, error) {
|
|||
// total number of page views will be returned. Returns a PageViews object
|
||||
// on success.
|
||||
func GetViews(path string, hour int, day int, month int, year int) (*PageViews, error) {
|
||||
var args fasthttp.Args
|
||||
var args http.Args
|
||||
|
||||
if hour > -1 {
|
||||
// If passed, the number of page views for the requested hour will
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
http "github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// Telegraph constants
|
||||
|
@ -132,8 +132,8 @@ type (
|
|||
}
|
||||
)
|
||||
|
||||
func request(url string, args *fasthttp.Args) (*Response, error) {
|
||||
_, resp, err := fasthttp.Post(nil, url, args)
|
||||
func request(url string, args *http.Args) (*Response, error) {
|
||||
_, resp, err := http.Post(nil, url, args)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue