pub mod api; use api::{NewShareRequest, NewShareResponse, SharryAPI}; use log::debug; use ureq; #[derive(Debug)] pub struct Alias<'t> { api: &'t SharryAPI, id: String, } impl<'t> Alias<'t> { pub fn new(api: &'t SharryAPI, id: &str) -> Self { Self { api: api, id: id.into(), } } pub fn create_share( &self, http: &ureq::Agent, data: &NewShareRequest, ) -> Result { let foo = http .post(self.api.get_uri("alias/upload/new")) .header("Sharry-Alias", &self.id) .send_json(data)? .body_mut() .read_json::()?; debug!("foo: {:?}", foo); Ok(Share { alias: self, id: foo.id, }) } } #[derive(Debug)] pub struct Share<'t> { alias: &'t Alias<'t>, id: String, } impl<'t> Share<'t> { pub fn add_file(&self) {} }