gsquire / sendgrid-rs

Unofficial Rust library for the SendGrid API
https://crates.io/crates/sendgrid
MIT License
107 stars 50 forks source link

Personalization requires at least one email which isn't convenient #79

Closed GopherJ closed 1 month ago

GopherJ commented 3 years ago

I just noticed that since certain commit, Personalization needs to provide at least one email, this isn't convenient.

Because in one email we often have multiple receivers, it's normal to build an empty Personalization and then loop through the list of receivers.

However, with the latest change, we need to do:

let mut p = Personalization::new(Email::new(receivers.remove(0))

p.add_to(..)

comparing to:

let mut p = Personalization::new()

p.add_to(..)
gsquire commented 3 years ago

Hey, sorry that this is a little bit of a paper cut for the API. I'd be willing to add an Email::many API that accepts a vector of receivers if that would help.

gsquire commented 1 month ago

I'm closing this since the work has been done. Feel free to re-open or make a new issue otherwise.