Skip to main content

Client

Trait Client 

Source
pub trait Client<CTXEXT> {
    // Required methods
    fn create_api_key<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context<CTXEXT>,
        request: CreateApiKeyRequest,
    ) -> Pin<Box<dyn Future<Output = Result<CreateApiKeyResponse, ResponseError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn create_openrouter_byok_api_key<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context<CTXEXT>,
        request: CreateOpenRouterByokApiKeyRequest,
    ) -> Pin<Box<dyn Future<Output = Result<CreateOpenRouterByokApiKeyResponse, ResponseError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn disable_api_key<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context<CTXEXT>,
        request: DisableApiKeyRequest,
    ) -> Pin<Box<dyn Future<Output = Result<DisableApiKeyResponse, ResponseError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_openrouter_byok_api_key<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context<CTXEXT>,
    ) -> Pin<Box<dyn Future<Output = Result<(), ResponseError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_api_keys<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context<CTXEXT>,
    ) -> Pin<Box<dyn Future<Output = Result<ListApiKeyResponse, ResponseError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_openrouter_byok_api_key<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context<CTXEXT>,
    ) -> Pin<Box<dyn Future<Output = Result<GetOpenRouterByokApiKeyResponse, ResponseError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_credits<'life0, 'async_trait>(
        &'life0 self,
        ctx: Context<CTXEXT>,
    ) -> Pin<Box<dyn Future<Output = Result<GetCreditsResponse, ResponseError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for authentication operations.

Provides methods for managing API keys, BYOK OpenRouter keys, and credits. Generic over CTXEXT to allow custom context extensions.

Required Methods§

Source

fn create_api_key<'life0, 'async_trait>( &'life0 self, ctx: Context<CTXEXT>, request: CreateApiKeyRequest, ) -> Pin<Box<dyn Future<Output = Result<CreateApiKeyResponse, ResponseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates a new API key for the authenticated user.

Source

fn create_openrouter_byok_api_key<'life0, 'async_trait>( &'life0 self, ctx: Context<CTXEXT>, request: CreateOpenRouterByokApiKeyRequest, ) -> Pin<Box<dyn Future<Output = Result<CreateOpenRouterByokApiKeyResponse, ResponseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets the user’s BYOK (Bring Your Own Key) OpenRouter API key.

Source

fn disable_api_key<'life0, 'async_trait>( &'life0 self, ctx: Context<CTXEXT>, request: DisableApiKeyRequest, ) -> Pin<Box<dyn Future<Output = Result<DisableApiKeyResponse, ResponseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Disables an existing API key.

Source

fn delete_openrouter_byok_api_key<'life0, 'async_trait>( &'life0 self, ctx: Context<CTXEXT>, ) -> Pin<Box<dyn Future<Output = Result<(), ResponseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Deletes the user’s BYOK OpenRouter API key.

Source

fn list_api_keys<'life0, 'async_trait>( &'life0 self, ctx: Context<CTXEXT>, ) -> Pin<Box<dyn Future<Output = Result<ListApiKeyResponse, ResponseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Lists all API keys for the authenticated user.

Source

fn get_openrouter_byok_api_key<'life0, 'async_trait>( &'life0 self, ctx: Context<CTXEXT>, ) -> Pin<Box<dyn Future<Output = Result<GetOpenRouterByokApiKeyResponse, ResponseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the user’s BYOK OpenRouter API key.

Source

fn get_credits<'life0, 'async_trait>( &'life0 self, ctx: Context<CTXEXT>, ) -> Pin<Box<dyn Future<Output = Result<GetCreditsResponse, ResponseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the user’s available credit balance.

Implementors§

Source§

impl<CTXEXT> Client<CTXEXT> for ObjectiveAiClient
where CTXEXT: Send + Sync + 'static,