v0.3.0
parent
3cba63c224
commit
952f272d09
|
@ -1,7 +1,9 @@
|
||||||
jmap-client 0.3.0
|
jmap-client 0.3.0
|
||||||
================================
|
================================
|
||||||
|
- JMAP for Sieve Scripts DRAFT-14 support.
|
||||||
- Set timeouts using `Duration` instead of `u64`.
|
- Set timeouts using `Duration` instead of `u64`.
|
||||||
- SetError handling of unknown properties.
|
- SetError handling of unknown properties.
|
||||||
|
- Support deserializing non-IANA registered roles.
|
||||||
|
|
||||||
jmap-client 0.2.1
|
jmap-client 0.2.1
|
||||||
================================
|
================================
|
||||||
|
|
|
@ -113,23 +113,16 @@ pub(crate) enum ACLPatch {
|
||||||
Set(bool),
|
Set(bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||||
#[serde(rename_all = "lowercase")]
|
|
||||||
pub enum Role {
|
pub enum Role {
|
||||||
#[serde(rename = "archive", alias = "ARCHIVE")]
|
|
||||||
Archive,
|
Archive,
|
||||||
#[serde(rename = "drafts", alias = "DRAFTS")]
|
|
||||||
Drafts,
|
Drafts,
|
||||||
#[serde(rename = "important", alias = "IMPORTANT")]
|
|
||||||
Important,
|
Important,
|
||||||
#[serde(rename = "inbox", alias = "INBOX")]
|
|
||||||
Inbox,
|
Inbox,
|
||||||
#[serde(rename = "junk", alias = "JUNK")]
|
|
||||||
Junk,
|
Junk,
|
||||||
#[serde(rename = "sent", alias = "SENT")]
|
|
||||||
Sent,
|
Sent,
|
||||||
#[serde(rename = "trash", alias = "TRASH")]
|
|
||||||
Trash,
|
Trash,
|
||||||
|
Other(String),
|
||||||
#[default]
|
#[default]
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
@ -252,3 +245,43 @@ impl ChangesObject for Mailbox<Set> {
|
||||||
impl ChangesObject for Mailbox<Get> {
|
impl ChangesObject for Mailbox<Get> {
|
||||||
type ChangesResponse = ChangesResponse;
|
type ChangesResponse = ChangesResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'de> Deserialize<'de> for Role {
|
||||||
|
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||||
|
where
|
||||||
|
D: serde::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
match <&str>::deserialize(deserializer)?
|
||||||
|
.to_ascii_lowercase()
|
||||||
|
.as_str()
|
||||||
|
{
|
||||||
|
"inbox" => Ok(Role::Inbox),
|
||||||
|
"sent" => Ok(Role::Sent),
|
||||||
|
"trash" => Ok(Role::Trash),
|
||||||
|
"drafts" => Ok(Role::Drafts),
|
||||||
|
"junk" => Ok(Role::Junk),
|
||||||
|
"archive" => Ok(Role::Archive),
|
||||||
|
"important" => Ok(Role::Important),
|
||||||
|
other => Ok(Role::Other(other.to_string())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Serialize for Role {
|
||||||
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: serde::Serializer,
|
||||||
|
{
|
||||||
|
serializer.serialize_str(match self {
|
||||||
|
Role::Inbox => "inbox",
|
||||||
|
Role::Sent => "sent",
|
||||||
|
Role::Trash => "trash",
|
||||||
|
Role::Drafts => "drafts",
|
||||||
|
Role::Junk => "junk",
|
||||||
|
Role::Archive => "archive",
|
||||||
|
Role::Important => "important",
|
||||||
|
Role::Other(other) => other,
|
||||||
|
Role::None => "",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue