diff --git a/CHANGELOG.md b/CHANGELOG.md index e656640..d3505fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.22.1 - 2024-09-04 + +### Added + +- `Personalization::new_many` was added to simplify the API. + ## 0.22.0 - 2024-08-30 ### Changed diff --git a/Cargo.toml b/Cargo.toml index 5cd4f78..b241f09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sendgrid" -version = "0.22.0" +version = "0.22.1" edition = "2021" authors = ["Garrett Squire "] description = "An unofficial client library for the SendGrid API" diff --git a/src/v3.rs b/src/v3.rs index 9cd0876..56e93fe 100644 --- a/src/v3.rs +++ b/src/v3.rs @@ -128,7 +128,7 @@ pub struct Content { /// A personalization block for a V3 message. It has to at least contain one email as a to /// address. All other fields are optional. -#[derive(Serialize)] +#[derive(Default, Serialize)] pub struct Personalization { to: Vec, @@ -438,29 +438,15 @@ impl Personalization { pub fn new(email: Email) -> Personalization { Personalization { to: vec![email], - cc: None, - bcc: None, - subject: None, - headers: None, - substitutions: None, - custom_args: None, - dynamic_template_data: None, - send_at: None, + ..Default::default() } } - /// Construct a new personalization block for this message with a Vec of Email + /// Construct a new personalization block for this message with more than one address. pub fn new_many(email: Vec) -> Personalization { Personalization { to: email, - cc: None, - bcc: None, - subject: None, - headers: None, - substitutions: None, - custom_args: None, - dynamic_template_data: None, - send_at: None, + ..Default::default() } }