sendgrid_api/settings_partner.rs
1use crate::Client;
2use crate::ClientResult;
3
4pub struct SettingsPartner {
5 pub client: Client,
6}
7
8impl SettingsPartner {
9 #[doc(hidden)]
10 pub fn new(client: Client) -> Self {
11 SettingsPartner { client }
12 }
13
14 /**
15 * Returns all New Relic partner settings.
16 *
17 * This function performs a `GET` to the `/partner_settings/new_relic` endpoint.
18 *
19 * **This endpoint allows you to retrieve your current New Relic partner settings.**
20 *
21 * Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [Partners documentation](https://sendgrid.com/docs/ui/account-and-settings/partners/).
22 *
23 * By integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [SendGrid for New Relic documentation](https://sendgrid.com/docs/ui/analytics-and-reporting/tracking-stats-using-new-relic/).
24 *
25 * **Parameters:**
26 *
27 * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
28 */
29 pub async fn get_partner_settings_new_relic(
30 &self,
31 ) -> ClientResult<crate::Response<crate::types::PartnerSettingsNewRelic>> {
32 let url = self.client.url("/partner_settings/new_relic", None);
33 self.client
34 .get(
35 &url,
36 crate::Message {
37 body: None,
38 content_type: None,
39 },
40 )
41 .await
42 }
43 /**
44 * Updates New Relic partner settings.
45 *
46 * This function performs a `PATCH` to the `/partner_settings/new_relic` endpoint.
47 *
48 * **This endpoint allows you to update or change your New Relic partner settings.**
49 *
50 * Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [Partners documentation](https://sendgrid.com/docs/ui/account-and-settings/partners/).
51 *
52 * By integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [SendGrid for New Relic documentation](https://sendgrid.com/docs/ui/analytics-and-reporting/tracking-stats-using-new-relic/).
53 *
54 * **Parameters:**
55 *
56 * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
57 */
58 pub async fn patch_partner_settings_new_relic(
59 &self,
60 body: &crate::types::PatchPartnerSettingsNewRelicRequest,
61 ) -> ClientResult<crate::Response<crate::types::PartnerSettingsNewRelic>> {
62 let url = self.client.url("/partner_settings/new_relic", None);
63 self.client
64 .patch(
65 &url,
66 crate::Message {
67 body: Some(reqwest::Body::from(serde_json::to_vec(body)?)),
68 content_type: Some("application/json".to_string()),
69 },
70 )
71 .await
72 }
73 /**
74 * Returns a list of all partner settings.
75 *
76 * This function performs a `GET` to the `/partner_settings` endpoint.
77 *
78 * **This endpoint allows you to retrieve a list of all partner settings that you can enable.**
79 *
80 * Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [Partners documentation](https://sendgrid.com/docs/ui/account-and-settings/partners/).
81 *
82 * **Parameters:**
83 *
84 * * `limit: i64` -- The number of settings to return per page.
85 * * `offset: i64` -- The paging offset.
86 * * `on_behalf_of: &str` -- The license key provided with your New Relic account.
87 */
88 pub async fn get_partner_settings(
89 &self,
90 limit: i64,
91 offset: i64,
92 ) -> ClientResult<crate::Response<crate::types::GetPartnerSettingsResponse>> {
93 let mut query_args: Vec<(String, String)> = Default::default();
94 if limit > 0 {
95 query_args.push(("limit".to_string(), limit.to_string()));
96 }
97 if offset > 0 {
98 query_args.push(("offset".to_string(), offset.to_string()));
99 }
100 let query_ = serde_urlencoded::to_string(&query_args).unwrap();
101 let url = self
102 .client
103 .url(&format!("/partner_settings?{}", query_), None);
104 self.client
105 .get(
106 &url,
107 crate::Message {
108 body: None,
109 content_type: None,
110 },
111 )
112 .await
113 }
114}