/
compositeresult.go
43 lines (39 loc) · 1.67 KB
/
compositeresult.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
// Copyright 2012 Microsoft (data structure).
// Copyright 2016 Erlend Johannessen (code).
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package bingapi
// CompositeResult receives all results from a composite Bing search.
// The totals and offsets are in the Bing documentation described as int64,
// but in the received json they were strings.
type CompositeResult struct {
MetaData MetaData `json:"__metadata"`
ID string
WebTotal string // originally int64
WebOffset string // originally int64
ImageTotal string // originally int64
ImageOffset string // originally int64
VideoTotal string // originally int64
VideoOffset string // originally int64
NewsTotal string // originally int64
NewsOffset string // originally int64
SpellingSuggestionsTotal string // originally int64
AlteredQuery string
AlterationOverrideQuery string
Web []WebResult
Image []ImageResult
Video []VideoResult
News []NewsResult
RelatedSearch []RelatedResult
SpellingSuggestions []SpellResult
}
// CompositeResultContainer receives a slice of CompositeResult.
// Only the first element in the slice is used.
type CompositeResultContainer struct {
Results []CompositeResult `json:"results"`
}
// compositeResultWrapper is the outer wrapper for the result.
// Not used for more than receiving the resultcontainer.
type compositeResultWrapper struct {
Data CompositeResultContainer `json:"d"`
}