telegraph/get_page_list.go

29 lines
707 B
Go
Raw Normal View History

2017-09-04 21:09:59 +00:00
package telegraph
import (
"strconv"
json "github.com/pquerna/ffjson/ffjson"
http "github.com/valyala/fasthttp"
)
// GetPageList get a list of pages belonging to a Telegraph account. Returns a PageList object, sorted
// by most recently created pages first.
2018-07-27 11:51:14 +00:00
func (a *Account) GetPageList(offset, limit int) (r *PageList, err error) {
args := http.AcquireArgs()
2018-07-27 11:51:14 +00:00
defer http.ReleaseArgs(args)
args.Add("access_token", a.AccessToken) // required
2017-09-04 21:09:59 +00:00
args.Add("offset", strconv.Itoa(offset))
args.Add("limit", strconv.Itoa(limit))
2018-07-27 11:51:14 +00:00
dst := new(Response)
dst, err = makeRequest("getPageList", args)
2017-09-04 21:09:59 +00:00
if err != nil {
return nil, err
}
2018-07-27 11:51:14 +00:00
r = new(PageList)
err = json.Unmarshal(*dst.Result, r)
return
2017-09-04 21:09:59 +00:00
}