AuthProvider

Trait AuthProvider 

pub trait AuthProvider:
    Send
    + Sync
    + 'static {
    // Required methods
    fn ws_url(&self, model: &GeminiModel) -> String;
    fn auth_headers<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, AuthError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn rest_url(
        &self,
        endpoint: ServiceEndpoint,
        model: Option<&GeminiModel>,
    ) -> String { ... }
    fn query_params(&self) -> Vec<(String, String)> { ... }
    fn refresh<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait { ... }
}
Expand description

Provides authentication credentials and URL construction for Gemini API connections.

Required Methods§

fn ws_url(&self, model: &GeminiModel) -> String

Build the WebSocket URL for the given model.

fn auth_headers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

HTTP headers for the WebSocket upgrade request (e.g., Bearer token).

Provided Methods§

fn rest_url( &self, endpoint: ServiceEndpoint, model: Option<&GeminiModel>, ) -> String

Build a REST API URL for the given service endpoint and model.

Default implementation panics — override when using HTTP client features.

fn query_params(&self) -> Vec<(String, String)>

Query parameters to append to the URL (e.g., API key).

fn refresh<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Called on auth failure to allow token refresh. Default: no-op.

Implementors§