shrupl/src/main.rs

30 lines
669 B
Rust
Raw Normal View History

2025-05-22 17:34:44 +00:00
mod sharry;
use log::info;
2025-05-23 01:11:11 +00:00
use sharry::{Alias, NewShareRequest, URI};
2025-05-22 17:34:44 +00:00
use std::time::Duration;
use ureq::Agent;
2025-05-17 23:57:52 +00:00
fn main() {
2025-05-22 17:34:44 +00:00
env_logger::init();
let agent: Agent = Agent::config_builder()
.timeout_global(Some(Duration::from_secs(5)))
.build()
.into();
2025-05-22 21:07:49 +00:00
let alias = Alias::new(
URI::new("sharry.yavook.de"),
"G7RYoWME1W7-pcgipemJcr8-39FcMd92gBu-RgufeHc51z6",
);
2025-05-22 17:34:44 +00:00
let share = alias.create_share(&agent, &NewShareRequest::new(Some("foo"), "", 10));
2025-05-22 21:07:49 +00:00
let share = share.unwrap();
info!("share: {:?}", share);
2025-05-23 01:11:11 +00:00
share.create_file(&agent, "./myfile.dat").unwrap();
2025-05-22 21:07:49 +00:00
share.notify(&agent).unwrap();
2025-05-17 23:57:52 +00:00
}