sendgrid2/lib.rs
1//! [`SendgridClient`](struct.SendgridClient.html) is the main entry point for this library.
2//!
3//! Library created with [`libninja`](https://www.libninja.com).
4#![allow(non_camel_case_types)]
5#![allow(unused)]
6pub mod model;
7pub mod request;
8use crate::model::*;
9
10pub struct SendgridClient {
11 pub(crate) client: httpclient::Client,
12 authentication: SendgridAuthentication,
13}
14impl SendgridClient {
15 pub fn from_env() -> Self {
16 let url = "https://api.sendgrid.com".to_string();
17 Self {
18 client: httpclient::Client::new(Some(url)),
19 authentication: SendgridAuthentication::from_env(),
20 }
21 }
22}
23impl SendgridClient {
24 pub fn new(url: &str, authentication: SendgridAuthentication) -> Self {
25 let client = httpclient::Client::new(Some(url.to_string()));
26 Self { client, authentication }
27 }
28 pub fn with_authentication(
29 mut self,
30 authentication: SendgridAuthentication,
31 ) -> Self {
32 self.authentication = authentication;
33 self
34 }
35 pub fn authenticate<'a>(
36 &self,
37 mut r: httpclient::RequestBuilder<'a>,
38 ) -> httpclient::RequestBuilder<'a> {
39 match &self.authentication {
40 SendgridAuthentication::Authorization { authorization } => {
41 r = r.header("Authorization", authorization);
42 }
43 }
44 r
45 }
46 pub fn with_middleware<M: httpclient::Middleware + 'static>(
47 mut self,
48 middleware: M,
49 ) -> Self {
50 self.client = self.client.with_middleware(middleware);
51 self
52 }
53 /**Retrieve all recent access attempts
54
55**This endpoint allows you to retrieve a list of all of the IP addresses that recently attempted to access your account either through the User Interface or the API.***/
56 pub fn get_access_settings_activity(
57 &self,
58 ) -> request::GetAccessSettingsActivityRequest {
59 request::GetAccessSettingsActivityRequest {
60 client: &self,
61 limit: None,
62 on_behalf_of: None,
63 }
64 }
65 /**Retrieve a list of currently allowed IPs
66
67**This endpoint allows you to retrieve a list of IP addresses that are currently allowed to access your account.**
68
69Each IP address returned to you will have `created_at` and `updated_at` dates. Each IP will also be associated with an `id` that can be used to remove the address from your allow list.*/
70 pub fn get_access_settings_whitelist(
71 &self,
72 ) -> request::GetAccessSettingsWhitelistRequest {
73 request::GetAccessSettingsWhitelistRequest {
74 client: &self,
75 on_behalf_of: None,
76 }
77 }
78 /**Add one or more IPs to the allow list
79
80**This endpoint allows you to add one or more allowed IP addresses.**
81
82To allow one or more IP addresses, pass them to this endpoint in an array. Once an IP address is added to your allow list, it will be assigned an `id` that can be used to remove the address. You can retrieve the ID associated with an IP using the "Retrieve a list of currently allowed IPs" endpoint.*/
83 pub fn post_access_settings_whitelist(
84 &self,
85 ips: Vec<serde_json::Value>,
86 ) -> request::PostAccessSettingsWhitelistRequest {
87 request::PostAccessSettingsWhitelistRequest {
88 client: &self,
89 on_behalf_of: None,
90 ips,
91 }
92 }
93 /**Remove one or more IPs from the allow list
94
95**This endpoint allows you to remove one or more IP addresses from your list of allowed addresses.**
96
97To remove one or more IP addresses, pass this endpoint an array containing the ID(s) associated with the IP(s) you intend to remove. You can retrieve the IDs associated with your allowed IP addresses using the "Retrieve a list of currently allowed IPs" endpoint.
98
99It is possible to remove your own IP address, which will block access to your account. You will need to submit a [support ticket](https://sendgrid.com/docs/ui/account-and-settings/support/) if this happens. For this reason, it is important to double check that you are removing only the IPs you intend to remove when using this endpoint.*/
100 pub fn delete_access_settings_whitelist(
101 &self,
102 ) -> request::DeleteAccessSettingsWhitelistRequest {
103 request::DeleteAccessSettingsWhitelistRequest {
104 client: &self,
105 on_behalf_of: None,
106 ids: None,
107 }
108 }
109 /**Retrieve a specific allowed IP
110
111**This endpoint allows you to retreive a specific IP address that has been allowed to access your account.**
112
113You must include the ID for the specific IP address you want to retrieve in your call. You can retrieve the IDs associated with your allowed IP addresses using the "Retrieve a list of currently allowed IPs" endpoint.*/
114 pub fn get_access_settings_whitelist_rule_id(
115 &self,
116 rule_id: &str,
117 ) -> request::GetAccessSettingsWhitelistRuleIdRequest {
118 request::GetAccessSettingsWhitelistRuleIdRequest {
119 client: &self,
120 on_behalf_of: None,
121 rule_id: rule_id.to_owned(),
122 }
123 }
124 /**Remove a specific IP from the allowed list
125
126**This endpoint allows you to remove a specific IP address from your list of allowed addresses.**
127
128When removing a specific IP address from your list, you must include the ID in your call. You can retrieve the IDs associated with your allowed IP addresses using the "Retrieve a list of currently allowed IPs" endpoint.*/
129 pub fn delete_access_settings_whitelist_rule_id(
130 &self,
131 rule_id: &str,
132 ) -> request::DeleteAccessSettingsWhitelistRuleIdRequest {
133 request::DeleteAccessSettingsWhitelistRuleIdRequest {
134 client: &self,
135 on_behalf_of: None,
136 rule_id: rule_id.to_owned(),
137 }
138 }
139 /**Retrieve all alerts
140
141**This endpoint allows you to retrieve all of your alerts.**
142
143Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
144* Usage alerts allow you to set the threshold at which an alert will be sent.
145* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
146
147For more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).*/
148 pub fn get_alerts(&self) -> request::GetAlertsRequest {
149 request::GetAlertsRequest {
150 client: &self,
151 authorization: None,
152 on_behalf_of: None,
153 }
154 }
155 /**Create a new Alert
156
157**This endpoint allows you to create a new alert.**
158
159Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics. There are two types of alerts that can be created with this endpoint:
160
161* `usage_limit` allows you to set the threshold at which an alert will be sent.
162* `stats_notification` allows you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
163
164For more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).*/
165 pub fn post_alerts(&self, type_: &str) -> request::PostAlertsRequest {
166 request::PostAlertsRequest {
167 client: &self,
168 authorization: None,
169 on_behalf_of: None,
170 email_to: None,
171 frequency: None,
172 percentage: None,
173 type_: type_.to_owned(),
174 }
175 }
176 /**Retrieve a specific alert
177
178**This endpoint allows you to retrieve a specific alert.**
179
180Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
181* Usage alerts allow you to set the threshold at which an alert will be sent.
182* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
183
184For more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).*/
185 pub fn get_alerts_alert_id(
186 &self,
187 alert_id: i64,
188 ) -> request::GetAlertsAlertIdRequest {
189 request::GetAlertsAlertIdRequest {
190 client: &self,
191 authorization: None,
192 on_behalf_of: None,
193 alert_id,
194 }
195 }
196 /**Delete an alert
197
198**This endpoint allows you to delete an alert.**
199
200Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
201* Usage alerts allow you to set the threshold at which an alert will be sent.
202* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
203
204For more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).*/
205 pub fn delete_alerts_alert_id(
206 &self,
207 alert_id: i64,
208 ) -> request::DeleteAlertsAlertIdRequest {
209 request::DeleteAlertsAlertIdRequest {
210 client: &self,
211 on_behalf_of: None,
212 alert_id,
213 }
214 }
215 /**Update an alert
216
217**This endpoint allows you to update an alert.**
218
219Alerts allow you to specify an email address to receive notifications regarding your email usage or statistics.
220* Usage alerts allow you to set the threshold at which an alert will be sent.
221* Stats notifications allow you to set how frequently you would like to receive email statistics reports. For example, "daily", "weekly", or "monthly".
222
223For more information about alerts, please see our [Alerts documentation](https://sendgrid.com/docs/ui/account-and-settings/alerts/).*/
224 pub fn patch_alerts_alert_id(
225 &self,
226 alert_id: i64,
227 ) -> request::PatchAlertsAlertIdRequest {
228 request::PatchAlertsAlertIdRequest {
229 client: &self,
230 on_behalf_of: None,
231 alert_id,
232 email_to: None,
233 frequency: None,
234 percentage: None,
235 }
236 }
237 /**Retrieve all API Keys belonging to the authenticated user
238
239**This endpoint allows you to retrieve all API Keys that belong to the authenticated user.**
240
241A successful response from this API will include all available API keys' names and IDs.
242
243For security reasons, there is not a way to retrieve the key itself after it's created. If you lose your API key, you must create a new one. Only the "Create API keys" endpoint will return a key to you and only at the time of creation.
244
245An `api_key_id` can be used to update or delete the key, as well as retrieve the key's details, such as its scopes.*/
246 pub fn get_api_keys(&self) -> request::GetApiKeysRequest {
247 request::GetApiKeysRequest {
248 client: &self,
249 limit: None,
250 on_behalf_of: None,
251 }
252 }
253 /**Create API keys
254
255**This endpoint allows you to create a new API Key for the user.**
256
257To create your initial SendGrid API Key, you should [use the SendGrid App](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management.
258
259> There is a limit of 100 API Keys on your account.
260
261A JSON request body containing a `name` property is required when making requests to this endpoint. If the number of maximum keys, 100, is reached, a `403` status will be returned.
262
263Though the `name` field is required, it does not need to be unique. A unique API key ID will be generated for each key you create and returned in the response body.
264
265It is not necessary to pass a `scopes` field to the API when creating a key, but you should be aware that omitting the `scopes` field from your request will create a key with "Full Access" permissions by default.
266
267See the [API Key Permissions List](https://sendgrid.api-docs.io/v3.0/how-to-use-the-sendgrid-v3-api/api-authorization) for all available scopes. An API key's scopes can be updated after creation using the "Update API keys" endpoint.*/
268 pub fn create_api_keys(&self, name: &str) -> request::CreateApiKeysRequest {
269 request::CreateApiKeysRequest {
270 client: &self,
271 on_behalf_of: None,
272 name: name.to_owned(),
273 scopes: None,
274 }
275 }
276 /**Retrieve an existing API Key
277
278**This endpoint allows you to retrieve a single API key using an `api_key_id`.**
279
280The endpoint will return a key's name, ID, and scopes. If the API Key ID does not, exist a `404` status will be returned.
281
282See the [API Key Permissions List](https://sendgrid.api-docs.io/v3.0/how-to-use-the-sendgrid-v3-api/api-authorization) for all available scopes. An API key's scopes can be updated after creation using the "Update API keys" endpoint.*/
283 pub fn get_api_keys_api_key_id(
284 &self,
285 api_key_id: &str,
286 ) -> request::GetApiKeysApiKeyIdRequest {
287 request::GetApiKeysApiKeyIdRequest {
288 client: &self,
289 on_behalf_of: None,
290 api_key_id: api_key_id.to_owned(),
291 }
292 }
293 /**Update API key name and scopes
294
295**This endpoint allows you to update the name and scopes of a given API key.**
296
297You must pass this endpoint a JSON request body with a `name` field and a `scopes` array containing at least one scope. The `name` and `scopes` fields will be used to update the key associated with the `api_key_id` in the request URL.
298
299If you need to update a key's scopes only, pass the `name` field with the key's existing name; the `name` will not be modified. If you need to update a key's name only, use the "Update API key name" endpoint.
300
301See the [API Key Permissions List](https://sendgrid.api-docs.io/v3.0/how-to-use-the-sendgrid-v3-api/api-authorization) for all available scopes.*/
302 pub fn put_api_keys_api_key_id(
303 &self,
304 api_key_id: &str,
305 name: &str,
306 ) -> request::PutApiKeysApiKeyIdRequest {
307 request::PutApiKeysApiKeyIdRequest {
308 client: &self,
309 on_behalf_of: None,
310 api_key_id: api_key_id.to_owned(),
311 name: name.to_owned(),
312 scopes: None,
313 }
314 }
315 /**Delete API keys
316
317**This endpoint allows you to revoke an existing API Key using an `api_key_id`**
318
319Authentications using a revoked API Key will fail after after some small propogation delay. If the API Key ID does not exist, a `404` status will be returned.*/
320 pub fn delete_api_keys_api_key_id(
321 &self,
322 api_key_id: &str,
323 ) -> request::DeleteApiKeysApiKeyIdRequest {
324 request::DeleteApiKeysApiKeyIdRequest {
325 client: &self,
326 on_behalf_of: None,
327 api_key_id: api_key_id.to_owned(),
328 }
329 }
330 /**Update API key name
331
332**This endpoint allows you to update the name of an existing API Key.**
333
334You must pass this endpoint a JSON request body with a `name` property, which will be used to rename the key associated with the `api_key_id` passed in the URL.*/
335 pub fn patch_api_keys_api_key_id(
336 &self,
337 api_key_id: &str,
338 name: &str,
339 ) -> request::PatchApiKeysApiKeyIdRequest {
340 request::PatchApiKeysApiKeyIdRequest {
341 client: &self,
342 on_behalf_of: None,
343 api_key_id: api_key_id.to_owned(),
344 name: name.to_owned(),
345 }
346 }
347 /**Retrieve all suppression groups associated with the user.
348
349**This endpoint allows you to retrieve a list of all suppression groups created by this user.**
350
351This endpoint can also return information for multiple group IDs that you include in your request. To add a group ID to your request, simply append `?id=123456&id=123456`, with the appropriate group IDs.*/
352 pub fn get_asm_groups(&self) -> request::GetAsmGroupsRequest {
353 request::GetAsmGroupsRequest {
354 client: &self,
355 id: None,
356 on_behalf_of: None,
357 }
358 }
359 /**Create a new suppression group
360
361**This endpoint allows you to create a new suppression group.**
362
363To add an email address to the suppression group, [create a Suppression](https://sendgrid.api-docs.io/v3.0/suppressions-suppressions/add-suppressions-to-a-suppression-group).*/
364 pub fn post_asm_groups(&self) -> request::PostAsmGroupsRequest {
365 request::PostAsmGroupsRequest {
366 client: &self,
367 on_behalf_of: None,
368 description: None,
369 is_default: None,
370 name: None,
371 }
372 }
373 /**Get information on a single suppression group.
374
375**This endpoint allows you to retrieve a single suppression group.***/
376 pub fn get_asm_groups_group_id(
377 &self,
378 group_id: &str,
379 ) -> request::GetAsmGroupsGroupIdRequest {
380 request::GetAsmGroupsGroupIdRequest {
381 client: &self,
382 on_behalf_of: None,
383 group_id: group_id.to_owned(),
384 }
385 }
386 /**Delete a Suppression Group
387
388**This endpoint allows you to delete a suppression group.**
389
390If a recipient uses the "one-click unsubscribe" option on an email associated with a deleted group, that recipient will be added to the global suppression list.
391
392Deleting a suppression group will remove the suppression, meaning email will once again be sent to the previously suppressed addresses. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.*/
393 pub fn delete_asm_groups_group_id(
394 &self,
395 group_id: &str,
396 ) -> request::DeleteAsmGroupsGroupIdRequest {
397 request::DeleteAsmGroupsGroupIdRequest {
398 client: &self,
399 on_behalf_of: None,
400 group_id: group_id.to_owned(),
401 }
402 }
403 /**Update a suppression group.
404
405**This endpoint allows you to update or change a suppression group.***/
406 pub fn patch_asm_groups_group_id(
407 &self,
408 args: request::PatchAsmGroupsGroupIdRequired,
409 ) -> request::PatchAsmGroupsGroupIdRequest {
410 request::PatchAsmGroupsGroupIdRequest {
411 client: &self,
412 on_behalf_of: None,
413 group_id: args.group_id.to_owned(),
414 description: args.description.to_owned(),
415 is_default: args.is_default,
416 name: args.name.to_owned(),
417 }
418 }
419 /**Retrieve all suppressions for a suppression group
420
421**This endpoint allows you to retrieve all suppressed email addresses belonging to the given group.***/
422 pub fn get_asm_groups_group_id_suppressions(
423 &self,
424 group_id: &str,
425 ) -> request::GetAsmGroupsGroupIdSuppressionsRequest {
426 request::GetAsmGroupsGroupIdSuppressionsRequest {
427 client: &self,
428 on_behalf_of: None,
429 group_id: group_id.to_owned(),
430 }
431 }
432 /**Add suppressions to a suppression group
433
434**This endpoint allows you to add email addresses to an unsubscribe group.**
435
436If you attempt to add suppressions to a group that has been deleted or does not exist, the suppressions will be added to the global suppressions list.*/
437 pub fn post_asm_groups_group_id_suppressions(
438 &self,
439 group_id: &str,
440 recipient_emails: &[&str],
441 ) -> request::PostAsmGroupsGroupIdSuppressionsRequest {
442 request::PostAsmGroupsGroupIdSuppressionsRequest {
443 client: &self,
444 on_behalf_of: None,
445 group_id: group_id.to_owned(),
446 recipient_emails: recipient_emails.iter().map(|&x| x.to_owned()).collect(),
447 }
448 }
449 /**Search for suppressions within a group
450
451**This endpoint allows you to search a suppression group for multiple suppressions.**
452
453When given a list of email addresses and a group ID, this endpoint will only return the email addresses that have been unsubscribed from the given group.*/
454 pub fn post_asm_groups_group_id_suppressions_search(
455 &self,
456 group_id: &str,
457 recipient_emails: &[&str],
458 ) -> request::PostAsmGroupsGroupIdSuppressionsSearchRequest {
459 request::PostAsmGroupsGroupIdSuppressionsSearchRequest {
460 client: &self,
461 on_behalf_of: None,
462 group_id: group_id.to_owned(),
463 recipient_emails: recipient_emails.iter().map(|&x| x.to_owned()).collect(),
464 }
465 }
466 /**Delete a suppression from a suppression group
467
468**This endpoint allows you to remove a suppressed email address from the given suppression group.**
469
470Removing an address will remove the suppression, meaning email will once again be sent to the previously suppressed addresses. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.*/
471 pub fn delete_asm_groups_group_id_suppressions_email(
472 &self,
473 group_id: &str,
474 email: &str,
475 ) -> request::DeleteAsmGroupsGroupIdSuppressionsEmailRequest {
476 request::DeleteAsmGroupsGroupIdSuppressionsEmailRequest {
477 client: &self,
478 on_behalf_of: None,
479 group_id: group_id.to_owned(),
480 email: email.to_owned(),
481 }
482 }
483 /**Retrieve all suppressions
484
485**This endpoint allows you to retrieve a list of all suppressions.***/
486 pub fn get_asm_suppressions(&self) -> request::GetAsmSuppressionsRequest {
487 request::GetAsmSuppressionsRequest {
488 client: &self,
489 on_behalf_of: None,
490 }
491 }
492 /**Add recipient addresses to the global suppression group.
493
494**This endpoint allows you to add one or more email addresses to the global suppressions group.***/
495 pub fn post_asm_suppressions_global(
496 &self,
497 recipient_emails: &[&str],
498 ) -> request::PostAsmSuppressionsGlobalRequest {
499 request::PostAsmSuppressionsGlobalRequest {
500 client: &self,
501 on_behalf_of: None,
502 recipient_emails: recipient_emails.iter().map(|&x| x.to_owned()).collect(),
503 }
504 }
505 /**Retrieve a Global Suppression
506
507**This endpoint allows you to retrieve a global suppression. You can also use this endpoint to confirm if an email address is already globally suppresed.**
508
509If the email address you include in the URL path parameter `{email}` is already globally suppressed, the response will include that email address. If the address you enter for `{email}` is not globally suppressed, an empty JSON object `{}` will be returned.*/
510 pub fn get_asm_suppressions_global_email(
511 &self,
512 email: &str,
513 ) -> request::GetAsmSuppressionsGlobalEmailRequest {
514 request::GetAsmSuppressionsGlobalEmailRequest {
515 client: &self,
516 on_behalf_of: None,
517 email: email.to_owned(),
518 }
519 }
520 /**Delete a Global Suppression
521
522**This endpoint allows you to remove an email address from the global suppressions group.**
523
524Deleting a suppression group will remove the suppression, meaning email will once again be sent to the previously suppressed addresses. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.*/
525 pub fn delete_asm_suppressions_global_email(
526 &self,
527 email: &str,
528 ) -> request::DeleteAsmSuppressionsGlobalEmailRequest {
529 request::DeleteAsmSuppressionsGlobalEmailRequest {
530 client: &self,
531 on_behalf_of: None,
532 email: email.to_owned(),
533 }
534 }
535 /**Retrieve all suppression groups for an email address
536
537**This endpoint returns a list of all groups from which the given email address has been unsubscribed.***/
538 pub fn get_asm_suppressions_email(
539 &self,
540 email: &str,
541 ) -> request::GetAsmSuppressionsEmailRequest {
542 request::GetAsmSuppressionsEmailRequest {
543 client: &self,
544 on_behalf_of: None,
545 email: email.to_owned(),
546 }
547 }
548 /**Retrieve email statistics by browser.
549
550**This endpoint allows you to retrieve your email statistics segmented by browser type.**
551
552**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
553
554Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).*/
555 pub fn get_browsers_stats(
556 &self,
557 start_date: &str,
558 ) -> request::GetBrowsersStatsRequest {
559 request::GetBrowsersStatsRequest {
560 client: &self,
561 browsers: None,
562 on_behalf_of: None,
563 limit: None,
564 offset: None,
565 aggregated_by: None,
566 start_date: start_date.to_owned(),
567 end_date: None,
568 }
569 }
570 /**Retrieve all Campaigns
571
572**This endpoint allows you to retrieve a list of all of your campaigns.**
573
574Returns campaigns in reverse order they were created (newest first).
575
576Returns an empty array if no campaigns exist.*/
577 pub fn get_campaigns(&self) -> request::GetCampaignsRequest {
578 request::GetCampaignsRequest {
579 client: &self,
580 limit: None,
581 offset: None,
582 on_behalf_of: None,
583 }
584 }
585 /**Create a Campaign
586
587**This endpoint allows you to create a campaign.**
588
589In order to send or schedule the campaign, you will be required to provide a subject, sender ID, content (we suggest both html and plain text), and at least one list or segment ID. This information is not required when you create a campaign.*/
590 pub fn post_campaigns(&self, title: &str) -> request::PostCampaignsRequest {
591 request::PostCampaignsRequest {
592 client: &self,
593 on_behalf_of: None,
594 categories: None,
595 custom_unsubscribe_url: None,
596 editor: None,
597 html_content: None,
598 ip_pool: None,
599 list_ids: None,
600 plain_content: None,
601 segment_ids: None,
602 sender_id: None,
603 subject: None,
604 suppression_group_id: None,
605 title: title.to_owned(),
606 }
607 }
608 /**Retrieve a single campaign
609
610**This endpoint allows you to retrieve a specific campaign.***/
611 pub fn get_campaigns_campaign_id(
612 &self,
613 campaign_id: i64,
614 ) -> request::GetCampaignsCampaignIdRequest {
615 request::GetCampaignsCampaignIdRequest {
616 client: &self,
617 on_behalf_of: None,
618 campaign_id,
619 }
620 }
621 /**Delete a Campaign
622
623**This endpoint allows you to delete a specific campaign.***/
624 pub fn delete_campaigns_campaign_id(
625 &self,
626 campaign_id: i64,
627 ) -> request::DeleteCampaignsCampaignIdRequest {
628 request::DeleteCampaignsCampaignIdRequest {
629 client: &self,
630 on_behalf_of: None,
631 campaign_id,
632 }
633 }
634 /**Update a Campaign
635
636**This endpoint allows you to update a specific campaign.**
637
638This is especially useful if you only set up the campaign using POST /campaigns, but didn't set many of the parameters.*/
639 pub fn patch_campaigns_campaign_id(
640 &self,
641 args: request::PatchCampaignsCampaignIdRequired,
642 ) -> request::PatchCampaignsCampaignIdRequest {
643 request::PatchCampaignsCampaignIdRequest {
644 client: &self,
645 on_behalf_of: None,
646 campaign_id: args.campaign_id,
647 categories: args.categories.iter().map(|&x| x.to_owned()).collect(),
648 html_content: args.html_content.to_owned(),
649 plain_content: args.plain_content.to_owned(),
650 subject: args.subject.to_owned(),
651 title: args.title.to_owned(),
652 }
653 }
654 /**View Scheduled Time of a Campaign
655
656**This endpoint allows you to retrieve the date and time that a campaign has been scheduled to be sent.***/
657 pub fn get_campaigns_campaign_id_schedules(
658 &self,
659 campaign_id: i64,
660 ) -> request::GetCampaignsCampaignIdSchedulesRequest {
661 request::GetCampaignsCampaignIdSchedulesRequest {
662 client: &self,
663 on_behalf_of: None,
664 campaign_id,
665 }
666 }
667 /**Schedule a Campaign
668
669**This endpoint allows you to schedule a specific date and time for your campaign to be sent.**
670
671If you have the flexibility, it's better to schedule mail for off-peak times. Most emails are scheduled and sent at the top of the hour or half hour. Scheduling email to avoid those times (for example, scheduling at 10:53) can result in lower deferral rates because it won't be going through our servers at the same times as everyone else's mail.*/
672 pub fn post_campaigns_campaign_id_schedules(
673 &self,
674 campaign_id: i64,
675 send_at: i64,
676 ) -> request::PostCampaignsCampaignIdSchedulesRequest {
677 request::PostCampaignsCampaignIdSchedulesRequest {
678 client: &self,
679 on_behalf_of: None,
680 campaign_id,
681 send_at,
682 }
683 }
684 /**Unschedule a Scheduled Campaign
685
686**This endpoint allows you to unschedule a campaign that has already been scheduled to be sent.**
687
688A successful unschedule will return a 204.
689If the specified campaign is in the process of being sent, the only option is to cancel (a different method).*/
690 pub fn delete_campaigns_campaign_id_schedules(
691 &self,
692 campaign_id: i64,
693 ) -> request::DeleteCampaignsCampaignIdSchedulesRequest {
694 request::DeleteCampaignsCampaignIdSchedulesRequest {
695 client: &self,
696 on_behalf_of: None,
697 campaign_id,
698 }
699 }
700 /**Update a Scheduled Campaign
701
702**This endpoint allows to you change the scheduled time and date for a campaign to be sent.***/
703 pub fn patch_campaigns_campaign_id_schedules(
704 &self,
705 campaign_id: i64,
706 send_at: i64,
707 ) -> request::PatchCampaignsCampaignIdSchedulesRequest {
708 request::PatchCampaignsCampaignIdSchedulesRequest {
709 client: &self,
710 on_behalf_of: None,
711 campaign_id,
712 send_at,
713 }
714 }
715 /**Send a Campaign
716
717**This endpoint allows you to immediately send an existing campaign.**
718
719Normally a POST request would have a body, but since this endpoint is telling us to send a resource that is already created, a request body is not needed.*/
720 pub fn post_campaigns_campaign_id_schedules_now(
721 &self,
722 campaign_id: i64,
723 ) -> request::PostCampaignsCampaignIdSchedulesNowRequest {
724 request::PostCampaignsCampaignIdSchedulesNowRequest {
725 client: &self,
726 on_behalf_of: None,
727 campaign_id,
728 }
729 }
730 /**Send a Test Campaign
731
732**This endpoint allows you to send a test campaign.**
733
734To send to multiple addresses, use an array for the JSON "to" value ["one@address","two@address"]*/
735 pub fn post_campaigns_campaign_id_schedules_test(
736 &self,
737 campaign_id: i64,
738 to: &str,
739 ) -> request::PostCampaignsCampaignIdSchedulesTestRequest {
740 request::PostCampaignsCampaignIdSchedulesTestRequest {
741 client: &self,
742 on_behalf_of: None,
743 campaign_id,
744 to: to.to_owned(),
745 }
746 }
747 /**Retrieve all categories
748
749**This endpoint allows you to retrieve a list of all of your categories.***/
750 pub fn get_categories(&self) -> request::GetCategoriesRequest {
751 request::GetCategoriesRequest {
752 client: &self,
753 limit: None,
754 category: None,
755 offset: None,
756 on_behalf_of: None,
757 }
758 }
759 /**Retrieve Email Statistics for Categories
760
761**This endpoint allows you to retrieve all of your email statistics for each of your categories.**
762
763If you do not define any query parameters, this endpoint will return a sum for each category in groups of 10.*/
764 pub fn get_categories_stats(
765 &self,
766 start_date: &str,
767 categories: &str,
768 ) -> request::GetCategoriesStatsRequest {
769 request::GetCategoriesStatsRequest {
770 client: &self,
771 start_date: start_date.to_owned(),
772 end_date: None,
773 categories: categories.to_owned(),
774 aggregated_by: None,
775 on_behalf_of: None,
776 }
777 }
778 /**Retrieve sums of email stats for each category.
779
780**This endpoint allows you to retrieve the total sum of each email statistic for every category over the given date range.**
781
782If you do not define any query parameters, this endpoint will return a sum for each category in groups of 10.*/
783 pub fn get_categories_stats_sums(
784 &self,
785 start_date: &str,
786 ) -> request::GetCategoriesStatsSumsRequest {
787 request::GetCategoriesStatsSumsRequest {
788 client: &self,
789 sort_by_metric: None,
790 sort_by_direction: None,
791 start_date: start_date.to_owned(),
792 end_date: None,
793 limit: None,
794 offset: None,
795 aggregated_by: None,
796 on_behalf_of: None,
797 }
798 }
799 /**Retrieve email statistics by client type.
800
801**This endpoint allows you to retrieve your email statistics segmented by client type.**
802
803**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
804
805Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).*/
806 pub fn get_clients_stats(
807 &self,
808 start_date: &str,
809 ) -> request::GetClientsStatsRequest {
810 request::GetClientsStatsRequest {
811 client: &self,
812 on_behalf_of: None,
813 start_date: start_date.to_owned(),
814 end_date: None,
815 aggregated_by: None,
816 }
817 }
818 /**Retrieve stats by a specific client type.
819
820**This endpoint allows you to retrieve your email statistics segmented by a specific client type.**
821
822**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
823
824## Available Client Types
825- phone
826- tablet
827- webmail
828- desktop
829
830Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).*/
831 pub fn get_clients_client_type_stats(
832 &self,
833 start_date: &str,
834 client_type: &str,
835 ) -> request::GetClientsClientTypeStatsRequest {
836 request::GetClientsClientTypeStatsRequest {
837 client: &self,
838 on_behalf_of: None,
839 start_date: start_date.to_owned(),
840 end_date: None,
841 aggregated_by: None,
842 client_type: client_type.to_owned(),
843 }
844 }
845 /**Retrieve all custom fields
846
847**This endpoint allows you to retrieve all custom fields.***/
848 pub fn get_contactdb_custom_fields(
849 &self,
850 ) -> request::GetContactdbCustomFieldsRequest {
851 request::GetContactdbCustomFieldsRequest {
852 client: &self,
853 on_behalf_of: None,
854 }
855 }
856 /**Create a Custom Field
857
858**This endpoint allows you to create a custom field.**
859
860**You can create up to 120 custom fields.***/
861 pub fn post_contactdb_custom_fields(
862 &self,
863 ) -> request::PostContactdbCustomFieldsRequest {
864 request::PostContactdbCustomFieldsRequest {
865 client: &self,
866 on_behalf_of: None,
867 name: None,
868 type_: None,
869 }
870 }
871 /**Retrieve a Custom Field
872
873**This endpoint allows you to retrieve a custom field by ID.***/
874 pub fn get_contactdb_custom_fields_custom_field_id(
875 &self,
876 custom_field_id: i64,
877 ) -> request::GetContactdbCustomFieldsCustomFieldIdRequest {
878 request::GetContactdbCustomFieldsCustomFieldIdRequest {
879 client: &self,
880 on_behalf_of: None,
881 custom_field_id,
882 }
883 }
884 /**Delete a Custom Field
885
886**This endpoint allows you to delete a custom field by ID.***/
887 pub fn delete_contactdb_custom_fields_custom_field_id(
888 &self,
889 custom_field_id: i64,
890 ) -> request::DeleteContactdbCustomFieldsCustomFieldIdRequest {
891 request::DeleteContactdbCustomFieldsCustomFieldIdRequest {
892 client: &self,
893 on_behalf_of: None,
894 custom_field_id,
895 }
896 }
897 /**Retrieve all lists
898
899**This endpoint allows you to retrieve all of your recipient lists. If you don't have any lists, an empty array will be returned.***/
900 pub fn get_contactdb_lists(&self) -> request::GetContactdbListsRequest {
901 request::GetContactdbListsRequest {
902 client: &self,
903 on_behalf_of: None,
904 }
905 }
906 /**Create a List
907
908**This endpoint allows you to create a list for your recipients.***/
909 pub fn post_contactdb_lists(
910 &self,
911 name: &str,
912 ) -> request::PostContactdbListsRequest {
913 request::PostContactdbListsRequest {
914 client: &self,
915 on_behalf_of: None,
916 name: name.to_owned(),
917 }
918 }
919 /**Delete Multiple lists
920
921**This endpoint allows you to delete multiple recipient lists.***/
922 pub fn delete_contactdb_lists(
923 &self,
924 body: serde_json::Value,
925 ) -> request::DeleteContactdbListsRequest {
926 request::DeleteContactdbListsRequest {
927 client: &self,
928 on_behalf_of: None,
929 body,
930 }
931 }
932 /**Retrieve a single list
933
934**This endpoint allows you to retrieve a single recipient list.***/
935 pub fn get_contactdb_lists_list_id(
936 &self,
937 ) -> request::GetContactdbListsListIdRequest {
938 request::GetContactdbListsListIdRequest {
939 client: &self,
940 list_id: None,
941 on_behalf_of: None,
942 }
943 }
944 /**Delete a List
945
946**This endpoint allows you to delete a specific recipient list with the given ID.***/
947 pub fn delete_contactdb_lists_list_id(
948 &self,
949 list_id: &str,
950 ) -> request::DeleteContactdbListsListIdRequest {
951 request::DeleteContactdbListsListIdRequest {
952 client: &self,
953 delete_contacts: None,
954 on_behalf_of: None,
955 list_id: list_id.to_owned(),
956 }
957 }
958 /**Update a List
959
960**This endpoint allows you to update the name of one of your recipient lists.***/
961 pub fn patch_contactdb_lists_list_id(
962 &self,
963 list_id: i64,
964 name: &str,
965 ) -> request::PatchContactdbListsListIdRequest {
966 request::PatchContactdbListsListIdRequest {
967 client: &self,
968 list_id,
969 on_behalf_of: None,
970 name: name.to_owned(),
971 }
972 }
973 /**Retrieve all recipients on a List
974
975**This endpoint allows you to retrieve all recipients on the list with the given ID.***/
976 pub fn get_contactdb_lists_list_id_recipients(
977 &self,
978 list_id: i64,
979 ) -> request::GetContactdbListsListIdRecipientsRequest {
980 request::GetContactdbListsListIdRecipientsRequest {
981 client: &self,
982 page: None,
983 page_size: None,
984 list_id,
985 on_behalf_of: None,
986 }
987 }
988 /**Add Multiple Recipients to a List
989
990**This endpoint allows you to add multiple recipients to a list.**
991
992Adds existing recipients to a list, passing in the recipient IDs to add. Recipient IDs should be passed exactly as they are returned from recipient endpoints.*/
993 pub fn post_contactdb_lists_list_id_recipients(
994 &self,
995 list_id: i64,
996 body: serde_json::Value,
997 ) -> request::PostContactdbListsListIdRecipientsRequest {
998 request::PostContactdbListsListIdRecipientsRequest {
999 client: &self,
1000 on_behalf_of: None,
1001 list_id,
1002 body,
1003 }
1004 }
1005 /**Add a Single Recipient to a List
1006
1007**This endpoint allows you to add a single recipient to a list.***/
1008 pub fn post_contactdb_lists_list_id_recipients_recipient_id(
1009 &self,
1010 list_id: i64,
1011 recipient_id: &str,
1012 ) -> request::PostContactdbListsListIdRecipientsRecipientIdRequest {
1013 request::PostContactdbListsListIdRecipientsRecipientIdRequest {
1014 client: &self,
1015 on_behalf_of: None,
1016 list_id,
1017 recipient_id: recipient_id.to_owned(),
1018 }
1019 }
1020 /**Delete a Single Recipient from a Single List
1021
1022**This endpoint allows you to delete a single recipient from a list.***/
1023 pub fn delete_contactdb_lists_list_id_recipients_recipient_id(
1024 &self,
1025 list_id: i64,
1026 recipient_id: i64,
1027 ) -> request::DeleteContactdbListsListIdRecipientsRecipientIdRequest {
1028 request::DeleteContactdbListsListIdRecipientsRecipientIdRequest {
1029 client: &self,
1030 list_id,
1031 recipient_id,
1032 on_behalf_of: None,
1033 }
1034 }
1035 /**Retrieve recipients
1036
1037**This endpoint allows you to retrieve all of your Marketing Campaigns recipients.**
1038
1039Batch deletion of a page makes it possible to receive an empty page of recipients before reaching the end of
1040the list of recipients. To avoid this issue; iterate over pages until a 404 is retrieved.*/
1041 pub fn get_contactdb_recipients(&self) -> request::GetContactdbRecipientsRequest {
1042 request::GetContactdbRecipientsRequest {
1043 client: &self,
1044 page: None,
1045 page_size: None,
1046 on_behalf_of: None,
1047 }
1048 }
1049 /**Add recipients
1050
1051**This endpoint allows you to add a Marketing Campaigns recipient.**
1052
1053You can add custom field data as a parameter on this endpoint. We have provided an example using some of the default custom fields SendGrid provides.
1054
1055The rate limit is three requests every 2 seconds. You can upload 1000 contacts per request. So the maximum upload rate is 1500 recipients per second.*/
1056 pub fn post_contactdb_recipients(
1057 &self,
1058 body: serde_json::Value,
1059 ) -> request::PostContactdbRecipientsRequest {
1060 request::PostContactdbRecipientsRequest {
1061 client: &self,
1062 on_behalf_of: None,
1063 body,
1064 }
1065 }
1066 /**Delete Recipients
1067
1068**This endpoint allows you to deletes one or more recipients.**
1069
1070The body of an API call to this endpoint must include an array of recipient IDs of the recipients you want to delete.*/
1071 pub fn delete_contactdb_recipients(
1072 &self,
1073 body: serde_json::Value,
1074 ) -> request::DeleteContactdbRecipientsRequest {
1075 request::DeleteContactdbRecipientsRequest {
1076 client: &self,
1077 on_behalf_of: None,
1078 body,
1079 }
1080 }
1081 /**Update Recipient
1082
1083**This endpoint allows you to update one or more recipients.**
1084
1085The body of an API call to this endpoint must include an array of one or more recipient objects.
1086
1087It is of note that you can add custom field data as parameters on recipient objects. We have provided an example using some of the default custom fields SendGrid provides.*/
1088 pub fn patch_contactdb_recipients(
1089 &self,
1090 body: serde_json::Value,
1091 ) -> request::PatchContactdbRecipientsRequest {
1092 request::PatchContactdbRecipientsRequest {
1093 client: &self,
1094 on_behalf_of: None,
1095 body,
1096 }
1097 }
1098 /**Retrieve the count of billable recipients
1099
1100**This endpoint allows you to retrieve the number of Marketing Campaigns recipients that you will be billed for.**
1101
1102You are billed for marketing campaigns based on the highest number of recipients you have had in your account at one time. This endpoint will allow you to know the current billable count value.*/
1103 pub fn get_contactdb_recipients_billable_count(
1104 &self,
1105 ) -> request::GetContactdbRecipientsBillableCountRequest {
1106 request::GetContactdbRecipientsBillableCountRequest {
1107 client: &self,
1108 on_behalf_of: None,
1109 }
1110 }
1111 /**Retrieve a Count of Recipients
1112
1113**This endpoint allows you to retrieve the total number of Marketing Campaigns recipients.***/
1114 pub fn get_contactdb_recipients_count(
1115 &self,
1116 ) -> request::GetContactdbRecipientsCountRequest {
1117 request::GetContactdbRecipientsCountRequest {
1118 client: &self,
1119 on_behalf_of: None,
1120 }
1121 }
1122 /**Search recipients
1123
1124<p>
1125 Search using segment conditions without actually creating a segment.
1126 Body contains a JSON object with <code>conditions</code>, a list of conditions as described below, and an optional <code>list_id</code>, which is a valid list ID for a list to limit the search on.
1127</p>
1128
1129<p>
1130 Valid operators for create and update depend on the type of the field for which you are searching.
1131</p>
1132
1133<ul>
1134 <li>Dates:
1135 <ul>
1136 <li>"eq", "ne", "lt" (before), "gt" (after)
1137 <ul>
1138 <li>You may use MM/DD/YYYY for day granularity or an epoch for second granularity.</li>
1139 </ul>
1140 </li>
1141 <li>"empty", "not_empty"</li>
1142 <li>"is within"
1143 <ul>
1144 <li>You may use an <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601 date format</a> or the # of days.</li>
1145 </ul>
1146 </li>
1147 </ul>
1148 </li>
1149 <li>Text: "contains", "eq" (is - matches the full field), "ne" (is not - matches any field where the entire field is not the condition value), "empty", "not_empty"</li>
1150 <li>Numbers: "eq", "lt", "gt", "empty", "not_empty"</li>
1151 <li>Email Clicks and Opens: "eq" (opened), "ne" (not opened)</li>
1152</ul>
1153
1154<p>
1155 Field values must all be a string.
1156</p>
1157
1158<p>
1159 Search conditions using "eq" or "ne" for email clicks and opens should provide a "field" of either <code>clicks.campaign_identifier</code> or <code>opens.campaign_identifier</code>.
1160 The condition value should be a string containing the id of a completed campaign.
1161</p>
1162
1163<p>
1164 Search conditions list may contain multiple conditions, joined by an "and" or "or" in the "and_or" field.
1165 The first condition in the conditions list must have an empty "and_or", and subsequent conditions must all specify an "and_or".
1166</p>*/
1167 pub fn post_contactdb_recipients_search(
1168 &self,
1169 conditions: Vec<ContactdbSegmentsConditions>,
1170 list_id: i64,
1171 ) -> request::PostContactdbRecipientsSearchRequest {
1172 request::PostContactdbRecipientsSearchRequest {
1173 client: &self,
1174 conditions,
1175 list_id,
1176 }
1177 }
1178 /**Retrieve a single recipient
1179
1180**This endpoint allows you to retrieve a single recipient by ID from your contact database.***/
1181 pub fn get_contactdb_recipients_recipient_id(
1182 &self,
1183 recipient_id: &str,
1184 ) -> request::GetContactdbRecipientsRecipientIdRequest {
1185 request::GetContactdbRecipientsRecipientIdRequest {
1186 client: &self,
1187 on_behalf_of: None,
1188 recipient_id: recipient_id.to_owned(),
1189 }
1190 }
1191 /**Delete a Recipient
1192
1193**This endpoint allows you to delete a single recipient with the given ID from your contact database.**
1194
1195> Use this to permanently delete your recipients from all of your contact lists and all segments if required by applicable law.*/
1196 pub fn delete_contactdb_recipients_recipient_id(
1197 &self,
1198 recipient_id: &str,
1199 ) -> request::DeleteContactdbRecipientsRecipientIdRequest {
1200 request::DeleteContactdbRecipientsRecipientIdRequest {
1201 client: &self,
1202 on_behalf_of: None,
1203 recipient_id: recipient_id.to_owned(),
1204 }
1205 }
1206 /**Retrieve the lists that a recipient is on
1207
1208**This endpoint allows you to retrieve the lists that a given recipient belongs to.**
1209
1210Each recipient can be on many lists. This endpoint gives you all of the lists that any one recipient has been added to.*/
1211 pub fn get_contactdb_recipients_recipient_id_lists(
1212 &self,
1213 recipient_id: &str,
1214 ) -> request::GetContactdbRecipientsRecipientIdListsRequest {
1215 request::GetContactdbRecipientsRecipientIdListsRequest {
1216 client: &self,
1217 on_behalf_of: None,
1218 recipient_id: recipient_id.to_owned(),
1219 }
1220 }
1221 /**Retrieve reserved fields
1222
1223**This endpoint allows you to list all fields that are reserved and can't be used for custom field names.***/
1224 pub fn get_contactdb_reserved_fields(
1225 &self,
1226 ) -> request::GetContactdbReservedFieldsRequest {
1227 request::GetContactdbReservedFieldsRequest {
1228 client: &self,
1229 on_behalf_of: None,
1230 }
1231 }
1232 /**Retrieve all segments
1233
1234**This endpoint allows you to retrieve all of your segments.***/
1235 pub fn get_contactdb_segments(&self) -> request::GetContactdbSegmentsRequest {
1236 request::GetContactdbSegmentsRequest {
1237 client: &self,
1238 on_behalf_of: None,
1239 }
1240 }
1241 /**Create a Segment
1242
1243**This endpoint allows you to create a new segment.**
1244
1245
1246 Valid operators for create and update depend on the type of the field for which you are searching.
1247
1248**Dates**
1249- "eq", "ne", "lt" (before), "gt" (after)
1250 - You may use MM/DD/YYYY for day granularity or an epoch for second granularity.
1251- "empty", "not_empty"
1252- "is within"
1253 - You may use an [ISO 8601 date format](https://en.wikipedia.org/wiki/ISO_8601) or the # of days.
1254
1255**Text**
1256- "contains"
1257- "eq" (is/equals - matches the full field)
1258- "ne" (is not/not equals - matches any field where the entire field is not the condition value)
1259- "empty"
1260- "not_empty"
1261
1262**Numbers**
1263- "eq" (is/equals)
1264- "lt" (is less than)
1265- "gt" (is greater than)
1266- "empty"
1267- "not_empty"
1268
1269**Email Clicks and Opens**
1270- "eq" (opened)
1271- "ne" (not opened)
1272
1273All field values must be a string.
1274
1275
1276Conditions using "eq" or "ne" for email clicks and opens should provide a "field" of either `clicks.campaign_identifier` or `opens.campaign_identifier`.
1277The condition value should be a string containing the id of a completed campaign.
1278
1279
1280The conditions list may contain multiple conditions, joined by an "and" or "or" in the "and_or" field.
1281
1282The first condition in the conditions list must have an empty "and_or", and subsequent conditions must all specify an "and_or".*/
1283 pub fn post_contactdb_segments(
1284 &self,
1285 conditions: Vec<ContactdbSegmentsConditions>,
1286 name: &str,
1287 ) -> request::PostContactdbSegmentsRequest {
1288 request::PostContactdbSegmentsRequest {
1289 client: &self,
1290 on_behalf_of: None,
1291 conditions,
1292 list_id: None,
1293 name: name.to_owned(),
1294 recipient_count: None,
1295 }
1296 }
1297 /**Retrieve a segment
1298
1299**This endpoint allows you to retrieve a single segment with the given ID.***/
1300 pub fn get_contactdb_segments_segment_id(
1301 &self,
1302 segment_id: i64,
1303 ) -> request::GetContactdbSegmentsSegmentIdRequest {
1304 request::GetContactdbSegmentsSegmentIdRequest {
1305 client: &self,
1306 segment_id,
1307 on_behalf_of: None,
1308 }
1309 }
1310 /**Delete a segment
1311
1312**This endpoint allows you to delete a segment from your recipients database.**
1313
1314You also have the option to delete all the contacts from your Marketing Campaigns recipient database who were in this segment.*/
1315 pub fn delete_contactdb_segments_segment_id(
1316 &self,
1317 segment_id: &str,
1318 ) -> request::DeleteContactdbSegmentsSegmentIdRequest {
1319 request::DeleteContactdbSegmentsSegmentIdRequest {
1320 client: &self,
1321 delete_contacts: None,
1322 on_behalf_of: None,
1323 segment_id: segment_id.to_owned(),
1324 }
1325 }
1326 /**Update a segment
1327
1328**This endpoint allows you to update a segment.***/
1329 pub fn patch_contactdb_segments_segment_id(
1330 &self,
1331 name: &str,
1332 ) -> request::PatchContactdbSegmentsSegmentIdRequest {
1333 request::PatchContactdbSegmentsSegmentIdRequest {
1334 client: &self,
1335 segment_id: None,
1336 on_behalf_of: None,
1337 conditions: None,
1338 list_id: None,
1339 name: name.to_owned(),
1340 }
1341 }
1342 /**Retrieve recipients on a segment
1343
1344**This endpoint allows you to retrieve all of the recipients in a segment with the given ID.***/
1345 pub fn get_contactdb_segments_segment_id_recipients(
1346 &self,
1347 segment_id: i64,
1348 ) -> request::GetContactdbSegmentsSegmentIdRecipientsRequest {
1349 request::GetContactdbSegmentsSegmentIdRecipientsRequest {
1350 client: &self,
1351 page: None,
1352 page_size: None,
1353 on_behalf_of: None,
1354 segment_id,
1355 }
1356 }
1357 /**Get Recipient Upload Status
1358
1359**This endpoint allows you to check the upload status of a Marketing Campaigns recipient.***/
1360 pub fn get_contactdb_status(&self) -> request::GetContactdbStatusRequest {
1361 request::GetContactdbStatusRequest {
1362 client: &self,
1363 on_behalf_of: None,
1364 }
1365 }
1366 /**List Designs
1367
1368**This endpoint allows you to retrieve a list of designs already stored in your Design Library**.
1369
1370A GET request to `/designs` will return a list of your existing designs. This endpoint will not return the pre-built Twilio SendGrid designs. Pre-built designs can be retrieved using the `/designs/pre-builts` endpoint, which is detailed below.
1371
1372By default, you will receive 100 results per request; however, you can modify the number of results returned by passing an integer to the `page_size` query parameter.*/
1373 pub fn list_designs(&self) -> request::ListDesignsRequest {
1374 request::ListDesignsRequest {
1375 client: &self,
1376 page_size: None,
1377 page_token: None,
1378 summary: None,
1379 }
1380 }
1381 /**Create Design
1382
1383**This endpoint allows you to create a new design**.
1384
1385You can add a new design by passing data, including a string of HTML email content, to `/designs`. When creating designs from scratch, be aware of the styling constraints inherent to many email clients. For a list of best practices, see our guide to [Cross-Platform Email Design](https://sendgrid.com/docs/ui/sending-email/cross-platform-html-design/).
1386
1387The Design Library can also convert your design’s HTML elements into drag and drop modules that are editable in the Designs Library user interface. For more, visit the [Design and Code Editor documentation](https://sendgrid.com/docs/ui/sending-email/editor/#drag--drop-markup).
1388
1389Because the `/designs` endpoint makes it easy to add designs, you can create a design with your preferred tooling or migrate designs you already own without relying on the Design Library UI.*/
1390 pub fn post_design(
1391 &self,
1392 args: request::PostDesignRequired,
1393 ) -> request::PostDesignRequest {
1394 request::PostDesignRequest {
1395 client: &self,
1396 editor: args.editor.to_owned(),
1397 name: args.name.to_owned(),
1398 categories: args.categories.iter().map(|&x| x.to_owned()).collect(),
1399 generate_plain_content: args.generate_plain_content,
1400 subject: args.subject.to_owned(),
1401 html_content: args.html_content.to_owned(),
1402 plain_content: args.plain_content.to_owned(),
1403 }
1404 }
1405 /**List SendGrid Pre-built Designs
1406
1407**This endpoint allows you to retrieve a list of pre-built designs provided by Twilio SendGrid**.
1408
1409Unlike the `/designs` endpoint where *your* designs are stored, a GET request made to `designs/pre-builts` will retrieve a list of the pre-built Twilio SendGrid designs. This endpoint will not return the designs stored in your Design Library.
1410
1411By default, you will receive 100 results per request; however, you can modify the number of results returned by passing an integer to the `page_size` query parameter.
1412
1413This endpoint is useful for retrieving the IDs of Twilio SendGrid designs that you want to duplicate and modify.*/
1414 pub fn list_sendgrid_pre_built_designs(
1415 &self,
1416 ) -> request::ListSendgridPreBuiltDesignsRequest {
1417 request::ListSendgridPreBuiltDesignsRequest {
1418 client: &self,
1419 page_size: None,
1420 page_token: None,
1421 summary: None,
1422 }
1423 }
1424 /**Get SendGrid Pre-built Design
1425
1426**This endpoint allows you to retrieve a single pre-built design**.
1427
1428A GET request to `/designs/pre-builts/{id}` will retrieve details about a specific pre-built design.
1429
1430This endpoint is valuable when retrieving details about a pre-built design that you wish to duplicate and modify.*/
1431 pub fn get_sendgrid_pre_built_design(
1432 &self,
1433 id: &str,
1434 ) -> request::GetSendgridPreBuiltDesignRequest {
1435 request::GetSendgridPreBuiltDesignRequest {
1436 client: &self,
1437 id: id.to_owned(),
1438 }
1439 }
1440 /**Duplicate SendGrid Pre-built Design
1441
1442**This endpoint allows you to duplicate one of the pre-built Twilio SendGrid designs**.
1443
1444Like duplicating one of your existing designs, you are not required to pass any data in the body of a request to this endpoint. If you choose to leave the `name` field blank, your duplicate will be assigned the name of the design it was copied from with the text "Duplicate: " prepended to it. This name change is only a convenience, as the duplicate design will be assigned a unique ID that differentiates it from your other designs. You can retrieve the IDs for Twilio SendGrid pre-built designs using the "List SendGrid Pre-built Designs" endpoint.
1445
1446You can modify your duplicate’s name at the time of creation by passing an updated value to the `name` field when making the initial request.
1447More on retrieving design IDs can be found above.*/
1448 pub fn post_sendgrid_pre_built_design(
1449 &self,
1450 id: &str,
1451 ) -> request::PostSendgridPreBuiltDesignRequest {
1452 request::PostSendgridPreBuiltDesignRequest {
1453 client: &self,
1454 id: id.to_owned(),
1455 editor: None,
1456 name: None,
1457 }
1458 }
1459 /**Get Design
1460
1461**This endpoint allows you to retrieve a single design**.
1462
1463A GET request to `/designs/{id}` will retrieve details about a specific design in your Design Library.
1464
1465This endpoint is valuable when retrieving information stored in a field that you wish to update using a PATCH request.*/
1466 pub fn get_design(&self, id: &str) -> request::GetDesignRequest {
1467 request::GetDesignRequest {
1468 client: &self,
1469 id: id.to_owned(),
1470 }
1471 }
1472 /**Duplicate Design
1473
1474**This endpoint allows you to duplicate one of your existing designs**.
1475
1476Modifying an existing design is often the easiest way to create something new.
1477
1478You are not required to pass any data in the body of a request to this endpoint. If you choose to leave the `name` field blank, your duplicate will be assigned the name of the design it was copied from with the text "Duplicate: " prepended to it. This name change is only a convenience, as the duplicate will be assigned a unique ID that differentiates it from your other designs.
1479
1480You can modify your duplicate’s name at the time of creation by passing an updated value to the `name` field when making the initial request.
1481More on retrieving design IDs can be found below.*/
1482 pub fn post_design_dup(&self, id: &str) -> request::PostDesignDupRequest {
1483 request::PostDesignDupRequest {
1484 client: &self,
1485 id: id.to_owned(),
1486 editor: None,
1487 name: None,
1488 }
1489 }
1490 /**Delete Design
1491
1492**This endpoint allows you to delete a single design**.
1493
1494Be sure to check the ID of the design you intend to delete before making this request; deleting a design is a permanent action.*/
1495 pub fn delete_design(&self, id: &str) -> request::DeleteDesignRequest {
1496 request::DeleteDesignRequest {
1497 client: &self,
1498 id: id.to_owned(),
1499 }
1500 }
1501 /**Update Design
1502
1503**This endpoint allows you to edit a design**.
1504
1505The Design API supports PATCH requests, which allow you to make partial updates to a single design. Passing data to a specific field will update only the data stored in that field; all other fields will be unaltered.
1506
1507For example, updating a design's name requires that you make a PATCH request to this endpoint with data specified for the `name` field only.
1508
1509```
1510{
1511 "name": "<Updated Name>"
1512}
1513```*/
1514 pub fn put_design(&self, id: &str) -> request::PutDesignRequest {
1515 request::PutDesignRequest {
1516 client: &self,
1517 id: id.to_owned(),
1518 categories: None,
1519 generate_plain_content: None,
1520 html_content: None,
1521 name: None,
1522 plain_content: None,
1523 subject: None,
1524 }
1525 }
1526 /**Retrieve email statistics by device type.
1527
1528**This endpoint allows you to retrieve your email statistics segmented by the device type.**
1529
1530**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
1531
1532## Available Device Types
1533| **Device** | **Description** | **Example** |
1534|---|---|---|
1535| Desktop | Email software on desktop computer. | I.E., Outlook, Sparrow, or Apple Mail. |
1536| Webmail | A web-based email client. | I.E., Yahoo, Google, AOL, or Outlook.com. |
1537| Phone | A smart phone. | iPhone, Android, Blackberry, etc.
1538| Tablet | A tablet computer. | iPad, android based tablet, etc. |
1539| Other | An unrecognized device. |
1540
1541Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).*/
1542 pub fn get_devices_stats(
1543 &self,
1544 start_date: &str,
1545 ) -> request::GetDevicesStatsRequest {
1546 request::GetDevicesStatsRequest {
1547 client: &self,
1548 on_behalf_of: None,
1549 limit: None,
1550 offset: None,
1551 aggregated_by: None,
1552 start_date: start_date.to_owned(),
1553 end_date: None,
1554 }
1555 }
1556 /**Retrieve email statistics by country and state/province.
1557
1558**This endpoint allows you to retrieve your email statistics segmented by country and state/province.**
1559
1560**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
1561
1562Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Statistics/index.html).*/
1563 pub fn get_geo_stats(&self, start_date: &str) -> request::GetGeoStatsRequest {
1564 request::GetGeoStatsRequest {
1565 client: &self,
1566 country: None,
1567 on_behalf_of: None,
1568 limit: None,
1569 offset: None,
1570 aggregated_by: None,
1571 start_date: start_date.to_owned(),
1572 end_date: None,
1573 }
1574 }
1575 /**Retrieve all IP addresses
1576
1577**This endpoint allows you to retrieve a list of all assigned and unassigned IPs.**
1578
1579Response includes warm up status, pools, assigned subusers, and reverse DNS info. The start_date field corresponds to when warmup started for that IP.
1580
1581A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.*/
1582 pub fn get_ips(&self) -> request::GetIpsRequest {
1583 request::GetIpsRequest {
1584 client: &self,
1585 ip: None,
1586 exclude_whitelabels: None,
1587 limit: None,
1588 offset: None,
1589 subuser: None,
1590 sort_by_direction: None,
1591 }
1592 }
1593 /**Add IPs
1594
1595**This endpoint is for adding a(n) IP Address(es) to your account.***/
1596 pub fn post_ips(&self, count: i64) -> request::PostIpsRequest {
1597 request::PostIpsRequest {
1598 client: &self,
1599 count,
1600 subusers: None,
1601 warmup: None,
1602 }
1603 }
1604 /**Retrieve all assigned IPs
1605
1606**This endpoint allows you to retrieve only assigned IP addresses.**
1607
1608A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.*/
1609 pub fn get_ips_assigned(&self) -> request::GetIpsAssignedRequest {
1610 request::GetIpsAssignedRequest {
1611 client: &self,
1612 }
1613 }
1614 /**Retrieve all IP pools
1615
1616**This endpoint allows you to get all of your IP pools.***/
1617 pub fn get_ips_pools(&self) -> request::GetIpsPoolsRequest {
1618 request::GetIpsPoolsRequest {
1619 client: &self,
1620 }
1621 }
1622 /**Create an IP pool
1623
1624**This endpoint allows you to create an IP pool.**
1625
1626Before you can create an IP pool, you need to activate the IP in your SendGrid account:
1627
16281. Log into your SendGrid account.
16291. Navigate to **Settings** and then select **IP Addresses**.
16301. Find the IP address you want to activate and then click **Edit**.
16311. Check **Allow my account to send mail using this IP address**.
16321. Click **Save**.*/
1633 pub fn post_ips_pools(&self, name: &str) -> request::PostIpsPoolsRequest {
1634 request::PostIpsPoolsRequest {
1635 client: &self,
1636 name: name.to_owned(),
1637 }
1638 }
1639 /**Retrieve all the IPs in a specified pool
1640
1641**This endpoint allows you to get all of the IP addresses that are in a specific IP pool.***/
1642 pub fn get_ips_pools_pool_name(
1643 &self,
1644 pool_name: &str,
1645 ) -> request::GetIpsPoolsPoolNameRequest {
1646 request::GetIpsPoolsPoolNameRequest {
1647 client: &self,
1648 pool_name: pool_name.to_owned(),
1649 }
1650 }
1651 /**Rename an IP pool
1652
1653**This endpoint allows you to update the name of an IP pool.***/
1654 pub fn put_ips_pools_pool_name(
1655 &self,
1656 pool_name: &str,
1657 ) -> request::PutIpsPoolsPoolNameRequest {
1658 request::PutIpsPoolsPoolNameRequest {
1659 client: &self,
1660 pool_name: pool_name.to_owned(),
1661 name: None,
1662 }
1663 }
1664 /**Delete an IP pool
1665
1666**This endpoint allows you to delete an IP pool.***/
1667 pub fn delete_ips_pools_pool_name(
1668 &self,
1669 pool_name: &str,
1670 ) -> request::DeleteIpsPoolsPoolNameRequest {
1671 request::DeleteIpsPoolsPoolNameRequest {
1672 client: &self,
1673 pool_name: pool_name.to_owned(),
1674 }
1675 }
1676 /**Add an IP address to a pool
1677
1678**This endpoint allows you to add an IP address to an IP pool.**
1679
1680You can add the same IP address to multiple pools. It may take up to 60 seconds for your IP address to be added to a pool after your request is made.
1681
1682Before you can add an IP to a pool, you need to activate it in your SendGrid account:
1683
16841. Log into your SendGrid account.
16851. Navigate to **Settings** and then select **IP Addresses**.
16861. Find the IP address you want to activate and then click **Edit**.
16871. Check **Allow my account to send mail using this IP address**.
16881. Click **Save**.
1689
1690You can retrieve all of your available IP addresses from the "Retrieve all IP addresses" endpoint.*/
1691 pub fn post_ips_pools_pool_name_ips(
1692 &self,
1693 pool_name: &str,
1694 ) -> request::PostIpsPoolsPoolNameIpsRequest {
1695 request::PostIpsPoolsPoolNameIpsRequest {
1696 client: &self,
1697 pool_name: pool_name.to_owned(),
1698 ip: None,
1699 }
1700 }
1701 /**Remove an IP address from a pool
1702
1703**This endpoint allows you to remove an IP address from an IP pool.***/
1704 pub fn delete_ips_pools_pool_name_ips_ip(
1705 &self,
1706 pool_name: &str,
1707 ip: &str,
1708 ) -> request::DeleteIpsPoolsPoolNameIpsIpRequest {
1709 request::DeleteIpsPoolsPoolNameIpsIpRequest {
1710 client: &self,
1711 pool_name: pool_name.to_owned(),
1712 ip: ip.to_owned(),
1713 }
1714 }
1715 /**Get remaining IPs count
1716
1717**This endpoint gets amount of IP Addresses that can still be created during a given period and the price of those IPs.***/
1718 pub fn get_ips_remaining(&self) -> request::GetIpsRemainingRequest {
1719 request::GetIpsRemainingRequest {
1720 client: &self,
1721 }
1722 }
1723 /**Retrieve all IPs currently in warmup
1724
1725**This endpoint allows you to retrieve all of your IP addresses that are currently warming up.***/
1726 pub fn get_ips_warmup(&self) -> request::GetIpsWarmupRequest {
1727 request::GetIpsWarmupRequest {
1728 client: &self,
1729 }
1730 }
1731 /**Start warming up an IP address
1732
1733**This endpoint allows you to put an IP address into warmup mode.***/
1734 pub fn post_ips_warmup(&self) -> request::PostIpsWarmupRequest {
1735 request::PostIpsWarmupRequest {
1736 client: &self,
1737 ip: None,
1738 }
1739 }
1740 /**Retrieve the warmup status for a specific IP address
1741
1742**This endpoint allows you to retrieve the warmup status for a specific IP address.**
1743
1744You can retrieve all of your warming IPs using the "Retrieve all IPs currently in warmup" endpoint.*/
1745 pub fn get_ips_warmup_ip_address(
1746 &self,
1747 ip_address: &str,
1748 ) -> request::GetIpsWarmupIpAddressRequest {
1749 request::GetIpsWarmupIpAddressRequest {
1750 client: &self,
1751 ip_address: ip_address.to_owned(),
1752 }
1753 }
1754 /**Stop warming up an IP address
1755
1756**This endpoint allows you to remove an IP address from warmup mode.**
1757
1758Your request will return a 204 status code if the specified IP was successfully removed from warmup mode. To retrieve details of the IP’s warmup status *before* removing it from warmup mode, call the "Retrieve the warmpup status for a specific IP address" endpoint.*/
1759 pub fn delete_ips_warmup_ip_address(
1760 &self,
1761 ip_address: &str,
1762 ) -> request::DeleteIpsWarmupIpAddressRequest {
1763 request::DeleteIpsWarmupIpAddressRequest {
1764 client: &self,
1765 ip_address: ip_address.to_owned(),
1766 }
1767 }
1768 /**Retrieve all IP pools an IP address belongs to
1769
1770**This endpoint allows you to see which IP pools a particular IP address has been added to.**
1771
1772The same IP address can be added to multiple IP pools.
1773
1774A single IP address or a range of IP addresses may be dedicated to an account in order to send email for multiple domains. The reputation of this IP is based on the aggregate performance of all the senders who use it.*/
1775 pub fn get_ips_ip_address(
1776 &self,
1777 ip_address: &str,
1778 ) -> request::GetIpsIpAddressRequest {
1779 request::GetIpsIpAddressRequest {
1780 client: &self,
1781 ip_address: ip_address.to_owned(),
1782 }
1783 }
1784 /**Create a batch ID
1785
1786**This endpoint allows you to generate a new batch ID.**
1787
1788Once a `batch_id` is created, you can associate it with a scheduled send using the `/mail/send` endpoint. Passing the `batch_id` as a field in the `/mail/send` request body will assign the ID to the send you are creating.
1789
1790Once an ID is associated with a scheduled send, the send can be accessed and its send status can be modified using the `batch_id`.*/
1791 pub fn post_mail_batch(&self) -> request::PostMailBatchRequest {
1792 request::PostMailBatchRequest {
1793 client: &self,
1794 on_behalf_of: None,
1795 }
1796 }
1797 /**Validate batch ID
1798
1799**This endpoint allows you to validate a batch ID.**
1800
1801When you pass a valid `batch_id` to this endpoint, it will return a `200` status code and the batch ID itself.
1802
1803If you pass an invalid `batch_id` to the endpoint, you will receive a `400` level status code and an error message.
1804
1805A `batch_id` does not need to be assigned to a scheduled send to be considered valid. A successful response means only that the `batch_id` has been created, but it does not indicate that it has been associated with a send.*/
1806 pub fn get_mail_batch_batch_id(
1807 &self,
1808 batch_id: &str,
1809 ) -> request::GetMailBatchBatchIdRequest {
1810 request::GetMailBatchBatchIdRequest {
1811 client: &self,
1812 on_behalf_of: None,
1813 batch_id: batch_id.to_owned(),
1814 }
1815 }
1816 /**v3 Mail Send
1817
1818The Mail Send endpoint allows you to send email over SendGrid’s v3 Web API, the most recent version of our API. If you are looking for documentation about the v2 Mail Send endpoint, see our [v2 API Reference](https://sendgrid.com/docs/API_Reference/Web_API/mail.html).
1819
1820## Helper Libraries
1821
1822Twilio SendGrid provides libraries to help you quickly and easily integrate with the v3 Web API in 7 different languages:
1823
1824* [C#](https://github.com/sendgrid/sendgrid-csharp)
1825* [Go](https://github.com/sendgrid/sendgrid-go)
1826* [Java](https://github.com/sendgrid/sendgrid-java)
1827* [Node JS](https://github.com/sendgrid/sendgrid-nodejs)
1828* [PHP](https://github.com/sendgrid/sendgrid-php)
1829* [Python](https://github.com/sendgrid/sendgrid-python)
1830* [Ruby](https://github.com/sendgrid/sendgrid-ruby)
1831
1832## Dynamic Transactional Templates and Handlebars
1833
1834In order to send a dynamic template, specify the template ID with the `template_id` parameter.
1835
1836To specify handlebar substitutions, define your substitutions in the request JSON with this syntax:
1837
1838```
1839"dynamic_template_data": {
1840 "guest": "Jane Doe",
1841 "partysize": "4",
1842 "english": true,
1843 "date": "April 1st, 2021"
1844 }
1845```
1846
1847For more information about Dynamic Transactional Templates and Handlebars, see our documentation and reference pages.
1848
1849* [How to send an email with Dynamic Transactional Templates
1850](https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/)
1851* [Using Handlebars](https://sendgrid.com/docs/for-developers/sending-email/using-handlebars/)
1852
1853## Mail Body Compression
1854
1855Mail body compression is available to some high volume accounts. Talk to your CSM if you are interested in this functionality. Mail body compression works by setting up a JSON payload as defined on this page, then compressing it with gzip (the gzip file can be no more than 30mb).
1856
1857To use mail body compression:
1858
18591. Add a `Content-Encoding` header, with a value of `gzip`.
1860 a. `Content-Encoding: gzip`
18612. Send the gzip as a data-binary.
1862 a. `--data-binary '@data.json.gz'
1863`
1864
1865## Multiple Reply-To Emails
1866
1867Using `reply_to_list` allows senders to include more than one recipient email address to receive reply and/or bounce messages from the recipient of the email.
1868
1869### Usage Considerations
1870
1871* `reply_to` is mutually exclusive with `reply_to_list`. If both are used, then the API call will be rejected.
1872* The `reply_to_list` object, when used, must at least have an email parameter and may also contain a name parameter.
1873* Each email address in the `reply_to_list` should be unique.
1874* There is a limit of 1000 `reply_to_list` emails per mail/send request.
1875* In SMTP calls, we will omit any invalid emails.
1876
1877### Possible 400 Error Messages
1878
1879* `reply_to` is mutually exclusive with `reply_to_list`.
1880* The `reply_to_list` object, when used, must at least have an email parameter and may also contain a name parameter.
1881* Each email address in the `reply_to_list` should be unique.
1882* There is a limit of X `reply_to` emails per mail/send request.
1883* The `reply_to_list` email does not contain a valid address.
1884* The `reply_to_list` email exceeds the maximum total length of X characters.
1885* The `reply_to_list` email parameter is required.*/
1886 pub fn post_mail_send(
1887 &self,
1888 args: request::PostMailSendRequired,
1889 ) -> request::PostMailSendRequest {
1890 request::PostMailSendRequest {
1891 client: &self,
1892 asm: None,
1893 attachments: None,
1894 batch_id: None,
1895 categories: None,
1896 content: args.content,
1897 custom_args: None,
1898 from: args.from,
1899 headers: None,
1900 ip_pool_name: None,
1901 mail_settings: None,
1902 personalizations: args.personalizations,
1903 reply_to: None,
1904 reply_to_list: None,
1905 send_at: None,
1906 subject: args.subject.to_owned(),
1907 template_id: None,
1908 tracking_settings: None,
1909 }
1910 }
1911 /**Retrieve all mail settings
1912
1913**This endpoint allows you to retrieve a list of all mail settings.**
1914
1915Each setting will be returned with an `enabled` status set to `true` or `false` and a short description that explains what the setting does.*/
1916 pub fn get_mail_settings(&self) -> request::GetMailSettingsRequest {
1917 request::GetMailSettingsRequest {
1918 client: &self,
1919 limit: None,
1920 offset: None,
1921 on_behalf_of: None,
1922 }
1923 }
1924 /**Retrieve address whitelist mail settings
1925
1926**This endpoint allows you to retrieve your current email address whitelist settings.**
1927
1928The Address Whitelist setting allows you to specify email addresses or domains for which mail should never be suppressed.
1929
1930For example, if you own the domain `example.com`, and one or more of your recipients use `email@example.com` addresses, placing `example.com` in the address whitelist setting instructs Twilio SendGrid to ignore all bounces, blocks, and unsubscribes logged for that domain. In other words, all bounces, blocks, and unsubscribes will still be sent to `example.com` as if they were sent under normal sending conditions.*/
1931 pub fn get_mail_settings_address_whitelist(
1932 &self,
1933 ) -> request::GetMailSettingsAddressWhitelistRequest {
1934 request::GetMailSettingsAddressWhitelistRequest {
1935 client: &self,
1936 on_behalf_of: None,
1937 }
1938 }
1939 /**Update address whitelist mail settings
1940
1941**This endpoint allows you to update your current email address whitelist settings.**
1942
1943You can select whether or not this setting should be enabled by assigning the `enabled` field a `true` or `false` value.
1944
1945Passing only the `enabled` field to this endpoint will not alter your current `list` of whitelist entries. However, any modifications to your `list` of entries will overwrite the entire list. For this reason, you must included all existing entries you wish to retain in your `list` in addition to any new entries you intend to add. To remove one or more `list` entries, pass a `list` with only the entries you wish to retain.
1946
1947You should not add generic domains such as `gmail.com` or `yahoo.com` in your `list` because your emails will not honor recipients' unsubscribes. This may cause a legal violation of [CAN-SPAM](https://sendgrid.com/docs/glossary/can-spam/) and could damage your sending reputation.
1948
1949The Address Whitelist setting allows you to specify email addresses or domains for which mail should never be suppressed.
1950
1951For example, if you own the domain `example.com`, and one or more of your recipients use `email@example.com` addresses, placing `example.com` in the address whitelist setting instructs Twilio SendGrid to ignore all bounces, blocks, and unsubscribes logged for that domain. In other words, all bounces, blocks, and unsubscribes will still be sent to `example.com` as if they were sent under normal sending conditions.*/
1952 pub fn patch_mail_settings_address_whitelist(
1953 &self,
1954 ) -> request::PatchMailSettingsAddressWhitelistRequest {
1955 request::PatchMailSettingsAddressWhitelistRequest {
1956 client: &self,
1957 on_behalf_of: None,
1958 enabled: None,
1959 list: None,
1960 }
1961 }
1962 /**Retrieve bounce purge mail settings
1963
1964**This endpoint allows you to retrieve your current bounce and purge settings.**
1965
1966The Bounce Perge setting allows you to set a schedule that Twilio SendGrid will use to automatically delete contacts from your soft and hard bounce suppression lists.
1967
1968A hard bounce occurs when an email message has been returned to the sender because the recipient's address is invalid. A hard bounce might occur because the domain name doesn't exist or because the recipient is unknown.
1969
1970A soft bounce occurs when an email message reaches the recipient's mail server but is bounced back undelivered before it actually reaches the recipient. A soft bounce might occur because the recipient's inbox is full.
1971
1972You can also manage this setting in the [Mail Settings section of the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings). You can manage your bounces manually using the [Bounces API](https://sendgrid.api-docs.io/v3.0/bounces-api) or the [Bounces menu in the Twilio SendGrid App](https://app.sendgrid.com/suppressions/bounces).*/
1973 pub fn get_mail_settings_bounce_purge(
1974 &self,
1975 ) -> request::GetMailSettingsBouncePurgeRequest {
1976 request::GetMailSettingsBouncePurgeRequest {
1977 client: &self,
1978 on_behalf_of: None,
1979 }
1980 }
1981 /**Update bounce purge mail settings
1982
1983**This endpoint allows you to update your current bounce and purge settings.**
1984
1985The Bounce Perge setting allows you to set a schedule that Twilio SendGrid will use to automatically delete contacts from your soft and hard bounce suppression lists. The schedule is set in full days by assigning the number of days, an integer, to the `soft_bounces` and/or `hard_bounces` fields.
1986
1987A hard bounce occurs when an email message has been returned to the sender because the recipient's address is invalid. A hard bounce might occur because the domain name doesn't exist or because the recipient is unknown.
1988
1989A soft bounce occurs when an email message reaches the recipient's mail server but is bounced back undelivered before it actually reaches the recipient. A soft bounce might occur because the recipient's inbox is full.
1990
1991You can also manage this setting in the [Mail Settings section of the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings). You can manage your bounces manually using the [Bounces API](https://sendgrid.api-docs.io/v3.0/bounces-api) or the [Bounces menu in the Twilio SendGrid App](https://app.sendgrid.com/suppressions/bounces).*/
1992 pub fn patch_mail_settings_bounce_purge(
1993 &self,
1994 ) -> request::PatchMailSettingsBouncePurgeRequest {
1995 request::PatchMailSettingsBouncePurgeRequest {
1996 client: &self,
1997 on_behalf_of: None,
1998 enabled: None,
1999 hard_bounces: None,
2000 soft_bounces: None,
2001 }
2002 }
2003 /**Retrieve footer mail settings
2004
2005**This endpoint allows you to retrieve your current Footer mail settings.**
2006
2007The Footer setting will insert a custom footer at the bottom of your text and HTML email message bodies.
2008
2009You can insert your HTML or plain text directly using the "Update footer mail settings" endpoint, or you can create the footer using the [Mail Settings menu in the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings).*/
2010 pub fn get_mail_settings_footer(&self) -> request::GetMailSettingsFooterRequest {
2011 request::GetMailSettingsFooterRequest {
2012 client: &self,
2013 on_behalf_of: None,
2014 }
2015 }
2016 /**Update footer mail settings
2017
2018**This endpoint allows you to update your current Footer mail settings.**
2019
2020The Footer setting will insert a custom footer at the bottom of your text and HTML email message bodies.
2021
2022You can insert your HTML or plain text directly using this endpoint, or you can create the footer using the [Mail Settings menu in the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings).*/
2023 pub fn patch_mail_settings_footer(&self) -> request::PatchMailSettingsFooterRequest {
2024 request::PatchMailSettingsFooterRequest {
2025 client: &self,
2026 on_behalf_of: None,
2027 enabled: None,
2028 html_content: None,
2029 plain_content: None,
2030 }
2031 }
2032 /**Retrieve forward bounce mail settings
2033
2034**This endpoint allows you to retrieve your current bounce forwarding mail settings.**
2035
2036Enabling the Forward Bounce setting allows you to specify `email` addresses to which bounce reports will be forwarded. This endpoint returns the email address you have set to receive forwarded bounces and an `enabled` status indicating if the setting is active.*/
2037 pub fn get_mail_settings_forward_bounce(
2038 &self,
2039 ) -> request::GetMailSettingsForwardBounceRequest {
2040 request::GetMailSettingsForwardBounceRequest {
2041 client: &self,
2042 on_behalf_of: None,
2043 }
2044 }
2045 /**Update forward bounce mail settings
2046
2047**This endpoint allows you to update your current bounce forwarding mail settings.**
2048
2049Enabling the Forward Bounce setting allows you to specify an `email` address to which bounce reports will be forwarded.
2050
2051You can also configure the Forward Spam mail settings in the [Mail Settings section of the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings).*/
2052 pub fn patch_mail_settings_forward_bounce(
2053 &self,
2054 ) -> request::PatchMailSettingsForwardBounceRequest {
2055 request::PatchMailSettingsForwardBounceRequest {
2056 client: &self,
2057 on_behalf_of: None,
2058 email: None,
2059 enabled: None,
2060 }
2061 }
2062 /**Retrieve forward spam mail settings
2063
2064**This endpoint allows you to retrieve your current Forward Spam mail settings.**
2065
2066Enabling the Forward Spam setting allows you to specify `email` addresses to which spam reports will be forwarded. This endpoint returns any email address(es) you have set to receive forwarded spam and an `enabled` status indicating if the setting is active.*/
2067 pub fn get_mail_settings_forward_spam(
2068 &self,
2069 ) -> request::GetMailSettingsForwardSpamRequest {
2070 request::GetMailSettingsForwardSpamRequest {
2071 client: &self,
2072 on_behalf_of: None,
2073 }
2074 }
2075 /**Update forward spam mail settings
2076
2077**This endpoint allows you to update your current Forward Spam mail settings.**
2078
2079Enabling the Forward Spam setting allows you to specify `email` addresses to which spam reports will be forwarded. You can set multiple addresses by passing this endpoint a comma separated list of emails in a single string.
2080
2081```
2082{
2083 "email": "address1@example.com, address2@exapmle.com",
2084 "enabled": true
2085}
2086```
2087
2088The Forward Spam setting may also be used to receive emails sent to `abuse@` and `postmaster@` role addresses if you have authenticated your domain.
2089
2090For example, if you authenticated `example.com` as your root domain and set a custom return path of `sub` for that domain, you could turn on Forward Spam, and any emails sent to `abuse@sub.example.com` or `postmaster@sub.example.com` would be forwarded to the email address you entered in the `email` field.
2091
2092You can authenticate your domain using the "Authenticate a domain" endpoint or in the [Sender Authentication section of the Twilio SendGrid App](https://app.sendgrid.com/settings/sender_auth). You can also configure the Forward Spam mail settings in the [Mail Settings section of the Twilio SendGrid App](https://app.sendgrid.com/settings/mail_settings).*/
2093 pub fn patch_mail_settings_forward_spam(
2094 &self,
2095 ) -> request::PatchMailSettingsForwardSpamRequest {
2096 request::PatchMailSettingsForwardSpamRequest {
2097 client: &self,
2098 on_behalf_of: None,
2099 email: None,
2100 enabled: None,
2101 }
2102 }
2103 /**Retrieve legacy template mail settings
2104
2105**This endpoint allows you to retrieve your current legacy email template settings.**
2106
2107This setting refers to our original email templates. We currently support more fully featured [Dynamic Transactional Templates](https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/).
2108
2109The legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages. For instructions on using legacy templates, see how to ["Create and Edit Legacy Transactional Templates](https://sendgrid.com/docs/ui/sending-email/create-and-edit-legacy-transactional-templates/). For help migrating to our current template system, see ["Migrating from Legacy Templates"](https://sendgrid.com/docs/ui/sending-email/migrating-from-legacy-templates/).*/
2110 pub fn get_mail_settings_template(&self) -> request::GetMailSettingsTemplateRequest {
2111 request::GetMailSettingsTemplateRequest {
2112 client: &self,
2113 on_behalf_of: None,
2114 }
2115 }
2116 /**Update template mail settings
2117
2118**This endpoint allows you to update your current legacy email template settings.**
2119
2120This setting refers to our original email templates. We currently support more fully featured [Dynamic Transactional Templates](https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/).
2121
2122The legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages. For instructions on using legacy templates, see how to ["Create and Edit Legacy Transactional Templates](https://sendgrid.com/docs/ui/sending-email/create-and-edit-legacy-transactional-templates/). For help migrating to our current template system, see ["Migrating from Legacy Templates"](https://sendgrid.com/docs/ui/sending-email/migrating-from-legacy-templates/).*/
2123 pub fn patch_mail_settings_template(
2124 &self,
2125 ) -> request::PatchMailSettingsTemplateRequest {
2126 request::PatchMailSettingsTemplateRequest {
2127 client: &self,
2128 on_behalf_of: None,
2129 enabled: None,
2130 html_content: None,
2131 }
2132 }
2133 /**Retrieve email statistics by mailbox provider.
2134
2135**This endpoint allows you to retrieve your email statistics segmented by recipient mailbox provider.**
2136
2137**We only store up to 7 days of email activity in our database.** By default, 500 items will be returned per request via the Advanced Stats API endpoints.
2138
2139Advanced Stats provide a more in-depth view of your email statistics and the actions taken by your recipients. You can segment these statistics by geographic location, device type, client type, browser, and mailbox provider. For more information about statistics, please see our [Statistics Overview](https://sendgrid.com/docs/ui/analytics-and-reporting/stats-overview/).*/
2140 pub fn get_mailbox_providers_stats(
2141 &self,
2142 start_date: &str,
2143 ) -> request::GetMailboxProvidersStatsRequest {
2144 request::GetMailboxProvidersStatsRequest {
2145 client: &self,
2146 mailbox_providers: None,
2147 on_behalf_of: None,
2148 limit: None,
2149 offset: None,
2150 aggregated_by: None,
2151 start_date: start_date.to_owned(),
2152 end_date: None,
2153 }
2154 }
2155 /**Get Sample Contacts
2156
2157**This endpoint will return up to 50 of the most recent contacts uploaded or attached to a list**.
2158
2159This list will then be sorted by email address.
2160
2161The full contact count is also returned.
2162
2163Please note that pagination of the contacts has been deprecated.
2164
2165Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.*/
2166 pub fn get_mc_contats(&self) -> request::GetMcContatsRequest {
2167 request::GetMcContatsRequest {
2168 client: &self,
2169 }
2170 }
2171 /**Add or Update a Contact
2172
2173**This endpoint allows the [upsert](https://en.wiktionary.org/wiki/upsert) (insert or update) of up to 30,000 contacts, or 6MB of data, whichever is lower**.
2174
2175Because the creation and update of contacts is an asynchronous process, the response will not contain immediate feedback on the processing of your upserted contacts. Rather, it will contain an HTTP 202 response indicating the contacts are queued for processing or an HTTP 4XX error containing validation errors. Should you wish to get the resulting contact's ID or confirm your contacts have been updated or added, you can use the "Get Contacts by Emails" endpoint.
2176
2177Please note that custom fields need to have been already created if you wish to set their values for the contacts being upserted. To do this, please use the "Create Custom Field Definition" endpoint.
2178
2179You will see a `job_id` in the response to your request. This can be used to check the status of your upsert job. To do so, please use the "Import Contacts Status" endpoint.
2180
2181If the contact already exists in the system, any entries submitted via this endpoint will update the existing contact. The contact to update will be determined only by the `email` field and any fields omitted from the request will remain as they were. A contact's ID cannot be used to update the contact.
2182
2183The email field will be changed to all lower-case. If a contact is added with an email that exists but contains capital letters, the existing contact with the all lower-case email will be updated.*/
2184 pub fn put_mc_contacts(
2185 &self,
2186 contacts: Vec<ContactRequest>,
2187 ) -> request::PutMcContactsRequest {
2188 request::PutMcContactsRequest {
2189 client: &self,
2190 contacts,
2191 list_ids: None,
2192 }
2193 }
2194 /**Delete Contacts
2195
2196**This endpoint can be used to delete one or more contacts**.
2197
2198The query parameter `ids` must set to a comma-separated list of contact IDs for bulk contact deletion.
2199
2200The query parameter `delete_all_contacts` must be set to `"true"` to delete **all** contacts.
2201
2202You must set either `ids` or `delete_all_contacts`.
2203
2204Deletion jobs are processed asynchronously.
2205
2206Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.*/
2207 pub fn delete_mc_contacts(&self) -> request::DeleteMcContactsRequest {
2208 request::DeleteMcContactsRequest {
2209 client: &self,
2210 delete_all_contacts: None,
2211 ids: None,
2212 }
2213 }
2214 /**Get Batched Contacts by IDs
2215
2216**This endpoint is used to retrieve a set of contacts identified by their IDs.**
2217
2218This can be more efficient endpoint to get contacts than making a series of individual `GET` requests to the "Get a Contact by ID" endpoint.
2219
2220You can supply up to 100 IDs. Pass them into the `ids` field in your request body as an array or one or more strings.
2221
2222Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.*/
2223 pub fn post_marketing_contacts_batch(
2224 &self,
2225 ids: &[&str],
2226 ) -> request::PostMarketingContactsBatchRequest {
2227 request::PostMarketingContactsBatchRequest {
2228 client: &self,
2229 ids: ids.iter().map(|&x| x.to_owned()).collect(),
2230 }
2231 }
2232 /**Get Total Contact Count
2233
2234**This endpoint returns the total number of contacts you have stored.**
2235
2236
2237Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.*/
2238 pub fn get_mc_contacts_count(&self) -> request::GetMcContactsCountRequest {
2239 request::GetMcContactsCountRequest {
2240 client: &self,
2241 }
2242 }
2243 /**Get All Existing Exports
2244
2245**Use this endpoint to retrieve details of all current exported jobs**.
2246
2247It will return an array of objects, each of which records an export job in flight or recently completed.
2248
2249Each object's `export_type` field will tell you which kind of export it is and its `status` field will indicate what stage of processing it has reached. Exports which are `ready` will be accompanied by a `urls` field which lists the URLs of the export's downloadable files — there will be more than one if you specified a maximum file size in your initial export request.
2250
2251Use this endpoint if you have exports in flight but do not know their IDs, which are required for the "Export Contacts Status" endpoint.*/
2252 pub fn get_marketing_contacts_exports(
2253 &self,
2254 ) -> request::GetMarketingContactsExportsRequest {
2255 request::GetMarketingContactsExportsRequest {
2256 client: &self,
2257 }
2258 }
2259 /**Export Contacts
2260
2261**Use this endpoint to export lists or segments of contacts**.
2262
2263If you would just like to have a link to the exported list sent to your email set the `notifications.email` option to `true` in the `POST` payload.
2264
2265If you would like to download the list, take the `id` that is returned and use the "Export Contacts Status" endpoint to get the `urls`. Once you have the list of URLs, make a `GET` request to each URL provided to download your CSV file(s).
2266
2267You specify the segements and or/contact lists you wish to export by providing the relevant IDs in, respectively, the `segment_ids` and `list_ids` fields in the request body.
2268
2269The lists will be provided in either JSON or CSV files. To specify which of these you would required, set the request body `file_type` field to `json` or `csv`.
2270
2271You can also specify a maximum file size (in MB). If the export file is larger than this, it will be split into multiple files.*/
2272 pub fn post_mc_contacts_exports(&self) -> request::PostMcContactsExportsRequest {
2273 request::PostMcContactsExportsRequest {
2274 client: &self,
2275 file_type: None,
2276 list_ids: None,
2277 max_file_size: None,
2278 notifications: None,
2279 segment_ids: None,
2280 }
2281 }
2282 /**Export Contacts Status
2283
2284**This endpoint can be used to check the status of a contact export job**.
2285
2286To use this call, you will need the `id` from the "Export Contacts" call.
2287
2288If you would like to download a list, take the `id` that is returned from the "Export Contacts" endpoint and make an API request here to get the `urls`. Once you have the list of URLs, make a `GET` request on each URL to download your CSV file(s).
2289
2290Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.*/
2291 pub fn get_mc_contacts_exports_id(
2292 &self,
2293 id: &str,
2294 ) -> request::GetMcContactsExportsIdRequest {
2295 request::GetMcContactsExportsIdRequest {
2296 client: &self,
2297 id: id.to_owned(),
2298 }
2299 }
2300 /**Import Contacts
2301
2302**This endpoint allows a CSV upload containing up to one million contacts or 5GB of data, whichever is smaller.**
2303
2304Imports take place asynchronously: the endpoint returns a URL (`upload_uri`) and HTTP headers (`upload_headers`) which can subsequently be used to `PUT` a file of contacts to be imported into our system.
2305
2306Uploaded CSV files may also be [gzip-compressed](https://en.wikipedia.org/wiki/Gzip).
2307
2308In either case, you must include the field `file_type` with the value `csv` in your request body.
2309
2310The `field_mappings` paramter is a respective list of field definition IDs to map the uploaded CSV columns to. It allows you to use CSVs where one or more columns are skipped (`null`) or remapped to the contact field.
2311
2312For example, if `field_mappings` is set to `[null, "w1", "_rf1"]`, this means skip column 0, map column 1 to the custom field with the ID `w1`, and map column 2 to the reserved field with the ID `_rf1`. See the "Get All Field Definitions" endpoint to fetch your custom and reserved field IDs to use with `field_mappings`.
2313
2314Once you recieve the response body you can then initiate a **second** API call where you use the supplied URL and HTTP header to upload your file. For example:
2315
2316`curl --upload-file "file/path.csv" "URL_GIVEN" -H 'HEADER_GIVEN'`
2317
2318If you'd like to monitor the status of your import job, use the `job_id` and the "Import Contacts Status" endpoint.
2319
2320Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.*/
2321 pub fn put_mc_contacts_imports(
2322 &self,
2323 field_mappings: Vec<serde_json::Value>,
2324 file_type: &str,
2325 ) -> request::PutMcContactsImportsRequest {
2326 request::PutMcContactsImportsRequest {
2327 client: &self,
2328 field_mappings,
2329 file_type: file_type.to_owned(),
2330 list_ids: None,
2331 }
2332 }
2333 /**Import Contacts Status
2334
2335**This endpoint can be used to check the status of a contact import job**.
2336
2337Use the `job_id` from the "Import Contacts," "Add or Update a Contact," or "Delete Contacts" endpoints as the `id` in the path parameter.
2338
2339If there is an error with your `PUT` request, download the `errors_url` file and open it to view more details.
2340
2341The job `status` field indicates whether the job is `pending`, `completed`, `errored`, or `failed`.
2342
2343Pending means not started. Completed means finished without any errors. Errored means finished with some errors. Failed means finshed with all errors, or the job was entirely unprocessable: for example, if you attempt to import file format we do not support.
2344
2345The `results` object will have fields depending on the job type.
2346
2347Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.*/
2348 pub fn get_marketing_contacts_imports_id(
2349 &self,
2350 id: &str,
2351 ) -> request::GetMarketingContactsImportsIdRequest {
2352 request::GetMarketingContactsImportsIdRequest {
2353 client: &self,
2354 id: id.to_owned(),
2355 }
2356 }
2357 /**Search Contacts
2358
2359**Use this endpoint to locate contacts**.
2360
2361The request body's `query` field accepts valid [SGQL](https://sendgrid.com/docs/for-developers/sending-email/segmentation-query-language/) for searching for a contact.
2362
2363Because contact emails are stored in lower case, using SGQL to search by email address requires the provided email address to be in lower case. The SGQL `lower()` function can be used for this.
2364
2365Only the first 50 contacts that meet the search criteria will be returned.
2366
2367If the query takes longer than 20 seconds, a `408 Request Timeout` status will be returned.
2368
2369Formatting the `created_at` and `updated_at` values as Unix timestamps is deprecated. Instead they are returned as ISO format as string.*/
2370 pub fn post_mc_contacts_search(
2371 &self,
2372 query: &str,
2373 ) -> request::PostMcContactsSearchRequest {
2374 request::PostMcContactsSearchRequest {
2375 client: &self,
2376 query: query.to_owned(),
2377 }
2378 }
2379 /**Get Contacts by Emails
2380
2381**This endpoint allows you to retrieve up to 100 contacts matching the searched `email` address(es), including any `alternate_emails`.**
2382
2383Email addresses are unique to a contact, meaning this endpoint can treat an email address as a primary key to search by. The contact object associated with the address, whether it is their `email` or one of their `alternate_emails` will be returned if matched.
2384
2385Email addresses in the search request do not need to match the case in which they're stored, but the email addresses in the result will be all lower case. Empty strings are excluded from the search and will not be returned.
2386
2387This endpoint should be used in place of the "Search Contacts" endpoint when you can provide exact email addresses and do not need to include other [Segmentation Query Language (SGQL)](https://sendgrid.com/docs/for-developers/sending-email/segmentation-query-language/) filters when searching.
2388
2389If you need to access a large percentage of your contacts, we recommend exporting your contacts with the "Export Contacts" endpoint and filtering the results client side.
2390
2391This endpoint returns a `200` status code when any contacts match the address(es) you supplied. When searching multiple addresses in a single request, it is possible that some addresses will match a contact while others will not. When a partially successful search like this is made, the matching contacts are returned in an object and an error message is returned for the email address(es) that are not found.
2392
2393This endpoint returns a `404` status code when no contacts are found for the provided email address(es).
2394
2395A `400` status code is returned if any searched addresses are invalid.
2396
2397Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.*/
2398 pub fn post_marketing_contacts_search_emails(
2399 &self,
2400 emails: &[&str],
2401 ) -> request::PostMarketingContactsSearchEmailsRequest {
2402 request::PostMarketingContactsSearchEmailsRequest {
2403 client: &self,
2404 emails: emails.iter().map(|&x| x.to_owned()).collect(),
2405 }
2406 }
2407 /**Get a Contact by ID
2408
2409**This endpoint returns the full details and all fields for the specified contact**.
2410
2411The "Get Contacts by Emails" endpoint can be used to get the ID of a contact.*/
2412 pub fn get_mc_contacts_id(&self, id: &str) -> request::GetMcContactsIdRequest {
2413 request::GetMcContactsIdRequest {
2414 client: &self,
2415 id: id.to_owned(),
2416 }
2417 }
2418 /**Get All Field Definitions
2419
2420**This endpoint retrieves all defined Custom Fields and Reserved Fields.***/
2421 pub fn get_mc_field_definitions(&self) -> request::GetMcFieldDefinitionsRequest {
2422 request::GetMcFieldDefinitionsRequest {
2423 client: &self,
2424 }
2425 }
2426 /**Create Custom Field Definition
2427
2428**This endpoint creates a new custom field definition.**
2429
2430Custom field definitions are created with the given `name` and `field_type`. Although field names are stored in a case-sensitive manner, all field names must be case-insensitively unique. This means you may create a field named `CamelCase` or `camelcase`, but not both. Additionally, a Custom Field name cannot collide with any Reserved Field names. You should save the returned `id` value in order to update or delete the field at a later date. You can have up to 120 custom fields.
2431
2432The custom field name should be created using only alphanumeric characters (A-Z and 0-9) and underscores (\_). Custom fields can only begin with letters A-Z or underscores (_). The field type can be date, text, or number fields. The field type is important for creating segments from your contact database.
2433
2434**Note: Creating a custom field that begins with a number will cause issues with sending in Marketing Campaigns.***/
2435 pub fn post_mc_field_definitions(
2436 &self,
2437 field_type: &str,
2438 name: &str,
2439 ) -> request::PostMcFieldDefinitionsRequest {
2440 request::PostMcFieldDefinitionsRequest {
2441 client: &self,
2442 field_type: field_type.to_owned(),
2443 name: name.to_owned(),
2444 }
2445 }
2446 /**Delete Custom Field Definition
2447
2448**This endpoint deletes a defined Custom Field.**
2449
2450You cand delete only Custom Fields; Reserved Fields cannot be deleted.*/
2451 pub fn delete_mc_field_definitions_custom_field_id(
2452 &self,
2453 custom_field_id: &str,
2454 ) -> request::DeleteMcFieldDefinitionsCustomFieldIdRequest {
2455 request::DeleteMcFieldDefinitionsCustomFieldIdRequest {
2456 client: &self,
2457 custom_field_id: custom_field_id.to_owned(),
2458 }
2459 }
2460 /**Update Custom Field Definition
2461
2462**This endopoint allows you to update a defined Custom Field.**
2463
2464Only your Custom fields can be modified; Reserved Fields cannot be updated.*/
2465 pub fn patch_mc_field_definitions_custom_field_id(
2466 &self,
2467 custom_field_id: &str,
2468 name: &str,
2469 ) -> request::PatchMcFieldDefinitionsCustomFieldIdRequest {
2470 request::PatchMcFieldDefinitionsCustomFieldIdRequest {
2471 client: &self,
2472 custom_field_id: custom_field_id.to_owned(),
2473 name: name.to_owned(),
2474 }
2475 }
2476 /**Get All Lists
2477
2478**This endpoint returns an array of all of your contact lists.***/
2479 pub fn get_mc_lists(&self) -> request::GetMcListsRequest {
2480 request::GetMcListsRequest {
2481 client: &self,
2482 page_size: None,
2483 page_token: None,
2484 }
2485 }
2486 /**Create List
2487
2488**This endpoint creates a new contacts list.**
2489
2490Once you create a list, you can use the UI to [trigger an automation](https://sendgrid.com/docs/ui/sending-email/getting-started-with-automation/#create-an-automation) every time you add a new contact to the list.
2491
2492A link to the newly created object is in `_metadata`.*/
2493 pub fn post_mc_lists(&self, name: &str) -> request::PostMcListsRequest {
2494 request::PostMcListsRequest {
2495 client: &self,
2496 name: name.to_owned(),
2497 }
2498 }
2499 /**Get a List by ID
2500
2501**This endpoint returns data about a specific list.**
2502
2503Setting the optional parameter `contact_sample=true` returns the `contact_sample` in the response body. Up to fifty of the most recent contacts uploaded or attached to a list will be returned, sorted alphabetically, by email address.
2504
2505The full contact count is also returned.*/
2506 pub fn get_mc_lists_id(&self, id: &str) -> request::GetMcListsIdRequest {
2507 request::GetMcListsIdRequest {
2508 client: &self,
2509 contact_sample: None,
2510 id: id.to_owned(),
2511 }
2512 }
2513 /**Delete a list
2514
2515**This endpoint allows you to deletes a specific list.**
2516
2517Optionally, you can also delete contacts associated to the list. The query parameter, `delete_contacts=true`, will delete the list and start an asynchronous job to delete associated contacts.*/
2518 pub fn delete_lists_id(&self, id: &str) -> request::DeleteListsIdRequest {
2519 request::DeleteListsIdRequest {
2520 client: &self,
2521 delete_contacts: None,
2522 id: id.to_owned(),
2523 }
2524 }
2525 /**Update List
2526
2527**This endpoint updates the name of a list.***/
2528 pub fn patch_mc_lists_id(&self, id: &str) -> request::PatchMcListsIdRequest {
2529 request::PatchMcListsIdRequest {
2530 client: &self,
2531 id: id.to_owned(),
2532 name: None,
2533 }
2534 }
2535 /**Remove Contacts from a List
2536
2537**This endpoint allows you to remove contacts from a given list.**
2538
2539The contacts will not be deleted. Only their list membership will be changed.*/
2540 pub fn delete_mc_lists_id_contacts(
2541 &self,
2542 contact_ids: &str,
2543 id: &str,
2544 ) -> request::DeleteMcListsIdContactsRequest {
2545 request::DeleteMcListsIdContactsRequest {
2546 client: &self,
2547 contact_ids: contact_ids.to_owned(),
2548 id: id.to_owned(),
2549 }
2550 }
2551 /**Get List Contact Count
2552
2553**This endpoint returns the number of contacts on a specific list.***/
2554 pub fn get_mc_lists_id_contacts_count(
2555 &self,
2556 id: &str,
2557 ) -> request::GetMcListsIdContactsCountRequest {
2558 request::GetMcListsIdContactsCountRequest {
2559 client: &self,
2560 id: id.to_owned(),
2561 }
2562 }
2563 /**Get List of Segments
2564
2565**This endpoint allows you to retrieve a list of segments.**
2566
2567The query param `parent_list_ids` is treated as a filter. Any match will be returned. Zero matches will return a response code of 200 with an empty `results` array.
2568
2569`parent_list_ids` | `no_parent_list_id` | `ids` | `result`
2570-----------------:|:--------------------:|:-------------:|:-------------:
2571empty | false | empty | all segments values
2572list_ids | false | empty | segments filtered by list_ids values
2573list_ids |true | empty | segments filtered by list_ids and segments with no parent list_ids empty
2574empty | true | empty | segments with no parent list_ids
2575anything | anything | ids | segments with matching segment ids |*/
2576 pub fn get_marketing_segments(&self) -> request::GetMarketingSegmentsRequest {
2577 request::GetMarketingSegmentsRequest {
2578 client: &self,
2579 ids: None,
2580 parent_list_ids: None,
2581 no_parent_list_id: None,
2582 }
2583 }
2584 /**Create Segment
2585
2586**This endpoint allows you to create a segment.***/
2587 pub fn post_marketing_segments(
2588 &self,
2589 args: request::PostMarketingSegmentsRequired,
2590 ) -> request::PostMarketingSegmentsRequest {
2591 request::PostMarketingSegmentsRequest {
2592 client: &self,
2593 name: args.name.to_owned(),
2594 parent_list_ids: args
2595 .parent_list_ids
2596 .iter()
2597 .map(|&x| x.to_owned())
2598 .collect(),
2599 query_dsl: args.query_dsl.to_owned(),
2600 parent_list_id: args.parent_list_id.to_owned(),
2601 }
2602 }
2603 /**Get List of Segments
2604
2605**This endpoint allows you to retrieve a list of segments.**
2606
2607The query param `parent_list_ids` is treated as a filter. Any match will be returned. Zero matches will return a response code of 200 with an empty `results` array.
2608
2609`parent_list_ids` | `no_parent_list_id` | `ids` | `result`
2610-----------------:|:--------------------:|:-------------:|:-------------:
2611empty | false | empty | all segments values
2612list_ids | false | empty | segments filtered by list_ids values
2613list_ids |true | empty | segments filtered by list_ids and segments with no parent list_ids empty
2614empty | true | empty | segments with no parent list_ids
2615anything | anything | ids | segments with matching segment ids |*/
2616 pub fn get_segments(&self) -> request::GetSegmentsRequest {
2617 request::GetSegmentsRequest {
2618 client: &self,
2619 ids: None,
2620 parent_list_ids: None,
2621 no_parent_list_id: None,
2622 }
2623 }
2624 /**Create Segment
2625
2626Segment `name` has to be unique. A user can not create a new segment with an existing segment name.*/
2627 pub fn post_segments(
2628 &self,
2629 name: &str,
2630 query_dsl: &str,
2631 ) -> request::PostSegmentsRequest {
2632 request::PostSegmentsRequest {
2633 client: &self,
2634 name: name.to_owned(),
2635 parent_list_ids: None,
2636 query_dsl: query_dsl.to_owned(),
2637 }
2638 }
2639 ///Get Segment by ID
2640 pub fn get_segments_segment_id(
2641 &self,
2642 segment_id: &str,
2643 ) -> request::GetSegmentsSegmentIdRequest {
2644 request::GetSegmentsSegmentIdRequest {
2645 client: &self,
2646 contacts_sample: None,
2647 segment_id: segment_id.to_owned(),
2648 }
2649 }
2650 /**Delete segment
2651
2652**This endpoint allows you to delete a segment by ID.***/
2653 pub fn delete_segments_segment_id(
2654 &self,
2655 segment_id: &str,
2656 ) -> request::DeleteSegmentsSegmentIdRequest {
2657 request::DeleteSegmentsSegmentIdRequest {
2658 client: &self,
2659 segment_id: segment_id.to_owned(),
2660 }
2661 }
2662 /**Update Segment
2663
2664Segment `name` has to be unique. A user can not create a new segment with an existing segment name.*/
2665 pub fn patch_segments_segment_id(
2666 &self,
2667 segment_id: &str,
2668 ) -> request::PatchSegmentsSegmentIdRequest {
2669 request::PatchSegmentsSegmentIdRequest {
2670 client: &self,
2671 segment_id: segment_id.to_owned(),
2672 name: None,
2673 query_dsl: None,
2674 }
2675 }
2676 /**Get Segment by ID
2677
2678**This endpoint allows you to retrieve a single segment by ID.***/
2679 pub fn get_marketing_segments_segment_id(
2680 &self,
2681 segment_id: &str,
2682 ) -> request::GetMarketingSegmentsSegmentIdRequest {
2683 request::GetMarketingSegmentsSegmentIdRequest {
2684 client: &self,
2685 query_json: None,
2686 segment_id: segment_id.to_owned(),
2687 }
2688 }
2689 /**Delete Segment
2690
2691**This endpoint allows you to delete a segment by `segment_id`.**
2692
2693Note that deleting a segment does not delete the contacts associated with the segment by default. Contacts associated with a deleted segment will remain in your list of all contacts and any other segments they belong to.*/
2694 pub fn delete_marketing_segments_segment_id(
2695 &self,
2696 segment_id: &str,
2697 ) -> request::DeleteMarketingSegmentsSegmentIdRequest {
2698 request::DeleteMarketingSegmentsSegmentIdRequest {
2699 client: &self,
2700 segment_id: segment_id.to_owned(),
2701 }
2702 }
2703 /**Update Segment
2704
2705**This endpoint allows you to update a segment.**
2706
2707Segment `name` needs to be unique. A user can not update a segment name to an existing one.*/
2708 pub fn patch_marketing_segments_segment_id(
2709 &self,
2710 segment_id: &str,
2711 name: &str,
2712 query_dsl: &str,
2713 ) -> request::PatchMarketingSegmentsSegmentIdRequest {
2714 request::PatchMarketingSegmentsSegmentIdRequest {
2715 client: &self,
2716 segment_id: segment_id.to_owned(),
2717 name: name.to_owned(),
2718 parent_list_ids: None,
2719 query_dsl: query_dsl.to_owned(),
2720 }
2721 }
2722 /**Create a Sender Identity
2723
2724**This endpoint allows you to create a new sender identity.**
2725
2726*You may create up to 100 unique sender identities.*
2727
2728Sender 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`.*/
2729 pub fn post_marketing_senders(
2730 &self,
2731 args: request::PostMarketingSendersRequired,
2732 ) -> request::PostMarketingSendersRequest {
2733 request::PostMarketingSendersRequest {
2734 client: &self,
2735 on_behalf_of: None,
2736 address: args.address.to_owned(),
2737 address2: None,
2738 city: args.city.to_owned(),
2739 country: args.country.to_owned(),
2740 from: args.from,
2741 nickname: args.nickname.to_owned(),
2742 reply_to: None,
2743 state: None,
2744 zip: None,
2745 }
2746 }
2747 /**Get All Single Sends
2748
2749**This endpoint allows you to retrieve all your Single Sends.**
2750
2751Returns all of your Single Sends with condensed details about each, including the Single Sends' IDs. For more details about an individual Single Send, pass the Single Send's ID to the `/marketing/singlesends/{id}` endpoint.*/
2752 pub fn get_marketing_singlesends(&self) -> request::GetMarketingSinglesendsRequest {
2753 request::GetMarketingSinglesendsRequest {
2754 client: &self,
2755 page_size: None,
2756 page_token: None,
2757 }
2758 }
2759 /**Create Single Send
2760
2761**This endpoint allows you to create a new Single Send.**
2762
2763Please note that if you are migrating from the previous version of Single Sends, you no longer need to pass a template ID with your request to this endpoint. Instead, you will pass all template data in the `email_config` object.*/
2764 pub fn post_marketing_singlesends(
2765 &self,
2766 name: &str,
2767 ) -> request::PostMarketingSinglesendsRequest {
2768 request::PostMarketingSinglesendsRequest {
2769 client: &self,
2770 categories: None,
2771 email_config: None,
2772 name: name.to_owned(),
2773 send_at: None,
2774 send_to: None,
2775 }
2776 }
2777 /**Bulk Delete Single Sends
2778
2779**This endpoint allows you to delete multiple Single Sends using an array of Single Sends IDs.**
2780
2781To first retrieve all your Single Sends' IDs, you can make a GET request to the `/marketing/singlensends` endpoint.
2782
2783Please note that a DELETE request is permanent, and your Single Sends will not be recoverable after deletion.*/
2784 pub fn delete_marketing_singlesends(
2785 &self,
2786 ) -> request::DeleteMarketingSinglesendsRequest {
2787 request::DeleteMarketingSinglesendsRequest {
2788 client: &self,
2789 ids: None,
2790 }
2791 }
2792 /**Get All Categories
2793
2794**This endpoint allows you to retrieve all the categories associated with your Single Sends.**
2795
2796This endpoint will return your latest 1,000 categories.*/
2797 pub fn get_marketing_singlesends_categories(
2798 &self,
2799 ) -> request::GetMarketingSinglesendsCategoriesRequest {
2800 request::GetMarketingSinglesendsCategoriesRequest {
2801 client: &self,
2802 }
2803 }
2804 /**Get Single Sends Search
2805
2806**This endpoint allows you to search for Single Sends based on specified criteria.**
2807
2808You can search for Single Sends by passing a combination of values using the `name`, `status`, and `categories` request body fields.
2809
2810For example, if you want to search for all Single Sends that are "drafts" or "scheduled" and also associated with the category "shoes," your request body may look like the example below.
2811
2812```javascript
2813{
2814 "status": [
2815 "draft",
2816 "scheduled"
2817 ],
2818 "categories": [
2819 "shoes"
2820 ],
2821}
2822```*/
2823 pub fn post_marketing_singlesends_search(
2824 &self,
2825 ) -> request::PostMarketingSinglesendsSearchRequest {
2826 request::PostMarketingSinglesendsSearchRequest {
2827 client: &self,
2828 page_size: None,
2829 page_token: None,
2830 categories: None,
2831 name: None,
2832 status: None,
2833 }
2834 }
2835 /**Get Single Send by ID
2836
2837**This endpoint allows you to retrieve details about one Single Send using a Single Send ID.**
2838
2839You can retrieve all of your Single Sends by making a GET request to the `/marketing/singlesends` endpoint.*/
2840 pub fn get_marketing_singlesends_id(
2841 &self,
2842 id: &str,
2843 ) -> request::GetMarketingSinglesendsIdRequest {
2844 request::GetMarketingSinglesendsIdRequest {
2845 client: &self,
2846 id: id.to_owned(),
2847 }
2848 }
2849 /**Duplicate Single Send
2850
2851**This endpoint allows you to duplicate an existing Single Send using its Single Send ID.**
2852
2853Duplicating a Single Send is useful when you want to create a Single Send but don't want to start from scratch. Once duplicated, you can update or edit the Single Send by making a PATCH request to the `/marketing/singlesends/{id}` endpoint.
2854
2855If you leave the `name` field blank, your duplicate will be assigned the name of the Single Send it was copied from with the text “Copy of ” prepended to it. The `name` field length is limited to 100 characters, so the end of the new Single Send name, including “Copy of ”, will be trimmed if the name exceeds this limit.*/
2856 pub fn post_marketing_singlesends_id(
2857 &self,
2858 id: &str,
2859 ) -> request::PostMarketingSinglesendsIdRequest {
2860 request::PostMarketingSinglesendsIdRequest {
2861 client: &self,
2862 id: id.to_owned(),
2863 name: None,
2864 }
2865 }
2866 /**Delete Single Send by ID
2867
2868**This endpoint allows you to delete one Single Send using a Single Send ID.**
2869
2870To first retrieve all your Single Sends' IDs, you can make a GET request to the `/marketing/singlensends` endpoint.
2871
2872Please note that a `DELETE` request is permanent, and your Single Send will not be recoverable after deletion.*/
2873 pub fn delete_marketing_singlesends_id(
2874 &self,
2875 id: &str,
2876 ) -> request::DeleteMarketingSinglesendsIdRequest {
2877 request::DeleteMarketingSinglesendsIdRequest {
2878 client: &self,
2879 id: id.to_owned(),
2880 }
2881 }
2882 /**Update Single Send
2883
2884**This endpoint allows you to update a Single Send using a Single Send ID.**
2885
2886You only need to pass the fields you want to update. Any blank/missing fields will remain unaltered.*/
2887 pub fn patch_marketing_singlesends_id(
2888 &self,
2889 id: &str,
2890 name: &str,
2891 ) -> request::PatchMarketingSinglesendsIdRequest {
2892 request::PatchMarketingSinglesendsIdRequest {
2893 client: &self,
2894 id: id.to_owned(),
2895 categories: None,
2896 email_config: None,
2897 name: name.to_owned(),
2898 send_at: None,
2899 send_to: None,
2900 }
2901 }
2902 /**Schedule Single Send
2903
2904**This endpoint allows you to schedule a Single Send for future delivery using a Single Send ID.**
2905
2906To schedule a Single Send, you must pass a date string in ISO 8601 time format (yyyy-MM-ddTHH:mm:ssZ) using the required `send_at` field. For example, the ISO 8601 format for 9:00 AM UTC on May 6, 2020 would be `2020-05-06T09:00:00Z`. You may also pass the string `"now"` to send the Single Send immediately.*/
2907 pub fn put_marketing_singlesends_id_schedule(
2908 &self,
2909 id: &str,
2910 send_at: &str,
2911 ) -> request::PutMarketingSinglesendsIdScheduleRequest {
2912 request::PutMarketingSinglesendsIdScheduleRequest {
2913 client: &self,
2914 id: id.to_owned(),
2915 send_at: send_at.to_owned(),
2916 }
2917 }
2918 /**Delete Single Send Schedule
2919
2920**This endpoint allows you to cancel a scheduled Single Send using a Single Send ID.**
2921
2922Making a DELETE request to this endpoint will cancel the scheduled sending of a Single Send. The request will not delete the Single Send itself. Deleting a Single Send can be done by passing a DELETE request to `/marketing/singlesends/{id}`.*/
2923 pub fn delete_marketing_singlesends_id_schedule(
2924 &self,
2925 id: &str,
2926 ) -> request::DeleteMarketingSinglesendsIdScheduleRequest {
2927 request::DeleteMarketingSinglesendsIdScheduleRequest {
2928 client: &self,
2929 id: id.to_owned(),
2930 }
2931 }
2932 /**Get All Automation Stats
2933
2934**This endpoint allows you to retrieve stats for all your Automations.**
2935
2936By default, all of your Automations will be returned, but you can specify a selection by passing in a comma-separated list of Automation IDs as the value of the query string parameter `automation_ids`.
2937
2938Responses are paginated. You can limit the number of responses returned per batch using the `page_size` query string parameter. The default is 50, but you specify a value between 1 and 100.
2939
2940You can retrieve a specific page of responses with the `page_token` query string parameter.*/
2941 pub fn getall_automation_stats(&self) -> request::GetallAutomationStatsRequest {
2942 request::GetallAutomationStatsRequest {
2943 client: &self,
2944 automation_ids: None,
2945 page_size: None,
2946 page_token: None,
2947 }
2948 }
2949 /**Export Automation Stats
2950
2951**This endpoint allows you to export Automation stats as CSV data**.
2952
2953You can specify one Automation or many: include as many Automation IDs as you need, separating them with commas, as the value of the `ids` query string paramter.
2954
2955The data is returned as plain text response but in CSV format, so your application making the call can present the information in whatever way is most appropriate, or just save the data as a `.csv` file.*/
2956 pub fn get_automations_stats_export(
2957 &self,
2958 ) -> request::GetAutomationsStatsExportRequest {
2959 request::GetAutomationsStatsExportRequest {
2960 client: &self,
2961 ids: None,
2962 timezone: None,
2963 }
2964 }
2965 /**Get Automation Stats by ID
2966
2967**This endpoint allows you to retrieve stats for a single Automation using its ID.**
2968
2969Multiple Automation IDs can be retrieved using the "Get All Automation Stats" endpoint. Once you have an ID, this endpoint will return detailed stats for the single automation specified.
2970
2971You may constrain the stats returned using the `start_date` and `end_date` query string parameters. You can also use the `group_by` and `aggregated_by` query string parameters to further refine the stats returned.*/
2972 pub fn get_automation_stat(&self, id: &str) -> request::GetAutomationStatRequest {
2973 request::GetAutomationStatRequest {
2974 client: &self,
2975 group_by: None,
2976 step_ids: None,
2977 aggregated_by: None,
2978 start_date: None,
2979 end_date: None,
2980 timezone: None,
2981 page_size: None,
2982 page_token: None,
2983 id: id.to_owned(),
2984 }
2985 }
2986 /**Get Automation Click Tracking Stats by ID
2987
2988**This endpoint lets you retrieve click-tracking stats for a single Automation**.
2989
2990The stats returned list the URLs embedded in your Automation and the number of clicks each one received.
2991
2992Responses are paginated. You can limit the number of responses returned per batch using the `page_size` query string parameter. The default is 50, but you specify a value between 1 and 100.
2993
2994You can retrieve a specific page of responses with the `page_token` query string parameter.*/
2995 pub fn get_automation_link_stat(
2996 &self,
2997 id: &str,
2998 ) -> request::GetAutomationLinkStatRequest {
2999 request::GetAutomationLinkStatRequest {
3000 client: &self,
3001 group_by: None,
3002 step_ids: None,
3003 page_size: None,
3004 page_token: None,
3005 id: id.to_owned(),
3006 }
3007 }
3008 /**Get All Single Sends Stats
3009
3010**This endpoint allows you to retrieve stats for all your Single Sends.**
3011
3012By default, all of your Single Sends will be returned, but you can specify a selection by passing in a comma-separated list of Single Send IDs as the value of the query string parameter `singlesend_ids`.
3013
3014Responses are paginated. You can limit the number of responses returned per batch using the `page_size` query string parameter. The default is 50, but you specify a value between 1 and 100.
3015
3016You can retrieve a specific page of responses with the `page_token` query string parameter.*/
3017 pub fn getall_singlesend_stats(&self) -> request::GetallSinglesendStatsRequest {
3018 request::GetallSinglesendStatsRequest {
3019 client: &self,
3020 singlesend_ids: None,
3021 page_size: None,
3022 page_token: None,
3023 }
3024 }
3025 /**Export Single Send Stats
3026
3027**This endpoint allows you to export Single Send stats as .CSV data**.
3028
3029You can specify one Single Send or many: include as many Single Send IDs as you need, separating them with commas, as the value of the `ids` query string paramter.
3030
3031The data is returned as plain text response but in .CSV format, so your application making the call can present the information in whatever way is most appropriate, or just save the data as a .csv file.*/
3032 pub fn get_singlesend_stats_export(
3033 &self,
3034 ) -> request::GetSinglesendStatsExportRequest {
3035 request::GetSinglesendStatsExportRequest {
3036 client: &self,
3037 ids: None,
3038 timezone: None,
3039 }
3040 }
3041 /**Get Single Send Stats by ID
3042
3043**This endpoint allows you to retrieve stats for an individual Single Send using a Single Send ID.**
3044
3045Multiple Single Send IDs can be retrieved using the "Get All Single Sends Stats" endpoint. Once you have an ID, this endpoint will return detailed stats for the Single Send specified.
3046
3047You may constrain the stats returned using the `start_date` and `end_date` query string parameters. You can also use the `group_by` and `aggregated_by` query string parameters to further refine the stats returned.*/
3048 pub fn get_singlesend_stat(&self, id: &str) -> request::GetSinglesendStatRequest {
3049 request::GetSinglesendStatRequest {
3050 client: &self,
3051 aggregated_by: None,
3052 start_date: None,
3053 end_date: None,
3054 timezone: None,
3055 page_size: None,
3056 page_token: None,
3057 group_by: None,
3058 id: id.to_owned(),
3059 }
3060 }
3061 /**Get Single Send Click Tracking Stats by ID
3062
3063**This endpoint lets you retrieve click-tracking stats for one Single Send**.
3064
3065The stats returned list the URLs embedded in the specified Single Send and the number of clicks each one received.
3066
3067Responses are paginated. You can limit the number of responses returned per batch using the `page_size` query string parameter. The default is 50, but you specify a value between 1 and 100.
3068
3069You can retrieve a specific page of responses with the `page_token` query string parameter.*/
3070 pub fn get_singlesend_link_stat(
3071 &self,
3072 id: &str,
3073 ) -> request::GetSinglesendLinkStatRequest {
3074 request::GetSinglesendLinkStatRequest {
3075 client: &self,
3076 page_size: None,
3077 page_token: None,
3078 group_by: None,
3079 ab_variation_id: None,
3080 ab_phase_id: None,
3081 id: id.to_owned(),
3082 }
3083 }
3084 /**Send a Test Marketing Email
3085
3086**This endpoint allows you to send a test marketing email to a list of email addresses**.
3087
3088Before sending a marketing message, you can test it using this endpoint. You may specify up to **10 contacts** in the `emails` request body field. You must also specify a `template_id` and include either a `from_address` or `sender_id`. You can manage your templates with the [Twilio SendGrid App](https://mc.sendgrid.com/dynamic-templates) or the [Transactional Templates API](https://sendgrid.api-docs.io/v3.0/transactional-templates).
3089
3090> Please note that this endpoint works with Dynamic Transactional Templates only. Legacy Transactional Templates will not be delivered.
3091
3092For more information about managing Dynamic Transactional Templates, see [How to Send Email with Dynamic Transactional Templates](https://sendgrid.com/docs/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates/).
3093
3094You can also test your Single Sends in the [Twilio SendGrid Marketing Campaigns UI](https://mc.sendgrid.com/single-sends).*/
3095 pub fn post_marketing_test_send_email(
3096 &self,
3097 emails: &[&str],
3098 template_id: &str,
3099 ) -> request::PostMarketingTestSendEmailRequest {
3100 request::PostMarketingTestSendEmailRequest {
3101 client: &self,
3102 custom_unsubscribe_url: None,
3103 emails: emails.iter().map(|&x| x.to_owned()).collect(),
3104 from_address: None,
3105 sender_id: None,
3106 suppression_group_id: None,
3107 template_id: template_id.to_owned(),
3108 version_id_override: None,
3109 }
3110 }
3111 /**Filter all messages
3112
3113Filter all messages to search your Email Activity. All queries must be [URL encoded](https://meyerweb.com/eric/tools/dencoder/), and use the following format:
3114
3115`query={query_type}="{query_content}"`
3116
3117 Once URL encoded, the previous query will look like this:
3118
3119`query=type%3D%22query_content%22`
3120
3121For example, to filter by a specific email, use the following query:
3122
3123`query=to_email%3D%22example%40example.com%22`
3124
3125Visit our [Query Reference section](https://docs.sendgrid.com/for-developers/sending-email/getting-started-email-activity-api#query-reference) to see a full list of basic query types and examples.*/
3126 pub fn get_messages(
3127 &self,
3128 query: &str,
3129 authorization: &str,
3130 ) -> request::GetMessagesRequest {
3131 request::GetMessagesRequest {
3132 client: &self,
3133 query: query.to_owned(),
3134 limit: None,
3135 authorization: authorization.to_owned(),
3136 }
3137 }
3138 /**Request CSV
3139
3140This request will kick off a backend process to generate a CSV file. Once generated, the worker will then send an email for the user download the file. The link will expire in 3 days.
3141
3142The CSV fill contain the last 1 million messages. This endpoint will be rate limited to 1 request every 12 hours (rate limit may change).
3143
3144This endpoint is similar to the GET Single Message endpoint - the only difference is that /download is added to indicate that this is a CSV download requests but the same query is used to determine what the CSV should contain.*/
3145 pub fn post_v3_messages_download(
3146 &self,
3147 authorization: &str,
3148 ) -> request::PostV3MessagesDownloadRequest {
3149 request::PostV3MessagesDownloadRequest {
3150 client: &self,
3151 query: None,
3152 authorization: authorization.to_owned(),
3153 }
3154 }
3155 /**Download CSV
3156
3157**This endpoint will return a presigned URL that can be used to download the CSV that was requested from the "Request a CSV" endpoint.***/
3158 pub fn get_v3_messages_download_download_uuid(
3159 &self,
3160 authorization: &str,
3161 download_uuid: &str,
3162 ) -> request::GetV3MessagesDownloadDownloadUuidRequest {
3163 request::GetV3MessagesDownloadDownloadUuidRequest {
3164 client: &self,
3165 authorization: authorization.to_owned(),
3166 download_uuid: download_uuid.to_owned(),
3167 }
3168 }
3169 /**Filter messages by message ID
3170
3171Get all of the details about the specified message.*/
3172 pub fn get_v3_messages_msg_id(
3173 &self,
3174 authorization: &str,
3175 msg_id: &str,
3176 ) -> request::GetV3MessagesMsgIdRequest {
3177 request::GetV3MessagesMsgIdRequest {
3178 client: &self,
3179 authorization: authorization.to_owned(),
3180 msg_id: msg_id.to_owned(),
3181 }
3182 }
3183 /**Returns a list of all partner settings.
3184
3185**This endpoint allows you to retrieve a list of all partner settings that you can enable.**
3186
3187Our 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/).*/
3188 pub fn get_partner_settings(&self) -> request::GetPartnerSettingsRequest {
3189 request::GetPartnerSettingsRequest {
3190 client: &self,
3191 limit: None,
3192 offset: None,
3193 on_behalf_of: None,
3194 }
3195 }
3196 /**Returns all New Relic partner settings.
3197
3198**This endpoint allows you to retrieve your current New Relic partner settings.**
3199
3200Our 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/).
3201
3202By 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/).*/
3203 pub fn get_partner_settings_new_relic(
3204 &self,
3205 ) -> request::GetPartnerSettingsNewRelicRequest {
3206 request::GetPartnerSettingsNewRelicRequest {
3207 client: &self,
3208 on_behalf_of: None,
3209 }
3210 }
3211 /**Updates New Relic partner settings.
3212
3213**This endpoint allows you to update or change your New Relic partner settings.**
3214
3215Our 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/).
3216
3217By 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/).*/
3218 pub fn patch_partner_settings_new_relic(
3219 &self,
3220 ) -> request::PatchPartnerSettingsNewRelicRequest {
3221 request::PatchPartnerSettingsNewRelicRequest {
3222 client: &self,
3223 on_behalf_of: None,
3224 enable_subuser_statistics: None,
3225 enabled: None,
3226 license_key: None,
3227 }
3228 }
3229 /**Retrieve a list of scopes for which this user has access.
3230
3231**This endpoint returns a list of all scopes that this user has access to.**
3232
3233API Keys are used to authenticate with [SendGrid's v3 API](https://sendgrid.api-docs.io/v3.0/how-to-use-the-sendgrid-v3-api/api-authorization).
3234
3235API Keys may be assigned certain permissions, or scopes, that limit which API endpoints they are able to access.
3236
3237This endpoint returns all the scopes assigned to the key you use to authenticate with it. To retrieve the scopes assigned to another key, you can pass an API key ID to the "Retrieve an existing API key" endpoint.
3238
3239For a more detailed explanation of how you can use API Key permissions, please visit our [API Keys documentation](https://sendgrid.com/docs/ui/account-and-settings/api-keys/).*/
3240 pub fn get_scopes(&self) -> request::GetScopesRequest {
3241 request::GetScopesRequest {
3242 client: &self,
3243 on_behalf_of: None,
3244 }
3245 }
3246 /**Retrieve access requests
3247
3248**This endpoint allows you to retrieve a list of all recent access requests.**
3249
3250The Response Header's `link` parameter will include pagination info.*/
3251 pub fn get_v3_scopes_requests(&self) -> request::GetV3ScopesRequestsRequest {
3252 request::GetV3ScopesRequestsRequest {
3253 client: &self,
3254 limit: None,
3255 offset: None,
3256 }
3257 }
3258 /**Deny access request
3259
3260**This endpoint allows you to deny an attempt to access your account.**
3261
3262**Note:** Only teammate admins may delete a teammate's access request.*/
3263 pub fn delete_v3_scopes_requests_request_id(
3264 &self,
3265 request_id: &str,
3266 ) -> request::DeleteV3ScopesRequestsRequestIdRequest {
3267 request::DeleteV3ScopesRequestsRequestIdRequest {
3268 client: &self,
3269 request_id: request_id.to_owned(),
3270 }
3271 }
3272 /**Approve access request
3273
3274**This endpoint allows you to approve an access attempt.**
3275
3276**Note:** Only teammate admins may approve another teammate’s access request.*/
3277 pub fn patch_v3_scopes_requests_approve_id(
3278 &self,
3279 request_id: &str,
3280 ) -> request::PatchV3ScopesRequestsApproveIdRequest {
3281 request::PatchV3ScopesRequestsApproveIdRequest {
3282 client: &self,
3283 request_id: request_id.to_owned(),
3284 }
3285 }
3286 /**Get all Sender Identities
3287
3288**This endpoint allows you to retrieve a list of all sender identities that have been created for your account.***/
3289 pub fn get_v3_senders(&self) -> request::GetV3SendersRequest {
3290 request::GetV3SendersRequest {
3291 client: &self,
3292 on_behalf_of: None,
3293 }
3294 }
3295 /**Create a Sender Identity
3296
3297**This endpoint allows you to create a new sender identity.**
3298
3299You may create up to 100 unique sender identities.*/
3300 pub fn post_senders(
3301 &self,
3302 args: request::PostSendersRequired,
3303 ) -> request::PostSendersRequest {
3304 request::PostSendersRequest {
3305 client: &self,
3306 on_behalf_of: None,
3307 address: args.address.to_owned(),
3308 address2: args.address2.to_owned(),
3309 city: args.city.to_owned(),
3310 country: args.country.to_owned(),
3311 from: args.from,
3312 nickname: args.nickname.to_owned(),
3313 reply_to: args.reply_to,
3314 state: args.state.to_owned(),
3315 zip: args.zip.to_owned(),
3316 }
3317 }
3318 /**View a Sender Identity
3319
3320**This endpoint allows you to retrieve a specific sender identity.***/
3321 pub fn get_v3_senders_sender_id(
3322 &self,
3323 sender_id: i64,
3324 ) -> request::GetV3SendersSenderIdRequest {
3325 request::GetV3SendersSenderIdRequest {
3326 client: &self,
3327 on_behalf_of: None,
3328 sender_id,
3329 }
3330 }
3331 /**Delete a Sender Identity
3332
3333**This endoint allows you to delete one of your sender identities.***/
3334 pub fn delete_v3_senders_sender_id(
3335 &self,
3336 sender_id: i64,
3337 ) -> request::DeleteV3SendersSenderIdRequest {
3338 request::DeleteV3SendersSenderIdRequest {
3339 client: &self,
3340 on_behalf_of: None,
3341 sender_id,
3342 }
3343 }
3344 /**Update a Sender Identity
3345
3346**This endpoint allows you to update a sender identity.**
3347
3348Updates to `from.email` require re-verification.
3349
3350Partial updates are allowed, but fields that are marked as "required" in the POST (create) endpoint must not be nil if that field is included in the PATCH request.*/
3351 pub fn patch_v3_senders_sender_id(
3352 &self,
3353 sender_id: i64,
3354 ) -> request::PatchV3SendersSenderIdRequest {
3355 request::PatchV3SendersSenderIdRequest {
3356 client: &self,
3357 on_behalf_of: None,
3358 sender_id,
3359 address: None,
3360 address2: None,
3361 city: None,
3362 country: None,
3363 from: None,
3364 nickname: None,
3365 reply_to: None,
3366 state: None,
3367 zip: None,
3368 }
3369 }
3370 /**Resend Sender Identity Verification
3371
3372**This enpdoint allows you to resend a sender identity verification email.***/
3373 pub fn post_v3_senders_sender_id_resend_verification(
3374 &self,
3375 sender_id: i64,
3376 ) -> request::PostV3SendersSenderIdResendVerificationRequest {
3377 request::PostV3SendersSenderIdResendVerificationRequest {
3378 client: &self,
3379 on_behalf_of: None,
3380 sender_id,
3381 }
3382 }
3383 /**Create an SSO Certificate
3384
3385**This endpoint allows you to create an SSO certificate.***/
3386 pub fn post_sso_certificates(
3387 &self,
3388 integration_id: &str,
3389 public_certificate: &str,
3390 ) -> request::PostSsoCertificatesRequest {
3391 request::PostSsoCertificatesRequest {
3392 client: &self,
3393 enabled: None,
3394 integration_id: integration_id.to_owned(),
3395 public_certificate: public_certificate.to_owned(),
3396 }
3397 }
3398 /**Get an SSO Certificate
3399
3400**This endpoint allows you to retrieve an individual SSO certificate.***/
3401 pub fn get_sso_certificates_cert_id(
3402 &self,
3403 cert_id: &str,
3404 ) -> request::GetSsoCertificatesCertIdRequest {
3405 request::GetSsoCertificatesCertIdRequest {
3406 client: &self,
3407 cert_id: cert_id.to_owned(),
3408 }
3409 }
3410 /**Delete an SSO Certificate
3411
3412**This endpoint allows you to delete an SSO certificate.**
3413
3414You can retrieve a certificate's ID from the response provided by the "Get All SSO Integrations" endpoint.*/
3415 pub fn delete_sso_certificates_cert_id(
3416 &self,
3417 cert_id: &str,
3418 ) -> request::DeleteSsoCertificatesCertIdRequest {
3419 request::DeleteSsoCertificatesCertIdRequest {
3420 client: &self,
3421 cert_id: cert_id.to_owned(),
3422 }
3423 }
3424 /**Update SSO Certificate
3425
3426**This endpoint allows you to update an existing certificate by ID.**
3427
3428You can retrieve a certificate's ID from the response provided by the "Get All SSO Integrations" endpoint.*/
3429 pub fn patch_sso_certificates_cert_id(
3430 &self,
3431 cert_id: &str,
3432 ) -> request::PatchSsoCertificatesCertIdRequest {
3433 request::PatchSsoCertificatesCertIdRequest {
3434 client: &self,
3435 cert_id: cert_id.to_owned(),
3436 enabled: None,
3437 integration_id: None,
3438 public_certificate: None,
3439 }
3440 }
3441 /**Get All SSO Integrations
3442
3443**This endpoint allows you to retrieve all SSO integrations tied to your Twilio SendGrid account.**
3444
3445The IDs returned by this endpoint can be used by the APIs additional endpoints to modify your SSO integrations.*/
3446 pub fn get_sso_integrations(&self) -> request::GetSsoIntegrationsRequest {
3447 request::GetSsoIntegrationsRequest {
3448 client: &self,
3449 si: None,
3450 }
3451 }
3452 /**Create an SSO Integration
3453
3454**This endpoint allows you to create an SSO integration.***/
3455 pub fn post_sso_integrations(
3456 &self,
3457 args: request::PostSsoIntegrationsRequired,
3458 ) -> request::PostSsoIntegrationsRequest {
3459 request::PostSsoIntegrationsRequest {
3460 client: &self,
3461 completed_integration: None,
3462 enabled: args.enabled,
3463 entity_id: args.entity_id.to_owned(),
3464 name: args.name.to_owned(),
3465 signin_url: args.signin_url.to_owned(),
3466 signout_url: args.signout_url.to_owned(),
3467 }
3468 }
3469 /**Get an SSO Integration
3470
3471**This endpoint allows you to retrieve an SSO integration by ID.**
3472
3473You can retrieve the IDs for your configurations from the response provided by the "Get All SSO Integrations" endpoint.*/
3474 pub fn get_sso_integrations_id(
3475 &self,
3476 id: &str,
3477 ) -> request::GetSsoIntegrationsIdRequest {
3478 request::GetSsoIntegrationsIdRequest {
3479 client: &self,
3480 si: None,
3481 id: id.to_owned(),
3482 }
3483 }
3484 /**Delete an SSO Integration
3485
3486**This endpoint allows you to delete an IdP configuration by ID.**
3487
3488You can retrieve the IDs for your configurations from the response provided by the "Get All SSO Integrations" endpoint.*/
3489 pub fn delete_sso_integrations_id(
3490 &self,
3491 id: &str,
3492 ) -> request::DeleteSsoIntegrationsIdRequest {
3493 request::DeleteSsoIntegrationsIdRequest {
3494 client: &self,
3495 id: id.to_owned(),
3496 }
3497 }
3498 /**Update an SSO Integration
3499
3500**This endpoint allows you to modify an exisiting SSO integration.**
3501
3502You can retrieve the IDs for your configurations from the response provided by the "Get All SSO Integrations" endpoint.*/
3503 pub fn patch_sso_integrations_id(
3504 &self,
3505 args: request::PatchSsoIntegrationsIdRequired,
3506 ) -> request::PatchSsoIntegrationsIdRequest {
3507 request::PatchSsoIntegrationsIdRequest {
3508 client: &self,
3509 si: None,
3510 id: args.id.to_owned(),
3511 completed_integration: None,
3512 enabled: args.enabled,
3513 entity_id: args.entity_id.to_owned(),
3514 name: args.name.to_owned(),
3515 signin_url: args.signin_url.to_owned(),
3516 signout_url: args.signout_url.to_owned(),
3517 }
3518 }
3519 /**Get All SSO Certificates by Integration
3520
3521**This endpoint allows you to retrieve all your IdP configurations by configuration ID.**
3522
3523The `integration_id` expected by this endpoint is the `id` returned in the response by the "Get All SSO Integrations" endpoint.*/
3524 pub fn get_sso_integrations_integration_id_certificates(
3525 &self,
3526 integration_id: &str,
3527 ) -> request::GetSsoIntegrationsIntegrationIdCertificatesRequest {
3528 request::GetSsoIntegrationsIntegrationIdCertificatesRequest {
3529 client: &self,
3530 integration_id: integration_id.to_owned(),
3531 }
3532 }
3533 /**Create SSO Teammate
3534
3535**This endpoint allows you to create an SSO Teammate.**
3536
3537The email provided for this user will also function as the Teammate’s username.*/
3538 pub fn post_sso_teammates(
3539 &self,
3540 args: request::PostSsoTeammatesRequired,
3541 ) -> request::PostSsoTeammatesRequest {
3542 request::PostSsoTeammatesRequest {
3543 client: &self,
3544 email: args.email.to_owned(),
3545 first_name: args.first_name.to_owned(),
3546 is_admin: args.is_admin,
3547 is_read_only: args.is_read_only,
3548 last_name: args.last_name.to_owned(),
3549 scopes: args.scopes.iter().map(|&x| x.to_owned()).collect(),
3550 }
3551 }
3552 /**Edit an SSO Teammate
3553
3554**This endpoint allows you to modify an existing SSO Teammate.**
3555
3556To turn a teammate into an admin, the request body should contain the `is_admin` field set to `true`. Otherwise, set `is_admin` to false and pass in all the scopes that a teammate should have.
3557
3558Only the parent user and Teammates with admin permissions can update another Teammate’s permissions. Admin users can only update permissions.*/
3559 pub fn patch_sso_teammates_username(
3560 &self,
3561 username: &str,
3562 ) -> request::PatchSsoTeammatesUsernameRequest {
3563 request::PatchSsoTeammatesUsernameRequest {
3564 client: &self,
3565 username: username.to_owned(),
3566 first_name: None,
3567 is_admin: None,
3568 last_name: None,
3569 scopes: None,
3570 }
3571 }
3572 /**Retrieve global email statistics
3573
3574**This endpoint allows you to retrieve all of your global email statistics between a given date range.**
3575
3576Parent accounts can see either aggregated stats for the parent account or aggregated stats for a subuser specified in the `on-behalf-of` header. Subuser accounts will see only their own stats.*/
3577 pub fn get_stats(&self, start_date: &str) -> request::GetStatsRequest {
3578 request::GetStatsRequest {
3579 client: &self,
3580 on_behalf_of: None,
3581 limit: None,
3582 offset: None,
3583 aggregated_by: None,
3584 start_date: start_date.to_owned(),
3585 end_date: None,
3586 }
3587 }
3588 /**List all Subusers
3589
3590**This endpoint allows you to retrieve a list of all of your subusers.**
3591
3592You can choose to retrieve specific subusers as well as limit the results that come back from the API.*/
3593 pub fn get_subusers(&self) -> request::GetSubusersRequest {
3594 request::GetSubusersRequest {
3595 client: &self,
3596 username: None,
3597 limit: None,
3598 offset: None,
3599 }
3600 }
3601 /**Create Subuser
3602
3603**This endpoint allows you to create a new subuser.***/
3604 pub fn post_subusers(
3605 &self,
3606 args: request::PostSubusersRequired,
3607 ) -> request::PostSubusersRequest {
3608 request::PostSubusersRequest {
3609 client: &self,
3610 email: args.email.to_owned(),
3611 ips: args.ips.iter().map(|&x| x.to_owned()).collect(),
3612 password: args.password.to_owned(),
3613 username: args.username.to_owned(),
3614 }
3615 }
3616 /**Retrieve Subuser Reputations
3617
3618**This endpoint allows you to request the reputations for your subusers.**
3619
3620Subuser sender reputations give a good idea how well a sender is doing with regards to how recipients and recipient servers react to the mail that is being received. When a bounce, spam report, or other negative action happens on a sent email, it will affect your sender rating.*/
3621 pub fn get_subusers_reputations(&self) -> request::GetSubusersReputationsRequest {
3622 request::GetSubusersReputationsRequest {
3623 client: &self,
3624 usernames: None,
3625 }
3626 }
3627 /**Retrieve email statistics for your subusers.
3628
3629**This endpoint allows you to retrieve the email statistics for the given subusers.**
3630
3631You may retrieve statistics for up to 10 different subusers by including an additional _subusers_ parameter for each additional subuser.*/
3632 pub fn get_subusers_stats(
3633 &self,
3634 subusers: &str,
3635 start_date: &str,
3636 ) -> request::GetSubusersStatsRequest {
3637 request::GetSubusersStatsRequest {
3638 client: &self,
3639 limit: None,
3640 offset: None,
3641 aggregated_by: None,
3642 subusers: subusers.to_owned(),
3643 start_date: start_date.to_owned(),
3644 end_date: None,
3645 }
3646 }
3647 /**Retrieve monthly stats for all subusers
3648
3649**This endpoint allows you to retrieve the monthly email statistics for all subusers over the given date range.**
3650
3651When using the `sort_by_metric` to sort your stats by a specific metric, you can not sort by the following metrics:
3652`bounce_drops`, `deferred`, `invalid_emails`, `processed`, `spam_report_drops`, `spam_reports`, or `unsubscribe_drops`.*/
3653 pub fn get_subusers_stats_monthly(
3654 &self,
3655 date: &str,
3656 ) -> request::GetSubusersStatsMonthlyRequest {
3657 request::GetSubusersStatsMonthlyRequest {
3658 client: &self,
3659 date: date.to_owned(),
3660 subuser: None,
3661 sort_by_metric: None,
3662 sort_by_direction: None,
3663 limit: None,
3664 offset: None,
3665 }
3666 }
3667 /**Retrieve the totals for each email statistic metric for all subusers.
3668
3669**This endpoint allows you to retrieve the total sums of each email statistic metric for all subusers over the given date range.***/
3670 pub fn get_subusers_stats_sums(
3671 &self,
3672 start_date: &str,
3673 ) -> request::GetSubusersStatsSumsRequest {
3674 request::GetSubusersStatsSumsRequest {
3675 client: &self,
3676 sort_by_direction: None,
3677 start_date: start_date.to_owned(),
3678 end_date: None,
3679 limit: None,
3680 offset: None,
3681 aggregated_by: None,
3682 sort_by_metric: None,
3683 }
3684 }
3685 /**Delete a subuser
3686
3687**This endpoint allows you to delete a subuser.**
3688
3689This is a permanent action. Once deleted, a subuser cannot be retrieved.*/
3690 pub fn delete_subusers_subuser_name(
3691 &self,
3692 subuser_name: &str,
3693 ) -> request::DeleteSubusersSubuserNameRequest {
3694 request::DeleteSubusersSubuserNameRequest {
3695 client: &self,
3696 subuser_name: subuser_name.to_owned(),
3697 }
3698 }
3699 /**Enable/disable a subuser
3700
3701**This endpoint allows you to enable or disable a subuser.***/
3702 pub fn patch_subusers_subuser_name(
3703 &self,
3704 subuser_name: &str,
3705 ) -> request::PatchSubusersSubuserNameRequest {
3706 request::PatchSubusersSubuserNameRequest {
3707 client: &self,
3708 subuser_name: subuser_name.to_owned(),
3709 disabled: None,
3710 }
3711 }
3712 /**Update IPs assigned to a subuser
3713
3714**This endpoint allows you update your subusers' assigned IP.**
3715
3716Each subuser should be assigned to an IP address from which all of this subuser's mail will be sent. Often, this is the same IP as the parent account, but each subuser can have one or more of their own IP addresses as well.
3717
3718More information:
3719
3720* [How to request more IPs](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/)
3721* [Setup Reverse DNS](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/)*/
3722 pub fn put_subusers_subuser_name_ips(
3723 &self,
3724 subuser_name: &str,
3725 body: serde_json::Value,
3726 ) -> request::PutSubusersSubuserNameIpsRequest {
3727 request::PutSubusersSubuserNameIpsRequest {
3728 client: &self,
3729 subuser_name: subuser_name.to_owned(),
3730 body,
3731 }
3732 }
3733 ///Retrieve monitor settings for a subuser
3734 pub fn get_subusers_subuser_name_monitor(
3735 &self,
3736 subuser_name: &str,
3737 ) -> request::GetSubusersSubuserNameMonitorRequest {
3738 request::GetSubusersSubuserNameMonitorRequest {
3739 client: &self,
3740 subuser_name: subuser_name.to_owned(),
3741 }
3742 }
3743 ///Update Monitor Settings for a subuser
3744 pub fn put_subusers_subuser_name_monitor(
3745 &self,
3746 subuser_name: &str,
3747 email: &str,
3748 frequency: f64,
3749 ) -> request::PutSubusersSubuserNameMonitorRequest {
3750 request::PutSubusersSubuserNameMonitorRequest {
3751 client: &self,
3752 subuser_name: subuser_name.to_owned(),
3753 email: email.to_owned(),
3754 frequency,
3755 }
3756 }
3757 ///Create monitor settings
3758 pub fn post_subusers_subuser_name_monitor(
3759 &self,
3760 subuser_name: &str,
3761 email: &str,
3762 frequency: f64,
3763 ) -> request::PostSubusersSubuserNameMonitorRequest {
3764 request::PostSubusersSubuserNameMonitorRequest {
3765 client: &self,
3766 subuser_name: subuser_name.to_owned(),
3767 email: email.to_owned(),
3768 frequency,
3769 }
3770 }
3771 ///Delete monitor settings
3772 pub fn delete_subusers_subuser_name_monitor(
3773 &self,
3774 subuser_name: &str,
3775 ) -> request::DeleteSubusersSubuserNameMonitorRequest {
3776 request::DeleteSubusersSubuserNameMonitorRequest {
3777 client: &self,
3778 subuser_name: subuser_name.to_owned(),
3779 }
3780 }
3781 /**Retrieve the monthly email statistics for a single subuser
3782
3783**This endpoint allows you to retrive the monthly email statistics for a specific subuser.**
3784
3785When using the `sort_by_metric` to sort your stats by a specific metric, you can not sort by the following metrics:
3786`bounce_drops`, `deferred`, `invalid_emails`, `processed`, `spam_report_drops`, `spam_reports`, or `unsubscribe_drops`.*/
3787 pub fn get_subusers_subuser_name_stats_monthly(
3788 &self,
3789 date: &str,
3790 subuser_name: &str,
3791 ) -> request::GetSubusersSubuserNameStatsMonthlyRequest {
3792 request::GetSubusersSubuserNameStatsMonthlyRequest {
3793 client: &self,
3794 date: date.to_owned(),
3795 sort_by_metric: None,
3796 sort_by_direction: None,
3797 limit: None,
3798 offset: None,
3799 subuser_name: subuser_name.to_owned(),
3800 }
3801 }
3802 /**Retrieve all blocks
3803
3804**This endpoint allows you to retrieve all email addresses that are currently on your blocks list. A maximum of 500 blocks will be returned per query. You can use the `offset` and `limit` parameters to retrieve more or less than 500 results.***/
3805 pub fn get_suppression_blocks(&self) -> request::GetSuppressionBlocksRequest {
3806 request::GetSuppressionBlocksRequest {
3807 client: &self,
3808 start_time: None,
3809 end_time: None,
3810 limit: None,
3811 offset: None,
3812 on_behalf_of: None,
3813 }
3814 }
3815 /**Delete blocks
3816
3817**This endpoint allows you to delete all email addresses on your blocks list.**
3818
3819There are two options for deleting blocked emails:
3820
38211. You can delete all blocked emails by setting `delete_all` to `true` in the request body.
38222. You can delete a selection of blocked emails by specifying the email addresses in the `emails` array of the request body.*/
3823 pub fn delete_suppression_blocks(&self) -> request::DeleteSuppressionBlocksRequest {
3824 request::DeleteSuppressionBlocksRequest {
3825 client: &self,
3826 on_behalf_of: None,
3827 delete_all: None,
3828 emails: None,
3829 }
3830 }
3831 /**Retrieve a specific block
3832
3833**This endpoint allows you to retrieve a specific email address from your blocks list.***/
3834 pub fn get_suppression_blocks_email(
3835 &self,
3836 email: &str,
3837 ) -> request::GetSuppressionBlocksEmailRequest {
3838 request::GetSuppressionBlocksEmailRequest {
3839 client: &self,
3840 on_behalf_of: None,
3841 email: email.to_owned(),
3842 }
3843 }
3844 /**Delete a specific block
3845
3846**This endpoint allows you to delete a specific email address from your blocks list.***/
3847 pub fn delete_suppression_blocks_email(
3848 &self,
3849 email: &str,
3850 ) -> request::DeleteSuppressionBlocksEmailRequest {
3851 request::DeleteSuppressionBlocksEmailRequest {
3852 client: &self,
3853 on_behalf_of: None,
3854 email: email.to_owned(),
3855 }
3856 }
3857 /**Retrieve all bounces
3858
3859**This endpoint allows you to retrieve all of your bounces. A maximum of 500 bounces will be returned per query. You can use the `offset` and `limit` parameters to retrieve more or less than 500 results.***/
3860 pub fn get_suppression_bounces(
3861 &self,
3862 accept: &str,
3863 ) -> request::GetSuppressionBouncesRequest {
3864 request::GetSuppressionBouncesRequest {
3865 client: &self,
3866 start_time: None,
3867 end_time: None,
3868 limit: None,
3869 offset: None,
3870 accept: accept.to_owned(),
3871 on_behalf_of: None,
3872 }
3873 }
3874 /**Delete bounces
3875
3876**This endpoint allows you to delete all emails on your bounces list.**
3877
3878There are two options for deleting bounced emails:
3879
38801. You can delete all bounced emails by setting `delete_all` to `true` in the request body.
38812. You can delete a selection of bounced emails by specifying the email addresses in the `emails` array of the request body.
3882
3883**WARNING:** You can not have both `emails` and `delete_all` set.*/
3884 pub fn delete_suppression_bounces(
3885 &self,
3886 ) -> request::DeleteSuppressionBouncesRequest {
3887 request::DeleteSuppressionBouncesRequest {
3888 client: &self,
3889 on_behalf_of: None,
3890 delete_all: None,
3891 emails: None,
3892 }
3893 }
3894 /**Retrieve bounce classification totals
3895
3896This endpoint will return the total number of bounces by classification in descending order for each day. You can retrieve the bounce classification totals in CSV format by specifying `"text/csv"` in the Accept header.*/
3897 pub fn get_suppression_bounces_classifications(
3898 &self,
3899 accept: &str,
3900 ) -> request::GetSuppressionBouncesClassificationsRequest {
3901 request::GetSuppressionBouncesClassificationsRequest {
3902 client: &self,
3903 accept: accept.to_owned(),
3904 start_date: None,
3905 end_date: None,
3906 on_behalf_of: None,
3907 }
3908 }
3909 /**Retrieve bounce classification over time by domain stats
3910
3911This endpoint will return the number of bounces for the classification specified in descending order for each day. You can retrieve the bounce classification totals in CSV format by specifying `"text/csv"` in the Accept header.*/
3912 pub fn get_suppressions_bounces_classifications_classification(
3913 &self,
3914 accept: &str,
3915 classification: &str,
3916 ) -> request::GetSuppressionsBouncesClassificationsClassificationRequest {
3917 request::GetSuppressionsBouncesClassificationsClassificationRequest {
3918 client: &self,
3919 accept: accept.to_owned(),
3920 classification: classification.to_owned(),
3921 start_date: None,
3922 end_date: None,
3923 on_behalf_of: None,
3924 }
3925 }
3926 /**Retrieve a Bounce
3927
3928**This endpoint allows you to retrieve a specific bounce by email address.***/
3929 pub fn get_suppression_bounces_email(
3930 &self,
3931 email: &str,
3932 ) -> request::GetSuppressionBouncesEmailRequest {
3933 request::GetSuppressionBouncesEmailRequest {
3934 client: &self,
3935 on_behalf_of: None,
3936 email: email.to_owned(),
3937 }
3938 }
3939 /**Delete a bounce
3940
3941**This endpoint allows you to remove an email address from your bounce list.***/
3942 pub fn delete_suppression_bounces_email(
3943 &self,
3944 email_address: &str,
3945 email: &str,
3946 ) -> request::DeleteSuppressionBouncesEmailRequest {
3947 request::DeleteSuppressionBouncesEmailRequest {
3948 client: &self,
3949 email_address: email_address.to_owned(),
3950 on_behalf_of: None,
3951 email: email.to_owned(),
3952 }
3953 }
3954 /**Retrieve all invalid emails
3955
3956**This endpoint allows you to retrieve a list of all invalid email addresses.***/
3957 pub fn get_suppression_invalid_emails(
3958 &self,
3959 ) -> request::GetSuppressionInvalidEmailsRequest {
3960 request::GetSuppressionInvalidEmailsRequest {
3961 client: &self,
3962 start_time: None,
3963 end_time: None,
3964 limit: None,
3965 offset: None,
3966 on_behalf_of: None,
3967 }
3968 }
3969 /**Delete invalid emails
3970
3971**This endpoint allows you to remove email addresses from your invalid email address list.**
3972
3973There are two options for deleting invalid email addresses:
3974
39751) You can delete all invalid email addresses by setting `delete_all` to true in the request body.
39762) You can delete some invalid email addresses by specifying certain addresses in an array in the request body.*/
3977 pub fn delete_suppression_invalid_emails(
3978 &self,
3979 ) -> request::DeleteSuppressionInvalidEmailsRequest {
3980 request::DeleteSuppressionInvalidEmailsRequest {
3981 client: &self,
3982 on_behalf_of: None,
3983 delete_all: None,
3984 emails: None,
3985 }
3986 }
3987 /**Retrieve a specific invalid email
3988
3989**This endpoint allows you to retrieve a specific invalid email addresses.***/
3990 pub fn get_suppression_invalid_emails_email(
3991 &self,
3992 email: &str,
3993 ) -> request::GetSuppressionInvalidEmailsEmailRequest {
3994 request::GetSuppressionInvalidEmailsEmailRequest {
3995 client: &self,
3996 on_behalf_of: None,
3997 email: email.to_owned(),
3998 }
3999 }
4000 /**Delete a specific invalid email
4001
4002**This endpoint allows you to remove a specific email address from the invalid email address list.***/
4003 pub fn delete_suppression_invalid_emails_email(
4004 &self,
4005 email: &str,
4006 ) -> request::DeleteSuppressionInvalidEmailsEmailRequest {
4007 request::DeleteSuppressionInvalidEmailsEmailRequest {
4008 client: &self,
4009 on_behalf_of: None,
4010 email: email.to_owned(),
4011 }
4012 }
4013 /**Retrieve all spam reports
4014
4015**This endpoint allows you to retrieve all spam reports.***/
4016 pub fn get_suppression_spam_reports(
4017 &self,
4018 ) -> request::GetSuppressionSpamReportsRequest {
4019 request::GetSuppressionSpamReportsRequest {
4020 client: &self,
4021 start_time: None,
4022 end_time: None,
4023 limit: None,
4024 offset: None,
4025 on_behalf_of: None,
4026 }
4027 }
4028 /**Delete spam reports
4029
4030**This endpoint allows you to delete your spam reports.**
4031
4032Deleting a spam report will remove the suppression, meaning email will once again be sent to the previously suppressed address. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.
4033
4034There are two options for deleting spam reports:
4035
40361. You can delete all spam reports by setting the `delete_all` field to `true` in the request body.
40372. You can delete a list of select spam reports by specifying the email addresses in the `emails` array of the request body.*/
4038 pub fn delete_suppression_spam_reports(
4039 &self,
4040 ) -> request::DeleteSuppressionSpamReportsRequest {
4041 request::DeleteSuppressionSpamReportsRequest {
4042 client: &self,
4043 on_behalf_of: None,
4044 delete_all: None,
4045 emails: None,
4046 }
4047 }
4048 /**Retrieve a specific spam report
4049
4050**This endpoint allows you to retrieve a specific spam report by email address.***/
4051 pub fn get_suppression_spam_reports_email(
4052 &self,
4053 email: &str,
4054 ) -> request::GetSuppressionSpamReportsEmailRequest {
4055 request::GetSuppressionSpamReportsEmailRequest {
4056 client: &self,
4057 on_behalf_of: None,
4058 email: email.to_owned(),
4059 }
4060 }
4061 /**Delete a specific spam report
4062
4063**This endpoint allows you to delete a specific spam report by email address.**
4064
4065Deleting a spam report will remove the suppression, meaning email will once again be sent to the previously suppressed address. This should be avoided unless a recipient indicates they wish to receive email from you again. You can use our [bypass filters](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) to deliver messages to otherwise suppressed addresses when exceptions are required.*/
4066 pub fn delete_suppression_spam_reports_email(
4067 &self,
4068 email: &str,
4069 ) -> request::DeleteSuppressionSpamReportsEmailRequest {
4070 request::DeleteSuppressionSpamReportsEmailRequest {
4071 client: &self,
4072 on_behalf_of: None,
4073 email: email.to_owned(),
4074 }
4075 }
4076 /**Retrieve all global suppressions
4077
4078**This endpoint allows you to retrieve a list of all email address that are globally suppressed.***/
4079 pub fn get_suppression_unsubscribes(
4080 &self,
4081 ) -> request::GetSuppressionUnsubscribesRequest {
4082 request::GetSuppressionUnsubscribesRequest {
4083 client: &self,
4084 start_time: None,
4085 end_time: None,
4086 limit: None,
4087 offset: None,
4088 on_behalf_of: None,
4089 }
4090 }
4091 /**Retrieve all teammates
4092
4093**This endpoint allows you to retrieve a list of all current Teammates.**
4094
4095You can limit the number of results returned using the `limit` query paramater. To return results from a specific Teammate, use the `offset` paramter. The Response Headers will include pagination info.*/
4096 pub fn get_v3_teammates(&self) -> request::GetV3TeammatesRequest {
4097 request::GetV3TeammatesRequest {
4098 client: &self,
4099 limit: None,
4100 offset: None,
4101 on_behalf_of: None,
4102 }
4103 }
4104 /**Invite teammate
4105
4106**This endpoint allows you to invite a Teammate to your account via email.**
4107
4108You can set a Teammate's initial permissions using the `scopes` array in the request body. Teammate's will receive a minimum set of scopes from Twilio SendGrid that are necessary for the Teammate to function.
4109
4110**Note:** A teammate invite will expire after 7 days, but you may resend the invitation at any time to reset the expiration date.*/
4111 pub fn post_v3_teammates(
4112 &self,
4113 email: &str,
4114 is_admin: bool,
4115 scopes: &[&str],
4116 ) -> request::PostV3TeammatesRequest {
4117 request::PostV3TeammatesRequest {
4118 client: &self,
4119 on_behalf_of: None,
4120 email: email.to_owned(),
4121 is_admin,
4122 scopes: scopes.iter().map(|&x| x.to_owned()).collect(),
4123 }
4124 }
4125 /**Retrieve all pending teammates
4126
4127**This endpoint allows you to retrieve a list of all pending Teammate invitations.**
4128
4129Each teammate invitation is valid for 7 days. Users may resend the invitation to refresh the expiration date.*/
4130 pub fn get_v3_teammates_pending(&self) -> request::GetV3TeammatesPendingRequest {
4131 request::GetV3TeammatesPendingRequest {
4132 client: &self,
4133 on_behalf_of: None,
4134 }
4135 }
4136 /**Delete pending teammate
4137
4138**This endpoint allows you to delete a pending teammate invite.***/
4139 pub fn delete_v3_teammates_pending_token(
4140 &self,
4141 token: &str,
4142 ) -> request::DeleteV3TeammatesPendingTokenRequest {
4143 request::DeleteV3TeammatesPendingTokenRequest {
4144 client: &self,
4145 on_behalf_of: None,
4146 token: token.to_owned(),
4147 }
4148 }
4149 /**Resend teammate invite
4150
4151**This endpoint allows you to resend a Teammate invitation.**
4152
4153Teammate invitations will expire after 7 days. Resending an invitation will reset the expiration date.*/
4154 pub fn post_v3_teammates_pending_token_resend(
4155 &self,
4156 token: &str,
4157 ) -> request::PostV3TeammatesPendingTokenResendRequest {
4158 request::PostV3TeammatesPendingTokenResendRequest {
4159 client: &self,
4160 on_behalf_of: None,
4161 token: token.to_owned(),
4162 }
4163 }
4164 /**Retrieve specific teammate
4165
4166**This endpoint allows you to retrieve a specific Teammate by username.**
4167
4168You can retrieve the username's for each of your Teammates using the "Retrieve all Teammates" endpoint.*/
4169 pub fn get_v3_teammates_username(
4170 &self,
4171 username: &str,
4172 ) -> request::GetV3TeammatesUsernameRequest {
4173 request::GetV3TeammatesUsernameRequest {
4174 client: &self,
4175 on_behalf_of: None,
4176 username: username.to_owned(),
4177 }
4178 }
4179 /**Delete teammate
4180
4181**This endpoint allows you to delete a teammate.**
4182
4183**Only the parent user or an admin teammate can delete another teammate.***/
4184 pub fn delete_v3_teammates_username(
4185 &self,
4186 username: &str,
4187 ) -> request::DeleteV3TeammatesUsernameRequest {
4188 request::DeleteV3TeammatesUsernameRequest {
4189 client: &self,
4190 on_behalf_of: None,
4191 username: username.to_owned(),
4192 }
4193 }
4194 /**Update teammate's permissions
4195
4196**This endpoint allows you to update a teammate’s permissions.**
4197
4198To turn a teammate into an admin, the request body should contain an `is_admin` set to `true`. Otherwise, set `is_admin` to `false` and pass in all the scopes that a teammate should have.
4199
4200**Only the parent user or other admin teammates can update another teammate’s permissions.**
4201
4202**Admin users can only update permissions.***/
4203 pub fn patch_v3_teammates_username(
4204 &self,
4205 username: &str,
4206 is_admin: bool,
4207 scopes: &[&str],
4208 ) -> request::PatchV3TeammatesUsernameRequest {
4209 request::PatchV3TeammatesUsernameRequest {
4210 client: &self,
4211 on_behalf_of: None,
4212 username: username.to_owned(),
4213 is_admin,
4214 scopes: scopes.iter().map(|&x| x.to_owned()).collect(),
4215 }
4216 }
4217 /**Retrieve paged transactional templates.
4218
4219**This endpoint allows you to retrieve all transactional templates.***/
4220 pub fn get_templates(&self, page_size: f64) -> request::GetTemplatesRequest {
4221 request::GetTemplatesRequest {
4222 client: &self,
4223 generations: None,
4224 page_size,
4225 page_token: None,
4226 on_behalf_of: None,
4227 }
4228 }
4229 /**Create a transactional template.
4230
4231**This endpoint allows you to create a transactional template.***/
4232 pub fn post_templates(&self, name: &str) -> request::PostTemplatesRequest {
4233 request::PostTemplatesRequest {
4234 client: &self,
4235 on_behalf_of: None,
4236 generation: None,
4237 name: name.to_owned(),
4238 }
4239 }
4240 /**Retrieve a single transactional template.
4241
4242**This endpoint allows you to retrieve a single transactional template.***/
4243 pub fn get_templates_template_id(
4244 &self,
4245 template_id: &str,
4246 ) -> request::GetTemplatesTemplateIdRequest {
4247 request::GetTemplatesTemplateIdRequest {
4248 client: &self,
4249 on_behalf_of: None,
4250 template_id: template_id.to_owned(),
4251 }
4252 }
4253 /**Duplicate a transactional template.
4254
4255**This endpoint allows you to duplicate a transactional template.***/
4256 pub fn post_templates_template_id(
4257 &self,
4258 template_id: &str,
4259 ) -> request::PostTemplatesTemplateIdRequest {
4260 request::PostTemplatesTemplateIdRequest {
4261 client: &self,
4262 on_behalf_of: None,
4263 template_id: template_id.to_owned(),
4264 name: None,
4265 }
4266 }
4267 /**Delete a template.
4268
4269**This endpoint allows you to delete a transactional template.***/
4270 pub fn delete_templates_template_id(
4271 &self,
4272 template_id: &str,
4273 ) -> request::DeleteTemplatesTemplateIdRequest {
4274 request::DeleteTemplatesTemplateIdRequest {
4275 client: &self,
4276 on_behalf_of: None,
4277 template_id: template_id.to_owned(),
4278 }
4279 }
4280 /**Edit a transactional template.
4281
4282**This endpoint allows you to edit the name of a transactional template.**
4283
4284To edit the template itself, [create a new transactional template version](https://sendgrid.api-docs.io/v3.0/transactional-templates-versions/create-a-new-transactional-template-version).*/
4285 pub fn patch_templates_template_id(
4286 &self,
4287 template_id: &str,
4288 ) -> request::PatchTemplatesTemplateIdRequest {
4289 request::PatchTemplatesTemplateIdRequest {
4290 client: &self,
4291 on_behalf_of: None,
4292 template_id: template_id.to_owned(),
4293 name: None,
4294 }
4295 }
4296 /**Create a new transactional template version.
4297
4298**This endpoint allows you to create a new version of a template.***/
4299 pub fn post_templates_template_id_versions(
4300 &self,
4301 template_id: &str,
4302 name: &str,
4303 subject: &str,
4304 ) -> request::PostTemplatesTemplateIdVersionsRequest {
4305 request::PostTemplatesTemplateIdVersionsRequest {
4306 client: &self,
4307 on_behalf_of: None,
4308 template_id: template_id.to_owned(),
4309 active: None,
4310 editor: None,
4311 generate_plain_content: None,
4312 html_content: None,
4313 name: name.to_owned(),
4314 plain_content: None,
4315 subject: subject.to_owned(),
4316 test_data: None,
4317 }
4318 }
4319 /**Retrieve a specific transactional template version.
4320
4321**This endpoint allows you to retrieve a specific version of a template.***/
4322 pub fn get_templates_template_id_versions_version_id(
4323 &self,
4324 template_id: &str,
4325 version_id: &str,
4326 ) -> request::GetTemplatesTemplateIdVersionsVersionIdRequest {
4327 request::GetTemplatesTemplateIdVersionsVersionIdRequest {
4328 client: &self,
4329 on_behalf_of: None,
4330 template_id: template_id.to_owned(),
4331 version_id: version_id.to_owned(),
4332 }
4333 }
4334 /**Delete a transactional template version.
4335
4336**This endpoint allows you to delete a transactional template version.***/
4337 pub fn delete_templates_template_id_versions_version_id(
4338 &self,
4339 template_id: &str,
4340 version_id: &str,
4341 ) -> request::DeleteTemplatesTemplateIdVersionsVersionIdRequest {
4342 request::DeleteTemplatesTemplateIdVersionsVersionIdRequest {
4343 client: &self,
4344 on_behalf_of: None,
4345 template_id: template_id.to_owned(),
4346 version_id: version_id.to_owned(),
4347 }
4348 }
4349 /**Edit a transactional template version.
4350
4351**This endpoint allows you to edit the content of your template version.***/
4352 pub fn patch_templates_template_id_versions_version_id(
4353 &self,
4354 args: request::PatchTemplatesTemplateIdVersionsVersionIdRequired,
4355 ) -> request::PatchTemplatesTemplateIdVersionsVersionIdRequest {
4356 request::PatchTemplatesTemplateIdVersionsVersionIdRequest {
4357 client: &self,
4358 on_behalf_of: None,
4359 template_id: args.template_id.to_owned(),
4360 version_id: args.version_id.to_owned(),
4361 active: None,
4362 editor: None,
4363 generate_plain_content: None,
4364 html_content: None,
4365 name: args.name.to_owned(),
4366 plain_content: None,
4367 subject: args.subject.to_owned(),
4368 test_data: None,
4369 }
4370 }
4371 /**Activate a transactional template version.
4372
4373**This endpoint allows you to activate a version of one of your templates.***/
4374 pub fn post_templates_template_id_versions_version_id_activate(
4375 &self,
4376 template_id: &str,
4377 version_id: &str,
4378 ) -> request::PostTemplatesTemplateIdVersionsVersionIdActivateRequest {
4379 request::PostTemplatesTemplateIdVersionsVersionIdActivateRequest {
4380 client: &self,
4381 on_behalf_of: None,
4382 template_id: template_id.to_owned(),
4383 version_id: version_id.to_owned(),
4384 }
4385 }
4386 /**Retrieve Tracking Settings
4387
4388**This endpoint allows you to retrieve a list of all tracking settings on your account.***/
4389 pub fn get_tracking_settings(&self) -> request::GetTrackingSettingsRequest {
4390 request::GetTrackingSettingsRequest {
4391 client: &self,
4392 on_behalf_of: None,
4393 }
4394 }
4395 /**Retrieve Click Track Settings
4396
4397**This endpoint allows you to retrieve your current click tracking setting.**
4398
4399Click 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/).
4400
4401Click tracking helps you understand how users are engaging with your communications. SendGrid can track up to 1000 links per email*/
4402 pub fn get_tracking_settings_click(
4403 &self,
4404 ) -> request::GetTrackingSettingsClickRequest {
4405 request::GetTrackingSettingsClickRequest {
4406 client: &self,
4407 on_behalf_of: None,
4408 }
4409 }
4410 /**Update Click Tracking Settings
4411
4412**This endpoint allows you to enable or disable your current click tracking setting.**
4413
4414Click 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/).
4415
4416Click tracking helps you understand how users are engaging with your communications. SendGrid can track up to 1000 links per email*/
4417 pub fn patch_tracking_settings_click(
4418 &self,
4419 ) -> request::PatchTrackingSettingsClickRequest {
4420 request::PatchTrackingSettingsClickRequest {
4421 client: &self,
4422 on_behalf_of: None,
4423 enabled: None,
4424 }
4425 }
4426 /**Retrieve Google Analytics Settings
4427
4428**This endpoint allows you to retrieve your current setting for Google Analytics.**
4429
4430
4431Google 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).
4432
4433We default the settings to Google’s recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/ui/analytics-and-reporting/google-analytics/).*/
4434 pub fn get_tracking_settings_google_analytics(
4435 &self,
4436 ) -> request::GetTrackingSettingsGoogleAnalyticsRequest {
4437 request::GetTrackingSettingsGoogleAnalyticsRequest {
4438 client: &self,
4439 on_behalf_of: None,
4440 }
4441 }
4442 /**Update Google Analytics Settings
4443
4444**This endpoint allows you to update your current setting for Google Analytics.**
4445
4446Google 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).
4447
4448We default the settings to Google’s recommendations. For more information, see [Google Analytics Demystified](https://sendgrid.com/docs/ui/analytics-and-reporting/google-analytics/).*/
4449 pub fn patch_tracking_settings_google_analytics(
4450 &self,
4451 ) -> request::PatchTrackingSettingsGoogleAnalyticsRequest {
4452 request::PatchTrackingSettingsGoogleAnalyticsRequest {
4453 client: &self,
4454 on_behalf_of: None,
4455 enabled: None,
4456 utm_campaign: None,
4457 utm_content: None,
4458 utm_medium: None,
4459 utm_source: None,
4460 utm_term: None,
4461 }
4462 }
4463 /**Get Open Tracking Settings
4464
4465**This endpoint allows you to retrieve your current settings for open tracking.**
4466
4467Open Tracking adds an invisible image at the end of the email which can track email opens.
4468
4469If 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.
4470
4471These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.*/
4472 pub fn get_tracking_settings_open(&self) -> request::GetTrackingSettingsOpenRequest {
4473 request::GetTrackingSettingsOpenRequest {
4474 client: &self,
4475 on_behalf_of: None,
4476 }
4477 }
4478 /**Update Open Tracking Settings
4479
4480**This endpoint allows you to update your current settings for open tracking.**
4481
4482Open Tracking adds an invisible image at the end of the email which can track email opens.
4483
4484If 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.
4485
4486These events are logged in the Statistics portal, Email Activity interface, and are reported by the Event Webhook.*/
4487 pub fn patch_tracking_settings_open(
4488 &self,
4489 ) -> request::PatchTrackingSettingsOpenRequest {
4490 request::PatchTrackingSettingsOpenRequest {
4491 client: &self,
4492 on_behalf_of: None,
4493 enabled: None,
4494 }
4495 }
4496 /**Retrieve Subscription Tracking Settings
4497
4498**This endpoint allows you to retrieve your current settings for subscription tracking.**
4499
4500Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.*/
4501 pub fn get_tracking_settings_subscription(
4502 &self,
4503 ) -> request::GetTrackingSettingsSubscriptionRequest {
4504 request::GetTrackingSettingsSubscriptionRequest {
4505 client: &self,
4506 on_behalf_of: None,
4507 }
4508 }
4509 /**Update Subscription Tracking Settings
4510
4511**This endpoint allows you to update your current settings for subscription tracking.**
4512
4513Subscription tracking adds links to the bottom of your emails that allows your recipients to subscribe to, or unsubscribe from, your emails.*/
4514 pub fn patch_tracking_settings_subscription(
4515 &self,
4516 ) -> request::PatchTrackingSettingsSubscriptionRequest {
4517 request::PatchTrackingSettingsSubscriptionRequest {
4518 client: &self,
4519 on_behalf_of: None,
4520 enabled: None,
4521 html_content: None,
4522 landing: None,
4523 plain_content: None,
4524 replace: None,
4525 url: None,
4526 }
4527 }
4528 /**Get a user's account information.
4529
4530**This endpoint allows you to retrieve your user account details.**
4531
4532Your user's account information includes the user's account type and reputation.*/
4533 pub fn get_user_account(&self) -> request::GetUserAccountRequest {
4534 request::GetUserAccountRequest {
4535 client: &self,
4536 on_behalf_of: None,
4537 }
4538 }
4539 /**Retrieve your credit balance
4540
4541**This endpoint allows you to retrieve the current credit balance for your account.**
4542
4543Each account has a credit balance, which is a base number of emails it can send before receiving per-email charges. For more information about credits and billing, see [Billing and Plan details information](https://sendgrid.com/docs/ui/account-and-settings/billing/).*/
4544 pub fn get_user_credits(&self) -> request::GetUserCreditsRequest {
4545 request::GetUserCreditsRequest {
4546 client: &self,
4547 on_behalf_of: None,
4548 }
4549 }
4550 /**Retrieve your account email address
4551
4552**This endpoint allows you to retrieve the email address currently on file for your account.***/
4553 pub fn get_user_email(&self) -> request::GetUserEmailRequest {
4554 request::GetUserEmailRequest {
4555 client: &self,
4556 on_behalf_of: None,
4557 }
4558 }
4559 /**Update your account email address
4560
4561**This endpoint allows you to update the email address currently on file for your account.***/
4562 pub fn put_user_email(&self) -> request::PutUserEmailRequest {
4563 request::PutUserEmailRequest {
4564 client: &self,
4565 on_behalf_of: None,
4566 email: None,
4567 }
4568 }
4569 /**Update your password
4570
4571**This endpoint allows you to update your password.***/
4572 pub fn put_user_password(
4573 &self,
4574 new_password: &str,
4575 old_password: &str,
4576 ) -> request::PutUserPasswordRequest {
4577 request::PutUserPasswordRequest {
4578 client: &self,
4579 on_behalf_of: None,
4580 new_password: new_password.to_owned(),
4581 old_password: old_password.to_owned(),
4582 }
4583 }
4584 ///Get a user's profile
4585 pub fn get_user_profile(&self) -> request::GetUserProfileRequest {
4586 request::GetUserProfileRequest {
4587 client: &self,
4588 on_behalf_of: None,
4589 }
4590 }
4591 /**Update a user's profile
4592
4593**This endpoint allows you to update your current profile details.**
4594
4595Any one or more of the parameters can be updated via the PATCH `/user/profile` endpoint. You must include at least one when you PATCH.*/
4596 pub fn patch_user_profile(&self) -> request::PatchUserProfileRequest {
4597 request::PatchUserProfileRequest {
4598 client: &self,
4599 on_behalf_of: None,
4600 address: None,
4601 address2: None,
4602 city: None,
4603 company: None,
4604 country: None,
4605 first_name: None,
4606 last_name: None,
4607 phone: None,
4608 state: None,
4609 website: None,
4610 zip: None,
4611 }
4612 }
4613 /**Retrieve all scheduled sends
4614
4615**This endpoint allows you to retrieve all cancelled and paused scheduled send information.**
4616
4617This endpoint will return only the scheduled sends that are associated with a `batch_id`. If you have scheduled a send using the `/mail/send` endpoint and the `send_at` field but no `batch_id`, the send will be scheduled for delivery; however, it will not be returned by this endpoint. For this reason, you should assign a `batch_id` to any scheduled send you may need to pause or cancel in the future.*/
4618 pub fn get_user_scheduled_sends(&self) -> request::GetUserScheduledSendsRequest {
4619 request::GetUserScheduledSendsRequest {
4620 client: &self,
4621 on_behalf_of: None,
4622 }
4623 }
4624 /**Cancel or pause a scheduled send
4625
4626**This endpoint allows you to cancel or pause a scheduled send associated with a `batch_id`.**
4627
4628Passing this endpoint a `batch_id` and status will cancel or pause the scheduled send.
4629
4630Once a scheduled send is set to `pause` or `cancel` you must use the "Update a scheduled send" endpoint to change its status or the "Delete a cancellation or pause from a scheduled send" endpoint to remove the status. Passing a status change to a scheduled send that has already been paused or cancelled will result in a `400` level status code.
4631
4632If the maximum number of cancellations/pauses are added to a send, a `400` level status code will be returned.*/
4633 pub fn post_user_scheduled_sends(
4634 &self,
4635 batch_id: &str,
4636 status: &str,
4637 ) -> request::PostUserScheduledSendsRequest {
4638 request::PostUserScheduledSendsRequest {
4639 client: &self,
4640 on_behalf_of: None,
4641 batch_id: batch_id.to_owned(),
4642 status: status.to_owned(),
4643 }
4644 }
4645 /**Retrieve scheduled send
4646
4647**This endpoint allows you to retrieve the cancel/paused scheduled send information for a specific `batch_id`.***/
4648 pub fn get_user_scheduled_sends_batch_id(
4649 &self,
4650 batch_id: &str,
4651 ) -> request::GetUserScheduledSendsBatchIdRequest {
4652 request::GetUserScheduledSendsBatchIdRequest {
4653 client: &self,
4654 on_behalf_of: None,
4655 batch_id: batch_id.to_owned(),
4656 }
4657 }
4658 /**Delete a cancellation or pause from a scheduled send
4659
4660**This endpoint allows you to delete the cancellation/pause of a scheduled send.**
4661
4662Scheduled sends cancelled less than 10 minutes before the scheduled time are not guaranteed to be cancelled.*/
4663 pub fn delete_user_scheduled_sends_batch_id(
4664 &self,
4665 batch_id: &str,
4666 ) -> request::DeleteUserScheduledSendsBatchIdRequest {
4667 request::DeleteUserScheduledSendsBatchIdRequest {
4668 client: &self,
4669 on_behalf_of: None,
4670 batch_id: batch_id.to_owned(),
4671 }
4672 }
4673 /**Update a scheduled send
4674
4675**This endpoint allows you to update the status of a scheduled send for the given `batch_id`.**
4676
4677If you have already set a `cancel` or `pause` status on a scheduled send using the "Cancel or pause a scheduled send" endpoint, you can update it's status using this endpoint. Attempting to update a status once it has been set with the "Cancel or pause a scheduled send" endpoint will result in a `400` error.*/
4678 pub fn patch_user_scheduled_sends_batch_id(
4679 &self,
4680 batch_id: &str,
4681 status: &str,
4682 ) -> request::PatchUserScheduledSendsBatchIdRequest {
4683 request::PatchUserScheduledSendsBatchIdRequest {
4684 client: &self,
4685 on_behalf_of: None,
4686 batch_id: batch_id.to_owned(),
4687 status: status.to_owned(),
4688 }
4689 }
4690 /**Retrieve current Enforced TLS settings.
4691
4692**This endpoint allows you to retrieve your current Enforced TLS settings.**
4693
4694The Enforced TLS settings specify whether or not the recipient is required to support TLS or have a valid certificate.
4695
4696If either `require_tls` or `require_valid_cert` is set to `true`, the recipient must support TLS 1.1 or higher or have a valid certificate. If these conditions are not met, Twilio SendGrid will drop the message and send a block event with “TLS required but not supported” as the description.*/
4697 pub fn get_user_settings_enforced_tls(
4698 &self,
4699 ) -> request::GetUserSettingsEnforcedTlsRequest {
4700 request::GetUserSettingsEnforcedTlsRequest {
4701 client: &self,
4702 on_behalf_of: None,
4703 }
4704 }
4705 /**Update Enforced TLS settings
4706
4707**This endpoint allows you to update your Enforced TLS settings.**
4708
4709To require TLS from recipients, set `require_tls` to `true`. If either `require_tls` or `require_valid_cert` is set to `true`, the recipient must support TLS 1.1 or higher or have a valid certificate. If these conditions are not met, Twilio SendGrid will drop the message and send a block event with “TLS required but not supported” as the description.
4710
4711> Twilio SendGrid supports TLS 1.1 and higher and does not support older versions of TLS due to security vulnerabilities.*/
4712 pub fn patch_user_settings_enforced_tls(
4713 &self,
4714 ) -> request::PatchUserSettingsEnforcedTlsRequest {
4715 request::PatchUserSettingsEnforcedTlsRequest {
4716 client: &self,
4717 on_behalf_of: None,
4718 require_tls: None,
4719 require_valid_cert: None,
4720 version: None,
4721 }
4722 }
4723 /**Retrieve your username
4724
4725**This endpoint allows you to retrieve your current account username.***/
4726 pub fn get_user_username(&self) -> request::GetUserUsernameRequest {
4727 request::GetUserUsernameRequest {
4728 client: &self,
4729 on_behalf_of: None,
4730 }
4731 }
4732 /**Update your username
4733
4734**This endpoint allows you to update the username for your account.***/
4735 pub fn put_user_username(&self) -> request::PutUserUsernameRequest {
4736 request::PutUserUsernameRequest {
4737 client: &self,
4738 on_behalf_of: None,
4739 username: None,
4740 }
4741 }
4742 /**Retrieve Event Webhook settings
4743
4744**This endpoint allows you to retrieve your current event webhook settings.**
4745
4746If an event type is marked as `true`, then the event webhook will include information about that event.
4747
4748SendGrid’s Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.
4749
4750Common uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.*/
4751 pub fn get_user_webhooks_event_settings(
4752 &self,
4753 ) -> request::GetUserWebhooksEventSettingsRequest {
4754 request::GetUserWebhooksEventSettingsRequest {
4755 client: &self,
4756 on_behalf_of: None,
4757 }
4758 }
4759 /**Update Event Notification Settings
4760
4761**This endpoint allows you to update your current event webhook settings.**
4762
4763If an event type is marked as `true`, then the event webhook will include information about that event.
4764
4765SendGrid’s Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.
4766
4767Common uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.*/
4768 pub fn patch_user_webhooks_event_settings(
4769 &self,
4770 args: request::PatchUserWebhooksEventSettingsRequired,
4771 ) -> request::PatchUserWebhooksEventSettingsRequest {
4772 request::PatchUserWebhooksEventSettingsRequest {
4773 client: &self,
4774 on_behalf_of: None,
4775 bounce: args.bounce,
4776 click: args.click,
4777 deferred: args.deferred,
4778 delivered: args.delivered,
4779 dropped: args.dropped,
4780 enabled: args.enabled,
4781 group_resubscribe: args.group_resubscribe,
4782 group_unsubscribe: args.group_unsubscribe,
4783 oauth_client_id: None,
4784 oauth_client_secret: None,
4785 oauth_token_url: None,
4786 open: args.open,
4787 processed: args.processed,
4788 spam_report: args.spam_report,
4789 unsubscribe: args.unsubscribe,
4790 url: args.url.to_owned(),
4791 }
4792 }
4793 /**Retrieve Signed Webhook Public Key
4794
4795**This endpoint allows you to retrieve your signed webhook's public key.**
4796
4797Once you have enabled signing of the Event Webhook, you will need the public key provided to verify the signatures on requests coming from Twilio SendGrid. You can retrieve the public key from this endpoint at any time.
4798
4799For more information about cryptographically signing the Event Webhook, see [Getting Started with the Event Webhook Security Features](https://sendgrid.com/docs/for-developers/tracking-events/getting-started-event-webhook-security-features).*/
4800 pub fn get_user_webhooks_event_settings_signed(
4801 &self,
4802 ) -> request::GetUserWebhooksEventSettingsSignedRequest {
4803 request::GetUserWebhooksEventSettingsSignedRequest {
4804 client: &self,
4805 on_behalf_of: None,
4806 }
4807 }
4808 /**Enable/Disable Signed Webhook
4809
4810**This endpoint allows you to enable or disable signing of the Event Webhook.**
4811
4812This endpoint takes a single boolean request parameter, `enabled`. You may either enable or disable signing of the Event Webhook using this endpoint. Once enabled, you can retrieve your public key using the `/webhooks/event/settings/signed` endpoint.
4813
4814For more information about cryptographically signing the Event Webhook, see [Getting Started with the Event Webhook Security Features](https://sendgrid.com/docs/for-developers/tracking-events/getting-started-event-webhook-security-features).*/
4815 pub fn patch_user_webhooks_event_settings_signed(
4816 &self,
4817 enabled: bool,
4818 ) -> request::PatchUserWebhooksEventSettingsSignedRequest {
4819 request::PatchUserWebhooksEventSettingsSignedRequest {
4820 client: &self,
4821 on_behalf_of: None,
4822 enabled,
4823 }
4824 }
4825 /**Test Event Notification Settings
4826
4827**This endpoint allows you to test your event webhook by sending a fake event notification post to the provided URL.**
4828
4829SendGrid’s Event Webhook will notify a URL of your choice via HTTP POST with information about events that occur as SendGrid processes your email.
4830
4831Common uses of this data are to remove unsubscribes, react to spam reports, determine unengaged recipients, identify bounced email addresses, or create advanced analytics of your email program.
4832
4833>**Tip**: Retry logic for this endpoint differs from other endpoints, which use a rolling 24-hour retry.
4834
4835If your web server does not return a 2xx response type, we will retry a POST request until we receive a 2xx response or the maximum time of 10 minutes has expired.*/
4836 pub fn post_user_webhooks_event_test(
4837 &self,
4838 ) -> request::PostUserWebhooksEventTestRequest {
4839 request::PostUserWebhooksEventTestRequest {
4840 client: &self,
4841 on_behalf_of: None,
4842 oauth_client_id: None,
4843 oauth_client_secret: None,
4844 oauth_token_url: None,
4845 url: None,
4846 }
4847 }
4848 /**Retrieve all parse settings
4849
4850**This endpoint allows you to retrieve all of your current inbound parse settings.***/
4851 pub fn get_user_webhooks_parse_settings(
4852 &self,
4853 ) -> request::GetUserWebhooksParseSettingsRequest {
4854 request::GetUserWebhooksParseSettingsRequest {
4855 client: &self,
4856 on_behalf_of: None,
4857 }
4858 }
4859 /**Create a parse setting
4860
4861**This endpoint allows you to create a new inbound parse setting.**
4862
4863Creating an Inbound Parse setting requires two pieces of information: a `url` and a `hostname`.
4864
4865The `hostname` must correspond to a domain authenticated by Twilio SendGrid on your account. If you need to complete domain authentication, you can use the [Twilio SendGrid App](https://app.sendgrid.com/settings/sender_auth) or the "Authenticate a domain" endpoint. See "[How to Set Up Domain Authentication](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/)" for instructions.
4866
4867Any email received by the `hostname` will be parsed when you complete this setup. You must also add a Twilio SendGrid MX record to this domain's DNS records. See "[Setting up the Inbound Parse Webhook](https://sendgrid.com/docs/for-developers/parsing-email/setting-up-the-inbound-parse-webhook/)" for full instructions.
4868
4869The `url` represents a location where the parsed message data will be delivered. Twilio SendGrid will make an HTTP POST request to this `url` with the message data. The `url` must be publicly reachable, and your application must return a `200` status code to signal that the message data has been received.*/
4870 pub fn post_user_webhooks_parse_settings(
4871 &self,
4872 ) -> request::PostUserWebhooksParseSettingsRequest {
4873 request::PostUserWebhooksParseSettingsRequest {
4874 client: &self,
4875 on_behalf_of: None,
4876 hostname: None,
4877 send_raw: None,
4878 spam_check: None,
4879 url: None,
4880 }
4881 }
4882 /**Retrieve a specific parse setting
4883
4884**This endpoint allows you to retrieve a specific inbound parse setting by hostname.**
4885
4886You can retrieve all your Inbound Parse settings and their associated host names with the "Retrieve all parse settings" endpoint.*/
4887 pub fn get_user_webhooks_parse_settings_hostname(
4888 &self,
4889 hostname: &str,
4890 ) -> request::GetUserWebhooksParseSettingsHostnameRequest {
4891 request::GetUserWebhooksParseSettingsHostnameRequest {
4892 client: &self,
4893 on_behalf_of: None,
4894 hostname: hostname.to_owned(),
4895 }
4896 }
4897 /**Delete a parse setting
4898
4899**This endpoint allows you to delete a specific inbound parse setting by hostname.**
4900
4901You can retrieve all your Inbound Parse settings and their associated host names with the "Retrieve all parse settings" endpoint.*/
4902 pub fn delete_user_webhooks_parse_settings_hostname(
4903 &self,
4904 hostname: &str,
4905 ) -> request::DeleteUserWebhooksParseSettingsHostnameRequest {
4906 request::DeleteUserWebhooksParseSettingsHostnameRequest {
4907 client: &self,
4908 on_behalf_of: None,
4909 hostname: hostname.to_owned(),
4910 }
4911 }
4912 /**Update a parse setting
4913
4914**This endpoint allows you to update a specific inbound parse setting by hostname.**
4915
4916You can retrieve all your Inbound Parse settings and their associated host names with the "Retrieve all parse settings" endpoint.*/
4917 pub fn patch_user_webhooks_parse_settings_hostname(
4918 &self,
4919 hostname: &str,
4920 ) -> request::PatchUserWebhooksParseSettingsHostnameRequest {
4921 request::PatchUserWebhooksParseSettingsHostnameRequest {
4922 client: &self,
4923 on_behalf_of: None,
4924 hostname: hostname.to_owned(),
4925 send_raw: None,
4926 spam_check: None,
4927 url: None,
4928 }
4929 }
4930 /**Retrieves Inbound Parse Webhook statistics.
4931
4932**This endpoint allows you to retrieve the statistics for your Parse Webhook useage.**
4933
4934SendGrid's Inbound Parse Webhook allows you to parse the contents and attachments of incomming emails. The Parse API can then POST the parsed emails to a URL that you specify. The Inbound Parse Webhook cannot parse messages greater than 30MB in size, including all attachments.
4935
4936There are a number of pre-made integrations for the SendGrid Parse Webhook which make processing events easy. You can find these integrations in the [Library Index](https://sendgrid.com/docs/Integrate/libraries.html#-Webhook-Libraries).*/
4937 pub fn get_user_webhooks_parse_stats(
4938 &self,
4939 start_date: &str,
4940 ) -> request::GetUserWebhooksParseStatsRequest {
4941 request::GetUserWebhooksParseStatsRequest {
4942 client: &self,
4943 limit: None,
4944 offset: None,
4945 aggregated_by: None,
4946 start_date: start_date.to_owned(),
4947 end_date: None,
4948 on_behalf_of: None,
4949 }
4950 }
4951 /**Validate an email
4952
4953**This endpoint allows you to validate an email address.***/
4954 pub fn post_validations_email(
4955 &self,
4956 email: &str,
4957 ) -> request::PostValidationsEmailRequest {
4958 request::PostValidationsEmailRequest {
4959 client: &self,
4960 email: email.to_owned(),
4961 source: None,
4962 }
4963 }
4964 /**Get All Verified Senders
4965
4966**This endpoint allows you to retrieve all the Sender Identities associated with an account.**
4967
4968This endpoint will return both verified and unverified senders.
4969
4970You can limit the number of results returned using the `limit`, `lastSeenID`, and `id` query string parameters.
4971
4972* `limit` allows you to specify an exact number of Sender Identities to return.
4973* `lastSeenID` will return senders with an ID number occuring after the passed in ID. In other words, the `lastSeenID` provides a starting point from which SendGrid will iterate to find Sender Identities associated with your account.
4974* `id` will return information about only the Sender Identity passed in the request.*/
4975 pub fn get_verified_senders(&self) -> request::GetVerifiedSendersRequest {
4976 request::GetVerifiedSendersRequest {
4977 client: &self,
4978 limit: None,
4979 last_seen_id: None,
4980 id: None,
4981 }
4982 }
4983 /**Create Verified Sender Request
4984
4985**This endpoint allows you to create a new Sender Identify**.
4986
4987Upon successful submission of a `POST` request to this endpoint, an identity will be created, and a verification email will be sent to the address assigned to the `from_email` field. You must complete the verification process using the sent email to fully verify the sender.
4988
4989If you need to resend the verification email, you can do so with the Resend Verified Sender Request, `/resend/{id}`, endpoint.
4990
4991If you need to authenticate a domain rather than a Single Sender, see the [Domain Authentication API](https://sendgrid.api-docs.io/v3.0/domain-authentication/authenticate-a-domain).*/
4992 pub fn post_verified_senders(
4993 &self,
4994 from_email: &str,
4995 nickname: &str,
4996 reply_to: &str,
4997 ) -> request::PostVerifiedSendersRequest {
4998 request::PostVerifiedSendersRequest {
4999 client: &self,
5000 address: None,
5001 address2: None,
5002 city: None,
5003 country: None,
5004 from_email: from_email.to_owned(),
5005 from_name: None,
5006 nickname: nickname.to_owned(),
5007 reply_to: reply_to.to_owned(),
5008 reply_to_name: None,
5009 state: None,
5010 zip: None,
5011 }
5012 }
5013 /**Domain Warn List
5014
5015**This endpoint returns a list of domains known to implement DMARC and categorizes them by failure type — hard failure or soft failure**.
5016
5017Domains listed as hard failures will not deliver mail when used as a [Sender Identity](https://sendgrid.com/docs/for-developers/sending-email/sender-identity/) due to the domain's DMARC policy settings.
5018
5019For example, using a `yahoo.com` email address as a Sender Identity will likely result in the rejection of your mail. For more information about DMARC, see [Everything about DMARC](https://sendgrid.com/docs/ui/sending-email/dmarc/).*/
5020 pub fn get_verified_senders_domains(
5021 &self,
5022 ) -> request::GetVerifiedSendersDomainsRequest {
5023 request::GetVerifiedSendersDomainsRequest {
5024 client: &self,
5025 }
5026 }
5027 /**Resend Verified Sender Request
5028
5029**This endpoint allows you to resend a verification email to a specified Sender Identity**.
5030
5031Passing the `id` assigned to a Sender Identity to this endpoint will resend a verification email to the `from_address` associated with the Sender Identity. This can be useful if someone loses their verification email or needs to have it resent for any other reason.
5032
5033You can retrieve the IDs associated with Sender Identities by passing a "Get All Verified Senders" endpoint.*/
5034 pub fn post_verified_senders_resend_id(
5035 &self,
5036 id: &str,
5037 ) -> request::PostVerifiedSendersResendIdRequest {
5038 request::PostVerifiedSendersResendIdRequest {
5039 client: &self,
5040 id: id.to_owned(),
5041 }
5042 }
5043 /**Completed Steps
5044
5045**This endpoint allows you to determine which of SendGrid’s verification processes have been completed for an account**.
5046
5047This endpoint returns boolean values, `true` and `false`, for [Domain Authentication](https://sendgrid.com/docs/for-developers/sending-email/sender-identity/#domain-authentication), `domain_verified`, and [Single Sender Verification](https://sendgrid.com/docs/for-developers/sending-email/sender-identity/#single-sender-verification), `sender_verified`, for the account.
5048
5049An account may have one, both, or neither verification steps completed. If you need to authenticate a domain rather than a Single Sender, see the "Authenticate a domain" endpoint.*/
5050 pub fn get_verified_senders_steps_completed(
5051 &self,
5052 ) -> request::GetVerifiedSendersStepsCompletedRequest {
5053 request::GetVerifiedSendersStepsCompletedRequest {
5054 client: &self,
5055 }
5056 }
5057 /**Verify Sender Request
5058
5059**This endpoint allows you to verify a sender requests.**
5060
5061The token is generated by SendGrid and included in a verification email delivered to the address that's pending verification.*/
5062 pub fn get_verified_senders_verify_token(
5063 &self,
5064 token: &str,
5065 ) -> request::GetVerifiedSendersVerifyTokenRequest {
5066 request::GetVerifiedSendersVerifyTokenRequest {
5067 client: &self,
5068 token: token.to_owned(),
5069 }
5070 }
5071 /**Delete Verified Sender
5072
5073**This endpoint allows you to delete a Sender Identity**.
5074
5075Pass the `id` assigned to a Sender Identity to this endpoint to delete the Sender Identity from your account.
5076
5077You can retrieve the IDs associated with Sender Identities using the "Get All Verified Senders" endpoint.*/
5078 pub fn delete_verified_senders_id(
5079 &self,
5080 id: &str,
5081 ) -> request::DeleteVerifiedSendersIdRequest {
5082 request::DeleteVerifiedSendersIdRequest {
5083 client: &self,
5084 id: id.to_owned(),
5085 }
5086 }
5087 /**Edit Verified Sender
5088
5089**This endpoint allows you to update an existing Sender Identity**.
5090
5091Pass the `id` assigned to a Sender Identity to this endpoint as a path parameter. Include any fields you wish to update in the request body in JSON format.
5092
5093You can retrieve the IDs associated with Sender Identities by passing a `GET` request to the Get All Verified Senders endpoint, `/verified_senders`.
5094
5095**Note:** Unlike a `PUT` request, `PATCH` allows you to update only the fields you wish to edit. Fields that are not passed as part of a request will remain unaltered.*/
5096 pub fn patch_verified_senders_id(
5097 &self,
5098 args: request::PatchVerifiedSendersIdRequired,
5099 ) -> request::PatchVerifiedSendersIdRequest {
5100 request::PatchVerifiedSendersIdRequest {
5101 client: &self,
5102 id: args.id.to_owned(),
5103 address: None,
5104 address2: None,
5105 city: None,
5106 country: None,
5107 from_email: args.from_email.to_owned(),
5108 from_name: None,
5109 nickname: args.nickname.to_owned(),
5110 reply_to: args.reply_to.to_owned(),
5111 reply_to_name: None,
5112 state: None,
5113 zip: None,
5114 }
5115 }
5116 /**Email DNS records to a co-worker
5117
5118**This endpoint is used to share DNS records with a colleagues**
5119
5120Use this endpoint to send SendGrid-generated DNS record information to a co-worker so they can enter it into your DNS provider to validate your domain and link branding.
5121
5122What type of records are sent will depend on whether you have chosen Automated Security or not. When using Automated Security, SendGrid provides you with three CNAME records. If you turn Automated Security off, you are instead given TXT and MX records.
5123
5124If you pass a `link_id` to this endpoint, the generated email will supply the DNS records necessary to complete [Link Branding](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) setup. If you pass a `domain_id` to this endpoint, the generated email will supply the DNS records needed to complete [Domain Authentication](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Passing both IDs will generate an email with the records needed to complete both setup steps.
5125
5126You can retrieve all your domain IDs from the returned `id` fields for each domain using the "List all authenticated domains" endpoint. You can retrieve all of your link IDs using the "Retrieve all branded links" endpoint.*/
5127 pub fn post_whitelabel_dns_email(
5128 &self,
5129 domain_id: i64,
5130 email: &str,
5131 link_id: i64,
5132 ) -> request::PostWhitelabelDnsEmailRequest {
5133 request::PostWhitelabelDnsEmailRequest {
5134 client: &self,
5135 domain_id,
5136 email: email.to_owned(),
5137 link_id,
5138 message: None,
5139 }
5140 }
5141 /**List all authenticated domains
5142
5143**This endpoint allows you to retrieve a list of all domains you have authenticated.***/
5144 pub fn get_whitelabel_domains(&self) -> request::GetWhitelabelDomainsRequest {
5145 request::GetWhitelabelDomainsRequest {
5146 client: &self,
5147 limit: None,
5148 offset: None,
5149 exclude_subusers: None,
5150 username: None,
5151 domain: None,
5152 on_behalf_of: None,
5153 }
5154 }
5155 /**Authenticate a domain
5156
5157**This endpoint allows you to authenticate a domain.**
5158
5159If you are authenticating a domain for a subuser, you have two options:
51601. Use the "username" parameter. This allows you to authenticate a domain on behalf of your subuser. This means the subuser is able to see and modify the authenticated domain.
51612. Use the Association workflow (see Associate Domain section). This allows you to authenticate a domain created by the parent to a subuser. This means the subuser will default to the assigned domain, but will not be able to see or modify that authenticated domain. However, if the subuser authenticates their own domain it will overwrite the assigned domain.*/
5162 pub fn post_whitelabel_domains(
5163 &self,
5164 domain: &str,
5165 ) -> request::PostWhitelabelDomainsRequest {
5166 request::PostWhitelabelDomainsRequest {
5167 client: &self,
5168 on_behalf_of: None,
5169 automatic_security: None,
5170 custom_dkim_selector: None,
5171 custom_spf: None,
5172 default: None,
5173 domain: domain.to_owned(),
5174 ips: None,
5175 subdomain: None,
5176 username: None,
5177 }
5178 }
5179 /**Get the default authentication
5180
5181**This endpoint allows you to retrieve the default authentication for a domain.**
5182
5183When creating or updating a domain authentication, you can set the domain as a default. The default domain will be used to send all mail. If you have multiple authenticated domains, the authenticated domain matching the domain of the From address will be used, and the default will be overridden.
5184
5185This endpoint will return a default domain and its details only if a default is set. You are not required to set a default. If you do not set a default domain, this endpoint will return general information about your domain authentication status.*/
5186 pub fn get_whitelabel_domains_default(
5187 &self,
5188 ) -> request::GetWhitelabelDomainsDefaultRequest {
5189 request::GetWhitelabelDomainsDefaultRequest {
5190 client: &self,
5191 domain: None,
5192 on_behalf_of: None,
5193 }
5194 }
5195 /**List the authenticated domain associated with the given user.
5196
5197**This endpoint allows you to retrieve all of the authenticated domains that have been assigned to a specific subuser.**
5198
5199Authenticated domains can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's domain authentication. To associate an authenticated domain with a subuser, the parent account must first authenticate and validate the domain. The parent may then associate the authenticated domain via the subuser management tools.*/
5200 pub fn get_whitelabel_domains_subuser(
5201 &self,
5202 username: &str,
5203 ) -> request::GetWhitelabelDomainsSubuserRequest {
5204 request::GetWhitelabelDomainsSubuserRequest {
5205 client: &self,
5206 username: username.to_owned(),
5207 }
5208 }
5209 /**Disassociate an authenticated domain from a given user.
5210
5211**This endpoint allows you to disassociate a specific authenticated domain from a subuser.**
5212
5213Authenticated domains can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's domain authentication. To associate an authenticated domain with a subuser, the parent account must first authenticate and validate the domain. The parent may then associate the authenticated domain via the subuser management tools.*/
5214 pub fn delete_whitelabel_domains_subuser(
5215 &self,
5216 ) -> request::DeleteWhitelabelDomainsSubuserRequest {
5217 request::DeleteWhitelabelDomainsSubuserRequest {
5218 client: &self,
5219 username: None,
5220 }
5221 }
5222 /**Retrieve an authenticated domain
5223
5224**This endpoint allows you to retrieve a specific authenticated domain.***/
5225 pub fn get_whitelabel_domains_domain_id(
5226 &self,
5227 domain_id: &str,
5228 ) -> request::GetWhitelabelDomainsDomainIdRequest {
5229 request::GetWhitelabelDomainsDomainIdRequest {
5230 client: &self,
5231 on_behalf_of: None,
5232 domain_id: domain_id.to_owned(),
5233 }
5234 }
5235 /**Delete an authenticated domain.
5236
5237**This endpoint allows you to delete an authenticated domain.***/
5238 pub fn delete_whitelabel_domains_domain_id(
5239 &self,
5240 domain_id: &str,
5241 ) -> request::DeleteWhitelabelDomainsDomainIdRequest {
5242 request::DeleteWhitelabelDomainsDomainIdRequest {
5243 client: &self,
5244 on_behalf_of: None,
5245 domain_id: domain_id.to_owned(),
5246 }
5247 }
5248 /**Update an authenticated domain
5249
5250**This endpoint allows you to update the settings for an authenticated domain.***/
5251 pub fn patch_whitelabel_domains_domain_id(
5252 &self,
5253 domain_id: &str,
5254 ) -> request::PatchWhitelabelDomainsDomainIdRequest {
5255 request::PatchWhitelabelDomainsDomainIdRequest {
5256 client: &self,
5257 on_behalf_of: None,
5258 domain_id: domain_id.to_owned(),
5259 custom_spf: None,
5260 default: None,
5261 }
5262 }
5263 /**Associate an authenticated domain with a given user.
5264
5265**This endpoint allows you to associate a specific authenticated domain with a subuser.**
5266
5267Authenticated domains can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's domain authentication. To associate an authenticated domain with a subuser, the parent account must first authenticate and validate the domain. The parent may then associate the authenticated domain via the subuser management tools.*/
5268 pub fn post_whitelabel_domains_domain_id_subuser(
5269 &self,
5270 domain_id: i64,
5271 username: &str,
5272 ) -> request::PostWhitelabelDomainsDomainIdSubuserRequest {
5273 request::PostWhitelabelDomainsDomainIdSubuserRequest {
5274 client: &self,
5275 domain_id,
5276 username: username.to_owned(),
5277 }
5278 }
5279 /**Add an IP to an authenticated domain
5280
5281**This endpoint allows you to add an IP address to an authenticated domain.***/
5282 pub fn post_whitelabel_domains_id_ips(
5283 &self,
5284 id: i64,
5285 ip: &str,
5286 ) -> request::PostWhitelabelDomainsIdIpsRequest {
5287 request::PostWhitelabelDomainsIdIpsRequest {
5288 client: &self,
5289 on_behalf_of: None,
5290 id,
5291 ip: ip.to_owned(),
5292 }
5293 }
5294 /**Remove an IP from an authenticated domain.
5295
5296**This endpoint allows you to remove an IP address from that domain's authentication.***/
5297 pub fn delete_whitelabel_domains_id_ips_ip(
5298 &self,
5299 id: i64,
5300 ip: &str,
5301 ) -> request::DeleteWhitelabelDomainsIdIpsIpRequest {
5302 request::DeleteWhitelabelDomainsIdIpsIpRequest {
5303 client: &self,
5304 on_behalf_of: None,
5305 id,
5306 ip: ip.to_owned(),
5307 }
5308 }
5309 /**Validate a domain authentication.
5310
5311**This endpoint allows you to validate an authenticated domain. If it fails, it will return an error message describing why the domain could not be validated.***/
5312 pub fn post_whitelabel_domains_id_validate(
5313 &self,
5314 id: i64,
5315 ) -> request::PostWhitelabelDomainsIdValidateRequest {
5316 request::PostWhitelabelDomainsIdValidateRequest {
5317 client: &self,
5318 on_behalf_of: None,
5319 id,
5320 }
5321 }
5322 /**Retrieve all reverse DNS records
5323
5324**This endpoint allows you to retrieve all of the Reverse DNS records created by this account.**
5325
5326You may include a search key by using the `ip` query string parameter. This enables you to perform a prefix search for a given IP segment (e.g., `?ip="192."`).
5327
5328Use the `limit` query string parameter to reduce the number of records returned. All records will be returned if you have fewer records than the specified limit.
5329
5330The `offset` query string parameter allows you to specify a non-zero index from which records will be returned. For example, if you have ten records, `?offset=5` will return the last five records (at indexes 5 through 9). The list starts at index zero.*/
5331 pub fn get_whitelabel_ips(&self) -> request::GetWhitelabelIpsRequest {
5332 request::GetWhitelabelIpsRequest {
5333 client: &self,
5334 limit: None,
5335 offset: None,
5336 ip: None,
5337 on_behalf_of: None,
5338 }
5339 }
5340 /**Set up reverse DNS
5341
5342**This endpoint allows you to set up reverse DNS.***/
5343 pub fn post_whitelabel_ips(
5344 &self,
5345 domain: &str,
5346 ip: &str,
5347 ) -> request::PostWhitelabelIpsRequest {
5348 request::PostWhitelabelIpsRequest {
5349 client: &self,
5350 on_behalf_of: None,
5351 domain: domain.to_owned(),
5352 ip: ip.to_owned(),
5353 subdomain: None,
5354 }
5355 }
5356 /**Retrieve a reverse DNS record
5357
5358**This endpoint allows you to retrieve a reverse DNS record.**
5359
5360You can retrieve the IDs associated with all your reverse DNS records using the "Retrieve all reverse DNS records" endpoint.*/
5361 pub fn get_whitelabel_ips_id(&self, id: &str) -> request::GetWhitelabelIpsIdRequest {
5362 request::GetWhitelabelIpsIdRequest {
5363 client: &self,
5364 on_behalf_of: None,
5365 id: id.to_owned(),
5366 }
5367 }
5368 /**Delete a reverse DNS record
5369
5370**This endpoint allows you to delete a reverse DNS record.**
5371
5372A call to this endpoint will respond with a 204 status code if the deletion was successful.
5373
5374You can retrieve the IDs associated with all your reverse DNS records using the "Retrieve all reverse DNS records" endpoint.*/
5375 pub fn delete_whitelabel_ips_id(
5376 &self,
5377 id: &str,
5378 ) -> request::DeleteWhitelabelIpsIdRequest {
5379 request::DeleteWhitelabelIpsIdRequest {
5380 client: &self,
5381 on_behalf_of: None,
5382 id: id.to_owned(),
5383 }
5384 }
5385 /**Validate a reverse DNS record
5386
5387**This endpoint allows you to validate a reverse DNS record.**
5388
5389Always check the `valid` property of the response’s `validation_results.a_record` object. This field will indicate whether it was possible to validate the reverse DNS record. If the `validation_results.a_record.valid` is `false`, this indicates only that Twilio SendGrid could not determine the validity your reverse DNS record — it may still be valid.
5390
5391If validity couldn’t be determined, you can check the value of `validation_results.a_record.reason` to find out why.
5392
5393You can retrieve the IDs associated with all your reverse DNS records using the "Retrieve all reverse DNS records" endpoint.*/
5394 pub fn post_whitelabel_ips_id_validate(
5395 &self,
5396 id: &str,
5397 ) -> request::PostWhitelabelIpsIdValidateRequest {
5398 request::PostWhitelabelIpsIdValidateRequest {
5399 client: &self,
5400 on_behalf_of: None,
5401 id: id.to_owned(),
5402 }
5403 }
5404 /**Retrieve all branded links
5405
5406**This endpoint allows you to retrieve all branded links**.
5407
5408You can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.*/
5409 pub fn get_whitelabel_links(&self) -> request::GetWhitelabelLinksRequest {
5410 request::GetWhitelabelLinksRequest {
5411 client: &self,
5412 limit: None,
5413 on_behalf_of: None,
5414 }
5415 }
5416 /**Create a branded link
5417
5418**This endpoint allows you to create a new branded link.**
5419
5420To create the link branding, supply the root domain and, optionally, the subdomain — these go into separate fields in your request body. The root domain should match your FROM email address. If you provide a subdomain, it must be different from the subdomain you used for authenticating your domain.
5421
5422You can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.*/
5423 pub fn post_whitelabel_links(
5424 &self,
5425 domain: &str,
5426 ) -> request::PostWhitelabelLinksRequest {
5427 request::PostWhitelabelLinksRequest {
5428 client: &self,
5429 on_behalf_of: None,
5430 default: None,
5431 domain: domain.to_owned(),
5432 subdomain: None,
5433 }
5434 }
5435 /**Retrieve the default branded link
5436
5437**This endpoint allows you to retrieve the default branded link.**
5438
5439The default branded link is the actual URL to be used when sending messages. If you have more than one branded link, the default is determined by the following order:
5440
5441* The validated branded link marked as `default` (set when you call the "Create a branded link" endpoint or by calling the "Update a branded link" endpoint on an existing link)
5442* Legacy branded links (migrated from the whitelabel wizard)
5443* Default SendGrid-branded links (i.e., `100.ct.sendgrid.net`)
5444
5445You can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.*/
5446 pub fn get_whitelabel_links_default(
5447 &self,
5448 ) -> request::GetWhitelabelLinksDefaultRequest {
5449 request::GetWhitelabelLinksDefaultRequest {
5450 client: &self,
5451 domain: None,
5452 on_behalf_of: None,
5453 }
5454 }
5455 /**Retrieve a subuser's branded link
5456
5457**This endpoint allows you to retrieve the branded link associated with a subuser.**
5458
5459Link branding can be associated with subusers from the parent account. This functionality allows subusers to send mail using their parent's link branding. To associate link branding, the parent account must first create a branded link and then validate it. The parent may then associate that branded link with a subuser via the API or the [Subuser Management page of the Twilio SendGrid App](https://app.sendgrid.com/settings/subusers).*/
5460 pub fn get_whitelabel_links_subuser(
5461 &self,
5462 username: &str,
5463 ) -> request::GetWhitelabelLinksSubuserRequest {
5464 request::GetWhitelabelLinksSubuserRequest {
5465 client: &self,
5466 username: username.to_owned(),
5467 }
5468 }
5469 /**Disassociate a branded link from a subuser
5470
5471**This endpoint allows you to take a branded link away from a subuser.**
5472
5473Link branding can be associated with subusers from the parent account. This functionality allows subusers to send mail using their parent's link branding. To associate link branding, the parent account must first create a branded link and validate it. The parent may then associate that branded link with a subuser via the API or the [Subuser Management page of the Twilio SendGrid App](https://app.sendgrid.com/settings/subusers).
5474
5475Your request will receive a response with a 204 status code if the disassociation was successful.*/
5476 pub fn delete_whitelabel_links_subuser(
5477 &self,
5478 username: &str,
5479 ) -> request::DeleteWhitelabelLinksSubuserRequest {
5480 request::DeleteWhitelabelLinksSubuserRequest {
5481 client: &self,
5482 username: username.to_owned(),
5483 }
5484 }
5485 /**Retrieve a branded link
5486
5487**This endpoint allows you to retrieve a specific branded link by providing its ID.**
5488
5489You can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.*/
5490 pub fn get_whitelabel_links_id(
5491 &self,
5492 id: i64,
5493 ) -> request::GetWhitelabelLinksIdRequest {
5494 request::GetWhitelabelLinksIdRequest {
5495 client: &self,
5496 on_behalf_of: None,
5497 id,
5498 }
5499 }
5500 /**Delete a branded link
5501
5502**This endpoint allows you to delete a branded link.**
5503
5504Your request will receive a response with a 204 status code if the deletion was successful. The call does not return the link's details, so if you wish to record these make sure you call the "Retrieve a branded link" endpoint *before* you request its deletion.
5505
5506You can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.*/
5507 pub fn delete_whitelabel_links_id(
5508 &self,
5509 id: i64,
5510 ) -> request::DeleteWhitelabelLinksIdRequest {
5511 request::DeleteWhitelabelLinksIdRequest {
5512 client: &self,
5513 on_behalf_of: None,
5514 id,
5515 }
5516 }
5517 /**Update a branded link
5518
5519**This endpoint allows you to update a specific branded link. You can use this endpoint to change a branded link's default status.**
5520
5521You can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.*/
5522 pub fn patch_whitelabel_links_id(
5523 &self,
5524 id: i64,
5525 ) -> request::PatchWhitelabelLinksIdRequest {
5526 request::PatchWhitelabelLinksIdRequest {
5527 client: &self,
5528 on_behalf_of: None,
5529 id,
5530 default: None,
5531 }
5532 }
5533 /**Validate a branded link
5534
5535**This endpoint allows you to validate a branded link.**
5536
5537You can submit this request as one of your subusers if you include their ID in the `on-behalf-of` header in the request.*/
5538 pub fn post_whitelabel_links_id_validate(
5539 &self,
5540 id: i64,
5541 ) -> request::PostWhitelabelLinksIdValidateRequest {
5542 request::PostWhitelabelLinksIdValidateRequest {
5543 client: &self,
5544 on_behalf_of: None,
5545 id,
5546 }
5547 }
5548 /**Associate a branded link with a subuser
5549
5550**This endpoint allows you to associate a branded link with a subuser account.**
5551
5552Link branding can be associated with subusers from the parent account. This functionality allows subusers to send mail using their parent's link branding. To associate link branding, the parent account must first create a branded link and validate it. The parent may then associate that branded link with a subuser via the API or the [Subuser Management page of the Twilio SendGrid App](https://app.sendgrid.com/settings/subusers).*/
5553 pub fn post_whitelabel_links_link_id_subuser(
5554 &self,
5555 link_id: i64,
5556 ) -> request::PostWhitelabelLinksLinkIdSubuserRequest {
5557 request::PostWhitelabelLinksLinkIdSubuserRequest {
5558 client: &self,
5559 link_id,
5560 username: None,
5561 }
5562 }
5563}
5564pub enum SendgridAuthentication {
5565 Authorization { authorization: String },
5566}
5567impl SendgridAuthentication {
5568 pub fn from_env() -> Self {
5569 Self::Authorization {
5570 authorization: std::env::var("SENDGRID_AUTHORIZATION")
5571 .expect("Environment variable SENDGRID_AUTHORIZATION is not set."),
5572 }
5573 }
5574}