space-traders 0.1.1

Async SpaceTraders API client for Rust.
Documentation
//! Generated by: <https://openapi-generator.tech>
//!
//! Version of specification: `2.0.0`

/// Configuration for accessing endpoints.
#[derive(Debug, Clone)]
pub struct Configuration {
    /// The base path of the server.
    ///
    /// This is prepended to the request path.
    pub base_path: String,

    /// The user agent string to use.
    pub user_agent: Option<String>,

    /// Client to use for the request.
    pub client: reqwest::Client,

    /// Basic http auth data.
    pub basic_auth: Option<BasicAuth>,

    /// OAuth access token.
    ///
    /// This is set as a bearer token.
    pub oauth_access_token: Option<String>,

    /// Bearer token.
    pub bearer_access_token: Option<String>,

    /// API key to send.
    pub api_key: Option<ApiKey>,
}

/// Basic http auth.
///
/// This is of the form `(username, password)`.
pub type BasicAuth = (String, Option<String>);

/// An API key.
#[derive(Debug, Clone)]
pub struct ApiKey {
    /// Prefix to apply to the query.
    pub prefix: Option<String>,

    /// The key value.
    pub key: String,
}

impl Configuration {
    /// Create default configuration.
    ///
    /// The base path is set to `https://api.spacetraders.io/v2` by default.
    /// The user agent is set to `openapi-rust/2.0.0` by default.
    pub fn new() -> Configuration {
        Configuration::default()
    }
}

impl Default for Configuration {
    fn default() -> Self {
        Configuration {
            base_path: "https://api.spacetraders.io/v2".to_owned(),
            user_agent: Some("openapi-rust/2.0.0".to_owned()),
            client: reqwest::Client::new(),
            basic_auth: None,
            oauth_access_token: None,
            bearer_access_token: None,
            api_key: None,
        }
    }
}