mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 21:42:26 +00:00
Error typing for rustical_store as well as some refactoring
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::{calendar::Calendar, event::Event};
|
||||
|
||||
#[async_trait]
|
||||
pub trait CalendarStore: Send + Sync + 'static {
|
||||
async fn get_calendar(&self, id: &str) -> Result<Calendar>;
|
||||
async fn get_calendars(&self, owner: &str) -> Result<Vec<Calendar>>;
|
||||
async fn insert_calendar(&mut self, cid: String, calendar: Calendar) -> Result<()>;
|
||||
async fn delete_calendar(&mut self, cid: &str) -> Result<()>;
|
||||
async fn get_calendar(&self, id: &str) -> Result<Calendar, Error>;
|
||||
async fn get_calendars(&self, owner: &str) -> Result<Vec<Calendar>, Error>;
|
||||
async fn insert_calendar(&mut self, cid: String, calendar: Calendar) -> Result<(), Error>;
|
||||
async fn delete_calendar(&mut self, cid: &str) -> Result<(), Error>;
|
||||
|
||||
async fn get_events(&self, cid: &str) -> Result<Vec<Event>>;
|
||||
async fn get_event(&self, cid: &str, uid: &str) -> Result<Event>;
|
||||
async fn upsert_event(&mut self, cid: String, uid: String, ics: String) -> Result<()>;
|
||||
async fn delete_event(&mut self, cid: &str, uid: &str) -> Result<()>;
|
||||
async fn get_events(&self, cid: &str) -> Result<Vec<Event>, Error>;
|
||||
async fn get_event(&self, cid: &str, uid: &str) -> Result<Event, Error>;
|
||||
async fn upsert_event(&mut self, cid: String, uid: String, ics: String) -> Result<(), Error>;
|
||||
async fn delete_event(&mut self, cid: &str, uid: &str) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user