-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_page_list.go
More file actions
32 lines (26 loc) · 823 Bytes
/
Copy pathget_page_list.go
File metadata and controls
32 lines (26 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package telegraph
type getPageList struct {
// Access token of the Telegraph account.
AccessToken string `json:"access_token"`
// Sequential number of the first page to be returned.
Offset int `json:"offset,omitempty"`
// Limits the number of pages to be retrieved.
Limit int `json:"limit,omitempty"`
}
// GetPageList get a list of pages belonging to a Telegraph account. Returns a PageList object, sorted by most
// recently created pages first.
func (a *Account) GetPageList(offset, limit int) (*PageList, error) {
data, err := makeRequest("getPageList", getPageList{
AccessToken: a.AccessToken,
Offset: offset,
Limit: limit,
})
if err != nil {
return nil, err
}
result := new(PageList)
if err = parser.Unmarshal(data, result); err != nil {
return nil, err
}
return result, nil
}