sendgrid_api/
settings_tracking.rs

1use crate::Client;
2use crate::ClientResult;
3
4pub struct SettingsTracking {
5    pub client: Client,
6}
7
8impl SettingsTracking {
9    #[doc(hidden)]
10    pub fn new(client: Client) -> Self {
11        SettingsTracking { client }
12    }
13
14    /**
15     * Retrieve Tracking Settings.
16     *
17     * This function performs a `GET` to the `/tracking_settings` endpoint.
18     *
19     * **This endpoint allows you to retrieve a list of all tracking settings on your account.**
20     *
21     * **Parameters:**
22     *
23     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
24     */
25    pub async fn get_tracking_settings(
26        &self,
27    ) -> ClientResult<crate::Response<crate::types::GetTrackingSettingsResponse>> {
28        let url = self.client.url("/tracking_settings", None);
29        self.client
30            .get(
31                &url,
32                crate::Message {
33                    body: None,
34                    content_type: None,
35                },
36            )
37            .await
38    }
39    /**
40     * Retrieve Click Track Settings.
41     *
42     * This function performs a `GET` to the `/tracking_settings/click` endpoint.
43     *
44     * **This endpoint allows you to retrieve your current click tracking setting.**
45     *
46     * Click Tracking overrides all the links and URLs in your emails and points them to either SendGrid’s servers or the domain with which you branded your link. When a customer clicks a link, SendGrid tracks those [clicks](https://sendgrid.com/docs/glossary/clicks/).
47     *
48     * Click tracking helps you understand how users are engaging with your communications. SendGrid can track up to 1000 links per email
49     *
50     * **Parameters:**
51     *
52     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
53     */
54    pub async fn get_tracking_settings_click(
55        &self,
56    ) -> ClientResult<crate::Response<crate::types::ClickTracking>> {
57        let url = self.client.url("/tracking_settings/click", None);
58        self.client
59            .get(
60                &url,
61                crate::Message {
62                    body: None,
63                    content_type: None,
64                },
65            )
66            .await
67    }
68    /**
69     * Update Click Tracking Settings.
70     *
71     * This function performs a `PATCH` to the `/tracking_settings/click` endpoint.
72     *
73     * **This endpoint allows you to enable or disable your current click tracking setting.**
74     *
75     * Click Tracking overrides all the links and URLs in your emails and points them to either SendGrid’s servers or the domain with which you branded your link. When a customer clicks a link, SendGrid tracks those [clicks](https://sendgrid.com/docs/glossary/clicks/).
76     *
77     * Click tracking helps you understand how users are engaging with your communications. SendGrid can track up to 1000 links per email
78     *
79     * **Parameters:**
80     *
81     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
82     */
83    pub async fn patch_tracking_settings_click(
84        &self,
85        body: &crate::types::PatchTrackingSettingsOpenRequest,
86    ) -> ClientResult<crate::Response<crate::types::ClickTracking>> {
87        let url = self.client.url("/tracking_settings/click", None);
88        self.client
89            .patch(
90                &url,
91                crate::Message {
92                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
93                    content_type: Some("application/json".to_string()),
94                },
95            )
96            .await
97    }
98    /**
99     * Retrieve Google Analytics Settings.
100     *
101     * This function performs a `GET` to the `/tracking_settings/google_analytics` endpoint.
102     *
103     * **This endpoint allows you to retrieve your current setting for Google Analytics.**
104     *
105     *
106     * Google Analytics helps you understand how users got to your site and what they're doing there. For more information about using Google Analytics, please refer to [Google’s URL Builder](https://support.google.com/analytics/answer/1033867?hl=en) and their article on ["Best Practices for Campaign Building"](https://support.google.com/analytics/answer/1037445).
107     *
108     * We default the settings to Google’s recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/ui/analytics-and-reporting/google-analytics/).
109     *
110     * **Parameters:**
111     *
112     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
113     */
114    pub async fn get_tracking_settings_google_analytic(
115        &self,
116    ) -> ClientResult<crate::Response<crate::types::GoogleAnalyticsSettings>> {
117        let url = self.client.url("/tracking_settings/google_analytics", None);
118        self.client
119            .get(
120                &url,
121                crate::Message {
122                    body: None,
123                    content_type: None,
124                },
125            )
126            .await
127    }
128    /**
129     * Update Google Analytics Settings.
130     *
131     * This function performs a `PATCH` to the `/tracking_settings/google_analytics` endpoint.
132     *
133     * **This endpoint allows you to update your current setting for Google Analytics.**
134     *
135     * Google Analytics helps you understand how users got to your site and what they're doing there. For more information about using Google Analytics, please refer to [Google’s URL Builder](https://support.google.com/analytics/answer/1033867?hl=en) and their article on ["Best Practices for Campaign Building"](https://support.google.com/analytics/answer/1037445).
136     *
137     * We default the settings to Google’s recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/ui/analytics-and-reporting/google-analytics/).
138     *
139     * **Parameters:**
140     *
141     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
142     */
143    pub async fn patch_tracking_settings_google_analytics(
144        &self,
145        body: &crate::types::GoogleAnalyticsSettings,
146    ) -> ClientResult<crate::Response<crate::types::GoogleAnalyticsSettings>> {
147        let url = self.client.url("/tracking_settings/google_analytics", None);
148        self.client
149            .patch(
150                &url,
151                crate::Message {
152                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
153                    content_type: Some("application/json".to_string()),
154                },
155            )
156            .await
157    }
158    /**
159     * Get Open Tracking Settings.
160     *
161     * This function performs a `GET` to the `/tracking_settings/open` endpoint.
162     *
163     * **This endpoint allows you to retrieve your current settings for open tracking.**
164     *
165     * Open Tracking adds an invisible image at the end of the email which can track email opens.
166     *
167     * If the email recipient has images enabled on their email client, a request to SendGrid’s server for the invisible image is executed and an open event is logged.
168     *
169     * These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.
170     *
171     * **Parameters:**
172     *
173     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
174     */
175    pub async fn get_tracking_settings_open(
176        &self,
177    ) -> ClientResult<crate::Response<crate::types::GetTrackingSettingsOpenResponse>> {
178        let url = self.client.url("/tracking_settings/open", None);
179        self.client
180            .get(
181                &url,
182                crate::Message {
183                    body: None,
184                    content_type: None,
185                },
186            )
187            .await
188    }
189    /**
190     * Update Open Tracking Settings.
191     *
192     * This function performs a `PATCH` to the `/tracking_settings/open` endpoint.
193     *
194     * **This endpoint allows you to update your current settings for open tracking.**
195     *
196     * Open Tracking adds an invisible image at the end of the email which can track email opens.
197     *
198     * If the email recipient has images enabled on their email client, a request to SendGrid’s server for the invisible image is executed and an open event is logged.
199     *
200     * These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.
201     *
202     * **Parameters:**
203     *
204     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
205     */
206    pub async fn patch_tracking_settings_open(
207        &self,
208        body: &crate::types::PatchTrackingSettingsOpenRequest,
209    ) -> ClientResult<crate::Response<crate::types::GetTrackingSettingsOpenResponse>> {
210        let url = self.client.url("/tracking_settings/open", None);
211        self.client
212            .patch(
213                &url,
214                crate::Message {
215                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
216                    content_type: Some("application/json".to_string()),
217                },
218            )
219            .await
220    }
221    /**
222     * Retrieve Subscription Tracking Settings.
223     *
224     * This function performs a `GET` to the `/tracking_settings/subscription` endpoint.
225     *
226     * **This endpoint allows you to retrieve your current settings for subscription tracking.**
227     *
228     * Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.
229     *
230     * **Parameters:**
231     *
232     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
233     */
234    pub async fn get_tracking_settings_subscription(
235        &self,
236    ) -> ClientResult<crate::Response<crate::types::SubscriptionTrackingSettings>> {
237        let url = self.client.url("/tracking_settings/subscription", None);
238        self.client
239            .get(
240                &url,
241                crate::Message {
242                    body: None,
243                    content_type: None,
244                },
245            )
246            .await
247    }
248    /**
249     * Update Subscription Tracking Settings.
250     *
251     * This function performs a `PATCH` to the `/tracking_settings/subscription` endpoint.
252     *
253     * **This endpoint allows you to update your current settings for subscription tracking.**
254     *
255     * Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.
256     *
257     * **Parameters:**
258     *
259     * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
260     */
261    pub async fn patch_tracking_settings_subscription(
262        &self,
263        body: &crate::types::SubscriptionTrackingSettings,
264    ) -> ClientResult<crate::Response<crate::types::SubscriptionTrackingSettings>> {
265        let url = self.client.url("/tracking_settings/subscription", None);
266        self.client
267            .patch(
268                &url,
269                crate::Message {
270                    body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
271                    content_type: Some("application/json".to_string()),
272                },
273            )
274            .await
275    }
276}