feat: abstract method to perform action
This commit is contained in:
@@ -2,7 +2,7 @@ use nyquest_preset::nyquest::ClientBuilder;
|
||||
use palc::Parser;
|
||||
use sdgb_api::{
|
||||
all_net::QRCode,
|
||||
title::{MaiVersionExt, Sdgb1_50, methods::APIMethod, model::Ping},
|
||||
title::{MaiVersionExt, Sdgb1_40, Sdgb1_50, methods::APIMethod, model::Ping},
|
||||
};
|
||||
use spdlog::{error, info};
|
||||
|
||||
@@ -19,10 +19,10 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
|
||||
match cmd.command {
|
||||
commands::Commands::Ping => {
|
||||
let req = Sdgb1_50::api_request(APIMethod::Ping, "", Ping)?;
|
||||
let data = client.request(req).await?.bytes().await?;
|
||||
let decoded = Sdgb1_50::decode(data)?;
|
||||
info!("resp: {:?}", String::from_utf8_lossy(&decoded));
|
||||
let decoded = Sdgb1_40::request(&client, APIMethod::Ping, "1", Ping {}).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));
|
||||
}
|
||||
commands::Commands::QRLogin { ref qrcode_content } => {
|
||||
let qrcode = QRCode { qrcode_content };
|
||||
|
||||
Reference in New Issue
Block a user