/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
*
* The version of the OpenAPI document: 1.565.5
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadEmailBouncedBounce {
/// The address that refused the mail.
#[serde(rename = "recipient", skip_serializing_if = "Option::is_none")]
pub recipient: Option<String>,
/// `hard`: 5.x.x, the address does not take mail. `soft`: 4.x.x, a temporary refusal the sending server gave up on. `undetermined`: the report gave no status.
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub r#type: Option<Type>,
#[serde(rename = "category", skip_serializing_if = "Option::is_none")]
pub category: Option<Category>,
/// RFC 3463 enhanced status, such as 5.1.1.
#[serde(
rename = "status",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub status: Option<Option<String>>,
/// The SMTP reply code, such as 550. Always a number.
#[serde(
rename = "smtpCode",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub smtp_code: Option<Option<i32>>,
/// The receiving server's answer.
#[serde(
rename = "diagnostic",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub diagnostic: Option<Option<String>>,
/// `remove` only for an address that does not take mail. Sender-side refusals (authentication, blocklists, spam filters) are `fix_configuration` or `review`, never `remove`.
#[serde(rename = "recommendedAction", skip_serializing_if = "Option::is_none")]
pub recommended_action: Option<RecommendedAction>,
#[serde(
rename = "reportingMta",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub reporting_mta: Option<Option<String>>,
/// `dsn`: a standard delivery report with the bounced Message-ID. `ndr`: a non-standard report read from its headers and text.
#[serde(rename = "detection", skip_serializing_if = "Option::is_none")]
pub detection: Option<Detection>,
/// Provider id of the bounce report in the mailbox.
#[serde(rename = "bounceMessageId", skip_serializing_if = "Option::is_none")]
pub bounce_message_id: Option<String>,
/// When the report arrived in the mailbox.
#[serde(rename = "bouncedAt", skip_serializing_if = "Option::is_none")]
pub bounced_at: Option<String>,
/// When Zernio read it. Reports can arrive minutes to days after the send.
#[serde(rename = "detectedAt", skip_serializing_if = "Option::is_none")]
pub detected_at: Option<String>,
}
impl WebhookPayloadEmailBouncedBounce {
pub fn new() -> WebhookPayloadEmailBouncedBounce {
WebhookPayloadEmailBouncedBounce {
recipient: None,
r#type: None,
category: None,
status: None,
smtp_code: None,
diagnostic: None,
recommended_action: None,
reporting_mta: None,
detection: None,
bounce_message_id: None,
bounced_at: None,
detected_at: None,
}
}
}
/// `hard`: 5.x.x, the address does not take mail. `soft`: 4.x.x, a temporary refusal the sending server gave up on. `undetermined`: the report gave no status.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "hard")]
Hard,
#[serde(rename = "soft")]
Soft,
#[serde(rename = "undetermined")]
Undetermined,
}
impl Default for Type {
fn default() -> Type {
Self::Hard
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Category {
#[serde(rename = "user_unknown")]
UserUnknown,
#[serde(rename = "mailbox_full")]
MailboxFull,
#[serde(rename = "domain_not_found")]
DomainNotFound,
#[serde(rename = "policy_blocked")]
PolicyBlocked,
#[serde(rename = "spam_blocked")]
SpamBlocked,
#[serde(rename = "blocklisted")]
Blocklisted,
#[serde(rename = "message_too_large")]
MessageTooLarge,
#[serde(rename = "content_rejected")]
ContentRejected,
#[serde(rename = "auth_failure")]
AuthFailure,
#[serde(rename = "rate_limited")]
RateLimited,
#[serde(rename = "other")]
Other,
}
impl Default for Category {
fn default() -> Category {
Self::UserUnknown
}
}
/// `remove` only for an address that does not take mail. Sender-side refusals (authentication, blocklists, spam filters) are `fix_configuration` or `review`, never `remove`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RecommendedAction {
#[serde(rename = "remove")]
Remove,
#[serde(rename = "retry")]
Retry,
#[serde(rename = "review")]
Review,
#[serde(rename = "fix_configuration")]
FixConfiguration,
}
impl Default for RecommendedAction {
fn default() -> RecommendedAction {
Self::Remove
}
}
/// `dsn`: a standard delivery report with the bounced Message-ID. `ndr`: a non-standard report read from its headers and text.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Detection {
#[serde(rename = "dsn")]
Dsn,
#[serde(rename = "ndr")]
Ndr,
}
impl Default for Detection {
fn default() -> Detection {
Self::Dsn
}
}