-
Notifications
You must be signed in to change notification settings - Fork 0
/
google_api_response.go
94 lines (91 loc) · 3.27 KB
/
google_api_response.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package main
// https://cse.google.com/cse/setup/basic?cx=013327425812576012613:3t1bx0dps9c
// https://developers.google.com/custom-search/json-api/v1/reference/cse/list
// GoogleAPIResponse generated by json2Go
type GoogleAPIResponse struct {
Kind string `json:"kind"`
URL struct {
Type string `json:"type"`
Template string `json:"template"`
} `json:"url"`
Queries struct {
Request []struct {
Title string `json:"title"`
TotalResults string `json:"totalResults"`
SearchTerms string `json:"searchTerms"`
Count int `json:"count"`
StartIndex int `json:"startIndex"`
InputEncoding string `json:"inputEncoding"`
OutputEncoding string `json:"outputEncoding"`
Safe string `json:"safe"`
Cx string `json:"cx"`
SearchType string `json:"searchType"`
} `json:"request"`
PreviousPage []struct {
Title string `json:"title"`
TotalResults string `json:"totalResults"`
SearchTerms string `json:"searchTerms"`
Count int `json:"count"`
StartIndex int `json:"startIndex"`
InputEncoding string `json:"inputEncoding"`
OutputEncoding string `json:"outputEncoding"`
Safe string `json:"safe"`
Cx string `json:"cx"`
SearchType string `json:"searchType"`
} `json:"previousPage"`
NextPage []struct {
Title string `json:"title"`
TotalResults string `json:"totalResults"`
SearchTerms string `json:"searchTerms"`
Count int `json:"count"`
StartIndex int `json:"startIndex"`
InputEncoding string `json:"inputEncoding"`
OutputEncoding string `json:"outputEncoding"`
Safe string `json:"safe"`
Cx string `json:"cx"`
SearchType string `json:"searchType"`
} `json:"nextPage"`
} `json:"queries"`
Context struct {
Title string `json:"title"`
} `json:"context"`
SearchInformation struct {
SearchTime float64 `json:"searchTime"`
FormattedSearchTime string `json:"formattedSearchTime"`
TotalResults string `json:"totalResults"`
FormattedTotalResults string `json:"formattedTotalResults"`
} `json:"searchInformation"`
Items []struct {
Kind string `json:"kind"`
Title string `json:"title"`
HTMLTitle string `json:"htmlTitle"`
Link string `json:"link"`
DisplayLink string `json:"displayLink"`
Snippet string `json:"snippet"`
HTMLSnippet string `json:"htmlSnippet"`
Mime string `json:"mime"`
Image struct {
ContextLink string `json:"contextLink"`
Height int `json:"height"`
Width int `json:"width"`
ByteSize int `json:"byteSize"`
ThumbnailLink string `json:"thumbnailLink"`
ThumbnailHeight int `json:"thumbnailHeight"`
ThumbnailWidth int `json:"thumbnailWidth"`
} `json:"image"`
} `json:"items"`
}
// GoogleAPIErrorResponse generated by json2go
type GoogleAPIErrorResponse struct {
Error struct {
Errors []struct {
Domain string `json:"domain"`
Reason string `json:"reason"`
Message string `json:"message"`
LocationType string `json:"locationType"`
Location string `json:"location"`
} `json:"errors"`
Code int `json:"code"`
Message string `json:"message"`
} `json:"error"`
}