@@ -74,9 +74,7 @@ pub struct Tips {
74
74
#[ derive( Clone , Debug , Deserialize , Eq , PartialEq ) ]
75
75
pub struct Tip {
76
76
// Attributes
77
- pub count : u32 ,
78
-
79
- pub tip : Vec < Tip > ,
77
+ pub text : String ,
80
78
}
81
79
82
80
/// A series of `DidYouMean` elements.
@@ -89,7 +87,15 @@ pub struct DidYouMeans {
89
87
}
90
88
91
89
/// Provides a suggestion for a different query than the one provided.
92
- pub type DidYouMean = String ;
90
+ #[ derive( Clone , Debug , Deserialize , Eq , PartialEq ) ]
91
+ pub struct DidYouMean {
92
+ // Attributes
93
+ pub score : String , // TODO: find a way to put a floating point here.
94
+ pub level : String ,
95
+
96
+ #[ serde( rename="$value" ) ]
97
+ pub value : String ,
98
+ }
93
99
94
100
/// Generated when a foreign language is detected in a query.
95
101
#[ derive( Clone , Debug , Deserialize , Eq , PartialEq ) ]
@@ -142,35 +148,47 @@ pub struct Warnings {
142
148
// Attributes
143
149
pub count : u32 ,
144
150
145
- pub warning : Vec < Warnings > ,
146
- }
147
-
148
- /// An enum representing all possible warning types.
149
- #[ derive( Clone , Debug , Deserialize , Eq , PartialEq ) ]
150
- pub enum Warning {
151
- Spellcheck {
152
- // Attributes
153
- word : String ,
154
- suggestion : String ,
155
- text : String ,
156
- } ,
157
- Delimeters {
158
- // Attributes
159
- text : String ,
160
- } ,
161
- Translation {
162
- // Attributes
163
- phrase : String ,
164
- trans : String ,
165
- lang : String ,
166
- text : String ,
167
- } ,
168
- Reinterpret {
169
- // Attributes
170
- text : String ,
171
-
172
- alternative : Vec < Alternative > ,
173
- } ,
151
+ // TODO: find a way to merge these into an enum?
152
+ pub spellcheck : Option < Vec < Spellcheck > > ,
153
+ pub delimeters : Option < Vec < Delimeters > > ,
154
+ pub translation : Option < Vec < Translation > > ,
155
+ pub reinterpret : Option < Vec < Reinterpret > > ,
156
+ }
157
+
158
+ /// Provides word and suggestion attributes as alternative spellings for a word
159
+ /// in the query.
160
+ #[ derive( Clone , Debug , Deserialize , Eq , PartialEq ) ]
161
+ pub struct Spellcheck {
162
+ // Attributes
163
+ word : String ,
164
+ suggestion : String ,
165
+ text : String ,
166
+ }
167
+
168
+ /// Represents a warning regarding mismatched delimiters in a query.
169
+ #[ derive( Clone , Debug , Deserialize , Eq , PartialEq ) ]
170
+ pub struct Delimeters {
171
+ // Attributes
172
+ text : String ,
173
+ }
174
+
175
+ /// Represents a word or a phrase which was translated in the query.
176
+ #[ derive( Clone , Debug , Deserialize , Eq , PartialEq ) ]
177
+ pub struct Translation {
178
+ // Attributes
179
+ phrase : String ,
180
+ trans : String ,
181
+ lang : String ,
182
+ text : String ,
183
+ }
184
+
185
+ /// Represents a warning that the query was reinterpred.
186
+ #[ derive( Clone , Debug , Deserialize , Eq , PartialEq ) ]
187
+ pub struct Reinterpret {
188
+ // Attributes
189
+ text : String ,
190
+
191
+ alternative : Vec < Alternative > ,
174
192
}
175
193
176
194
/// An alternative interpretation of an element in a query.
@@ -222,7 +240,7 @@ pub struct Pod {
222
240
pub scanner : String ,
223
241
pub id : String ,
224
242
pub numsubpods : u32 ,
225
- // pub primary: Option<bool>, // TODO: unimplemented by `serde_xml`.
243
+ pub primary : Option < bool > ,
226
244
227
245
pub subpod : Vec < Subpod > ,
228
246
pub states : Option < States > ,
@@ -240,6 +258,17 @@ pub struct States {
240
258
// Attributes
241
259
pub count : u32 ,
242
260
261
+ pub state : Vec < State > ,
262
+ pub statelist : Option < Vec < Statelist > > ,
263
+ }
264
+
265
+ /// A series of `State` attributes, combined into a list.
266
+ #[ derive( Clone , Debug , Deserialize , Eq , PartialEq ) ]
267
+ pub struct Statelist {
268
+ // Attributes
269
+ pub count : u32 ,
270
+ pub value : String ,
271
+
243
272
pub state : Vec < State > ,
244
273
}
245
274
0 commit comments