Skip to main content

mobilitydata_client/models/
source_info.rs

1/*
2 * Mobility Database Catalog
3 *
4 * API for the Mobility Database Catalog. See [https://mobilitydatabase.org/](https://mobilitydatabase.org/).  The Mobility Database API uses OAuth2 authentication. To initiate a successful API request, an access token must be included as a bearer token in the HTTP header. Access tokens are valid for one hour. To obtain an access token, you'll first need a refresh token, which is long-lived and does not expire. 
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * Contact: api@mobilitydata.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct SourceInfo {
16    /// URL where the producer is providing the dataset.  Refer to the authentication information to know how to access this URL. 
17    #[serde(rename = "producer_url", skip_serializing_if = "Option::is_none")]
18    pub producer_url: Option<String>,
19    /// Defines the type of authentication required to access the `producer_url`. Valid values for this field are:   * 0 or (empty) - No authentication required.   * 1 - The authentication requires an API key, which should be passed as value of the parameter api_key_parameter_name in the URL. Please visit URL in authentication_info_url for more information.   * 2 - The authentication requires an HTTP header, which should be passed as the value of the header api_key_parameter_name in the HTTP request. When not provided, the authentication type is assumed to be 0. 
20    #[serde(rename = "authentication_type", skip_serializing_if = "Option::is_none")]
21    pub authentication_type: Option<AuthenticationType>,
22    /// Contains a URL to a human-readable page describing how the authentication should be performed and how credentials can be created.  This field is required for `authentication_type=1` and `authentication_type=2`. 
23    #[serde(rename = "authentication_info_url", skip_serializing_if = "Option::is_none")]
24    pub authentication_info_url: Option<String>,
25    /// Defines the name of the parameter to pass in the URL to provide the API key. This field is required for `authentication_type=1` and `authentication_type=2`. 
26    #[serde(rename = "api_key_parameter_name", skip_serializing_if = "Option::is_none")]
27    pub api_key_parameter_name: Option<String>,
28    /// A URL where to find the license for the feed.
29    #[serde(rename = "license_url", skip_serializing_if = "Option::is_none")]
30    pub license_url: Option<String>,
31    /// Id of the feed license that can be used to query the license endpoint.
32    #[serde(rename = "license_id", skip_serializing_if = "Option::is_none")]
33    pub license_id: Option<String>,
34    /// true if the license is SPDX. false if not.
35    #[serde(rename = "license_is_spdx", skip_serializing_if = "Option::is_none")]
36    pub license_is_spdx: Option<bool>,
37    /// Notes concerning the relation between the feed and the license.
38    #[serde(rename = "license_notes", skip_serializing_if = "Option::is_none")]
39    pub license_notes: Option<String>,
40}
41
42impl SourceInfo {
43    pub fn new() -> SourceInfo {
44        SourceInfo {
45            producer_url: None,
46            authentication_type: None,
47            authentication_info_url: None,
48            api_key_parameter_name: None,
49            license_url: None,
50            license_id: None,
51            license_is_spdx: None,
52            license_notes: None,
53        }
54    }
55}
56/// Defines the type of authentication required to access the `producer_url`. Valid values for this field are:   * 0 or (empty) - No authentication required.   * 1 - The authentication requires an API key, which should be passed as value of the parameter api_key_parameter_name in the URL. Please visit URL in authentication_info_url for more information.   * 2 - The authentication requires an HTTP header, which should be passed as the value of the header api_key_parameter_name in the HTTP request. When not provided, the authentication type is assumed to be 0. 
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum AuthenticationType {
59    #[serde(rename = "0")]
60    Variant0,
61    #[serde(rename = "1")]
62    Variant1,
63    #[serde(rename = "2")]
64    Variant2,
65}
66
67impl Default for AuthenticationType {
68    fn default() -> AuthenticationType {
69        Self::Variant0
70    }
71}
72