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