aerogramme/src/main.rs

53 lines
1.1 KiB
Rust
Raw Normal View History

2022-05-18 10:24:37 +00:00
use anyhow::Result;
use rusoto_credential::{EnvironmentProvider, ProvideAwsCredentials};
use rusoto_signature::Region;
mod bayou;
mod cryptoblob;
mod time;
mod uidindex;
2022-05-18 10:42:25 +00:00
use bayou::*;
2022-05-18 10:24:37 +00:00
use cryptoblob::Key;
2022-05-18 10:42:25 +00:00
use uidindex::*;
2022-05-18 10:24:37 +00:00
#[tokio::main]
async fn main() {
do_stuff().await.expect("Something failed");
}
async fn do_stuff() -> Result<()> {
let creds = EnvironmentProvider::default().credentials().await.unwrap();
let k2v_region = Region::Custom {
name: "garage-staging".to_owned(),
endpoint: "https://k2v-staging.home.adnab.me".to_owned(),
};
let s3_region = Region::Custom {
name: "garage-staging".to_owned(),
endpoint: "https://garage-staging.home.adnab.me".to_owned(),
};
let key = Key::from_slice(&[0u8; 32]).unwrap();
let mut mail_index = Bayou::<UidIndex>::new(
creds,
k2v_region,
s3_region,
"alex".into(),
"TestMailbox".into(),
key,
)?;
mail_index.sync().await?;
2022-05-18 10:42:25 +00:00
let add_mail_op = mail_index
.state()
.op_mail_add(MailUuid([0xFFu8; 24]), vec!["\\Unseen".into()]);
mail_index.push(add_mail_op).await?;
2022-05-18 10:24:37 +00:00
Ok(())
}