pub struct GitHubCopilotAuth { /* private fields */ }
Expand description
GitHub Copilot authentication implementation
Implementations§
Source§impl GitHubCopilotAuth
impl GitHubCopilotAuth
pub fn new(storage: Box<dyn AuthStorage>) -> Self
Sourcepub async fn start_device_flow() -> Result<DeviceCodeResponse>
pub async fn start_device_flow() -> Result<DeviceCodeResponse>
Start device code flow for GitHub authentication
Sourcepub async fn poll_for_token(
device_code: &str,
) -> Result<GitHubCopilotAuthResult>
pub async fn poll_for_token( device_code: &str, ) -> Result<GitHubCopilotAuthResult>
Poll for GitHub access token during device flow
Sourcepub async fn get_copilot_token(github_token: &str) -> Result<AuthCredentials>
pub async fn get_copilot_token(github_token: &str) -> Result<AuthCredentials>
Exchange GitHub OAuth token for Copilot API token
Sourcepub async fn get_access_token(&self) -> Result<Option<String>>
pub async fn get_access_token(&self) -> Result<Option<String>>
Get valid Copilot access token, refreshing if necessary
Trait Implementations§
Source§impl Auth for GitHubCopilotAuth
impl Auth for GitHubCopilotAuth
Source§fn provider_id(&self) -> &str
fn provider_id(&self) -> &str
Get the provider ID this auth is for
Source§fn get_credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AuthCredentials>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AuthCredentials>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get current valid credentials
Source§fn set_credentials<'life0, 'async_trait>(
&'life0 self,
credentials: AuthCredentials,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_credentials<'life0, 'async_trait>(
&'life0 self,
credentials: AuthCredentials,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store new credentials
Auto Trait Implementations§
impl Freeze for GitHubCopilotAuth
impl !RefUnwindSafe for GitHubCopilotAuth
impl Send for GitHubCopilotAuth
impl Sync for GitHubCopilotAuth
impl Unpin for GitHubCopilotAuth
impl !UnwindSafe for GitHubCopilotAuth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more