google_api_rust_client_unoffical/services/route_service/
mod.rs

1
2
3use crate::auth::service_account::ServiceAccountCredentials;
4use super::ServiceBase;
5
6pub mod get_route;
7pub mod get_route_matrix;
8pub mod common_models;
9
10static ROUTE_SERVICE_SCOPE: &str = "https://www.googleapis.com/auth/cloud-platform";
11static GET_ROUTE_URL: &str = "https://routes.googleapis.com/directions/v2:computeRoutes";
12static GET_ROUTE_MATRIX_URL: &str = "https://routes.googleapis.com/distanceMatrix/v2:computeRouteMatrix";
13
14#[derive(Debug, Clone)]
15pub struct RouteService {
16    base: ServiceBase
17}
18
19
20impl RouteService {
21    /// Create `RouteService` Authenticate by using API keys.
22    ///
23    /// * `api_key` -  API key to use to authenticate to Google Cloud APIs and services that support API keys.
24    pub fn new_with_api_key(api_key: String) -> Self {
25        return Self { base: ServiceBase::new_with_api_key(api_key) }
26    }
27
28    /// Create `RouteService` Authenticate by using API keys.
29    ///
30    /// * `service_account_credentials` -  `ServiceAccountCredentials` to use to authenticate to Google Cloud APIs.
31    pub fn new_with_credentials(service_account_credentials: ServiceAccountCredentials) -> Self {
32        return Self { base: ServiceBase::new_with_credentials(service_account_credentials, vec![ROUTE_SERVICE_SCOPE]) }
33    }
34}