fastcomments-sdk 3.0.1

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 SaveCommentResponseOptimized {
    #[serde(rename = "status")]
    pub status: models::ApiStatus,
    #[serde(rename = "comment")]
    pub comment: Box<models::PublicComment>,
    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
    pub user: Option<Box<models::UserSessionInfo>>,
    /// Construct a type with a set of properties K of type T
    #[serde(rename = "moduleData", skip_serializing_if = "Option::is_none")]
    pub module_data: Option<std::collections::HashMap<String, serde_json::Value>>,
}

impl SaveCommentResponseOptimized {
    pub fn new(status: models::ApiStatus, comment: models::PublicComment, user: Option<models::UserSessionInfo>) -> SaveCommentResponseOptimized {
        SaveCommentResponseOptimized {
            status,
            comment: Box::new(comment),
            user: if let Some(x) = user {Some(Box::new(x))} else {None},
            module_data: None,
        }
    }
}