Skip to main content

met_office_api/apis/
configuration.rs

1/*
2 * Global three hourly spot data
3 *
4 * This API provides three hourly weather forecast data for a requested coordinate defined by a latitude and longitude. The format of the data is GeoJSON.
5 *
6 * The version of the OpenAPI document: 1.0.1
7 * Contact: enquiries@metoffice.gov.uk
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13#[derive(Debug, Clone)]
14pub struct Configuration {
15    pub base_path: String,
16    pub user_agent: Option<String>,
17    pub client: reqwest::Client,
18    pub basic_auth: Option<BasicAuth>,
19    pub oauth_access_token: Option<String>,
20    pub bearer_access_token: Option<String>,
21    pub api_key: Option<ApiKey>,
22    pub api_client: Option<ApiKey>,
23    // TODO: take an oauth2 token source, similar to the go one
24}
25
26pub type BasicAuth = (String, Option<String>);
27
28#[derive(Debug, Clone)]
29pub struct ApiKey {
30    pub prefix: Option<String>,
31    pub key: String,
32}
33
34
35impl Configuration {
36    pub fn new() -> Configuration {
37        Configuration::default()
38    }
39}
40
41impl Default for Configuration {
42    fn default() -> Self {
43        Configuration {
44            base_path: "https://api-metoffice.apiconnect.ibmcloud.com/v0".to_owned(),
45            user_agent: Some("OpenAPI-Generator/1.0.1/rust".to_owned()),
46            client: reqwest::Client::new(),
47            basic_auth: None,
48            oauth_access_token: None,
49            bearer_access_token: None,
50            api_key: None,
51            api_client: None,
52
53        }
54    }
55}