sendgrid_api/
senders.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct Senders {
5    pub client: Client,
6}
7
8impl Senders {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        Senders { client }
12    }
13
14    /**
15     * Create a Sender Identity.
16     *
17     * This function performs a `POST` to the `/marketing/senders` endpoint.
18     *
19     * **This endpoint allows you to create a new sender identity.**
20     *
21     * *You may create up to 100 unique sender identities.*
22     *
23     * Sender identities are required to be verified before use. If your domain has been authenticated, a new sender identity will auto verify on creation. Otherwise an email will be sent to the `from.email`.
24     *
25     * **Parameters:**
26     *
27     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
28     */
29    pub async fn post_marketing(
30        &self,
31        body: &crate::types::PostMarketingSendersRequest,
32    ) -> ClientResult<crate::Response<crate::types::SenderAllOf>> {
33        let url = self.client.url("/marketing/senders", None);
34        self.client
35            .post(
36                &url,
37                crate::Message {
38                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
39                    content_type: Some("application/json".to_string()),
40                },
41            )
42            .await
43    }
44}