Skip to main content

loops_so/generated/
types.rs

1//!
2//! AUTO-GENERATED CODE - DO NOT EDIT!
3//!
4//! Loops OpenAPI Spec
5//! Source: target/openapi.normalized.json
6//! Version: 1.22.6
7//! Generated by `oas3-gen v0.28.0`
8//!
9//! This is the OpenAPI Spec for the [Loops API](https://loops.so/docs/api).
10
11use serde::{Deserialize, Serialize};
12use validator::Validate;
13pub const IDEMPOTENCY_KEY: http::HeaderName = http::HeaderName::from_static("idempotency-key");
14pub const WEBHOOK_ID: http::HeaderName = http::HeaderName::from_static("webhook-id");
15pub const WEBHOOK_TIMESTAMP: http::HeaderName = http::HeaderName::from_static("webhook-timestamp");
16pub const WEBHOOK_SIGNATURE: http::HeaderName = http::HeaderName::from_static("webhook-signature");
17/// All-time email engagement counters. Opens and clicks count sends, not events: a send opened five times counts once. A recipient who received the email twice is counted once per send, not once per person.
18#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
19pub struct EmailMetricsResponse {
20    /// Number of sends.
21    pub sends: i64,
22    /// Number of sends that were opened at least once.
23    pub opens: i64,
24    /// Number of sends where at least one link was clicked.
25    pub clicks: i64,
26    /// Number of unsubscribes.
27    pub unsubscribes: i64,
28    /// Number of sends reported as spam.
29    #[serde(rename = "spamReports")]
30    pub spam_reports: i64,
31    /// Number of sends that hard bounced.
32    #[serde(rename = "hardBounces")]
33    pub hard_bounces: i64,
34    /// Number of sends that soft bounced.
35    #[serde(rename = "softBounces")]
36    pub soft_bounces: i64,
37}
38/// All-time delivery counters for a transactional email.
39#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
40pub struct TransactionalMetricsResponse {
41    /// Number of sends.
42    pub sends: i64,
43    /// Number of sends delivered.
44    pub deliveries: i64,
45    /// Number of sends reported as spam.
46    #[serde(rename = "spamReports")]
47    pub spam_reports: i64,
48    /// Number of sends that hard bounced.
49    #[serde(rename = "hardBounces")]
50    pub hard_bounces: i64,
51    /// Number of sends that soft bounced.
52    #[serde(rename = "softBounces")]
53    pub soft_bounces: i64,
54}
55#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
56pub struct Contact {
57    /// The contact's Loops ID.
58    pub id: Option<String>,
59    /// The contact's email address.
60    pub email: Option<String>,
61    /// The contact's first name.
62    #[serde(rename = "firstName")]
63    pub first_name: Option<String>,
64    /// The contact's last name.
65    #[serde(rename = "lastName")]
66    pub last_name: Option<String>,
67    /// The source the contact was created from.
68    pub source: Option<String>,
69    /// Whether the contact will receive campaign and workflow emails.
70    pub subscribed: Option<bool>,
71    /// The contact's user group.
72    #[serde(rename = "userGroup")]
73    pub user_group: Option<String>,
74    /// The contact's unique user ID.
75    #[serde(rename = "userId")]
76    pub user_id: Option<String>,
77    /// Mailing lists the contact is subscribed to, represented by key-value pairs of mailing list IDs and `true`.
78    #[serde(rename = "mailingLists")]
79    pub mailing_lists: Option<serde_json::Value>,
80    /// Double opt-in status. This will be `null` for contacts unless they are created via a form while double opt-in is enabled.
81    #[serde(rename = "optInStatus")]
82    pub opt_in_status: Option<OptInStatus>,
83}
84#[serde_with::skip_serializing_none]
85#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
86pub struct ContactFields {
87    /// The contact's email address.
88    pub email: Option<String>,
89    /// The contact's first name.
90    #[serde(rename = "firstName")]
91    pub first_name: Option<String>,
92    /// The contact's last name.
93    #[serde(rename = "lastName")]
94    pub last_name: Option<String>,
95    /// A custom source value to replace the default “API”.
96    pub source: Option<String>,
97    /// Whether the contact will receive campaign and workflow emails. All new contacts are subscribed by default.
98    pub subscribed: Option<bool>,
99    /// The contact's user group.
100    #[serde(rename = "userGroup")]
101    pub user_group: Option<String>,
102    /// A unique user ID (for example, from an external application).
103    #[serde(rename = "userId")]
104    pub user_id: Option<String>,
105    /// Manage mailing list subscriptions.
106    ///
107    /// Include key-value pairs of mailing list IDs and a `boolean` denoting if the contact should be added (`true`) or removed (`false`) from the list.
108    #[serde(rename = "mailingLists")]
109    pub mailing_lists: Option<serde_json::Value>,
110    /// Additional properties not defined in the schema.
111    #[serde(flatten)]
112    pub additional_properties: indexmap::IndexMap<String, String>,
113}
114#[serde_with::skip_serializing_none]
115#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
116pub struct ContactRequest {
117    /// The contact's email address.
118    #[validate(length(min = 1u64))]
119    pub email: String,
120    /// The contact's first name.
121    #[serde(rename = "firstName")]
122    pub first_name: Option<String>,
123    /// The contact's last name.
124    #[serde(rename = "lastName")]
125    pub last_name: Option<String>,
126    /// A custom source value to replace the default “API”.
127    pub source: Option<String>,
128    /// Whether the contact will receive campaign and workflow emails. All new contacts are subscribed by default.
129    pub subscribed: Option<bool>,
130    /// The contact's user group.
131    #[serde(rename = "userGroup")]
132    pub user_group: Option<String>,
133    /// A unique user ID (for example, from an external application).
134    #[serde(rename = "userId")]
135    pub user_id: Option<String>,
136    /// Manage mailing list subscriptions.
137    ///
138    /// Include key-value pairs of mailing list IDs and a `boolean` denoting if the contact should be added (`true`) or removed (`false`) from the list.
139    #[serde(rename = "mailingLists")]
140    pub mailing_lists: Option<serde_json::Value>,
141    /// Additional properties not defined in the schema.
142    #[serde(flatten)]
143    pub additional_properties: indexmap::IndexMap<String, String>,
144}
145#[serde_with::skip_serializing_none]
146#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
147pub struct ContactUpdateRequest {
148    /// The contact's email address. **Required if `userId` is not provided.**
149    pub email: Option<String>,
150    /// The contact's first name.
151    #[serde(rename = "firstName")]
152    pub first_name: Option<String>,
153    /// The contact's last name.
154    #[serde(rename = "lastName")]
155    pub last_name: Option<String>,
156    /// A custom source value to replace the default “API”.
157    pub source: Option<String>,
158    /// Whether the contact will receive campaign and workflow emails. We recommend leaving this field out of your update requests unless you specifically want to unsubscribe (`false`) or re-subscribe (`true`) a contact. All new contacts are subscribed by default.
159    pub subscribed: Option<bool>,
160    /// The contact's user group.
161    #[serde(rename = "userGroup")]
162    pub user_group: Option<String>,
163    /// The contact's unique user ID. **Required if `email` is not provided.**
164    #[serde(rename = "userId")]
165    pub user_id: Option<String>,
166    /// Manage mailing list subscriptions.
167    ///
168    /// Include key-value pairs of mailing list IDs and a `boolean` denoting if the contact should be added (`true`) or removed (`false`) from the list.
169    #[serde(rename = "mailingLists")]
170    pub mailing_lists: Option<serde_json::Value>,
171    /// Additional properties not defined in the schema.
172    #[serde(flatten)]
173    pub additional_properties: indexmap::IndexMap<String, String>,
174}
175#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
176pub struct ContactSuccessResponse {
177    pub success: bool,
178    pub id: String,
179}
180#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
181pub struct ContactFailureResponse {
182    pub success: bool,
183    pub message: String,
184}
185#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
186#[serde(untagged)]
187pub enum ContactDeleteRequest {
188    #[default]
189    Email(serde_json::Value),
190    UserId(serde_json::Value),
191}
192#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
193pub struct ContactDeleteResponse {
194    pub success: bool,
195    pub message: String,
196}
197#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
198pub struct ContactSuppressionStatusResponse {
199    pub contact: ContactSuppressionStatusResponseContact,
200    /// Whether the contact is suppressed.
201    #[serde(rename = "isSuppressed")]
202    pub is_suppressed: bool,
203    #[serde(rename = "removalQuota")]
204    pub removal_quota: ContactSuppressionRemovalQuota,
205}
206#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
207pub struct ContactSuppressionRemoveResponse {
208    /// Whether the suppression removal was successful.
209    pub success: bool,
210    pub message: String,
211    #[serde(rename = "removalQuota")]
212    pub removal_quota: ContactSuppressionRemovalQuota,
213}
214#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
215pub struct ContactSuppressionRemovalQuota {
216    /// The number of suppression removals allowed in a rolling 30 day period.
217    pub limit: f64,
218    /// The remaining number of suppression removals left in the current 30 day period.
219    pub remaining: f64,
220}
221/// There are a few [reserved names](https://loops.so/docs/contacts/properties#reserved-names) that you cannot use for contact properties.
222#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
223pub struct ContactPropertyCreateRequest {
224    /// The name of the property. This should be in camelCase, like `planName` or `importDate`.
225    #[validate(length(min = 1u64))]
226    pub name: String,
227    /// The type of property.
228    #[serde(rename = "type")]
229    pub r#type: ContactPropertyCreateRequestType,
230}
231#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
232pub struct ContactPropertySuccessResponse {
233    pub success: bool,
234}
235#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
236pub struct ContactPropertyFailureResponse {
237    pub success: bool,
238    pub message: String,
239}
240#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
241#[serde(untagged)]
242pub enum EventRequest {
243    #[default]
244    Email(serde_json::Value),
245    UserId(serde_json::Value),
246}
247#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
248pub struct EventSuccessResponse {
249    pub success: bool,
250}
251#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
252pub struct EventFailureResponse {
253    pub success: bool,
254    pub message: String,
255}
256#[serde_with::skip_serializing_none]
257#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
258pub struct TransactionalRequest {
259    /// The recipient's email address.
260    #[validate(length(min = 1u64))]
261    pub email: String,
262    /// The ID of the transactional email to send.
263    #[serde(rename = "transactionalId")]
264    #[validate(length(min = 1u64))]
265    pub transactional_id: String,
266    /// If `true`, a contact will be created in your audience using the `email` value (if a matching contact doesn't already exist).
267    #[serde(rename = "addToAudience")]
268    pub add_to_audience: Option<bool>,
269    /// An object containing data as defined by the data variables added to the transactional email template. Values can be of type string or number.
270    ///
271    /// If you have added optional data variables to your email, you can exclude them from the dataVariables object or set the value to "".
272    ///
273    /// If you have added an array data variable to your email, make sure to include an array matching the data variables you added to your array block.
274    #[serde(rename = "dataVariables")]
275    pub data_variables: Option<serde_json::Value>,
276    /// A list containing file objects to be sent along with an email message. Attachments must be enabled by Loops support before they can be used with the API.
277    #[validate(nested)]
278    pub attachments: Option<Vec<TransactionalRequestAttachment>>,
279}
280#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
281pub struct TransactionalSuccessResponse {
282    pub success: bool,
283}
284#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
285pub struct TransactionalFailureResponse {
286    pub message: String,
287}
288#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
289pub struct TransactionalSendFailureResponse {
290    pub success: bool,
291    pub message: String,
292}
293#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
294pub struct TransactionalFailure2Response {
295    pub success: bool,
296    pub message: String,
297    pub path: String,
298}
299#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
300pub struct TransactionalFailure3Response {
301    pub success: bool,
302    pub message: String,
303    pub error: ResponseError,
304}
305#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
306pub struct TransactionalFailure4Response {
307    pub success: bool,
308    pub message: String,
309    pub error: TransactionalFailure4ResponseError,
310}
311#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
312pub struct TransactionalFailure5Response {
313    pub success: bool,
314    pub message: String,
315    pub error: ResponseError,
316    #[serde(rename = "transactionalId")]
317    pub transactional_id: String,
318}
319#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
320pub struct IdempotencyKeyFailureResponse {
321    pub success: bool,
322    pub message: String,
323}
324#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
325pub struct TransactionalEmail {
326    /// The ID of the transactional email.
327    pub id: String,
328    /// The name of the transactional email.
329    pub name: String,
330    /// The date and time the transactional email was last updated in ISO 8601 format.
331    #[serde(rename = "lastUpdated")]
332    pub last_updated: String,
333    /// The data variables used by the transactional email.
334    #[serde(rename = "dataVariables")]
335    pub data_variables: Vec<serde_json::Value>,
336}
337#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
338pub struct ListTransactionalsResponse {
339    pub pagination: Option<Pagination>,
340    pub data: Option<Vec<TransactionalEmail>>,
341}
342#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
343pub struct TransactionalResource {
344    /// The ID of the transactional email.
345    pub id: String,
346    /// The URL of the transactional email in the Loops app.
347    pub url: String,
348    /// The name of the transactional email.
349    pub name: String,
350    /// The ID of the draft email message. `null` if there is no draft version.
351    #[serde(rename = "draftEmailMessageId")]
352    pub draft_email_message_id: Option<String>,
353    /// The ID of the published email message. `null` if there is no published version.
354    #[serde(rename = "publishedEmailMessageId")]
355    pub published_email_message_id: Option<String>,
356    /// The ID of the group this transactional email belongs to.
357    #[serde(rename = "transactionalGroupId")]
358    pub transactional_group_id: Option<String>,
359    /// ISO 8601 timestamp for when the transactional email was created.
360    #[serde(rename = "createdAt")]
361    pub created_at: chrono::DateTime<chrono::Utc>,
362    /// ISO 8601 timestamp for when the transactional email was last updated.
363    #[serde(rename = "updatedAt")]
364    pub updated_at: chrono::DateTime<chrono::Utc>,
365    /// Data variable names used by the published email. Empty for unpublished transactional emails.
366    #[serde(rename = "dataVariables")]
367    pub data_variables: Vec<String>,
368}
369#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
370pub struct TransactionalDraftResponse {
371    /// The ID of the transactional email.
372    pub id: String,
373    /// The URL of the transactional email in the Loops app.
374    pub url: String,
375    /// The name of the transactional email.
376    pub name: String,
377    /// The ID of the draft email message.
378    #[serde(rename = "draftEmailMessageId")]
379    pub draft_email_message_id: Option<String>,
380    /// The `contentRevisionId` of the draft email message. Pass this as `expectedRevisionId` on your first update via `POST /v1/email-messages/{emailMessageId}`.
381    #[serde(rename = "draftEmailMessageContentRevisionId")]
382    pub draft_email_message_content_revision_id: Option<String>,
383    /// The ID of the published email message. `null` if there is no published version.
384    #[serde(rename = "publishedEmailMessageId")]
385    pub published_email_message_id: Option<String>,
386    /// The ID of the group this transactional email belongs to. Returned when creating a transactional email.
387    #[serde(rename = "transactionalGroupId")]
388    pub transactional_group_id: Option<String>,
389    /// ISO 8601 timestamp for when the transactional email was created.
390    #[serde(rename = "createdAt")]
391    pub created_at: chrono::DateTime<chrono::Utc>,
392    /// ISO 8601 timestamp for when the transactional email was last updated.
393    #[serde(rename = "updatedAt")]
394    pub updated_at: chrono::DateTime<chrono::Utc>,
395    /// Data variable names used by the published email. Empty for unpublished transactional emails.
396    #[serde(rename = "dataVariables")]
397    pub data_variables: Vec<String>,
398}
399#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
400pub struct ListTransactionalsResourceResponse {
401    pub pagination: Pagination,
402    pub data: Vec<TransactionalResource>,
403}
404#[serde_with::skip_serializing_none]
405#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
406pub struct CreateTransactionalRequest {
407    /// The name of the transactional email.
408    #[validate(length(min = 1u64))]
409    pub name: String,
410    /// The ID of the group to add this transactional email to. Defaults to the team's Unsorted group when omitted.
411    #[serde(rename = "transactionalGroupId")]
412    pub transactional_group_id: Option<String>,
413}
414/// At least one field must be provided.
415#[serde_with::skip_serializing_none]
416#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
417pub struct UpdateTransactionalRequest {
418    pub name: Option<String>,
419    /// The ID of the group to move this transactional email to.
420    #[serde(rename = "transactionalGroupId")]
421    pub transactional_group_id: Option<String>,
422}
423#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
424pub struct ContactProperty {
425    /// The key of the contact property.
426    pub key: String,
427    /// The human-friendly label for this property.
428    pub label: String,
429    /// The type of property.
430    #[serde(rename = "type")]
431    pub r#type: ContactPropertyCreateRequestType,
432}
433#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
434pub struct MailingList {
435    /// The ID of the mailing list.
436    pub id: String,
437    /// The name of the mailing list.
438    pub name: String,
439    /// The description of the mailing list. `null` if no description is set.
440    pub description: Option<String>,
441    /// Whether the mailing list is public (`true`) or private (`false`).
442    #[serde(rename = "isPublic")]
443    pub is_public: bool,
444}
445/// Manage mailing list subscriptions.
446///
447/// Include key-value pairs of mailing list IDs and a `boolean` denoting if the contact should be added (`true`) or removed (`false`) from the list.
448pub type MailingListSubscriptions = serde_json::Value;
449#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
450pub struct Theme {
451    /// The ID of the theme.
452    pub id: String,
453    /// The name of the theme.
454    pub name: String,
455    /// Flat map of style attributes, matching the attribute names accepted by the LMX `<Style />` tag.
456    pub styles: ThemeStyles,
457    /// Whether this theme is the team's default.
458    #[serde(rename = "isDefault")]
459    pub is_default: bool,
460    /// ISO 8601 timestamp for when the theme was created.
461    #[serde(rename = "createdAt")]
462    pub created_at: String,
463    /// ISO 8601 timestamp for when the theme was last updated.
464    #[serde(rename = "updatedAt")]
465    pub updated_at: String,
466}
467/// Flat map of style attributes, matching the attribute names accepted by the LMX `<Style />` tag.
468#[serde_with::skip_serializing_none]
469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
470pub struct ThemeStyles {
471    #[serde(rename = "backgroundColor")]
472    pub background_color: Option<String>,
473    #[serde(rename = "backgroundXPadding")]
474    pub background_xpadding: Option<f64>,
475    #[serde(rename = "backgroundYPadding")]
476    pub background_ypadding: Option<f64>,
477    #[serde(rename = "bodyColor")]
478    pub body_color: Option<String>,
479    #[serde(rename = "bodyXPadding")]
480    pub body_xpadding: Option<f64>,
481    #[serde(rename = "bodyYPadding")]
482    pub body_ypadding: Option<f64>,
483    #[serde(rename = "bodyFontFamily")]
484    pub body_font_family: Option<String>,
485    #[serde(rename = "bodyFontCategory")]
486    pub body_font_category: Option<String>,
487    #[serde(rename = "borderColor")]
488    pub border_color: Option<String>,
489    #[serde(rename = "borderWidth")]
490    pub border_width: Option<f64>,
491    #[serde(rename = "borderRadius")]
492    pub border_radius: Option<f64>,
493    #[serde(rename = "buttonBodyColor")]
494    pub button_body_color: Option<String>,
495    #[serde(rename = "buttonBodyXPadding")]
496    pub button_body_xpadding: Option<f64>,
497    #[serde(rename = "buttonBodyYPadding")]
498    pub button_body_ypadding: Option<f64>,
499    #[serde(rename = "buttonBorderColor")]
500    pub button_border_color: Option<String>,
501    #[serde(rename = "buttonBorderWidth")]
502    pub button_border_width: Option<f64>,
503    #[serde(rename = "buttonBorderRadius")]
504    pub button_border_radius: Option<f64>,
505    #[serde(rename = "buttonTextColor")]
506    pub button_text_color: Option<String>,
507    #[serde(rename = "buttonTextFormat")]
508    pub button_text_format: Option<f64>,
509    #[serde(rename = "buttonTextFontSize")]
510    pub button_text_font_size: Option<f64>,
511    #[serde(rename = "dividerColor")]
512    pub divider_color: Option<String>,
513    #[serde(rename = "dividerBorderWidth")]
514    pub divider_border_width: Option<f64>,
515    #[serde(rename = "textBaseColor")]
516    pub text_base_color: Option<String>,
517    #[serde(rename = "textBaseFontSize")]
518    pub text_base_font_size: Option<f64>,
519    #[serde(rename = "textBaseLineHeight")]
520    pub text_base_line_height: Option<f64>,
521    #[serde(rename = "textBaseLetterSpacing")]
522    pub text_base_letter_spacing: Option<f64>,
523    #[serde(rename = "textLinkColor")]
524    pub text_link_color: Option<String>,
525    #[serde(rename = "heading1Color")]
526    pub heading1color: Option<String>,
527    #[serde(rename = "heading1FontSize")]
528    pub heading1font_size: Option<f64>,
529    #[serde(rename = "heading1LineHeight")]
530    pub heading1line_height: Option<f64>,
531    #[serde(rename = "heading1LetterSpacing")]
532    pub heading1letter_spacing: Option<f64>,
533    #[serde(rename = "heading2Color")]
534    pub heading2color: Option<String>,
535    #[serde(rename = "heading2FontSize")]
536    pub heading2font_size: Option<f64>,
537    #[serde(rename = "heading2LineHeight")]
538    pub heading2line_height: Option<f64>,
539    #[serde(rename = "heading2LetterSpacing")]
540    pub heading2letter_spacing: Option<f64>,
541    #[serde(rename = "heading3Color")]
542    pub heading3color: Option<String>,
543    #[serde(rename = "heading3FontSize")]
544    pub heading3font_size: Option<f64>,
545    #[serde(rename = "heading3LineHeight")]
546    pub heading3line_height: Option<f64>,
547    #[serde(rename = "heading3LetterSpacing")]
548    pub heading3letter_spacing: Option<f64>,
549}
550#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
551pub struct ListThemesResponse {
552    pub pagination: Pagination,
553    pub data: Vec<Theme>,
554}
555#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
556pub struct ThemeResponse {
557    /// The ID of the theme.
558    pub id: String,
559    /// The name of the theme.
560    pub name: String,
561    /// Flat map of style attributes, matching the attribute names accepted by the LMX `<Style />` tag.
562    pub styles: ThemeStyles,
563    /// Whether this theme is the team's default.
564    #[serde(rename = "isDefault")]
565    pub is_default: bool,
566    /// ISO 8601 timestamp for when the theme was created.
567    #[serde(rename = "createdAt")]
568    pub created_at: String,
569    /// ISO 8601 timestamp for when the theme was last updated.
570    #[serde(rename = "updatedAt")]
571    pub updated_at: String,
572}
573#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
574pub struct ThemeFailureResponse {
575    pub message: String,
576}
577#[serde_with::skip_serializing_none]
578#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
579pub struct CreateThemeBody {
580    /// The theme name.
581    #[validate(length(min = 1u64))]
582    pub name: String,
583    /// Flat map of style attributes, matching the attribute names accepted by the LMX `<Style />` tag.
584    pub styles: Option<ThemeStyles>,
585}
586/// At least one of `name` or `styles` must be provided.
587#[serde_with::skip_serializing_none]
588#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
589pub struct UpdateThemeBody {
590    pub name: Option<String>,
591    /// Flat map of style attributes, matching the attribute names accepted by the LMX `<Style />` tag.
592    pub styles: Option<ThemeStyles>,
593}
594#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
595pub struct UpdateThemeResponse {
596    /// The ID of the theme.
597    pub id: String,
598    /// The name of the theme.
599    pub name: String,
600    /// Flat map of style attributes, matching the attribute names accepted by the LMX `<Style />` tag.
601    pub styles: ThemeStyles,
602    /// Whether this theme is the team's default.
603    #[serde(rename = "isDefault")]
604    pub is_default: bool,
605    /// ISO 8601 timestamp for when the theme was created.
606    #[serde(rename = "createdAt")]
607    pub created_at: String,
608    /// ISO 8601 timestamp for when the theme was last updated.
609    #[serde(rename = "updatedAt")]
610    pub updated_at: String,
611    /// The number of emails using this theme that are affected by the style change. `0` when only the name changed.
612    #[serde(rename = "affectedEmailCount")]
613    pub affected_email_count: f64,
614}
615#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
616pub struct Component {
617    pub id: String,
618    pub name: String,
619    /// The component body serialized as LMX.
620    pub lmx: String,
621}
622#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
623pub struct ListComponentsResponse {
624    pub pagination: Pagination,
625    pub data: Vec<Component>,
626}
627#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
628pub struct ComponentResponse {
629    /// The ID of the component.
630    pub id: String,
631    /// The name of the component.
632    pub name: String,
633    /// The component body serialized as LMX.
634    pub lmx: String,
635}
636#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
637pub struct ComponentFailureResponse {
638    pub message: String,
639}
640#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
641pub struct ComponentValidationFailureResponse {
642    pub message: String,
643    /// The dynamic variables that the change would push into an email that cannot use them. Present only when the update was rejected for that reason.
644    #[serde(rename = "invalidTags")]
645    pub invalid_tags: Option<Vec<String>>,
646}
647#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
648pub struct CreateComponentBody {
649    /// The component name.
650    #[validate(length(min = 1u64))]
651    pub name: String,
652    /// The component body as an LMX string.
653    #[validate(length(min = 1u64))]
654    pub lmx: String,
655}
656/// At least one of `name` or `lmx` must be provided.
657#[serde_with::skip_serializing_none]
658#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
659pub struct UpdateComponentBody {
660    pub name: Option<String>,
661    /// The component body as an LMX string.
662    pub lmx: Option<String>,
663}
664#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
665pub struct UpdateComponentResponse {
666    /// The ID of the component.
667    pub id: String,
668    /// The name of the component.
669    pub name: String,
670    /// The component body serialized as LMX.
671    pub lmx: String,
672    /// The number of emails using this component that were updated by the body change. `0` when only the name changed.
673    #[serde(rename = "affectedEmailCount")]
674    pub affected_email_count: f64,
675}
676#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
677pub struct AudienceSegment {
678    /// The ID of the audience segment.
679    pub id: String,
680    /// The name of the audience segment.
681    pub name: String,
682    /// An optional description of the audience segment.
683    pub description: Option<String>,
684    /// ISO 8601 timestamp for when the audience segment was created.
685    #[serde(rename = "createdAt")]
686    pub created_at: String,
687    /// ISO 8601 timestamp for when the audience segment was last updated.
688    #[serde(rename = "updatedAt")]
689    pub updated_at: String,
690    pub filter: Option<AudienceFilter>,
691}
692#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
693pub struct ListAudienceSegmentsResponse {
694    pub pagination: Pagination,
695    pub data: Vec<AudienceSegment>,
696}
697#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
698pub struct AudienceSegmentResponse {
699    /// The ID of the audience segment.
700    pub id: String,
701    /// The name of the audience segment.
702    pub name: String,
703    /// An optional description of the audience segment.
704    pub description: Option<String>,
705    /// ISO 8601 timestamp for when the audience segment was created.
706    #[serde(rename = "createdAt")]
707    pub created_at: String,
708    /// ISO 8601 timestamp for when the audience segment was last updated.
709    #[serde(rename = "updatedAt")]
710    pub updated_at: String,
711    pub filter: Option<AudienceFilter>,
712}
713#[serde_with::skip_serializing_none]
714#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
715pub struct CreateAudienceSegmentRequest {
716    /// The name of the audience segment. Must be unique within the team.
717    #[validate(length(max = 255u64))]
718    pub name: String,
719    /// An optional description of the audience segment.
720    #[validate(length(max = 1_000u64))]
721    pub description: Option<String>,
722    /// A tree of audience conditions combined with `match`.
723    #[validate(nested)]
724    pub filter: CreateAudienceSegmentRequestFilter,
725}
726#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
727pub struct AudienceSegmentFailureResponse {
728    pub message: String,
729}
730/// When the campaign is scheduled to send.
731#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
732pub struct CampaignScheduling {
733    pub method: Method,
734    /// ISO 8601 send time. Null when the method is `now`.
735    pub timestamp: Option<chrono::DateTime<chrono::Utc>>,
736}
737/// When the campaign should send. `timestamp` is required and must be in the future when `method` is `schedule`, and must be omitted when `method` is `now`.
738#[serde_with::skip_serializing_none]
739#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
740pub struct CampaignSchedulingRequest {
741    pub method: Method,
742    pub timestamp: Option<chrono::DateTime<chrono::Utc>>,
743}
744/// A tree of audience conditions combined with `match`.
745#[derive(
746    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
747)]
748pub struct AudienceFilter {
749    #[serde(rename = "match")]
750    pub r#match: Match,
751    #[validate(length(min = 1u64))]
752    pub conditions: Vec<AudienceFilterCondition>,
753}
754/// A tree of audience conditions combined with `match`. Setting this without also providing `audienceSegmentId` clears any existing `audienceSegmentId`. When both are provided, this filter is applied on top of the segment's filter.
755#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
756pub struct AudienceFilterInRequest {
757    #[serde(rename = "match")]
758    pub r#match: Match,
759    #[validate(length(min = 1u64))]
760    pub conditions: Vec<AudienceFilterCondition>,
761}
762#[derive(Debug, Clone, PartialEq)]
763pub enum AudienceFilterCondition {
764    Property(PropertyCondition),
765    OptIn(OptInCondition),
766    Activity(ActivityCondition),
767}
768impl AudienceFilterCondition {
769    pub const DISCRIMINATOR_FIELD: &'static str = "type";
770}
771impl Default for AudienceFilterCondition {
772    fn default() -> Self {
773        Self::Property(<PropertyCondition>::default())
774    }
775}
776impl serde::Serialize for AudienceFilterCondition {
777    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
778    where
779        S: serde::Serializer,
780    {
781        match self {
782            Self::Property(v) => v.serialize(serializer),
783            Self::OptIn(v) => v.serialize(serializer),
784            Self::Activity(v) => v.serialize(serializer),
785        }
786    }
787}
788impl<'de> serde::Deserialize<'de> for AudienceFilterCondition {
789    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
790    where
791        D: serde::Deserializer<'de>,
792    {
793        let value = serde_json::Value::deserialize(deserializer)?;
794        match value
795            .get(Self::DISCRIMINATOR_FIELD)
796            .and_then(|v| v.as_str())
797        {
798            Some("property") => serde_json::from_value(value)
799                .map(Self::Property)
800                .map_err(serde::de::Error::custom),
801            Some("optIn") => serde_json::from_value(value)
802                .map(Self::OptIn)
803                .map_err(serde::de::Error::custom),
804            Some("activity") => serde_json::from_value(value)
805                .map(Self::Activity)
806                .map_err(serde::de::Error::custom),
807            None => Err(serde::de::Error::missing_field(Self::DISCRIMINATOR_FIELD)),
808            Some(other) => Err(serde::de::Error::custom(format!(
809                "Unknown discriminator value '{}' for field '{}'",
810                other, "type"
811            ))),
812        }
813    }
814}
815/// Matches contacts by a property value.
816#[serde_with::skip_serializing_none]
817#[derive(
818    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
819)]
820#[serde(default)]
821pub struct PropertyCondition {
822    #[doc(hidden)]
823    #[serde(default, rename = "type", skip_deserializing)]
824    #[default(Some("property"))]
825    pub r#type: Option<&'static str>,
826    /// The contact property name.
827    #[validate(length(min = 1u64))]
828    pub key: String,
829    pub operator: PropertyConditionOperator,
830    /// The comparison value. Omitted for value-less operators (e.g. `isTrue`, `empty`). A `{ from, to }` object for `between`.
831    pub value: Option<PropertyConditionValue>,
832}
833/// Matches contacts by mailing list opt-in status.
834#[serde_with::skip_serializing_none]
835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
836#[serde(default)]
837pub struct OptInCondition {
838    #[doc(hidden)]
839    #[serde(default, rename = "type", skip_deserializing)]
840    #[default(Some("optIn"))]
841    pub r#type: Option<&'static str>,
842    pub status: Option<Status>,
843}
844/// Matches contacts by their activity on a campaign or workflow.
845#[serde_with::skip_serializing_none]
846#[derive(
847    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
848)]
849#[serde(default)]
850pub struct ActivityCondition {
851    #[doc(hidden)]
852    #[serde(default, rename = "type", skip_deserializing)]
853    #[default(Some("activity"))]
854    pub r#type: Option<&'static str>,
855    pub action: ActivityConditionAction,
856    pub negate: bool,
857    pub target: ActivityConditionTarget,
858    /// The ID of the campaign, workflow, or workflow email.
859    #[validate(length(min = 1u64))]
860    pub id: String,
861}
862#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
863pub struct ListCampaignsResponse {
864    pub pagination: Pagination,
865    pub data: Vec<CampaignResponse>,
866}
867#[serde_with::skip_serializing_none]
868#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
869pub struct CreateCampaignRequest {
870    /// The campaign name.
871    #[validate(length(min = 1u64))]
872    pub name: String,
873    /// The ID of the group to add this campaign to. Defaults to the team's Unsorted group when omitted.
874    #[serde(rename = "campaignGroupId")]
875    pub campaign_group_id: Option<String>,
876    /// The ID of the mailing list to send to.
877    #[serde(rename = "mailingListId")]
878    pub mailing_list_id: Option<String>,
879    /// The ID of an audience segment. Setting this without also providing `audienceFilter` clears any existing `audienceFilter`. If both are provided, the filter is applied on top of the segment's filter.
880    #[serde(rename = "audienceSegmentId")]
881    pub audience_segment_id: Option<String>,
882    #[serde(rename = "audienceFilter")]
883    #[validate(nested)]
884    pub audience_filter: Option<AudienceFilterInRequest>,
885    /// When the campaign should send. `timestamp` is required and must be in the future when `method` is `schedule`, and must be omitted when `method` is `now`.
886    pub scheduling: Option<CampaignSchedulingRequest>,
887}
888#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
889#[serde(default)]
890pub struct CreateCampaignResponse {
891    /// The ID of the campaign.
892    pub id: String,
893    /// The URL of the campaign in the Loops app.
894    pub url: String,
895    /// The name of the campaign.
896    pub name: String,
897    /// The status of the campaign (always `Draft` for new campaigns).
898    #[default("Draft".to_string())]
899    pub status: String,
900    /// ISO 8601 timestamp for when the campaign was created.
901    #[serde(rename = "createdAt")]
902    pub created_at: chrono::DateTime<chrono::Utc>,
903    /// ISO 8601 timestamp for when the campaign was last updated.
904    #[serde(rename = "updatedAt")]
905    pub updated_at: chrono::DateTime<chrono::Utc>,
906    /// The ID of the empty email message created for this campaign. Use `POST /v1/email-messages/{emailMessageId}` to set its fields and LMX content.
907    #[serde(rename = "emailMessageId")]
908    pub email_message_id: Option<String>,
909    /// The `contentRevisionId` of the newly created email message. Pass this as `expectedRevisionId` on your first update.
910    #[serde(rename = "emailMessageContentRevisionId")]
911    pub email_message_content_revision_id: Option<String>,
912    /// The ID of the campaign group this campaign belongs to, if set.
913    #[serde(rename = "campaignGroupId")]
914    pub campaign_group_id: Option<String>,
915    /// The ID of the mailing list this campaign sends to, if set.
916    #[serde(rename = "mailingListId")]
917    pub mailing_list_id: Option<String>,
918    /// The ID of the audience segment this campaign targets, if set.
919    #[serde(rename = "audienceSegmentId")]
920    pub audience_segment_id: Option<String>,
921    /// The filter rules that define the audience for this campaign, if set.
922    #[serde(rename = "audienceFilter")]
923    pub audience_filter: Option<AudienceFilter>,
924    /// When the campaign is scheduled to send.
925    pub scheduling: CampaignScheduling,
926}
927/// At least one field must be provided.
928#[serde_with::skip_serializing_none]
929#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
930pub struct UpdateCampaignRequest {
931    /// The updated campaign name.
932    pub name: Option<String>,
933    /// The ID of the group to move this campaign to.
934    #[serde(rename = "campaignGroupId")]
935    pub campaign_group_id: Option<String>,
936    /// The ID of the mailing list to send to.
937    #[serde(rename = "mailingListId")]
938    pub mailing_list_id: Option<String>,
939    /// The ID of an audience segment. Setting this without also providing `audienceFilter` clears any existing `audienceFilter`. If both are provided, the filter is applied on top of the segment's filter.
940    #[serde(rename = "audienceSegmentId")]
941    pub audience_segment_id: Option<String>,
942    #[serde(rename = "audienceFilter")]
943    #[validate(nested)]
944    pub audience_filter: Option<AudienceFilterInRequest>,
945    /// When the campaign should send. `timestamp` is required and must be in the future when `method` is `schedule`, and must be omitted when `method` is `now`.
946    pub scheduling: Option<CampaignSchedulingRequest>,
947}
948#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
949pub struct CampaignResponse {
950    /// The ID of the campaign.
951    pub id: String,
952    /// The URL of the campaign in the Loops app.
953    pub url: String,
954    /// The name of the campaign.
955    pub name: String,
956    /// The status of the campaign.
957    pub status: Status2,
958    /// ISO 8601 timestamp for when the campaign was created.
959    #[serde(rename = "createdAt")]
960    pub created_at: chrono::DateTime<chrono::Utc>,
961    /// ISO 8601 timestamp for when the campaign was last updated.
962    #[serde(rename = "updatedAt")]
963    pub updated_at: chrono::DateTime<chrono::Utc>,
964    /// The associated email message ID.
965    #[serde(rename = "emailMessageId")]
966    pub email_message_id: Option<String>,
967    /// The ID of the campaign group this campaign belongs to.
968    #[serde(rename = "campaignGroupId")]
969    pub campaign_group_id: Option<String>,
970    /// The ID of the mailing list this campaign sends to, if set.
971    #[serde(rename = "mailingListId")]
972    pub mailing_list_id: Option<String>,
973    /// The ID of the audience segment this campaign targets, if set.
974    #[serde(rename = "audienceSegmentId")]
975    pub audience_segment_id: Option<String>,
976    /// The filter rules that define the audience for this campaign, if set.
977    #[serde(rename = "audienceFilter")]
978    pub audience_filter: Option<AudienceFilter>,
979    /// When the campaign is scheduled to send.
980    pub scheduling: CampaignScheduling,
981}
982#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
983pub struct CampaignFailureResponse {
984    pub message: String,
985}
986#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
987pub struct WorkflowSummary {
988    /// The ID of the workflow.
989    pub id: String,
990    /// The URL of the workflow in the Loops app.
991    pub url: String,
992    /// The name of the workflow.
993    pub name: String,
994    /// The ID of the workflow group this workflow belongs to.
995    #[serde(rename = "workflowGroupId")]
996    pub workflow_group_id: String,
997    /// ISO 8601 timestamp for when the workflow was created.
998    #[serde(rename = "createdAt")]
999    pub created_at: chrono::DateTime<chrono::Utc>,
1000    /// ISO 8601 timestamp for when the workflow was last updated.
1001    #[serde(rename = "updatedAt")]
1002    pub updated_at: chrono::DateTime<chrono::Utc>,
1003}
1004#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1005pub struct ListWorkflowsResponse {
1006    pub pagination: Pagination,
1007    pub data: Vec<WorkflowSummary>,
1008}
1009/// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1010pub type WorkflowRevisionId = serde_json::Value;
1011/// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation. Will be `null` for workflows without a revision token yet.
1012pub type NullableWorkflowRevisionId = Option<String>;
1013/// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1014pub type WorkflowReEligible = bool;
1015/// The IDs of the nodes that are downstream of this node.
1016pub type WorkflowNextNodeIds = Vec<String>;
1017/// The workflow revision token returned by the latest workflow read or mutation. Older workflows may return `null` before their first revision-aware mutation; pass `null` back as `expectedRevisionId` in that case. If the token is stale, the API returns a `409 Conflict` error.
1018pub type WorkflowExpectedRevisionId = Option<String>;
1019/// `fail` returns queued-contact impact instead of mutating. `discard` confirms that matching queued contacts should be discarded. Defaults to `fail` when omitted.
1020#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
1021pub enum WorkflowQueuedContactPolicy {
1022    #[serde(rename = "fail")]
1023    #[default]
1024    Fail,
1025    #[serde(rename = "discard")]
1026    Discard,
1027}
1028impl core::fmt::Display for WorkflowQueuedContactPolicy {
1029    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1030        match self {
1031            Self::Fail => write!(f, "fail"),
1032            Self::Discard => write!(f, "discard"),
1033        }
1034    }
1035}
1036#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1037pub struct SimplifiedWorkflow {
1038    /// The ID of the workflow.
1039    pub id: String,
1040    /// The URL of the workflow in the Loops app.
1041    pub url: String,
1042    #[serde(rename = "workflowRevisionId")]
1043    pub workflow_revision_id: Option<NullableWorkflowRevisionId>,
1044    pub status: SimplifiedWorkflowStatus,
1045    /// The name of the workflow.
1046    pub name: Option<String>,
1047    /// The description of the workflow.
1048    pub description: Option<String>,
1049    /// The ID of the workflow group this workflow belongs to.
1050    #[serde(rename = "workflowGroupId")]
1051    pub workflow_group_id: String,
1052    /// The ID of the mailing list the workflow sends to.
1053    #[serde(rename = "mailingListId")]
1054    pub mailing_list_id: Option<String>,
1055    /// The ID of the root node in the workflow graph.
1056    #[serde(rename = "rootNodeId")]
1057    pub root_node_id: String,
1058    /// A map of node IDs to simplified node objects. Each node includes `typeName` and `nextNodeIds`, plus type-specific fields when present. To get the full node object, use the `GET /v1/workflows/{workflowId}/nodes/{nodeId}` endpoint.
1059    /// - Example: `{"cf16k73gq014h3mmj5b6jdi9r":{"typeName":"SignupTrigger","nextNodeIds":["cf16k73gq014h3mmj5b4jdifg","cf16k73gq014h3mmj5b4jdifh"]}}`
1060    pub nodes: indexmap::IndexMap<String, Box<SimplifiedWorkflowNode>>,
1061}
1062#[serde_with::skip_serializing_none]
1063#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
1064pub struct CreateWorkflowRequest {
1065    /// The name of the workflow.
1066    #[validate(length(min = 1u64))]
1067    pub name: String,
1068    /// The description of the workflow.
1069    pub description: Option<String>,
1070    /// The ID of a mailing list the workflow sends to. After creation, the mailing list can be changed with the `/v1/workflows/{workflowId}/mailing-list` endpoint.
1071    #[serde(rename = "mailingListId")]
1072    pub mailing_list_id: Option<String>,
1073    /// The ID of the workflow group to create this workflow in. Defaults to the team's Unsorted group when omitted.
1074    #[serde(rename = "workflowGroupId")]
1075    pub workflow_group_id: Option<String>,
1076}
1077/// At least one property must be provided.
1078#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1079#[serde(untagged)]
1080pub enum UpdateWorkflowPropertiesRequest {
1081    #[default]
1082    Name(serde_json::Value),
1083    Description(serde_json::Value),
1084    WorkflowGroup(serde_json::Value),
1085}
1086#[serde_with::skip_serializing_none]
1087#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1088pub struct DeleteWorkflowRequest {
1089    #[serde(rename = "expectedRevisionId")]
1090    pub expected_revision_id: Option<WorkflowExpectedRevisionId>,
1091    /// Set to `true` after a confirmation-required `409 Conflict` response to confirm deleting a sending workflow or a workflow with queued contacts.
1092    #[serde(rename = "confirmDelete")]
1093    pub confirm_delete: Option<bool>,
1094}
1095/// Detailed workflow node returned from create and update mutations. The exact fields depend on `typeName`.
1096#[derive(Debug, Clone, PartialEq)]
1097pub enum WorkflowMutationNode {
1098    SignupTrigger(SignupTriggerWorkflowMutationNode),
1099    EventTrigger(EventTriggerWorkflowMutationNode),
1100    ContactPropertyTrigger(ContactPropertyTriggerWorkflowMutationNode),
1101    AddToListTrigger(AddToListTriggerWorkflowMutationNode),
1102    BlankTrigger(BlankTriggerWorkflowMutationNode),
1103    AudienceFilter(AudienceFilterWorkflowMutationNode),
1104    TimerAction(TimerActionWorkflowMutationNode),
1105    SendEmailAction(SendEmailActionWorkflowMutationNode),
1106    ExitAction(ExitActionWorkflowMutationNode),
1107    Branch(BranchWorkflowMutationNode),
1108    ExperimentBranch(ExperimentBranchWorkflowMutationNode),
1109    Variant(VariantWorkflowMutationNode),
1110}
1111impl WorkflowMutationNode {
1112    pub const DISCRIMINATOR_FIELD: &'static str = "typeName";
1113}
1114impl Default for WorkflowMutationNode {
1115    fn default() -> Self {
1116        Self::SignupTrigger(<SignupTriggerWorkflowMutationNode>::default())
1117    }
1118}
1119impl<'de> serde::Deserialize<'de> for WorkflowMutationNode {
1120    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
1121    where
1122        D: serde::Deserializer<'de>,
1123    {
1124        let value = serde_json::Value::deserialize(deserializer)?;
1125        match value
1126            .get(Self::DISCRIMINATOR_FIELD)
1127            .and_then(|v| v.as_str())
1128        {
1129            Some("SignupTrigger") => serde_json::from_value(value)
1130                .map(Self::SignupTrigger)
1131                .map_err(serde::de::Error::custom),
1132            Some("EventTrigger") => serde_json::from_value(value)
1133                .map(Self::EventTrigger)
1134                .map_err(serde::de::Error::custom),
1135            Some("ContactPropertyTrigger") => serde_json::from_value(value)
1136                .map(Self::ContactPropertyTrigger)
1137                .map_err(serde::de::Error::custom),
1138            Some("AddToListTrigger") => serde_json::from_value(value)
1139                .map(Self::AddToListTrigger)
1140                .map_err(serde::de::Error::custom),
1141            Some("BlankTrigger") => serde_json::from_value(value)
1142                .map(Self::BlankTrigger)
1143                .map_err(serde::de::Error::custom),
1144            Some("AudienceFilter") => serde_json::from_value(value)
1145                .map(Self::AudienceFilter)
1146                .map_err(serde::de::Error::custom),
1147            Some("TimerAction") => serde_json::from_value(value)
1148                .map(Self::TimerAction)
1149                .map_err(serde::de::Error::custom),
1150            Some("SendEmailAction") => serde_json::from_value(value)
1151                .map(Self::SendEmailAction)
1152                .map_err(serde::de::Error::custom),
1153            Some("ExitAction") => serde_json::from_value(value)
1154                .map(Self::ExitAction)
1155                .map_err(serde::de::Error::custom),
1156            Some("BranchNode") => serde_json::from_value(value)
1157                .map(Self::Branch)
1158                .map_err(serde::de::Error::custom),
1159            Some("ExperimentBranchNode") => serde_json::from_value(value)
1160                .map(Self::ExperimentBranch)
1161                .map_err(serde::de::Error::custom),
1162            Some("VariantNode") => serde_json::from_value(value)
1163                .map(Self::Variant)
1164                .map_err(serde::de::Error::custom),
1165            None => Err(serde::de::Error::missing_field(Self::DISCRIMINATOR_FIELD)),
1166            Some(other) => Err(serde::de::Error::custom(format!(
1167                "Unknown discriminator value '{}' for field '{}'",
1168                other, "typeName"
1169            ))),
1170        }
1171    }
1172}
1173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
1174pub struct WorkflowMutationNodeRevision {
1175    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1176    #[serde(rename = "workflowRevisionId")]
1177    pub workflow_revision_id: serde_json::Value,
1178}
1179#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1180#[serde(default)]
1181pub struct SignupTriggerWorkflowMutationNode {
1182    pub id: String,
1183    #[doc(hidden)]
1184    #[serde(default, rename = "typeName", skip_deserializing)]
1185    #[default(Some("SignupTrigger"))]
1186    pub type_name: Option<&'static str>,
1187    /// The IDs of the nodes that are downstream of this node.
1188    #[serde(rename = "nextNodeIds")]
1189    pub next_node_ids: Vec<String>,
1190}
1191#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1192#[serde(default)]
1193pub struct EventTriggerWorkflowMutationNode {
1194    pub id: String,
1195    #[doc(hidden)]
1196    #[serde(default, rename = "typeName", skip_deserializing)]
1197    #[default(Some("EventTrigger"))]
1198    pub type_name: Option<&'static str>,
1199    /// The IDs of the nodes that are downstream of this node.
1200    #[serde(rename = "nextNodeIds")]
1201    pub next_node_ids: Vec<String>,
1202    /// The name of the event pattern that triggers this node.
1203    #[serde(rename = "eventName")]
1204    pub event_name: Option<String>,
1205    /// The properties of the event pattern, which can be used in emails.
1206    #[serde(rename = "eventProperties")]
1207    pub event_properties: Option<Vec<WorkflowEventProperty>>,
1208    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1209    #[serde(rename = "reEligible")]
1210    pub re_eligible: bool,
1211}
1212#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1213#[serde(default)]
1214pub struct ContactPropertyTriggerWorkflowMutationNode {
1215    pub id: String,
1216    #[doc(hidden)]
1217    #[serde(default, rename = "typeName", skip_deserializing)]
1218    #[default(Some("ContactPropertyTrigger"))]
1219    pub type_name: Option<&'static str>,
1220    /// The IDs of the nodes that are downstream of this node.
1221    #[serde(rename = "nextNodeIds")]
1222    pub next_node_ids: Vec<String>,
1223    #[serde(rename = "contactPropertyQuery")]
1224    pub contact_property_query: Option<WorkflowContactPropertyQuery>,
1225    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1226    #[serde(rename = "reEligible")]
1227    pub re_eligible: bool,
1228}
1229#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1230#[serde(default)]
1231pub struct AddToListTriggerWorkflowMutationNode {
1232    pub id: String,
1233    #[doc(hidden)]
1234    #[serde(default, rename = "typeName", skip_deserializing)]
1235    #[default(Some("AddToListTrigger"))]
1236    pub type_name: Option<&'static str>,
1237    /// The IDs of the nodes that are downstream of this node.
1238    #[serde(rename = "nextNodeIds")]
1239    pub next_node_ids: Vec<String>,
1240    /// The ID of the mailing list this trigger sends to, if set.
1241    #[serde(rename = "mailingListId")]
1242    pub mailing_list_id: Option<String>,
1243    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1244    #[serde(rename = "reEligible")]
1245    pub re_eligible: bool,
1246}
1247#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1248#[serde(default)]
1249pub struct BlankTriggerWorkflowMutationNode {
1250    pub id: String,
1251    #[doc(hidden)]
1252    #[serde(default, rename = "typeName", skip_deserializing)]
1253    #[default(Some("BlankTrigger"))]
1254    pub type_name: Option<&'static str>,
1255    /// The IDs of the nodes that are downstream of this node.
1256    #[serde(rename = "nextNodeIds")]
1257    pub next_node_ids: Vec<String>,
1258}
1259#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1260#[serde(default)]
1261pub struct AudienceFilterWorkflowMutationNode {
1262    pub id: String,
1263    #[doc(hidden)]
1264    #[serde(default, rename = "typeName", skip_deserializing)]
1265    #[default(Some("AudienceFilter"))]
1266    pub type_name: Option<&'static str>,
1267    /// The IDs of the nodes that are downstream of this node.
1268    #[serde(rename = "nextNodeIds")]
1269    pub next_node_ids: Vec<String>,
1270    #[serde(rename = "audienceFilter")]
1271    pub audience_filter: Option<AudienceFilter>,
1272    /// The ID of the audience segment this trigger targets.
1273    #[serde(rename = "audienceSegmentId")]
1274    pub audience_segment_id: Option<String>,
1275    /// If `true`, the audience filter will apply to all downstream nodes. If `false`, the audience filter will only apply to the current node. Matches the "Filter scope" option in the UI.
1276    #[serde(rename = "appliesDownstream")]
1277    pub applies_downstream: bool,
1278}
1279#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1280#[serde(default)]
1281pub struct TimerActionWorkflowMutationNode {
1282    pub id: String,
1283    #[doc(hidden)]
1284    #[serde(default, rename = "typeName", skip_deserializing)]
1285    #[default(Some("TimerAction"))]
1286    pub type_name: Option<&'static str>,
1287    /// The IDs of the nodes that are downstream of this node.
1288    #[serde(rename = "nextNodeIds")]
1289    pub next_node_ids: Vec<String>,
1290    /// The amount of time to wait before triggering the next node. Set to `0` to move to the next node immediately.
1291    pub amount: f64,
1292    /// The unit of time for the timer action node. m = minutes, h = hours, d = days.
1293    pub unit: WorkflowTimerUnit,
1294}
1295#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1296#[serde(default)]
1297pub struct SendEmailActionWorkflowMutationNode {
1298    pub id: String,
1299    #[doc(hidden)]
1300    #[serde(default, rename = "typeName", skip_deserializing)]
1301    #[default(Some("SendEmailAction"))]
1302    pub type_name: Option<&'static str>,
1303    /// The IDs of the nodes that are downstream of this node.
1304    #[serde(rename = "nextNodeIds")]
1305    pub next_node_ids: Vec<String>,
1306    /// The ID of the email message to send. To edit this email, use the `POST /v1/email-messages/{emailMessageId}` endpoint.
1307    #[serde(rename = "emailMessageId")]
1308    pub email_message_id: String,
1309    pub subject: String,
1310}
1311#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1312#[serde(default)]
1313pub struct ExitActionWorkflowMutationNode {
1314    pub id: String,
1315    #[doc(hidden)]
1316    #[serde(default, rename = "typeName", skip_deserializing)]
1317    #[default(Some("ExitAction"))]
1318    pub type_name: Option<&'static str>,
1319    /// The IDs of the nodes that are downstream of this node.
1320    #[serde(rename = "nextNodeIds")]
1321    pub next_node_ids: Vec<String>,
1322}
1323#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1324#[serde(default)]
1325pub struct BranchWorkflowMutationNode {
1326    pub id: String,
1327    #[doc(hidden)]
1328    #[serde(default, rename = "typeName", skip_deserializing)]
1329    #[default(Some("BranchNode"))]
1330    pub type_name: Option<&'static str>,
1331    /// The IDs of the nodes that are downstream of this node.
1332    #[serde(rename = "nextNodeIds")]
1333    pub next_node_ids: Vec<String>,
1334}
1335#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1336#[serde(default)]
1337pub struct ExperimentBranchWorkflowMutationNode {
1338    pub id: String,
1339    #[doc(hidden)]
1340    #[serde(default, rename = "typeName", skip_deserializing)]
1341    #[default(Some("ExperimentBranchNode"))]
1342    pub type_name: Option<&'static str>,
1343    /// The IDs of the nodes that are downstream of this node.
1344    #[serde(rename = "nextNodeIds")]
1345    pub next_node_ids: Vec<String>,
1346    /// The percentage of contacts that will be sent to variant branches, between `0` and `100`. The remaining percentage will be sent to the control branch. `100` sends all contacts to variant branches.
1347    #[serde(rename = "samplingRate")]
1348    pub sampling_rate: f64,
1349}
1350#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1351#[serde(default)]
1352pub struct VariantWorkflowMutationNode {
1353    pub id: String,
1354    #[doc(hidden)]
1355    #[serde(default, rename = "typeName", skip_deserializing)]
1356    #[default(Some("VariantNode"))]
1357    pub type_name: Option<&'static str>,
1358    /// The IDs of the nodes that are downstream of this node.
1359    #[serde(rename = "nextNodeIds")]
1360    pub next_node_ids: Vec<String>,
1361    /// Whether this is the control variant of an experiment.
1362    #[serde(rename = "isControl")]
1363    pub is_control: Option<bool>,
1364}
1365/// Node-type-specific fields to update. The allowed fields depend on the existing node type. Trigger node updates may include `typeName` when changing one trigger node type to another trigger node type.
1366#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1367#[serde(untagged)]
1368pub enum UpdateWorkflowNodePayload {
1369    /// Changes an existing trigger node to a signup trigger.
1370    #[default]
1371    SignupTrigger(WorkflowSignupTriggerPayload),
1372    /// Updates an event trigger, or changes an existing trigger node to an event trigger. Assign the event pattern with either `eventPatternId` or `eventName`, not both. Set either field to `null` to clear the event-pattern relationship.
1373    EventTrigger(WorkflowEventTriggerPayload),
1374    /// Updates a contact-property trigger, or changes an existing trigger node to a contact-property trigger.
1375    ContactPropertyTrigger(WorkflowContactPropertyTriggerPayload),
1376    /// Updates an add-to-list trigger, or changes an existing trigger node to an add-to-list trigger.
1377    AddToListTrigger(WorkflowAddToListTriggerPayload),
1378    /// Configuration for the audience filter node.
1379    AudienceFilter(WorkflowAudienceFilterPayload),
1380    /// Configuration for the timer action node.
1381    TimerAction(WorkflowTimerActionPayload),
1382    /// Configuration for the experiment branch node.
1383    ExperimentBranch(WorkflowExperimentBranchPayload),
1384    /// Configuration for the variant node.
1385    Variant(WorkflowVariantPayload),
1386}
1387/// Changes an existing trigger node to a signup trigger.
1388#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1389#[serde(default)]
1390pub struct WorkflowSignupTriggerPayload {
1391    #[serde(rename = "typeName")]
1392    #[default("SignupTrigger".to_string())]
1393    pub type_name: String,
1394}
1395/// Updates an event trigger, or changes an existing trigger node to an event trigger. Assign the event pattern with either `eventPatternId` or `eventName`, not both. Set either field to `null` to clear the event-pattern relationship.
1396#[serde_with::skip_serializing_none]
1397#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1398#[serde(default)]
1399pub struct WorkflowEventTriggerPayload {
1400    #[serde(rename = "typeName")]
1401    #[default(Some("EventTrigger".to_string()))]
1402    pub type_name: Option<String>,
1403    /// The ID of the event pattern to trigger on. Use either `eventPatternId` or `eventName`, not both. Set to `null` to clear the event-pattern relationship.
1404    #[serde(rename = "eventPatternId")]
1405    pub event_pattern_id: Option<String>,
1406    /// The name of the event pattern to trigger on. Use this when you know the event name but not the internal event pattern ID. Use either `eventName` or `eventPatternId`, not both. Set to `null` to clear the event-pattern relationship.
1407    #[serde(rename = "eventName")]
1408    pub event_name: Option<String>,
1409    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1410    #[serde(rename = "reEligible")]
1411    pub re_eligible: Option<bool>,
1412}
1413/// Updates a contact-property trigger, or changes an existing trigger node to a contact-property trigger.
1414#[serde_with::skip_serializing_none]
1415#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
1416#[serde(default)]
1417pub struct WorkflowContactPropertyTriggerPayload {
1418    #[serde(rename = "typeName")]
1419    #[default(Some("ContactPropertyTrigger".to_string()))]
1420    pub type_name: Option<String>,
1421    /// Define the contact property change that triggers the workflow. In update requests, `key` must resolve to an existing contact property that is available for Contact Updated triggers. Hidden or unsupported fields, such as `createdAt`, `notes`, and computed contact properties, are rejected.
1422    #[serde(rename = "contactPropertyQuery")]
1423    #[validate(nested)]
1424    pub contact_property_query: Option<WorkflowContactPropertyQuery>,
1425    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1426    #[serde(rename = "reEligible")]
1427    pub re_eligible: Option<bool>,
1428}
1429/// Updates an add-to-list trigger, or changes an existing trigger node to an add-to-list trigger.
1430#[serde_with::skip_serializing_none]
1431#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1432#[serde(default)]
1433pub struct WorkflowAddToListTriggerPayload {
1434    #[serde(rename = "typeName")]
1435    #[default(Some("AddToListTrigger".to_string()))]
1436    pub type_name: Option<String>,
1437    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1438    #[serde(rename = "reEligible")]
1439    pub re_eligible: Option<bool>,
1440}
1441/// Configuration for the audience filter node.
1442#[serde_with::skip_serializing_none]
1443#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
1444pub struct WorkflowAudienceFilterPayload {
1445    /// The ID of an audience segment. Setting this without also providing `audienceFilter` clears any existing `audienceFilter`. If both are provided, the filter is applied on top of the segment's filter.
1446    #[serde(rename = "audienceSegmentId")]
1447    pub audience_segment_id: Option<String>,
1448    #[serde(rename = "audienceFilter")]
1449    #[validate(nested)]
1450    pub audience_filter: Option<AudienceFilterInRequest>,
1451    /// If `true`, the audience filter will apply to all downstream nodes. If `false`, the audience filter will only apply to the current node. Matches the "Filter scope" option in the UI.
1452    #[serde(rename = "appliesDownstream")]
1453    pub applies_downstream: Option<bool>,
1454}
1455/// Configuration for the timer action node.
1456#[serde_with::skip_serializing_none]
1457#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1458pub struct WorkflowTimerActionPayload {
1459    /// The amount of time to wait before triggering the next node. Set to `0` to move to the next node immediately.
1460    pub amount: Option<f64>,
1461    /// The unit of time for the timer action node. m = minutes, h = hours, d = days.
1462    pub unit: Option<WorkflowTimerUnit>,
1463}
1464/// Configuration for the experiment branch node.
1465#[serde_with::skip_serializing_none]
1466#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1467pub struct WorkflowExperimentBranchPayload {
1468    /// The percentage of contacts that will be sent to variant branches, between `0` and `100`. The remaining percentage will be sent to the control branch. `100` sends all contacts to variant branches.
1469    #[serde(rename = "samplingRate")]
1470    pub sampling_rate: Option<f64>,
1471}
1472/// Configuration for the variant node.
1473#[serde_with::skip_serializing_none]
1474#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1475pub struct WorkflowVariantPayload {
1476    /// Use `true` to set this variant as the control of the experiment. This will set `false` on the existing control, if one exists. Experiments do not require a control variant.
1477    #[serde(rename = "isControl")]
1478    pub is_control: Option<bool>,
1479}
1480/// Node types that can be created with the API. `*Trigger` nodes and `ExitAction` nodes cannot be created.
1481#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, oas3_gen_support::Default)]
1482pub enum CreateWorkflowNodeTypeName {
1483    #[default]
1484    AudienceFilter,
1485    BranchNode,
1486    ExperimentBranchNode,
1487    TimerAction,
1488    SendEmailAction,
1489    VariantNode,
1490}
1491impl core::fmt::Display for CreateWorkflowNodeTypeName {
1492    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1493        match self {
1494            Self::AudienceFilter => write!(f, "AudienceFilter"),
1495            Self::BranchNode => write!(f, "BranchNode"),
1496            Self::ExperimentBranchNode => write!(f, "ExperimentBranchNode"),
1497            Self::TimerAction => write!(f, "TimerAction"),
1498            Self::SendEmailAction => write!(f, "SendEmailAction"),
1499            Self::VariantNode => write!(f, "VariantNode"),
1500        }
1501    }
1502}
1503/// Insert a new node between two existing nodes, `fromNodeId` and `toNodeId`. When `fromNodeId` is an `ExperimentBranchNode`, `nodeTypeName` must be `VariantNode`, and `toNodeId` cannot already be a `VariantNode`; use add-branch to add sibling variants. Branch paths can be edited with create-node, but a workflow cannot be started unless each direct `BranchNode` child is an `AudienceFilter`.
1504#[serde_with::skip_serializing_none]
1505#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
1506#[serde(default)]
1507pub struct CreateWorkflowNodeBetweenRequest {
1508    #[serde(rename = "expectedRevisionId")]
1509    pub expected_revision_id: Option<WorkflowExpectedRevisionId>,
1510    #[doc(hidden)]
1511    #[serde(default, rename = "insertMode", skip_deserializing)]
1512    #[default(Some("between"))]
1513    pub insert_mode: Option<&'static str>,
1514    /// Node types that can be created with the API. `*Trigger` nodes and `ExitAction` nodes cannot be created.
1515    #[serde(rename = "nodeTypeName")]
1516    pub node_type_name: CreateWorkflowNodeTypeName,
1517    /// The node to insert after. This node must currently point to `toNodeId`. If this is an `ExperimentBranchNode`, `nodeTypeName` must be `VariantNode` and `toNodeId` cannot already be a `VariantNode`.
1518    #[serde(rename = "fromNodeId")]
1519    #[validate(length(min = 1u64))]
1520    pub from_node_id: String,
1521    /// The node to insert before.
1522    #[serde(rename = "toNodeId")]
1523    #[validate(length(min = 1u64))]
1524    pub to_node_id: String,
1525}
1526/// Insert a new node before `toNodeId`. `VariantNode` cannot use `insertMode: "before"`; to restore a missing variant path, use `insertMode: "between"` with the experiment branch as `fromNodeId`.
1527#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1528#[serde(untagged)]
1529pub enum CreateWorkflowNodeBeforeRequest {
1530    #[default]
1531    TargetNode(CreateWorkflowNodeBeforeRequestTargetNode),
1532    Deprecated(CreateWorkflowNodeBeforeRequestTargetNodeDeprecated),
1533}
1534/// Insert a new node after `fromNodeId`. This is valid only when `fromNodeId` has exactly one outgoing node. It is invalid when `fromNodeId` has no outgoing nodes, multiple outgoing nodes, or is an exit node. When the source has multiple outgoing nodes, use `between` with the exact `toNodeId` instead.
1535#[serde_with::skip_serializing_none]
1536#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
1537#[serde(default)]
1538pub struct CreateWorkflowNodeAfterRequest {
1539    #[serde(rename = "expectedRevisionId")]
1540    pub expected_revision_id: Option<WorkflowExpectedRevisionId>,
1541    #[doc(hidden)]
1542    #[serde(default, rename = "insertMode", skip_deserializing)]
1543    #[default(Some("after"))]
1544    pub insert_mode: Option<&'static str>,
1545    /// Node types that can be created with the API. `*Trigger` nodes and `ExitAction` nodes cannot be created.
1546    #[serde(rename = "nodeTypeName")]
1547    pub node_type_name: CreateWorkflowNodeTypeName,
1548    /// The node to insert after. This node must currently have exactly one outgoing node.
1549    #[serde(rename = "fromNodeId")]
1550    #[validate(length(min = 1u64))]
1551    pub from_node_id: String,
1552}
1553/// Create a new workflow node with an explicit `insertMode`. To configure the node after creation, use the `POST /v1/workflows/{workflowId}/nodes/{nodeId}` endpoint.
1554#[derive(Debug, Clone, PartialEq)]
1555pub enum CreateWorkflowNodeRequest {
1556    Between(CreateWorkflowNodeBetweenRequest),
1557    Before(CreateWorkflowNodeBeforeRequest),
1558    After(CreateWorkflowNodeAfterRequest),
1559}
1560impl CreateWorkflowNodeRequest {
1561    pub const DISCRIMINATOR_FIELD: &'static str = "insertMode";
1562}
1563impl Default for CreateWorkflowNodeRequest {
1564    fn default() -> Self {
1565        Self::Between(<CreateWorkflowNodeBetweenRequest>::default())
1566    }
1567}
1568impl serde::Serialize for CreateWorkflowNodeRequest {
1569    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
1570    where
1571        S: serde::Serializer,
1572    {
1573        match self {
1574            Self::Between(v) => v.serialize(serializer),
1575            Self::Before(v) => v.serialize(serializer),
1576            Self::After(v) => v.serialize(serializer),
1577        }
1578    }
1579}
1580/// Detailed workflow node returned from a mutation, plus the latest workflow revision token.
1581#[derive(Debug, Clone, PartialEq)]
1582pub enum WorkflowMutationNodeWithRevision {
1583    SignupTrigger(SignupTriggerWorkflowMutationNodeWithRevision),
1584    EventTrigger(EventTriggerWorkflowMutationNodeWithRevision),
1585    ContactPropertyTrigger(ContactPropertyTriggerWorkflowMutationNodeWithRevision),
1586    AddToListTrigger(AddToListTriggerWorkflowMutationNodeWithRevision),
1587    BlankTrigger(BlankTriggerWorkflowMutationNodeWithRevision),
1588    AudienceFilter(AudienceFilterWorkflowMutationNodeWithRevision),
1589    TimerAction(TimerActionWorkflowMutationNodeWithRevision),
1590    SendEmailAction(SendEmailActionWorkflowMutationNodeWithRevision),
1591    ExitAction(ExitActionWorkflowMutationNodeWithRevision),
1592    Branch(BranchWorkflowMutationNodeWithRevision),
1593    ExperimentBranch(ExperimentBranchWorkflowMutationNodeWithRevision),
1594    Variant(VariantWorkflowMutationNodeWithRevision),
1595}
1596impl WorkflowMutationNodeWithRevision {
1597    pub const DISCRIMINATOR_FIELD: &'static str = "typeName";
1598}
1599impl Default for WorkflowMutationNodeWithRevision {
1600    fn default() -> Self {
1601        Self::SignupTrigger(<SignupTriggerWorkflowMutationNodeWithRevision>::default())
1602    }
1603}
1604impl<'de> serde::Deserialize<'de> for WorkflowMutationNodeWithRevision {
1605    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
1606    where
1607        D: serde::Deserializer<'de>,
1608    {
1609        let value = serde_json::Value::deserialize(deserializer)?;
1610        match value
1611            .get(Self::DISCRIMINATOR_FIELD)
1612            .and_then(|v| v.as_str())
1613        {
1614            Some("SignupTrigger") => serde_json::from_value(value)
1615                .map(Self::SignupTrigger)
1616                .map_err(serde::de::Error::custom),
1617            Some("EventTrigger") => serde_json::from_value(value)
1618                .map(Self::EventTrigger)
1619                .map_err(serde::de::Error::custom),
1620            Some("ContactPropertyTrigger") => serde_json::from_value(value)
1621                .map(Self::ContactPropertyTrigger)
1622                .map_err(serde::de::Error::custom),
1623            Some("AddToListTrigger") => serde_json::from_value(value)
1624                .map(Self::AddToListTrigger)
1625                .map_err(serde::de::Error::custom),
1626            Some("BlankTrigger") => serde_json::from_value(value)
1627                .map(Self::BlankTrigger)
1628                .map_err(serde::de::Error::custom),
1629            Some("AudienceFilter") => serde_json::from_value(value)
1630                .map(Self::AudienceFilter)
1631                .map_err(serde::de::Error::custom),
1632            Some("TimerAction") => serde_json::from_value(value)
1633                .map(Self::TimerAction)
1634                .map_err(serde::de::Error::custom),
1635            Some("SendEmailAction") => serde_json::from_value(value)
1636                .map(Self::SendEmailAction)
1637                .map_err(serde::de::Error::custom),
1638            Some("ExitAction") => serde_json::from_value(value)
1639                .map(Self::ExitAction)
1640                .map_err(serde::de::Error::custom),
1641            Some("BranchNode") => serde_json::from_value(value)
1642                .map(Self::Branch)
1643                .map_err(serde::de::Error::custom),
1644            Some("ExperimentBranchNode") => serde_json::from_value(value)
1645                .map(Self::ExperimentBranch)
1646                .map_err(serde::de::Error::custom),
1647            Some("VariantNode") => serde_json::from_value(value)
1648                .map(Self::Variant)
1649                .map_err(serde::de::Error::custom),
1650            None => Err(serde::de::Error::missing_field(Self::DISCRIMINATOR_FIELD)),
1651            Some(other) => Err(serde::de::Error::custom(format!(
1652                "Unknown discriminator value '{}' for field '{}'",
1653                other, "typeName"
1654            ))),
1655        }
1656    }
1657}
1658#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1659#[serde(default)]
1660pub struct SignupTriggerWorkflowMutationNodeWithRevision {
1661    pub id: String,
1662    #[doc(hidden)]
1663    #[serde(default, rename = "typeName", skip_deserializing)]
1664    #[default(Some("SignupTrigger"))]
1665    pub type_name: Option<&'static str>,
1666    /// The IDs of the nodes that are downstream of this node.
1667    #[serde(rename = "nextNodeIds")]
1668    pub next_node_ids: Vec<String>,
1669    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1670    #[serde(rename = "workflowRevisionId")]
1671    pub workflow_revision_id: serde_json::Value,
1672}
1673#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1674#[serde(default)]
1675pub struct EventTriggerWorkflowMutationNodeWithRevision {
1676    pub id: String,
1677    #[doc(hidden)]
1678    #[serde(default, rename = "typeName", skip_deserializing)]
1679    #[default(Some("EventTrigger"))]
1680    pub type_name: Option<&'static str>,
1681    /// The IDs of the nodes that are downstream of this node.
1682    #[serde(rename = "nextNodeIds")]
1683    pub next_node_ids: Vec<String>,
1684    /// The name of the event pattern that triggers this node.
1685    #[serde(rename = "eventName")]
1686    pub event_name: Option<String>,
1687    /// The properties of the event pattern, which can be used in emails.
1688    #[serde(rename = "eventProperties")]
1689    pub event_properties: Option<Vec<WorkflowEventProperty>>,
1690    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1691    #[serde(rename = "reEligible")]
1692    pub re_eligible: bool,
1693    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1694    #[serde(rename = "workflowRevisionId")]
1695    pub workflow_revision_id: serde_json::Value,
1696}
1697#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1698#[serde(default)]
1699pub struct ContactPropertyTriggerWorkflowMutationNodeWithRevision {
1700    pub id: String,
1701    #[doc(hidden)]
1702    #[serde(default, rename = "typeName", skip_deserializing)]
1703    #[default(Some("ContactPropertyTrigger"))]
1704    pub type_name: Option<&'static str>,
1705    /// The IDs of the nodes that are downstream of this node.
1706    #[serde(rename = "nextNodeIds")]
1707    pub next_node_ids: Vec<String>,
1708    #[serde(rename = "contactPropertyQuery")]
1709    pub contact_property_query: Option<WorkflowContactPropertyQuery>,
1710    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1711    #[serde(rename = "reEligible")]
1712    pub re_eligible: bool,
1713    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1714    #[serde(rename = "workflowRevisionId")]
1715    pub workflow_revision_id: serde_json::Value,
1716}
1717#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1718#[serde(default)]
1719pub struct AddToListTriggerWorkflowMutationNodeWithRevision {
1720    pub id: String,
1721    #[doc(hidden)]
1722    #[serde(default, rename = "typeName", skip_deserializing)]
1723    #[default(Some("AddToListTrigger"))]
1724    pub type_name: Option<&'static str>,
1725    /// The IDs of the nodes that are downstream of this node.
1726    #[serde(rename = "nextNodeIds")]
1727    pub next_node_ids: Vec<String>,
1728    /// The ID of the mailing list this trigger sends to, if set.
1729    #[serde(rename = "mailingListId")]
1730    pub mailing_list_id: Option<String>,
1731    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
1732    #[serde(rename = "reEligible")]
1733    pub re_eligible: bool,
1734    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1735    #[serde(rename = "workflowRevisionId")]
1736    pub workflow_revision_id: serde_json::Value,
1737}
1738#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1739#[serde(default)]
1740pub struct BlankTriggerWorkflowMutationNodeWithRevision {
1741    pub id: String,
1742    #[doc(hidden)]
1743    #[serde(default, rename = "typeName", skip_deserializing)]
1744    #[default(Some("BlankTrigger"))]
1745    pub type_name: Option<&'static str>,
1746    /// The IDs of the nodes that are downstream of this node.
1747    #[serde(rename = "nextNodeIds")]
1748    pub next_node_ids: Vec<String>,
1749    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1750    #[serde(rename = "workflowRevisionId")]
1751    pub workflow_revision_id: serde_json::Value,
1752}
1753#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1754#[serde(default)]
1755pub struct AudienceFilterWorkflowMutationNodeWithRevision {
1756    pub id: String,
1757    #[doc(hidden)]
1758    #[serde(default, rename = "typeName", skip_deserializing)]
1759    #[default(Some("AudienceFilter"))]
1760    pub type_name: Option<&'static str>,
1761    /// The IDs of the nodes that are downstream of this node.
1762    #[serde(rename = "nextNodeIds")]
1763    pub next_node_ids: Vec<String>,
1764    #[serde(rename = "audienceFilter")]
1765    pub audience_filter: Option<AudienceFilter>,
1766    /// The ID of the audience segment this trigger targets.
1767    #[serde(rename = "audienceSegmentId")]
1768    pub audience_segment_id: Option<String>,
1769    /// If `true`, the audience filter will apply to all downstream nodes. If `false`, the audience filter will only apply to the current node. Matches the "Filter scope" option in the UI.
1770    #[serde(rename = "appliesDownstream")]
1771    pub applies_downstream: bool,
1772    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1773    #[serde(rename = "workflowRevisionId")]
1774    pub workflow_revision_id: serde_json::Value,
1775}
1776#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1777#[serde(default)]
1778pub struct TimerActionWorkflowMutationNodeWithRevision {
1779    pub id: String,
1780    #[doc(hidden)]
1781    #[serde(default, rename = "typeName", skip_deserializing)]
1782    #[default(Some("TimerAction"))]
1783    pub type_name: Option<&'static str>,
1784    /// The IDs of the nodes that are downstream of this node.
1785    #[serde(rename = "nextNodeIds")]
1786    pub next_node_ids: Vec<String>,
1787    /// The amount of time to wait before triggering the next node. Set to `0` to move to the next node immediately.
1788    pub amount: f64,
1789    /// The unit of time for the timer action node. m = minutes, h = hours, d = days.
1790    pub unit: WorkflowTimerUnit,
1791    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1792    #[serde(rename = "workflowRevisionId")]
1793    pub workflow_revision_id: serde_json::Value,
1794}
1795#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1796#[serde(default)]
1797pub struct SendEmailActionWorkflowMutationNodeWithRevision {
1798    pub id: String,
1799    #[doc(hidden)]
1800    #[serde(default, rename = "typeName", skip_deserializing)]
1801    #[default(Some("SendEmailAction"))]
1802    pub type_name: Option<&'static str>,
1803    /// The IDs of the nodes that are downstream of this node.
1804    #[serde(rename = "nextNodeIds")]
1805    pub next_node_ids: Vec<String>,
1806    /// The ID of the email message to send. To edit this email, use the `POST /v1/email-messages/{emailMessageId}` endpoint.
1807    #[serde(rename = "emailMessageId")]
1808    pub email_message_id: String,
1809    pub subject: String,
1810    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1811    #[serde(rename = "workflowRevisionId")]
1812    pub workflow_revision_id: serde_json::Value,
1813}
1814#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1815#[serde(default)]
1816pub struct ExitActionWorkflowMutationNodeWithRevision {
1817    pub id: String,
1818    #[doc(hidden)]
1819    #[serde(default, rename = "typeName", skip_deserializing)]
1820    #[default(Some("ExitAction"))]
1821    pub type_name: Option<&'static str>,
1822    /// The IDs of the nodes that are downstream of this node.
1823    #[serde(rename = "nextNodeIds")]
1824    pub next_node_ids: Vec<String>,
1825    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1826    #[serde(rename = "workflowRevisionId")]
1827    pub workflow_revision_id: serde_json::Value,
1828}
1829#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1830#[serde(default)]
1831pub struct BranchWorkflowMutationNodeWithRevision {
1832    pub id: String,
1833    #[doc(hidden)]
1834    #[serde(default, rename = "typeName", skip_deserializing)]
1835    #[default(Some("BranchNode"))]
1836    pub type_name: Option<&'static str>,
1837    /// The IDs of the nodes that are downstream of this node.
1838    #[serde(rename = "nextNodeIds")]
1839    pub next_node_ids: Vec<String>,
1840    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1841    #[serde(rename = "workflowRevisionId")]
1842    pub workflow_revision_id: serde_json::Value,
1843}
1844#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1845#[serde(default)]
1846pub struct ExperimentBranchWorkflowMutationNodeWithRevision {
1847    pub id: String,
1848    #[doc(hidden)]
1849    #[serde(default, rename = "typeName", skip_deserializing)]
1850    #[default(Some("ExperimentBranchNode"))]
1851    pub type_name: Option<&'static str>,
1852    /// The IDs of the nodes that are downstream of this node.
1853    #[serde(rename = "nextNodeIds")]
1854    pub next_node_ids: Vec<String>,
1855    /// The percentage of contacts that will be sent to variant branches, between `0` and `100`. The remaining percentage will be sent to the control branch. `100` sends all contacts to variant branches.
1856    #[serde(rename = "samplingRate")]
1857    pub sampling_rate: f64,
1858    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1859    #[serde(rename = "workflowRevisionId")]
1860    pub workflow_revision_id: serde_json::Value,
1861}
1862#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1863#[serde(default)]
1864pub struct VariantWorkflowMutationNodeWithRevision {
1865    pub id: String,
1866    #[doc(hidden)]
1867    #[serde(default, rename = "typeName", skip_deserializing)]
1868    #[default(Some("VariantNode"))]
1869    pub type_name: Option<&'static str>,
1870    /// The IDs of the nodes that are downstream of this node.
1871    #[serde(rename = "nextNodeIds")]
1872    pub next_node_ids: Vec<String>,
1873    /// Whether this is the control variant of an experiment.
1874    #[serde(rename = "isControl")]
1875    pub is_control: Option<bool>,
1876    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
1877    #[serde(rename = "workflowRevisionId")]
1878    pub workflow_revision_id: serde_json::Value,
1879}
1880#[derive(Debug, Clone, PartialEq)]
1881pub enum CreatedWorkflowNode {
1882    SignupTriggerWorkflowMutationNodeWithRevision(
1883        Box<SignupTriggerWorkflowMutationNodeWithRevision>,
1884    ),
1885    EventTriggerWorkflowMutationNodeWithRevision(Box<EventTriggerWorkflowMutationNodeWithRevision>),
1886    ContactPropertyTriggerWorkflowMutationNodeWithRevision(
1887        Box<ContactPropertyTriggerWorkflowMutationNodeWithRevision>,
1888    ),
1889    AddToListTriggerWorkflowMutationNodeWithRevision(
1890        Box<AddToListTriggerWorkflowMutationNodeWithRevision>,
1891    ),
1892    BlankTriggerWorkflowMutationNodeWithRevision(Box<BlankTriggerWorkflowMutationNodeWithRevision>),
1893    AudienceFilterWorkflowMutationNodeWithRevision(
1894        Box<AudienceFilterWorkflowMutationNodeWithRevision>,
1895    ),
1896    TimerActionWorkflowMutationNodeWithRevision(Box<TimerActionWorkflowMutationNodeWithRevision>),
1897    SendEmailActionWorkflowMutationNodeWithRevision(
1898        Box<SendEmailActionWorkflowMutationNodeWithRevision>,
1899    ),
1900    ExitActionWorkflowMutationNodeWithRevision(Box<ExitActionWorkflowMutationNodeWithRevision>),
1901    BranchWorkflowMutationNodeWithRevision(Box<BranchWorkflowMutationNodeWithRevision>),
1902    ExperimentBranchWorkflowMutationNodeWithRevision(
1903        Box<ExperimentBranchWorkflowMutationNodeWithRevision>,
1904    ),
1905    VariantWorkflowMutationNodeWithRevision(Box<VariantWorkflowMutationNodeWithRevision>),
1906    Node(Box<CreatedWorkflowNodeBase>),
1907}
1908impl CreatedWorkflowNode {
1909    pub const DISCRIMINATOR_FIELD: &'static str = "typeName";
1910}
1911impl Default for CreatedWorkflowNode {
1912    fn default() -> Self {
1913        Self::Node(<Box<CreatedWorkflowNodeBase>>::default())
1914    }
1915}
1916impl<'de> serde::Deserialize<'de> for CreatedWorkflowNode {
1917    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
1918    where
1919        D: serde::Deserializer<'de>,
1920    {
1921        let value = serde_json::Value::deserialize(deserializer)?;
1922        match value
1923            .get(Self::DISCRIMINATOR_FIELD)
1924            .and_then(|v| v.as_str())
1925        {
1926            Some("SignupTrigger") => serde_json::from_value(value)
1927                .map(Self::SignupTriggerWorkflowMutationNodeWithRevision)
1928                .map_err(serde::de::Error::custom),
1929            Some("EventTrigger") => serde_json::from_value(value)
1930                .map(Self::EventTriggerWorkflowMutationNodeWithRevision)
1931                .map_err(serde::de::Error::custom),
1932            Some("ContactPropertyTrigger") => serde_json::from_value(value)
1933                .map(Self::ContactPropertyTriggerWorkflowMutationNodeWithRevision)
1934                .map_err(serde::de::Error::custom),
1935            Some("AddToListTrigger") => serde_json::from_value(value)
1936                .map(Self::AddToListTriggerWorkflowMutationNodeWithRevision)
1937                .map_err(serde::de::Error::custom),
1938            Some("BlankTrigger") => serde_json::from_value(value)
1939                .map(Self::BlankTriggerWorkflowMutationNodeWithRevision)
1940                .map_err(serde::de::Error::custom),
1941            Some("AudienceFilter") => serde_json::from_value(value)
1942                .map(Self::AudienceFilterWorkflowMutationNodeWithRevision)
1943                .map_err(serde::de::Error::custom),
1944            Some("TimerAction") => serde_json::from_value(value)
1945                .map(Self::TimerActionWorkflowMutationNodeWithRevision)
1946                .map_err(serde::de::Error::custom),
1947            Some("SendEmailAction") => serde_json::from_value(value)
1948                .map(Self::SendEmailActionWorkflowMutationNodeWithRevision)
1949                .map_err(serde::de::Error::custom),
1950            Some("ExitAction") => serde_json::from_value(value)
1951                .map(Self::ExitActionWorkflowMutationNodeWithRevision)
1952                .map_err(serde::de::Error::custom),
1953            Some("BranchNode") => serde_json::from_value(value)
1954                .map(Self::BranchWorkflowMutationNodeWithRevision)
1955                .map_err(serde::de::Error::custom),
1956            Some("ExperimentBranchNode") => serde_json::from_value(value)
1957                .map(Self::ExperimentBranchWorkflowMutationNodeWithRevision)
1958                .map_err(serde::de::Error::custom),
1959            Some("VariantNode") => serde_json::from_value(value)
1960                .map(Self::VariantWorkflowMutationNodeWithRevision)
1961                .map_err(serde::de::Error::custom),
1962            None => serde_json::from_value(value)
1963                .map(Self::Node)
1964                .map_err(serde::de::Error::custom),
1965            Some(other) => Err(serde::de::Error::custom(format!(
1966                "Unknown discriminator value '{}' for field '{}'",
1967                other, "typeName"
1968            ))),
1969        }
1970    }
1971}
1972#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1973pub struct CreatedWorkflowNodeBase {
1974    /// Default child nodes created along with the requested node. BranchNode creation returns two AudienceFilter children. ExperimentBranchNode creation returns two regular VariantNode children and one control VariantNode.
1975    #[serde(rename = "createdChildNodes")]
1976    pub created_child_nodes: Option<Vec<WorkflowMutationNode>>,
1977}
1978#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1979pub struct CreateWorkflowNodeResponse {
1980    pub node: CreatedWorkflowNode,
1981    pub workflow: SimplifiedWorkflow,
1982}
1983#[serde_with::skip_serializing_none]
1984#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
1985pub struct AddWorkflowBranchRequest {
1986    #[serde(rename = "expectedRevisionId")]
1987    pub expected_revision_id: Option<WorkflowExpectedRevisionId>,
1988}
1989#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
1990pub struct AddWorkflowBranchResponse {
1991    /// Detailed workflow node returned from a mutation, plus the latest workflow revision token.
1992    pub node: Box<WorkflowMutationNodeWithRevision>,
1993    pub workflow: SimplifiedWorkflow,
1994}
1995/// Reroute the source node's only outgoing connection to `newTargetNodeId`.
1996#[serde_with::skip_serializing_none]
1997#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
1998pub struct RerouteNodeConnectionRequest {
1999    #[serde(rename = "expectedRevisionId")]
2000    pub expected_revision_id: Option<WorkflowExpectedRevisionId>,
2001    /// The valid workflow node that should receive the connection from the source node.
2002    #[serde(rename = "newTargetNodeId")]
2003    #[validate(length(min = 1u64))]
2004    pub new_target_node_id: String,
2005}
2006/// The updated source node, plus the latest workflow.
2007#[derive(Debug, Clone, PartialEq)]
2008pub enum RerouteNodeConnectionResponse {
2009    SignupTriggerWorkflowMutationNodeWithRevision(
2010        Box<SignupTriggerWorkflowMutationNodeWithRevision>,
2011    ),
2012    EventTriggerWorkflowMutationNodeWithRevision(Box<EventTriggerWorkflowMutationNodeWithRevision>),
2013    ContactPropertyTriggerWorkflowMutationNodeWithRevision(
2014        Box<ContactPropertyTriggerWorkflowMutationNodeWithRevision>,
2015    ),
2016    AddToListTriggerWorkflowMutationNodeWithRevision(
2017        Box<AddToListTriggerWorkflowMutationNodeWithRevision>,
2018    ),
2019    BlankTriggerWorkflowMutationNodeWithRevision(Box<BlankTriggerWorkflowMutationNodeWithRevision>),
2020    AudienceFilterWorkflowMutationNodeWithRevision(
2021        Box<AudienceFilterWorkflowMutationNodeWithRevision>,
2022    ),
2023    TimerActionWorkflowMutationNodeWithRevision(Box<TimerActionWorkflowMutationNodeWithRevision>),
2024    SendEmailActionWorkflowMutationNodeWithRevision(
2025        Box<SendEmailActionWorkflowMutationNodeWithRevision>,
2026    ),
2027    ExitActionWorkflowMutationNodeWithRevision(Box<ExitActionWorkflowMutationNodeWithRevision>),
2028    BranchWorkflowMutationNodeWithRevision(Box<BranchWorkflowMutationNodeWithRevision>),
2029    ExperimentBranchWorkflowMutationNodeWithRevision(
2030        Box<ExperimentBranchWorkflowMutationNodeWithRevision>,
2031    ),
2032    VariantWorkflowMutationNodeWithRevision(Box<VariantWorkflowMutationNodeWithRevision>),
2033    Response(Box<RerouteNodeConnectionResponseBase>),
2034}
2035impl RerouteNodeConnectionResponse {
2036    pub const DISCRIMINATOR_FIELD: &'static str = "typeName";
2037}
2038impl Default for RerouteNodeConnectionResponse {
2039    fn default() -> Self {
2040        Self::Response(<Box<RerouteNodeConnectionResponseBase>>::default())
2041    }
2042}
2043impl<'de> serde::Deserialize<'de> for RerouteNodeConnectionResponse {
2044    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
2045    where
2046        D: serde::Deserializer<'de>,
2047    {
2048        let value = serde_json::Value::deserialize(deserializer)?;
2049        match value
2050            .get(Self::DISCRIMINATOR_FIELD)
2051            .and_then(|v| v.as_str())
2052        {
2053            Some("SignupTrigger") => serde_json::from_value(value)
2054                .map(Self::SignupTriggerWorkflowMutationNodeWithRevision)
2055                .map_err(serde::de::Error::custom),
2056            Some("EventTrigger") => serde_json::from_value(value)
2057                .map(Self::EventTriggerWorkflowMutationNodeWithRevision)
2058                .map_err(serde::de::Error::custom),
2059            Some("ContactPropertyTrigger") => serde_json::from_value(value)
2060                .map(Self::ContactPropertyTriggerWorkflowMutationNodeWithRevision)
2061                .map_err(serde::de::Error::custom),
2062            Some("AddToListTrigger") => serde_json::from_value(value)
2063                .map(Self::AddToListTriggerWorkflowMutationNodeWithRevision)
2064                .map_err(serde::de::Error::custom),
2065            Some("BlankTrigger") => serde_json::from_value(value)
2066                .map(Self::BlankTriggerWorkflowMutationNodeWithRevision)
2067                .map_err(serde::de::Error::custom),
2068            Some("AudienceFilter") => serde_json::from_value(value)
2069                .map(Self::AudienceFilterWorkflowMutationNodeWithRevision)
2070                .map_err(serde::de::Error::custom),
2071            Some("TimerAction") => serde_json::from_value(value)
2072                .map(Self::TimerActionWorkflowMutationNodeWithRevision)
2073                .map_err(serde::de::Error::custom),
2074            Some("SendEmailAction") => serde_json::from_value(value)
2075                .map(Self::SendEmailActionWorkflowMutationNodeWithRevision)
2076                .map_err(serde::de::Error::custom),
2077            Some("ExitAction") => serde_json::from_value(value)
2078                .map(Self::ExitActionWorkflowMutationNodeWithRevision)
2079                .map_err(serde::de::Error::custom),
2080            Some("BranchNode") => serde_json::from_value(value)
2081                .map(Self::BranchWorkflowMutationNodeWithRevision)
2082                .map_err(serde::de::Error::custom),
2083            Some("ExperimentBranchNode") => serde_json::from_value(value)
2084                .map(Self::ExperimentBranchWorkflowMutationNodeWithRevision)
2085                .map_err(serde::de::Error::custom),
2086            Some("VariantNode") => serde_json::from_value(value)
2087                .map(Self::VariantWorkflowMutationNodeWithRevision)
2088                .map_err(serde::de::Error::custom),
2089            None => serde_json::from_value(value)
2090                .map(Self::Response)
2091                .map_err(serde::de::Error::custom),
2092            Some(other) => Err(serde::de::Error::custom(format!(
2093                "Unknown discriminator value '{}' for field '{}'",
2094                other, "typeName"
2095            ))),
2096        }
2097    }
2098}
2099/// The updated source node, plus the latest workflow.
2100#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2101pub struct RerouteNodeConnectionResponseBase {
2102    pub workflow: SimplifiedWorkflow,
2103}
2104#[serde_with::skip_serializing_none]
2105#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
2106pub struct UpdateWorkflowNodeRequest {
2107    #[serde(rename = "expectedRevisionId")]
2108    pub expected_revision_id: Option<WorkflowExpectedRevisionId>,
2109    /// Node-type-specific fields to update. The allowed fields depend on the existing node type. Trigger node updates may include `typeName` when changing one trigger node type to another trigger node type.
2110    pub payload: Box<UpdateWorkflowNodePayload>,
2111}
2112/// The updated workflow node, plus the latest simplified workflow.
2113#[derive(Debug, Clone, PartialEq)]
2114pub enum UpdateWorkflowNodeResponse {
2115    SignupTriggerWorkflowMutationNodeWithRevision(
2116        Box<SignupTriggerWorkflowMutationNodeWithRevision>,
2117    ),
2118    EventTriggerWorkflowMutationNodeWithRevision(Box<EventTriggerWorkflowMutationNodeWithRevision>),
2119    ContactPropertyTriggerWorkflowMutationNodeWithRevision(
2120        Box<ContactPropertyTriggerWorkflowMutationNodeWithRevision>,
2121    ),
2122    AddToListTriggerWorkflowMutationNodeWithRevision(
2123        Box<AddToListTriggerWorkflowMutationNodeWithRevision>,
2124    ),
2125    BlankTriggerWorkflowMutationNodeWithRevision(Box<BlankTriggerWorkflowMutationNodeWithRevision>),
2126    AudienceFilterWorkflowMutationNodeWithRevision(
2127        Box<AudienceFilterWorkflowMutationNodeWithRevision>,
2128    ),
2129    TimerActionWorkflowMutationNodeWithRevision(Box<TimerActionWorkflowMutationNodeWithRevision>),
2130    SendEmailActionWorkflowMutationNodeWithRevision(
2131        Box<SendEmailActionWorkflowMutationNodeWithRevision>,
2132    ),
2133    ExitActionWorkflowMutationNodeWithRevision(Box<ExitActionWorkflowMutationNodeWithRevision>),
2134    BranchWorkflowMutationNodeWithRevision(Box<BranchWorkflowMutationNodeWithRevision>),
2135    ExperimentBranchWorkflowMutationNodeWithRevision(
2136        Box<ExperimentBranchWorkflowMutationNodeWithRevision>,
2137    ),
2138    VariantWorkflowMutationNodeWithRevision(Box<VariantWorkflowMutationNodeWithRevision>),
2139    Response(Box<UpdateWorkflowNodeResponseBase>),
2140}
2141impl UpdateWorkflowNodeResponse {
2142    pub const DISCRIMINATOR_FIELD: &'static str = "typeName";
2143}
2144impl Default for UpdateWorkflowNodeResponse {
2145    fn default() -> Self {
2146        Self::Response(<Box<UpdateWorkflowNodeResponseBase>>::default())
2147    }
2148}
2149impl<'de> serde::Deserialize<'de> for UpdateWorkflowNodeResponse {
2150    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
2151    where
2152        D: serde::Deserializer<'de>,
2153    {
2154        let value = serde_json::Value::deserialize(deserializer)?;
2155        match value
2156            .get(Self::DISCRIMINATOR_FIELD)
2157            .and_then(|v| v.as_str())
2158        {
2159            Some("SignupTrigger") => serde_json::from_value(value)
2160                .map(Self::SignupTriggerWorkflowMutationNodeWithRevision)
2161                .map_err(serde::de::Error::custom),
2162            Some("EventTrigger") => serde_json::from_value(value)
2163                .map(Self::EventTriggerWorkflowMutationNodeWithRevision)
2164                .map_err(serde::de::Error::custom),
2165            Some("ContactPropertyTrigger") => serde_json::from_value(value)
2166                .map(Self::ContactPropertyTriggerWorkflowMutationNodeWithRevision)
2167                .map_err(serde::de::Error::custom),
2168            Some("AddToListTrigger") => serde_json::from_value(value)
2169                .map(Self::AddToListTriggerWorkflowMutationNodeWithRevision)
2170                .map_err(serde::de::Error::custom),
2171            Some("BlankTrigger") => serde_json::from_value(value)
2172                .map(Self::BlankTriggerWorkflowMutationNodeWithRevision)
2173                .map_err(serde::de::Error::custom),
2174            Some("AudienceFilter") => serde_json::from_value(value)
2175                .map(Self::AudienceFilterWorkflowMutationNodeWithRevision)
2176                .map_err(serde::de::Error::custom),
2177            Some("TimerAction") => serde_json::from_value(value)
2178                .map(Self::TimerActionWorkflowMutationNodeWithRevision)
2179                .map_err(serde::de::Error::custom),
2180            Some("SendEmailAction") => serde_json::from_value(value)
2181                .map(Self::SendEmailActionWorkflowMutationNodeWithRevision)
2182                .map_err(serde::de::Error::custom),
2183            Some("ExitAction") => serde_json::from_value(value)
2184                .map(Self::ExitActionWorkflowMutationNodeWithRevision)
2185                .map_err(serde::de::Error::custom),
2186            Some("BranchNode") => serde_json::from_value(value)
2187                .map(Self::BranchWorkflowMutationNodeWithRevision)
2188                .map_err(serde::de::Error::custom),
2189            Some("ExperimentBranchNode") => serde_json::from_value(value)
2190                .map(Self::ExperimentBranchWorkflowMutationNodeWithRevision)
2191                .map_err(serde::de::Error::custom),
2192            Some("VariantNode") => serde_json::from_value(value)
2193                .map(Self::VariantWorkflowMutationNodeWithRevision)
2194                .map_err(serde::de::Error::custom),
2195            None => serde_json::from_value(value)
2196                .map(Self::Response)
2197                .map_err(serde::de::Error::custom),
2198            Some(other) => Err(serde::de::Error::custom(format!(
2199                "Unknown discriminator value '{}' for field '{}'",
2200                other, "typeName"
2201            ))),
2202        }
2203    }
2204}
2205/// The updated workflow node, plus the latest simplified workflow.
2206#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2207pub struct UpdateWorkflowNodeResponseBase {
2208    pub workflow: SimplifiedWorkflow,
2209}
2210#[serde_with::skip_serializing_none]
2211#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
2212#[serde(default)]
2213pub struct DeleteWorkflowNodeRequest {
2214    #[serde(rename = "expectedRevisionId")]
2215    pub expected_revision_id: Option<WorkflowExpectedRevisionId>,
2216    /// If `true`, the request will be validated but the workflow will not be modified.
2217    #[serde(rename = "dryRun")]
2218    pub dry_run: Option<bool>,
2219    /// `fail` returns queued-contact impact instead of mutating. `discard` confirms that matching queued contacts should be discarded. Defaults to `fail` when omitted.
2220    #[serde(rename = "queuedContactPolicy")]
2221    #[default(Some(Default::default()))]
2222    pub queued_contact_policy: Option<WorkflowQueuedContactPolicy>,
2223}
2224#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2225pub struct WorkflowQueuedContactDeletePreview {
2226    pub status: PreviewStatus,
2227    /// The IDs of the nodes that would be deleted.
2228    #[serde(rename = "nodeIds")]
2229    pub node_ids: Vec<String>,
2230    /// The number of queued contacts that would be removed from the workflow due to the node deletion.
2231    #[serde(rename = "queuedContactCount")]
2232    pub queued_contact_count: f64,
2233}
2234#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2235#[serde(default)]
2236pub struct WorkflowDeletedResponse {
2237    #[default("deleted".to_string())]
2238    pub status: String,
2239    #[serde(rename = "nodeIds")]
2240    pub node_ids: Vec<String>,
2241    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
2242    #[serde(rename = "workflowRevisionId")]
2243    pub workflow_revision_id: serde_json::Value,
2244    /// The number of queued contacts that were removed from the workflow due to the node deletion.
2245    #[serde(rename = "queuedContactCount")]
2246    pub queued_contact_count: f64,
2247    pub workflow: SimplifiedWorkflow,
2248}
2249#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2250#[serde(untagged)]
2251pub enum DeleteWorkflowNodeResponse {
2252    #[default]
2253    QueuedContactDeletePreview(WorkflowQueuedContactDeletePreview),
2254    DeletedResponse(WorkflowDeletedResponse),
2255}
2256#[serde_with::skip_serializing_none]
2257#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
2258#[serde(default)]
2259pub struct ChangeWorkflowMailingListRequest {
2260    #[serde(rename = "expectedRevisionId")]
2261    pub expected_revision_id: Option<WorkflowExpectedRevisionId>,
2262    /// The mailing list to use for the workflow. When assigning a mailing list, queued contacts excluded by the new list can return `queuedContactsFound`; retry with `queuedContactPolicy: "discard"` to apply the change and discard those contacts. Use `null` to clear the workflow mailing list; clearing does not discard queued contacts.
2263    #[serde(rename = "mailingListId")]
2264    pub mailing_list_id: Option<String>,
2265    /// If `true`, the request will be validated but the workflow will not be modified.
2266    #[serde(rename = "dryRun")]
2267    pub dry_run: Option<bool>,
2268    /// `fail` returns queued-contact impact instead of mutating. `discard` confirms that matching queued contacts should be discarded. Defaults to `fail` when omitted.
2269    #[serde(rename = "queuedContactPolicy")]
2270    #[default(Some(Default::default()))]
2271    pub queued_contact_policy: Option<WorkflowQueuedContactPolicy>,
2272}
2273#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2274pub struct WorkflowMailingListPreview {
2275    pub status: PreviewStatus,
2276    #[serde(rename = "mailingListId")]
2277    pub mailing_list_id: Option<String>,
2278    /// The number of queued contacts that would be removed from the workflow due to the mailing list changing.
2279    #[serde(rename = "queuedContactCount")]
2280    pub queued_contact_count: f64,
2281}
2282#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2283#[serde(default)]
2284pub struct WorkflowMailingListUpdatedResponse {
2285    #[default("updated".to_string())]
2286    pub status: String,
2287    #[serde(rename = "mailingListId")]
2288    pub mailing_list_id: Option<String>,
2289    /// The current workflow revision token. Pass the latest value as `expectedRevisionId` on the next workflow mutation.
2290    #[serde(rename = "workflowRevisionId")]
2291    pub workflow_revision_id: serde_json::Value,
2292    /// The number of queued contacts that were removed from the workflow due to the mailing list changing.
2293    #[serde(rename = "queuedContactCount")]
2294    pub queued_contact_count: f64,
2295    pub workflow: SimplifiedWorkflow,
2296}
2297#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2298#[serde(untagged)]
2299pub enum ChangeWorkflowMailingListResponse {
2300    #[default]
2301    Preview(WorkflowMailingListPreview),
2302    UpdatedResponse(WorkflowMailingListUpdatedResponse),
2303}
2304#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2305pub struct EventPatternSummary {
2306    /// The ID of the event pattern.
2307    pub id: String,
2308    /// The name of the event pattern. Use this when sending events with the API.
2309    #[serde(rename = "eventName")]
2310    pub event_name: String,
2311    /// The platform that sent this event pattern, if the event pattern is from an incoming webhook. Will be `null` for custom events.
2312    #[serde(rename = "incomingWebhookPlatform")]
2313    pub incoming_webhook_platform: Option<IncomingWebhookPlatform>,
2314}
2315#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2316pub struct ListEventPatternsResponse {
2317    pub pagination: ListEventPatternsResponsePagination,
2318    pub data: Vec<EventPatternSummary>,
2319}
2320#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2321pub struct EventPattern {
2322    pub id: String,
2323    /// The name of the event pattern. Use this when sending events with the API.
2324    #[serde(rename = "eventName")]
2325    pub event_name: String,
2326    /// The properties of the event pattern, which can be used in emails.
2327    #[serde(rename = "eventProperties")]
2328    pub event_properties: Vec<WorkflowEventProperty>,
2329    /// The platform that sent this event pattern, if the event pattern is from an incoming webhook. Will be `null` for custom events.
2330    #[serde(rename = "incomingWebhookPlatform")]
2331    pub incoming_webhook_platform: Option<IncomingWebhookPlatform>,
2332}
2333#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2334pub struct EventPatternFailureResponse {
2335    pub message: String,
2336}
2337#[derive(Debug, Clone, PartialEq)]
2338pub enum SimplifiedWorkflowNode {
2339    SignupTrigger(SimplifiedSignupTriggerWorkflowNode),
2340    EventTrigger(SimplifiedEventTriggerWorkflowNode),
2341    ContactPropertyTrigger(SimplifiedContactPropertyTriggerWorkflowNode),
2342    AddToListTrigger(SimplifiedAddToListTriggerWorkflowNode),
2343    BlankTrigger(SimplifiedBlankTriggerWorkflowNode),
2344    AudienceFilter(SimplifiedAudienceFilterWorkflowNode),
2345    TimerAction(SimplifiedTimerActionWorkflowNode),
2346    SendEmailAction(SimplifiedSendEmailActionWorkflowNode),
2347    ExitAction(SimplifiedExitActionWorkflowNode),
2348    Branch(SimplifiedBranchWorkflowNode),
2349    ExperimentBranch(SimplifiedExperimentBranchWorkflowNode),
2350    Variant(SimplifiedVariantWorkflowNode),
2351}
2352impl SimplifiedWorkflowNode {
2353    pub const DISCRIMINATOR_FIELD: &'static str = "typeName";
2354}
2355impl Default for SimplifiedWorkflowNode {
2356    fn default() -> Self {
2357        Self::SignupTrigger(<SimplifiedSignupTriggerWorkflowNode>::default())
2358    }
2359}
2360impl serde::Serialize for SimplifiedWorkflowNode {
2361    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
2362    where
2363        S: serde::Serializer,
2364    {
2365        match self {
2366            Self::SignupTrigger(v) => v.serialize(serializer),
2367            Self::EventTrigger(v) => v.serialize(serializer),
2368            Self::ContactPropertyTrigger(v) => v.serialize(serializer),
2369            Self::AddToListTrigger(v) => v.serialize(serializer),
2370            Self::BlankTrigger(v) => v.serialize(serializer),
2371            Self::AudienceFilter(v) => v.serialize(serializer),
2372            Self::TimerAction(v) => v.serialize(serializer),
2373            Self::SendEmailAction(v) => v.serialize(serializer),
2374            Self::ExitAction(v) => v.serialize(serializer),
2375            Self::Branch(v) => v.serialize(serializer),
2376            Self::ExperimentBranch(v) => v.serialize(serializer),
2377            Self::Variant(v) => v.serialize(serializer),
2378        }
2379    }
2380}
2381impl<'de> serde::Deserialize<'de> for SimplifiedWorkflowNode {
2382    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
2383    where
2384        D: serde::Deserializer<'de>,
2385    {
2386        let value = serde_json::Value::deserialize(deserializer)?;
2387        match value
2388            .get(Self::DISCRIMINATOR_FIELD)
2389            .and_then(|v| v.as_str())
2390        {
2391            Some("SignupTrigger") => serde_json::from_value(value)
2392                .map(Self::SignupTrigger)
2393                .map_err(serde::de::Error::custom),
2394            Some("EventTrigger") => serde_json::from_value(value)
2395                .map(Self::EventTrigger)
2396                .map_err(serde::de::Error::custom),
2397            Some("ContactPropertyTrigger") => serde_json::from_value(value)
2398                .map(Self::ContactPropertyTrigger)
2399                .map_err(serde::de::Error::custom),
2400            Some("AddToListTrigger") => serde_json::from_value(value)
2401                .map(Self::AddToListTrigger)
2402                .map_err(serde::de::Error::custom),
2403            Some("BlankTrigger") => serde_json::from_value(value)
2404                .map(Self::BlankTrigger)
2405                .map_err(serde::de::Error::custom),
2406            Some("AudienceFilter") => serde_json::from_value(value)
2407                .map(Self::AudienceFilter)
2408                .map_err(serde::de::Error::custom),
2409            Some("TimerAction") => serde_json::from_value(value)
2410                .map(Self::TimerAction)
2411                .map_err(serde::de::Error::custom),
2412            Some("SendEmailAction") => serde_json::from_value(value)
2413                .map(Self::SendEmailAction)
2414                .map_err(serde::de::Error::custom),
2415            Some("ExitAction") => serde_json::from_value(value)
2416                .map(Self::ExitAction)
2417                .map_err(serde::de::Error::custom),
2418            Some("BranchNode") => serde_json::from_value(value)
2419                .map(Self::Branch)
2420                .map_err(serde::de::Error::custom),
2421            Some("ExperimentBranchNode") => serde_json::from_value(value)
2422                .map(Self::ExperimentBranch)
2423                .map_err(serde::de::Error::custom),
2424            Some("VariantNode") => serde_json::from_value(value)
2425                .map(Self::Variant)
2426                .map_err(serde::de::Error::custom),
2427            None => Err(serde::de::Error::missing_field(Self::DISCRIMINATOR_FIELD)),
2428            Some(other) => Err(serde::de::Error::custom(format!(
2429                "Unknown discriminator value '{}' for field '{}'",
2430                other, "typeName"
2431            ))),
2432        }
2433    }
2434}
2435#[serde_with::skip_serializing_none]
2436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2437#[serde(default)]
2438pub struct SimplifiedSignupTriggerWorkflowNode {
2439    #[doc(hidden)]
2440    #[serde(default, rename = "typeName", skip_deserializing)]
2441    #[default(Some("SignupTrigger"))]
2442    pub type_name: Option<&'static str>,
2443    /// The IDs of the nodes that are downstream of this node.
2444    #[serde(rename = "nextNodeIds")]
2445    pub next_node_ids: Vec<String>,
2446}
2447#[serde_with::skip_serializing_none]
2448#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2449#[serde(default)]
2450pub struct SimplifiedEventTriggerWorkflowNode {
2451    #[doc(hidden)]
2452    #[serde(default, rename = "typeName", skip_deserializing)]
2453    #[default(Some("EventTrigger"))]
2454    pub type_name: Option<&'static str>,
2455    /// The IDs of the nodes that are downstream of this node.
2456    #[serde(rename = "nextNodeIds")]
2457    pub next_node_ids: Vec<String>,
2458    /// The name of the event that triggers the workflow.
2459    #[serde(rename = "eventName")]
2460    pub event_name: Option<String>,
2461    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
2462    #[serde(rename = "reEligible")]
2463    pub re_eligible: bool,
2464}
2465#[serde_with::skip_serializing_none]
2466#[derive(
2467    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2468)]
2469#[serde(default)]
2470pub struct SimplifiedContactPropertyTriggerWorkflowNode {
2471    #[doc(hidden)]
2472    #[serde(default, rename = "typeName", skip_deserializing)]
2473    #[default(Some("ContactPropertyTrigger"))]
2474    pub type_name: Option<&'static str>,
2475    /// The IDs of the nodes that are downstream of this node.
2476    #[serde(rename = "nextNodeIds")]
2477    pub next_node_ids: Vec<String>,
2478    #[serde(rename = "contactPropertyQuery")]
2479    #[validate(nested)]
2480    pub contact_property_query: Option<WorkflowContactPropertyQuery>,
2481    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
2482    #[serde(rename = "reEligible")]
2483    pub re_eligible: bool,
2484}
2485#[serde_with::skip_serializing_none]
2486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2487#[serde(default)]
2488pub struct SimplifiedAddToListTriggerWorkflowNode {
2489    #[doc(hidden)]
2490    #[serde(default, rename = "typeName", skip_deserializing)]
2491    #[default(Some("AddToListTrigger"))]
2492    pub type_name: Option<&'static str>,
2493    /// The IDs of the nodes that are downstream of this node.
2494    #[serde(rename = "nextNodeIds")]
2495    pub next_node_ids: Vec<String>,
2496    /// The ID of the mailing list that triggers the workflow.
2497    #[serde(rename = "mailingListId")]
2498    pub mailing_list_id: Option<String>,
2499    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
2500    #[serde(rename = "reEligible")]
2501    pub re_eligible: bool,
2502}
2503#[serde_with::skip_serializing_none]
2504#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2505#[serde(default)]
2506pub struct SimplifiedBlankTriggerWorkflowNode {
2507    #[doc(hidden)]
2508    #[serde(default, rename = "typeName", skip_deserializing)]
2509    #[default(Some("BlankTrigger"))]
2510    pub type_name: Option<&'static str>,
2511    /// The IDs of the nodes that are downstream of this node.
2512    #[serde(rename = "nextNodeIds")]
2513    pub next_node_ids: Vec<String>,
2514}
2515#[serde_with::skip_serializing_none]
2516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2517#[serde(default)]
2518pub struct SimplifiedAudienceFilterWorkflowNode {
2519    #[doc(hidden)]
2520    #[serde(default, rename = "typeName", skip_deserializing)]
2521    #[default(Some("AudienceFilter"))]
2522    pub type_name: Option<&'static str>,
2523    /// The IDs of the nodes that are downstream of this node.
2524    #[serde(rename = "nextNodeIds")]
2525    pub next_node_ids: Vec<String>,
2526}
2527#[serde_with::skip_serializing_none]
2528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2529#[serde(default)]
2530pub struct SimplifiedTimerActionWorkflowNode {
2531    #[doc(hidden)]
2532    #[serde(default, rename = "typeName", skip_deserializing)]
2533    #[default(Some("TimerAction"))]
2534    pub type_name: Option<&'static str>,
2535    /// The IDs of the nodes that are downstream of this node.
2536    #[serde(rename = "nextNodeIds")]
2537    pub next_node_ids: Vec<String>,
2538    /// The amount of time to wait before triggering the next node. Set to `0` to move to the next node immediately.
2539    pub amount: f64,
2540    /// The unit of time for the timer action node. m = minutes, h = hours, d = days.
2541    pub unit: WorkflowTimerUnit,
2542}
2543#[serde_with::skip_serializing_none]
2544#[derive(
2545    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2546)]
2547#[serde(default)]
2548pub struct SimplifiedSendEmailActionWorkflowNode {
2549    #[doc(hidden)]
2550    #[serde(default, rename = "typeName", skip_deserializing)]
2551    #[default(Some("SendEmailAction"))]
2552    pub type_name: Option<&'static str>,
2553    /// The IDs of the nodes that are downstream of this node.
2554    #[serde(rename = "nextNodeIds")]
2555    pub next_node_ids: Vec<String>,
2556    /// The ID of the email message to send. To edit this email, use the `POST /v1/email-messages/{emailMessageId}` endpoint.
2557    #[serde(rename = "emailMessageId")]
2558    pub email_message_id: Option<String>,
2559    /// The subject of the email message (reference only).
2560    #[validate(length(min = 1u64))]
2561    pub subject: String,
2562}
2563#[serde_with::skip_serializing_none]
2564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2565#[serde(default)]
2566pub struct SimplifiedExitActionWorkflowNode {
2567    #[doc(hidden)]
2568    #[serde(default, rename = "typeName", skip_deserializing)]
2569    #[default(Some("ExitAction"))]
2570    pub type_name: Option<&'static str>,
2571    /// The IDs of the nodes that are downstream of this node.
2572    #[serde(rename = "nextNodeIds")]
2573    pub next_node_ids: Vec<String>,
2574}
2575#[serde_with::skip_serializing_none]
2576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2577#[serde(default)]
2578pub struct SimplifiedBranchWorkflowNode {
2579    #[doc(hidden)]
2580    #[serde(default, rename = "typeName", skip_deserializing)]
2581    #[default(Some("BranchNode"))]
2582    pub type_name: Option<&'static str>,
2583    /// The IDs of the nodes that are downstream of this node.
2584    #[serde(rename = "nextNodeIds")]
2585    pub next_node_ids: Vec<String>,
2586}
2587#[serde_with::skip_serializing_none]
2588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2589#[serde(default)]
2590pub struct SimplifiedExperimentBranchWorkflowNode {
2591    #[doc(hidden)]
2592    #[serde(default, rename = "typeName", skip_deserializing)]
2593    #[default(Some("ExperimentBranchNode"))]
2594    pub type_name: Option<&'static str>,
2595    /// The IDs of the nodes that are downstream of this node.
2596    #[serde(rename = "nextNodeIds")]
2597    pub next_node_ids: Vec<String>,
2598    /// The percentage of contacts that will be sent to variant branches, between `0` and `100`. The remaining percentage will be sent to the control branch.
2599    #[serde(rename = "samplingRate")]
2600    pub sampling_rate: f64,
2601}
2602#[serde_with::skip_serializing_none]
2603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
2604#[serde(default)]
2605pub struct SimplifiedVariantWorkflowNode {
2606    #[doc(hidden)]
2607    #[serde(default, rename = "typeName", skip_deserializing)]
2608    #[default(Some("VariantNode"))]
2609    pub type_name: Option<&'static str>,
2610    /// The IDs of the nodes that are downstream of this node.
2611    #[serde(rename = "nextNodeIds")]
2612    pub next_node_ids: Vec<String>,
2613    /// Whether this is the control variant of an experiment.
2614    #[serde(rename = "isControl")]
2615    pub is_control: bool,
2616}
2617#[derive(Debug, Clone, PartialEq)]
2618pub enum WorkflowNode {
2619    SignupTrigger(SignupTriggerWorkflowNode),
2620    EventTrigger(EventTriggerWorkflowNode),
2621    ContactPropertyTrigger(ContactPropertyTriggerWorkflowNode),
2622    AddToListTrigger(AddToListTriggerWorkflowNode),
2623    BlankTrigger(BlankTriggerWorkflowNode),
2624    AudienceFilter(AudienceFilterWorkflowNode),
2625    TimerAction(TimerActionWorkflowNode),
2626    SendEmailAction(SendEmailActionWorkflowNode),
2627    ExitAction(ExitActionWorkflowNode),
2628    Branch(BranchWorkflowNode),
2629    ExperimentBranch(ExperimentBranchWorkflowNode),
2630    Variant(VariantWorkflowNode),
2631}
2632impl WorkflowNode {
2633    pub const DISCRIMINATOR_FIELD: &'static str = "typeName";
2634}
2635impl Default for WorkflowNode {
2636    fn default() -> Self {
2637        Self::SignupTrigger(<SignupTriggerWorkflowNode>::default())
2638    }
2639}
2640impl serde::Serialize for WorkflowNode {
2641    fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
2642    where
2643        S: serde::Serializer,
2644    {
2645        match self {
2646            Self::SignupTrigger(v) => v.serialize(serializer),
2647            Self::EventTrigger(v) => v.serialize(serializer),
2648            Self::ContactPropertyTrigger(v) => v.serialize(serializer),
2649            Self::AddToListTrigger(v) => v.serialize(serializer),
2650            Self::BlankTrigger(v) => v.serialize(serializer),
2651            Self::AudienceFilter(v) => v.serialize(serializer),
2652            Self::TimerAction(v) => v.serialize(serializer),
2653            Self::SendEmailAction(v) => v.serialize(serializer),
2654            Self::ExitAction(v) => v.serialize(serializer),
2655            Self::Branch(v) => v.serialize(serializer),
2656            Self::ExperimentBranch(v) => v.serialize(serializer),
2657            Self::Variant(v) => v.serialize(serializer),
2658        }
2659    }
2660}
2661impl<'de> serde::Deserialize<'de> for WorkflowNode {
2662    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
2663    where
2664        D: serde::Deserializer<'de>,
2665    {
2666        let value = serde_json::Value::deserialize(deserializer)?;
2667        match value
2668            .get(Self::DISCRIMINATOR_FIELD)
2669            .and_then(|v| v.as_str())
2670        {
2671            Some("SignupTrigger") => serde_json::from_value(value)
2672                .map(Self::SignupTrigger)
2673                .map_err(serde::de::Error::custom),
2674            Some("EventTrigger") => serde_json::from_value(value)
2675                .map(Self::EventTrigger)
2676                .map_err(serde::de::Error::custom),
2677            Some("ContactPropertyTrigger") => serde_json::from_value(value)
2678                .map(Self::ContactPropertyTrigger)
2679                .map_err(serde::de::Error::custom),
2680            Some("AddToListTrigger") => serde_json::from_value(value)
2681                .map(Self::AddToListTrigger)
2682                .map_err(serde::de::Error::custom),
2683            Some("BlankTrigger") => serde_json::from_value(value)
2684                .map(Self::BlankTrigger)
2685                .map_err(serde::de::Error::custom),
2686            Some("AudienceFilter") => serde_json::from_value(value)
2687                .map(Self::AudienceFilter)
2688                .map_err(serde::de::Error::custom),
2689            Some("TimerAction") => serde_json::from_value(value)
2690                .map(Self::TimerAction)
2691                .map_err(serde::de::Error::custom),
2692            Some("SendEmailAction") => serde_json::from_value(value)
2693                .map(Self::SendEmailAction)
2694                .map_err(serde::de::Error::custom),
2695            Some("ExitAction") => serde_json::from_value(value)
2696                .map(Self::ExitAction)
2697                .map_err(serde::de::Error::custom),
2698            Some("BranchNode") => serde_json::from_value(value)
2699                .map(Self::Branch)
2700                .map_err(serde::de::Error::custom),
2701            Some("ExperimentBranchNode") => serde_json::from_value(value)
2702                .map(Self::ExperimentBranch)
2703                .map_err(serde::de::Error::custom),
2704            Some("VariantNode") => serde_json::from_value(value)
2705                .map(Self::Variant)
2706                .map_err(serde::de::Error::custom),
2707            None => Err(serde::de::Error::missing_field(Self::DISCRIMINATOR_FIELD)),
2708            Some(other) => Err(serde::de::Error::custom(format!(
2709                "Unknown discriminator value '{}' for field '{}'",
2710                other, "typeName"
2711            ))),
2712        }
2713    }
2714}
2715/// Detailed workflow node returned from read operations. The exact fields depend on `typeName`.
2716#[derive(Debug, Clone, PartialEq)]
2717pub enum WorkflowNodeWithRevision {
2718    SignupTriggerWorkflowNode(Box<SignupTriggerWorkflowNode>),
2719    EventTriggerWorkflowNode(Box<EventTriggerWorkflowNode>),
2720    ContactPropertyTriggerWorkflowNode(Box<ContactPropertyTriggerWorkflowNode>),
2721    AddToListTriggerWorkflowNode(Box<AddToListTriggerWorkflowNode>),
2722    BlankTriggerWorkflowNode(Box<BlankTriggerWorkflowNode>),
2723    AudienceFilterWorkflowNode(Box<AudienceFilterWorkflowNode>),
2724    TimerActionWorkflowNode(Box<TimerActionWorkflowNode>),
2725    SendEmailActionWorkflowNode(Box<SendEmailActionWorkflowNode>),
2726    ExitActionWorkflowNode(Box<ExitActionWorkflowNode>),
2727    BranchWorkflowNode(Box<BranchWorkflowNode>),
2728    ExperimentBranchWorkflowNode(Box<ExperimentBranchWorkflowNode>),
2729    VariantWorkflowNode(Box<VariantWorkflowNode>),
2730    Revision(Box<WorkflowNodeWithRevisionBase>),
2731}
2732impl WorkflowNodeWithRevision {
2733    pub const DISCRIMINATOR_FIELD: &'static str = "typeName";
2734}
2735impl Default for WorkflowNodeWithRevision {
2736    fn default() -> Self {
2737        Self::Revision(<Box<WorkflowNodeWithRevisionBase>>::default())
2738    }
2739}
2740impl<'de> serde::Deserialize<'de> for WorkflowNodeWithRevision {
2741    fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
2742    where
2743        D: serde::Deserializer<'de>,
2744    {
2745        let value = serde_json::Value::deserialize(deserializer)?;
2746        match value
2747            .get(Self::DISCRIMINATOR_FIELD)
2748            .and_then(|v| v.as_str())
2749        {
2750            Some("SignupTrigger") => serde_json::from_value(value)
2751                .map(Self::SignupTriggerWorkflowNode)
2752                .map_err(serde::de::Error::custom),
2753            Some("EventTrigger") => serde_json::from_value(value)
2754                .map(Self::EventTriggerWorkflowNode)
2755                .map_err(serde::de::Error::custom),
2756            Some("ContactPropertyTrigger") => serde_json::from_value(value)
2757                .map(Self::ContactPropertyTriggerWorkflowNode)
2758                .map_err(serde::de::Error::custom),
2759            Some("AddToListTrigger") => serde_json::from_value(value)
2760                .map(Self::AddToListTriggerWorkflowNode)
2761                .map_err(serde::de::Error::custom),
2762            Some("BlankTrigger") => serde_json::from_value(value)
2763                .map(Self::BlankTriggerWorkflowNode)
2764                .map_err(serde::de::Error::custom),
2765            Some("AudienceFilter") => serde_json::from_value(value)
2766                .map(Self::AudienceFilterWorkflowNode)
2767                .map_err(serde::de::Error::custom),
2768            Some("TimerAction") => serde_json::from_value(value)
2769                .map(Self::TimerActionWorkflowNode)
2770                .map_err(serde::de::Error::custom),
2771            Some("SendEmailAction") => serde_json::from_value(value)
2772                .map(Self::SendEmailActionWorkflowNode)
2773                .map_err(serde::de::Error::custom),
2774            Some("ExitAction") => serde_json::from_value(value)
2775                .map(Self::ExitActionWorkflowNode)
2776                .map_err(serde::de::Error::custom),
2777            Some("BranchNode") => serde_json::from_value(value)
2778                .map(Self::BranchWorkflowNode)
2779                .map_err(serde::de::Error::custom),
2780            Some("ExperimentBranchNode") => serde_json::from_value(value)
2781                .map(Self::ExperimentBranchWorkflowNode)
2782                .map_err(serde::de::Error::custom),
2783            Some("VariantNode") => serde_json::from_value(value)
2784                .map(Self::VariantWorkflowNode)
2785                .map_err(serde::de::Error::custom),
2786            None => serde_json::from_value(value)
2787                .map(Self::Revision)
2788                .map_err(serde::de::Error::custom),
2789            Some(other) => Err(serde::de::Error::custom(format!(
2790                "Unknown discriminator value '{}' for field '{}'",
2791                other, "typeName"
2792            ))),
2793        }
2794    }
2795}
2796/// Detailed workflow node returned from read operations. The exact fields depend on `typeName`.
2797#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
2798pub struct WorkflowNodeWithRevisionBase {
2799    #[serde(rename = "workflowRevisionId")]
2800    pub workflow_revision_id: Option<NullableWorkflowRevisionId>,
2801}
2802#[serde_with::skip_serializing_none]
2803#[derive(
2804    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2805)]
2806#[serde(default)]
2807pub struct SignupTriggerWorkflowNode {
2808    #[validate(length(min = 1u64))]
2809    pub id: String,
2810    #[serde(rename = "workflowId")]
2811    #[validate(length(min = 1u64))]
2812    pub workflow_id: String,
2813    #[doc(hidden)]
2814    #[serde(default, rename = "typeName", skip_deserializing)]
2815    #[default(Some("SignupTrigger"))]
2816    pub type_name: Option<&'static str>,
2817    /// The IDs of the nodes that are downstream of this node.
2818    #[serde(rename = "nextNodeIds")]
2819    pub next_node_ids: Vec<String>,
2820}
2821#[serde_with::skip_serializing_none]
2822#[derive(
2823    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2824)]
2825#[serde(default)]
2826pub struct EventTriggerWorkflowNode {
2827    #[validate(length(min = 1u64))]
2828    pub id: String,
2829    #[serde(rename = "workflowId")]
2830    #[validate(length(min = 1u64))]
2831    pub workflow_id: String,
2832    #[doc(hidden)]
2833    #[serde(default, rename = "typeName", skip_deserializing)]
2834    #[default(Some("EventTrigger"))]
2835    pub type_name: Option<&'static str>,
2836    /// The IDs of the nodes that are downstream of this node.
2837    #[serde(rename = "nextNodeIds")]
2838    pub next_node_ids: Vec<String>,
2839    /// The name of the event pattern that triggers this node.
2840    #[serde(rename = "eventName")]
2841    pub event_name: Option<String>,
2842    /// The properties of the event pattern, which can be used in emails.
2843    #[serde(rename = "eventProperties")]
2844    #[validate(nested)]
2845    pub event_properties: Option<Vec<WorkflowEventProperty>>,
2846    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
2847    #[serde(rename = "reEligible")]
2848    pub re_eligible: bool,
2849}
2850#[serde_with::skip_serializing_none]
2851#[derive(
2852    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2853)]
2854#[serde(default)]
2855pub struct ContactPropertyTriggerWorkflowNode {
2856    #[validate(length(min = 1u64))]
2857    pub id: String,
2858    #[serde(rename = "workflowId")]
2859    #[validate(length(min = 1u64))]
2860    pub workflow_id: String,
2861    #[doc(hidden)]
2862    #[serde(default, rename = "typeName", skip_deserializing)]
2863    #[default(Some("ContactPropertyTrigger"))]
2864    pub type_name: Option<&'static str>,
2865    /// The IDs of the nodes that are downstream of this node.
2866    #[serde(rename = "nextNodeIds")]
2867    pub next_node_ids: Vec<String>,
2868    #[serde(rename = "contactPropertyQuery")]
2869    #[validate(nested)]
2870    pub contact_property_query: Option<WorkflowContactPropertyQuery>,
2871    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
2872    #[serde(rename = "reEligible")]
2873    pub re_eligible: bool,
2874}
2875#[serde_with::skip_serializing_none]
2876#[derive(
2877    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2878)]
2879#[serde(default)]
2880pub struct AddToListTriggerWorkflowNode {
2881    #[validate(length(min = 1u64))]
2882    pub id: String,
2883    #[serde(rename = "workflowId")]
2884    #[validate(length(min = 1u64))]
2885    pub workflow_id: String,
2886    #[doc(hidden)]
2887    #[serde(default, rename = "typeName", skip_deserializing)]
2888    #[default(Some("AddToListTrigger"))]
2889    pub type_name: Option<&'static str>,
2890    /// The IDs of the nodes that are downstream of this node.
2891    #[serde(rename = "nextNodeIds")]
2892    pub next_node_ids: Vec<String>,
2893    /// The ID of the mailing list that triggers the workflow.
2894    #[serde(rename = "mailingListId")]
2895    pub mailing_list_id: Option<String>,
2896    /// If `true`, the contacts will be able to enter this workflow every time the trigger is matched. If `false`, contacts will only ever enter this workflow once. Matches the "Trigger frequency" option in the UI.
2897    #[serde(rename = "reEligible")]
2898    pub re_eligible: bool,
2899}
2900#[serde_with::skip_serializing_none]
2901#[derive(
2902    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2903)]
2904#[serde(default)]
2905pub struct BlankTriggerWorkflowNode {
2906    #[validate(length(min = 1u64))]
2907    pub id: String,
2908    #[serde(rename = "workflowId")]
2909    #[validate(length(min = 1u64))]
2910    pub workflow_id: String,
2911    #[doc(hidden)]
2912    #[serde(default, rename = "typeName", skip_deserializing)]
2913    #[default(Some("BlankTrigger"))]
2914    pub type_name: Option<&'static str>,
2915    /// The IDs of the nodes that are downstream of this node.
2916    #[serde(rename = "nextNodeIds")]
2917    pub next_node_ids: Vec<String>,
2918}
2919#[serde_with::skip_serializing_none]
2920#[derive(
2921    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2922)]
2923#[serde(default)]
2924pub struct AudienceFilterWorkflowNode {
2925    #[validate(length(min = 1u64))]
2926    pub id: String,
2927    #[serde(rename = "workflowId")]
2928    #[validate(length(min = 1u64))]
2929    pub workflow_id: String,
2930    #[doc(hidden)]
2931    #[serde(default, rename = "typeName", skip_deserializing)]
2932    #[default(Some("AudienceFilter"))]
2933    pub type_name: Option<&'static str>,
2934    /// The IDs of the nodes that are downstream of this node.
2935    #[serde(rename = "nextNodeIds")]
2936    pub next_node_ids: Vec<String>,
2937    #[serde(rename = "audienceFilter")]
2938    #[validate(nested)]
2939    pub audience_filter: Option<AudienceFilter>,
2940    #[serde(rename = "audienceSegmentId")]
2941    pub audience_segment_id: Option<String>,
2942    /// If `true`, the audience filter will apply to all downstream nodes. If `false`, the audience filter will only apply to the current node. Matches the "Filter scope" option in the UI.
2943    #[serde(rename = "appliesDownstream")]
2944    pub applies_downstream: bool,
2945}
2946#[serde_with::skip_serializing_none]
2947#[derive(
2948    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2949)]
2950#[serde(default)]
2951pub struct TimerActionWorkflowNode {
2952    #[validate(length(min = 1u64))]
2953    pub id: String,
2954    #[serde(rename = "workflowId")]
2955    #[validate(length(min = 1u64))]
2956    pub workflow_id: String,
2957    #[doc(hidden)]
2958    #[serde(default, rename = "typeName", skip_deserializing)]
2959    #[default(Some("TimerAction"))]
2960    pub type_name: Option<&'static str>,
2961    /// The IDs of the nodes that are downstream of this node.
2962    #[serde(rename = "nextNodeIds")]
2963    pub next_node_ids: Vec<String>,
2964    /// The amount of time to wait before triggering the next node. Set to `0` to move to the next node immediately.
2965    pub amount: f64,
2966    /// The unit of time for the timer action node. m = minutes, h = hours, d = days.
2967    pub unit: WorkflowTimerUnit,
2968}
2969#[serde_with::skip_serializing_none]
2970#[derive(
2971    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2972)]
2973#[serde(default)]
2974pub struct SendEmailActionWorkflowNode {
2975    #[validate(length(min = 1u64))]
2976    pub id: String,
2977    #[serde(rename = "workflowId")]
2978    #[validate(length(min = 1u64))]
2979    pub workflow_id: String,
2980    #[doc(hidden)]
2981    #[serde(default, rename = "typeName", skip_deserializing)]
2982    #[default(Some("SendEmailAction"))]
2983    pub type_name: Option<&'static str>,
2984    /// The IDs of the nodes that are downstream of this node.
2985    #[serde(rename = "nextNodeIds")]
2986    pub next_node_ids: Vec<String>,
2987    /// The ID of the email message to send. To edit this email, use the `POST /v1/email-messages/{emailMessageId}` endpoint.
2988    #[serde(rename = "emailMessageId")]
2989    #[validate(length(min = 1u64))]
2990    pub email_message_id: String,
2991    #[validate(length(min = 1u64))]
2992    pub subject: String,
2993}
2994#[serde_with::skip_serializing_none]
2995#[derive(
2996    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
2997)]
2998#[serde(default)]
2999pub struct ExitActionWorkflowNode {
3000    #[validate(length(min = 1u64))]
3001    pub id: String,
3002    #[serde(rename = "workflowId")]
3003    #[validate(length(min = 1u64))]
3004    pub workflow_id: String,
3005    #[doc(hidden)]
3006    #[serde(default, rename = "typeName", skip_deserializing)]
3007    #[default(Some("ExitAction"))]
3008    pub type_name: Option<&'static str>,
3009    /// The IDs of the nodes that are downstream of this node.
3010    #[serde(rename = "nextNodeIds")]
3011    pub next_node_ids: Vec<String>,
3012}
3013#[serde_with::skip_serializing_none]
3014#[derive(
3015    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3016)]
3017#[serde(default)]
3018pub struct BranchWorkflowNode {
3019    #[validate(length(min = 1u64))]
3020    pub id: String,
3021    #[serde(rename = "workflowId")]
3022    #[validate(length(min = 1u64))]
3023    pub workflow_id: String,
3024    #[doc(hidden)]
3025    #[serde(default, rename = "typeName", skip_deserializing)]
3026    #[default(Some("BranchNode"))]
3027    pub type_name: Option<&'static str>,
3028    /// The IDs of the nodes that are downstream of this node.
3029    #[serde(rename = "nextNodeIds")]
3030    pub next_node_ids: Vec<String>,
3031}
3032#[serde_with::skip_serializing_none]
3033#[derive(
3034    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3035)]
3036#[serde(default)]
3037pub struct ExperimentBranchWorkflowNode {
3038    #[validate(length(min = 1u64))]
3039    pub id: String,
3040    #[serde(rename = "workflowId")]
3041    #[validate(length(min = 1u64))]
3042    pub workflow_id: String,
3043    #[doc(hidden)]
3044    #[serde(default, rename = "typeName", skip_deserializing)]
3045    #[default(Some("ExperimentBranchNode"))]
3046    pub type_name: Option<&'static str>,
3047    /// The IDs of the nodes that are downstream of this node.
3048    #[serde(rename = "nextNodeIds")]
3049    pub next_node_ids: Vec<String>,
3050    /// The percentage of contacts that will be sent to variant branches, between `0` and `100`. The remaining percentage will be sent to the control branch. `100` sends all contacts to variant branches.
3051    #[serde(rename = "samplingRate")]
3052    pub sampling_rate: f64,
3053}
3054#[serde_with::skip_serializing_none]
3055#[derive(
3056    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3057)]
3058#[serde(default)]
3059pub struct VariantWorkflowNode {
3060    #[validate(length(min = 1u64))]
3061    pub id: String,
3062    #[serde(rename = "workflowId")]
3063    #[validate(length(min = 1u64))]
3064    pub workflow_id: String,
3065    #[doc(hidden)]
3066    #[serde(default, rename = "typeName", skip_deserializing)]
3067    #[default(Some("VariantNode"))]
3068    pub type_name: Option<&'static str>,
3069    /// The IDs of the nodes that are downstream of this node.
3070    #[serde(rename = "nextNodeIds")]
3071    pub next_node_ids: Vec<String>,
3072    /// Whether this is the control variant of an experiment.
3073    #[serde(rename = "isControl")]
3074    pub is_control: Option<bool>,
3075}
3076#[derive(
3077    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3078)]
3079pub struct WorkflowEventProperty {
3080    #[validate(length(min = 1u64))]
3081    pub name: String,
3082    #[serde(rename = "type")]
3083    pub r#type: ContactPropertyCreateRequestType,
3084}
3085/// Define the contact property change that triggers the workflow. In update requests, `key` must resolve to an existing contact property that is available for Contact Updated triggers. Hidden or unsupported fields, such as `createdAt`, `notes`, and computed contact properties, are rejected.
3086#[derive(
3087    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3088)]
3089pub struct WorkflowContactPropertyQuery {
3090    /// The camel-cased `key` of the contact property to query. The property must exist for the team and must be available for Contact Updated triggers.
3091    #[validate(length(min = 1u64))]
3092    pub key: String,
3093    /// For Contact Updated triggers, the API validates `operator` against the selected contact property's type and the side of the comparison. The `was` comparison can use any operator supported by the selected property type. The `is` comparison uses the same operators, except number and boolean properties cannot use `empty`. String properties support `any`, `equal`, `not_equal`, `contains`, `not_contains`, `empty`, and `not_empty`. Number properties support `any`, `greater_than`, `less_than`, `numeric_equal`, `numeric_not_equal`, `empty`, and `not_empty`. Boolean properties support `any`, `true`, `false`, `empty`, and `not_empty`. Date properties support `any`, `empty`, `not_empty`, `after`, `before`, and `between`.
3094    pub is: WorkflowContactPropertyComparison,
3095    /// For Contact Updated triggers, the API validates `operator` against the selected contact property's type and the side of the comparison. The `was` comparison can use any operator supported by the selected property type. The `is` comparison uses the same operators, except number and boolean properties cannot use `empty`. String properties support `any`, `equal`, `not_equal`, `contains`, `not_contains`, `empty`, and `not_empty`. Number properties support `any`, `greater_than`, `less_than`, `numeric_equal`, `numeric_not_equal`, `empty`, and `not_empty`. Boolean properties support `any`, `true`, `false`, `empty`, and `not_empty`. Date properties support `any`, `empty`, `not_empty`, `after`, `before`, and `between`.
3096    pub was: WorkflowContactPropertyComparison,
3097}
3098/// For Contact Updated triggers, the API validates `operator` against the selected contact property's type and the side of the comparison. The `was` comparison can use any operator supported by the selected property type. The `is` comparison uses the same operators, except number and boolean properties cannot use `empty`. String properties support `any`, `equal`, `not_equal`, `contains`, `not_contains`, `empty`, and `not_empty`. Number properties support `any`, `greater_than`, `less_than`, `numeric_equal`, `numeric_not_equal`, `empty`, and `not_empty`. Boolean properties support `any`, `true`, `false`, `empty`, and `not_empty`. Date properties support `any`, `empty`, `not_empty`, `after`, `before`, and `between`.
3099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
3100pub struct WorkflowContactPropertyComparison {
3101    pub value: WorkflowContactPropertyComparisonValue,
3102    /// The comparison operator. It must be valid for the selected contact property's type and for the `is` or `was` side of the comparison. Number and boolean properties allow `empty` on `was`, but not on `is`.
3103    pub operator: WorkflowContactPropertyComparisonOperator,
3104}
3105/// The amount of time to wait before triggering the next node. Set to `0` to move to the next node immediately.
3106pub type WorkflowTimerAmount = f64;
3107/// The unit of time for the timer action node. m = minutes, h = hours, d = days.
3108#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
3109pub enum WorkflowTimerUnit {
3110    #[serde(rename = "m")]
3111    #[default]
3112    M,
3113    #[serde(rename = "h")]
3114    H,
3115    #[serde(rename = "d")]
3116    D,
3117}
3118impl core::fmt::Display for WorkflowTimerUnit {
3119    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3120        match self {
3121            Self::M => write!(f, "m"),
3122            Self::H => write!(f, "h"),
3123            Self::D => write!(f, "d"),
3124        }
3125    }
3126}
3127#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3128pub struct WorkflowFailureResponse {
3129    pub message: String,
3130}
3131#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3132pub struct GroupResponse {
3133    /// The ID of the group.
3134    pub id: String,
3135    /// The name of the group.
3136    pub name: String,
3137    /// The description of the group.
3138    pub description: String,
3139    /// ISO 8601 timestamp for when the group was created.
3140    #[serde(rename = "createdAt")]
3141    pub created_at: chrono::DateTime<chrono::Utc>,
3142    /// ISO 8601 timestamp for when the group was last updated.
3143    #[serde(rename = "updatedAt")]
3144    pub updated_at: chrono::DateTime<chrono::Utc>,
3145}
3146#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3147pub struct ListGroupsResponse {
3148    pub pagination: Pagination,
3149    pub data: Vec<GroupResponse>,
3150}
3151#[serde_with::skip_serializing_none]
3152#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3153pub struct CreateGroupRequest {
3154    /// The group name. Cannot be the reserved name "Unsorted".
3155    #[validate(length(min = 1u64))]
3156    pub name: String,
3157    /// An optional description for the group.
3158    pub description: Option<String>,
3159}
3160/// At least one field must be provided.
3161#[serde_with::skip_serializing_none]
3162#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
3163pub struct UpdateGroupRequest {
3164    /// The group name. Cannot be the reserved name "Unsorted".
3165    pub name: Option<String>,
3166    /// A description for the group.
3167    pub description: Option<String>,
3168}
3169#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3170pub struct GroupFailureResponse {
3171    pub message: String,
3172}
3173#[serde_with::skip_serializing_none]
3174#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
3175pub struct UpdateEmailMessageRequest {
3176    /// The `contentRevisionId` you last fetched, or the `emailMessageContentRevisionId` you received when creating the campaign.
3177    #[serde(rename = "expectedRevisionId")]
3178    pub expected_revision_id: Option<String>,
3179    pub subject: Option<String>,
3180    #[serde(rename = "previewText")]
3181    pub preview_text: Option<String>,
3182    #[serde(rename = "fromName")]
3183    pub from_name: Option<String>,
3184    /// The email sender email address, without the team's sending domain.
3185    #[serde(rename = "fromEmail")]
3186    pub from_email: Option<String>,
3187    /// Reply-to email. Must be empty or a valid email address.
3188    #[serde(rename = "replyToEmail")]
3189    pub reply_to_email: Option<String>,
3190    /// CC email address. Requires the team to have CC/BCC enabled. Not supported for campaign emails.
3191    #[serde(rename = "ccEmail")]
3192    pub cc_email: Option<String>,
3193    /// BCC email address. Requires the team to have CC/BCC enabled. Not supported for campaign emails.
3194    #[serde(rename = "bccEmail")]
3195    pub bcc_email: Option<String>,
3196    /// ISO 639-1 language code for the email, e.g. `en` or `fr`.
3197    #[serde(rename = "languageCode")]
3198    pub language_code: Option<String>,
3199    /// The rendering format of the email.
3200    #[serde(rename = "emailFormat")]
3201    pub email_format: Option<EmailFormat>,
3202    /// The email body serialized as LMX. Styles must be embedded in the LMX `<Style />` tag.
3203    pub lmx: Option<String>,
3204    /// Fallback values for contact properties, keyed by property name. Per-key merge: a string value sets the fallback, a null value deletes it, and keys omitted from the map are left unchanged.
3205    #[serde(rename = "contactPropertiesFallbacks")]
3206    pub contact_properties_fallbacks: Option<indexmap::IndexMap<String, Option<String>>>,
3207    /// Fallback values for event properties, keyed by property name. Per-key merge: a string value sets the fallback, a null value deletes it, and keys omitted from the map are left unchanged.
3208    #[serde(rename = "eventPropertiesFallbacks")]
3209    pub event_properties_fallbacks: Option<indexmap::IndexMap<String, Option<String>>>,
3210    /// Fallback values for data variables, keyed by variable name. Per-key merge: a string value sets the fallback, a null value deletes it, and keys omitted from the map are left unchanged.
3211    #[serde(rename = "dataVariablesFallbacks")]
3212    pub data_variables_fallbacks: Option<indexmap::IndexMap<String, Option<String>>>,
3213}
3214#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3215pub struct EmailMessageResponse {
3216    /// The ID of the email message.
3217    pub id: String,
3218    /// The campaign this email message belongs to. Present only when the message belongs to a campaign (mutually exclusive with `transactionalId`).
3219    #[serde(rename = "campaignId")]
3220    pub campaign_id: Option<String>,
3221    /// The transactional email this email message belongs to. Present only when the message belongs to a transactional email (mutually exclusive with `campaignId`).
3222    #[serde(rename = "transactionalId")]
3223    pub transactional_id: Option<String>,
3224    /// The email subject.
3225    pub subject: String,
3226    /// The email preview text.
3227    #[serde(rename = "previewText")]
3228    pub preview_text: String,
3229    /// The email sender name.
3230    #[serde(rename = "fromName")]
3231    pub from_name: String,
3232    /// The email sender email address, without the team's sending domain.
3233    #[serde(rename = "fromEmail")]
3234    pub from_email: String,
3235    /// The email reply-to address.
3236    #[serde(rename = "replyToEmail")]
3237    pub reply_to_email: String,
3238    /// The email CC address. Only present when set.
3239    #[serde(rename = "ccEmail")]
3240    pub cc_email: Option<String>,
3241    /// The email BCC address. Only present when set.
3242    #[serde(rename = "bccEmail")]
3243    pub bcc_email: Option<String>,
3244    /// ISO 639-1 language code for the email, e.g. `en` or `fr`. Only present when set.
3245    #[serde(rename = "languageCode")]
3246    pub language_code: Option<String>,
3247    /// The rendering format of the email.
3248    #[serde(rename = "emailFormat")]
3249    pub email_format: EmailFormat,
3250    /// The email body serialized as LMX.
3251    pub lmx: String,
3252    /// The current content revision. Pass this as `expectedRevisionId` on your next update.
3253    #[serde(rename = "contentRevisionId")]
3254    pub content_revision_id: Option<String>,
3255    #[serde(rename = "updatedAt")]
3256    pub updated_at: chrono::DateTime<chrono::Utc>,
3257    /// Fallback values for contact properties. Only present when set.
3258    #[serde(rename = "contactPropertiesFallbacks")]
3259    pub contact_properties_fallbacks: Option<indexmap::IndexMap<String, String>>,
3260    /// Fallback values for event properties. Only present when set.
3261    #[serde(rename = "eventPropertiesFallbacks")]
3262    pub event_properties_fallbacks: Option<indexmap::IndexMap<String, String>>,
3263    /// Fallback values for data variables. Only present when set.
3264    #[serde(rename = "dataVariablesFallbacks")]
3265    pub data_variables_fallbacks: Option<indexmap::IndexMap<String, String>>,
3266    /// Non-fatal issues raised while compiling the submitted LMX. Only present on update responses when warnings were produced.
3267    pub warnings: Option<Vec<EmailMessageResponseWarning>>,
3268}
3269#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3270pub struct EmailMessageFailureResponse {
3271    pub message: String,
3272}
3273#[serde_with::skip_serializing_none]
3274#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3275pub struct EmailMessagePreviewRequest {
3276    /// One or more addresses to send the preview to.
3277    #[validate(length(min = 1u64))]
3278    pub emails: Vec<String>,
3279    /// Contact property values to render. Accepted for campaign and workflow previews.
3280    /// - Example: `Some({"firstName":"Alex"})`
3281    #[serde(rename = "contactProperties")]
3282    pub contact_properties: Option<indexmap::IndexMap<String, String>>,
3283    /// Event property values to render. Accepted for workflow previews only.
3284    /// - Example: `Some({"planName":"Pro"})`
3285    #[serde(rename = "eventProperties")]
3286    pub event_properties: Option<indexmap::IndexMap<String, String>>,
3287    /// Transactional data variables to render. Accepted for transactional previews only.
3288    /// - Example: `Some({"loginUrl":"https://app.company.com/login"})`
3289    #[serde(rename = "dataVariables")]
3290    pub data_variables: Option<indexmap::IndexMap<String, String>>,
3291}
3292#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3293pub struct EmailMessagePreviewResponse {
3294    /// The ID of the email message the preview was sent for.
3295    pub id: String,
3296}
3297#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3298pub struct EmailMessageGuardianResponse {
3299    /// Validation errors. These must be resolved before the email can be published.
3300    pub errors: Vec<GuardianRule>,
3301    /// Validation warnings. These are advisory and do not block publishing.
3302    pub warnings: Vec<GuardianRule>,
3303}
3304#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3305pub struct GuardianRule {
3306    /// The identifier of the Guardian rule that fired.
3307    pub rule: GuardianRuleRule,
3308    /// A short summary of the rule.
3309    pub title: String,
3310    /// A longer explanation of why the issue matters.
3311    pub description: String,
3312    /// The specific elements that triggered the rule.
3313    pub items: Vec<GuardianRuleItem>,
3314}
3315#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3316pub struct CreateUploadRequest {
3317    /// The MIME type of the file to upload. Supported types are `image/jpeg`, `image/png`, `image/gif` and `image/webp`.
3318    #[serde(rename = "contentType")]
3319    #[validate(length(min = 1u64))]
3320    pub content_type: String,
3321    /// The size of the file in bytes. Must be a positive integer no greater than 4,000,000 bytes.
3322    #[serde(rename = "contentLength")]
3323    pub content_length: i64,
3324}
3325#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3326pub struct CreateUploadResponse {
3327    /// The ID of the created asset. Pass this as `emailAssetId` to `POST /v1/uploads/{emailAssetId}/complete` once the file has been uploaded.
3328    #[serde(rename = "emailAssetId")]
3329    pub email_asset_id: String,
3330    /// The pre-signed URL to upload the file to with an HTTP `PUT` request. Send the same `Content-Type` and `Content-Length` used in the create request.
3331    #[serde(rename = "presignedUrl")]
3332    pub presigned_url: String,
3333}
3334#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3335pub struct CompleteUploadResponse {
3336    /// The ID of the created asset.
3337    #[serde(rename = "emailAssetId")]
3338    pub email_asset_id: String,
3339    /// The public URL of the uploaded asset.
3340    #[serde(rename = "finalUrl")]
3341    pub final_url: String,
3342}
3343#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3344pub struct UploadLimitExceededFailureResponse {
3345    pub message: Option<String>,
3346    /// The maximum number of uploads allowed per window.
3347    #[serde(rename = "maxUploads")]
3348    pub max_uploads: Option<i64>,
3349    /// The number of hours in the upload limit window.
3350    #[serde(rename = "windowHours")]
3351    pub window_hours: Option<i64>,
3352}
3353#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3354pub struct UploadFailureResponse {
3355    pub message: String,
3356    /// Present when the request was rejected for an unsupported `contentType`. Lists the accepted MIME types.
3357    #[serde(rename = "supportedContentTypes")]
3358    pub supported_content_types: Option<Vec<String>>,
3359    /// Present when the upload exceeds the size limit. The maximum allowed size in bytes.
3360    #[serde(rename = "maxBytes")]
3361    pub max_bytes: Option<i64>,
3362}
3363#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
3364pub struct Pagination {
3365    #[serde(rename = "totalResults")]
3366    pub total_results: f64,
3367    #[serde(rename = "returnedResults")]
3368    pub returned_results: f64,
3369    #[serde(rename = "perPage")]
3370    pub per_page: f64,
3371    #[serde(rename = "totalPages")]
3372    pub total_pages: f64,
3373    #[serde(rename = "nextCursor")]
3374    pub next_cursor: Option<String>,
3375    #[serde(rename = "nextPage")]
3376    pub next_page: Option<String>,
3377}
3378#[serde_with::skip_serializing_none]
3379#[derive(
3380    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3381)]
3382pub struct WebhookContactIdentity {
3383    #[validate(length(min = 1u64))]
3384    pub id: String,
3385    #[validate(length(min = 1u64))]
3386    pub email: String,
3387    #[serde(rename = "userId")]
3388    pub user_id: Option<String>,
3389}
3390#[derive(
3391    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3392)]
3393#[serde(default)]
3394pub struct WebhookBasePayload {
3395    #[serde(rename = "eventName")]
3396    #[validate(length(min = 1u64))]
3397    pub event_name: String,
3398    /// Unix timestamp in seconds.
3399    #[serde(rename = "eventTime")]
3400    pub event_time: i64,
3401    #[serde(rename = "webhookSchemaVersion")]
3402    #[default("1.0.0".to_string())]
3403    pub webhook_schema_version: String,
3404    #[serde(rename = "contactIdentity")]
3405    #[validate(nested)]
3406    pub contact_identity: WebhookContactIdentity,
3407}
3408/// Full contact object, including custom properties.
3409#[serde_with::skip_serializing_none]
3410#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3411pub struct WebhookContact {
3412    #[validate(length(min = 1u64))]
3413    pub id: String,
3414    #[validate(length(min = 1u64))]
3415    pub email: String,
3416    #[serde(rename = "firstName")]
3417    pub first_name: Option<String>,
3418    #[serde(rename = "lastName")]
3419    pub last_name: Option<String>,
3420    #[validate(length(min = 1u64))]
3421    pub source: String,
3422    pub subscribed: bool,
3423    #[serde(rename = "userGroup")]
3424    #[validate(length(min = 1u64))]
3425    pub user_group: String,
3426    #[serde(rename = "userId")]
3427    pub user_id: Option<String>,
3428    pub notes: Option<String>,
3429    /// An object of mailing list IDs and boolean subscription statuses.
3430    #[serde(rename = "mailingLists")]
3431    pub mailing_lists: indexmap::IndexMap<String, bool>,
3432    /// Double opt-in status.
3433    #[serde(rename = "optInStatus")]
3434    pub opt_in_status: Option<OptInStatus>,
3435    /// Additional properties not defined in the schema.
3436    #[serde(flatten)]
3437    pub additional_properties: indexmap::IndexMap<String, serde_json::Value>,
3438}
3439#[derive(
3440    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3441)]
3442pub struct WebhookEmail {
3443    /// The ID of the email.
3444    #[validate(length(min = 1u64))]
3445    pub id: String,
3446    /// The ID of the sent version of the campaign, workflow or transactional email.
3447    #[serde(rename = "emailMessageId")]
3448    #[validate(length(min = 1u64))]
3449    pub email_message_id: String,
3450    /// The subject of the email.
3451    #[validate(length(min = 1u64))]
3452    pub subject: String,
3453}
3454/// Details of the mailing list.
3455#[serde_with::skip_serializing_none]
3456#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3457pub struct WebhookMailingList {
3458    #[validate(length(min = 1u64))]
3459    pub id: String,
3460    #[validate(length(min = 1u64))]
3461    pub name: String,
3462    pub description: Option<String>,
3463    #[serde(rename = "isPublic")]
3464    pub is_public: bool,
3465}
3466#[serde_with::skip_serializing_none]
3467#[derive(
3468    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3469)]
3470#[serde(default)]
3471pub struct WebhookEmailMetricPayload {
3472    #[serde(rename = "eventName")]
3473    #[validate(length(min = 1u64))]
3474    pub event_name: String,
3475    /// Unix timestamp in seconds.
3476    #[serde(rename = "eventTime")]
3477    pub event_time: i64,
3478    #[serde(rename = "webhookSchemaVersion")]
3479    #[default("1.0.0".to_string())]
3480    pub webhook_schema_version: String,
3481    #[serde(rename = "contactIdentity")]
3482    #[validate(nested)]
3483    pub contact_identity: WebhookContactIdentity,
3484    #[validate(nested)]
3485    pub email: WebhookEmail,
3486    /// The type of email this event relates to. Workflow emails use `loop`.
3487    #[serde(rename = "sourceType")]
3488    pub source_type: WebhookEmailMetricPayloadSourceType,
3489    /// The ID of the campaign if `sourceType` is `campaign`.
3490    #[serde(rename = "campaignId")]
3491    pub campaign_id: Option<String>,
3492    /// The ID of the workflow if `sourceType` is `loop`.
3493    #[serde(rename = "loopId")]
3494    pub loop_id: Option<String>,
3495    /// The ID of the transactional email if `sourceType` is `transactional`.
3496    #[serde(rename = "transactionalId")]
3497    pub transactional_id: Option<String>,
3498}
3499#[serde_with::skip_serializing_none]
3500#[derive(
3501    Debug, Clone, PartialEq, Serialize, Deserialize, validator::Validate, oas3_gen_support::Default,
3502)]
3503#[serde(default)]
3504pub struct WebhookMarketingEmailMetricPayload {
3505    #[serde(rename = "eventName")]
3506    #[validate(length(min = 1u64))]
3507    pub event_name: String,
3508    /// Unix timestamp in seconds.
3509    #[serde(rename = "eventTime")]
3510    pub event_time: i64,
3511    #[serde(rename = "webhookSchemaVersion")]
3512    #[default("1.0.0".to_string())]
3513    pub webhook_schema_version: String,
3514    #[serde(rename = "contactIdentity")]
3515    #[validate(nested)]
3516    pub contact_identity: WebhookContactIdentity,
3517    #[validate(nested)]
3518    pub email: WebhookEmail,
3519    /// The type of email this event relates to. Workflow emails use `loop`. Not available for transactional emails.
3520    #[serde(rename = "sourceType")]
3521    pub source_type: WebhookMarketingEmailMetricPayloadSourceType,
3522    /// The ID of the campaign if `sourceType` is `campaign`.
3523    #[serde(rename = "campaignId")]
3524    pub campaign_id: Option<String>,
3525    /// The ID of the workflow if `sourceType` is `loop`.
3526    #[serde(rename = "loopId")]
3527    pub loop_id: Option<String>,
3528}
3529#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3530#[serde(default)]
3531pub struct WebhookContactUnsubscribedPayload {
3532    #[serde(rename = "eventName")]
3533    #[default("contact.unsubscribed".to_string())]
3534    pub event_name: String,
3535    /// Unix timestamp in seconds.
3536    #[serde(rename = "eventTime")]
3537    pub event_time: i64,
3538    #[serde(rename = "webhookSchemaVersion")]
3539    #[default("1.0.0".to_string())]
3540    pub webhook_schema_version: String,
3541    #[serde(rename = "contactIdentity")]
3542    #[validate(nested)]
3543    pub contact_identity: WebhookContactIdentity,
3544}
3545#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3546#[serde(default)]
3547pub struct WebhookContactCreatedPayload {
3548    #[serde(rename = "eventName")]
3549    #[default("contact.created".to_string())]
3550    pub event_name: String,
3551    /// Unix timestamp in seconds.
3552    #[serde(rename = "eventTime")]
3553    pub event_time: i64,
3554    #[serde(rename = "webhookSchemaVersion")]
3555    #[default("1.0.0".to_string())]
3556    pub webhook_schema_version: String,
3557    #[serde(rename = "contactIdentity")]
3558    #[validate(nested)]
3559    pub contact_identity: WebhookContactIdentity,
3560    /// Full contact object, including custom properties.
3561    #[validate(nested)]
3562    pub contact: WebhookContact,
3563}
3564#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3565#[serde(default)]
3566pub struct WebhookContactDeletedPayload {
3567    #[serde(rename = "eventName")]
3568    #[default("contact.deleted".to_string())]
3569    pub event_name: String,
3570    /// Unix timestamp in seconds.
3571    #[serde(rename = "eventTime")]
3572    pub event_time: i64,
3573    #[serde(rename = "webhookSchemaVersion")]
3574    #[default("1.0.0".to_string())]
3575    pub webhook_schema_version: String,
3576    #[serde(rename = "contactIdentity")]
3577    #[validate(nested)]
3578    pub contact_identity: WebhookContactIdentity,
3579}
3580#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3581#[serde(default)]
3582pub struct WebhookContactMailingListSubscribedPayload {
3583    #[serde(rename = "eventName")]
3584    #[default("contact.mailingList.subscribed".to_string())]
3585    pub event_name: String,
3586    /// Unix timestamp in seconds.
3587    #[serde(rename = "eventTime")]
3588    pub event_time: i64,
3589    #[serde(rename = "webhookSchemaVersion")]
3590    #[default("1.0.0".to_string())]
3591    pub webhook_schema_version: String,
3592    #[serde(rename = "contactIdentity")]
3593    #[validate(nested)]
3594    pub contact_identity: WebhookContactIdentity,
3595    /// Details of the mailing list.
3596    #[serde(rename = "mailingList")]
3597    #[validate(nested)]
3598    pub mailing_list: WebhookMailingList,
3599}
3600#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3601#[serde(default)]
3602pub struct WebhookContactMailingListUnsubscribedPayload {
3603    #[serde(rename = "eventName")]
3604    #[default("contact.mailingList.unsubscribed".to_string())]
3605    pub event_name: String,
3606    /// Unix timestamp in seconds.
3607    #[serde(rename = "eventTime")]
3608    pub event_time: i64,
3609    #[serde(rename = "webhookSchemaVersion")]
3610    #[default("1.0.0".to_string())]
3611    pub webhook_schema_version: String,
3612    #[serde(rename = "contactIdentity")]
3613    #[validate(nested)]
3614    pub contact_identity: WebhookContactIdentity,
3615    /// Details of the mailing list.
3616    #[serde(rename = "mailingList")]
3617    #[validate(nested)]
3618    pub mailing_list: WebhookMailingList,
3619}
3620#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3621#[serde(default)]
3622pub struct WebhookTransactionalEmailSentPayload {
3623    #[serde(rename = "eventName")]
3624    #[default("transactional.email.sent".to_string())]
3625    pub event_name: String,
3626    /// Unix timestamp in seconds.
3627    #[serde(rename = "eventTime")]
3628    pub event_time: i64,
3629    #[serde(rename = "webhookSchemaVersion")]
3630    #[default("1.0.0".to_string())]
3631    pub webhook_schema_version: String,
3632    #[serde(rename = "contactIdentity")]
3633    #[validate(nested)]
3634    pub contact_identity: WebhookContactIdentity,
3635    #[serde(rename = "transactionalId")]
3636    #[validate(length(min = 1u64))]
3637    pub transactional_id: String,
3638    #[serde(rename = "transactionalName")]
3639    #[validate(length(min = 1u64))]
3640    pub transactional_name: String,
3641    #[validate(nested)]
3642    pub email: WebhookEmail,
3643}
3644#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3645#[serde(default)]
3646pub struct WebhookCampaignEmailSentPayload {
3647    #[serde(rename = "eventName")]
3648    #[default("campaign.email.sent".to_string())]
3649    pub event_name: String,
3650    /// Unix timestamp in seconds.
3651    #[serde(rename = "eventTime")]
3652    pub event_time: i64,
3653    #[serde(rename = "webhookSchemaVersion")]
3654    #[default("1.0.0".to_string())]
3655    pub webhook_schema_version: String,
3656    #[serde(rename = "contactIdentity")]
3657    #[validate(nested)]
3658    pub contact_identity: WebhookContactIdentity,
3659    #[serde(rename = "campaignId")]
3660    #[validate(length(min = 1u64))]
3661    pub campaign_id: String,
3662    #[serde(rename = "campaignName")]
3663    #[validate(length(min = 1u64))]
3664    pub campaign_name: String,
3665    #[validate(nested)]
3666    pub email: WebhookEmail,
3667    /// The mailing list(s) the email was sent to, or an empty array.
3668    #[serde(rename = "mailingLists")]
3669    #[validate(nested)]
3670    pub mailing_lists: Vec<WebhookMailingList>,
3671}
3672#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3673#[serde(default)]
3674pub struct WebhookLoopEmailSentPayload {
3675    #[serde(rename = "eventName")]
3676    #[default("loop.email.sent".to_string())]
3677    pub event_name: String,
3678    /// Unix timestamp in seconds.
3679    #[serde(rename = "eventTime")]
3680    pub event_time: i64,
3681    #[serde(rename = "webhookSchemaVersion")]
3682    #[default("1.0.0".to_string())]
3683    pub webhook_schema_version: String,
3684    #[serde(rename = "contactIdentity")]
3685    #[validate(nested)]
3686    pub contact_identity: WebhookContactIdentity,
3687    /// The ID of the workflow.
3688    #[serde(rename = "loopId")]
3689    #[validate(length(min = 1u64))]
3690    pub loop_id: String,
3691    /// The name of the workflow.
3692    #[serde(rename = "loopName")]
3693    #[validate(length(min = 1u64))]
3694    pub loop_name: String,
3695    #[validate(nested)]
3696    pub email: WebhookEmail,
3697    /// The mailing list(s) the email was sent to, or an empty array.
3698    #[serde(rename = "mailingLists")]
3699    #[validate(nested)]
3700    pub mailing_lists: Vec<WebhookMailingList>,
3701}
3702#[serde_with::skip_serializing_none]
3703#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3704#[serde(default)]
3705pub struct WebhookEmailDeliveredPayload {
3706    #[serde(rename = "eventName")]
3707    #[default("email.delivered".to_string())]
3708    pub event_name: String,
3709    /// Unix timestamp in seconds.
3710    #[serde(rename = "eventTime")]
3711    pub event_time: i64,
3712    #[serde(rename = "webhookSchemaVersion")]
3713    #[default("1.0.0".to_string())]
3714    pub webhook_schema_version: String,
3715    #[serde(rename = "contactIdentity")]
3716    #[validate(nested)]
3717    pub contact_identity: WebhookContactIdentity,
3718    #[validate(nested)]
3719    pub email: WebhookEmail,
3720    /// The type of email this event relates to. Workflow emails use `loop`.
3721    #[serde(rename = "sourceType")]
3722    pub source_type: WebhookEmailMetricPayloadSourceType,
3723    /// The ID of the campaign if `sourceType` is `campaign`.
3724    #[serde(rename = "campaignId")]
3725    pub campaign_id: Option<String>,
3726    /// The ID of the workflow if `sourceType` is `loop`.
3727    #[serde(rename = "loopId")]
3728    pub loop_id: Option<String>,
3729    /// The ID of the transactional email if `sourceType` is `transactional`.
3730    #[serde(rename = "transactionalId")]
3731    pub transactional_id: Option<String>,
3732}
3733#[serde_with::skip_serializing_none]
3734#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3735#[serde(default)]
3736pub struct WebhookEmailSoftBouncedPayload {
3737    #[serde(rename = "eventName")]
3738    #[default("email.softBounced".to_string())]
3739    pub event_name: String,
3740    /// Unix timestamp in seconds.
3741    #[serde(rename = "eventTime")]
3742    pub event_time: i64,
3743    #[serde(rename = "webhookSchemaVersion")]
3744    #[default("1.0.0".to_string())]
3745    pub webhook_schema_version: String,
3746    #[serde(rename = "contactIdentity")]
3747    #[validate(nested)]
3748    pub contact_identity: WebhookContactIdentity,
3749    #[validate(nested)]
3750    pub email: WebhookEmail,
3751    /// The type of email this event relates to. Workflow emails use `loop`.
3752    #[serde(rename = "sourceType")]
3753    pub source_type: WebhookEmailMetricPayloadSourceType,
3754    /// The ID of the campaign if `sourceType` is `campaign`.
3755    #[serde(rename = "campaignId")]
3756    pub campaign_id: Option<String>,
3757    /// The ID of the workflow if `sourceType` is `loop`.
3758    #[serde(rename = "loopId")]
3759    pub loop_id: Option<String>,
3760    /// The ID of the transactional email if `sourceType` is `transactional`.
3761    #[serde(rename = "transactionalId")]
3762    pub transactional_id: Option<String>,
3763}
3764#[serde_with::skip_serializing_none]
3765#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3766#[serde(default)]
3767pub struct WebhookEmailHardBouncedPayload {
3768    #[serde(rename = "eventName")]
3769    #[default("email.hardBounced".to_string())]
3770    pub event_name: String,
3771    /// Unix timestamp in seconds.
3772    #[serde(rename = "eventTime")]
3773    pub event_time: i64,
3774    #[serde(rename = "webhookSchemaVersion")]
3775    #[default("1.0.0".to_string())]
3776    pub webhook_schema_version: String,
3777    #[serde(rename = "contactIdentity")]
3778    #[validate(nested)]
3779    pub contact_identity: WebhookContactIdentity,
3780    #[validate(nested)]
3781    pub email: WebhookEmail,
3782    /// The type of email this event relates to. Workflow emails use `loop`.
3783    #[serde(rename = "sourceType")]
3784    pub source_type: WebhookEmailMetricPayloadSourceType,
3785    /// The ID of the campaign if `sourceType` is `campaign`.
3786    #[serde(rename = "campaignId")]
3787    pub campaign_id: Option<String>,
3788    /// The ID of the workflow if `sourceType` is `loop`.
3789    #[serde(rename = "loopId")]
3790    pub loop_id: Option<String>,
3791    /// The ID of the transactional email if `sourceType` is `transactional`.
3792    #[serde(rename = "transactionalId")]
3793    pub transactional_id: Option<String>,
3794}
3795#[serde_with::skip_serializing_none]
3796#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3797#[serde(default)]
3798pub struct WebhookEmailClickedPayload {
3799    #[serde(rename = "eventName")]
3800    #[default("email.clicked".to_string())]
3801    pub event_name: String,
3802    /// Unix timestamp in seconds.
3803    #[serde(rename = "eventTime")]
3804    pub event_time: i64,
3805    #[serde(rename = "webhookSchemaVersion")]
3806    #[default("1.0.0".to_string())]
3807    pub webhook_schema_version: String,
3808    #[serde(rename = "contactIdentity")]
3809    #[validate(nested)]
3810    pub contact_identity: WebhookContactIdentity,
3811    #[validate(nested)]
3812    pub email: WebhookEmail,
3813    /// The type of email this event relates to. Workflow emails use `loop`. Not available for transactional emails.
3814    #[serde(rename = "sourceType")]
3815    pub source_type: WebhookMarketingEmailMetricPayloadSourceType,
3816    /// The ID of the campaign if `sourceType` is `campaign`.
3817    #[serde(rename = "campaignId")]
3818    pub campaign_id: Option<String>,
3819    /// The ID of the workflow if `sourceType` is `loop`.
3820    #[serde(rename = "loopId")]
3821    pub loop_id: Option<String>,
3822}
3823#[serde_with::skip_serializing_none]
3824#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3825#[serde(default)]
3826pub struct WebhookEmailUnsubscribedPayload {
3827    #[serde(rename = "eventName")]
3828    #[default("email.unsubscribed".to_string())]
3829    pub event_name: String,
3830    /// Unix timestamp in seconds.
3831    #[serde(rename = "eventTime")]
3832    pub event_time: i64,
3833    #[serde(rename = "webhookSchemaVersion")]
3834    #[default("1.0.0".to_string())]
3835    pub webhook_schema_version: String,
3836    #[serde(rename = "contactIdentity")]
3837    #[validate(nested)]
3838    pub contact_identity: WebhookContactIdentity,
3839    #[validate(nested)]
3840    pub email: WebhookEmail,
3841    /// The type of email this event relates to. Workflow emails use `loop`. Not available for transactional emails.
3842    #[serde(rename = "sourceType")]
3843    pub source_type: WebhookMarketingEmailMetricPayloadSourceType,
3844    /// The ID of the campaign if `sourceType` is `campaign`.
3845    #[serde(rename = "campaignId")]
3846    pub campaign_id: Option<String>,
3847    /// The ID of the workflow if `sourceType` is `loop`.
3848    #[serde(rename = "loopId")]
3849    pub loop_id: Option<String>,
3850}
3851#[serde_with::skip_serializing_none]
3852#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3853#[serde(default)]
3854pub struct WebhookEmailResubscribedPayload {
3855    #[serde(rename = "eventName")]
3856    #[default("email.resubscribed".to_string())]
3857    pub event_name: String,
3858    /// Unix timestamp in seconds.
3859    #[serde(rename = "eventTime")]
3860    pub event_time: i64,
3861    #[serde(rename = "webhookSchemaVersion")]
3862    #[default("1.0.0".to_string())]
3863    pub webhook_schema_version: String,
3864    #[serde(rename = "contactIdentity")]
3865    #[validate(nested)]
3866    pub contact_identity: WebhookContactIdentity,
3867    #[validate(nested)]
3868    pub email: WebhookEmail,
3869    /// The type of email this event relates to. Workflow emails use `loop`. Not available for transactional emails.
3870    #[serde(rename = "sourceType")]
3871    pub source_type: WebhookMarketingEmailMetricPayloadSourceType,
3872    /// The ID of the campaign if `sourceType` is `campaign`.
3873    #[serde(rename = "campaignId")]
3874    pub campaign_id: Option<String>,
3875    /// The ID of the workflow if `sourceType` is `loop`.
3876    #[serde(rename = "loopId")]
3877    pub loop_id: Option<String>,
3878}
3879#[serde_with::skip_serializing_none]
3880#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3881#[serde(default)]
3882pub struct WebhookEmailOpenedPayload {
3883    #[serde(rename = "eventName")]
3884    #[default("email.opened".to_string())]
3885    pub event_name: String,
3886    /// Unix timestamp in seconds.
3887    #[serde(rename = "eventTime")]
3888    pub event_time: i64,
3889    #[serde(rename = "webhookSchemaVersion")]
3890    #[default("1.0.0".to_string())]
3891    pub webhook_schema_version: String,
3892    #[serde(rename = "contactIdentity")]
3893    #[validate(nested)]
3894    pub contact_identity: WebhookContactIdentity,
3895    #[validate(nested)]
3896    pub email: WebhookEmail,
3897    /// The type of email this event relates to. Workflow emails use `loop`. Not available for transactional emails.
3898    #[serde(rename = "sourceType")]
3899    pub source_type: WebhookMarketingEmailMetricPayloadSourceType,
3900    /// The ID of the campaign if `sourceType` is `campaign`.
3901    #[serde(rename = "campaignId")]
3902    pub campaign_id: Option<String>,
3903    /// The ID of the workflow if `sourceType` is `loop`.
3904    #[serde(rename = "loopId")]
3905    pub loop_id: Option<String>,
3906}
3907#[serde_with::skip_serializing_none]
3908#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
3909#[serde(default)]
3910pub struct WebhookEmailSpamReportedPayload {
3911    #[serde(rename = "eventName")]
3912    #[default("email.spamReported".to_string())]
3913    pub event_name: String,
3914    /// Unix timestamp in seconds.
3915    #[serde(rename = "eventTime")]
3916    pub event_time: i64,
3917    #[serde(rename = "webhookSchemaVersion")]
3918    #[default("1.0.0".to_string())]
3919    pub webhook_schema_version: String,
3920    #[serde(rename = "contactIdentity")]
3921    #[validate(nested)]
3922    pub contact_identity: WebhookContactIdentity,
3923    #[validate(nested)]
3924    pub email: WebhookEmail,
3925    /// The type of email this event relates to. Workflow emails use `loop`.
3926    #[serde(rename = "sourceType")]
3927    pub source_type: WebhookEmailMetricPayloadSourceType,
3928    /// The ID of the campaign if `sourceType` is `campaign`.
3929    #[serde(rename = "campaignId")]
3930    pub campaign_id: Option<String>,
3931    /// The ID of the workflow if `sourceType` is `loop`.
3932    #[serde(rename = "loopId")]
3933    pub loop_id: Option<String>,
3934    /// The ID of the transactional email if `sourceType` is `transactional`.
3935    #[serde(rename = "transactionalId")]
3936    pub transactional_id: Option<String>,
3937}
3938#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
3939#[serde(default)]
3940pub struct WebhookTestingTestEventPayload {
3941    #[serde(rename = "eventName")]
3942    #[default("testing.testEvent".to_string())]
3943    pub event_name: String,
3944    /// Unix timestamp in seconds.
3945    #[serde(rename = "eventTime")]
3946    pub event_time: i64,
3947    #[default("test".to_string())]
3948    pub message: String,
3949    #[serde(rename = "webhookSchemaVersion")]
3950    #[default("1.0.0".to_string())]
3951    pub webhook_schema_version: String,
3952}
3953#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
3954pub enum OptInStatus {
3955    #[serde(rename = "accepted")]
3956    #[default]
3957    Accepted,
3958    #[serde(rename = "pending")]
3959    Pending,
3960    #[serde(rename = "rejected")]
3961    Rejected,
3962}
3963impl core::fmt::Display for OptInStatus {
3964    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3965        match self {
3966            Self::Accepted => write!(f, "accepted"),
3967            Self::Pending => write!(f, "pending"),
3968            Self::Rejected => write!(f, "rejected"),
3969        }
3970    }
3971}
3972#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
3973pub enum Status {
3974    #[serde(rename = "accepted")]
3975    #[default]
3976    Accepted,
3977    #[serde(rename = "pending")]
3978    Pending,
3979    #[serde(rename = "rejected")]
3980    Rejected,
3981}
3982impl core::fmt::Display for Status {
3983    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3984        match self {
3985            Self::Accepted => write!(f, "accepted"),
3986            Self::Pending => write!(f, "pending"),
3987            Self::Rejected => write!(f, "rejected"),
3988        }
3989    }
3990}
3991#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
3992pub enum IncomingWebhookPlatform {
3993    #[serde(rename = "clerk")]
3994    #[default]
3995    Clerk,
3996    #[serde(rename = "polar")]
3997    Polar,
3998    #[serde(rename = "stripe")]
3999    Stripe,
4000    #[serde(rename = "supabase")]
4001    Supabase,
4002}
4003impl core::fmt::Display for IncomingWebhookPlatform {
4004    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
4005        match self {
4006            Self::Clerk => write!(f, "clerk"),
4007            Self::Polar => write!(f, "polar"),
4008            Self::Stripe => write!(f, "stripe"),
4009            Self::Supabase => write!(f, "supabase"),
4010        }
4011    }
4012}
4013/// Test your API key and get team context.
4014#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4015pub struct TestApiKeyRequest {}
4016impl TestApiKeyRequest {
4017    /// Parse the HTTP response into the response enum.
4018    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<TestApiKeyResponse> {
4019        let status = req.status();
4020        if status == http::StatusCode::OK {
4021            let data =
4022                oas3_gen_support::Diagnostics::<ApiKey200Response>::json_with_diagnostics(req)
4023                    .await?;
4024            return Ok(TestApiKeyResponse::Ok(data));
4025        }
4026        if status == http::StatusCode::UNAUTHORIZED {
4027            let data =
4028                oas3_gen_support::Diagnostics::<ApiKey401Response>::json_with_diagnostics(req)
4029                    .await?;
4030            return Ok(TestApiKeyResponse::Unauthorized(data));
4031        }
4032        let _ = req.bytes().await?;
4033        return Ok(TestApiKeyResponse::Unknown);
4034    }
4035}
4036/// Response types for testApiKey
4037#[derive(Debug, Clone)]
4038pub enum TestApiKeyResponse {
4039    ///200: Success
4040    Ok(ApiKey200Response),
4041    ///401: Invalid API key
4042    Unauthorized(ApiKey401Response),
4043    ///default: Unknown response
4044    Unknown,
4045}
4046#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
4047pub struct GetAudienceSegmentRequestPath {
4048    /// The ID of the audience segment.
4049    #[validate(length(min = 1u64))]
4050    pub audience_segment_id: String,
4051}
4052/// Retrieve a single audience segment by ID.
4053#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4054pub struct GetAudienceSegmentRequest {
4055    #[validate(nested)]
4056    pub path: GetAudienceSegmentRequestPath,
4057}
4058impl GetAudienceSegmentRequest {
4059    /// Parse the HTTP response into the response enum.
4060    pub async fn parse_response(
4061        req: reqwest::Response,
4062    ) -> anyhow::Result<GetAudienceSegmentResponse> {
4063        let status = req.status();
4064        if status == http::StatusCode::OK {
4065            let data =
4066                oas3_gen_support::Diagnostics::<AudienceSegmentResponse>::json_with_diagnostics(
4067                    req,
4068                )
4069                .await?;
4070            return Ok(GetAudienceSegmentResponse::Ok(data));
4071        }
4072        if status == http::StatusCode::BAD_REQUEST {
4073            let data = oas3_gen_support::Diagnostics::<
4074                AudienceSegmentFailureResponse,
4075            >::json_with_diagnostics(req)
4076                .await?;
4077            return Ok(GetAudienceSegmentResponse::BadRequest(data));
4078        }
4079        if status == http::StatusCode::UNAUTHORIZED {
4080            let _ = req.bytes().await?;
4081            return Ok(GetAudienceSegmentResponse::Unauthorized);
4082        }
4083        if status == http::StatusCode::NOT_FOUND {
4084            let data = oas3_gen_support::Diagnostics::<
4085                AudienceSegmentFailureResponse,
4086            >::json_with_diagnostics(req)
4087                .await?;
4088            return Ok(GetAudienceSegmentResponse::NotFound(data));
4089        }
4090        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4091            let _ = req.bytes().await?;
4092            return Ok(GetAudienceSegmentResponse::MethodNotAllowed);
4093        }
4094        let _ = req.bytes().await?;
4095        return Ok(GetAudienceSegmentResponse::Unknown);
4096    }
4097}
4098/// Response types for getAudienceSegment
4099#[derive(Debug, Clone)]
4100pub enum GetAudienceSegmentResponse {
4101    ///200: Successful.
4102    Ok(AudienceSegmentResponse),
4103    ///400: Invalid `audienceSegmentId`.
4104    BadRequest(AudienceSegmentFailureResponse),
4105    ///401: Invalid API key or content API not enabled for this team.
4106    Unauthorized,
4107    ///404: Audience segment not found.
4108    NotFound(AudienceSegmentFailureResponse),
4109    ///405: Wrong HTTP request method.
4110    MethodNotAllowed,
4111    ///default: Unknown response
4112    Unknown,
4113}
4114#[serde_with::skip_serializing_none]
4115#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
4116pub struct ListAudienceSegmentsRequestQuery {
4117    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
4118    #[serde(rename = "perPage")]
4119    pub per_page: Option<String>,
4120    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
4121    pub cursor: Option<String>,
4122}
4123/// Retrieve a paginated list of audience segments, most recently created first.
4124#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4125pub struct ListAudienceSegmentsRequest {
4126    pub query: ListAudienceSegmentsRequestQuery,
4127}
4128impl ListAudienceSegmentsRequest {
4129    /// Parse the HTTP response into the response enum.
4130    pub async fn parse_response(
4131        req: reqwest::Response,
4132    ) -> anyhow::Result<ListAudienceSegmentsResponseEnum> {
4133        let status = req.status();
4134        if status == http::StatusCode::OK {
4135            let data = oas3_gen_support::Diagnostics::<
4136                ListAudienceSegmentsResponse,
4137            >::json_with_diagnostics(req)
4138                .await?;
4139            return Ok(ListAudienceSegmentsResponseEnum::Ok(data));
4140        }
4141        if status == http::StatusCode::BAD_REQUEST {
4142            let data = oas3_gen_support::Diagnostics::<
4143                AudienceSegmentFailureResponse,
4144            >::json_with_diagnostics(req)
4145                .await?;
4146            return Ok(ListAudienceSegmentsResponseEnum::BadRequest(data));
4147        }
4148        if status == http::StatusCode::UNAUTHORIZED {
4149            let _ = req.bytes().await?;
4150            return Ok(ListAudienceSegmentsResponseEnum::Unauthorized);
4151        }
4152        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4153            let _ = req.bytes().await?;
4154            return Ok(ListAudienceSegmentsResponseEnum::MethodNotAllowed);
4155        }
4156        let _ = req.bytes().await?;
4157        return Ok(ListAudienceSegmentsResponseEnum::Unknown);
4158    }
4159}
4160/// Response types for listAudienceSegments
4161#[derive(Debug, Clone)]
4162pub enum ListAudienceSegmentsResponseEnum {
4163    ///200: Successful.
4164    Ok(ListAudienceSegmentsResponse),
4165    ///400: Invalid `perPage` value.
4166    BadRequest(AudienceSegmentFailureResponse),
4167    ///401: Invalid API key or content API not enabled for this team.
4168    Unauthorized,
4169    ///405: Wrong HTTP request method.
4170    MethodNotAllowed,
4171    ///default: Unknown response
4172    Unknown,
4173}
4174/// Create a new audience segment.
4175#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4176pub struct CreateAudienceSegmentRequestParams {
4177    #[validate(nested)]
4178    pub body: CreateAudienceSegmentRequest,
4179}
4180impl CreateAudienceSegmentRequestParams {
4181    /// Parse the HTTP response into the response enum.
4182    pub async fn parse_response(
4183        req: reqwest::Response,
4184    ) -> anyhow::Result<GetAudienceSegmentResponse> {
4185        let status = req.status();
4186        if status == http::StatusCode::OK {
4187            let data =
4188                oas3_gen_support::Diagnostics::<AudienceSegmentResponse>::json_with_diagnostics(
4189                    req,
4190                )
4191                .await?;
4192            return Ok(GetAudienceSegmentResponse::Ok(data));
4193        }
4194        if status == http::StatusCode::BAD_REQUEST {
4195            let data = oas3_gen_support::Diagnostics::<
4196                AudienceSegmentFailureResponse,
4197            >::json_with_diagnostics(req)
4198                .await?;
4199            return Ok(GetAudienceSegmentResponse::BadRequest(data));
4200        }
4201        if status == http::StatusCode::UNAUTHORIZED {
4202            let _ = req.bytes().await?;
4203            return Ok(GetAudienceSegmentResponse::Unauthorized);
4204        }
4205        if status == http::StatusCode::NOT_FOUND {
4206            let data = oas3_gen_support::Diagnostics::<
4207                AudienceSegmentFailureResponse,
4208            >::json_with_diagnostics(req)
4209                .await?;
4210            return Ok(GetAudienceSegmentResponse::NotFound(data));
4211        }
4212        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4213            let _ = req.bytes().await?;
4214            return Ok(GetAudienceSegmentResponse::MethodNotAllowed);
4215        }
4216        let _ = req.bytes().await?;
4217        return Ok(GetAudienceSegmentResponse::Unknown);
4218    }
4219}
4220#[serde_with::skip_serializing_none]
4221#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
4222pub struct ListCampaignsRequestQuery {
4223    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
4224    #[serde(rename = "perPage")]
4225    pub per_page: Option<String>,
4226    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
4227    pub cursor: Option<String>,
4228}
4229/// Retrieve a paginated list of campaigns.
4230#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4231pub struct ListCampaignsRequest {
4232    pub query: ListCampaignsRequestQuery,
4233}
4234impl ListCampaignsRequest {
4235    /// Parse the HTTP response into the response enum.
4236    pub async fn parse_response(
4237        req: reqwest::Response,
4238    ) -> anyhow::Result<ListCampaignsResponseEnum> {
4239        let status = req.status();
4240        if status == http::StatusCode::OK {
4241            let data =
4242                oas3_gen_support::Diagnostics::<ListCampaignsResponse>::json_with_diagnostics(req)
4243                    .await?;
4244            return Ok(ListCampaignsResponseEnum::Ok(data));
4245        }
4246        if status == http::StatusCode::BAD_REQUEST {
4247            let data =
4248                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4249                    req,
4250                )
4251                .await?;
4252            return Ok(ListCampaignsResponseEnum::BadRequest(data));
4253        }
4254        if status == http::StatusCode::UNAUTHORIZED {
4255            let _ = req.bytes().await?;
4256            return Ok(ListCampaignsResponseEnum::Unauthorized);
4257        }
4258        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4259            let _ = req.bytes().await?;
4260            return Ok(ListCampaignsResponseEnum::MethodNotAllowed);
4261        }
4262        let _ = req.bytes().await?;
4263        return Ok(ListCampaignsResponseEnum::Unknown);
4264    }
4265}
4266/// Response types for listCampaigns
4267#[derive(Debug, Clone)]
4268pub enum ListCampaignsResponseEnum {
4269    ///200: Successful.
4270    Ok(ListCampaignsResponse),
4271    ///400: Invalid `perPage` value.
4272    BadRequest(CampaignFailureResponse),
4273    ///401: Invalid API key or content API not enabled for this team.
4274    Unauthorized,
4275    ///405: Wrong HTTP request method.
4276    MethodNotAllowed,
4277    ///default: Unknown response
4278    Unknown,
4279}
4280/// Create a new draft campaign. An empty email message is created automatically and its `emailMessageId` is returned. Use the `/email-messages/{emailMessageId}` endpoint to set subject, sender, preview text, and LMX content. The audience (mailing list, segment, or filter), group, and scheduling can be set on create or later via update.
4281#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4282pub struct CreateCampaignRequestParams {
4283    #[validate(nested)]
4284    pub body: CreateCampaignRequest,
4285}
4286impl CreateCampaignRequestParams {
4287    /// Parse the HTTP response into the response enum.
4288    pub async fn parse_response(
4289        req: reqwest::Response,
4290    ) -> anyhow::Result<CreateCampaignResponseEnum> {
4291        let status = req.status();
4292        if status == http::StatusCode::CREATED {
4293            let data =
4294                oas3_gen_support::Diagnostics::<CreateCampaignResponse>::json_with_diagnostics(req)
4295                    .await?;
4296            return Ok(CreateCampaignResponseEnum::Created(data));
4297        }
4298        if status == http::StatusCode::BAD_REQUEST {
4299            let data =
4300                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4301                    req,
4302                )
4303                .await?;
4304            return Ok(CreateCampaignResponseEnum::BadRequest(data));
4305        }
4306        if status == http::StatusCode::UNAUTHORIZED {
4307            let _ = req.bytes().await?;
4308            return Ok(CreateCampaignResponseEnum::Unauthorized);
4309        }
4310        if status == http::StatusCode::NOT_FOUND {
4311            let data =
4312                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4313                    req,
4314                )
4315                .await?;
4316            return Ok(CreateCampaignResponseEnum::NotFound(data));
4317        }
4318        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4319            let _ = req.bytes().await?;
4320            return Ok(CreateCampaignResponseEnum::MethodNotAllowed);
4321        }
4322        let _ = req.bytes().await?;
4323        return Ok(CreateCampaignResponseEnum::Unknown);
4324    }
4325}
4326/// Response types for createCampaign
4327#[derive(Debug, Clone)]
4328pub enum CreateCampaignResponseEnum {
4329    ///201: Campaign created.
4330    Created(CreateCampaignResponse),
4331    ///400: Invalid request body, campaign group not found, or no sending domain configured.
4332    BadRequest(CampaignFailureResponse),
4333    ///401: Invalid API key or content API not enabled for this team.
4334    Unauthorized,
4335    ///404: Referenced mailing list or audience segment not found.
4336    NotFound(CampaignFailureResponse),
4337    ///405: Wrong HTTP request method.
4338    MethodNotAllowed,
4339    ///default: Unknown response
4340    Unknown,
4341}
4342#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
4343pub struct GetCampaignRequestPath {
4344    /// The ID of the campaign.
4345    #[validate(length(min = 1u64))]
4346    pub campaign_id: String,
4347}
4348/// Retrieve a single campaign by ID.
4349#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4350pub struct GetCampaignRequest {
4351    #[validate(nested)]
4352    pub path: GetCampaignRequestPath,
4353}
4354impl GetCampaignRequest {
4355    /// Parse the HTTP response into the response enum.
4356    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetCampaignResponse> {
4357        let status = req.status();
4358        if status == http::StatusCode::OK {
4359            let data =
4360                oas3_gen_support::Diagnostics::<CampaignResponse>::json_with_diagnostics(req)
4361                    .await?;
4362            return Ok(GetCampaignResponse::Ok(data));
4363        }
4364        if status == http::StatusCode::BAD_REQUEST {
4365            let data =
4366                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4367                    req,
4368                )
4369                .await?;
4370            return Ok(GetCampaignResponse::BadRequest(data));
4371        }
4372        if status == http::StatusCode::UNAUTHORIZED {
4373            let _ = req.bytes().await?;
4374            return Ok(GetCampaignResponse::Unauthorized);
4375        }
4376        if status == http::StatusCode::NOT_FOUND {
4377            let data =
4378                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4379                    req,
4380                )
4381                .await?;
4382            return Ok(GetCampaignResponse::NotFound(data));
4383        }
4384        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4385            let _ = req.bytes().await?;
4386            return Ok(GetCampaignResponse::MethodNotAllowed);
4387        }
4388        let _ = req.bytes().await?;
4389        return Ok(GetCampaignResponse::Unknown);
4390    }
4391}
4392/// Response types for getCampaign
4393#[derive(Debug, Clone)]
4394pub enum GetCampaignResponse {
4395    ///200: Successful.
4396    Ok(CampaignResponse),
4397    ///400: Invalid `campaignId`.
4398    BadRequest(CampaignFailureResponse),
4399    ///401: Invalid API key or content API not enabled for this team.
4400    Unauthorized,
4401    ///404: Campaign not found.
4402    NotFound(CampaignFailureResponse),
4403    ///405: Wrong HTTP request method.
4404    MethodNotAllowed,
4405    ///default: Unknown response
4406    Unknown,
4407}
4408#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
4409pub struct UpdateCampaignRequestParamsPath {
4410    /// The ID of the campaign.
4411    #[validate(length(min = 1u64))]
4412    pub campaign_id: String,
4413}
4414/// Update a draft campaign's name, group, audience (mailing list, segment, or filter), or scheduling. At least one field must be provided. Once a campaign has been sent, only its `name` and `campaignGroupId` can be updated.
4415#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4416pub struct UpdateCampaignRequestParams {
4417    #[validate(nested)]
4418    pub path: UpdateCampaignRequestParamsPath,
4419    #[validate(nested)]
4420    pub body: UpdateCampaignRequest,
4421}
4422impl UpdateCampaignRequestParams {
4423    /// Parse the HTTP response into the response enum.
4424    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<UpdateCampaignResponse> {
4425        let status = req.status();
4426        if status == http::StatusCode::OK {
4427            let data =
4428                oas3_gen_support::Diagnostics::<CampaignResponse>::json_with_diagnostics(req)
4429                    .await?;
4430            return Ok(UpdateCampaignResponse::Ok(data));
4431        }
4432        if status == http::StatusCode::BAD_REQUEST {
4433            let data =
4434                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4435                    req,
4436                )
4437                .await?;
4438            return Ok(UpdateCampaignResponse::BadRequest(data));
4439        }
4440        if status == http::StatusCode::UNAUTHORIZED {
4441            let _ = req.bytes().await?;
4442            return Ok(UpdateCampaignResponse::Unauthorized);
4443        }
4444        if status == http::StatusCode::NOT_FOUND {
4445            let data =
4446                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4447                    req,
4448                )
4449                .await?;
4450            return Ok(UpdateCampaignResponse::NotFound(data));
4451        }
4452        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4453            let _ = req.bytes().await?;
4454            return Ok(UpdateCampaignResponse::MethodNotAllowed);
4455        }
4456        if status == http::StatusCode::CONFLICT {
4457            let data =
4458                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4459                    req,
4460                )
4461                .await?;
4462            return Ok(UpdateCampaignResponse::Conflict(data));
4463        }
4464        let _ = req.bytes().await?;
4465        return Ok(UpdateCampaignResponse::Unknown);
4466    }
4467}
4468/// Response types for updateCampaign
4469#[derive(Debug, Clone)]
4470pub enum UpdateCampaignResponse {
4471    ///200: Campaign updated.
4472    Ok(CampaignResponse),
4473    ///400: Invalid request body or campaign group not found.
4474    BadRequest(CampaignFailureResponse),
4475    ///401: Invalid API key or content API not enabled for this team.
4476    Unauthorized,
4477    ///404: Campaign, mailing list, or audience segment not found.
4478    NotFound(CampaignFailureResponse),
4479    ///405: Wrong HTTP request method.
4480    MethodNotAllowed,
4481    ///409: Campaign has been sent and the request updates a field other than `name` or `campaignGroupId`.
4482    Conflict(CampaignFailureResponse),
4483    ///default: Unknown response
4484    Unknown,
4485}
4486#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
4487pub struct GetCampaignMetricsRequestPath {
4488    /// The ID of the campaign.
4489    #[validate(length(min = 1u64))]
4490    pub campaign_id: String,
4491}
4492/// Retrieve all-time email engagement metrics for a campaign.
4493#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4494pub struct GetCampaignMetricsRequest {
4495    #[validate(nested)]
4496    pub path: GetCampaignMetricsRequestPath,
4497}
4498impl GetCampaignMetricsRequest {
4499    /// Parse the HTTP response into the response enum.
4500    pub async fn parse_response(
4501        req: reqwest::Response,
4502    ) -> anyhow::Result<GetCampaignMetricsResponse> {
4503        let status = req.status();
4504        if status == http::StatusCode::OK {
4505            let data =
4506                oas3_gen_support::Diagnostics::<EmailMetricsResponse>::json_with_diagnostics(req)
4507                    .await?;
4508            return Ok(GetCampaignMetricsResponse::Ok(data));
4509        }
4510        if status == http::StatusCode::BAD_REQUEST {
4511            let data =
4512                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4513                    req,
4514                )
4515                .await?;
4516            return Ok(GetCampaignMetricsResponse::BadRequest(data));
4517        }
4518        if status == http::StatusCode::UNAUTHORIZED {
4519            let _ = req.bytes().await?;
4520            return Ok(GetCampaignMetricsResponse::Unauthorized);
4521        }
4522        if status == http::StatusCode::NOT_FOUND {
4523            let data =
4524                oas3_gen_support::Diagnostics::<CampaignFailureResponse>::json_with_diagnostics(
4525                    req,
4526                )
4527                .await?;
4528            return Ok(GetCampaignMetricsResponse::NotFound(data));
4529        }
4530        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4531            let _ = req.bytes().await?;
4532            return Ok(GetCampaignMetricsResponse::MethodNotAllowed);
4533        }
4534        let _ = req.bytes().await?;
4535        return Ok(GetCampaignMetricsResponse::Unknown);
4536    }
4537}
4538/// Response types for getCampaignMetrics
4539#[derive(Debug, Clone)]
4540pub enum GetCampaignMetricsResponse {
4541    ///200: Successful.
4542    Ok(EmailMetricsResponse),
4543    ///400: Invalid `campaignId`, the campaign has not been sent yet, or the campaign has no email message.
4544    BadRequest(CampaignFailureResponse),
4545    ///401: Invalid API key.
4546    Unauthorized,
4547    ///404: Campaign not found.
4548    NotFound(CampaignFailureResponse),
4549    ///405: Wrong HTTP request method.
4550    MethodNotAllowed,
4551    ///default: Unknown response
4552    Unknown,
4553}
4554#[serde_with::skip_serializing_none]
4555#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
4556pub struct ListCampaignGroupsRequestQuery {
4557    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
4558    #[serde(rename = "perPage")]
4559    pub per_page: Option<String>,
4560    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
4561    pub cursor: Option<String>,
4562}
4563/// Retrieve a paginated list of campaign groups, most recently created first.
4564#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4565pub struct ListCampaignGroupsRequest {
4566    pub query: ListCampaignGroupsRequestQuery,
4567}
4568impl ListCampaignGroupsRequest {
4569    /// Parse the HTTP response into the response enum.
4570    pub async fn parse_response(
4571        req: reqwest::Response,
4572    ) -> anyhow::Result<ListCampaignGroupsResponse> {
4573        let status = req.status();
4574        if status == http::StatusCode::OK {
4575            let data =
4576                oas3_gen_support::Diagnostics::<ListGroupsResponse>::json_with_diagnostics(req)
4577                    .await?;
4578            return Ok(ListCampaignGroupsResponse::Ok(data));
4579        }
4580        if status == http::StatusCode::BAD_REQUEST {
4581            let data =
4582                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
4583                    .await?;
4584            return Ok(ListCampaignGroupsResponse::BadRequest(data));
4585        }
4586        if status == http::StatusCode::UNAUTHORIZED {
4587            let _ = req.bytes().await?;
4588            return Ok(ListCampaignGroupsResponse::Unauthorized);
4589        }
4590        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4591            let _ = req.bytes().await?;
4592            return Ok(ListCampaignGroupsResponse::MethodNotAllowed);
4593        }
4594        let _ = req.bytes().await?;
4595        return Ok(ListCampaignGroupsResponse::Unknown);
4596    }
4597}
4598/// Response types for listCampaignGroups
4599#[derive(Debug, Clone)]
4600pub enum ListCampaignGroupsResponse {
4601    ///200: Successful.
4602    Ok(ListGroupsResponse),
4603    ///400: Invalid `perPage` value.
4604    BadRequest(GroupFailureResponse),
4605    ///401: Invalid API key or content API not enabled for this team.
4606    Unauthorized,
4607    ///405: Wrong HTTP request method.
4608    MethodNotAllowed,
4609    ///default: Unknown response
4610    Unknown,
4611}
4612/// Create a new campaign group.
4613#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4614pub struct CreateCampaignGroupRequest {
4615    #[validate(nested)]
4616    pub body: CreateGroupRequest,
4617}
4618impl CreateCampaignGroupRequest {
4619    /// Parse the HTTP response into the response enum.
4620    pub async fn parse_response(
4621        req: reqwest::Response,
4622    ) -> anyhow::Result<CreateCampaignGroupResponse> {
4623        let status = req.status();
4624        if status == http::StatusCode::OK {
4625            let data =
4626                oas3_gen_support::Diagnostics::<GroupResponse>::json_with_diagnostics(req).await?;
4627            return Ok(CreateCampaignGroupResponse::Ok(data));
4628        }
4629        if status == http::StatusCode::BAD_REQUEST {
4630            let data =
4631                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
4632                    .await?;
4633            return Ok(CreateCampaignGroupResponse::BadRequest(data));
4634        }
4635        if status == http::StatusCode::UNAUTHORIZED {
4636            let _ = req.bytes().await?;
4637            return Ok(CreateCampaignGroupResponse::Unauthorized);
4638        }
4639        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4640            let _ = req.bytes().await?;
4641            return Ok(CreateCampaignGroupResponse::MethodNotAllowed);
4642        }
4643        let _ = req.bytes().await?;
4644        return Ok(CreateCampaignGroupResponse::Unknown);
4645    }
4646}
4647/// Response types for createCampaignGroup
4648#[derive(Debug, Clone)]
4649pub enum CreateCampaignGroupResponse {
4650    ///200: Campaign group created.
4651    Ok(GroupResponse),
4652    ///400: Invalid request body or reserved group name.
4653    BadRequest(GroupFailureResponse),
4654    ///401: Invalid API key or content API not enabled for this team.
4655    Unauthorized,
4656    ///405: Wrong HTTP request method.
4657    MethodNotAllowed,
4658    ///default: Unknown response
4659    Unknown,
4660}
4661#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
4662pub struct GetCampaignGroupRequestPath {
4663    /// The ID of the campaign group.
4664    #[validate(length(min = 1u64))]
4665    pub campaign_group_id: String,
4666}
4667/// Retrieve a single campaign group by ID.
4668#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4669pub struct GetCampaignGroupRequest {
4670    #[validate(nested)]
4671    pub path: GetCampaignGroupRequestPath,
4672}
4673impl GetCampaignGroupRequest {
4674    /// Parse the HTTP response into the response enum.
4675    pub async fn parse_response(
4676        req: reqwest::Response,
4677    ) -> anyhow::Result<GetCampaignGroupResponse> {
4678        let status = req.status();
4679        if status == http::StatusCode::OK {
4680            let data =
4681                oas3_gen_support::Diagnostics::<GroupResponse>::json_with_diagnostics(req).await?;
4682            return Ok(GetCampaignGroupResponse::Ok(data));
4683        }
4684        if status == http::StatusCode::BAD_REQUEST {
4685            let data =
4686                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
4687                    .await?;
4688            return Ok(GetCampaignGroupResponse::BadRequest(data));
4689        }
4690        if status == http::StatusCode::UNAUTHORIZED {
4691            let _ = req.bytes().await?;
4692            return Ok(GetCampaignGroupResponse::Unauthorized);
4693        }
4694        if status == http::StatusCode::NOT_FOUND {
4695            let data =
4696                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
4697                    .await?;
4698            return Ok(GetCampaignGroupResponse::NotFound(data));
4699        }
4700        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4701            let _ = req.bytes().await?;
4702            return Ok(GetCampaignGroupResponse::MethodNotAllowed);
4703        }
4704        let _ = req.bytes().await?;
4705        return Ok(GetCampaignGroupResponse::Unknown);
4706    }
4707}
4708/// Response types for getCampaignGroup
4709#[derive(Debug, Clone)]
4710pub enum GetCampaignGroupResponse {
4711    ///200: Successful.
4712    Ok(GroupResponse),
4713    ///400: Invalid `campaignGroupId`.
4714    BadRequest(GroupFailureResponse),
4715    ///401: Invalid API key or content API not enabled for this team.
4716    Unauthorized,
4717    ///404: Campaign group not found.
4718    NotFound(GroupFailureResponse),
4719    ///405: Wrong HTTP request method.
4720    MethodNotAllowed,
4721    ///default: Unknown response
4722    Unknown,
4723}
4724#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
4725pub struct UpdateCampaignGroupRequestPath {
4726    /// The ID of the campaign group.
4727    #[validate(length(min = 1u64))]
4728    pub campaign_group_id: String,
4729}
4730/// Update a campaign group's name or description. At least one field must be provided. The reserved "Unsorted" group cannot be edited.
4731#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4732pub struct UpdateCampaignGroupRequest {
4733    #[validate(nested)]
4734    pub path: UpdateCampaignGroupRequestPath,
4735    pub body: UpdateGroupRequest,
4736}
4737impl UpdateCampaignGroupRequest {
4738    /// Parse the HTTP response into the response enum.
4739    pub async fn parse_response(
4740        req: reqwest::Response,
4741    ) -> anyhow::Result<GetCampaignGroupResponse> {
4742        let status = req.status();
4743        if status == http::StatusCode::OK {
4744            let data =
4745                oas3_gen_support::Diagnostics::<GroupResponse>::json_with_diagnostics(req).await?;
4746            return Ok(GetCampaignGroupResponse::Ok(data));
4747        }
4748        if status == http::StatusCode::BAD_REQUEST {
4749            let data =
4750                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
4751                    .await?;
4752            return Ok(GetCampaignGroupResponse::BadRequest(data));
4753        }
4754        if status == http::StatusCode::UNAUTHORIZED {
4755            let _ = req.bytes().await?;
4756            return Ok(GetCampaignGroupResponse::Unauthorized);
4757        }
4758        if status == http::StatusCode::NOT_FOUND {
4759            let data =
4760                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
4761                    .await?;
4762            return Ok(GetCampaignGroupResponse::NotFound(data));
4763        }
4764        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4765            let _ = req.bytes().await?;
4766            return Ok(GetCampaignGroupResponse::MethodNotAllowed);
4767        }
4768        let _ = req.bytes().await?;
4769        return Ok(GetCampaignGroupResponse::Unknown);
4770    }
4771}
4772/// Retrieve a list of Loops' dedicated sending IP addresses.
4773///
4774/// This endpoint is provided for the rare instances where you may need to whitelist our sending IPs. Please note that this list is subject to change and will not include shared IPs used for sending mail.
4775///
4776/// Unless you are sure you need this and are comfortable watching for changes, we strongly recommend you _do not_ whitelist these IPs.
4777#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4778pub struct ListDedicatedSendingIpsRequest {}
4779impl ListDedicatedSendingIpsRequest {
4780    /// Parse the HTTP response into the response enum.
4781    pub async fn parse_response(
4782        req: reqwest::Response,
4783    ) -> anyhow::Result<ListDedicatedSendingIpsResponse> {
4784        let status = req.status();
4785        if status == http::StatusCode::OK {
4786            let data =
4787                oas3_gen_support::Diagnostics::<Vec<String>>::json_with_diagnostics(req).await?;
4788            return Ok(ListDedicatedSendingIpsResponse::Ok(data));
4789        }
4790        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4791            let _ = req.bytes().await?;
4792            return Ok(ListDedicatedSendingIpsResponse::MethodNotAllowed);
4793        }
4794        let _ = req.bytes().await?;
4795        return Ok(ListDedicatedSendingIpsResponse::Unknown);
4796    }
4797}
4798/// Response types for listDedicatedSendingIps
4799#[derive(Debug, Clone)]
4800pub enum ListDedicatedSendingIpsResponse {
4801    ///200: Successful.
4802    Ok(Vec<String>),
4803    ///405: Wrong HTTP request method.
4804    MethodNotAllowed,
4805    ///default: Unknown response
4806    Unknown,
4807}
4808/// Add a contact to your audience.
4809#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4810pub struct CreateContactRequest {
4811    /// You can add custom contact properties as keys in this request (of type `string`, `number`, `boolean` or `date`. [See available date formats](https://loops.so/docs/contacts/properties#dates)). Make sure to create the properties in Loops before using them in API calls.
4812    #[validate(nested)]
4813    pub body: ContactRequest,
4814}
4815impl CreateContactRequest {
4816    /// Parse the HTTP response into the response enum.
4817    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<CreateContactResponse> {
4818        let status = req.status();
4819        if status == http::StatusCode::OK {
4820            let data =
4821                oas3_gen_support::Diagnostics::<ContactSuccessResponse>::json_with_diagnostics(req)
4822                    .await?;
4823            return Ok(CreateContactResponse::Ok(data));
4824        }
4825        if status == http::StatusCode::BAD_REQUEST {
4826            let data =
4827                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
4828                    .await?;
4829            return Ok(CreateContactResponse::BadRequest(data));
4830        }
4831        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4832            let _ = req.bytes().await?;
4833            return Ok(CreateContactResponse::MethodNotAllowed);
4834        }
4835        if status == http::StatusCode::CONFLICT {
4836            let data =
4837                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
4838                    .await?;
4839            return Ok(CreateContactResponse::Conflict(data));
4840        }
4841        let _ = req.bytes().await?;
4842        return Ok(CreateContactResponse::Unknown);
4843    }
4844}
4845/// Response types for createContact
4846#[derive(Debug, Clone)]
4847pub enum CreateContactResponse {
4848    ///200: Successful create.
4849    Ok(ContactSuccessResponse),
4850    ///400: Bad request (e.g. invalid email address).
4851    BadRequest(ContactFailureResponse),
4852    ///405: Wrong HTTP request method.
4853    MethodNotAllowed,
4854    ///409: Email or `userId` already exists.
4855    Conflict(ContactFailureResponse),
4856    ///default: Unknown response
4857    Unknown,
4858}
4859/// Update a contact by `email` or `userId`. You must provide one of these parameters.
4860///
4861/// If you want to update a contact's email address, the contact will first need a `userId` value. You can then make a request containing the `userId` field along with an updated email address.
4862///
4863/// This endpoint will create a contact if a matching contact does not already exist in your audience.
4864///
4865/// Provide either `email` or `userId` to identify the contact you want to update. If both are provided, the system will look for a contact with either a matching `email` or `userId` value. If a contact is found for one of the values (e.g. `email`), the other value (e.g. `userId`) will be updated. If a contact is not found, a new contact will be created using both `email` and `userId` values.
4866#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4867pub struct UpdateContactRequest {
4868    /// You can add custom contact properties as keys in this request (of type `string`, `number`, `boolean` or `date`. [See available date formats](https://loops.so/docs/contacts/properties#dates)). Make sure to create the properties in Loops before using them in API calls.
4869    pub body: ContactUpdateRequest,
4870}
4871impl UpdateContactRequest {
4872    /// Parse the HTTP response into the response enum.
4873    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<UpdateContactResponse> {
4874        let status = req.status();
4875        if status == http::StatusCode::OK {
4876            let data =
4877                oas3_gen_support::Diagnostics::<ContactSuccessResponse>::json_with_diagnostics(req)
4878                    .await?;
4879            return Ok(UpdateContactResponse::Ok(data));
4880        }
4881        if status == http::StatusCode::BAD_REQUEST {
4882            let data =
4883                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
4884                    .await?;
4885            return Ok(UpdateContactResponse::BadRequest(data));
4886        }
4887        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4888            let _ = req.bytes().await?;
4889            return Ok(UpdateContactResponse::MethodNotAllowed);
4890        }
4891        let _ = req.bytes().await?;
4892        return Ok(UpdateContactResponse::Unknown);
4893    }
4894}
4895/// Response types for updateContact
4896#[derive(Debug, Clone)]
4897pub enum UpdateContactResponse {
4898    ///200: Successful update.
4899    Ok(ContactSuccessResponse),
4900    ///400: Bad request (e.g. `email` or `userId` are missing).
4901    BadRequest(ContactFailureResponse),
4902    ///405: Wrong HTTP request method.
4903    MethodNotAllowed,
4904    ///default: Unknown response
4905    Unknown,
4906}
4907#[serde_with::skip_serializing_none]
4908#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
4909pub struct FindContactRequestQuery {
4910    /// Email address (URI-encoded)
4911    pub email: Option<String>,
4912    #[serde(rename = "userId")]
4913    pub user_id: Option<String>,
4914}
4915/// Search for a contact by `email` or `userId`. Only one parameter is allowed.
4916#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4917pub struct FindContactRequest {
4918    pub query: FindContactRequestQuery,
4919}
4920impl FindContactRequest {
4921    /// Parse the HTTP response into the response enum.
4922    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<FindContactResponse> {
4923        let status = req.status();
4924        if status == http::StatusCode::OK {
4925            let data = oas3_gen_support::Diagnostics::<Find200Response>::json_with_diagnostics(req)
4926                .await?;
4927            return Ok(FindContactResponse::Ok(data));
4928        }
4929        if status == http::StatusCode::BAD_REQUEST {
4930            let data =
4931                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
4932                    .await?;
4933            return Ok(FindContactResponse::BadRequest(data));
4934        }
4935        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4936            let _ = req.bytes().await?;
4937            return Ok(FindContactResponse::MethodNotAllowed);
4938        }
4939        let _ = req.bytes().await?;
4940        return Ok(FindContactResponse::Unknown);
4941    }
4942}
4943/// Response types for findContact
4944#[derive(Debug, Clone)]
4945pub enum FindContactResponse {
4946    ///200: List of contacts (or an empty array if no contact was found). Contact objects will include any custom properties.
4947    Ok(Find200Response),
4948    ///400: Bad request (e.g. invalid email address).
4949    BadRequest(ContactFailureResponse),
4950    ///405: Wrong HTTP request method.
4951    MethodNotAllowed,
4952    ///default: Unknown response
4953    Unknown,
4954}
4955/// Delete a contact by `email` or `userId`.
4956#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
4957pub struct DeleteContactRequest {
4958    /// Include only one of `email` or `userId`.
4959    pub body: ContactDeleteRequest,
4960}
4961impl DeleteContactRequest {
4962    /// Parse the HTTP response into the response enum.
4963    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<DeleteContactResponse> {
4964        let status = req.status();
4965        if status == http::StatusCode::OK {
4966            let data =
4967                oas3_gen_support::Diagnostics::<ContactDeleteResponse>::json_with_diagnostics(req)
4968                    .await?;
4969            return Ok(DeleteContactResponse::Ok(data));
4970        }
4971        if status == http::StatusCode::BAD_REQUEST {
4972            let data =
4973                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
4974                    .await?;
4975            return Ok(DeleteContactResponse::BadRequest(data));
4976        }
4977        if status == http::StatusCode::NOT_FOUND {
4978            let data =
4979                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
4980                    .await?;
4981            return Ok(DeleteContactResponse::NotFound(data));
4982        }
4983        if status == http::StatusCode::METHOD_NOT_ALLOWED {
4984            let _ = req.bytes().await?;
4985            return Ok(DeleteContactResponse::MethodNotAllowed);
4986        }
4987        let _ = req.bytes().await?;
4988        return Ok(DeleteContactResponse::Unknown);
4989    }
4990}
4991/// Response types for deleteContact
4992#[derive(Debug, Clone)]
4993pub enum DeleteContactResponse {
4994    ///200: Successful delete.
4995    Ok(ContactDeleteResponse),
4996    ///400: Bad request (e.g. `email` and `userId` are both provided).
4997    BadRequest(ContactFailureResponse),
4998    ///404: Contact not found.
4999    NotFound(ContactFailureResponse),
5000    ///405: Wrong HTTP request method.
5001    MethodNotAllowed,
5002    ///default: Unknown response
5003    Unknown,
5004}
5005#[serde_with::skip_serializing_none]
5006#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
5007pub struct GetContactSuppressionRequestQuery {
5008    /// Email address (URI-encoded)
5009    pub email: Option<String>,
5010    #[serde(rename = "userId")]
5011    pub user_id: Option<String>,
5012}
5013/// Retrieve suppression status and removal quota for a contact by `email` or `userId`. Include only one query parameter.
5014#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5015pub struct GetContactSuppressionRequest {
5016    pub query: GetContactSuppressionRequestQuery,
5017}
5018impl GetContactSuppressionRequest {
5019    /// Parse the HTTP response into the response enum.
5020    pub async fn parse_response(
5021        req: reqwest::Response,
5022    ) -> anyhow::Result<GetContactSuppressionResponse> {
5023        let status = req.status();
5024        if status == http::StatusCode::OK {
5025            let data = oas3_gen_support::Diagnostics::<
5026                ContactSuppressionStatusResponse,
5027            >::json_with_diagnostics(req)
5028                .await?;
5029            return Ok(GetContactSuppressionResponse::Ok(data));
5030        }
5031        if status == http::StatusCode::BAD_REQUEST {
5032            let data =
5033                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
5034                    .await?;
5035            return Ok(GetContactSuppressionResponse::BadRequest(data));
5036        }
5037        if status == http::StatusCode::NOT_FOUND {
5038            let data =
5039                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
5040                    .await?;
5041            return Ok(GetContactSuppressionResponse::NotFound(data));
5042        }
5043        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5044            let _ = req.bytes().await?;
5045            return Ok(GetContactSuppressionResponse::MethodNotAllowed);
5046        }
5047        let _ = req.bytes().await?;
5048        return Ok(GetContactSuppressionResponse::Unknown);
5049    }
5050}
5051/// Response types for getContactSuppression
5052#[derive(Debug, Clone)]
5053pub enum GetContactSuppressionResponse {
5054    ///200: Successful.
5055    Ok(ContactSuppressionStatusResponse),
5056    ///400: Bad request (e.g. invalid email address).
5057    BadRequest(ContactFailureResponse),
5058    ///404: Contact not found.
5059    NotFound(ContactFailureResponse),
5060    ///405: Wrong HTTP request method.
5061    MethodNotAllowed,
5062    ///default: Unknown response
5063    Unknown,
5064}
5065#[serde_with::skip_serializing_none]
5066#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
5067pub struct RemoveContactSuppressionRequestQuery {
5068    /// Email address (URI-encoded)
5069    pub email: Option<String>,
5070    #[serde(rename = "userId")]
5071    pub user_id: Option<String>,
5072}
5073/// Remove a suppressed contact from the suppression list by `email` or `userId`. Include only one query parameter.
5074#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5075pub struct RemoveContactSuppressionRequest {
5076    pub query: RemoveContactSuppressionRequestQuery,
5077}
5078impl RemoveContactSuppressionRequest {
5079    /// Parse the HTTP response into the response enum.
5080    pub async fn parse_response(
5081        req: reqwest::Response,
5082    ) -> anyhow::Result<RemoveContactSuppressionResponse> {
5083        let status = req.status();
5084        if status == http::StatusCode::OK {
5085            let data = oas3_gen_support::Diagnostics::<
5086                ContactSuppressionRemoveResponse,
5087            >::json_with_diagnostics(req)
5088                .await?;
5089            return Ok(RemoveContactSuppressionResponse::Ok(data));
5090        }
5091        if status == http::StatusCode::BAD_REQUEST {
5092            let data =
5093                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
5094                    .await?;
5095            return Ok(RemoveContactSuppressionResponse::BadRequest(data));
5096        }
5097        if status == http::StatusCode::NOT_FOUND {
5098            let data =
5099                oas3_gen_support::Diagnostics::<ContactFailureResponse>::json_with_diagnostics(req)
5100                    .await?;
5101            return Ok(RemoveContactSuppressionResponse::NotFound(data));
5102        }
5103        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5104            let _ = req.bytes().await?;
5105            return Ok(RemoveContactSuppressionResponse::MethodNotAllowed);
5106        }
5107        let _ = req.bytes().await?;
5108        return Ok(RemoveContactSuppressionResponse::Unknown);
5109    }
5110}
5111/// Response types for removeContactSuppression
5112#[derive(Debug, Clone)]
5113pub enum RemoveContactSuppressionResponse {
5114    ///200: Successful removal.
5115    Ok(ContactSuppressionRemoveResponse),
5116    ///400: Bad request (e.g. contact is not suppressed).
5117    BadRequest(ContactFailureResponse),
5118    ///404: Contact not found.
5119    NotFound(ContactFailureResponse),
5120    ///405: Wrong HTTP request method.
5121    MethodNotAllowed,
5122    ///default: Unknown response
5123    Unknown,
5124}
5125#[serde_with::skip_serializing_none]
5126#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
5127pub struct ListContactPropertiesRequestQuery {
5128    /// `all` (default) or `custom` (only custom contact properties)
5129    pub list: Option<String>,
5130}
5131/// Retrieve a list of your account's contact properties.<br>Use the `list` parameter to query "all" or "custom" properties.
5132#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5133pub struct ListContactPropertiesRequest {
5134    pub query: ListContactPropertiesRequestQuery,
5135}
5136impl ListContactPropertiesRequest {
5137    /// Parse the HTTP response into the response enum.
5138    pub async fn parse_response(
5139        req: reqwest::Response,
5140    ) -> anyhow::Result<ListContactPropertiesResponse> {
5141        let status = req.status();
5142        if status == http::StatusCode::OK {
5143            let data =
5144                oas3_gen_support::Diagnostics::<Property200Response>::json_with_diagnostics(req)
5145                    .await?;
5146            return Ok(ListContactPropertiesResponse::Ok(data));
5147        }
5148        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5149            let _ = req.bytes().await?;
5150            return Ok(ListContactPropertiesResponse::MethodNotAllowed);
5151        }
5152        let _ = req.bytes().await?;
5153        return Ok(ListContactPropertiesResponse::Unknown);
5154    }
5155}
5156/// Response types for listContactProperties
5157#[derive(Debug, Clone)]
5158pub enum ListContactPropertiesResponse {
5159    ///200: Successful.
5160    Ok(Property200Response),
5161    ///405: Wrong HTTP request method.
5162    MethodNotAllowed,
5163    ///default: Unknown response
5164    Unknown,
5165}
5166/// Create a custom contact property.
5167#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5168pub struct CreateContactPropertyRequest {
5169    #[validate(nested)]
5170    pub body: ContactPropertyCreateRequest,
5171}
5172impl CreateContactPropertyRequest {
5173    /// Parse the HTTP response into the response enum.
5174    pub async fn parse_response(
5175        req: reqwest::Response,
5176    ) -> anyhow::Result<CreateContactPropertyResponse> {
5177        let status = req.status();
5178        if status == http::StatusCode::OK {
5179            let data = oas3_gen_support::Diagnostics::<
5180                ContactPropertySuccessResponse,
5181            >::json_with_diagnostics(req)
5182                .await?;
5183            return Ok(CreateContactPropertyResponse::Ok(data));
5184        }
5185        if status == http::StatusCode::BAD_REQUEST {
5186            let data = oas3_gen_support::Diagnostics::<
5187                ContactPropertyFailureResponse,
5188            >::json_with_diagnostics(req)
5189                .await?;
5190            return Ok(CreateContactPropertyResponse::BadRequest(data));
5191        }
5192        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5193            let _ = req.bytes().await?;
5194            return Ok(CreateContactPropertyResponse::MethodNotAllowed);
5195        }
5196        let _ = req.bytes().await?;
5197        return Ok(CreateContactPropertyResponse::Unknown);
5198    }
5199}
5200/// Response types for createContactProperty
5201#[derive(Debug, Clone)]
5202pub enum CreateContactPropertyResponse {
5203    ///200: Successful create.
5204    Ok(ContactPropertySuccessResponse),
5205    ///400: Bad request (e.g. invalid type).
5206    BadRequest(ContactPropertyFailureResponse),
5207    ///405: Wrong HTTP request method.
5208    MethodNotAllowed,
5209    ///default: Unknown response
5210    Unknown,
5211}
5212#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
5213pub struct GetComponentRequestPath {
5214    /// The ID of the component.
5215    #[validate(length(min = 1u64))]
5216    pub component_id: String,
5217}
5218/// Retrieve a single component by ID.
5219#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5220pub struct GetComponentRequest {
5221    #[validate(nested)]
5222    pub path: GetComponentRequestPath,
5223}
5224impl GetComponentRequest {
5225    /// Parse the HTTP response into the response enum.
5226    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetComponentResponse> {
5227        let status = req.status();
5228        if status == http::StatusCode::OK {
5229            let data =
5230                oas3_gen_support::Diagnostics::<ComponentResponse>::json_with_diagnostics(req)
5231                    .await?;
5232            return Ok(GetComponentResponse::Ok(data));
5233        }
5234        if status == http::StatusCode::BAD_REQUEST {
5235            let data =
5236                oas3_gen_support::Diagnostics::<ComponentFailureResponse>::json_with_diagnostics(
5237                    req,
5238                )
5239                .await?;
5240            return Ok(GetComponentResponse::BadRequest(data));
5241        }
5242        if status == http::StatusCode::UNAUTHORIZED {
5243            let _ = req.bytes().await?;
5244            return Ok(GetComponentResponse::Unauthorized);
5245        }
5246        if status == http::StatusCode::NOT_FOUND {
5247            let data =
5248                oas3_gen_support::Diagnostics::<ComponentFailureResponse>::json_with_diagnostics(
5249                    req,
5250                )
5251                .await?;
5252            return Ok(GetComponentResponse::NotFound(data));
5253        }
5254        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5255            let _ = req.bytes().await?;
5256            return Ok(GetComponentResponse::MethodNotAllowed);
5257        }
5258        let _ = req.bytes().await?;
5259        return Ok(GetComponentResponse::Unknown);
5260    }
5261}
5262/// Response types for getComponent
5263#[derive(Debug, Clone)]
5264pub enum GetComponentResponse {
5265    ///200: Successful.
5266    Ok(ComponentResponse),
5267    ///400: Invalid `componentId`.
5268    BadRequest(ComponentFailureResponse),
5269    ///401: Invalid API key or content API not enabled for this team.
5270    Unauthorized,
5271    ///404: Component not found.
5272    NotFound(ComponentFailureResponse),
5273    ///405: Wrong HTTP request method.
5274    MethodNotAllowed,
5275    ///default: Unknown response
5276    Unknown,
5277}
5278#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
5279pub struct UpdateComponentRequestPath {
5280    /// The ID of the component.
5281    #[validate(length(min = 1u64))]
5282    pub component_id: String,
5283}
5284/// Update a component's name and/or body. When the `lmx` body changes, the update cascades to every email using this component, and `affectedEmailCount` reports how many were affected. A change that would introduce a dynamic variable an email using the component cannot use is rejected.
5285#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5286pub struct UpdateComponentRequest {
5287    #[validate(nested)]
5288    pub path: UpdateComponentRequestPath,
5289    pub body: UpdateComponentBody,
5290}
5291impl UpdateComponentRequest {
5292    /// Parse the HTTP response into the response enum.
5293    pub async fn parse_response(
5294        req: reqwest::Response,
5295    ) -> anyhow::Result<UpdateComponentResponseEnum> {
5296        let status = req.status();
5297        if status == http::StatusCode::OK {
5298            let data =
5299                oas3_gen_support::Diagnostics::<UpdateComponentResponse>::json_with_diagnostics(
5300                    req,
5301                )
5302                .await?;
5303            return Ok(UpdateComponentResponseEnum::Ok(data));
5304        }
5305        if status == http::StatusCode::BAD_REQUEST {
5306            let data =
5307                oas3_gen_support::Diagnostics::<ComponentFailureResponse>::json_with_diagnostics(
5308                    req,
5309                )
5310                .await?;
5311            return Ok(UpdateComponentResponseEnum::BadRequest(data));
5312        }
5313        if status == http::StatusCode::UNAUTHORIZED {
5314            let _ = req.bytes().await?;
5315            return Ok(UpdateComponentResponseEnum::Unauthorized);
5316        }
5317        if status == http::StatusCode::NOT_FOUND {
5318            let data =
5319                oas3_gen_support::Diagnostics::<ComponentFailureResponse>::json_with_diagnostics(
5320                    req,
5321                )
5322                .await?;
5323            return Ok(UpdateComponentResponseEnum::NotFound(data));
5324        }
5325        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5326            let _ = req.bytes().await?;
5327            return Ok(UpdateComponentResponseEnum::MethodNotAllowed);
5328        }
5329        if status == http::StatusCode::PAYLOAD_TOO_LARGE {
5330            let data =
5331                oas3_gen_support::Diagnostics::<ComponentFailureResponse>::json_with_diagnostics(
5332                    req,
5333                )
5334                .await?;
5335            return Ok(UpdateComponentResponseEnum::ContentTooLarge(data));
5336        }
5337        if status == http::StatusCode::UNPROCESSABLE_ENTITY {
5338            let data = oas3_gen_support::Diagnostics::<
5339                ComponentValidationFailureResponse,
5340            >::json_with_diagnostics(req)
5341                .await?;
5342            return Ok(UpdateComponentResponseEnum::UnprocessableEntity(data));
5343        }
5344        let _ = req.bytes().await?;
5345        return Ok(UpdateComponentResponseEnum::Unknown);
5346    }
5347}
5348/// Response types for updateComponent
5349#[derive(Debug, Clone)]
5350pub enum UpdateComponentResponseEnum {
5351    ///200: Successful.
5352    Ok(UpdateComponentResponse),
5353    ///400: Invalid `componentId` or request body.
5354    BadRequest(ComponentFailureResponse),
5355    ///401: Invalid API key or content API not enabled for this team.
5356    Unauthorized,
5357    ///404: Component not found.
5358    NotFound(ComponentFailureResponse),
5359    ///405: Wrong HTTP request method.
5360    MethodNotAllowed,
5361    ///413: LMX body exceeds the size limit.
5362    ContentTooLarge(ComponentFailureResponse),
5363    ///422: Invalid LMX, or a body change that would break emails using the component.
5364    UnprocessableEntity(ComponentValidationFailureResponse),
5365    ///default: Unknown response
5366    Unknown,
5367}
5368#[serde_with::skip_serializing_none]
5369#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
5370pub struct ListComponentsRequestQuery {
5371    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
5372    #[serde(rename = "perPage")]
5373    pub per_page: Option<String>,
5374    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
5375    pub cursor: Option<String>,
5376}
5377/// Retrieve a paginated list of email components.
5378#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5379pub struct ListComponentsRequest {
5380    pub query: ListComponentsRequestQuery,
5381}
5382impl ListComponentsRequest {
5383    /// Parse the HTTP response into the response enum.
5384    pub async fn parse_response(
5385        req: reqwest::Response,
5386    ) -> anyhow::Result<ListComponentsResponseEnum> {
5387        let status = req.status();
5388        if status == http::StatusCode::OK {
5389            let data =
5390                oas3_gen_support::Diagnostics::<ListComponentsResponse>::json_with_diagnostics(req)
5391                    .await?;
5392            return Ok(ListComponentsResponseEnum::Ok(data));
5393        }
5394        if status == http::StatusCode::BAD_REQUEST {
5395            let data =
5396                oas3_gen_support::Diagnostics::<ComponentFailureResponse>::json_with_diagnostics(
5397                    req,
5398                )
5399                .await?;
5400            return Ok(ListComponentsResponseEnum::BadRequest(data));
5401        }
5402        if status == http::StatusCode::UNAUTHORIZED {
5403            let _ = req.bytes().await?;
5404            return Ok(ListComponentsResponseEnum::Unauthorized);
5405        }
5406        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5407            let _ = req.bytes().await?;
5408            return Ok(ListComponentsResponseEnum::MethodNotAllowed);
5409        }
5410        let _ = req.bytes().await?;
5411        return Ok(ListComponentsResponseEnum::Unknown);
5412    }
5413}
5414/// Response types for listComponents
5415#[derive(Debug, Clone)]
5416pub enum ListComponentsResponseEnum {
5417    ///200: Successful.
5418    Ok(ListComponentsResponse),
5419    ///400: Invalid `perPage` value.
5420    BadRequest(ComponentFailureResponse),
5421    ///401: Invalid API key or content API not enabled for this team.
5422    Unauthorized,
5423    ///405: Wrong HTTP request method.
5424    MethodNotAllowed,
5425    ///default: Unknown response
5426    Unknown,
5427}
5428/// Create a new email component from an LMX body.
5429#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5430pub struct CreateComponentRequest {
5431    #[validate(nested)]
5432    pub body: CreateComponentBody,
5433}
5434impl CreateComponentRequest {
5435    /// Parse the HTTP response into the response enum.
5436    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<CreateComponentResponse> {
5437        let status = req.status();
5438        if status == http::StatusCode::CREATED {
5439            let data =
5440                oas3_gen_support::Diagnostics::<ComponentResponse>::json_with_diagnostics(req)
5441                    .await?;
5442            return Ok(CreateComponentResponse::Created(data));
5443        }
5444        if status == http::StatusCode::BAD_REQUEST {
5445            let data =
5446                oas3_gen_support::Diagnostics::<ComponentFailureResponse>::json_with_diagnostics(
5447                    req,
5448                )
5449                .await?;
5450            return Ok(CreateComponentResponse::BadRequest(data));
5451        }
5452        if status == http::StatusCode::UNAUTHORIZED {
5453            let _ = req.bytes().await?;
5454            return Ok(CreateComponentResponse::Unauthorized);
5455        }
5456        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5457            let _ = req.bytes().await?;
5458            return Ok(CreateComponentResponse::MethodNotAllowed);
5459        }
5460        if status == http::StatusCode::PAYLOAD_TOO_LARGE {
5461            let data =
5462                oas3_gen_support::Diagnostics::<ComponentFailureResponse>::json_with_diagnostics(
5463                    req,
5464                )
5465                .await?;
5466            return Ok(CreateComponentResponse::ContentTooLarge(data));
5467        }
5468        if status == http::StatusCode::UNPROCESSABLE_ENTITY {
5469            let data =
5470                oas3_gen_support::Diagnostics::<ComponentFailureResponse>::json_with_diagnostics(
5471                    req,
5472                )
5473                .await?;
5474            return Ok(CreateComponentResponse::UnprocessableEntity(data));
5475        }
5476        let _ = req.bytes().await?;
5477        return Ok(CreateComponentResponse::Unknown);
5478    }
5479}
5480/// Response types for createComponent
5481#[derive(Debug, Clone)]
5482pub enum CreateComponentResponse {
5483    ///201: Component created.
5484    Created(ComponentResponse),
5485    ///400: Invalid request body.
5486    BadRequest(ComponentFailureResponse),
5487    ///401: Invalid API key or content API not enabled for this team.
5488    Unauthorized,
5489    ///405: Wrong HTTP request method.
5490    MethodNotAllowed,
5491    ///413: LMX body exceeds the size limit.
5492    ContentTooLarge(ComponentFailureResponse),
5493    ///422: Invalid LMX.
5494    UnprocessableEntity(ComponentFailureResponse),
5495    ///default: Unknown response
5496    Unknown,
5497}
5498#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
5499pub struct GetEmailMessageRequestPath {
5500    /// The ID of the email message.
5501    #[validate(length(min = 1u64))]
5502    pub email_message_id: String,
5503}
5504/// Retrieve an email message, including its compiled LMX content.
5505#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5506pub struct GetEmailMessageRequest {
5507    #[validate(nested)]
5508    pub path: GetEmailMessageRequestPath,
5509}
5510impl GetEmailMessageRequest {
5511    /// Parse the HTTP response into the response enum.
5512    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetEmailMessageResponse> {
5513        let status = req.status();
5514        if status == http::StatusCode::OK {
5515            let data =
5516                oas3_gen_support::Diagnostics::<EmailMessageResponse>::json_with_diagnostics(req)
5517                    .await?;
5518            return Ok(GetEmailMessageResponse::Ok(data));
5519        }
5520        if status == http::StatusCode::BAD_REQUEST {
5521            let data = oas3_gen_support::Diagnostics::<
5522                EmailMessageFailureResponse,
5523            >::json_with_diagnostics(req)
5524                .await?;
5525            return Ok(GetEmailMessageResponse::BadRequest(data));
5526        }
5527        if status == http::StatusCode::UNAUTHORIZED {
5528            let _ = req.bytes().await?;
5529            return Ok(GetEmailMessageResponse::Unauthorized);
5530        }
5531        if status == http::StatusCode::NOT_FOUND {
5532            let data = oas3_gen_support::Diagnostics::<
5533                EmailMessageFailureResponse,
5534            >::json_with_diagnostics(req)
5535                .await?;
5536            return Ok(GetEmailMessageResponse::NotFound(data));
5537        }
5538        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5539            let _ = req.bytes().await?;
5540            return Ok(GetEmailMessageResponse::MethodNotAllowed);
5541        }
5542        if status == http::StatusCode::CONFLICT {
5543            let data = oas3_gen_support::Diagnostics::<
5544                EmailMessageFailureResponse,
5545            >::json_with_diagnostics(req)
5546                .await?;
5547            return Ok(GetEmailMessageResponse::Conflict(data));
5548        }
5549        let _ = req.bytes().await?;
5550        return Ok(GetEmailMessageResponse::Unknown);
5551    }
5552}
5553/// Response types for getEmailMessage
5554#[derive(Debug, Clone)]
5555pub enum GetEmailMessageResponse {
5556    ///200: Successful.
5557    Ok(EmailMessageResponse),
5558    ///400: Invalid `emailMessageId` or no sending domain configured.
5559    BadRequest(EmailMessageFailureResponse),
5560    ///401: Invalid API key or content API not enabled for this team.
5561    Unauthorized,
5562    ///404: Email message not found.
5563    NotFound(EmailMessageFailureResponse),
5564    ///405: Wrong HTTP request method.
5565    MethodNotAllowed,
5566    ///409: Email message uses MJML format or content cannot be parsed.
5567    Conflict(EmailMessageFailureResponse),
5568    ///default: Unknown response
5569    Unknown,
5570}
5571#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
5572pub struct UpdateEmailMessageRequestParamsPath {
5573    /// The ID of the email message.
5574    #[validate(length(min = 1u64))]
5575    pub email_message_id: String,
5576}
5577/// Update fields on an email message (subject, preview text, sender, LMX content). The campaign must be in draft status. Supply `expectedRevisionId` matching the current `contentRevisionId` — the server rejects mismatched revisions with 409.
5578#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5579pub struct UpdateEmailMessageRequestParams {
5580    #[validate(nested)]
5581    pub path: UpdateEmailMessageRequestParamsPath,
5582    pub body: UpdateEmailMessageRequest,
5583}
5584impl UpdateEmailMessageRequestParams {
5585    /// Parse the HTTP response into the response enum.
5586    pub async fn parse_response(
5587        req: reqwest::Response,
5588    ) -> anyhow::Result<UpdateEmailMessageResponse> {
5589        let status = req.status();
5590        if status == http::StatusCode::OK {
5591            let data =
5592                oas3_gen_support::Diagnostics::<EmailMessageResponse>::json_with_diagnostics(req)
5593                    .await?;
5594            return Ok(UpdateEmailMessageResponse::Ok(data));
5595        }
5596        if status == http::StatusCode::BAD_REQUEST {
5597            let data = oas3_gen_support::Diagnostics::<
5598                EmailMessageFailureResponse,
5599            >::json_with_diagnostics(req)
5600                .await?;
5601            return Ok(UpdateEmailMessageResponse::BadRequest(data));
5602        }
5603        if status == http::StatusCode::UNAUTHORIZED {
5604            let _ = req.bytes().await?;
5605            return Ok(UpdateEmailMessageResponse::Unauthorized);
5606        }
5607        if status == http::StatusCode::NOT_FOUND {
5608            let data = oas3_gen_support::Diagnostics::<
5609                EmailMessageFailureResponse,
5610            >::json_with_diagnostics(req)
5611                .await?;
5612            return Ok(UpdateEmailMessageResponse::NotFound(data));
5613        }
5614        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5615            let _ = req.bytes().await?;
5616            return Ok(UpdateEmailMessageResponse::MethodNotAllowed);
5617        }
5618        if status == http::StatusCode::CONFLICT {
5619            let data = oas3_gen_support::Diagnostics::<
5620                EmailMessageFailureResponse,
5621            >::json_with_diagnostics(req)
5622                .await?;
5623            return Ok(UpdateEmailMessageResponse::Conflict(data));
5624        }
5625        if status == http::StatusCode::PAYLOAD_TOO_LARGE {
5626            let data = oas3_gen_support::Diagnostics::<
5627                EmailMessageFailureResponse,
5628            >::json_with_diagnostics(req)
5629                .await?;
5630            return Ok(UpdateEmailMessageResponse::ContentTooLarge(data));
5631        }
5632        if status == http::StatusCode::UNPROCESSABLE_ENTITY {
5633            let data = oas3_gen_support::Diagnostics::<
5634                EmailMessageFailureResponse,
5635            >::json_with_diagnostics(req)
5636                .await?;
5637            return Ok(UpdateEmailMessageResponse::UnprocessableEntity(data));
5638        }
5639        let _ = req.bytes().await?;
5640        return Ok(UpdateEmailMessageResponse::Unknown);
5641    }
5642}
5643/// Response types for updateEmailMessage
5644#[derive(Debug, Clone)]
5645pub enum UpdateEmailMessageResponse {
5646    ///200: Email message updated.
5647    Ok(EmailMessageResponse),
5648    ///400: Invalid request body.
5649    BadRequest(EmailMessageFailureResponse),
5650    ///401: Invalid API key or content API not enabled for this team.
5651    Unauthorized,
5652    ///404: Email message not found.
5653    NotFound(EmailMessageFailureResponse),
5654    ///405: Wrong HTTP request method.
5655    MethodNotAllowed,
5656    ///409: Campaign is not in draft status, `contentRevisionId` is stale, content cannot be parsed, or email message uses MJML format.
5657    Conflict(EmailMessageFailureResponse),
5658    ///413: LMX payload exceeds the 100KB limit.
5659    ContentTooLarge(EmailMessageFailureResponse),
5660    ///422: LMX failed to compile.
5661    UnprocessableEntity(EmailMessageFailureResponse),
5662    ///default: Unknown response
5663    Unknown,
5664}
5665#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
5666pub struct PreviewEmailMessageRequestPath {
5667    /// The ID of the email message.
5668    #[validate(length(min = 1u64))]
5669    pub email_message_id: String,
5670}
5671/// Send a test preview of an email message to one or more addresses. The accepted variable fields depend on the parent's type - campaign previews accept `contactProperties`, workflow previews accept `contactProperties` and `eventProperties`, and transactional previews accept `dataVariables`. Supplying a field the parent cannot reference is rejected with 400.
5672#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5673pub struct PreviewEmailMessageRequest {
5674    #[validate(nested)]
5675    pub path: PreviewEmailMessageRequestPath,
5676    #[validate(nested)]
5677    pub body: EmailMessagePreviewRequest,
5678}
5679impl PreviewEmailMessageRequest {
5680    /// Parse the HTTP response into the response enum.
5681    pub async fn parse_response(
5682        req: reqwest::Response,
5683    ) -> anyhow::Result<PreviewEmailMessageResponse> {
5684        let status = req.status();
5685        if status == http::StatusCode::OK {
5686            let data = oas3_gen_support::Diagnostics::<
5687                EmailMessagePreviewResponse,
5688            >::json_with_diagnostics(req)
5689                .await?;
5690            return Ok(PreviewEmailMessageResponse::Ok(data));
5691        }
5692        if status == http::StatusCode::BAD_REQUEST {
5693            let data = oas3_gen_support::Diagnostics::<
5694                EmailMessageFailureResponse,
5695            >::json_with_diagnostics(req)
5696                .await?;
5697            return Ok(PreviewEmailMessageResponse::BadRequest(data));
5698        }
5699        if status == http::StatusCode::UNAUTHORIZED {
5700            let _ = req.bytes().await?;
5701            return Ok(PreviewEmailMessageResponse::Unauthorized);
5702        }
5703        if status == http::StatusCode::NOT_FOUND {
5704            let data = oas3_gen_support::Diagnostics::<
5705                EmailMessageFailureResponse,
5706            >::json_with_diagnostics(req)
5707                .await?;
5708            return Ok(PreviewEmailMessageResponse::NotFound(data));
5709        }
5710        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5711            let _ = req.bytes().await?;
5712            return Ok(PreviewEmailMessageResponse::MethodNotAllowed);
5713        }
5714        if status == http::StatusCode::TOO_MANY_REQUESTS {
5715            let data = oas3_gen_support::Diagnostics::<
5716                EmailMessageFailureResponse,
5717            >::json_with_diagnostics(req)
5718                .await?;
5719            return Ok(PreviewEmailMessageResponse::TooManyRequests(data));
5720        }
5721        let _ = req.bytes().await?;
5722        return Ok(PreviewEmailMessageResponse::Unknown);
5723    }
5724}
5725/// Response types for previewEmailMessage
5726#[derive(Debug, Clone)]
5727pub enum PreviewEmailMessageResponse {
5728    ///200: Preview scheduled.
5729    Ok(EmailMessagePreviewResponse),
5730    ///400: Invalid request body, or a variable field the parent cannot reference.
5731    BadRequest(EmailMessageFailureResponse),
5732    ///401: Invalid API key or content API not enabled for this team.
5733    Unauthorized,
5734    ///404: Email message not found.
5735    NotFound(EmailMessageFailureResponse),
5736    ///405: Wrong HTTP request method.
5737    MethodNotAllowed,
5738    ///429: The daily preview limit was reached.
5739    TooManyRequests(EmailMessageFailureResponse),
5740    ///default: Unknown response
5741    Unknown,
5742}
5743#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
5744pub struct GetEmailMessageGuardianRequestPath {
5745    /// The ID of the email message.
5746    #[validate(length(min = 1u64))]
5747    pub email_message_id: String,
5748}
5749/// Validate an email message's content against Guardian rules and return any errors and warnings. Errors must be resolved before the email can be published, warnings are advisory.
5750#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5751pub struct GetEmailMessageGuardianRequest {
5752    #[validate(nested)]
5753    pub path: GetEmailMessageGuardianRequestPath,
5754}
5755impl GetEmailMessageGuardianRequest {
5756    /// Parse the HTTP response into the response enum.
5757    pub async fn parse_response(
5758        req: reqwest::Response,
5759    ) -> anyhow::Result<GetEmailMessageGuardianResponse> {
5760        let status = req.status();
5761        if status == http::StatusCode::OK {
5762            let data = oas3_gen_support::Diagnostics::<
5763                EmailMessageGuardianResponse,
5764            >::json_with_diagnostics(req)
5765                .await?;
5766            return Ok(GetEmailMessageGuardianResponse::Ok(data));
5767        }
5768        if status == http::StatusCode::BAD_REQUEST {
5769            let data = oas3_gen_support::Diagnostics::<
5770                EmailMessageFailureResponse,
5771            >::json_with_diagnostics(req)
5772                .await?;
5773            return Ok(GetEmailMessageGuardianResponse::BadRequest(data));
5774        }
5775        if status == http::StatusCode::UNAUTHORIZED {
5776            let _ = req.bytes().await?;
5777            return Ok(GetEmailMessageGuardianResponse::Unauthorized);
5778        }
5779        if status == http::StatusCode::NOT_FOUND {
5780            let data = oas3_gen_support::Diagnostics::<
5781                EmailMessageFailureResponse,
5782            >::json_with_diagnostics(req)
5783                .await?;
5784            return Ok(GetEmailMessageGuardianResponse::NotFound(data));
5785        }
5786        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5787            let _ = req.bytes().await?;
5788            return Ok(GetEmailMessageGuardianResponse::MethodNotAllowed);
5789        }
5790        if status == http::StatusCode::CONFLICT {
5791            let data = oas3_gen_support::Diagnostics::<
5792                EmailMessageFailureResponse,
5793            >::json_with_diagnostics(req)
5794                .await?;
5795            return Ok(GetEmailMessageGuardianResponse::Conflict(data));
5796        }
5797        let _ = req.bytes().await?;
5798        return Ok(GetEmailMessageGuardianResponse::Unknown);
5799    }
5800}
5801/// Response types for getEmailMessageGuardian
5802#[derive(Debug, Clone)]
5803pub enum GetEmailMessageGuardianResponse {
5804    ///200: Successful.
5805    Ok(EmailMessageGuardianResponse),
5806    ///400: Invalid `emailMessageId`.
5807    BadRequest(EmailMessageFailureResponse),
5808    ///401: Invalid API key or content API not enabled for this team.
5809    Unauthorized,
5810    ///404: Email message not found.
5811    NotFound(EmailMessageFailureResponse),
5812    ///405: Wrong HTTP request method.
5813    MethodNotAllowed,
5814    ///409: Email message uses MJML format.
5815    Conflict(EmailMessageFailureResponse),
5816    ///default: Unknown response
5817    Unknown,
5818}
5819#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
5820pub struct SendEventRequestHeader {
5821    /// Include a unique ID for this request (maximum 100 characters) to avoid duplicate emails.
5822    ///
5823    /// The value should be a string of up to 100 characters and should be unique for each request. We recommend using V4 UUIDs or some other method with enough guaranteed entropy to avoid collisions during a 24 hour window.
5824    ///
5825    /// This endpoint will return a `409 Conflict` response if the idempotency key has been used in the previous 24 hours.
5826    #[validate(length(max = 100u64))]
5827    pub idempotency_key: Option<String>,
5828}
5829impl core::convert::TryFrom<&SendEventRequestHeader> for http::HeaderMap {
5830    type Error = http::header::InvalidHeaderValue;
5831    fn try_from(headers: &SendEventRequestHeader) -> core::result::Result<Self, Self::Error> {
5832        let mut map = http::HeaderMap::with_capacity(1usize);
5833        if let Some(value) = &headers.idempotency_key {
5834            let header_value = http::HeaderValue::try_from(value)?;
5835            map.insert(IDEMPOTENCY_KEY, header_value);
5836        }
5837        Ok(map)
5838    }
5839}
5840impl core::convert::TryFrom<SendEventRequestHeader> for http::HeaderMap {
5841    type Error = http::header::InvalidHeaderValue;
5842    fn try_from(headers: SendEventRequestHeader) -> core::result::Result<Self, Self::Error> {
5843        http::HeaderMap::try_from(&headers)
5844    }
5845}
5846/// Send events to trigger workflows.
5847#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5848pub struct SendEventRequest {
5849    #[validate(nested)]
5850    pub header: SendEventRequestHeader,
5851    /// Provide either `email` or `userId` to identify the contact ([read more](https://loops.so/docs/api-reference/send-event#body)).<br>Event properties will be available in emails sent by this event. Values of properties can be of type `string`, `number`, `boolean` or `date` ([see allowed date formats](https://loops.so/docs/events/properties#important-information-about-event-properties)).<br>Make sure to create the properties in Loops before using them in API calls.<br>You can add update the contact by adding contact properties as keys in this request (of type `string`, `number`, `boolean` or `date` ([see available date formats](https://loops.so/docs/contacts/properties#dates))).
5852    pub body: EventRequest,
5853}
5854impl SendEventRequest {
5855    /// Parse the HTTP response into the response enum.
5856    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<SendEventResponse> {
5857        let status = req.status();
5858        if status == http::StatusCode::OK {
5859            let data =
5860                oas3_gen_support::Diagnostics::<EventSuccessResponse>::json_with_diagnostics(req)
5861                    .await?;
5862            return Ok(SendEventResponse::Ok(data));
5863        }
5864        if status == http::StatusCode::BAD_REQUEST {
5865            let data =
5866                oas3_gen_support::Diagnostics::<EventFailureResponse>::json_with_diagnostics(req)
5867                    .await?;
5868            return Ok(SendEventResponse::BadRequest(data));
5869        }
5870        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5871            let _ = req.bytes().await?;
5872            return Ok(SendEventResponse::MethodNotAllowed);
5873        }
5874        if status == http::StatusCode::CONFLICT {
5875            let data = oas3_gen_support::Diagnostics::<
5876                IdempotencyKeyFailureResponse,
5877            >::json_with_diagnostics(req)
5878                .await?;
5879            return Ok(SendEventResponse::Conflict(data));
5880        }
5881        let _ = req.bytes().await?;
5882        return Ok(SendEventResponse::Unknown);
5883    }
5884}
5885/// Response types for sendEvent
5886#[derive(Debug, Clone)]
5887pub enum SendEventResponse {
5888    ///200: Successful send.
5889    Ok(EventSuccessResponse),
5890    ///400: Bad request (e.g. `eventName` is missing).
5891    BadRequest(EventFailureResponse),
5892    ///405: Wrong HTTP request method.
5893    MethodNotAllowed,
5894    ///409: Idempotency key has been used.
5895    Conflict(IdempotencyKeyFailureResponse),
5896    ///default: Unknown response
5897    Unknown,
5898}
5899#[serde_with::skip_serializing_none]
5900#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
5901pub struct ListEventPatternsRequestQuery {
5902    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
5903    #[serde(rename = "perPage")]
5904    pub per_page: Option<String>,
5905    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
5906    pub cursor: Option<String>,
5907}
5908/// Retrieve a paginated list of event patterns available to workflow event trigger nodes.
5909#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5910pub struct ListEventPatternsRequest {
5911    pub query: ListEventPatternsRequestQuery,
5912}
5913impl ListEventPatternsRequest {
5914    /// Parse the HTTP response into the response enum.
5915    pub async fn parse_response(
5916        req: reqwest::Response,
5917    ) -> anyhow::Result<ListEventPatternsResponseEnum> {
5918        let status = req.status();
5919        if status == http::StatusCode::OK {
5920            let data =
5921                oas3_gen_support::Diagnostics::<ListEventPatternsResponse>::json_with_diagnostics(
5922                    req,
5923                )
5924                .await?;
5925            return Ok(ListEventPatternsResponseEnum::Ok(data));
5926        }
5927        if status == http::StatusCode::BAD_REQUEST {
5928            let data = oas3_gen_support::Diagnostics::<
5929                EventPatternFailureResponse,
5930            >::json_with_diagnostics(req)
5931                .await?;
5932            return Ok(ListEventPatternsResponseEnum::BadRequest(data));
5933        }
5934        if status == http::StatusCode::UNAUTHORIZED {
5935            let _ = req.bytes().await?;
5936            return Ok(ListEventPatternsResponseEnum::Unauthorized);
5937        }
5938        if status == http::StatusCode::METHOD_NOT_ALLOWED {
5939            let _ = req.bytes().await?;
5940            return Ok(ListEventPatternsResponseEnum::MethodNotAllowed);
5941        }
5942        let _ = req.bytes().await?;
5943        return Ok(ListEventPatternsResponseEnum::Unknown);
5944    }
5945}
5946/// Response types for listEventPatterns
5947#[derive(Debug, Clone)]
5948pub enum ListEventPatternsResponseEnum {
5949    ///200: Successful.
5950    Ok(ListEventPatternsResponse),
5951    ///400: Invalid `perPage` or `cursor` value.
5952    BadRequest(EventPatternFailureResponse),
5953    ///401: Invalid API key.
5954    Unauthorized,
5955    ///405: Wrong HTTP request method.
5956    MethodNotAllowed,
5957    ///default: Unknown response
5958    Unknown,
5959}
5960#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
5961pub struct GetEventPatternByNameRequestPath {
5962    /// The exact event name. Event names are case-sensitive and should be URL-encoded if they contain special characters.
5963    #[validate(length(min = 1u64))]
5964    pub event_name: String,
5965}
5966/// Retrieve event pattern details by event name for a workflow event trigger. Event names are case-sensitive, so `PaymentReceived` and `paymentReceived` are different events.
5967#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
5968pub struct GetEventPatternByNameRequest {
5969    #[validate(nested)]
5970    pub path: GetEventPatternByNameRequestPath,
5971}
5972impl GetEventPatternByNameRequest {
5973    /// Parse the HTTP response into the response enum.
5974    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetEventPatternResponse> {
5975        let status = req.status();
5976        if status == http::StatusCode::OK {
5977            let data =
5978                oas3_gen_support::Diagnostics::<EventPattern>::json_with_diagnostics(req).await?;
5979            return Ok(GetEventPatternResponse::Ok(data));
5980        }
5981        if status == http::StatusCode::BAD_REQUEST {
5982            let data = oas3_gen_support::Diagnostics::<
5983                EventPatternFailureResponse,
5984            >::json_with_diagnostics(req)
5985                .await?;
5986            return Ok(GetEventPatternResponse::BadRequest(data));
5987        }
5988        if status == http::StatusCode::UNAUTHORIZED {
5989            let _ = req.bytes().await?;
5990            return Ok(GetEventPatternResponse::Unauthorized);
5991        }
5992        if status == http::StatusCode::NOT_FOUND {
5993            let data = oas3_gen_support::Diagnostics::<
5994                EventPatternFailureResponse,
5995            >::json_with_diagnostics(req)
5996                .await?;
5997            return Ok(GetEventPatternResponse::NotFound(data));
5998        }
5999        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6000            let _ = req.bytes().await?;
6001            return Ok(GetEventPatternResponse::MethodNotAllowed);
6002        }
6003        let _ = req.bytes().await?;
6004        return Ok(GetEventPatternResponse::Unknown);
6005    }
6006}
6007#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
6008pub struct GetEventPatternRequestPath {
6009    /// The ID of the event pattern.
6010    #[validate(length(min = 1u64))]
6011    pub event_pattern_id: String,
6012}
6013/// Retrieve event pattern details for a workflow event trigger.
6014#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6015pub struct GetEventPatternRequest {
6016    #[validate(nested)]
6017    pub path: GetEventPatternRequestPath,
6018}
6019impl GetEventPatternRequest {
6020    /// Parse the HTTP response into the response enum.
6021    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetEventPatternResponse> {
6022        let status = req.status();
6023        if status == http::StatusCode::OK {
6024            let data =
6025                oas3_gen_support::Diagnostics::<EventPattern>::json_with_diagnostics(req).await?;
6026            return Ok(GetEventPatternResponse::Ok(data));
6027        }
6028        if status == http::StatusCode::BAD_REQUEST {
6029            let data = oas3_gen_support::Diagnostics::<
6030                EventPatternFailureResponse,
6031            >::json_with_diagnostics(req)
6032                .await?;
6033            return Ok(GetEventPatternResponse::BadRequest(data));
6034        }
6035        if status == http::StatusCode::UNAUTHORIZED {
6036            let _ = req.bytes().await?;
6037            return Ok(GetEventPatternResponse::Unauthorized);
6038        }
6039        if status == http::StatusCode::NOT_FOUND {
6040            let data = oas3_gen_support::Diagnostics::<
6041                EventPatternFailureResponse,
6042            >::json_with_diagnostics(req)
6043                .await?;
6044            return Ok(GetEventPatternResponse::NotFound(data));
6045        }
6046        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6047            let _ = req.bytes().await?;
6048            return Ok(GetEventPatternResponse::MethodNotAllowed);
6049        }
6050        let _ = req.bytes().await?;
6051        return Ok(GetEventPatternResponse::Unknown);
6052    }
6053}
6054/// Response types for getEventPattern
6055#[derive(Debug, Clone)]
6056pub enum GetEventPatternResponse {
6057    ///200: Successful.
6058    Ok(EventPattern),
6059    ///400: Invalid `eventPatternId`.
6060    BadRequest(EventPatternFailureResponse),
6061    ///401: Invalid API key.
6062    Unauthorized,
6063    ///404: Event pattern not found.
6064    NotFound(EventPatternFailureResponse),
6065    ///405: Wrong HTTP request method.
6066    MethodNotAllowed,
6067    ///default: Unknown response
6068    Unknown,
6069}
6070/// Retrieve a list of your account's mailing lists.
6071#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6072pub struct ListMailingListsRequest {}
6073impl ListMailingListsRequest {
6074    /// Parse the HTTP response into the response enum.
6075    pub async fn parse_response(
6076        req: reqwest::Response,
6077    ) -> anyhow::Result<ListMailingListsResponse> {
6078        let status = req.status();
6079        if status == http::StatusCode::OK {
6080            let data = oas3_gen_support::Diagnostics::<List200Response>::json_with_diagnostics(req)
6081                .await?;
6082            return Ok(ListMailingListsResponse::Ok(data));
6083        }
6084        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6085            let _ = req.bytes().await?;
6086            return Ok(ListMailingListsResponse::MethodNotAllowed);
6087        }
6088        let _ = req.bytes().await?;
6089        return Ok(ListMailingListsResponse::Unknown);
6090    }
6091}
6092/// Response types for listMailingLists
6093#[derive(Debug, Clone)]
6094pub enum ListMailingListsResponse {
6095    ///200: Successful.
6096    Ok(List200Response),
6097    ///405: Wrong HTTP request method.
6098    MethodNotAllowed,
6099    ///default: Unknown response
6100    Unknown,
6101}
6102#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
6103pub struct GetThemeRequestPath {
6104    /// The ID of the theme.
6105    #[validate(length(min = 1u64))]
6106    pub theme_id: String,
6107}
6108/// Retrieve a single theme by ID.
6109#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6110pub struct GetThemeRequest {
6111    #[validate(nested)]
6112    pub path: GetThemeRequestPath,
6113}
6114impl GetThemeRequest {
6115    /// Parse the HTTP response into the response enum.
6116    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetThemeResponse> {
6117        let status = req.status();
6118        if status == http::StatusCode::OK {
6119            let data =
6120                oas3_gen_support::Diagnostics::<ThemeResponse>::json_with_diagnostics(req).await?;
6121            return Ok(GetThemeResponse::Ok(data));
6122        }
6123        if status == http::StatusCode::BAD_REQUEST {
6124            let data =
6125                oas3_gen_support::Diagnostics::<ThemeFailureResponse>::json_with_diagnostics(req)
6126                    .await?;
6127            return Ok(GetThemeResponse::BadRequest(data));
6128        }
6129        if status == http::StatusCode::UNAUTHORIZED {
6130            let _ = req.bytes().await?;
6131            return Ok(GetThemeResponse::Unauthorized);
6132        }
6133        if status == http::StatusCode::NOT_FOUND {
6134            let data =
6135                oas3_gen_support::Diagnostics::<ThemeFailureResponse>::json_with_diagnostics(req)
6136                    .await?;
6137            return Ok(GetThemeResponse::NotFound(data));
6138        }
6139        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6140            let _ = req.bytes().await?;
6141            return Ok(GetThemeResponse::MethodNotAllowed);
6142        }
6143        let _ = req.bytes().await?;
6144        return Ok(GetThemeResponse::Unknown);
6145    }
6146}
6147/// Response types for getTheme
6148#[derive(Debug, Clone)]
6149pub enum GetThemeResponse {
6150    ///200: Successful.
6151    Ok(ThemeResponse),
6152    ///400: Invalid `themeId`.
6153    BadRequest(ThemeFailureResponse),
6154    ///401: Invalid API key or content API not enabled for this team.
6155    Unauthorized,
6156    ///404: Theme not found.
6157    NotFound(ThemeFailureResponse),
6158    ///405: Wrong HTTP request method.
6159    MethodNotAllowed,
6160    ///default: Unknown response
6161    Unknown,
6162}
6163#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
6164pub struct UpdateThemeRequestPath {
6165    /// The ID of the theme.
6166    #[validate(length(min = 1u64))]
6167    pub theme_id: String,
6168}
6169/// Update a theme's name and/or styles. When `styles` change, the update cascades to every email using this theme, and `affectedEmailCount` in the response reports how many emails were affected. Manual style edits made on individual emails are preserved: the cascade only changes properties an email has not overridden. A per-email override is removed only when it becomes identical to the theme's new value, after which that email follows the theme for that property.
6170#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6171pub struct UpdateThemeRequest {
6172    #[validate(nested)]
6173    pub path: UpdateThemeRequestPath,
6174    pub body: UpdateThemeBody,
6175}
6176impl UpdateThemeRequest {
6177    /// Parse the HTTP response into the response enum.
6178    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<UpdateThemeResponseEnum> {
6179        let status = req.status();
6180        if status == http::StatusCode::OK {
6181            let data =
6182                oas3_gen_support::Diagnostics::<UpdateThemeResponse>::json_with_diagnostics(req)
6183                    .await?;
6184            return Ok(UpdateThemeResponseEnum::Ok(data));
6185        }
6186        if status == http::StatusCode::BAD_REQUEST {
6187            let data =
6188                oas3_gen_support::Diagnostics::<ThemeFailureResponse>::json_with_diagnostics(req)
6189                    .await?;
6190            return Ok(UpdateThemeResponseEnum::BadRequest(data));
6191        }
6192        if status == http::StatusCode::UNAUTHORIZED {
6193            let _ = req.bytes().await?;
6194            return Ok(UpdateThemeResponseEnum::Unauthorized);
6195        }
6196        if status == http::StatusCode::NOT_FOUND {
6197            let data =
6198                oas3_gen_support::Diagnostics::<ThemeFailureResponse>::json_with_diagnostics(req)
6199                    .await?;
6200            return Ok(UpdateThemeResponseEnum::NotFound(data));
6201        }
6202        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6203            let _ = req.bytes().await?;
6204            return Ok(UpdateThemeResponseEnum::MethodNotAllowed);
6205        }
6206        let _ = req.bytes().await?;
6207        return Ok(UpdateThemeResponseEnum::Unknown);
6208    }
6209}
6210/// Response types for updateTheme
6211#[derive(Debug, Clone)]
6212pub enum UpdateThemeResponseEnum {
6213    ///200: Successful.
6214    Ok(UpdateThemeResponse),
6215    ///400: Invalid `themeId` or request body.
6216    BadRequest(ThemeFailureResponse),
6217    ///401: Invalid API key or content API not enabled for this team.
6218    Unauthorized,
6219    ///404: Theme not found.
6220    NotFound(ThemeFailureResponse),
6221    ///405: Wrong HTTP request method.
6222    MethodNotAllowed,
6223    ///default: Unknown response
6224    Unknown,
6225}
6226#[serde_with::skip_serializing_none]
6227#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
6228pub struct ListThemesRequestQuery {
6229    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
6230    #[serde(rename = "perPage")]
6231    pub per_page: Option<String>,
6232    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
6233    pub cursor: Option<String>,
6234}
6235/// Retrieve a paginated list of email themes, most recently created first.
6236#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6237pub struct ListThemesRequest {
6238    pub query: ListThemesRequestQuery,
6239}
6240impl ListThemesRequest {
6241    /// Parse the HTTP response into the response enum.
6242    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<ListThemesResponseEnum> {
6243        let status = req.status();
6244        if status == http::StatusCode::OK {
6245            let data =
6246                oas3_gen_support::Diagnostics::<ListThemesResponse>::json_with_diagnostics(req)
6247                    .await?;
6248            return Ok(ListThemesResponseEnum::Ok(data));
6249        }
6250        if status == http::StatusCode::BAD_REQUEST {
6251            let data =
6252                oas3_gen_support::Diagnostics::<ThemeFailureResponse>::json_with_diagnostics(req)
6253                    .await?;
6254            return Ok(ListThemesResponseEnum::BadRequest(data));
6255        }
6256        if status == http::StatusCode::UNAUTHORIZED {
6257            let _ = req.bytes().await?;
6258            return Ok(ListThemesResponseEnum::Unauthorized);
6259        }
6260        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6261            let _ = req.bytes().await?;
6262            return Ok(ListThemesResponseEnum::MethodNotAllowed);
6263        }
6264        let _ = req.bytes().await?;
6265        return Ok(ListThemesResponseEnum::Unknown);
6266    }
6267}
6268/// Response types for listThemes
6269#[derive(Debug, Clone)]
6270pub enum ListThemesResponseEnum {
6271    ///200: Successful.
6272    Ok(ListThemesResponse),
6273    ///400: Invalid `perPage` value.
6274    BadRequest(ThemeFailureResponse),
6275    ///401: Invalid API key or content API not enabled for this team.
6276    Unauthorized,
6277    ///405: Wrong HTTP request method.
6278    MethodNotAllowed,
6279    ///default: Unknown response
6280    Unknown,
6281}
6282/// Create a new email theme for use across Loops emails.
6283#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6284pub struct CreateThemeRequest {
6285    #[validate(nested)]
6286    pub body: CreateThemeBody,
6287}
6288impl CreateThemeRequest {
6289    /// Parse the HTTP response into the response enum.
6290    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<CreateThemeResponse> {
6291        let status = req.status();
6292        if status == http::StatusCode::CREATED {
6293            let data =
6294                oas3_gen_support::Diagnostics::<ThemeResponse>::json_with_diagnostics(req).await?;
6295            return Ok(CreateThemeResponse::Created(data));
6296        }
6297        if status == http::StatusCode::BAD_REQUEST {
6298            let data =
6299                oas3_gen_support::Diagnostics::<ThemeFailureResponse>::json_with_diagnostics(req)
6300                    .await?;
6301            return Ok(CreateThemeResponse::BadRequest(data));
6302        }
6303        if status == http::StatusCode::UNAUTHORIZED {
6304            let _ = req.bytes().await?;
6305            return Ok(CreateThemeResponse::Unauthorized);
6306        }
6307        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6308            let _ = req.bytes().await?;
6309            return Ok(CreateThemeResponse::MethodNotAllowed);
6310        }
6311        let _ = req.bytes().await?;
6312        return Ok(CreateThemeResponse::Unknown);
6313    }
6314}
6315/// Response types for createTheme
6316#[derive(Debug, Clone)]
6317pub enum CreateThemeResponse {
6318    ///201: Theme created.
6319    Created(ThemeResponse),
6320    ///400: Invalid request body.
6321    BadRequest(ThemeFailureResponse),
6322    ///401: Invalid API key or content API not enabled for this team.
6323    Unauthorized,
6324    ///405: Wrong HTTP request method.
6325    MethodNotAllowed,
6326    ///default: Unknown response
6327    Unknown,
6328}
6329#[serde_with::skip_serializing_none]
6330#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
6331pub struct ListPublishedTransactionalEmailsRequestQuery {
6332    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
6333    #[serde(rename = "perPage")]
6334    pub per_page: Option<String>,
6335    /// A cursor, to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
6336    pub cursor: Option<String>,
6337}
6338/// Get a list of published transactional emails.
6339#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6340pub struct ListPublishedTransactionalEmailsRequest {
6341    pub query: ListPublishedTransactionalEmailsRequestQuery,
6342}
6343impl ListPublishedTransactionalEmailsRequest {
6344    /// Parse the HTTP response into the response enum.
6345    pub async fn parse_response(
6346        req: reqwest::Response,
6347    ) -> anyhow::Result<ListPublishedTransactionalEmailsResponse> {
6348        let status = req.status();
6349        if status == http::StatusCode::OK {
6350            let data =
6351                oas3_gen_support::Diagnostics::<ListTransactionalsResponse>::json_with_diagnostics(
6352                    req,
6353                )
6354                .await?;
6355            return Ok(ListPublishedTransactionalEmailsResponse::Ok(data));
6356        }
6357        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6358            let _ = req.bytes().await?;
6359            return Ok(ListPublishedTransactionalEmailsResponse::MethodNotAllowed);
6360        }
6361        let _ = req.bytes().await?;
6362        return Ok(ListPublishedTransactionalEmailsResponse::Unknown);
6363    }
6364}
6365/// Response types for listPublishedTransactionalEmails
6366#[derive(Debug, Clone)]
6367pub enum ListPublishedTransactionalEmailsResponse {
6368    ///200: Successful.
6369    Ok(ListTransactionalsResponse),
6370    ///405: Wrong HTTP request method.
6371    MethodNotAllowed,
6372    ///default: Unknown response
6373    Unknown,
6374}
6375#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
6376pub struct SendTransactionalEmailRequestHeader {
6377    /// Include a unique ID for this request (maximum 100 characters) to avoid duplicate emails.
6378    ///
6379    /// The value should be a string of up to 100 characters and should be unique for each request. We recommend using V4 UUIDs or some other method with enough guaranteed entropy to avoid collisions during a 24 hour window.
6380    ///
6381    /// This endpoint will return a `409 Conflict` response if the idempotency key has been used in the previous 24 hours.
6382    #[validate(length(max = 100u64))]
6383    pub idempotency_key: Option<String>,
6384}
6385impl core::convert::TryFrom<&SendTransactionalEmailRequestHeader> for http::HeaderMap {
6386    type Error = http::header::InvalidHeaderValue;
6387    fn try_from(
6388        headers: &SendTransactionalEmailRequestHeader,
6389    ) -> core::result::Result<Self, Self::Error> {
6390        let mut map = http::HeaderMap::with_capacity(1usize);
6391        if let Some(value) = &headers.idempotency_key {
6392            let header_value = http::HeaderValue::try_from(value)?;
6393            map.insert(IDEMPOTENCY_KEY, header_value);
6394        }
6395        Ok(map)
6396    }
6397}
6398impl core::convert::TryFrom<SendTransactionalEmailRequestHeader> for http::HeaderMap {
6399    type Error = http::header::InvalidHeaderValue;
6400    fn try_from(
6401        headers: SendTransactionalEmailRequestHeader,
6402    ) -> core::result::Result<Self, Self::Error> {
6403        http::HeaderMap::try_from(&headers)
6404    }
6405}
6406/// Send a transactional email to a contact.<br>Please [email us](mailto:help@loops.so) to enable attachments on your account before using them with the API.
6407///
6408/// To set dynamic Subject, From, Reply to, CC, BCC email header fields, add data variables to those fields in the editor, then include data for each variable in the API request. Read our transactional email guide for more details.
6409#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6410pub struct SendTransactionalEmailRequest {
6411    #[validate(nested)]
6412    pub header: SendTransactionalEmailRequestHeader,
6413    #[validate(nested)]
6414    pub body: TransactionalRequest,
6415}
6416impl SendTransactionalEmailRequest {
6417    /// Parse the HTTP response into the response enum.
6418    pub async fn parse_response(
6419        req: reqwest::Response,
6420    ) -> anyhow::Result<SendTransactionalEmailResponse> {
6421        let status = req.status();
6422        if status == http::StatusCode::OK {
6423            let data = oas3_gen_support::Diagnostics::<
6424                TransactionalSuccessResponse,
6425            >::json_with_diagnostics(req)
6426                .await?;
6427            return Ok(SendTransactionalEmailResponse::Ok(data));
6428        }
6429        if status == http::StatusCode::BAD_REQUEST {
6430            let data =
6431                oas3_gen_support::Diagnostics::<Transactional400Response>::json_with_diagnostics(
6432                    req,
6433                )
6434                .await?;
6435            return Ok(SendTransactionalEmailResponse::BadRequest(data));
6436        }
6437        if status == http::StatusCode::NOT_FOUND {
6438            let data = oas3_gen_support::Diagnostics::<
6439                TransactionalFailure3Response,
6440            >::json_with_diagnostics(req)
6441                .await?;
6442            return Ok(SendTransactionalEmailResponse::NotFound(data));
6443        }
6444        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6445            let _ = req.bytes().await?;
6446            return Ok(SendTransactionalEmailResponse::MethodNotAllowed);
6447        }
6448        if status == http::StatusCode::CONFLICT {
6449            let data = oas3_gen_support::Diagnostics::<
6450                IdempotencyKeyFailureResponse,
6451            >::json_with_diagnostics(req)
6452                .await?;
6453            return Ok(SendTransactionalEmailResponse::Conflict(data));
6454        }
6455        let _ = req.bytes().await?;
6456        return Ok(SendTransactionalEmailResponse::Unknown);
6457    }
6458}
6459/// Response types for sendTransactionalEmail
6460#[derive(Debug, Clone)]
6461pub enum SendTransactionalEmailResponse {
6462    ///200: Successful send.
6463    Ok(TransactionalSuccessResponse),
6464    ///400: Bad request (e.g. transactional email is not published).
6465    BadRequest(Transactional400Response),
6466    ///404: Transactional email not found.
6467    NotFound(TransactionalFailure3Response),
6468    ///405: Wrong HTTP request method.
6469    MethodNotAllowed,
6470    ///409: Idempotency key has been used.
6471    Conflict(IdempotencyKeyFailureResponse),
6472    ///default: Unknown response
6473    Unknown,
6474}
6475#[serde_with::skip_serializing_none]
6476#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
6477pub struct ListTransactionalEmailsRequestQuery {
6478    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
6479    #[serde(rename = "perPage")]
6480    pub per_page: Option<String>,
6481    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
6482    pub cursor: Option<String>,
6483}
6484/// Retrieve a paginated list of transactional emails, most recently created first.
6485#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6486pub struct ListTransactionalEmailsRequest {
6487    pub query: ListTransactionalEmailsRequestQuery,
6488}
6489impl ListTransactionalEmailsRequest {
6490    /// Parse the HTTP response into the response enum.
6491    pub async fn parse_response(
6492        req: reqwest::Response,
6493    ) -> anyhow::Result<ListTransactionalEmailsResponse> {
6494        let status = req.status();
6495        if status == http::StatusCode::OK {
6496            let data = oas3_gen_support::Diagnostics::<
6497                ListTransactionalsResourceResponse,
6498            >::json_with_diagnostics(req)
6499                .await?;
6500            return Ok(ListTransactionalEmailsResponse::Ok(data));
6501        }
6502        if status == http::StatusCode::BAD_REQUEST {
6503            let data = oas3_gen_support::Diagnostics::<
6504                TransactionalFailureResponse,
6505            >::json_with_diagnostics(req)
6506                .await?;
6507            return Ok(ListTransactionalEmailsResponse::BadRequest(data));
6508        }
6509        if status == http::StatusCode::UNAUTHORIZED {
6510            let _ = req.bytes().await?;
6511            return Ok(ListTransactionalEmailsResponse::Unauthorized);
6512        }
6513        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6514            let _ = req.bytes().await?;
6515            return Ok(ListTransactionalEmailsResponse::MethodNotAllowed);
6516        }
6517        let _ = req.bytes().await?;
6518        return Ok(ListTransactionalEmailsResponse::Unknown);
6519    }
6520}
6521/// Response types for listTransactionalEmails
6522#[derive(Debug, Clone)]
6523pub enum ListTransactionalEmailsResponse {
6524    ///200: Successful.
6525    Ok(ListTransactionalsResourceResponse),
6526    ///400: Invalid `perPage` value.
6527    BadRequest(TransactionalFailureResponse),
6528    ///401: Invalid API key or content API not enabled for this team.
6529    Unauthorized,
6530    ///405: Wrong HTTP request method.
6531    MethodNotAllowed,
6532    ///default: Unknown response
6533    Unknown,
6534}
6535/// Create a new transactional email. An empty draft email message is created automatically and its `draftEmailMessageId` is returned. Use the `POST /v1/email-messages/{emailMessageId}` endpoint along with the returned `draftEmailMessageContentRevisionId` to set subject, sender, preview text, and LMX content, then call `POST /v1/transactional-emails/{transactionalId}/publish` to publish the draft.
6536#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6537pub struct CreateTransactionalEmailRequest {
6538    #[validate(nested)]
6539    pub body: CreateTransactionalRequest,
6540}
6541impl CreateTransactionalEmailRequest {
6542    /// Parse the HTTP response into the response enum.
6543    pub async fn parse_response(
6544        req: reqwest::Response,
6545    ) -> anyhow::Result<CreateTransactionalEmailResponse> {
6546        let status = req.status();
6547        if status == http::StatusCode::CREATED {
6548            let data =
6549                oas3_gen_support::Diagnostics::<TransactionalDraftResponse>::json_with_diagnostics(
6550                    req,
6551                )
6552                .await?;
6553            return Ok(CreateTransactionalEmailResponse::Created(data));
6554        }
6555        if status == http::StatusCode::BAD_REQUEST {
6556            let data = oas3_gen_support::Diagnostics::<
6557                TransactionalFailureResponse,
6558            >::json_with_diagnostics(req)
6559                .await?;
6560            return Ok(CreateTransactionalEmailResponse::BadRequest(data));
6561        }
6562        if status == http::StatusCode::UNAUTHORIZED {
6563            let _ = req.bytes().await?;
6564            return Ok(CreateTransactionalEmailResponse::Unauthorized);
6565        }
6566        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6567            let _ = req.bytes().await?;
6568            return Ok(CreateTransactionalEmailResponse::MethodNotAllowed);
6569        }
6570        let _ = req.bytes().await?;
6571        return Ok(CreateTransactionalEmailResponse::Unknown);
6572    }
6573}
6574/// Response types for createTransactionalEmail
6575#[derive(Debug, Clone)]
6576pub enum CreateTransactionalEmailResponse {
6577    ///201: Transactional email created.
6578    Created(TransactionalDraftResponse),
6579    ///400: Invalid request body or no sending domain configured.
6580    BadRequest(TransactionalFailureResponse),
6581    ///401: Invalid API key or content API not enabled for this team.
6582    Unauthorized,
6583    ///405: Wrong HTTP request method.
6584    MethodNotAllowed,
6585    ///default: Unknown response
6586    Unknown,
6587}
6588#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
6589pub struct GetTransactionalEmailRequestPath {
6590    /// The ID of the transactional email.
6591    #[validate(length(min = 1u64))]
6592    pub transactional_id: String,
6593}
6594/// Retrieve a single transactional email by ID.
6595#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6596pub struct GetTransactionalEmailRequest {
6597    #[validate(nested)]
6598    pub path: GetTransactionalEmailRequestPath,
6599}
6600impl GetTransactionalEmailRequest {
6601    /// Parse the HTTP response into the response enum.
6602    pub async fn parse_response(
6603        req: reqwest::Response,
6604    ) -> anyhow::Result<GetTransactionalEmailResponse> {
6605        let status = req.status();
6606        if status == http::StatusCode::OK {
6607            let data =
6608                oas3_gen_support::Diagnostics::<TransactionalResource>::json_with_diagnostics(req)
6609                    .await?;
6610            return Ok(GetTransactionalEmailResponse::Ok(data));
6611        }
6612        if status == http::StatusCode::BAD_REQUEST {
6613            let data = oas3_gen_support::Diagnostics::<
6614                TransactionalFailureResponse,
6615            >::json_with_diagnostics(req)
6616                .await?;
6617            return Ok(GetTransactionalEmailResponse::BadRequest(data));
6618        }
6619        if status == http::StatusCode::UNAUTHORIZED {
6620            let _ = req.bytes().await?;
6621            return Ok(GetTransactionalEmailResponse::Unauthorized);
6622        }
6623        if status == http::StatusCode::NOT_FOUND {
6624            let data = oas3_gen_support::Diagnostics::<
6625                TransactionalFailureResponse,
6626            >::json_with_diagnostics(req)
6627                .await?;
6628            return Ok(GetTransactionalEmailResponse::NotFound(data));
6629        }
6630        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6631            let _ = req.bytes().await?;
6632            return Ok(GetTransactionalEmailResponse::MethodNotAllowed);
6633        }
6634        let _ = req.bytes().await?;
6635        return Ok(GetTransactionalEmailResponse::Unknown);
6636    }
6637}
6638/// Response types for getTransactionalEmail
6639#[derive(Debug, Clone)]
6640pub enum GetTransactionalEmailResponse {
6641    ///200: Successful.
6642    Ok(TransactionalResource),
6643    ///400: Invalid `transactionalId`.
6644    BadRequest(TransactionalFailureResponse),
6645    ///401: Invalid API key or content API not enabled for this team.
6646    Unauthorized,
6647    ///404: Transactional email not found.
6648    NotFound(TransactionalFailureResponse),
6649    ///405: Wrong HTTP request method.
6650    MethodNotAllowed,
6651    ///default: Unknown response
6652    Unknown,
6653}
6654#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
6655pub struct UpdateTransactionalEmailRequestPath {
6656    /// The ID of the transactional email.
6657    #[validate(length(min = 1u64))]
6658    pub transactional_id: String,
6659}
6660/// Update a transactional email's name or group. At least one field must be provided.
6661#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6662pub struct UpdateTransactionalEmailRequest {
6663    #[validate(nested)]
6664    pub path: UpdateTransactionalEmailRequestPath,
6665    pub body: UpdateTransactionalRequest,
6666}
6667impl UpdateTransactionalEmailRequest {
6668    /// Parse the HTTP response into the response enum.
6669    pub async fn parse_response(
6670        req: reqwest::Response,
6671    ) -> anyhow::Result<GetTransactionalEmailResponse> {
6672        let status = req.status();
6673        if status == http::StatusCode::OK {
6674            let data =
6675                oas3_gen_support::Diagnostics::<TransactionalResource>::json_with_diagnostics(req)
6676                    .await?;
6677            return Ok(GetTransactionalEmailResponse::Ok(data));
6678        }
6679        if status == http::StatusCode::BAD_REQUEST {
6680            let data = oas3_gen_support::Diagnostics::<
6681                TransactionalFailureResponse,
6682            >::json_with_diagnostics(req)
6683                .await?;
6684            return Ok(GetTransactionalEmailResponse::BadRequest(data));
6685        }
6686        if status == http::StatusCode::UNAUTHORIZED {
6687            let _ = req.bytes().await?;
6688            return Ok(GetTransactionalEmailResponse::Unauthorized);
6689        }
6690        if status == http::StatusCode::NOT_FOUND {
6691            let data = oas3_gen_support::Diagnostics::<
6692                TransactionalFailureResponse,
6693            >::json_with_diagnostics(req)
6694                .await?;
6695            return Ok(GetTransactionalEmailResponse::NotFound(data));
6696        }
6697        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6698            let _ = req.bytes().await?;
6699            return Ok(GetTransactionalEmailResponse::MethodNotAllowed);
6700        }
6701        let _ = req.bytes().await?;
6702        return Ok(GetTransactionalEmailResponse::Unknown);
6703    }
6704}
6705#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
6706pub struct GetTransactionalEmailMetricsRequestPath {
6707    /// The ID of the transactional email.
6708    #[validate(length(min = 1u64))]
6709    pub transactional_id: String,
6710}
6711/// Retrieve all-time delivery metrics for a transactional email, totalled across every published version.
6712#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6713pub struct GetTransactionalEmailMetricsRequest {
6714    #[validate(nested)]
6715    pub path: GetTransactionalEmailMetricsRequestPath,
6716}
6717impl GetTransactionalEmailMetricsRequest {
6718    /// Parse the HTTP response into the response enum.
6719    pub async fn parse_response(
6720        req: reqwest::Response,
6721    ) -> anyhow::Result<GetTransactionalEmailMetricsResponse> {
6722        let status = req.status();
6723        if status == http::StatusCode::OK {
6724            let data = oas3_gen_support::Diagnostics::<
6725                TransactionalMetricsResponse,
6726            >::json_with_diagnostics(req)
6727                .await?;
6728            return Ok(GetTransactionalEmailMetricsResponse::Ok(data));
6729        }
6730        if status == http::StatusCode::BAD_REQUEST {
6731            let data = oas3_gen_support::Diagnostics::<
6732                TransactionalFailureResponse,
6733            >::json_with_diagnostics(req)
6734                .await?;
6735            return Ok(GetTransactionalEmailMetricsResponse::BadRequest(data));
6736        }
6737        if status == http::StatusCode::UNAUTHORIZED {
6738            let _ = req.bytes().await?;
6739            return Ok(GetTransactionalEmailMetricsResponse::Unauthorized);
6740        }
6741        if status == http::StatusCode::NOT_FOUND {
6742            let data = oas3_gen_support::Diagnostics::<
6743                TransactionalFailureResponse,
6744            >::json_with_diagnostics(req)
6745                .await?;
6746            return Ok(GetTransactionalEmailMetricsResponse::NotFound(data));
6747        }
6748        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6749            let _ = req.bytes().await?;
6750            return Ok(GetTransactionalEmailMetricsResponse::MethodNotAllowed);
6751        }
6752        let _ = req.bytes().await?;
6753        return Ok(GetTransactionalEmailMetricsResponse::Unknown);
6754    }
6755}
6756/// Response types for getTransactionalEmailMetrics
6757#[derive(Debug, Clone)]
6758pub enum GetTransactionalEmailMetricsResponse {
6759    ///200: Successful.
6760    Ok(TransactionalMetricsResponse),
6761    ///400: Invalid `transactionalId`.
6762    BadRequest(TransactionalFailureResponse),
6763    ///401: Invalid API key.
6764    Unauthorized,
6765    ///404: Transactional email not found.
6766    NotFound(TransactionalFailureResponse),
6767    ///405: Wrong HTTP request method.
6768    MethodNotAllowed,
6769    ///default: Unknown response
6770    Unknown,
6771}
6772#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
6773pub struct EnsureTransactionalDraftRequestPath {
6774    /// The ID of the transactional email.
6775    #[validate(length(min = 1u64))]
6776    pub transactional_id: String,
6777}
6778/// Ensure the transactional email has a draft email message. If a draft already exists it is returned unchanged; otherwise a new empty draft is created (seeded from the most recent published version when present). Use `POST /v1/email-messages/{emailMessageId}` to edit the draft's content.
6779#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6780pub struct EnsureTransactionalDraftRequest {
6781    #[validate(nested)]
6782    pub path: EnsureTransactionalDraftRequestPath,
6783}
6784impl EnsureTransactionalDraftRequest {
6785    /// Parse the HTTP response into the response enum.
6786    pub async fn parse_response(
6787        req: reqwest::Response,
6788    ) -> anyhow::Result<EnsureTransactionalDraftResponse> {
6789        let status = req.status();
6790        if status == http::StatusCode::OK {
6791            let data =
6792                oas3_gen_support::Diagnostics::<TransactionalDraftResponse>::json_with_diagnostics(
6793                    req,
6794                )
6795                .await?;
6796            return Ok(EnsureTransactionalDraftResponse::Ok(data));
6797        }
6798        if status == http::StatusCode::BAD_REQUEST {
6799            let data = oas3_gen_support::Diagnostics::<
6800                TransactionalFailureResponse,
6801            >::json_with_diagnostics(req)
6802                .await?;
6803            return Ok(EnsureTransactionalDraftResponse::BadRequest(data));
6804        }
6805        if status == http::StatusCode::UNAUTHORIZED {
6806            let _ = req.bytes().await?;
6807            return Ok(EnsureTransactionalDraftResponse::Unauthorized);
6808        }
6809        if status == http::StatusCode::NOT_FOUND {
6810            let data = oas3_gen_support::Diagnostics::<
6811                TransactionalFailureResponse,
6812            >::json_with_diagnostics(req)
6813                .await?;
6814            return Ok(EnsureTransactionalDraftResponse::NotFound(data));
6815        }
6816        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6817            let _ = req.bytes().await?;
6818            return Ok(EnsureTransactionalDraftResponse::MethodNotAllowed);
6819        }
6820        let _ = req.bytes().await?;
6821        return Ok(EnsureTransactionalDraftResponse::Unknown);
6822    }
6823}
6824/// Response types for ensureTransactionalDraft
6825#[derive(Debug, Clone)]
6826pub enum EnsureTransactionalDraftResponse {
6827    ///200: Draft ready.
6828    Ok(TransactionalDraftResponse),
6829    ///400: Invalid `transactionalId` or no sending domain configured.
6830    BadRequest(TransactionalFailureResponse),
6831    ///401: Invalid API key or content API not enabled for this team.
6832    Unauthorized,
6833    ///404: Transactional email not found.
6834    NotFound(TransactionalFailureResponse),
6835    ///405: Wrong HTTP request method.
6836    MethodNotAllowed,
6837    ///default: Unknown response
6838    Unknown,
6839}
6840#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
6841pub struct PublishTransactionalEmailRequestPath {
6842    /// The ID of the transactional email.
6843    #[validate(length(min = 1u64))]
6844    pub transactional_id: String,
6845}
6846/// Publish the transactional email's current draft email message. The draft becomes the published version and the draft is cleared.
6847#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6848pub struct PublishTransactionalEmailRequest {
6849    #[validate(nested)]
6850    pub path: PublishTransactionalEmailRequestPath,
6851}
6852impl PublishTransactionalEmailRequest {
6853    /// Parse the HTTP response into the response enum.
6854    pub async fn parse_response(
6855        req: reqwest::Response,
6856    ) -> anyhow::Result<PublishTransactionalEmailResponse> {
6857        let status = req.status();
6858        if status == http::StatusCode::OK {
6859            let data =
6860                oas3_gen_support::Diagnostics::<TransactionalResource>::json_with_diagnostics(req)
6861                    .await?;
6862            return Ok(PublishTransactionalEmailResponse::Ok(data));
6863        }
6864        if status == http::StatusCode::BAD_REQUEST {
6865            let data = oas3_gen_support::Diagnostics::<
6866                TransactionalFailureResponse,
6867            >::json_with_diagnostics(req)
6868                .await?;
6869            return Ok(PublishTransactionalEmailResponse::BadRequest(data));
6870        }
6871        if status == http::StatusCode::UNAUTHORIZED {
6872            let _ = req.bytes().await?;
6873            return Ok(PublishTransactionalEmailResponse::Unauthorized);
6874        }
6875        if status == http::StatusCode::NOT_FOUND {
6876            let data = oas3_gen_support::Diagnostics::<
6877                TransactionalFailureResponse,
6878            >::json_with_diagnostics(req)
6879                .await?;
6880            return Ok(PublishTransactionalEmailResponse::NotFound(data));
6881        }
6882        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6883            let _ = req.bytes().await?;
6884            return Ok(PublishTransactionalEmailResponse::MethodNotAllowed);
6885        }
6886        if status == http::StatusCode::CONFLICT {
6887            let data = oas3_gen_support::Diagnostics::<
6888                TransactionalFailureResponse,
6889            >::json_with_diagnostics(req)
6890                .await?;
6891            return Ok(PublishTransactionalEmailResponse::Conflict(data));
6892        }
6893        if status == http::StatusCode::UNPROCESSABLE_ENTITY {
6894            let data = oas3_gen_support::Diagnostics::<
6895                TransactionalFailureResponse,
6896            >::json_with_diagnostics(req)
6897                .await?;
6898            return Ok(PublishTransactionalEmailResponse::UnprocessableEntity(data));
6899        }
6900        let _ = req.bytes().await?;
6901        return Ok(PublishTransactionalEmailResponse::Unknown);
6902    }
6903}
6904/// Response types for publishTransactionalEmail
6905#[derive(Debug, Clone)]
6906pub enum PublishTransactionalEmailResponse {
6907    ///200: Transactional email published.
6908    Ok(TransactionalResource),
6909    ///400: Invalid `transactionalId`.
6910    BadRequest(TransactionalFailureResponse),
6911    ///401: Invalid API key or content API not enabled for this team.
6912    Unauthorized,
6913    ///404: Transactional email not found.
6914    NotFound(TransactionalFailureResponse),
6915    ///405: Wrong HTTP request method.
6916    MethodNotAllowed,
6917    ///409: No draft to publish.
6918    Conflict(TransactionalFailureResponse),
6919    ///422: Draft failed validation, sending domain is not verified, or content was flagged as unsafe.
6920    UnprocessableEntity(TransactionalFailureResponse),
6921    ///default: Unknown response
6922    Unknown,
6923}
6924#[serde_with::skip_serializing_none]
6925#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
6926pub struct ListTransactionalGroupsRequestQuery {
6927    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
6928    #[serde(rename = "perPage")]
6929    pub per_page: Option<String>,
6930    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
6931    pub cursor: Option<String>,
6932}
6933/// Retrieve a paginated list of transactional groups, most recently created first.
6934#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6935pub struct ListTransactionalGroupsRequest {
6936    pub query: ListTransactionalGroupsRequestQuery,
6937}
6938impl ListTransactionalGroupsRequest {
6939    /// Parse the HTTP response into the response enum.
6940    pub async fn parse_response(
6941        req: reqwest::Response,
6942    ) -> anyhow::Result<ListCampaignGroupsResponse> {
6943        let status = req.status();
6944        if status == http::StatusCode::OK {
6945            let data =
6946                oas3_gen_support::Diagnostics::<ListGroupsResponse>::json_with_diagnostics(req)
6947                    .await?;
6948            return Ok(ListCampaignGroupsResponse::Ok(data));
6949        }
6950        if status == http::StatusCode::BAD_REQUEST {
6951            let data =
6952                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
6953                    .await?;
6954            return Ok(ListCampaignGroupsResponse::BadRequest(data));
6955        }
6956        if status == http::StatusCode::UNAUTHORIZED {
6957            let _ = req.bytes().await?;
6958            return Ok(ListCampaignGroupsResponse::Unauthorized);
6959        }
6960        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6961            let _ = req.bytes().await?;
6962            return Ok(ListCampaignGroupsResponse::MethodNotAllowed);
6963        }
6964        let _ = req.bytes().await?;
6965        return Ok(ListCampaignGroupsResponse::Unknown);
6966    }
6967}
6968/// Create a new transactional group.
6969#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
6970pub struct CreateTransactionalGroupRequest {
6971    #[validate(nested)]
6972    pub body: CreateGroupRequest,
6973}
6974impl CreateTransactionalGroupRequest {
6975    /// Parse the HTTP response into the response enum.
6976    pub async fn parse_response(
6977        req: reqwest::Response,
6978    ) -> anyhow::Result<CreateCampaignGroupResponse> {
6979        let status = req.status();
6980        if status == http::StatusCode::OK {
6981            let data =
6982                oas3_gen_support::Diagnostics::<GroupResponse>::json_with_diagnostics(req).await?;
6983            return Ok(CreateCampaignGroupResponse::Ok(data));
6984        }
6985        if status == http::StatusCode::BAD_REQUEST {
6986            let data =
6987                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
6988                    .await?;
6989            return Ok(CreateCampaignGroupResponse::BadRequest(data));
6990        }
6991        if status == http::StatusCode::UNAUTHORIZED {
6992            let _ = req.bytes().await?;
6993            return Ok(CreateCampaignGroupResponse::Unauthorized);
6994        }
6995        if status == http::StatusCode::METHOD_NOT_ALLOWED {
6996            let _ = req.bytes().await?;
6997            return Ok(CreateCampaignGroupResponse::MethodNotAllowed);
6998        }
6999        let _ = req.bytes().await?;
7000        return Ok(CreateCampaignGroupResponse::Unknown);
7001    }
7002}
7003#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7004pub struct GetTransactionalGroupRequestPath {
7005    /// The ID of the transactional group.
7006    #[validate(length(min = 1u64))]
7007    pub transactional_group_id: String,
7008}
7009/// Retrieve a single transactional group by ID.
7010#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7011pub struct GetTransactionalGroupRequest {
7012    #[validate(nested)]
7013    pub path: GetTransactionalGroupRequestPath,
7014}
7015impl GetTransactionalGroupRequest {
7016    /// Parse the HTTP response into the response enum.
7017    pub async fn parse_response(
7018        req: reqwest::Response,
7019    ) -> anyhow::Result<GetCampaignGroupResponse> {
7020        let status = req.status();
7021        if status == http::StatusCode::OK {
7022            let data =
7023                oas3_gen_support::Diagnostics::<GroupResponse>::json_with_diagnostics(req).await?;
7024            return Ok(GetCampaignGroupResponse::Ok(data));
7025        }
7026        if status == http::StatusCode::BAD_REQUEST {
7027            let data =
7028                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7029                    .await?;
7030            return Ok(GetCampaignGroupResponse::BadRequest(data));
7031        }
7032        if status == http::StatusCode::UNAUTHORIZED {
7033            let _ = req.bytes().await?;
7034            return Ok(GetCampaignGroupResponse::Unauthorized);
7035        }
7036        if status == http::StatusCode::NOT_FOUND {
7037            let data =
7038                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7039                    .await?;
7040            return Ok(GetCampaignGroupResponse::NotFound(data));
7041        }
7042        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7043            let _ = req.bytes().await?;
7044            return Ok(GetCampaignGroupResponse::MethodNotAllowed);
7045        }
7046        let _ = req.bytes().await?;
7047        return Ok(GetCampaignGroupResponse::Unknown);
7048    }
7049}
7050#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7051pub struct UpdateTransactionalGroupRequestPath {
7052    /// The ID of the transactional group.
7053    #[validate(length(min = 1u64))]
7054    pub transactional_group_id: String,
7055}
7056/// Update a transactional group's name or description. At least one field must be provided. The reserved "Unsorted" group cannot be edited.
7057#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7058pub struct UpdateTransactionalGroupRequest {
7059    #[validate(nested)]
7060    pub path: UpdateTransactionalGroupRequestPath,
7061    pub body: UpdateGroupRequest,
7062}
7063impl UpdateTransactionalGroupRequest {
7064    /// Parse the HTTP response into the response enum.
7065    pub async fn parse_response(
7066        req: reqwest::Response,
7067    ) -> anyhow::Result<GetCampaignGroupResponse> {
7068        let status = req.status();
7069        if status == http::StatusCode::OK {
7070            let data =
7071                oas3_gen_support::Diagnostics::<GroupResponse>::json_with_diagnostics(req).await?;
7072            return Ok(GetCampaignGroupResponse::Ok(data));
7073        }
7074        if status == http::StatusCode::BAD_REQUEST {
7075            let data =
7076                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7077                    .await?;
7078            return Ok(GetCampaignGroupResponse::BadRequest(data));
7079        }
7080        if status == http::StatusCode::UNAUTHORIZED {
7081            let _ = req.bytes().await?;
7082            return Ok(GetCampaignGroupResponse::Unauthorized);
7083        }
7084        if status == http::StatusCode::NOT_FOUND {
7085            let data =
7086                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7087                    .await?;
7088            return Ok(GetCampaignGroupResponse::NotFound(data));
7089        }
7090        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7091            let _ = req.bytes().await?;
7092            return Ok(GetCampaignGroupResponse::MethodNotAllowed);
7093        }
7094        let _ = req.bytes().await?;
7095        return Ok(GetCampaignGroupResponse::Unknown);
7096    }
7097}
7098/// Request a pre-signed URL to upload an image asset. Upload the file with an HTTP `PUT` to the returned `presignedUrl` (sending the same `Content-Type` and `Content-Length`), then call `/uploads/{emailAssetId}/complete` to finalize the asset.
7099#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7100pub struct CreateUploadRequestParams {
7101    #[validate(nested)]
7102    pub body: CreateUploadRequest,
7103}
7104impl CreateUploadRequestParams {
7105    /// Parse the HTTP response into the response enum.
7106    pub async fn parse_response(
7107        req: reqwest::Response,
7108    ) -> anyhow::Result<CreateUploadResponseEnum> {
7109        let status = req.status();
7110        if status == http::StatusCode::OK {
7111            let data =
7112                oas3_gen_support::Diagnostics::<CreateUploadResponse>::json_with_diagnostics(req)
7113                    .await?;
7114            return Ok(CreateUploadResponseEnum::Ok(data));
7115        }
7116        if status == http::StatusCode::BAD_REQUEST {
7117            let data =
7118                oas3_gen_support::Diagnostics::<UploadFailureResponse>::json_with_diagnostics(req)
7119                    .await?;
7120            return Ok(CreateUploadResponseEnum::BadRequest(data));
7121        }
7122        if status == http::StatusCode::UNAUTHORIZED {
7123            let _ = req.bytes().await?;
7124            return Ok(CreateUploadResponseEnum::Unauthorized);
7125        }
7126        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7127            let _ = req.bytes().await?;
7128            return Ok(CreateUploadResponseEnum::MethodNotAllowed);
7129        }
7130        if status == http::StatusCode::PAYLOAD_TOO_LARGE {
7131            let data =
7132                oas3_gen_support::Diagnostics::<UploadFailureResponse>::json_with_diagnostics(req)
7133                    .await?;
7134            return Ok(CreateUploadResponseEnum::ContentTooLarge(data));
7135        }
7136        let _ = req.bytes().await?;
7137        return Ok(CreateUploadResponseEnum::Unknown);
7138    }
7139}
7140/// Response types for createUpload
7141#[derive(Debug, Clone)]
7142pub enum CreateUploadResponseEnum {
7143    ///200: Pre-signed upload URL created.
7144    Ok(CreateUploadResponse),
7145    ///400: Invalid request body or unsupported `contentType`.
7146    BadRequest(UploadFailureResponse),
7147    ///401: Invalid API key or content API not enabled for this team.
7148    Unauthorized,
7149    ///405: Wrong HTTP request method.
7150    MethodNotAllowed,
7151    ///413: Upload exceeds the maximum allowed size.
7152    ContentTooLarge(UploadFailureResponse),
7153    ///default: Unknown response
7154    Unknown,
7155}
7156#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7157pub struct CompleteUploadRequestPath {
7158    /// The `emailAssetId` returned when the upload was created via `POST /v1/uploads`.
7159    #[validate(length(min = 1u64))]
7160    pub email_asset_id: String,
7161}
7162/// Finalize an image upload after the file has been uploaded to the pre-signed URL. Returns the public URL of the uploaded image asset.
7163#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7164pub struct CompleteUploadRequest {
7165    #[validate(nested)]
7166    pub path: CompleteUploadRequestPath,
7167}
7168impl CompleteUploadRequest {
7169    /// Parse the HTTP response into the response enum.
7170    pub async fn parse_response(
7171        req: reqwest::Response,
7172    ) -> anyhow::Result<CompleteUploadResponseEnum> {
7173        let status = req.status();
7174        if status == http::StatusCode::OK {
7175            let data =
7176                oas3_gen_support::Diagnostics::<CompleteUploadResponse>::json_with_diagnostics(req)
7177                    .await?;
7178            return Ok(CompleteUploadResponseEnum::Ok(data));
7179        }
7180        if status == http::StatusCode::BAD_REQUEST {
7181            let data =
7182                oas3_gen_support::Diagnostics::<UploadFailureResponse>::json_with_diagnostics(req)
7183                    .await?;
7184            return Ok(CompleteUploadResponseEnum::BadRequest(data));
7185        }
7186        if status == http::StatusCode::UNAUTHORIZED {
7187            let _ = req.bytes().await?;
7188            return Ok(CompleteUploadResponseEnum::Unauthorized);
7189        }
7190        if status == http::StatusCode::NOT_FOUND {
7191            let data =
7192                oas3_gen_support::Diagnostics::<UploadFailureResponse>::json_with_diagnostics(req)
7193                    .await?;
7194            return Ok(CompleteUploadResponseEnum::NotFound(data));
7195        }
7196        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7197            let _ = req.bytes().await?;
7198            return Ok(CompleteUploadResponseEnum::MethodNotAllowed);
7199        }
7200        if status == http::StatusCode::TOO_MANY_REQUESTS {
7201            let data = oas3_gen_support::Diagnostics::<
7202                UploadLimitExceededFailureResponse,
7203            >::json_with_diagnostics(req)
7204                .await?;
7205            return Ok(CompleteUploadResponseEnum::TooManyRequests(data));
7206        }
7207        let _ = req.bytes().await?;
7208        return Ok(CompleteUploadResponseEnum::Unknown);
7209    }
7210}
7211/// Response types for completeUpload
7212#[derive(Debug, Clone)]
7213pub enum CompleteUploadResponseEnum {
7214    ///200: Upload completed.
7215    Ok(CompleteUploadResponse),
7216    ///400: Upload id is missing or the uploaded file has an unsupported content type.
7217    BadRequest(UploadFailureResponse),
7218    ///401: Invalid API key or content API not enabled for this team.
7219    Unauthorized,
7220    ///404: Upload not found.
7221    NotFound(UploadFailureResponse),
7222    ///405: Wrong HTTP request method.
7223    MethodNotAllowed,
7224    ///429: Upload limit exceeded.
7225    TooManyRequests(UploadLimitExceededFailureResponse),
7226    ///default: Unknown response
7227    Unknown,
7228}
7229#[serde_with::skip_serializing_none]
7230#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
7231pub struct ListWorkflowGroupsRequestQuery {
7232    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
7233    #[serde(rename = "perPage")]
7234    pub per_page: Option<String>,
7235    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
7236    pub cursor: Option<String>,
7237}
7238/// Retrieve a paginated list of workflow groups, most recently created first.
7239#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7240pub struct ListWorkflowGroupsRequest {
7241    pub query: ListWorkflowGroupsRequestQuery,
7242}
7243impl ListWorkflowGroupsRequest {
7244    /// Parse the HTTP response into the response enum.
7245    pub async fn parse_response(
7246        req: reqwest::Response,
7247    ) -> anyhow::Result<ListCampaignGroupsResponse> {
7248        let status = req.status();
7249        if status == http::StatusCode::OK {
7250            let data =
7251                oas3_gen_support::Diagnostics::<ListGroupsResponse>::json_with_diagnostics(req)
7252                    .await?;
7253            return Ok(ListCampaignGroupsResponse::Ok(data));
7254        }
7255        if status == http::StatusCode::BAD_REQUEST {
7256            let data =
7257                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7258                    .await?;
7259            return Ok(ListCampaignGroupsResponse::BadRequest(data));
7260        }
7261        if status == http::StatusCode::UNAUTHORIZED {
7262            let _ = req.bytes().await?;
7263            return Ok(ListCampaignGroupsResponse::Unauthorized);
7264        }
7265        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7266            let _ = req.bytes().await?;
7267            return Ok(ListCampaignGroupsResponse::MethodNotAllowed);
7268        }
7269        let _ = req.bytes().await?;
7270        return Ok(ListCampaignGroupsResponse::Unknown);
7271    }
7272}
7273/// Create a new workflow group.
7274#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7275pub struct CreateWorkflowGroupRequest {
7276    #[validate(nested)]
7277    pub body: CreateGroupRequest,
7278}
7279impl CreateWorkflowGroupRequest {
7280    /// Parse the HTTP response into the response enum.
7281    pub async fn parse_response(
7282        req: reqwest::Response,
7283    ) -> anyhow::Result<CreateCampaignGroupResponse> {
7284        let status = req.status();
7285        if status == http::StatusCode::OK {
7286            let data =
7287                oas3_gen_support::Diagnostics::<GroupResponse>::json_with_diagnostics(req).await?;
7288            return Ok(CreateCampaignGroupResponse::Ok(data));
7289        }
7290        if status == http::StatusCode::BAD_REQUEST {
7291            let data =
7292                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7293                    .await?;
7294            return Ok(CreateCampaignGroupResponse::BadRequest(data));
7295        }
7296        if status == http::StatusCode::UNAUTHORIZED {
7297            let _ = req.bytes().await?;
7298            return Ok(CreateCampaignGroupResponse::Unauthorized);
7299        }
7300        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7301            let _ = req.bytes().await?;
7302            return Ok(CreateCampaignGroupResponse::MethodNotAllowed);
7303        }
7304        let _ = req.bytes().await?;
7305        return Ok(CreateCampaignGroupResponse::Unknown);
7306    }
7307}
7308#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7309pub struct GetWorkflowGroupRequestPath {
7310    /// The ID of the workflow group.
7311    #[validate(length(min = 1u64))]
7312    pub workflow_group_id: String,
7313}
7314/// Retrieve a single workflow group by ID.
7315#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7316pub struct GetWorkflowGroupRequest {
7317    #[validate(nested)]
7318    pub path: GetWorkflowGroupRequestPath,
7319}
7320impl GetWorkflowGroupRequest {
7321    /// Parse the HTTP response into the response enum.
7322    pub async fn parse_response(
7323        req: reqwest::Response,
7324    ) -> anyhow::Result<GetCampaignGroupResponse> {
7325        let status = req.status();
7326        if status == http::StatusCode::OK {
7327            let data =
7328                oas3_gen_support::Diagnostics::<GroupResponse>::json_with_diagnostics(req).await?;
7329            return Ok(GetCampaignGroupResponse::Ok(data));
7330        }
7331        if status == http::StatusCode::BAD_REQUEST {
7332            let data =
7333                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7334                    .await?;
7335            return Ok(GetCampaignGroupResponse::BadRequest(data));
7336        }
7337        if status == http::StatusCode::UNAUTHORIZED {
7338            let _ = req.bytes().await?;
7339            return Ok(GetCampaignGroupResponse::Unauthorized);
7340        }
7341        if status == http::StatusCode::NOT_FOUND {
7342            let data =
7343                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7344                    .await?;
7345            return Ok(GetCampaignGroupResponse::NotFound(data));
7346        }
7347        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7348            let _ = req.bytes().await?;
7349            return Ok(GetCampaignGroupResponse::MethodNotAllowed);
7350        }
7351        let _ = req.bytes().await?;
7352        return Ok(GetCampaignGroupResponse::Unknown);
7353    }
7354}
7355#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7356pub struct UpdateWorkflowGroupRequestPath {
7357    /// The ID of the workflow group.
7358    #[validate(length(min = 1u64))]
7359    pub workflow_group_id: String,
7360}
7361/// Update a workflow group's name or description. At least one field must be provided. The reserved "Unsorted" group cannot be edited.
7362#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7363pub struct UpdateWorkflowGroupRequest {
7364    #[validate(nested)]
7365    pub path: UpdateWorkflowGroupRequestPath,
7366    pub body: UpdateGroupRequest,
7367}
7368impl UpdateWorkflowGroupRequest {
7369    /// Parse the HTTP response into the response enum.
7370    pub async fn parse_response(
7371        req: reqwest::Response,
7372    ) -> anyhow::Result<GetCampaignGroupResponse> {
7373        let status = req.status();
7374        if status == http::StatusCode::OK {
7375            let data =
7376                oas3_gen_support::Diagnostics::<GroupResponse>::json_with_diagnostics(req).await?;
7377            return Ok(GetCampaignGroupResponse::Ok(data));
7378        }
7379        if status == http::StatusCode::BAD_REQUEST {
7380            let data =
7381                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7382                    .await?;
7383            return Ok(GetCampaignGroupResponse::BadRequest(data));
7384        }
7385        if status == http::StatusCode::UNAUTHORIZED {
7386            let _ = req.bytes().await?;
7387            return Ok(GetCampaignGroupResponse::Unauthorized);
7388        }
7389        if status == http::StatusCode::NOT_FOUND {
7390            let data =
7391                oas3_gen_support::Diagnostics::<GroupFailureResponse>::json_with_diagnostics(req)
7392                    .await?;
7393            return Ok(GetCampaignGroupResponse::NotFound(data));
7394        }
7395        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7396            let _ = req.bytes().await?;
7397            return Ok(GetCampaignGroupResponse::MethodNotAllowed);
7398        }
7399        let _ = req.bytes().await?;
7400        return Ok(GetCampaignGroupResponse::Unknown);
7401    }
7402}
7403#[serde_with::skip_serializing_none]
7404#[derive(Debug, Clone, PartialEq, Serialize, oas3_gen_support::Default)]
7405pub struct ListWorkflowsRequestQuery {
7406    /// How many results to return in each request. Must be between 10 and 50. Default is 20.
7407    #[serde(rename = "perPage")]
7408    pub per_page: Option<String>,
7409    /// A cursor to return a specific page of results. Cursors can be found from the `pagination.nextCursor` value in each response.
7410    pub cursor: Option<String>,
7411}
7412/// Retrieve a paginated list of workflows.
7413#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7414pub struct ListWorkflowsRequest {
7415    pub query: ListWorkflowsRequestQuery,
7416}
7417impl ListWorkflowsRequest {
7418    /// Parse the HTTP response into the response enum.
7419    pub async fn parse_response(
7420        req: reqwest::Response,
7421    ) -> anyhow::Result<ListWorkflowsResponseEnum> {
7422        let status = req.status();
7423        if status == http::StatusCode::OK {
7424            let data =
7425                oas3_gen_support::Diagnostics::<ListWorkflowsResponse>::json_with_diagnostics(req)
7426                    .await?;
7427            return Ok(ListWorkflowsResponseEnum::Ok(data));
7428        }
7429        if status == http::StatusCode::BAD_REQUEST {
7430            let data =
7431                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7432                    req,
7433                )
7434                .await?;
7435            return Ok(ListWorkflowsResponseEnum::BadRequest(data));
7436        }
7437        if status == http::StatusCode::UNAUTHORIZED {
7438            let _ = req.bytes().await?;
7439            return Ok(ListWorkflowsResponseEnum::Unauthorized);
7440        }
7441        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7442            let _ = req.bytes().await?;
7443            return Ok(ListWorkflowsResponseEnum::MethodNotAllowed);
7444        }
7445        let _ = req.bytes().await?;
7446        return Ok(ListWorkflowsResponseEnum::Unknown);
7447    }
7448}
7449/// Response types for listWorkflows
7450#[derive(Debug, Clone)]
7451pub enum ListWorkflowsResponseEnum {
7452    ///200: Successful.
7453    Ok(ListWorkflowsResponse),
7454    ///400: Invalid `perPage` or `cursor` value.
7455    BadRequest(WorkflowFailureResponse),
7456    ///401: Invalid API key.
7457    Unauthorized,
7458    ///405: Wrong HTTP request method.
7459    MethodNotAllowed,
7460    ///default: Unknown response
7461    Unknown,
7462}
7463/// Create a draft workflow with a blank trigger and exit node. When `workflowGroupId` is omitted, the workflow is added to the team's Unsorted group.
7464#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7465pub struct CreateWorkflowRequestParams {
7466    #[validate(nested)]
7467    pub body: CreateWorkflowRequest,
7468}
7469impl CreateWorkflowRequestParams {
7470    /// Parse the HTTP response into the response enum.
7471    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<CreateWorkflowResponse> {
7472        let status = req.status();
7473        if status == http::StatusCode::OK {
7474            let data =
7475                oas3_gen_support::Diagnostics::<SimplifiedWorkflow>::json_with_diagnostics(req)
7476                    .await?;
7477            return Ok(CreateWorkflowResponse::Ok(data));
7478        }
7479        if status == http::StatusCode::BAD_REQUEST {
7480            let data =
7481                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7482                    req,
7483                )
7484                .await?;
7485            return Ok(CreateWorkflowResponse::BadRequest(data));
7486        }
7487        if status == http::StatusCode::UNAUTHORIZED {
7488            let _ = req.bytes().await?;
7489            return Ok(CreateWorkflowResponse::Unauthorized);
7490        }
7491        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7492            let _ = req.bytes().await?;
7493            return Ok(CreateWorkflowResponse::MethodNotAllowed);
7494        }
7495        let _ = req.bytes().await?;
7496        return Ok(CreateWorkflowResponse::Unknown);
7497    }
7498}
7499/// Response types for createWorkflow
7500#[derive(Debug, Clone)]
7501pub enum CreateWorkflowResponse {
7502    ///200: Workflow created.
7503    Ok(SimplifiedWorkflow),
7504    ///400: Invalid request body or workflow group not found.
7505    BadRequest(WorkflowFailureResponse),
7506    ///401: Invalid API key.
7507    Unauthorized,
7508    ///405: Wrong HTTP request method.
7509    MethodNotAllowed,
7510    ///default: Unknown response
7511    Unknown,
7512}
7513#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7514pub struct GetWorkflowRequestPath {
7515    /// The ID of the workflow.
7516    #[validate(length(min = 1u64))]
7517    pub workflow_id: String,
7518}
7519/// Retrieve a workflow graph with node type names, connections, and selected display fields.
7520#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7521pub struct GetWorkflowRequest {
7522    #[validate(nested)]
7523    pub path: GetWorkflowRequestPath,
7524}
7525impl GetWorkflowRequest {
7526    /// Parse the HTTP response into the response enum.
7527    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetWorkflowResponse> {
7528        let status = req.status();
7529        if status == http::StatusCode::OK {
7530            let data =
7531                oas3_gen_support::Diagnostics::<SimplifiedWorkflow>::json_with_diagnostics(req)
7532                    .await?;
7533            return Ok(GetWorkflowResponse::Ok(data));
7534        }
7535        if status == http::StatusCode::BAD_REQUEST {
7536            let data =
7537                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7538                    req,
7539                )
7540                .await?;
7541            return Ok(GetWorkflowResponse::BadRequest(data));
7542        }
7543        if status == http::StatusCode::UNAUTHORIZED {
7544            let _ = req.bytes().await?;
7545            return Ok(GetWorkflowResponse::Unauthorized);
7546        }
7547        if status == http::StatusCode::NOT_FOUND {
7548            let data =
7549                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7550                    req,
7551                )
7552                .await?;
7553            return Ok(GetWorkflowResponse::NotFound(data));
7554        }
7555        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7556            let _ = req.bytes().await?;
7557            return Ok(GetWorkflowResponse::MethodNotAllowed);
7558        }
7559        let _ = req.bytes().await?;
7560        return Ok(GetWorkflowResponse::Unknown);
7561    }
7562}
7563/// Response types for getWorkflow
7564#[derive(Debug, Clone)]
7565pub enum GetWorkflowResponse {
7566    ///200: Successful.
7567    Ok(SimplifiedWorkflow),
7568    ///400: Invalid `workflowId`.
7569    BadRequest(WorkflowFailureResponse),
7570    ///401: Invalid API key.
7571    Unauthorized,
7572    ///404: Workflow not found.
7573    NotFound(WorkflowFailureResponse),
7574    ///405: Wrong HTTP request method.
7575    MethodNotAllowed,
7576    ///default: Unknown response
7577    Unknown,
7578}
7579#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7580pub struct UpdateWorkflowPropertiesRequestParamsPath {
7581    /// The ID of the workflow.
7582    #[validate(length(min = 1u64))]
7583    pub workflow_id: String,
7584}
7585/// Update a workflow's name, description, or group. At least one field must be provided. To change the workflow's mailing list, use the `POST /v1/workflows/{workflowId}/mailing-list` endpoint instead.
7586#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7587pub struct UpdateWorkflowPropertiesRequestParams {
7588    #[validate(nested)]
7589    pub path: UpdateWorkflowPropertiesRequestParamsPath,
7590    pub body: UpdateWorkflowPropertiesRequest,
7591}
7592impl UpdateWorkflowPropertiesRequestParams {
7593    /// Parse the HTTP response into the response enum.
7594    pub async fn parse_response(
7595        req: reqwest::Response,
7596    ) -> anyhow::Result<UpdateWorkflowPropertiesResponse> {
7597        let status = req.status();
7598        if status == http::StatusCode::OK {
7599            let data =
7600                oas3_gen_support::Diagnostics::<SimplifiedWorkflow>::json_with_diagnostics(req)
7601                    .await?;
7602            return Ok(UpdateWorkflowPropertiesResponse::Ok(data));
7603        }
7604        if status == http::StatusCode::BAD_REQUEST {
7605            let data =
7606                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7607                    req,
7608                )
7609                .await?;
7610            return Ok(UpdateWorkflowPropertiesResponse::BadRequest(data));
7611        }
7612        if status == http::StatusCode::UNAUTHORIZED {
7613            let _ = req.bytes().await?;
7614            return Ok(UpdateWorkflowPropertiesResponse::Unauthorized);
7615        }
7616        if status == http::StatusCode::NOT_FOUND {
7617            let data =
7618                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7619                    req,
7620                )
7621                .await?;
7622            return Ok(UpdateWorkflowPropertiesResponse::NotFound(data));
7623        }
7624        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7625            let _ = req.bytes().await?;
7626            return Ok(UpdateWorkflowPropertiesResponse::MethodNotAllowed);
7627        }
7628        if status == http::StatusCode::CONFLICT {
7629            let data =
7630                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7631                    req,
7632                )
7633                .await?;
7634            return Ok(UpdateWorkflowPropertiesResponse::Conflict(data));
7635        }
7636        let _ = req.bytes().await?;
7637        return Ok(UpdateWorkflowPropertiesResponse::Unknown);
7638    }
7639}
7640/// Response types for updateWorkflowProperties
7641#[derive(Debug, Clone)]
7642pub enum UpdateWorkflowPropertiesResponse {
7643    ///200: Workflow properties updated.
7644    Ok(SimplifiedWorkflow),
7645    ///400: Invalid `workflowId`, request body, or workflow group not found.
7646    BadRequest(WorkflowFailureResponse),
7647    ///401: Invalid API key.
7648    Unauthorized,
7649    ///404: Workflow not found.
7650    NotFound(WorkflowFailureResponse),
7651    ///405: Wrong HTTP request method.
7652    MethodNotAllowed,
7653    ///409: `expectedRevisionId` is stale.
7654    Conflict(WorkflowFailureResponse),
7655    ///default: Unknown response
7656    Unknown,
7657}
7658#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7659pub struct DeleteWorkflowRequestParamsPath {
7660    /// The ID of the workflow.
7661    #[validate(length(min = 1u64))]
7662    pub workflow_id: String,
7663}
7664/// Delete a workflow. Successful deletion returns `204 No Content`. If the workflow is currently sending or has queued contacts, Loops returns `409 Conflict` with a message instead of deleting. Retry with `confirmDelete: true` to delete the workflow, stop sending, and cancel queued contacts.
7665#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7666pub struct DeleteWorkflowRequestParams {
7667    #[validate(nested)]
7668    pub path: DeleteWorkflowRequestParamsPath,
7669    pub body: DeleteWorkflowRequest,
7670}
7671impl DeleteWorkflowRequestParams {
7672    /// Parse the HTTP response into the response enum.
7673    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<DeleteWorkflowResponse> {
7674        let status = req.status();
7675        if status == http::StatusCode::NO_CONTENT {
7676            let _ = req.bytes().await?;
7677            return Ok(DeleteWorkflowResponse::NoContent);
7678        }
7679        if status == http::StatusCode::BAD_REQUEST {
7680            let data =
7681                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7682                    req,
7683                )
7684                .await?;
7685            return Ok(DeleteWorkflowResponse::BadRequest(data));
7686        }
7687        if status == http::StatusCode::UNAUTHORIZED {
7688            let _ = req.bytes().await?;
7689            return Ok(DeleteWorkflowResponse::Unauthorized);
7690        }
7691        if status == http::StatusCode::NOT_FOUND {
7692            let data =
7693                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7694                    req,
7695                )
7696                .await?;
7697            return Ok(DeleteWorkflowResponse::NotFound(data));
7698        }
7699        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7700            let _ = req.bytes().await?;
7701            return Ok(DeleteWorkflowResponse::MethodNotAllowed);
7702        }
7703        if status == http::StatusCode::CONFLICT {
7704            let data =
7705                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7706                    req,
7707                )
7708                .await?;
7709            return Ok(DeleteWorkflowResponse::Conflict(data));
7710        }
7711        let _ = req.bytes().await?;
7712        return Ok(DeleteWorkflowResponse::Unknown);
7713    }
7714}
7715/// Response types for deleteWorkflow
7716#[derive(Debug, Clone)]
7717pub enum DeleteWorkflowResponse {
7718    ///204: Workflow deleted. No response body.
7719    NoContent,
7720    ///400: Invalid `workflowId`, request body, or delete target.
7721    BadRequest(WorkflowFailureResponse),
7722    ///401: Invalid API key.
7723    Unauthorized,
7724    ///404: Workflow not found. Deleted workflows are returned as not found.
7725    NotFound(WorkflowFailureResponse),
7726    ///405: Wrong HTTP request method.
7727    MethodNotAllowed,
7728    ///409: `expectedRevisionId` is stale, or workflow deletion requires confirmation because the workflow is currently sending or has queued contacts.
7729    Conflict(WorkflowFailureResponse),
7730    ///default: Unknown response
7731    Unknown,
7732}
7733#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7734pub struct ChangeWorkflowMailingListRequestParamsPath {
7735    /// The ID of the workflow.
7736    #[validate(length(min = 1u64))]
7737    pub workflow_id: String,
7738}
7739/// Dry run or apply a workflow mailing list change. If queued contacts would be removed from the workflow due to the change of mailing list, Loops returns with `"status": "queuedContactsFound"` instead of applying the change. Retry with `queuedContactPolicy: "discard"` to apply the change and discard those contacts. Confirmed update responses include the simplified workflow after the mailing list changes.
7740#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7741pub struct ChangeWorkflowMailingListRequestParams {
7742    #[validate(nested)]
7743    pub path: ChangeWorkflowMailingListRequestParamsPath,
7744    pub body: ChangeWorkflowMailingListRequest,
7745}
7746impl ChangeWorkflowMailingListRequestParams {
7747    /// Parse the HTTP response into the response enum.
7748    pub async fn parse_response(
7749        req: reqwest::Response,
7750    ) -> anyhow::Result<ChangeWorkflowMailingListResponseEnum> {
7751        let status = req.status();
7752        if status == http::StatusCode::OK {
7753            let data = oas3_gen_support::Diagnostics::<
7754                ChangeWorkflowMailingListResponse,
7755            >::json_with_diagnostics(req)
7756                .await?;
7757            return Ok(ChangeWorkflowMailingListResponseEnum::Ok(data));
7758        }
7759        if status == http::StatusCode::BAD_REQUEST {
7760            let data =
7761                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7762                    req,
7763                )
7764                .await?;
7765            return Ok(ChangeWorkflowMailingListResponseEnum::BadRequest(data));
7766        }
7767        if status == http::StatusCode::UNAUTHORIZED {
7768            let _ = req.bytes().await?;
7769            return Ok(ChangeWorkflowMailingListResponseEnum::Unauthorized);
7770        }
7771        if status == http::StatusCode::NOT_FOUND {
7772            let data =
7773                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7774                    req,
7775                )
7776                .await?;
7777            return Ok(ChangeWorkflowMailingListResponseEnum::NotFound(data));
7778        }
7779        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7780            let _ = req.bytes().await?;
7781            return Ok(ChangeWorkflowMailingListResponseEnum::MethodNotAllowed);
7782        }
7783        if status == http::StatusCode::CONFLICT {
7784            let data =
7785                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7786                    req,
7787                )
7788                .await?;
7789            return Ok(ChangeWorkflowMailingListResponseEnum::Conflict(data));
7790        }
7791        let _ = req.bytes().await?;
7792        return Ok(ChangeWorkflowMailingListResponseEnum::Unknown);
7793    }
7794}
7795/// Response types for changeWorkflowMailingList
7796#[derive(Debug, Clone)]
7797pub enum ChangeWorkflowMailingListResponseEnum {
7798    ///200: Mailing-list dry run, queued-contact warning, or update result. Confirmed update responses include the simplified workflow after the mailing list changes.
7799    Ok(ChangeWorkflowMailingListResponse),
7800    ///400: Invalid `workflowId`, request body, mailing list, or workflow state.
7801    BadRequest(WorkflowFailureResponse),
7802    ///401: Invalid API key.
7803    Unauthorized,
7804    ///404: Workflow not found.
7805    NotFound(WorkflowFailureResponse),
7806    ///405: Wrong HTTP request method.
7807    MethodNotAllowed,
7808    ///409: `expectedRevisionId` is stale.
7809    Conflict(WorkflowFailureResponse),
7810    ///default: Unknown response
7811    Unknown,
7812}
7813#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7814pub struct CreateWorkflowNodeRequestParamsPath {
7815    /// The ID of the workflow.
7816    #[validate(length(min = 1u64))]
7817    pub workflow_id: String,
7818}
7819/// Create a new default workflow node and return it with the latest workflow.
7820///
7821/// Choose where the node goes with `insertMode`: `between` places it between an existing `fromNodeId` -> `toNodeId` connection, `before` places it before `toNodeId`, and `after` places it after `fromNodeId` when that node has exactly one outgoing connection. `after` is a convenience for simple linear paths, so callers do not need to fetch and pass the current child node ID. It is invalid when `fromNodeId` has no outgoing nodes, multiple outgoing nodes, or is an exit node. When the source has multiple outgoing nodes, use `between` with the exact `toNodeId` instead. For `before`, deprecated `beforeNodeId` requests are still accepted for compatibility, but new callers should use `toNodeId`.
7822///
7823/// New nodes start with default settings; update the node after creation to configure it. Branch nodes create their default paths too: `BranchNode` creates two `AudienceFilter` children, and `ExperimentBranchNode` creates two regular `VariantNode` children plus one control `VariantNode`. Public workflows can have up to 400 nodes. Generated children count toward that limit, so a normal create adds 1 node, `BranchNode` adds 3, and `ExperimentBranchNode` adds 4. To add a sibling child path to a branch or experiment branch, use the `POST /v1/workflows/{workflowId}/nodes/{nodeId}/add-branch` endpoint. Branch paths can be edited with create-node, but a workflow cannot be started unless each direct `BranchNode` child is an `AudienceFilter`. For experiments, use create-node only to insert a missing `VariantNode` before non-variant content; use add-branch for another variant path.
7824#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7825pub struct CreateWorkflowNodeRequestParams {
7826    #[validate(nested)]
7827    pub path: CreateWorkflowNodeRequestParamsPath,
7828    pub body: CreateWorkflowNodeRequest,
7829}
7830impl CreateWorkflowNodeRequestParams {
7831    /// Parse the HTTP response into the response enum.
7832    pub async fn parse_response(
7833        req: reqwest::Response,
7834    ) -> anyhow::Result<CreateWorkflowNodeResponseEnum> {
7835        let status = req.status();
7836        if status == http::StatusCode::OK {
7837            let data =
7838                oas3_gen_support::Diagnostics::<CreateWorkflowNodeResponse>::json_with_diagnostics(
7839                    req,
7840                )
7841                .await?;
7842            return Ok(CreateWorkflowNodeResponseEnum::Ok(data));
7843        }
7844        if status == http::StatusCode::BAD_REQUEST {
7845            let data =
7846                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7847                    req,
7848                )
7849                .await?;
7850            return Ok(CreateWorkflowNodeResponseEnum::BadRequest(data));
7851        }
7852        if status == http::StatusCode::UNAUTHORIZED {
7853            let _ = req.bytes().await?;
7854            return Ok(CreateWorkflowNodeResponseEnum::Unauthorized);
7855        }
7856        if status == http::StatusCode::NOT_FOUND {
7857            let data =
7858                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7859                    req,
7860                )
7861                .await?;
7862            return Ok(CreateWorkflowNodeResponseEnum::NotFound(data));
7863        }
7864        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7865            let _ = req.bytes().await?;
7866            return Ok(CreateWorkflowNodeResponseEnum::MethodNotAllowed);
7867        }
7868        if status == http::StatusCode::CONFLICT {
7869            let data =
7870                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7871                    req,
7872                )
7873                .await?;
7874            return Ok(CreateWorkflowNodeResponseEnum::Conflict(data));
7875        }
7876        let _ = req.bytes().await?;
7877        return Ok(CreateWorkflowNodeResponseEnum::Unknown);
7878    }
7879}
7880/// Response types for createWorkflowNode
7881#[derive(Debug, Clone)]
7882pub enum CreateWorkflowNodeResponseEnum {
7883    ///200: Workflow node created.
7884    Ok(CreateWorkflowNodeResponse),
7885    ///400: Invalid request. Details will be shown in `message`.
7886    BadRequest(WorkflowFailureResponse),
7887    ///401: Invalid API key.
7888    Unauthorized,
7889    ///404: Workflow or workflow node not found.
7890    NotFound(WorkflowFailureResponse),
7891    ///405: Wrong HTTP request method.
7892    MethodNotAllowed,
7893    ///409: `expectedRevisionId` is stale.
7894    Conflict(WorkflowFailureResponse),
7895    ///default: Unknown response
7896    Unknown,
7897}
7898#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7899pub struct AddWorkflowBranchRequestParamsPath {
7900    /// The ID of the workflow.
7901    #[validate(length(min = 1u64))]
7902    pub workflow_id: String,
7903    /// The ID of the BranchNode or ExperimentBranchNode that should receive one new child.
7904    #[validate(length(min = 1u64))]
7905    pub node_id: String,
7906}
7907/// Add a branch and a child node under an existing Branch or Experiment node. Returns the created child node plus the latest workflow.
7908///
7909/// - Adding a branch to a `BranchNode` creates one `AudienceFilter` child node.
7910/// - Adding a branch to an `ExperimentBranchNode` creates one `VariantNode` child node.
7911///
7912/// This endpoint does not accept node configuration fields; update the child node with `POST /v1/workflows/{workflowId}/nodes/{nodeId}` after creation. Public workflows are limited to 400 nodes, and this endpoint adds 1 node.
7913#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7914pub struct AddWorkflowBranchRequestParams {
7915    #[validate(nested)]
7916    pub path: AddWorkflowBranchRequestParamsPath,
7917    pub body: AddWorkflowBranchRequest,
7918}
7919impl AddWorkflowBranchRequestParams {
7920    /// Parse the HTTP response into the response enum.
7921    pub async fn parse_response(
7922        req: reqwest::Response,
7923    ) -> anyhow::Result<AddWorkflowBranchResponseEnum> {
7924        let status = req.status();
7925        if status == http::StatusCode::OK {
7926            let data =
7927                oas3_gen_support::Diagnostics::<AddWorkflowBranchResponse>::json_with_diagnostics(
7928                    req,
7929                )
7930                .await?;
7931            return Ok(AddWorkflowBranchResponseEnum::Ok(data));
7932        }
7933        if status == http::StatusCode::BAD_REQUEST {
7934            let data =
7935                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7936                    req,
7937                )
7938                .await?;
7939            return Ok(AddWorkflowBranchResponseEnum::BadRequest(data));
7940        }
7941        if status == http::StatusCode::UNAUTHORIZED {
7942            let _ = req.bytes().await?;
7943            return Ok(AddWorkflowBranchResponseEnum::Unauthorized);
7944        }
7945        if status == http::StatusCode::NOT_FOUND {
7946            let data =
7947                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7948                    req,
7949                )
7950                .await?;
7951            return Ok(AddWorkflowBranchResponseEnum::NotFound(data));
7952        }
7953        if status == http::StatusCode::METHOD_NOT_ALLOWED {
7954            let _ = req.bytes().await?;
7955            return Ok(AddWorkflowBranchResponseEnum::MethodNotAllowed);
7956        }
7957        if status == http::StatusCode::CONFLICT {
7958            let data =
7959                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
7960                    req,
7961                )
7962                .await?;
7963            return Ok(AddWorkflowBranchResponseEnum::Conflict(data));
7964        }
7965        let _ = req.bytes().await?;
7966        return Ok(AddWorkflowBranchResponseEnum::Unknown);
7967    }
7968}
7969/// Response types for addWorkflowBranch
7970#[derive(Debug, Clone)]
7971pub enum AddWorkflowBranchResponseEnum {
7972    ///200: Branch added.
7973    Ok(AddWorkflowBranchResponse),
7974    ///400: Invalid `workflowId`, `nodeId`, request body, branch target, workflow state, or workflow node cap.
7975    BadRequest(WorkflowFailureResponse),
7976    ///401: Invalid API key.
7977    Unauthorized,
7978    ///404: Workflow or workflow node not found.
7979    NotFound(WorkflowFailureResponse),
7980    ///405: Wrong HTTP request method.
7981    MethodNotAllowed,
7982    ///409: `expectedRevisionId` is stale.
7983    Conflict(WorkflowFailureResponse),
7984    ///default: Unknown response
7985    Unknown,
7986}
7987#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
7988pub struct GetWorkflowNodeRequestPath {
7989    /// The ID of the workflow.
7990    #[validate(length(min = 1u64))]
7991    pub workflow_id: String,
7992    /// The ID of the workflow node.
7993    #[validate(length(min = 1u64))]
7994    pub node_id: String,
7995}
7996/// Retrieve detailed data for a single workflow node.
7997#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
7998pub struct GetWorkflowNodeRequest {
7999    #[validate(nested)]
8000    pub path: GetWorkflowNodeRequestPath,
8001}
8002impl GetWorkflowNodeRequest {
8003    /// Parse the HTTP response into the response enum.
8004    pub async fn parse_response(req: reqwest::Response) -> anyhow::Result<GetWorkflowNodeResponse> {
8005        let status = req.status();
8006        if status == http::StatusCode::OK {
8007            let data =
8008                oas3_gen_support::Diagnostics::<WorkflowNodeWithRevision>::json_with_diagnostics(
8009                    req,
8010                )
8011                .await?;
8012            return Ok(GetWorkflowNodeResponse::Ok(data));
8013        }
8014        if status == http::StatusCode::BAD_REQUEST {
8015            let data =
8016                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8017                    req,
8018                )
8019                .await?;
8020            return Ok(GetWorkflowNodeResponse::BadRequest(data));
8021        }
8022        if status == http::StatusCode::UNAUTHORIZED {
8023            let _ = req.bytes().await?;
8024            return Ok(GetWorkflowNodeResponse::Unauthorized);
8025        }
8026        if status == http::StatusCode::NOT_FOUND {
8027            let data =
8028                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8029                    req,
8030                )
8031                .await?;
8032            return Ok(GetWorkflowNodeResponse::NotFound(data));
8033        }
8034        if status == http::StatusCode::METHOD_NOT_ALLOWED {
8035            let _ = req.bytes().await?;
8036            return Ok(GetWorkflowNodeResponse::MethodNotAllowed);
8037        }
8038        let _ = req.bytes().await?;
8039        return Ok(GetWorkflowNodeResponse::Unknown);
8040    }
8041}
8042/// Response types for getWorkflowNode
8043#[derive(Debug, Clone)]
8044pub enum GetWorkflowNodeResponse {
8045    ///200: Successful.
8046    Ok(WorkflowNodeWithRevision),
8047    ///400: Invalid `workflowId` or `nodeId`.
8048    BadRequest(WorkflowFailureResponse),
8049    ///401: Invalid API key.
8050    Unauthorized,
8051    ///404: Workflow or workflow node not found.
8052    NotFound(WorkflowFailureResponse),
8053    ///405: Wrong HTTP request method.
8054    MethodNotAllowed,
8055    ///default: Unknown response
8056    Unknown,
8057}
8058#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8059pub struct UpdateWorkflowNodeRequestParamsPath {
8060    /// The ID of the workflow.
8061    #[validate(length(min = 1u64))]
8062    pub workflow_id: String,
8063    /// The ID of the workflow node.
8064    #[validate(length(min = 1u64))]
8065    pub node_id: String,
8066}
8067/// Update workflow-node-owned fields for a single node. Shared resources such as email messages and audience segments should be updated through their own APIs.
8068#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8069pub struct UpdateWorkflowNodeRequestParams {
8070    #[validate(nested)]
8071    pub path: UpdateWorkflowNodeRequestParamsPath,
8072    pub body: UpdateWorkflowNodeRequest,
8073}
8074impl UpdateWorkflowNodeRequestParams {
8075    /// Parse the HTTP response into the response enum.
8076    pub async fn parse_response(
8077        req: reqwest::Response,
8078    ) -> anyhow::Result<UpdateWorkflowNodeResponseEnum> {
8079        let status = req.status();
8080        if status == http::StatusCode::OK {
8081            let data =
8082                oas3_gen_support::Diagnostics::<UpdateWorkflowNodeResponse>::json_with_diagnostics(
8083                    req,
8084                )
8085                .await?;
8086            return Ok(UpdateWorkflowNodeResponseEnum::Ok(data));
8087        }
8088        if status == http::StatusCode::BAD_REQUEST {
8089            let data =
8090                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8091                    req,
8092                )
8093                .await?;
8094            return Ok(UpdateWorkflowNodeResponseEnum::BadRequest(data));
8095        }
8096        if status == http::StatusCode::UNAUTHORIZED {
8097            let _ = req.bytes().await?;
8098            return Ok(UpdateWorkflowNodeResponseEnum::Unauthorized);
8099        }
8100        if status == http::StatusCode::NOT_FOUND {
8101            let data =
8102                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8103                    req,
8104                )
8105                .await?;
8106            return Ok(UpdateWorkflowNodeResponseEnum::NotFound(data));
8107        }
8108        if status == http::StatusCode::METHOD_NOT_ALLOWED {
8109            let _ = req.bytes().await?;
8110            return Ok(UpdateWorkflowNodeResponseEnum::MethodNotAllowed);
8111        }
8112        if status == http::StatusCode::CONFLICT {
8113            let data =
8114                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8115                    req,
8116                )
8117                .await?;
8118            return Ok(UpdateWorkflowNodeResponseEnum::Conflict(data));
8119        }
8120        if status == http::StatusCode::NOT_IMPLEMENTED {
8121            let data =
8122                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8123                    req,
8124                )
8125                .await?;
8126            return Ok(UpdateWorkflowNodeResponseEnum::NotImplemented(data));
8127        }
8128        let _ = req.bytes().await?;
8129        return Ok(UpdateWorkflowNodeResponseEnum::Unknown);
8130    }
8131}
8132/// Response types for updateWorkflowNode
8133#[derive(Debug, Clone)]
8134pub enum UpdateWorkflowNodeResponseEnum {
8135    ///200: Workflow node updated.
8136    Ok(UpdateWorkflowNodeResponse),
8137    ///400: Invalid `workflowId`, `nodeId`, request body, or node update.
8138    BadRequest(WorkflowFailureResponse),
8139    ///401: Invalid API key.
8140    Unauthorized,
8141    ///404: Workflow or workflow node not found.
8142    NotFound(WorkflowFailureResponse),
8143    ///405: Wrong HTTP request method.
8144    MethodNotAllowed,
8145    ///409: `expectedRevisionId` is stale.
8146    Conflict(WorkflowFailureResponse),
8147    ///501: This node update is not implemented.
8148    NotImplemented(WorkflowFailureResponse),
8149    ///default: Unknown response
8150    Unknown,
8151}
8152#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8153pub struct DeleteWorkflowNodeRequestParamsPath {
8154    /// The ID of the workflow.
8155    #[validate(length(min = 1u64))]
8156    pub workflow_id: String,
8157    /// The ID of the workflow node.
8158    #[validate(length(min = 1u64))]
8159    pub node_id: String,
8160}
8161/// Delete a single workflow node. If contacts are queued at the node, Loops returns with `"status": "queuedContactsFound"` instead of deleting. Retry with `queuedContactPolicy: "discard"` to delete the node and discard those queued contacts. Confirmed deletion responses include the simplified workflow after the node is removed.
8162#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8163pub struct DeleteWorkflowNodeRequestParams {
8164    #[validate(nested)]
8165    pub path: DeleteWorkflowNodeRequestParamsPath,
8166    pub body: DeleteWorkflowNodeRequest,
8167}
8168impl DeleteWorkflowNodeRequestParams {
8169    /// Parse the HTTP response into the response enum.
8170    pub async fn parse_response(
8171        req: reqwest::Response,
8172    ) -> anyhow::Result<DeleteWorkflowNodeResponseEnum> {
8173        let status = req.status();
8174        if status == http::StatusCode::OK {
8175            let data =
8176                oas3_gen_support::Diagnostics::<DeleteWorkflowNodeResponse>::json_with_diagnostics(
8177                    req,
8178                )
8179                .await?;
8180            return Ok(DeleteWorkflowNodeResponseEnum::Ok(data));
8181        }
8182        if status == http::StatusCode::BAD_REQUEST {
8183            let data =
8184                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8185                    req,
8186                )
8187                .await?;
8188            return Ok(DeleteWorkflowNodeResponseEnum::BadRequest(data));
8189        }
8190        if status == http::StatusCode::UNAUTHORIZED {
8191            let _ = req.bytes().await?;
8192            return Ok(DeleteWorkflowNodeResponseEnum::Unauthorized);
8193        }
8194        if status == http::StatusCode::NOT_FOUND {
8195            let data =
8196                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8197                    req,
8198                )
8199                .await?;
8200            return Ok(DeleteWorkflowNodeResponseEnum::NotFound(data));
8201        }
8202        if status == http::StatusCode::METHOD_NOT_ALLOWED {
8203            let _ = req.bytes().await?;
8204            return Ok(DeleteWorkflowNodeResponseEnum::MethodNotAllowed);
8205        }
8206        if status == http::StatusCode::CONFLICT {
8207            let data =
8208                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8209                    req,
8210                )
8211                .await?;
8212            return Ok(DeleteWorkflowNodeResponseEnum::Conflict(data));
8213        }
8214        let _ = req.bytes().await?;
8215        return Ok(DeleteWorkflowNodeResponseEnum::Unknown);
8216    }
8217}
8218/// Response types for deleteWorkflowNode
8219#[derive(Debug, Clone)]
8220pub enum DeleteWorkflowNodeResponseEnum {
8221    ///200: Delete dry run, queued-contact warning, or deletion result. Confirmed deletion responses include the simplified workflow after the node is removed.
8222    Ok(DeleteWorkflowNodeResponse),
8223    ///400: Invalid `workflowId`, `nodeId`, request body, or delete target.
8224    BadRequest(WorkflowFailureResponse),
8225    ///401: Invalid API key.
8226    Unauthorized,
8227    ///404: Workflow or workflow node not found.
8228    NotFound(WorkflowFailureResponse),
8229    ///405: Wrong HTTP request method.
8230    MethodNotAllowed,
8231    ///409: `expectedRevisionId` is stale.
8232    Conflict(WorkflowFailureResponse),
8233    ///default: Unknown response
8234    Unknown,
8235}
8236#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8237pub struct GetWorkflowNodeMetricsRequestPath {
8238    /// The ID of the workflow.
8239    #[validate(length(min = 1u64))]
8240    pub workflow_id: String,
8241    /// The ID of the `SendEmailAction` node.
8242    #[validate(length(min = 1u64))]
8243    pub node_id: String,
8244}
8245/// Retrieve all-time email engagement metrics for a workflow `SendEmailAction` node. Nodes of any other type return a `400` response. A `SendEmailAction` node with an email that has not sent anything yet reports every counter as `0`.
8246#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8247pub struct GetWorkflowNodeMetricsRequest {
8248    #[validate(nested)]
8249    pub path: GetWorkflowNodeMetricsRequestPath,
8250}
8251impl GetWorkflowNodeMetricsRequest {
8252    /// Parse the HTTP response into the response enum.
8253    pub async fn parse_response(
8254        req: reqwest::Response,
8255    ) -> anyhow::Result<GetWorkflowNodeMetricsResponse> {
8256        let status = req.status();
8257        if status == http::StatusCode::OK {
8258            let data =
8259                oas3_gen_support::Diagnostics::<EmailMetricsResponse>::json_with_diagnostics(req)
8260                    .await?;
8261            return Ok(GetWorkflowNodeMetricsResponse::Ok(data));
8262        }
8263        if status == http::StatusCode::BAD_REQUEST {
8264            let data =
8265                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8266                    req,
8267                )
8268                .await?;
8269            return Ok(GetWorkflowNodeMetricsResponse::BadRequest(data));
8270        }
8271        if status == http::StatusCode::UNAUTHORIZED {
8272            let _ = req.bytes().await?;
8273            return Ok(GetWorkflowNodeMetricsResponse::Unauthorized);
8274        }
8275        if status == http::StatusCode::NOT_FOUND {
8276            let data =
8277                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8278                    req,
8279                )
8280                .await?;
8281            return Ok(GetWorkflowNodeMetricsResponse::NotFound(data));
8282        }
8283        if status == http::StatusCode::METHOD_NOT_ALLOWED {
8284            let _ = req.bytes().await?;
8285            return Ok(GetWorkflowNodeMetricsResponse::MethodNotAllowed);
8286        }
8287        let _ = req.bytes().await?;
8288        return Ok(GetWorkflowNodeMetricsResponse::Unknown);
8289    }
8290}
8291/// Response types for getWorkflowNodeMetrics
8292#[derive(Debug, Clone)]
8293pub enum GetWorkflowNodeMetricsResponse {
8294    ///200: Successful.
8295    Ok(EmailMetricsResponse),
8296    ///400: Invalid `workflowId` or `nodeId`, the node is not a `SendEmailAction` node, or the node has no email message.
8297    BadRequest(WorkflowFailureResponse),
8298    ///401: Invalid API key.
8299    Unauthorized,
8300    ///404: Workflow or workflow node not found.
8301    NotFound(WorkflowFailureResponse),
8302    ///405: Wrong HTTP request method.
8303    MethodNotAllowed,
8304    ///default: Unknown response
8305    Unknown,
8306}
8307#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8308pub struct RerouteNodeConnectionRequestParamsPath {
8309    /// The ID of the workflow.
8310    #[validate(length(min = 1u64))]
8311    pub workflow_id: String,
8312    /// The ID of the source workflow node whose outgoing connection should be moved.
8313    #[validate(length(min = 1u64))]
8314    pub node_id: String,
8315}
8316/// Reroute the source node's existing connection to another valid target node. Returns the updated source node and the latest workflow.
8317#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8318pub struct RerouteNodeConnectionRequestParams {
8319    #[validate(nested)]
8320    pub path: RerouteNodeConnectionRequestParamsPath,
8321    #[validate(nested)]
8322    pub body: RerouteNodeConnectionRequest,
8323}
8324impl RerouteNodeConnectionRequestParams {
8325    /// Parse the HTTP response into the response enum.
8326    pub async fn parse_response(
8327        req: reqwest::Response,
8328    ) -> anyhow::Result<RerouteNodeConnectionResponseEnum> {
8329        let status = req.status();
8330        if status == http::StatusCode::OK {
8331            let data = oas3_gen_support::Diagnostics::<
8332                RerouteNodeConnectionResponse,
8333            >::json_with_diagnostics(req)
8334                .await?;
8335            return Ok(RerouteNodeConnectionResponseEnum::Ok(data));
8336        }
8337        if status == http::StatusCode::BAD_REQUEST {
8338            let data =
8339                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8340                    req,
8341                )
8342                .await?;
8343            return Ok(RerouteNodeConnectionResponseEnum::BadRequest(data));
8344        }
8345        if status == http::StatusCode::UNAUTHORIZED {
8346            let _ = req.bytes().await?;
8347            return Ok(RerouteNodeConnectionResponseEnum::Unauthorized);
8348        }
8349        if status == http::StatusCode::NOT_FOUND {
8350            let data =
8351                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8352                    req,
8353                )
8354                .await?;
8355            return Ok(RerouteNodeConnectionResponseEnum::NotFound(data));
8356        }
8357        if status == http::StatusCode::METHOD_NOT_ALLOWED {
8358            let _ = req.bytes().await?;
8359            return Ok(RerouteNodeConnectionResponseEnum::MethodNotAllowed);
8360        }
8361        if status == http::StatusCode::CONFLICT {
8362            let data =
8363                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8364                    req,
8365                )
8366                .await?;
8367            return Ok(RerouteNodeConnectionResponseEnum::Conflict(data));
8368        }
8369        let _ = req.bytes().await?;
8370        return Ok(RerouteNodeConnectionResponseEnum::Unknown);
8371    }
8372}
8373/// Response types for rerouteNodeConnection
8374#[derive(Debug, Clone)]
8375pub enum RerouteNodeConnectionResponseEnum {
8376    ///200: Node connection rerouted.
8377    Ok(RerouteNodeConnectionResponse),
8378    ///400: Invalid `workflowId`, `nodeId`, request body, node connection selection, reroute target, or workflow state.
8379    BadRequest(WorkflowFailureResponse),
8380    ///401: Invalid API key.
8381    Unauthorized,
8382    ///404: Workflow or workflow node not found.
8383    NotFound(WorkflowFailureResponse),
8384    ///405: Wrong HTTP request method.
8385    MethodNotAllowed,
8386    ///409: `expectedRevisionId` is stale.
8387    Conflict(WorkflowFailureResponse),
8388    ///default: Unknown response
8389    Unknown,
8390}
8391#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8392pub struct DeleteWorkflowNodeRecursivelyRequestPath {
8393    /// The ID of the workflow.
8394    #[validate(length(min = 1u64))]
8395    pub workflow_id: String,
8396    /// The root node ID of the subtree to delete.
8397    #[validate(length(min = 1u64))]
8398    pub node_id: String,
8399}
8400/// Delete a node and its downstream subtree. If contacts are queued at any node that would be deleted, Loops returns with `"status": "queuedContactsFound"` instead of deleting. Retry with `queuedContactPolicy: "discard"` to delete the nodes and discard those queued contacts. Confirmed deletion responses include the simplified workflow after the nodes are removed.
8401#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8402pub struct DeleteWorkflowNodeRecursivelyRequest {
8403    #[validate(nested)]
8404    pub path: DeleteWorkflowNodeRecursivelyRequestPath,
8405    pub body: DeleteWorkflowNodeRequest,
8406}
8407impl DeleteWorkflowNodeRecursivelyRequest {
8408    /// Parse the HTTP response into the response enum.
8409    pub async fn parse_response(
8410        req: reqwest::Response,
8411    ) -> anyhow::Result<DeleteWorkflowNodeResponseEnum> {
8412        let status = req.status();
8413        if status == http::StatusCode::OK {
8414            let data =
8415                oas3_gen_support::Diagnostics::<DeleteWorkflowNodeResponse>::json_with_diagnostics(
8416                    req,
8417                )
8418                .await?;
8419            return Ok(DeleteWorkflowNodeResponseEnum::Ok(data));
8420        }
8421        if status == http::StatusCode::BAD_REQUEST {
8422            let data =
8423                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8424                    req,
8425                )
8426                .await?;
8427            return Ok(DeleteWorkflowNodeResponseEnum::BadRequest(data));
8428        }
8429        if status == http::StatusCode::UNAUTHORIZED {
8430            let _ = req.bytes().await?;
8431            return Ok(DeleteWorkflowNodeResponseEnum::Unauthorized);
8432        }
8433        if status == http::StatusCode::NOT_FOUND {
8434            let data =
8435                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8436                    req,
8437                )
8438                .await?;
8439            return Ok(DeleteWorkflowNodeResponseEnum::NotFound(data));
8440        }
8441        if status == http::StatusCode::METHOD_NOT_ALLOWED {
8442            let _ = req.bytes().await?;
8443            return Ok(DeleteWorkflowNodeResponseEnum::MethodNotAllowed);
8444        }
8445        if status == http::StatusCode::CONFLICT {
8446            let data =
8447                oas3_gen_support::Diagnostics::<WorkflowFailureResponse>::json_with_diagnostics(
8448                    req,
8449                )
8450                .await?;
8451            return Ok(DeleteWorkflowNodeResponseEnum::Conflict(data));
8452        }
8453        let _ = req.bytes().await?;
8454        return Ok(DeleteWorkflowNodeResponseEnum::Unknown);
8455    }
8456}
8457#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8458pub struct WebhookContactUnsubscribedRequestHeader {
8459    /// Unique message ID. Use to deduplicate deliveries.
8460    #[validate(length(min = 1u64))]
8461    pub webhook_id: String,
8462    /// Unix timestamp of when the message was sent.
8463    #[validate(length(min = 1u64))]
8464    pub webhook_timestamp: String,
8465    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8466    #[validate(length(min = 1u64))]
8467    pub webhook_signature: String,
8468}
8469impl core::convert::TryFrom<&WebhookContactUnsubscribedRequestHeader> for http::HeaderMap {
8470    type Error = http::header::InvalidHeaderValue;
8471    fn try_from(
8472        headers: &WebhookContactUnsubscribedRequestHeader,
8473    ) -> core::result::Result<Self, Self::Error> {
8474        let mut map = http::HeaderMap::with_capacity(3usize);
8475        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8476        map.insert(WEBHOOK_ID, header_value);
8477        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8478        map.insert(WEBHOOK_TIMESTAMP, header_value);
8479        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8480        map.insert(WEBHOOK_SIGNATURE, header_value);
8481        Ok(map)
8482    }
8483}
8484impl core::convert::TryFrom<WebhookContactUnsubscribedRequestHeader> for http::HeaderMap {
8485    type Error = http::header::InvalidHeaderValue;
8486    fn try_from(
8487        headers: WebhookContactUnsubscribedRequestHeader,
8488    ) -> core::result::Result<Self, Self::Error> {
8489        http::HeaderMap::try_from(&headers)
8490    }
8491}
8492/// Sent when a contact is unsubscribed from your audience, or when a contact is deleted from your audience (alongside `contact.deleted`). This is not the same as a contact unsubscribing from a mailing list (see `contact.mailingList.unsubscribed`). Contains a `contactIdentity` object.
8493#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8494pub struct WebhookContactUnsubscribedRequest {
8495    #[validate(nested)]
8496    pub header: WebhookContactUnsubscribedRequestHeader,
8497    #[validate(nested)]
8498    pub body: WebhookContactUnsubscribedPayload,
8499}
8500impl WebhookContactUnsubscribedRequest {
8501    /// Parse the HTTP response into the response enum.
8502    pub async fn parse_response(
8503        req: reqwest::Response,
8504    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
8505        let status = req.status();
8506        if status == http::StatusCode::OK {
8507            let _ = req.bytes().await?;
8508            return Ok(WebhookEmailOpenedResponse::Ok);
8509        }
8510        let _ = req.bytes().await?;
8511        return Ok(WebhookEmailOpenedResponse::Unknown);
8512    }
8513}
8514#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8515pub struct WebhookContactCreatedRequestHeader {
8516    /// Unique message ID. Use to deduplicate deliveries.
8517    #[validate(length(min = 1u64))]
8518    pub webhook_id: String,
8519    /// Unix timestamp of when the message was sent.
8520    #[validate(length(min = 1u64))]
8521    pub webhook_timestamp: String,
8522    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8523    #[validate(length(min = 1u64))]
8524    pub webhook_signature: String,
8525}
8526impl core::convert::TryFrom<&WebhookContactCreatedRequestHeader> for http::HeaderMap {
8527    type Error = http::header::InvalidHeaderValue;
8528    fn try_from(
8529        headers: &WebhookContactCreatedRequestHeader,
8530    ) -> core::result::Result<Self, Self::Error> {
8531        let mut map = http::HeaderMap::with_capacity(3usize);
8532        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8533        map.insert(WEBHOOK_ID, header_value);
8534        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8535        map.insert(WEBHOOK_TIMESTAMP, header_value);
8536        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8537        map.insert(WEBHOOK_SIGNATURE, header_value);
8538        Ok(map)
8539    }
8540}
8541impl core::convert::TryFrom<WebhookContactCreatedRequestHeader> for http::HeaderMap {
8542    type Error = http::header::InvalidHeaderValue;
8543    fn try_from(
8544        headers: WebhookContactCreatedRequestHeader,
8545    ) -> core::result::Result<Self, Self::Error> {
8546        http::HeaderMap::try_from(&headers)
8547    }
8548}
8549/// Sent when a new contact is created in your audience. Contains a `contactIdentity` object and a full `contact` object with all of the new contact's properties (including custom properties). When double opt-in is enabled, contact webhooks do not fire until the contact is confirmed; `contact.created` only fires for form-created contacts once they confirm their subscription. `optInStatus` will never be `"pending"` or `"rejected"` for this event.
8550#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8551pub struct WebhookContactCreatedRequest {
8552    #[validate(nested)]
8553    pub header: WebhookContactCreatedRequestHeader,
8554    #[validate(nested)]
8555    pub body: WebhookContactCreatedPayload,
8556}
8557impl WebhookContactCreatedRequest {
8558    /// Parse the HTTP response into the response enum.
8559    pub async fn parse_response(
8560        req: reqwest::Response,
8561    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
8562        let status = req.status();
8563        if status == http::StatusCode::OK {
8564            let _ = req.bytes().await?;
8565            return Ok(WebhookEmailOpenedResponse::Ok);
8566        }
8567        let _ = req.bytes().await?;
8568        return Ok(WebhookEmailOpenedResponse::Unknown);
8569    }
8570}
8571#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8572pub struct WebhookContactDeletedRequestHeader {
8573    /// Unique message ID. Use to deduplicate deliveries.
8574    #[validate(length(min = 1u64))]
8575    pub webhook_id: String,
8576    /// Unix timestamp of when the message was sent.
8577    #[validate(length(min = 1u64))]
8578    pub webhook_timestamp: String,
8579    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8580    #[validate(length(min = 1u64))]
8581    pub webhook_signature: String,
8582}
8583impl core::convert::TryFrom<&WebhookContactDeletedRequestHeader> for http::HeaderMap {
8584    type Error = http::header::InvalidHeaderValue;
8585    fn try_from(
8586        headers: &WebhookContactDeletedRequestHeader,
8587    ) -> core::result::Result<Self, Self::Error> {
8588        let mut map = http::HeaderMap::with_capacity(3usize);
8589        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8590        map.insert(WEBHOOK_ID, header_value);
8591        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8592        map.insert(WEBHOOK_TIMESTAMP, header_value);
8593        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8594        map.insert(WEBHOOK_SIGNATURE, header_value);
8595        Ok(map)
8596    }
8597}
8598impl core::convert::TryFrom<WebhookContactDeletedRequestHeader> for http::HeaderMap {
8599    type Error = http::header::InvalidHeaderValue;
8600    fn try_from(
8601        headers: WebhookContactDeletedRequestHeader,
8602    ) -> core::result::Result<Self, Self::Error> {
8603        http::HeaderMap::try_from(&headers)
8604    }
8605}
8606/// Sent when a contact is deleted from your audience. Contains a `contactIdentity` object.
8607#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8608pub struct WebhookContactDeletedRequest {
8609    #[validate(nested)]
8610    pub header: WebhookContactDeletedRequestHeader,
8611    #[validate(nested)]
8612    pub body: WebhookContactDeletedPayload,
8613}
8614impl WebhookContactDeletedRequest {
8615    /// Parse the HTTP response into the response enum.
8616    pub async fn parse_response(
8617        req: reqwest::Response,
8618    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
8619        let status = req.status();
8620        if status == http::StatusCode::OK {
8621            let _ = req.bytes().await?;
8622            return Ok(WebhookEmailOpenedResponse::Ok);
8623        }
8624        let _ = req.bytes().await?;
8625        return Ok(WebhookEmailOpenedResponse::Unknown);
8626    }
8627}
8628#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8629pub struct WebhookContactMailingListSubscribedRequestHeader {
8630    /// Unique message ID. Use to deduplicate deliveries.
8631    #[validate(length(min = 1u64))]
8632    pub webhook_id: String,
8633    /// Unix timestamp of when the message was sent.
8634    #[validate(length(min = 1u64))]
8635    pub webhook_timestamp: String,
8636    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8637    #[validate(length(min = 1u64))]
8638    pub webhook_signature: String,
8639}
8640impl core::convert::TryFrom<&WebhookContactMailingListSubscribedRequestHeader> for http::HeaderMap {
8641    type Error = http::header::InvalidHeaderValue;
8642    fn try_from(
8643        headers: &WebhookContactMailingListSubscribedRequestHeader,
8644    ) -> core::result::Result<Self, Self::Error> {
8645        let mut map = http::HeaderMap::with_capacity(3usize);
8646        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8647        map.insert(WEBHOOK_ID, header_value);
8648        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8649        map.insert(WEBHOOK_TIMESTAMP, header_value);
8650        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8651        map.insert(WEBHOOK_SIGNATURE, header_value);
8652        Ok(map)
8653    }
8654}
8655impl core::convert::TryFrom<WebhookContactMailingListSubscribedRequestHeader> for http::HeaderMap {
8656    type Error = http::header::InvalidHeaderValue;
8657    fn try_from(
8658        headers: WebhookContactMailingListSubscribedRequestHeader,
8659    ) -> core::result::Result<Self, Self::Error> {
8660        http::HeaderMap::try_from(&headers)
8661    }
8662}
8663/// Sent when a contact is subscribed to a mailing list. Contains `contactIdentity` and `mailingList` objects. When double opt-in is enabled, this event only fires after the contact confirms their subscription.
8664#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8665pub struct WebhookContactMailingListSubscribedRequest {
8666    #[validate(nested)]
8667    pub header: WebhookContactMailingListSubscribedRequestHeader,
8668    #[validate(nested)]
8669    pub body: WebhookContactMailingListSubscribedPayload,
8670}
8671impl WebhookContactMailingListSubscribedRequest {
8672    /// Parse the HTTP response into the response enum.
8673    pub async fn parse_response(
8674        req: reqwest::Response,
8675    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
8676        let status = req.status();
8677        if status == http::StatusCode::OK {
8678            let _ = req.bytes().await?;
8679            return Ok(WebhookEmailOpenedResponse::Ok);
8680        }
8681        let _ = req.bytes().await?;
8682        return Ok(WebhookEmailOpenedResponse::Unknown);
8683    }
8684}
8685#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8686pub struct WebhookContactMailingListUnsubscribedRequestHeader {
8687    /// Unique message ID. Use to deduplicate deliveries.
8688    #[validate(length(min = 1u64))]
8689    pub webhook_id: String,
8690    /// Unix timestamp of when the message was sent.
8691    #[validate(length(min = 1u64))]
8692    pub webhook_timestamp: String,
8693    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8694    #[validate(length(min = 1u64))]
8695    pub webhook_signature: String,
8696}
8697impl core::convert::TryFrom<&WebhookContactMailingListUnsubscribedRequestHeader>
8698    for http::HeaderMap
8699{
8700    type Error = http::header::InvalidHeaderValue;
8701    fn try_from(
8702        headers: &WebhookContactMailingListUnsubscribedRequestHeader,
8703    ) -> core::result::Result<Self, Self::Error> {
8704        let mut map = http::HeaderMap::with_capacity(3usize);
8705        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8706        map.insert(WEBHOOK_ID, header_value);
8707        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8708        map.insert(WEBHOOK_TIMESTAMP, header_value);
8709        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8710        map.insert(WEBHOOK_SIGNATURE, header_value);
8711        Ok(map)
8712    }
8713}
8714impl core::convert::TryFrom<WebhookContactMailingListUnsubscribedRequestHeader>
8715    for http::HeaderMap
8716{
8717    type Error = http::header::InvalidHeaderValue;
8718    fn try_from(
8719        headers: WebhookContactMailingListUnsubscribedRequestHeader,
8720    ) -> core::result::Result<Self, Self::Error> {
8721        http::HeaderMap::try_from(&headers)
8722    }
8723}
8724/// Sent when a contact is unsubscribed from a mailing list. This is not the same as a contact unsubscribing from your audience (see `contact.unsubscribed`). Contains `contactIdentity` and `mailingList` objects.
8725#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8726pub struct WebhookContactMailingListUnsubscribedRequest {
8727    #[validate(nested)]
8728    pub header: WebhookContactMailingListUnsubscribedRequestHeader,
8729    #[validate(nested)]
8730    pub body: WebhookContactMailingListUnsubscribedPayload,
8731}
8732impl WebhookContactMailingListUnsubscribedRequest {
8733    /// Parse the HTTP response into the response enum.
8734    pub async fn parse_response(
8735        req: reqwest::Response,
8736    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
8737        let status = req.status();
8738        if status == http::StatusCode::OK {
8739            let _ = req.bytes().await?;
8740            return Ok(WebhookEmailOpenedResponse::Ok);
8741        }
8742        let _ = req.bytes().await?;
8743        return Ok(WebhookEmailOpenedResponse::Unknown);
8744    }
8745}
8746#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8747pub struct WebhookTransactionalEmailSentRequestHeader {
8748    /// Unique message ID. Use to deduplicate deliveries.
8749    #[validate(length(min = 1u64))]
8750    pub webhook_id: String,
8751    /// Unix timestamp of when the message was sent.
8752    #[validate(length(min = 1u64))]
8753    pub webhook_timestamp: String,
8754    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8755    #[validate(length(min = 1u64))]
8756    pub webhook_signature: String,
8757}
8758impl core::convert::TryFrom<&WebhookTransactionalEmailSentRequestHeader> for http::HeaderMap {
8759    type Error = http::header::InvalidHeaderValue;
8760    fn try_from(
8761        headers: &WebhookTransactionalEmailSentRequestHeader,
8762    ) -> core::result::Result<Self, Self::Error> {
8763        let mut map = http::HeaderMap::with_capacity(3usize);
8764        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8765        map.insert(WEBHOOK_ID, header_value);
8766        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8767        map.insert(WEBHOOK_TIMESTAMP, header_value);
8768        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8769        map.insert(WEBHOOK_SIGNATURE, header_value);
8770        Ok(map)
8771    }
8772}
8773impl core::convert::TryFrom<WebhookTransactionalEmailSentRequestHeader> for http::HeaderMap {
8774    type Error = http::header::InvalidHeaderValue;
8775    fn try_from(
8776        headers: WebhookTransactionalEmailSentRequestHeader,
8777    ) -> core::result::Result<Self, Self::Error> {
8778        http::HeaderMap::try_from(&headers)
8779    }
8780}
8781/// Sent when a transactional email is sent to a contact. Contains a `transactionalId` value plus `contactIdentity` and `email` objects.
8782#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8783pub struct WebhookTransactionalEmailSentRequest {
8784    #[validate(nested)]
8785    pub header: WebhookTransactionalEmailSentRequestHeader,
8786    #[validate(nested)]
8787    pub body: WebhookTransactionalEmailSentPayload,
8788}
8789impl WebhookTransactionalEmailSentRequest {
8790    /// Parse the HTTP response into the response enum.
8791    pub async fn parse_response(
8792        req: reqwest::Response,
8793    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
8794        let status = req.status();
8795        if status == http::StatusCode::OK {
8796            let _ = req.bytes().await?;
8797            return Ok(WebhookEmailOpenedResponse::Ok);
8798        }
8799        let _ = req.bytes().await?;
8800        return Ok(WebhookEmailOpenedResponse::Unknown);
8801    }
8802}
8803#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8804pub struct WebhookCampaignEmailSentRequestHeader {
8805    /// Unique message ID. Use to deduplicate deliveries.
8806    #[validate(length(min = 1u64))]
8807    pub webhook_id: String,
8808    /// Unix timestamp of when the message was sent.
8809    #[validate(length(min = 1u64))]
8810    pub webhook_timestamp: String,
8811    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8812    #[validate(length(min = 1u64))]
8813    pub webhook_signature: String,
8814}
8815impl core::convert::TryFrom<&WebhookCampaignEmailSentRequestHeader> for http::HeaderMap {
8816    type Error = http::header::InvalidHeaderValue;
8817    fn try_from(
8818        headers: &WebhookCampaignEmailSentRequestHeader,
8819    ) -> core::result::Result<Self, Self::Error> {
8820        let mut map = http::HeaderMap::with_capacity(3usize);
8821        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8822        map.insert(WEBHOOK_ID, header_value);
8823        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8824        map.insert(WEBHOOK_TIMESTAMP, header_value);
8825        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8826        map.insert(WEBHOOK_SIGNATURE, header_value);
8827        Ok(map)
8828    }
8829}
8830impl core::convert::TryFrom<WebhookCampaignEmailSentRequestHeader> for http::HeaderMap {
8831    type Error = http::header::InvalidHeaderValue;
8832    fn try_from(
8833        headers: WebhookCampaignEmailSentRequestHeader,
8834    ) -> core::result::Result<Self, Self::Error> {
8835        http::HeaderMap::try_from(&headers)
8836    }
8837}
8838/// Sent when a campaign email is sent to a contact. This event fires for every campaign send (for example, sending to 1,000 contacts produces 1,000 events). Contains `campaignId` and `campaignName` plus `contactIdentity` and `email` objects. If the campaign was sent to one or more mailing lists, a `mailingLists` array is also included.
8839#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8840pub struct WebhookCampaignEmailSentRequest {
8841    #[validate(nested)]
8842    pub header: WebhookCampaignEmailSentRequestHeader,
8843    #[validate(nested)]
8844    pub body: WebhookCampaignEmailSentPayload,
8845}
8846impl WebhookCampaignEmailSentRequest {
8847    /// Parse the HTTP response into the response enum.
8848    pub async fn parse_response(
8849        req: reqwest::Response,
8850    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
8851        let status = req.status();
8852        if status == http::StatusCode::OK {
8853            let _ = req.bytes().await?;
8854            return Ok(WebhookEmailOpenedResponse::Ok);
8855        }
8856        let _ = req.bytes().await?;
8857        return Ok(WebhookEmailOpenedResponse::Unknown);
8858    }
8859}
8860#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8861pub struct WebhookLoopEmailSentRequestHeader {
8862    /// Unique message ID. Use to deduplicate deliveries.
8863    #[validate(length(min = 1u64))]
8864    pub webhook_id: String,
8865    /// Unix timestamp of when the message was sent.
8866    #[validate(length(min = 1u64))]
8867    pub webhook_timestamp: String,
8868    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8869    #[validate(length(min = 1u64))]
8870    pub webhook_signature: String,
8871}
8872impl core::convert::TryFrom<&WebhookLoopEmailSentRequestHeader> for http::HeaderMap {
8873    type Error = http::header::InvalidHeaderValue;
8874    fn try_from(
8875        headers: &WebhookLoopEmailSentRequestHeader,
8876    ) -> core::result::Result<Self, Self::Error> {
8877        let mut map = http::HeaderMap::with_capacity(3usize);
8878        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8879        map.insert(WEBHOOK_ID, header_value);
8880        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8881        map.insert(WEBHOOK_TIMESTAMP, header_value);
8882        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8883        map.insert(WEBHOOK_SIGNATURE, header_value);
8884        Ok(map)
8885    }
8886}
8887impl core::convert::TryFrom<WebhookLoopEmailSentRequestHeader> for http::HeaderMap {
8888    type Error = http::header::InvalidHeaderValue;
8889    fn try_from(
8890        headers: WebhookLoopEmailSentRequestHeader,
8891    ) -> core::result::Result<Self, Self::Error> {
8892        http::HeaderMap::try_from(&headers)
8893    }
8894}
8895/// Sent when a workflow email is sent to a contact. This event keeps its `loop` naming for compatibility (Loops was renamed to Workflows on May 6, 2026). This event fires for every contact in a workflow (for example, 1,000 recipients produces 1,000 events). Contains `loopId` and `loopName` plus `contactIdentity` and `email` objects. If the workflow was sent to one or more mailing lists, a `mailingLists` array is also included.
8896#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8897pub struct WebhookLoopEmailSentRequest {
8898    #[validate(nested)]
8899    pub header: WebhookLoopEmailSentRequestHeader,
8900    #[validate(nested)]
8901    pub body: WebhookLoopEmailSentPayload,
8902}
8903impl WebhookLoopEmailSentRequest {
8904    /// Parse the HTTP response into the response enum.
8905    pub async fn parse_response(
8906        req: reqwest::Response,
8907    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
8908        let status = req.status();
8909        if status == http::StatusCode::OK {
8910            let _ = req.bytes().await?;
8911            return Ok(WebhookEmailOpenedResponse::Ok);
8912        }
8913        let _ = req.bytes().await?;
8914        return Ok(WebhookEmailOpenedResponse::Unknown);
8915    }
8916}
8917#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8918pub struct WebhookEmailDeliveredRequestHeader {
8919    /// Unique message ID. Use to deduplicate deliveries.
8920    #[validate(length(min = 1u64))]
8921    pub webhook_id: String,
8922    /// Unix timestamp of when the message was sent.
8923    #[validate(length(min = 1u64))]
8924    pub webhook_timestamp: String,
8925    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8926    #[validate(length(min = 1u64))]
8927    pub webhook_signature: String,
8928}
8929impl core::convert::TryFrom<&WebhookEmailDeliveredRequestHeader> for http::HeaderMap {
8930    type Error = http::header::InvalidHeaderValue;
8931    fn try_from(
8932        headers: &WebhookEmailDeliveredRequestHeader,
8933    ) -> core::result::Result<Self, Self::Error> {
8934        let mut map = http::HeaderMap::with_capacity(3usize);
8935        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8936        map.insert(WEBHOOK_ID, header_value);
8937        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8938        map.insert(WEBHOOK_TIMESTAMP, header_value);
8939        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8940        map.insert(WEBHOOK_SIGNATURE, header_value);
8941        Ok(map)
8942    }
8943}
8944impl core::convert::TryFrom<WebhookEmailDeliveredRequestHeader> for http::HeaderMap {
8945    type Error = http::header::InvalidHeaderValue;
8946    fn try_from(
8947        headers: WebhookEmailDeliveredRequestHeader,
8948    ) -> core::result::Result<Self, Self::Error> {
8949        http::HeaderMap::try_from(&headers)
8950    }
8951}
8952/// Sent when an email is delivered to its recipient. Contains `sourceType` (`campaign`, `loop`, or `transactional`) and the related `campaignId`, `loopId` (workflow ID), or `transactionalId`, plus `contactIdentity` and `email` objects.
8953#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
8954pub struct WebhookEmailDeliveredRequest {
8955    #[validate(nested)]
8956    pub header: WebhookEmailDeliveredRequestHeader,
8957    #[validate(nested)]
8958    pub body: WebhookEmailDeliveredPayload,
8959}
8960impl WebhookEmailDeliveredRequest {
8961    /// Parse the HTTP response into the response enum.
8962    pub async fn parse_response(
8963        req: reqwest::Response,
8964    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
8965        let status = req.status();
8966        if status == http::StatusCode::OK {
8967            let _ = req.bytes().await?;
8968            return Ok(WebhookEmailOpenedResponse::Ok);
8969        }
8970        let _ = req.bytes().await?;
8971        return Ok(WebhookEmailOpenedResponse::Unknown);
8972    }
8973}
8974#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
8975pub struct WebhookEmailSoftBouncedRequestHeader {
8976    /// Unique message ID. Use to deduplicate deliveries.
8977    #[validate(length(min = 1u64))]
8978    pub webhook_id: String,
8979    /// Unix timestamp of when the message was sent.
8980    #[validate(length(min = 1u64))]
8981    pub webhook_timestamp: String,
8982    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
8983    #[validate(length(min = 1u64))]
8984    pub webhook_signature: String,
8985}
8986impl core::convert::TryFrom<&WebhookEmailSoftBouncedRequestHeader> for http::HeaderMap {
8987    type Error = http::header::InvalidHeaderValue;
8988    fn try_from(
8989        headers: &WebhookEmailSoftBouncedRequestHeader,
8990    ) -> core::result::Result<Self, Self::Error> {
8991        let mut map = http::HeaderMap::with_capacity(3usize);
8992        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
8993        map.insert(WEBHOOK_ID, header_value);
8994        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
8995        map.insert(WEBHOOK_TIMESTAMP, header_value);
8996        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
8997        map.insert(WEBHOOK_SIGNATURE, header_value);
8998        Ok(map)
8999    }
9000}
9001impl core::convert::TryFrom<WebhookEmailSoftBouncedRequestHeader> for http::HeaderMap {
9002    type Error = http::header::InvalidHeaderValue;
9003    fn try_from(
9004        headers: WebhookEmailSoftBouncedRequestHeader,
9005    ) -> core::result::Result<Self, Self::Error> {
9006        http::HeaderMap::try_from(&headers)
9007    }
9008}
9009/// Sent when an email soft bounces. Soft bounces are temporary delivery failures (for example, a connection timing out). Soft bounces are retried multiple times and the email may still be delivered. Contains `sourceType` and the related `campaignId`, `loopId` (workflow ID), or `transactionalId`, plus `contactIdentity` and `email` objects.
9010#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
9011pub struct WebhookEmailSoftBouncedRequest {
9012    #[validate(nested)]
9013    pub header: WebhookEmailSoftBouncedRequestHeader,
9014    #[validate(nested)]
9015    pub body: WebhookEmailSoftBouncedPayload,
9016}
9017impl WebhookEmailSoftBouncedRequest {
9018    /// Parse the HTTP response into the response enum.
9019    pub async fn parse_response(
9020        req: reqwest::Response,
9021    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
9022        let status = req.status();
9023        if status == http::StatusCode::OK {
9024            let _ = req.bytes().await?;
9025            return Ok(WebhookEmailOpenedResponse::Ok);
9026        }
9027        let _ = req.bytes().await?;
9028        return Ok(WebhookEmailOpenedResponse::Unknown);
9029    }
9030}
9031#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
9032pub struct WebhookEmailHardBouncedRequestHeader {
9033    /// Unique message ID. Use to deduplicate deliveries.
9034    #[validate(length(min = 1u64))]
9035    pub webhook_id: String,
9036    /// Unix timestamp of when the message was sent.
9037    #[validate(length(min = 1u64))]
9038    pub webhook_timestamp: String,
9039    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
9040    #[validate(length(min = 1u64))]
9041    pub webhook_signature: String,
9042}
9043impl core::convert::TryFrom<&WebhookEmailHardBouncedRequestHeader> for http::HeaderMap {
9044    type Error = http::header::InvalidHeaderValue;
9045    fn try_from(
9046        headers: &WebhookEmailHardBouncedRequestHeader,
9047    ) -> core::result::Result<Self, Self::Error> {
9048        let mut map = http::HeaderMap::with_capacity(3usize);
9049        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
9050        map.insert(WEBHOOK_ID, header_value);
9051        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
9052        map.insert(WEBHOOK_TIMESTAMP, header_value);
9053        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
9054        map.insert(WEBHOOK_SIGNATURE, header_value);
9055        Ok(map)
9056    }
9057}
9058impl core::convert::TryFrom<WebhookEmailHardBouncedRequestHeader> for http::HeaderMap {
9059    type Error = http::header::InvalidHeaderValue;
9060    fn try_from(
9061        headers: WebhookEmailHardBouncedRequestHeader,
9062    ) -> core::result::Result<Self, Self::Error> {
9063        http::HeaderMap::try_from(&headers)
9064    }
9065}
9066/// Sent when an email hard bounces. Hard bounces are persistent delivery failures (for example, a mailbox that does not exist); the email will not be delivered. In Loops, a hard bounce also unsubscribes the contact from your audience, so a `contact.unsubscribed` event will also be sent. Contains `sourceType` and the related `campaignId`, `loopId` (workflow ID), or `transactionalId`, plus `contactIdentity` and `email` objects.
9067#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
9068pub struct WebhookEmailHardBouncedRequest {
9069    #[validate(nested)]
9070    pub header: WebhookEmailHardBouncedRequestHeader,
9071    #[validate(nested)]
9072    pub body: WebhookEmailHardBouncedPayload,
9073}
9074impl WebhookEmailHardBouncedRequest {
9075    /// Parse the HTTP response into the response enum.
9076    pub async fn parse_response(
9077        req: reqwest::Response,
9078    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
9079        let status = req.status();
9080        if status == http::StatusCode::OK {
9081            let _ = req.bytes().await?;
9082            return Ok(WebhookEmailOpenedResponse::Ok);
9083        }
9084        let _ = req.bytes().await?;
9085        return Ok(WebhookEmailOpenedResponse::Unknown);
9086    }
9087}
9088#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
9089pub struct WebhookEmailClickedRequestHeader {
9090    /// Unique message ID. Use to deduplicate deliveries.
9091    #[validate(length(min = 1u64))]
9092    pub webhook_id: String,
9093    /// Unix timestamp of when the message was sent.
9094    #[validate(length(min = 1u64))]
9095    pub webhook_timestamp: String,
9096    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
9097    #[validate(length(min = 1u64))]
9098    pub webhook_signature: String,
9099}
9100impl core::convert::TryFrom<&WebhookEmailClickedRequestHeader> for http::HeaderMap {
9101    type Error = http::header::InvalidHeaderValue;
9102    fn try_from(
9103        headers: &WebhookEmailClickedRequestHeader,
9104    ) -> core::result::Result<Self, Self::Error> {
9105        let mut map = http::HeaderMap::with_capacity(3usize);
9106        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
9107        map.insert(WEBHOOK_ID, header_value);
9108        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
9109        map.insert(WEBHOOK_TIMESTAMP, header_value);
9110        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
9111        map.insert(WEBHOOK_SIGNATURE, header_value);
9112        Ok(map)
9113    }
9114}
9115impl core::convert::TryFrom<WebhookEmailClickedRequestHeader> for http::HeaderMap {
9116    type Error = http::header::InvalidHeaderValue;
9117    fn try_from(
9118        headers: WebhookEmailClickedRequestHeader,
9119    ) -> core::result::Result<Self, Self::Error> {
9120        http::HeaderMap::try_from(&headers)
9121    }
9122}
9123/// Sent when a link in a campaign or workflow email is clicked. Not available for transactional emails because link clicks are not tracked for transactional emails. Contains `sourceType` and the related `campaignId` or `loopId` (workflow ID), plus `contactIdentity` and `email` objects.
9124#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
9125pub struct WebhookEmailClickedRequest {
9126    #[validate(nested)]
9127    pub header: WebhookEmailClickedRequestHeader,
9128    #[validate(nested)]
9129    pub body: WebhookEmailClickedPayload,
9130}
9131impl WebhookEmailClickedRequest {
9132    /// Parse the HTTP response into the response enum.
9133    pub async fn parse_response(
9134        req: reqwest::Response,
9135    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
9136        let status = req.status();
9137        if status == http::StatusCode::OK {
9138            let _ = req.bytes().await?;
9139            return Ok(WebhookEmailOpenedResponse::Ok);
9140        }
9141        let _ = req.bytes().await?;
9142        return Ok(WebhookEmailOpenedResponse::Unknown);
9143    }
9144}
9145#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
9146pub struct WebhookEmailUnsubscribedRequestHeader {
9147    /// Unique message ID. Use to deduplicate deliveries.
9148    #[validate(length(min = 1u64))]
9149    pub webhook_id: String,
9150    /// Unix timestamp of when the message was sent.
9151    #[validate(length(min = 1u64))]
9152    pub webhook_timestamp: String,
9153    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
9154    #[validate(length(min = 1u64))]
9155    pub webhook_signature: String,
9156}
9157impl core::convert::TryFrom<&WebhookEmailUnsubscribedRequestHeader> for http::HeaderMap {
9158    type Error = http::header::InvalidHeaderValue;
9159    fn try_from(
9160        headers: &WebhookEmailUnsubscribedRequestHeader,
9161    ) -> core::result::Result<Self, Self::Error> {
9162        let mut map = http::HeaderMap::with_capacity(3usize);
9163        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
9164        map.insert(WEBHOOK_ID, header_value);
9165        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
9166        map.insert(WEBHOOK_TIMESTAMP, header_value);
9167        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
9168        map.insert(WEBHOOK_SIGNATURE, header_value);
9169        Ok(map)
9170    }
9171}
9172impl core::convert::TryFrom<WebhookEmailUnsubscribedRequestHeader> for http::HeaderMap {
9173    type Error = http::header::InvalidHeaderValue;
9174    fn try_from(
9175        headers: WebhookEmailUnsubscribedRequestHeader,
9176    ) -> core::result::Result<Self, Self::Error> {
9177        http::HeaderMap::try_from(&headers)
9178    }
9179}
9180/// Sent when a recipient unsubscribes from marketing email or a mailing list using an email's "Unsubscribe" link. A `contact.unsubscribed` or `contact.mailingList.unsubscribed` event will also be sent depending on whether the email was sent to a mailing list. Not available for transactional emails because unsubscribe links are not included for transactional emails. Contains `sourceType` and the related `campaignId` or `loopId` (workflow ID), plus `contactIdentity` and `email` objects.
9181#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
9182pub struct WebhookEmailUnsubscribedRequest {
9183    #[validate(nested)]
9184    pub header: WebhookEmailUnsubscribedRequestHeader,
9185    #[validate(nested)]
9186    pub body: WebhookEmailUnsubscribedPayload,
9187}
9188impl WebhookEmailUnsubscribedRequest {
9189    /// Parse the HTTP response into the response enum.
9190    pub async fn parse_response(
9191        req: reqwest::Response,
9192    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
9193        let status = req.status();
9194        if status == http::StatusCode::OK {
9195            let _ = req.bytes().await?;
9196            return Ok(WebhookEmailOpenedResponse::Ok);
9197        }
9198        let _ = req.bytes().await?;
9199        return Ok(WebhookEmailOpenedResponse::Unknown);
9200    }
9201}
9202#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
9203pub struct WebhookEmailResubscribedRequestHeader {
9204    /// Unique message ID. Use to deduplicate deliveries.
9205    #[validate(length(min = 1u64))]
9206    pub webhook_id: String,
9207    /// Unix timestamp of when the message was sent.
9208    #[validate(length(min = 1u64))]
9209    pub webhook_timestamp: String,
9210    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
9211    #[validate(length(min = 1u64))]
9212    pub webhook_signature: String,
9213}
9214impl core::convert::TryFrom<&WebhookEmailResubscribedRequestHeader> for http::HeaderMap {
9215    type Error = http::header::InvalidHeaderValue;
9216    fn try_from(
9217        headers: &WebhookEmailResubscribedRequestHeader,
9218    ) -> core::result::Result<Self, Self::Error> {
9219        let mut map = http::HeaderMap::with_capacity(3usize);
9220        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
9221        map.insert(WEBHOOK_ID, header_value);
9222        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
9223        map.insert(WEBHOOK_TIMESTAMP, header_value);
9224        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
9225        map.insert(WEBHOOK_SIGNATURE, header_value);
9226        Ok(map)
9227    }
9228}
9229impl core::convert::TryFrom<WebhookEmailResubscribedRequestHeader> for http::HeaderMap {
9230    type Error = http::header::InvalidHeaderValue;
9231    fn try_from(
9232        headers: WebhookEmailResubscribedRequestHeader,
9233    ) -> core::result::Result<Self, Self::Error> {
9234        http::HeaderMap::try_from(&headers)
9235    }
9236}
9237/// Sent when a recipient resubscribes to marketing email from an email's preference center ("Unsubscribe" link). Not available for transactional emails because unsubscribe links are not included for transactional emails. Contains `sourceType` and the related `campaignId` or `loopId` (workflow ID), plus `contactIdentity` and `email` objects.
9238#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
9239pub struct WebhookEmailResubscribedRequest {
9240    #[validate(nested)]
9241    pub header: WebhookEmailResubscribedRequestHeader,
9242    #[validate(nested)]
9243    pub body: WebhookEmailResubscribedPayload,
9244}
9245impl WebhookEmailResubscribedRequest {
9246    /// Parse the HTTP response into the response enum.
9247    pub async fn parse_response(
9248        req: reqwest::Response,
9249    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
9250        let status = req.status();
9251        if status == http::StatusCode::OK {
9252            let _ = req.bytes().await?;
9253            return Ok(WebhookEmailOpenedResponse::Ok);
9254        }
9255        let _ = req.bytes().await?;
9256        return Ok(WebhookEmailOpenedResponse::Unknown);
9257    }
9258}
9259#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
9260pub struct WebhookEmailOpenedRequestHeader {
9261    /// Unique message ID. Use to deduplicate deliveries.
9262    #[validate(length(min = 1u64))]
9263    pub webhook_id: String,
9264    /// Unix timestamp of when the message was sent.
9265    #[validate(length(min = 1u64))]
9266    pub webhook_timestamp: String,
9267    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
9268    #[validate(length(min = 1u64))]
9269    pub webhook_signature: String,
9270}
9271impl core::convert::TryFrom<&WebhookEmailOpenedRequestHeader> for http::HeaderMap {
9272    type Error = http::header::InvalidHeaderValue;
9273    fn try_from(
9274        headers: &WebhookEmailOpenedRequestHeader,
9275    ) -> core::result::Result<Self, Self::Error> {
9276        let mut map = http::HeaderMap::with_capacity(3usize);
9277        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
9278        map.insert(WEBHOOK_ID, header_value);
9279        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
9280        map.insert(WEBHOOK_TIMESTAMP, header_value);
9281        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
9282        map.insert(WEBHOOK_SIGNATURE, header_value);
9283        Ok(map)
9284    }
9285}
9286impl core::convert::TryFrom<WebhookEmailOpenedRequestHeader> for http::HeaderMap {
9287    type Error = http::header::InvalidHeaderValue;
9288    fn try_from(
9289        headers: WebhookEmailOpenedRequestHeader,
9290    ) -> core::result::Result<Self, Self::Error> {
9291        http::HeaderMap::try_from(&headers)
9292    }
9293}
9294/// Sent when a campaign or workflow email is opened. Not available for transactional emails because email opens are not tracked for transactional emails. Contains `sourceType` and the related `campaignId` or `loopId` (workflow ID), plus `contactIdentity` and `email` objects.
9295#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
9296pub struct WebhookEmailOpenedRequest {
9297    #[validate(nested)]
9298    pub header: WebhookEmailOpenedRequestHeader,
9299    #[validate(nested)]
9300    pub body: WebhookEmailOpenedPayload,
9301}
9302impl WebhookEmailOpenedRequest {
9303    /// Parse the HTTP response into the response enum.
9304    pub async fn parse_response(
9305        req: reqwest::Response,
9306    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
9307        let status = req.status();
9308        if status == http::StatusCode::OK {
9309            let _ = req.bytes().await?;
9310            return Ok(WebhookEmailOpenedResponse::Ok);
9311        }
9312        let _ = req.bytes().await?;
9313        return Ok(WebhookEmailOpenedResponse::Unknown);
9314    }
9315}
9316/// Response types for webhookEmailOpened
9317#[derive(Debug, Clone)]
9318pub enum WebhookEmailOpenedResponse {
9319    ///200: Webhook received successfully. Return any 2xx status code to acknowledge delivery.
9320    Ok,
9321    ///default: Unknown response
9322    Unknown,
9323}
9324#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
9325pub struct WebhookEmailSpamReportedRequestHeader {
9326    /// Unique message ID. Use to deduplicate deliveries.
9327    #[validate(length(min = 1u64))]
9328    pub webhook_id: String,
9329    /// Unix timestamp of when the message was sent.
9330    #[validate(length(min = 1u64))]
9331    pub webhook_timestamp: String,
9332    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
9333    #[validate(length(min = 1u64))]
9334    pub webhook_signature: String,
9335}
9336impl core::convert::TryFrom<&WebhookEmailSpamReportedRequestHeader> for http::HeaderMap {
9337    type Error = http::header::InvalidHeaderValue;
9338    fn try_from(
9339        headers: &WebhookEmailSpamReportedRequestHeader,
9340    ) -> core::result::Result<Self, Self::Error> {
9341        let mut map = http::HeaderMap::with_capacity(3usize);
9342        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
9343        map.insert(WEBHOOK_ID, header_value);
9344        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
9345        map.insert(WEBHOOK_TIMESTAMP, header_value);
9346        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
9347        map.insert(WEBHOOK_SIGNATURE, header_value);
9348        Ok(map)
9349    }
9350}
9351impl core::convert::TryFrom<WebhookEmailSpamReportedRequestHeader> for http::HeaderMap {
9352    type Error = http::header::InvalidHeaderValue;
9353    fn try_from(
9354        headers: WebhookEmailSpamReportedRequestHeader,
9355    ) -> core::result::Result<Self, Self::Error> {
9356        http::HeaderMap::try_from(&headers)
9357    }
9358}
9359/// Sent when a recipient reports your email as spam. Contains `sourceType` and the related `campaignId`, `loopId` (workflow ID), or `transactionalId`, plus `contactIdentity` and `email` objects.
9360#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
9361pub struct WebhookEmailSpamReportedRequest {
9362    #[validate(nested)]
9363    pub header: WebhookEmailSpamReportedRequestHeader,
9364    #[validate(nested)]
9365    pub body: WebhookEmailSpamReportedPayload,
9366}
9367impl WebhookEmailSpamReportedRequest {
9368    /// Parse the HTTP response into the response enum.
9369    pub async fn parse_response(
9370        req: reqwest::Response,
9371    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
9372        let status = req.status();
9373        if status == http::StatusCode::OK {
9374            let _ = req.bytes().await?;
9375            return Ok(WebhookEmailOpenedResponse::Ok);
9376        }
9377        let _ = req.bytes().await?;
9378        return Ok(WebhookEmailOpenedResponse::Unknown);
9379    }
9380}
9381#[derive(Debug, Clone, PartialEq, validator::Validate, oas3_gen_support::Default)]
9382pub struct WebhookTestingTestEventRequestHeader {
9383    /// Unique message ID. Use to deduplicate deliveries.
9384    #[validate(length(min = 1u64))]
9385    pub webhook_id: String,
9386    /// Unix timestamp of when the message was sent.
9387    #[validate(length(min = 1u64))]
9388    pub webhook_timestamp: String,
9389    /// HMAC signature for verifying the request. Verify using your endpoint signing secret from the Loops dashboard.
9390    #[validate(length(min = 1u64))]
9391    pub webhook_signature: String,
9392}
9393impl core::convert::TryFrom<&WebhookTestingTestEventRequestHeader> for http::HeaderMap {
9394    type Error = http::header::InvalidHeaderValue;
9395    fn try_from(
9396        headers: &WebhookTestingTestEventRequestHeader,
9397    ) -> core::result::Result<Self, Self::Error> {
9398        let mut map = http::HeaderMap::with_capacity(3usize);
9399        let header_value = http::HeaderValue::try_from(&headers.webhook_id)?;
9400        map.insert(WEBHOOK_ID, header_value);
9401        let header_value = http::HeaderValue::try_from(&headers.webhook_timestamp)?;
9402        map.insert(WEBHOOK_TIMESTAMP, header_value);
9403        let header_value = http::HeaderValue::try_from(&headers.webhook_signature)?;
9404        map.insert(WEBHOOK_SIGNATURE, header_value);
9405        Ok(map)
9406    }
9407}
9408impl core::convert::TryFrom<WebhookTestingTestEventRequestHeader> for http::HeaderMap {
9409    type Error = http::header::InvalidHeaderValue;
9410    fn try_from(
9411        headers: WebhookTestingTestEventRequestHeader,
9412    ) -> core::result::Result<Self, Self::Error> {
9413        http::HeaderMap::try_from(&headers)
9414    }
9415}
9416/// Test event that can be triggered from the Webhooks settings page in Loops. Use this to verify that your endpoint is working and that your signature verification code is correct. The payload contains `eventName`, `eventTime`, `message` (always `"test"`), and `webhookSchemaVersion`.
9417#[derive(Debug, Clone, validator::Validate, oas3_gen_support::Default)]
9418pub struct WebhookTestingTestEventRequest {
9419    #[validate(nested)]
9420    pub header: WebhookTestingTestEventRequestHeader,
9421    pub body: WebhookTestingTestEventPayload,
9422}
9423impl WebhookTestingTestEventRequest {
9424    /// Parse the HTTP response into the response enum.
9425    pub async fn parse_response(
9426        req: reqwest::Response,
9427    ) -> anyhow::Result<WebhookEmailOpenedResponse> {
9428        let status = req.status();
9429        if status == http::StatusCode::OK {
9430            let _ = req.bytes().await?;
9431            return Ok(WebhookEmailOpenedResponse::Ok);
9432        }
9433        let _ = req.bytes().await?;
9434        return Ok(WebhookEmailOpenedResponse::Unknown);
9435    }
9436}
9437#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
9438pub struct ContactSuppressionStatusResponseContact {
9439    /// The contact's Loops ID.
9440    pub id: String,
9441    /// The contact's email address.
9442    pub email: String,
9443    /// The contact's unique user ID.
9444    #[serde(rename = "userId")]
9445    pub user_id: Option<String>,
9446}
9447/// The type of property.
9448#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9449pub enum ContactPropertyCreateRequestType {
9450    #[serde(rename = "string")]
9451    #[default]
9452    String,
9453    #[serde(rename = "number")]
9454    Number,
9455    #[serde(rename = "boolean")]
9456    Boolean,
9457    #[serde(rename = "date")]
9458    Date,
9459}
9460impl core::fmt::Display for ContactPropertyCreateRequestType {
9461    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9462        match self {
9463            Self::String => write!(f, "string"),
9464            Self::Number => write!(f, "number"),
9465            Self::Boolean => write!(f, "boolean"),
9466            Self::Date => write!(f, "date"),
9467        }
9468    }
9469}
9470#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
9471pub struct TransactionalRequestAttachment {
9472    /// The name of the file, shown in email clients.
9473    #[validate(length(min = 1u64))]
9474    pub filename: String,
9475    /// The MIME type of the file.
9476    #[serde(rename = "contentType")]
9477    #[validate(length(min = 1u64))]
9478    pub content_type: String,
9479    /// The base64-encoded content of the file.
9480    #[validate(length(min = 1u64))]
9481    pub data: String,
9482}
9483#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
9484pub struct ResponseError {
9485    pub path: Option<String>,
9486    pub message: Option<String>,
9487}
9488#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
9489pub struct TransactionalFailure4ResponseError {
9490    pub path: Option<String>,
9491    pub reason: Option<String>,
9492}
9493#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9494pub enum Match {
9495    #[serde(rename = "all")]
9496    #[default]
9497    All,
9498    #[serde(rename = "any")]
9499    Any,
9500}
9501impl core::fmt::Display for Match {
9502    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9503        match self {
9504            Self::All => write!(f, "all"),
9505            Self::Any => write!(f, "any"),
9506        }
9507    }
9508}
9509/// A tree of audience conditions combined with `match`.
9510#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
9511pub struct CreateAudienceSegmentRequestFilter {
9512    #[serde(rename = "match")]
9513    pub r#match: Match,
9514    #[validate(length(min = 1u64))]
9515    pub conditions: Vec<AudienceFilterCondition>,
9516}
9517#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9518pub enum Method {
9519    #[serde(rename = "now")]
9520    #[default]
9521    Now,
9522    #[serde(rename = "schedule")]
9523    Schedule,
9524}
9525impl core::fmt::Display for Method {
9526    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9527        match self {
9528            Self::Now => write!(f, "now"),
9529            Self::Schedule => write!(f, "schedule"),
9530        }
9531    }
9532}
9533#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9534pub enum PropertyConditionOperator {
9535    #[serde(rename = "any")]
9536    #[default]
9537    Any,
9538    #[serde(rename = "contains")]
9539    Contains,
9540    #[serde(rename = "notContains")]
9541    NotContains,
9542    #[serde(rename = "equals")]
9543    Equals,
9544    #[serde(rename = "notEquals")]
9545    NotEquals,
9546    #[serde(rename = "greaterThan")]
9547    GreaterThan,
9548    #[serde(rename = "lessThan")]
9549    LessThan,
9550    #[serde(rename = "isTrue")]
9551    IsTrue,
9552    #[serde(rename = "isFalse")]
9553    IsFalse,
9554    #[serde(rename = "empty")]
9555    Empty,
9556    #[serde(rename = "notEmpty")]
9557    NotEmpty,
9558    #[serde(rename = "dateEmpty")]
9559    DateEmpty,
9560    #[serde(rename = "dateNotEmpty")]
9561    DateNotEmpty,
9562    #[serde(rename = "after")]
9563    After,
9564    #[serde(rename = "before")]
9565    Before,
9566    #[serde(rename = "between")]
9567    Between,
9568}
9569impl core::fmt::Display for PropertyConditionOperator {
9570    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9571        match self {
9572            Self::Any => write!(f, "any"),
9573            Self::Contains => write!(f, "contains"),
9574            Self::NotContains => write!(f, "notContains"),
9575            Self::Equals => write!(f, "equals"),
9576            Self::NotEquals => write!(f, "notEquals"),
9577            Self::GreaterThan => write!(f, "greaterThan"),
9578            Self::LessThan => write!(f, "lessThan"),
9579            Self::IsTrue => write!(f, "isTrue"),
9580            Self::IsFalse => write!(f, "isFalse"),
9581            Self::Empty => write!(f, "empty"),
9582            Self::NotEmpty => write!(f, "notEmpty"),
9583            Self::DateEmpty => write!(f, "dateEmpty"),
9584            Self::DateNotEmpty => write!(f, "dateNotEmpty"),
9585            Self::After => write!(f, "after"),
9586            Self::Before => write!(f, "before"),
9587            Self::Between => write!(f, "between"),
9588        }
9589    }
9590}
9591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
9592pub struct PropertyConditionValueDateRange {
9593    pub from: chrono::DateTime<chrono::Utc>,
9594    pub to: chrono::DateTime<chrono::Utc>,
9595}
9596/// The comparison value. Omitted for value-less operators (e.g. `isTrue`, `empty`). A `{ from, to }` object for `between`.
9597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
9598#[serde(untagged)]
9599pub enum PropertyConditionValue {
9600    #[default]
9601    String(String),
9602    Number(f64),
9603    DateRange(PropertyConditionValueDateRange),
9604}
9605#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9606pub enum ActivityConditionAction {
9607    #[serde(rename = "sent")]
9608    #[default]
9609    Sent,
9610    #[serde(rename = "opened")]
9611    Opened,
9612    #[serde(rename = "clicked")]
9613    Clicked,
9614}
9615impl core::fmt::Display for ActivityConditionAction {
9616    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9617        match self {
9618            Self::Sent => write!(f, "sent"),
9619            Self::Opened => write!(f, "opened"),
9620            Self::Clicked => write!(f, "clicked"),
9621        }
9622    }
9623}
9624#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9625pub enum ActivityConditionTarget {
9626    #[serde(rename = "campaign")]
9627    #[default]
9628    Campaign,
9629    #[serde(rename = "workflow")]
9630    Workflow,
9631    #[serde(rename = "workflowEmail")]
9632    WorkflowEmail,
9633}
9634impl core::fmt::Display for ActivityConditionTarget {
9635    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9636        match self {
9637            Self::Campaign => write!(f, "campaign"),
9638            Self::Workflow => write!(f, "workflow"),
9639            Self::WorkflowEmail => write!(f, "workflowEmail"),
9640        }
9641    }
9642}
9643/// The status of the campaign.
9644#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
9645pub enum Status2 {
9646    #[default]
9647    Draft,
9648    Scheduled,
9649    Sending,
9650    Sent,
9651}
9652impl core::fmt::Display for Status2 {
9653    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9654        match self {
9655            Self::Draft => write!(f, "Draft"),
9656            Self::Scheduled => write!(f, "Scheduled"),
9657            Self::Sending => write!(f, "Sending"),
9658            Self::Sent => write!(f, "Sent"),
9659        }
9660    }
9661}
9662#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
9663pub enum SimplifiedWorkflowStatus {
9664    #[default]
9665    Draft,
9666    Sending,
9667    Paused,
9668    PausedAndQueueing,
9669}
9670impl core::fmt::Display for SimplifiedWorkflowStatus {
9671    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9672        match self {
9673            Self::Draft => write!(f, "Draft"),
9674            Self::Sending => write!(f, "Sending"),
9675            Self::Paused => write!(f, "Paused"),
9676            Self::PausedAndQueueing => write!(f, "PausedAndQueueing"),
9677        }
9678    }
9679}
9680#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
9681pub struct CreateWorkflowNodeBeforeRequestTargetNode {
9682    #[serde(rename = "toNodeId")]
9683    #[validate(length(min = 1u64))]
9684    pub to_node_id: String,
9685}
9686#[derive(Debug, Clone, PartialEq, Serialize, validator::Validate, oas3_gen_support::Default)]
9687pub struct CreateWorkflowNodeBeforeRequestTargetNodeDeprecated {
9688    #[deprecated]
9689    #[serde(rename = "beforeNodeId")]
9690    #[validate(length(min = 1u64))]
9691    pub before_node_id: String,
9692}
9693#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
9694pub enum PreviewStatus {
9695    #[serde(rename = "dryRun")]
9696    #[default]
9697    DryRun,
9698    #[serde(rename = "queuedContactsFound")]
9699    QueuedContactsFound,
9700}
9701impl core::fmt::Display for PreviewStatus {
9702    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9703        match self {
9704            Self::DryRun => write!(f, "dryRun"),
9705            Self::QueuedContactsFound => write!(f, "queuedContactsFound"),
9706        }
9707    }
9708}
9709#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
9710pub struct ListEventPatternsResponsePagination {
9711    #[serde(rename = "totalResults")]
9712    pub total_results: Option<f64>,
9713    #[serde(rename = "returnedResults")]
9714    pub returned_results: Option<f64>,
9715    #[serde(rename = "perPage")]
9716    pub per_page: Option<f64>,
9717    #[serde(rename = "totalPages")]
9718    pub total_pages: Option<f64>,
9719    #[serde(rename = "nextCursor")]
9720    pub next_cursor: Option<String>,
9721    #[serde(rename = "nextPage")]
9722    pub next_page: Option<String>,
9723}
9724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, oas3_gen_support::Default)]
9725#[serde(untagged)]
9726pub enum WorkflowContactPropertyComparisonValue {
9727    #[default]
9728    String(String),
9729    Number(f64),
9730    Boolean(bool),
9731}
9732/// The comparison operator. It must be valid for the selected contact property's type and for the `is` or `was` side of the comparison. Number and boolean properties allow `empty` on `was`, but not on `is`.
9733#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9734pub enum WorkflowContactPropertyComparisonOperator {
9735    #[serde(rename = "any")]
9736    #[default]
9737    Any,
9738    #[serde(rename = "contains")]
9739    Contains,
9740    #[serde(rename = "not_contains")]
9741    NotContains,
9742    #[serde(rename = "empty")]
9743    Empty,
9744    #[serde(rename = "not_empty")]
9745    NotEmpty,
9746    #[serde(rename = "equal")]
9747    Equal,
9748    #[serde(rename = "not_equal")]
9749    NotEqual,
9750    #[serde(rename = "greater_than")]
9751    GreaterThan,
9752    #[serde(rename = "less_than")]
9753    LessThan,
9754    #[serde(rename = "true")]
9755    True,
9756    #[serde(rename = "false")]
9757    False,
9758    #[serde(rename = "numeric_equal")]
9759    NumericEqual,
9760    #[serde(rename = "numeric_not_equal")]
9761    NumericNotEqual,
9762    #[serde(rename = "after")]
9763    After,
9764    #[serde(rename = "before")]
9765    Before,
9766    #[serde(rename = "between")]
9767    Between,
9768}
9769impl core::fmt::Display for WorkflowContactPropertyComparisonOperator {
9770    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9771        match self {
9772            Self::Any => write!(f, "any"),
9773            Self::Contains => write!(f, "contains"),
9774            Self::NotContains => write!(f, "not_contains"),
9775            Self::Empty => write!(f, "empty"),
9776            Self::NotEmpty => write!(f, "not_empty"),
9777            Self::Equal => write!(f, "equal"),
9778            Self::NotEqual => write!(f, "not_equal"),
9779            Self::GreaterThan => write!(f, "greater_than"),
9780            Self::LessThan => write!(f, "less_than"),
9781            Self::True => write!(f, "true"),
9782            Self::False => write!(f, "false"),
9783            Self::NumericEqual => write!(f, "numeric_equal"),
9784            Self::NumericNotEqual => write!(f, "numeric_not_equal"),
9785            Self::After => write!(f, "after"),
9786            Self::Before => write!(f, "before"),
9787            Self::Between => write!(f, "between"),
9788        }
9789    }
9790}
9791/// The rendering format of the email.
9792#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9793pub enum EmailFormat {
9794    #[serde(rename = "styled")]
9795    #[default]
9796    Styled,
9797    #[serde(rename = "plain")]
9798    Plain,
9799}
9800impl core::fmt::Display for EmailFormat {
9801    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9802        match self {
9803            Self::Styled => write!(f, "styled"),
9804            Self::Plain => write!(f, "plain"),
9805        }
9806    }
9807}
9808#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
9809#[serde(default)]
9810pub struct EmailMessageResponseWarning {
9811    pub rule: String,
9812    #[default("warning".to_string())]
9813    pub severity: String,
9814    pub message: String,
9815    pub path: Option<String>,
9816}
9817/// The identifier of the Guardian rule that fired.
9818#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, oas3_gen_support::Default)]
9819pub enum GuardianRuleRule {
9820    #[serde(rename = "unsupportedContactProperties")]
9821    #[default]
9822    UnsupportedContactProperties,
9823    #[serde(rename = "missingFallbackContactProperties")]
9824    MissingFallbackContactProperties,
9825    #[serde(rename = "unsupportedEventProperties")]
9826    UnsupportedEventProperties,
9827    #[serde(rename = "missingFallbackEventProperties")]
9828    MissingFallbackEventProperties,
9829    #[serde(rename = "unsupportedDataVariables")]
9830    UnsupportedDataVariables,
9831    #[serde(rename = "invalidCustomDataVariables")]
9832    InvalidCustomDataVariables,
9833    #[serde(rename = "missingRequiredDataVariables")]
9834    MissingRequiredDataVariables,
9835    #[serde(rename = "missingButtonHrefs")]
9836    MissingButtonHrefs,
9837    #[serde(rename = "invalidButtonHrefs")]
9838    InvalidButtonHrefs,
9839    #[serde(rename = "shortenedYouTubeButtonHrefs")]
9840    ShortenedYouTubeButtonHrefs,
9841    #[serde(rename = "missingLinkHrefs")]
9842    MissingLinkHrefs,
9843    #[serde(rename = "invalidLinkHrefs")]
9844    InvalidLinkHrefs,
9845    #[serde(rename = "shortenedYouTubeLinkHrefs")]
9846    ShortenedYouTubeLinkHrefs,
9847    #[serde(rename = "shortenedYouTubeImageHrefs")]
9848    ShortenedYouTubeImageHrefs,
9849    #[serde(rename = "emailWithoutMailtoButtonHrefs")]
9850    EmailWithoutMailtoButtonHrefs,
9851    #[serde(rename = "emailWithoutMailtoLinkHrefs")]
9852    EmailWithoutMailtoLinkHrefs,
9853    #[serde(rename = "emailWithoutMailtoImageHrefs")]
9854    EmailWithoutMailtoImageHrefs,
9855    #[serde(rename = "bareArrayNodes")]
9856    BareArrayNodes,
9857    #[serde(rename = "missingSocialIconHrefs")]
9858    MissingSocialIconHrefs,
9859}
9860impl core::fmt::Display for GuardianRuleRule {
9861    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9862        match self {
9863            Self::UnsupportedContactProperties => {
9864                write!(f, "unsupportedContactProperties")
9865            }
9866            Self::MissingFallbackContactProperties => {
9867                write!(f, "missingFallbackContactProperties")
9868            }
9869            Self::UnsupportedEventProperties => write!(f, "unsupportedEventProperties"),
9870            Self::MissingFallbackEventProperties => {
9871                write!(f, "missingFallbackEventProperties")
9872            }
9873            Self::UnsupportedDataVariables => write!(f, "unsupportedDataVariables"),
9874            Self::InvalidCustomDataVariables => write!(f, "invalidCustomDataVariables"),
9875            Self::MissingRequiredDataVariables => {
9876                write!(f, "missingRequiredDataVariables")
9877            }
9878            Self::MissingButtonHrefs => write!(f, "missingButtonHrefs"),
9879            Self::InvalidButtonHrefs => write!(f, "invalidButtonHrefs"),
9880            Self::ShortenedYouTubeButtonHrefs => write!(f, "shortenedYouTubeButtonHrefs"),
9881            Self::MissingLinkHrefs => write!(f, "missingLinkHrefs"),
9882            Self::InvalidLinkHrefs => write!(f, "invalidLinkHrefs"),
9883            Self::ShortenedYouTubeLinkHrefs => write!(f, "shortenedYouTubeLinkHrefs"),
9884            Self::ShortenedYouTubeImageHrefs => write!(f, "shortenedYouTubeImageHrefs"),
9885            Self::EmailWithoutMailtoButtonHrefs => {
9886                write!(f, "emailWithoutMailtoButtonHrefs")
9887            }
9888            Self::EmailWithoutMailtoLinkHrefs => write!(f, "emailWithoutMailtoLinkHrefs"),
9889            Self::EmailWithoutMailtoImageHrefs => {
9890                write!(f, "emailWithoutMailtoImageHrefs")
9891            }
9892            Self::BareArrayNodes => write!(f, "bareArrayNodes"),
9893            Self::MissingSocialIconHrefs => write!(f, "missingSocialIconHrefs"),
9894        }
9895    }
9896}
9897#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
9898pub struct GuardianRuleItem {
9899    /// A human-readable label for the item (for example, link text or a property name).
9900    pub label: String,
9901    /// Machine-readable identifier when the rule refers to a property or variable, when applicable.
9902    /// - Example: `Some("firstName".to_string())`
9903    #[serde(rename = "codeName")]
9904    pub code_name: Option<String>,
9905}
9906/// The type of email this event relates to. Workflow emails use `loop`.
9907#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9908pub enum WebhookEmailMetricPayloadSourceType {
9909    #[serde(rename = "loop")]
9910    #[default]
9911    Loop,
9912    #[serde(rename = "campaign")]
9913    Campaign,
9914    #[serde(rename = "transactional")]
9915    Transactional,
9916}
9917impl core::fmt::Display for WebhookEmailMetricPayloadSourceType {
9918    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9919        match self {
9920            Self::Loop => write!(f, "loop"),
9921            Self::Campaign => write!(f, "campaign"),
9922            Self::Transactional => write!(f, "transactional"),
9923        }
9924    }
9925}
9926/// The type of email this event relates to. Workflow emails use `loop`. Not available for transactional emails.
9927#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, oas3_gen_support::Default)]
9928pub enum WebhookMarketingEmailMetricPayloadSourceType {
9929    #[serde(rename = "loop")]
9930    #[default]
9931    Loop,
9932    #[serde(rename = "campaign")]
9933    Campaign,
9934}
9935impl core::fmt::Display for WebhookMarketingEmailMetricPayloadSourceType {
9936    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
9937        match self {
9938            Self::Loop => write!(f, "loop"),
9939            Self::Campaign => write!(f, "campaign"),
9940        }
9941    }
9942}
9943#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
9944pub struct ApiKey200Response {
9945    pub success: bool,
9946    /// The name of the team the API key belongs to.
9947    #[serde(rename = "teamName")]
9948    pub team_name: String,
9949}
9950#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
9951pub struct ApiKey401Response {
9952    pub success: Option<bool>,
9953    pub message: Option<String>,
9954    #[deprecated]
9955    pub error: Option<String>,
9956}
9957pub type Find200Response = Vec<Contact>;
9958pub type Property200Response = Vec<ContactProperty>;
9959pub type List200Response = Vec<MailingList>;
9960#[derive(Debug, Clone, PartialEq, Deserialize, oas3_gen_support::Default)]
9961#[serde(untagged)]
9962pub enum Transactional400Response {
9963    #[default]
9964    SendFailure(TransactionalSendFailureResponse),
9965    Failure2(TransactionalFailure2Response),
9966    Failure3(TransactionalFailure3Response),
9967    Failure4(TransactionalFailure4Response),
9968    Failure5(TransactionalFailure5Response),
9969}