fastcomments-sdk 3.0.0

Official FastComments Rust SDK (Typed API Client & Utilities)
Documentation
/*
 * fastcomments
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::client::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ApiBannedUser {
    #[serde(rename = "_id")]
    pub _id: String,
    #[serde(rename = "tenantId")]
    pub tenant_id: String,
    #[serde(rename = "userId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub user_id: Option<Option<String>>,
    #[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub email: Option<Option<String>>,
    #[serde(rename = "username", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub username: Option<Option<String>>,
    #[serde(rename = "ipHash", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub ip_hash: Option<Option<String>>,
    #[serde(rename = "createdAt")]
    pub created_at: chrono::DateTime<chrono::FixedOffset>,
    #[serde(rename = "bannedByUserId")]
    pub banned_by_user_id: String,
    #[serde(rename = "bannedCommentText")]
    pub banned_comment_text: String,
    #[serde(rename = "banType")]
    pub ban_type: String,
    #[serde(rename = "bannedUntil", deserialize_with = "Option::deserialize")]
    pub banned_until: Option<chrono::DateTime<chrono::FixedOffset>>,
    #[serde(rename = "hasEmailWildcard")]
    pub has_email_wildcard: bool,
    #[serde(rename = "banReason", skip_serializing_if = "Option::is_none")]
    pub ban_reason: Option<String>,
}

impl ApiBannedUser {
    pub fn new(_id: String, tenant_id: String, created_at: chrono::DateTime<chrono::FixedOffset>, banned_by_user_id: String, banned_comment_text: String, ban_type: String, banned_until: Option<chrono::DateTime<chrono::FixedOffset>>, has_email_wildcard: bool) -> ApiBannedUser {
        ApiBannedUser {
            _id,
            tenant_id,
            user_id: None,
            email: None,
            username: None,
            ip_hash: None,
            created_at,
            banned_by_user_id,
            banned_comment_text,
            ban_type,
            banned_until,
            has_email_wildcard,
            ban_reason: None,
        }
    }
}