mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 11:11:30 +00:00
18 lines
519 B
Rust
18 lines
519 B
Rust
|
use async_trait::async_trait;
|
||
|
use gpui2::AppContext;
|
||
|
|
||
|
#[derive(Clone, Debug)]
|
||
|
pub enum ProviderCredential {
|
||
|
Credentials { api_key: String },
|
||
|
NoCredentials,
|
||
|
NotNeeded,
|
||
|
}
|
||
|
|
||
|
#[async_trait]
|
||
|
pub trait CredentialProvider: Send + Sync {
|
||
|
fn has_credentials(&self) -> bool;
|
||
|
async fn retrieve_credentials(&self, cx: &mut AppContext) -> ProviderCredential;
|
||
|
async fn save_credentials(&self, cx: &mut AppContext, credential: ProviderCredential);
|
||
|
async fn delete_credentials(&self, cx: &mut AppContext);
|
||
|
}
|