First API tests.
This commit is contained in:
27
crates/jmap/src/changes/mod.rs
Normal file
27
crates/jmap/src/changes/mod.rs
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user