fastcomments-sdk 2.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 ApiError {
    #[serde(rename = "status")]
    pub status: models::ApiStatus,
    #[serde(rename = "reason")]
    pub reason: String,
    #[serde(rename = "code")]
    pub code: String,
    #[serde(rename = "secondaryCode", skip_serializing_if = "Option::is_none")]
    pub secondary_code: Option<String>,
    #[serde(rename = "bannedUntil", skip_serializing_if = "Option::is_none")]
    pub banned_until: Option<i64>,
    #[serde(rename = "maxCharacterLength", skip_serializing_if = "Option::is_none")]
    pub max_character_length: Option<i32>,
    #[serde(rename = "translatedError", skip_serializing_if = "Option::is_none")]
    pub translated_error: Option<String>,
    #[serde(rename = "customConfig", skip_serializing_if = "Option::is_none")]
    pub custom_config: Option<Box<models::CustomConfigParameters>>,
}

impl ApiError {
    pub fn new(status: models::ApiStatus, reason: String, code: String) -> ApiError {
        ApiError {
            status,
            reason,
            code,
            secondary_code: None,
            banned_until: None,
            max_character_length: None,
            translated_error: None,
            custom_config: None,
        }
    }
}