use serde::Serialize;
use crate::{
types::{Email, EmailResponse, TemplatedEmail},
Client, Result,
};
impl Client {
pub async fn send_batch_emails(&self, emails: &[Email]) -> Result<Vec<EmailResponse>> {
Ok(self.post("/email/batch", emails).await?)
}
pub async fn send_batch_template_emails<M>(
&self,
email: &[TemplatedEmail<M>],
) -> Result<EmailResponse>
where
M: Serialize,
{
Ok(self.post("/email/batchWithTemplates", email).await?)
}
pub async fn send_email(&self, email: &Email) -> Result<EmailResponse> {
Ok(self.post("/email", email).await?)
}
pub async fn send_template_email<M>(&self, email: &TemplatedEmail<M>) -> Result<EmailResponse>
where
M: Serialize,
{
Ok(self.post("/email/withTemplate", email).await?)
}
}