-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathawsresponse.go
211 lines (189 loc) · 4.66 KB
/
awsresponse.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
package amazonproduct
// Response describes the generic API Response
type AWSResponse struct {
OperationRequest struct {
RequestID string `xml:"RequestId"`
Arguments []Argument `xml:"Arguments>Argument"`
RequestProcessingTime float64
}
}
// Argument todo
type Argument struct {
Name string `xml:"Name,attr"`
Value string `xml:"Value,attr"`
}
// Image todo
type Image struct {
URL string
Height uint16
Width uint16
}
// Price describes the product price as
// Amount of cents in CurrencyCode
type Price struct {
Amount uint
CurrencyCode string
FormattedPrice string
}
type TopSeller struct {
ASIN string
Title string
}
// Item represents a product returned by the API
type Item struct {
ASIN string
URL string
DetailPageURL string
ItemAttributes *ItemAttributes
OfferSummary OfferSummary
Offers Offers
SalesRank int
SmallImage *Image
MediumImage *Image
LargeImage *Image
ImageSets *ImageSets
EditorialReviews EditorialReviews
BrowseNodes struct {
BrowseNode []BrowseNode
}
}
// BrowseNode represents a browse node returned by API
type BrowseNode struct {
BrowseNodeID string `xml:"BrowseNodeId"`
Name string
TopSellers struct {
TopSeller []TopSeller
}
Ancestors struct {
BrowseNode []BrowseNode
}
}
// Creator element in ItemAttributes
type Creator struct {
Role string `xml:"Role,attr"`
Value string `xml:",chardata"`
}
// ItemAttributes response group
type ItemAttributes struct {
Author []string
Binding string
Brand string
Color string
EAN string
EISBN string
Creator []Creator
Title string
ListPrice Price
Manufacturer string
Publisher string
NumberOfItems int
PackageQuantity int
Feature []string
Model string
ProductGroup string
PublicationDate string
ReleaseDate string
Studio string
Warranty string
Size string
UPC string
}
// Offer response attribute
type Offer struct {
Condition string `xml:"OfferAttributes>Condition"`
ID string `xml:"OfferListing>OfferListingId"`
IsEligibleForPrime bool `xml:"OfferListing>IsEligibleForPrime"`
Price Price `xml:"OfferListing>Price"`
PercentageSaved uint `xml:"OfferListing>PercentageSaved"`
Availability string `xml:"OfferListing>Availability"`
}
// Offers response group
type Offers struct {
TotalOffers int
TotalOfferPages int
MoreOffersURL string `xml:"MoreOffersUrl"`
Offers []Offer `xml:"Offer"`
}
// OfferSummary response group
type OfferSummary struct {
LowestNewPrice Price
LowestUsedPrice Price
TotalNew int
TotalUsed int
TotalCollectible int
TotalRefurbished int
}
// EditorialReview response attribute
type EditorialReview struct {
Source string
Content string
}
// EditorialReviews response group
type EditorialReviews struct {
EditorialReview EditorialReview
}
// BrowseNodeLookupRequest is the confirmation of a BrowseNodeInfo request
type BrowseNodeLookupRequest struct {
BrowseNodeId string
ResponseGroup string
}
// ItemLookupRequest is the confirmation of a ItemLookup request
type ItemLookupRequest struct {
IDType string `xml:"IdType"`
ItemID string `xml:"ItemId"`
ResponseGroup string `xml:"ResponseGroup"`
VariationPage string
}
// ItemLookupResponse describes the API response for the ItemLookup operation
type ItemLookupResponse struct {
AWSResponse
Items struct {
Request struct {
IsValid bool
ItemLookupRequest ItemLookupRequest
}
Item []Item `xml:"Item"`
}
}
// ItemSearchRequest is the confirmation of a ItemSearch request
type ItemSearchRequest struct {
Keywords string `xml:"Keywords"`
SearchIndex string `xml:"SearchIndex"`
ResponseGroup string `xml:"ResponseGroup"`
}
type ItemSearchResponse struct {
AWSResponse
Items struct {
Request struct {
IsValid bool
ItemSearchRequest ItemSearchRequest
}
Items []Item `xml:"Item"`
TotalResults int
TotalPages int
MoreSearchResultsUrl string
}
}
type BrowseNodeLookupResponse struct {
AWSResponse
BrowseNodes struct {
Request struct {
IsValid bool
BrowseNodeLookupRequest BrowseNodeLookupRequest
}
BrowseNode BrowseNode
}
}
type ImageSets struct {
ImageSet []ImageSet
}
type ImageSet struct {
//Category string `xml:"Category,attr"`
Category string `xml:",attr"`
SwatchImage *Image
SmallImage *Image
ThumbnailImage *Image
TinyImage *Image
MediumImage *Image
LargeImage *Image
}