sendgrid_api/
email_address_validation.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct EmailAddressValidation {
5    pub client: Client,
6}
7
8impl EmailAddressValidation {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        EmailAddressValidation { client }
12    }
13
14    /**
15     * Validate an email.
16     *
17     * This function performs a `POST` to the `/validations/email` endpoint.
18     *
19     * **This endpoint allows you to validate an email address.**
20     */
21    pub async fn post_validations_email(
22        &self,
23        body: &crate::types::PostValidationsEmailRequest,
24    ) -> ClientResult<crate::Response<crate::types::PostValidationsEmailResponse>> {
25        let url = self.client.url("/validations/email", None);
26        self.client
27            .post(
28                &url,
29                crate::Message {
30                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
31                    content_type: Some("application/json".to_string()),
32                },
33            )
34            .await
35    }
36}