-
Notifications
You must be signed in to change notification settings - Fork 6
/
types.go
80 lines (72 loc) · 2.62 KB
/
types.go
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package telegraph
// type Telegraph struct {
// Account `json:"account"`
// PageList `json:"pageList"`
// Page `json:"page"`
// PageViews `json:"pageViews"`
// Node `json:"node"`
// NodeElement `json:"nodeElement"`
// }
// Account implements the Account type of Telegraph API
type Account struct {
ShortName string `json:"short_name"`
AuthorName string `json:"author_name"`
AuthorURL string `json:"author_url"`
AccessToken string `json:"access_token"`
AuthURL string `json:"auth_url"`
PageCount int64 `json:"page_count"`
}
// PageList implements the PageList type of Telegraph API
type PageList struct {
TotalCount int64 `json:"total_count"`
Pages []Page `json:"pages"`
}
// Page implements the Page type of Telegraph API
type Page struct {
Path string `json:"path"`
URL string `json:"url"`
Title string `json:"title"`
Description string `json:"description"`
AuthorName string `json:"author_name"`
AuthorURL string `json:"author_url"`
ImageURL string `json:"image_url"`
Content []Node `json:"content"`
Views int64 `json:"views"`
CanEdit bool `json:"can_edit"`
}
// PageViews implements the PageViews type of Telegraph API
type PageViews struct {
Views int64 `json:"views"`
}
// Node implements the Node type of Telegraph API
// It can be a String or NodeElement object
type Node interface{}
// NodeElement implements the NodeElement type of Telegraph API
type NodeElement struct {
Tag string `json:"tag"`
Attrs map[string]string `json:"attrs"`
Children []Node `json:"children"`
}
// A way to set defaults to their zero types instead of nil
// Know a better way to do this?
type AllValueTypes struct {
ShortName string `json:"short_name"`
AuthorName string `json:"author_name"`
AuthorURL string `json:"author_url"`
AccessToken string `json:"access_token"`
AuthURL string `json:"auth_url"`
PageCount int64 `json:"page_count"`
TotalCount int64 `json:"total_count"`
Pages []Page `json:"pages"`
Path string `json:"path"`
URL string `json:"url"`
Title string `json:"title"`
Description string `json:"description"`
ImageURL string `json:"image_url"`
Content []Node `json:"content"`
Views int64 `json:"views"`
CanEdit bool `json:"can_edit"`
Tag string `json:"tag"`
Attrs map[string]string `json:"attrs"`
Children []Node `json:"children"`
}