mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 03:59:31 +01:00
rename LoginInfo::Token
to Application
This commit is contained in:
parent
3ff6a86e8e
commit
349c6ad0d6
2 changed files with 4 additions and 4 deletions
|
@ -58,7 +58,7 @@ impl AuthCommand {
|
|||
if keys.hosts.get(&user).is_none() {
|
||||
keys.hosts.insert(
|
||||
host,
|
||||
crate::keys::LoginInfo::Token {
|
||||
crate::keys::LoginInfo::Application {
|
||||
name: user,
|
||||
token: key,
|
||||
},
|
||||
|
|
|
@ -67,7 +67,7 @@ impl KeyInfo {
|
|||
#[derive(serde::Serialize, serde::Deserialize, Clone)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum LoginInfo {
|
||||
Token {
|
||||
Application {
|
||||
name: String,
|
||||
token: String,
|
||||
},
|
||||
|
@ -82,14 +82,14 @@ pub enum LoginInfo {
|
|||
impl LoginInfo {
|
||||
pub fn username(&self) -> &str {
|
||||
match self {
|
||||
LoginInfo::Token { name, .. } => name,
|
||||
LoginInfo::Application { name, .. } => name,
|
||||
LoginInfo::OAuth { name, .. } => name,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn api_for(&mut self, url: &Url) -> eyre::Result<forgejo_api::Forgejo> {
|
||||
match self {
|
||||
LoginInfo::Token { token, .. } => {
|
||||
LoginInfo::Application { token, .. } => {
|
||||
let api = forgejo_api::Forgejo::new(forgejo_api::Auth::Token(token), url.clone())?;
|
||||
Ok(api)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue