metaculus 0.4.0

API Client for Metaculus
Documentation
/*
 * Metaculus API
 *
 * Welcome to the unofficial Rust client for the Metaculus API
 *
 * The version of the OpenAPI document: 1.0
 * Contact: Benjamin Manns <opensource@benmanns.com>
 * Generated by: https://openapi-generator.tech
 */

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CommentChildren {
    #[serde(rename = "url")]
    pub url: String,
    #[serde(rename = "id")]
    pub id: i32,
    #[serde(rename = "author", deserialize_with = "Option::deserialize")]
    pub author: Option<i32>,
    #[serde(rename = "author_name", deserialize_with = "Option::deserialize")]
    pub author_name: Option<String>,
    #[serde(rename = "author_lvl", deserialize_with = "Option::deserialize")]
    pub author_lvl: Option<serde_json::Value>,
    #[serde(rename = "author_supporter_lvl")]
    pub author_supporter_lvl: i32,
    #[serde(rename = "is_deactivated")]
    pub is_deactivated: bool,
    #[serde(rename = "is_moderator")]
    pub is_moderator: bool,
    #[serde(rename = "is_admin")]
    pub is_admin: bool,
    #[serde(rename = "question")]
    pub question: String,
    #[serde(rename = "comment_html")]
    pub comment_html: String,
    #[serde(rename = "comment_text")]
    pub comment_text: String,
    #[serde(rename = "created_time")]
    pub created_time: String,
    #[serde(rename = "prediction_value", deserialize_with = "Option::deserialize")]
    pub prediction_value: Option<::std::collections::HashMap<String, serde_json::Value>>,
    #[serde(rename = "submit_type", skip_serializing_if = "Option::is_none")]
    pub submit_type: Option<crate::models::SubmitTypeEnum>,
    #[serde(rename = "preview", skip_serializing_if = "Option::is_none")]
    pub preview: Option<bool>,
    #[serde(
        rename = "parent",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub parent: Option<Option<i32>>,
    #[serde(rename = "num_children")]
    pub num_children: i32,
    #[serde(rename = "num_likes", deserialize_with = "Option::deserialize")]
    pub num_likes: Option<i32>,
    #[serde(rename = "deleted")]
    pub deleted: bool,
    #[serde(rename = "parent_author", deserialize_with = "Option::deserialize")]
    pub parent_author: Option<String>,
    #[serde(rename = "user_like")]
    pub user_like: i32,
    #[serde(rename = "user_like_at")]
    pub user_like_at: String,
    #[serde(
        rename = "latest_prediction",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub latest_prediction: Option<Option<::std::collections::HashMap<String, serde_json::Value>>>,
    #[serde(
        rename = "include_latest_prediction",
        skip_serializing_if = "Option::is_none"
    )]
    pub include_latest_prediction: Option<bool>,
    #[serde(rename = "edits")]
    pub edits: ::std::collections::HashMap<String, serde_json::Value>,
    #[serde(rename = "children")]
    pub children: Box<crate::models::Comment>,
}

impl CommentChildren {
    #[must_use]
    pub fn new(
        url: String,
        id: i32,
        author: Option<i32>,
        author_name: Option<String>,
        author_lvl: Option<serde_json::Value>,
        author_supporter_lvl: i32,
        is_deactivated: bool,
        is_moderator: bool,
        is_admin: bool,
        question: String,
        comment_html: String,
        comment_text: String,
        created_time: String,
        prediction_value: Option<::std::collections::HashMap<String, serde_json::Value>>,
        num_children: i32,
        num_likes: Option<i32>,
        deleted: bool,
        parent_author: Option<String>,
        user_like: i32,
        user_like_at: String,
        edits: ::std::collections::HashMap<String, serde_json::Value>,
        children: crate::models::Comment,
    ) -> CommentChildren {
        CommentChildren {
            url,
            id,
            author,
            author_name,
            author_lvl,
            author_supporter_lvl,
            is_deactivated,
            is_moderator,
            is_admin,
            question,
            comment_html,
            comment_text,
            created_time,
            prediction_value,
            submit_type: None,
            preview: None,
            parent: None,
            num_children,
            num_likes,
            deleted,
            parent_author,
            user_like,
            user_like_at,
            latest_prediction: None,
            include_latest_prediction: None,
            edits,
            children: Box::new(children),
        }
    }
}