♻️ More safe using of fasthttp.Args
This commit is contained in:
parent
9789b5403f
commit
a979bbbb5d
|
@ -36,7 +36,7 @@ type Account struct {
|
|||
// for each of their channels. On success, returns an Account object with the regular fields and an
|
||||
// additional access_token field.
|
||||
func CreateAccount(account *Account) (*Account, error) {
|
||||
var args http.Args
|
||||
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
|
||||
|
|
|
@ -43,7 +43,7 @@ type Page struct {
|
|||
|
||||
// CreatePage create a new Telegraph page. On success, returns a Page object.
|
||||
func (account *Account) CreatePage(page *Page, returnContent bool) (*Page, error) {
|
||||
var args http.Args
|
||||
args := http.AcquireArgs()
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
// 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 http.Args
|
||||
args := http.AcquireArgs()
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
// EditPage edit an existing Telegraph page. On success, returns a Page
|
||||
// object.
|
||||
func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error) {
|
||||
var args http.Args
|
||||
args := http.AcquireArgs()
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
// GetAccountInfo get information about a Telegraph account. Returns an
|
||||
// Account object on success.
|
||||
func (account *Account) GetAccountInfo(fields ...string) (*Account, error) {
|
||||
var args http.Args
|
||||
args := http.AcquireArgs()
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
// GetPage get a Telegraph page. Returns a Page object on success.
|
||||
func GetPage(path string, returnContent bool) (*Page, error) {
|
||||
var args http.Args
|
||||
args := http.AcquireArgs()
|
||||
|
||||
// If true, content field will be returned in Page object.
|
||||
args.Add("return_content", strconv.FormatBool(returnContent))
|
||||
|
|
|
@ -20,7 +20,7 @@ type PageList struct {
|
|||
// 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, limit int) (*PageList, error) {
|
||||
var args http.Args
|
||||
args := http.AcquireArgs()
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
|
|
@ -16,7 +16,7 @@ type PageViews struct {
|
|||
// GetViews get the number of views for a Telegraph article. By default, the total number of page
|
||||
// views will be returned. Returns a PageViews object on success.
|
||||
func GetViews(path string, hour, day, month, year int) (*PageViews, error) {
|
||||
var args http.Args
|
||||
args := http.AcquireArgs()
|
||||
|
||||
if hour > -1 {
|
||||
// If passed, the number of page views for the requested hour will
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
// 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 http.Args
|
||||
args := http.AcquireArgs()
|
||||
|
||||
// Access token of the Telegraph account.
|
||||
args.Add("access_token", account.AccessToken) // required
|
||||
|
|
Loading…
Reference in New Issue