diff --git a/Cargo.toml b/Cargo.toml index 9d5222b..1705f3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,8 @@ async-stream = { version = "0.3", optional = true} serde = { version = "1.0", features = ["derive"]} serde_json = "1.0" chrono = { version = "0.4", features = ["serde"]} -ahash = {version = "0.7.6", features = ["serde"]} -parking_lot = "0.12.0" +ahash = {version = "0.8", features = ["serde"]} +parking_lot = "0.12" base64 = "0.13" [features] diff --git a/src/core/set.rs b/src/core/set.rs index b969e34..60a0ca0 100644 --- a/src/core/set.rs +++ b/src/core/set.rs @@ -82,7 +82,7 @@ where properties: Option>, } -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, Eq, PartialEq)] pub enum SetErrorType { #[serde(rename = "forbidden")] Forbidden, diff --git a/src/principal/helpers.rs b/src/principal/helpers.rs index e9c2879..fc1b683 100644 --- a/src/principal/helpers.rs +++ b/src/principal/helpers.rs @@ -12,7 +12,7 @@ use crate::{ Get, Method, Set, }; -use super::{Principal, Property, Type}; +use super::{Principal, Property, Type, DKIM}; impl Client { pub async fn individual_create( @@ -52,6 +52,25 @@ impl Client { .created(&id) } + pub async fn domain_enable_dkim( + &self, + id: &str, + key: impl Into, + selector: impl Into, + expiration: Option, + ) -> crate::Result> { + let mut request = self.build(); + request + .set_principal() + .update(id) + .secret(key) + .dkim(DKIM::new(Some(selector), expiration)); + request + .send_single::() + .await? + .updated(id) + } + pub async fn list_create( &self, email: impl Into, diff --git a/src/principal/mod.rs b/src/principal/mod.rs index dcfc8e2..794beda 100644 --- a/src/principal/mod.rs +++ b/src/principal/mod.rs @@ -156,9 +156,9 @@ pub struct DKIM { } impl DKIM { - pub fn new(dkim_selector: Option, dkim_expiration: Option) -> DKIM { + pub fn new(dkim_selector: Option>, dkim_expiration: Option) -> DKIM { DKIM { - dkim_selector, + dkim_selector: dkim_selector.map(Into::into), dkim_expiration, } }