-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetPages.go
More file actions
43 lines (34 loc) · 745 Bytes
/
getPages.go
File metadata and controls
43 lines (34 loc) · 745 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
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"encoding/json"
)
type sharedPagesRequest struct {
IncludeDeleted bool `json:"includeDeleted"`
}
type sharedPagesResponse struct {
Pages []struct {
ID string `json:"id"`
SpaceID string `json:"spaceId"`
} `json:"pages"`
}
func getPages() []string {
t := sharedPagesRequest{
IncludeDeleted: false,
}
// Serialize json request
reqBody, err := json.Marshal(t)
if err != nil {
print("error")
}
// Send request
reply := requestData("getUserSharedPages", reqBody)
// Deserialize json response
end := sharedPagesResponse{}
json.Unmarshal(reply, &end)
var pages []string
for i := range end.Pages {
// Add page block ids to pages[]
pages = append(pages, end.Pages[i].ID)
}
return pages
}