caesar: cleaned up unneeded files and added better project structure

This commit is contained in:
Patryk Hegenberg 2024-04-19 17:17:34 +02:00
parent 6f1f927915
commit 518e9416b7
14 changed files with 78 additions and 89 deletions

View file

@ -1,29 +0,0 @@
use crate::http_server::TransferRequest;
use log::{debug, error};
use reqwest::{Client, StatusCode};
use std::collections::HashMap;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
pub async fn send_info(relay: &str, file: &str) -> Result<()> {
debug!("Send Request to: {:?}", relay.to_string());
let mut map = HashMap::new();
map.insert("keyword", "test");
map.insert("files", file);
let client = Client::new();
let res = client
.post(relay.to_string() + "/upload")
.json(&map)
.send()
.await?;
if res.status() == StatusCode::CREATED {
let transfer_info: TransferRequest = res.json().await?;
debug!("Json Response: {:#?}", transfer_info);
println!("Transfer name: {}", transfer_info.name);
} else {
error!("Error reading response");
}
Ok(())
}