-
Notifications
You must be signed in to change notification settings - Fork 1
/
structs.go
50 lines (42 loc) · 1.06 KB
/
structs.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
package serendip
// A struct for parsing results of Wikipedia API
type WikipediaRandomResult struct {
Query struct {
Random []WikipediaPage `json:"random"`
} `json:"query"`
}
// A struct for Wikipedia page infomation
type WikipediaPage struct {
Id int `json:"id"`
Title string `json:"title"`
}
// A struct for page fetching results
type PageResult struct {
Query struct {
Pages map[string]Page `json:"pages"`
} `json:"query"`
}
type Page struct {
PageID int `json:"pageid"`
NS int `json:"ns"`
Title string `json:"title"`
Extract string `json:"extract"`
}
// search results
type SearchResponse struct {
BatchComplete string `json:"batchcomplete"`
Continue SearchContinue `json:"continue"`
Query SearchResult `json:"query"`
}
type SearchResult struct {
PrefixSearch []PrefixSearch `json:"prefixsearch"`
}
type PrefixSearch struct {
NS int `json:"ns"`
Title string `json:"title"`
PageID int `json:"pageid"`
}
type SearchContinue struct {
PSOffset int `json:"psoffset"`
Continue string `json:"continue"`
}