feat: skip login support
This commit is contained in:
@@ -77,6 +77,8 @@ pub enum Commands {
|
|||||||
Userdata {
|
Userdata {
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
user_id: u32,
|
user_id: u32,
|
||||||
|
#[arg(long)]
|
||||||
|
skip_login: bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
#[cfg(feature = "fetchall")]
|
#[cfg(feature = "fetchall")]
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ use sdgb_api::{
|
|||||||
model::{
|
model::{
|
||||||
DataVersion, DxCalculatedEntries, DxMusicRecord, DxRatingNet, GetUserDataApi,
|
DataVersion, DxCalculatedEntries, DxMusicRecord, DxRatingNet, GetUserDataApi,
|
||||||
GetUserDataApiResp, GetUserPreviewApi, GetUserPreviewApiResp, GetUserRatingApi,
|
GetUserDataApiResp, GetUserPreviewApi, GetUserPreviewApiResp, GetUserRatingApi,
|
||||||
GetUserRatingApiResp, Ping, PingResp, UserLogoutApi, UserLogoutApiResp,
|
GetUserRatingApiResp, Ping, PingResp, UserLoginApiResp, UserLogoutApi,
|
||||||
|
UserLogoutApiResp,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -342,7 +343,10 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
|||||||
dump_json::<GetUserRatingApiResp>("b50.json", B50)?;
|
dump_json::<GetUserRatingApiResp>("b50.json", B50)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Commands::Userdata { user_id } => {
|
Commands::Userdata {
|
||||||
|
user_id,
|
||||||
|
skip_login,
|
||||||
|
} => {
|
||||||
let action = async |_| match Sdgb1_50::request::<_, GetUserDataApiResp>(
|
let action = async |_| match Sdgb1_50::request::<_, GetUserDataApiResp>(
|
||||||
&client,
|
&client,
|
||||||
APIMethod::GetUserDataApi,
|
APIMethod::GetUserDataApi,
|
||||||
@@ -358,7 +362,12 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
|||||||
error!("failed to get userdata: {e}");
|
error!("failed to get userdata: {e}");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
login_action(&client, user_id, action).await?;
|
// userdata does not require loginResult
|
||||||
|
if skip_login {
|
||||||
|
action(UserLoginApiResp::default()).await;
|
||||||
|
} else {
|
||||||
|
login_action(&client, user_id, action).await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user