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
use crate::time_zone::request::Request;

impl<'a> Request<'a> {

    /// Returns the URI query string that represents the query you've built.
    ///
    /// ## Description:
    ///
    /// Returns the query string that will be sent to the Google Maps API. It
    /// is the result of the builder pattern. This method could be useful for
    /// records or logging. It could also be used for passing to your HTTP
    /// client of choice and executing the HTTP GET request yourself.
    ///
    /// ## Arguments:
    ///
    /// This method accepts no arguments.

    pub fn query_string(&'a mut self) -> (String, String) {
        (
            "https://maps.googleapis.com/maps/api/timezone/json?".to_string(),
            match &self.query {
                // If query string has already been built, return it:
                Some(query_string) => query_string.to_owned(),
                // If it hasn't been built, build it:
                None => self.build().query.as_ref().unwrap().clone(),
            } // match
        )
    } // fn

} // impl