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
use crate::{
    client_settings::ClientSettings,
    latlng::LatLng,
    time_zone::request::Request,
}; // use
use time::PrimitiveDateTime;

impl<'a> Request<'a> {

    /// Initializes the builder pattern for a Time Zone API query with the
    /// required, non-optional parameters.
    ///
    /// ## Arguments:
    ///
    /// * `key` - Your application's Google Cloud API key.
    /// * `location` - Latitude & longitude of the desired time zone location.
    /// * `time` - Time is used to determine if Daylight Savings is applicable.
    ///
    /// ## Example:
    ///
    /// ```rust
    /// let time_zone = TimeZoneRequest::new(
    ///     &mut my_settings,
    ///     // St. Vitus Cathedral in Prague, Czechia
    ///     LatLng::try_from(50.090_903, 14.400_512).unwrap(),
    ///     PrimitiveDateTime::new(
    ///         // Tuesday February 15, 2022
    ///         Date::try_from_ymd(2022, 2, 15).unwrap(),
    ///         // 6:00:00 pm
    ///         Time::try_from_hms(18, 00, 0).unwrap(),
    ///     ),
    /// )
    /// ```

    pub fn new(client_settings: &mut ClientSettings, location: LatLng, time: PrimitiveDateTime) -> Request {
        // Instantiate struct and return it to caller:
        Request {
            // Required parameters:
            client_settings,
            location,
            time,
            // Optional parameters:
            language: None,
            // Internal use only:
            query: None,
            validated: false,
        } // struct
    } // fn

} // impl