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 Ranking {
    #[serde(rename = "id")]
    pub id: i32,
    #[serde(rename = "url")]
    pub url: String,
    #[serde(rename = "username")]
    pub username: String,
    #[serde(rename = "level")]
    pub level: i32,
    #[serde(rename = "level_title")]
    pub level_title: String,
    #[serde(rename = "score", deserialize_with = "Option::deserialize")]
    pub score: Option<serde_json::Value>,
}

impl Ranking {
    #[must_use]
    pub fn new(
        id: i32,
        url: String,
        username: String,
        level: i32,
        level_title: String,
        score: Option<serde_json::Value>,
    ) -> Ranking {
        Ranking {
            id,
            url,
            username,
            level,
            level_title,
            score,
        }
    }
}