feat: initial support of method call
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
use nyquest_preset::nyquest::ClientBuilder;
|
||||
use palc::Parser;
|
||||
use sdgb_api::all_net::QRCode;
|
||||
use sdgb_api::{
|
||||
all_net::QRCode,
|
||||
title::{MaiVersionExt, Sdgb1_50, methods::APIMethod, model::Ping},
|
||||
};
|
||||
use spdlog::{error, info};
|
||||
|
||||
use crate::commands::Cli;
|
||||
@@ -15,6 +18,12 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
let client = ClientBuilder::default().build_async().await?;
|
||||
|
||||
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));
|
||||
}
|
||||
commands::Commands::QRLogin { ref qrcode_content } => {
|
||||
let qrcode = QRCode { qrcode_content };
|
||||
match qrcode.login(&client).await {
|
||||
|
||||
Reference in New Issue
Block a user