First API tests.

This commit is contained in:
Mauro D
2023-04-19 16:55:37 +00:00
parent 0264890595
commit f8acc4fe5a
57 changed files with 2243 additions and 664 deletions

View File

@@ -0,0 +1,27 @@
use jmap_proto::{
error::method::MethodError,
types::{collection::Collection, state::State},
};
use crate::JMAP;
impl JMAP {
pub async fn get_state(
&self,
account_id: u32,
collection: Collection,
) -> Result<State, MethodError> {
match self.store.get_last_change_id(account_id, collection).await {
Ok(id) => Ok(id.into()),
Err(err) => {
tracing::error!(event = "error",
context = "store",
account_id = account_id,
collection = ?collection,
error = ?err,
"Failed to obtain state");
Err(MethodError::ServerPartialFail)
}
}
}
}