1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
use anyhow::Result;
use crate::Client;
pub struct SettingsTracking {
pub client: Client,
}
impl SettingsTracking {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
SettingsTracking { client }
}
/**
* Retrieve Tracking Settings.
*
* This function performs a `GET` to the `/tracking_settings` endpoint.
*
* **This endpoint allows you to retrieve a list of all tracking settings on your account.**
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_tracking_settings(&self) -> Result<crate::types::GetTrackingSettingsResponse> {
let url = "/tracking_settings".to_string();
self.client.get(&url, None).await
}
/**
* Retrieve Click Track Settings.
*
* This function performs a `GET` to the `/tracking_settings/click` endpoint.
*
* **This endpoint allows you to retrieve your current click tracking setting.**
*
* 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/).
*
* Click tracking helps you understand how users are engaging with your communications. SendGrid can track up to 1000 links per email
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_tracking_settings_click(&self) -> Result<crate::types::ClickTracking> {
let url = "/tracking_settings/click".to_string();
self.client.get(&url, None).await
}
/**
* Update Click Tracking Settings.
*
* This function performs a `PATCH` to the `/tracking_settings/click` endpoint.
*
* **This endpoint allows you to enable or disable your current click tracking setting.**
*
* 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/).
*
* Click tracking helps you understand how users are engaging with your communications. SendGrid can track up to 1000 links per email
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn patch_tracking_settings_click(
&self,
body: &crate::types::PatchTrackingSettingsOpenRequest,
) -> Result<crate::types::ClickTracking> {
let url = "/tracking_settings/click".to_string();
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Retrieve Google Analytics Settings.
*
* This function performs a `GET` to the `/tracking_settings/google_analytics` endpoint.
*
* **This endpoint allows you to retrieve your current setting for Google Analytics.**
*
*
* 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).
*
* 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/).
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_tracking_settings_google_analytic(
&self,
) -> Result<crate::types::GoogleAnalyticsSettings> {
let url = "/tracking_settings/google_analytics".to_string();
self.client.get(&url, None).await
}
/**
* Update Google Analytics Settings.
*
* This function performs a `PATCH` to the `/tracking_settings/google_analytics` endpoint.
*
* **This endpoint allows you to update your current setting for Google Analytics.**
*
* 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).
*
* 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/).
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn patch_tracking_settings_google_analytics(
&self,
body: &crate::types::GoogleAnalyticsSettings,
) -> Result<crate::types::GoogleAnalyticsSettings> {
let url = "/tracking_settings/google_analytics".to_string();
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Get Open Tracking Settings.
*
* This function performs a `GET` to the `/tracking_settings/open` endpoint.
*
* **This endpoint allows you to retrieve your current settings for open tracking.**
*
* Open Tracking adds an invisible image at the end of the email which can track email opens.
*
* 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.
*
* These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_tracking_settings_open(
&self,
) -> Result<crate::types::GetTrackingSettingsOpenResponse> {
let url = "/tracking_settings/open".to_string();
self.client.get(&url, None).await
}
/**
* Update Open Tracking Settings.
*
* This function performs a `PATCH` to the `/tracking_settings/open` endpoint.
*
* **This endpoint allows you to update your current settings for open tracking.**
*
* Open Tracking adds an invisible image at the end of the email which can track email opens.
*
* 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.
*
* These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn patch_tracking_settings_open(
&self,
body: &crate::types::PatchTrackingSettingsOpenRequest,
) -> Result<crate::types::GetTrackingSettingsOpenResponse> {
let url = "/tracking_settings/open".to_string();
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Retrieve Subscription Tracking Settings.
*
* This function performs a `GET` to the `/tracking_settings/subscription` endpoint.
*
* **This endpoint allows you to retrieve your current settings for subscription tracking.**
*
* Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn get_tracking_settings_subscription(
&self,
) -> Result<crate::types::SubscriptionTrackingSettings> {
let url = "/tracking_settings/subscription".to_string();
self.client.get(&url, None).await
}
/**
* Update Subscription Tracking Settings.
*
* This function performs a `PATCH` to the `/tracking_settings/subscription` endpoint.
*
* **This endpoint allows you to update your current settings for subscription tracking.**
*
* Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.
*
* **Parameters:**
*
* * `on_behalf_of: &str` -- The license key provided with your New Relic account.
*/
pub async fn patch_tracking_settings_subscription(
&self,
body: &crate::types::SubscriptionTrackingSettings,
) -> Result<crate::types::SubscriptionTrackingSettings> {
let url = "/tracking_settings/subscription".to_string();
self.client
.patch(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
}