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() {
|
if keys.hosts.get(&user).is_none() {
|
||||||
keys.hosts.insert(
|
keys.hosts.insert(
|
||||||
host,
|
host,
|
||||||
crate::keys::LoginInfo::Token {
|
crate::keys::LoginInfo::Application {
|
||||||
name: user,
|
name: user,
|
||||||
token: key,
|
token: key,
|
||||||
},
|
},
|
||||||
|
|
|
@ -67,7 +67,7 @@ impl KeyInfo {
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Clone)]
|
#[derive(serde::Serialize, serde::Deserialize, Clone)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum LoginInfo {
|
pub enum LoginInfo {
|
||||||
Token {
|
Application {
|
||||||
name: String,
|
name: String,
|
||||||
token: String,
|
token: String,
|
||||||
},
|
},
|
||||||
|
@ -82,14 +82,14 @@ pub enum LoginInfo {
|
||||||
impl LoginInfo {
|
impl LoginInfo {
|
||||||
pub fn username(&self) -> &str {
|
pub fn username(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
LoginInfo::Token { name, .. } => name,
|
LoginInfo::Application { name, .. } => name,
|
||||||
LoginInfo::OAuth { name, .. } => name,
|
LoginInfo::OAuth { name, .. } => name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn api_for(&mut self, url: &Url) -> eyre::Result<forgejo_api::Forgejo> {
|
pub async fn api_for(&mut self, url: &Url) -> eyre::Result<forgejo_api::Forgejo> {
|
||||||
match self {
|
match self {
|
||||||
LoginInfo::Token { token, .. } => {
|
LoginInfo::Application { token, .. } => {
|
||||||
let api = forgejo_api::Forgejo::new(forgejo_api::Auth::Token(token), url.clone())?;
|
let api = forgejo_api::Forgejo::new(forgejo_api::Auth::Token(token), url.clone())?;
|
||||||
Ok(api)
|
Ok(api)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue