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
use crate::topic::Topic;
use serde::Deserialize;
use serde_json::Value;
/// A struct representing the response received from the DuckDuckGo API.
#[derive(Debug, Deserialize)]
pub struct Response {
/// The abstract text associated with the search result.
#[serde(rename = "Abstract")]
pub r#abstract: Option<String>,
/// The source of the abstract, if available.
#[serde(rename = "AbstractSource")]
pub abstract_source: Option<String>,
/// The detailed abstract text associated with the search result.
#[serde(rename = "AbstractText")]
pub abstract_text: Option<String>,
/// The URL associated with the abstract, if available.
#[serde(rename = "AbstractURL")]
pub abstract_url: Option<String>,
/// The answer to the query, if available.
#[serde(rename = "Answer")]
pub answer: Option<String>,
/// The type of answer provided.
#[serde(rename = "AnswerType")]
pub answer_type: Option<String>,
/// The definition associated with the search result.
#[serde(rename = "Definition")]
pub definition: Option<String>,
/// The source of the definition, if available.
#[serde(rename = "DefinitionSource")]
pub definition_source: Option<String>,
/// The URL associated with the definition, if available.
#[serde(rename = "DefinitionURL")]
pub definition_url: Option<String>,
/// The entity associated with the search result.
#[serde(rename = "Entity")]
pub entity: Option<String>,
/// The heading or title of the search result.
#[serde(rename = "Heading")]
pub heading: Option<String>,
/// The URL of the image associated with the search result.
#[serde(rename = "Image")]
pub image: Option<String>,
/// The height of the image.
#[serde(rename = "ImageHeight")]
pub image_height: Value,
/// Indicates whether the image is a logo.
#[serde(rename = "ImageIsLogo")]
pub image_is_logo: Value,
/// The width of the image.
#[serde(rename = "ImageWidth")]
pub image_width: Value,
/// The infobox associated with the search result.
#[serde(rename = "Infobox")]
pub info_box: Option<Value>,
/// The redirect URL, if the result is a redirect.
#[serde(rename = "Redirect")]
pub redirect: Option<String>,
/// The list of related topics.
#[serde(rename = "RelatedTopics")]
pub related_topics: Vec<Topic>,
/// The list of generic results.
#[serde(rename = "Results")]
pub results: Vec<Value>,
/// The type of the response.
#[serde(rename = "Type")]
pub r#type: String,
/// An example query associated with the response.
#[serde(rename = "ExampleQuery")]
pub example_query: Option<String>,
/// The date when the response was created.
#[serde(rename = "CreatedDate")]
pub created_date: Option<String>,
}