langgraph-api 0.1.1

Rust Client API of LangGraph
Documentation
/*
 * LangSmith Deployment
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.1.0
 *
 * Generated by: https://openapi-generator.tech
 */

use serde::{Deserialize, Serialize};
use typed_builder::TypedBuilder;

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, typed_builder::TypedBuilder)]
pub struct Configuration {
    #[serde(default = "default_base_path")]
    #[builder(default_code = "default_base_path()")]
    pub base_path: String,
    #[serde(default = "default_user_agent")]
    #[builder(default_code = "default_user_agent()")]
    pub user_agent: Option<String>,
    #[serde(skip_serializing, skip_deserializing)]
    #[builder(default_code = "default_client()")]
    pub client: reqwest::Client,
    #[serde(default)]
    #[builder(default)]
    pub basic_auth: Option<BasicAuth>,
    #[serde(default)]
    #[builder(default)]
    pub oauth_access_token: Option<String>,
    #[serde(default)]
    #[builder(default)]
    pub bearer_access_token: Option<String>,
    #[serde(default)]
    #[builder(default)]
    pub api_key: Option<ApiKey>,
}

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

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, typed_builder::TypedBuilder)]
pub struct ApiKey {
    #[serde(default)]
    #[builder(default)]
    pub prefix: Option<String>,
    pub key: String,
}

fn default_base_path() -> String {
    "http://localhost:8444".to_owned()
}

fn default_user_agent() -> Option<String> {
    Some(format!(
        "{}-rust/{}",
        env!("CARGO_PKG_NAME"),
        env!("CARGO_PKG_VERSION")
    ))
}

fn default_client() -> reqwest::Client {
    reqwest::Client::new()
}

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

impl Default for Configuration {
    fn default() -> Self {
        Configuration {
            base_path: default_base_path(),
            user_agent: default_user_agent(),
            client: default_client(),
            basic_auth: None,
            oauth_access_token: None,
            bearer_access_token: None,
            api_key: None,
        }
    }
}