feat: preview user info
This commit is contained in:
@@ -2,7 +2,11 @@ use nyquest_preset::nyquest::ClientBuilder;
|
||||
use palc::Parser;
|
||||
use sdgb_api::{
|
||||
all_net::QRCode,
|
||||
title::{MaiVersionExt, Sdgb1_40, Sdgb1_50, methods::APIMethod, model::Ping},
|
||||
title::{
|
||||
MaiVersionExt, Sdgb1_40, Sdgb1_50,
|
||||
methods::APIMethod,
|
||||
model::{GetUserPreviewApi, GetUserPreviewApiResp, Ping},
|
||||
},
|
||||
};
|
||||
use spdlog::{error, info};
|
||||
|
||||
@@ -18,8 +22,26 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
let client = ClientBuilder::default().build_async().await?;
|
||||
|
||||
match cmd.command {
|
||||
commands::Commands::Preview { user_id } => {
|
||||
let preview = Sdgb1_50::request(
|
||||
&client,
|
||||
APIMethod::GetUserPreviewApi,
|
||||
user_id,
|
||||
GetUserPreviewApi { user_id },
|
||||
)
|
||||
.await?;
|
||||
|
||||
let preview: GetUserPreviewApiResp = serde_json::from_slice(&preview)?;
|
||||
println!("{preview}");
|
||||
}
|
||||
commands::Commands::Ping => {
|
||||
let decoded = Sdgb1_40::request(&client, APIMethod::Ping, "", Ping {}).await?;
|
||||
let decoded = Sdgb1_40::request(
|
||||
&client,
|
||||
APIMethod::Ping,
|
||||
"",
|
||||
Ping {}, // note: must not be `Ping`, or serde_json serializes to nothing
|
||||
)
|
||||
.await?;
|
||||
info!("sdgb 1.40 resp: {:?}", String::from_utf8_lossy(&decoded));
|
||||
let decoded = Sdgb1_50::request(&client, APIMethod::Ping, "", Ping {}).await?;
|
||||
info!("sdgb 1.50 resp: {:?}", String::from_utf8_lossy(&decoded));
|
||||
|
||||
Reference in New Issue
Block a user