pub enum Auth {
GhCli,
EnvVar(String),
Token(SecretString),
}Expand description
Authentication method for GitHub API.
Variants§
GhCli
Use token from gh CLI.
EnvVar(String)
Use token from environment variable.
Token(SecretString)
Use a specific token (zeroized on drop).
Implementations§
Source§impl Auth
impl Auth
Sourcepub fn auto() -> Self
pub fn auto() -> Self
Create auth from the first available method.
Tries in order: GITHUB_TOKEN env var, gh CLI.
Sourcepub fn resolve(&self) -> Result<SecretString>
pub fn resolve(&self) -> Result<SecretString>
Resolve the authentication to a token string.
Returns a SecretString that will be zeroized when dropped.
§Errors
Returns error if token cannot be obtained.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Auth
impl RefUnwindSafe for Auth
impl Send for Auth
impl Sync for Auth
impl Unpin for Auth
impl UnwindSafe for Auth
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