#[derive(Debug, Clone)]
pub struct CopilotConfig {
pub github_token: String,
pub base_url_override: Option<String>,
}
impl CopilotConfig {
pub const FALLBACK_BASE_URL: &'static str = "https://api.githubcopilot.com";
pub fn new(github_token: impl Into<String>) -> Self {
Self {
github_token: github_token.into(),
base_url_override: None,
}
}
pub fn with_base_url(mut self, base_url: impl Into<String>) -> Self {
self.base_url_override = Some(base_url.into().trim_end_matches('/').to_string());
self
}
}
#[derive(Debug, Clone)]
pub struct CachedCopilotToken {
pub token: String,
pub expires_at: u64,
pub api_base: String,
}