open-logistics 0.2.2

Rust client for the Open Logistics Shiprocket and Delhivery APIs.
Documentation
/*
 * Open Logistics — Delhivery
 *
 * OpenAPI description of the Delhivery B2C endpoints wrapped by `open-logistics`.  Source of truth for generated Python and Rust clients. Operation IDs and schema field names are intentionally snake_case so every language exposes the same names.  Delhivery overloads `POST /api/p/edit` for update and cancel, and `GET /api/v1/packages/json/` for single, order, and bulk tracking. OpenAPI permits one operation per path + method, so this spec exposes `orders_edit` and `tracking_fetch`; language facades may alias them as `update`, `cancel`, `by_waybill`, `by_order_id`, and `by_waybills`. 
 *
 * The version of the OpenAPI document: 0.2.2
 * 
 * Generated by: https://openapi-generator.tech
 */


pub use reqwest::Client;

#[derive(Clone)]
pub struct Configuration {
    pub base_path: String,
    pub user_agent: Option<String>,
    pub client: reqwest::Client,
    pub basic_auth: Option<BasicAuth>,
    pub oauth_access_token: Option<String>,
    pub bearer_access_token: Option<String>,
    pub api_key: Option<ApiKey>,
}

pub type BasicAuth = (String, Option<String>);

#[derive(Clone)]
pub struct ApiKey {
    pub prefix: Option<String>,
    pub key: String,
}

impl std::fmt::Debug for ApiKey {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("ApiKey")
            .field("prefix", &self.prefix)
            .field("key", &"[REDACTED]")
            .finish()
    }
}


impl std::fmt::Debug for Configuration {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let mut debug = f.debug_struct("Configuration");
        debug
            .field("base_path", &self.base_path)
            .field("user_agent", &self.user_agent)
            .field("client", &self.client);
        debug
            .field("basic_auth", &self.basic_auth.as_ref().map(|(username, password)| (username, password.as_ref().map(|_| "[REDACTED]"))))
            .field("oauth_access_token", &self.oauth_access_token.as_ref().map(|_| "[REDACTED]"))
            .field("bearer_access_token", &self.bearer_access_token.as_ref().map(|_| "[REDACTED]"))
            .field("api_key", &self.api_key);
        debug.finish()
    }
}

impl Configuration {
    pub fn new() -> Configuration {
        Configuration::default()
    }
}

impl Default for Configuration {
    fn default() -> Self {
        Configuration {
            base_path: "https://track.delhivery.com".to_owned(),
            user_agent: Some("OpenAPI-Generator/0.2.2/rust".to_owned()),
            client: reqwest::Client::new(),
            basic_auth: None,
            oauth_access_token: None,
            bearer_access_token: None,
            api_key: None,
        }
    }
}