google_maps_places/
lib.rs

1//! This library can be used to fetch details from Google Maps Places API
2//! using `place_id` from Place Search.
3//!
4//! # Getting started
5//!
6//! - Add to `[dependencies]`
7//!
8//!     ```
9//!     google-maps-places = "0.1"
10//!     ```
11//!
12//!     Available `features`:
13//!         
14//!     - `async-graphql`
15//!
16//! - Fetch place results
17//!
18//!     ```
19//!     let places = &Places { api_key: "api-key" };
20//!     let res = match places.get_map_place("ChIJATaCWGU3zDER32m__CAwDyY") {
21//!         Ok(b) => b,
22//!         Err(e) => {
23//!             println!("Error {:?}", e);
24//!             return;
25//!         }
26//!     };
27//!     match res {
28//!         Response::Ok { result } => {
29//!             println!("id                : {}", result.place_id);
30//!             println!("name              : {}", result.name);
31//!             println!("formatted_address : {}", result.formatted_address);
32//!             println!("");
33//!     
34//!             println!("street_number : {}", result.street_number().unwrap_or(""),);
35//!             println!("route         : {}", result.route().unwrap_or(""));
36//!             println!("sublocality   : {}", result.sublocality().unwrap_or(""));
37//!             println!("postal_code   : {}", result.postal_code().unwrap_or(""));
38//!             println!("city          : {}", result.city().unwrap_or(""));
39//!             println!("state         : {}", result.state().unwrap_or(""));
40//!             println!("country       : {}", result.country().unwrap_or(""));
41//!         }
42//!         Response::ZeroResults => {
43//!             println!("Zero results");
44//!         }
45//!         Response::InvalidRequest => {
46//!             println!("Invalid Request");
47//!         }
48//!         Response::OverQueryLimit => {
49//!             println!("Over Query Limit");
50//!         }
51//!         Response::RequestDenied { error_message } => {
52//!             println!("Request Denied: {}", error_message);
53//!         }
54//!         Response::UnknownError => {
55//!             println!("Unknown Error")
56//!         }
57//!     };
58//!     ```
59
60pub mod error;
61pub mod places;
62pub mod response;
63
64pub use crate::{
65    error::GoogleMapPlaceError, places::Places, response::PlaceResult, response::Response,
66};