jmap_client/core/
mod.rs

1/*
2 * Copyright Stalwart Labs LLC See the COPYING
3 * file at the top-level directory of this distribution.
4 *
5 * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 * https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 * <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
8 * option. This file may not be copied, modified, or distributed
9 * except according to those terms.
10 */
11
12use std::fmt::Display;
13
14use serde::{Deserialize, Serialize};
15
16use crate::Method;
17
18pub mod changes;
19pub mod copy;
20pub mod error;
21pub mod get;
22pub mod query;
23pub mod query_changes;
24pub mod request;
25pub mod response;
26pub mod session;
27pub mod set;
28
29pub struct RequestParams {
30    pub account_id: String,
31    pub method: Method,
32    pub call_id: usize,
33}
34
35impl RequestParams {
36    pub fn new(account_id: impl Into<String>, method: Method, call_id: usize) -> Self {
37        Self {
38            account_id: account_id.into(),
39            method,
40            call_id,
41        }
42    }
43}
44
45pub trait Object: Sized {
46    type Property: Display + Serialize + for<'de> Deserialize<'de>;
47    fn requires_account_id() -> bool;
48}