cargo fmt
catapult PR / Rustfmt (pull_request) Successful in 49s
catapult PR / Check (pull_request) Successful in 1m32s
catapult PR / Clippy (pull_request) Failing after 2m18s

This commit is contained in:
2026-06-22 17:43:55 -04:00
parent aaa20c8752
commit dd9d452576
3 changed files with 117 additions and 124 deletions
+2 -4
View File
@@ -16,9 +16,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("App: {app:?}");
let auth = catapult::service::auth::Auth {
app: app.clone()
};
let auth = catapult::service::auth::Auth { app: app.clone() };
let token = match auth.get_token().await {
Ok(token) => token,
Err(err) => {
@@ -32,7 +30,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut svc = catapult::service::Service {
app: app.clone(),
token
token,
};
loop {
+14 -19
View File
@@ -1,6 +1,6 @@
pub struct Service {
pub app: crate::app::App,
pub token: textsender_models::token::Login
pub token: textsender_models::token::Login,
}
impl Service {
@@ -30,7 +30,7 @@ impl Service {
pub mod auth {
pub struct Auth {
pub app: crate::app::App
pub app: crate::app::App,
}
/*
@@ -63,7 +63,8 @@ pub mod auth {
println!("Payload: {payload:?}");
match client.post(api_url).json(&payload).send().await {
Ok(response) => match response.status() {
Ok(response) => {
match response.status() {
reqwest::StatusCode::OK => {
println!("Response: {response:?}");
match response.text().await {
@@ -79,7 +80,9 @@ pub mod auth {
match j.get("data") {
Some(serde_json::Value::Array(lrs)) => {
if lrs.is_empty() {
Err(std::io::Error::other("Error response is empty"))
Err(std::io::Error::other(
"Error response is empty",
))
} else {
let lr = lrs[0].clone();
let ll: textsender_models::token::LoginResult = match serde_json::from_value(lr) { Ok(lr) => lr,
@@ -91,33 +94,25 @@ pub mod auth {
// Ok(textsender_models::token::LoginResult::default())
}
}
_ => {
Err(std::io::Error::other("Error parsing response"))
_ => Err(std::io::Error::other(
"Error parsing response",
)),
}
}
}
Err(err) => {
Err(std::io::Error::other(err.to_string()))
Err(err) => Err(std::io::Error::other(err.to_string())),
}
}
}
Err(err) => {
Err(std::io::Error::other(err))
Err(err) => Err(std::io::Error::other(err)),
}
}
}
_ => {
Err(std::io::Error::other("Error getting token"))
_ => Err(std::io::Error::other("Error getting token")),
}
}
Err(err) => {
Err(std::io::Error::other(err.to_string()))
Err(err) => Err(std::io::Error::other(err.to_string())),
}
}
}
}
}
/*
*