🙂 Fix codestyle and some things
This commit is contained in:
parent
e2253e159d
commit
fe87b5a44a
|
@ -5,7 +5,7 @@
|
|||
[![Build Status](https://travis-ci.org/toby3d/telegraph.svg)](https://travis-ci.org/toby3d/telegraph)
|
||||
[![GoDoc](https://godoc.org/github.com/toby3d/telegraph?status.svg)](https://godoc.org/github.com/toby3d/telegraph)
|
||||
[![Go Report](https://goreportcard.com/badge/github.com/toby3d/telegraph)](https://goreportcard.com/report/github.com/toby3d/telegraph)
|
||||
[![Patreon](https://img.shields.io/badge/support-patreon-E66500.svg?maxAge=2592000)](https://www.patreon.com/toby3d)
|
||||
[![Patreon](https://img.shields.io/badge/support-patreon-E6461A.svg?maxAge=2592000)](https://www.patreon.com/toby3d)
|
||||
|
||||
All [methods](http://telegra.ph/api#Available-methods) and [types](http://telegra.ph/api#Available-types) available! Yaay!
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@ package telegraph
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/valyala/fasthttp"
|
||||
"strings"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// CreateAccount create a new Telegraph account. Most users only need one
|
||||
|
|
|
@ -4,8 +4,9 @@ import (
|
|||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"golang.org/x/net/html"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/html"
|
||||
)
|
||||
|
||||
var availableTags = map[string]bool{
|
||||
|
|
3
page.go
3
page.go
|
@ -3,8 +3,9 @@ package telegraph
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/valyala/fasthttp"
|
||||
"strconv"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
// CreatePage create a new Telegraph page. On success, returns a Page object.
|
||||
|
|
|
@ -5,6 +5,7 @@ package telegraph
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
|
@ -132,13 +133,13 @@ type (
|
|||
)
|
||||
|
||||
func request(url string, args *fasthttp.Args) (*Response, error) {
|
||||
_, res, err := fasthttp.Post(nil, url, args)
|
||||
_, resp, err := fasthttp.Post(nil, url, args)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tResp Response
|
||||
if err := json.Unmarshal(res, &tResp); err != nil {
|
||||
if err := json.Unmarshal(resp, &tResp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ func TestCreateValidAccount(t *testing.T) {
|
|||
}
|
||||
|
||||
demoAccount = *account
|
||||
t.Logf("New account created!\n%#v", *account)
|
||||
t.Logf("New account created!")
|
||||
}
|
||||
|
||||
func TestCreateValidPage(t *testing.T) {
|
||||
|
@ -61,12 +61,12 @@ func TestEditValidAccountInfo(t *testing.T) {
|
|||
AuthorURL: "https://telegram.me/telegraph",
|
||||
}
|
||||
|
||||
info, err := demoAccount.EditAccountInfo(update)
|
||||
_, err := demoAccount.EditAccountInfo(update)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
t.Logf("Account updated!\n%#v", *info)
|
||||
t.Logf("Account updated!")
|
||||
}
|
||||
|
||||
func TestEditValidPage(t *testing.T) {
|
||||
|
@ -96,7 +96,7 @@ func TestGetValidAccountInfo(t *testing.T) {
|
|||
t.Error(err)
|
||||
}
|
||||
|
||||
t.Logf("Account info:\n%#v", *account)
|
||||
t.Logf("%s create %d pages", account.ShortName, account.PageCount)
|
||||
}
|
||||
|
||||
func TestGetValidPageList(t *testing.T) {
|
||||
|
@ -127,12 +127,10 @@ func TestGetValidViews(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRevokeAccessToken(t *testing.T) {
|
||||
t.Logf("Old Access Token: %s", demoAccount.AccessToken)
|
||||
|
||||
token, err := demoAccount.RevokeAccessToken()
|
||||
_, err := demoAccount.RevokeAccessToken()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
t.Logf("New Access Token: %s", token.AccessToken)
|
||||
t.Logf("New Access Token set!")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue