pub struct ExploreClient { /* private fields */ }
Expand description
Client meant to fetch widgets from Google Trends
Implementations§
Source§impl ExploreClient
impl ExploreClient
Sourcepub fn available_widgets(&self) -> Vec<(WidgetKeyword, WidgetCategory)>
pub fn available_widgets(&self) -> Vec<(WidgetKeyword, WidgetCategory)>
Returns all available widgets
Sourcepub async fn get_widget_as_json(
&self,
keyword: WidgetKeyword,
category: WidgetCategory,
) -> Result<Value, Error>
pub async fn get_widget_as_json( &self, keyword: WidgetKeyword, category: WidgetCategory, ) -> Result<Value, Error>
Returns the widget as a JSON object
Sourcepub async fn get_timeseries(
&self,
keyword: WidgetKeyword,
) -> Result<Timeseries, Error>
pub async fn get_timeseries( &self, keyword: WidgetKeyword, ) -> Result<Timeseries, Error>
Returns the timeseries as a Timeseries
object
Examples found in repository?
examples/simple_request.rs (line 23)
7async fn main() {
8 let simple_request = Request::new(
9 vec![ComparaisonElem {
10 keyword: "cough".to_string(),
11 geo: Country::ALL,
12 time: Period::Predefined(PredefinedPeriod::OneYear),
13 }],
14 Category::RespiratoryConditions,
15 Property::Web,
16 )
17 .unwrap();
18
19 let client = TrendsClient::try_default().await.unwrap();
20 let explore_client = client.explore(simple_request).await.unwrap();
21
22 let stats = explore_client
23 .get_timeseries(WidgetKeyword::All)
24 .await
25 .unwrap();
26
27 println!("{:?}", stats);
28}
Sourcepub async fn get_geomap(&self, keyword: WidgetKeyword) -> Result<GeoMap, Error>
pub async fn get_geomap(&self, keyword: WidgetKeyword) -> Result<GeoMap, Error>
Returns the geomap as a GeoMap
object
Returns the related queries as a RelatedQueries
object
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExploreClient
impl !RefUnwindSafe for ExploreClient
impl Send for ExploreClient
impl Sync for ExploreClient
impl Unpin for ExploreClient
impl !UnwindSafe for ExploreClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more