forem_openapi_client 1.0.1

Access Forem articles, users and other resources via API. For a real-world example of Forem in action, check out [DEV](https://www.dev.to). All endpoints can be accessed with the 'api-key' header and a accept header, but some of them are accessible publicly without authentication. Dates and date times, unless otherwise specified, must be in the [RFC 3339](https://tools.ietf.org/html/rfc3339) format. Generated at 2023-04-10T05:06:38.929104+00:00
Documentation
/*
 * Forem API V1
 *
 * Access Forem articles, users and other resources via API.         For a real-world example of Forem in action, check out [DEV](https://www.dev.to).         All endpoints can be accessed with the 'api-key' header and a accept header, but         some of them are accessible publicly without authentication.          Dates and date times, unless otherwise specified, must be in         the [RFC 3339](https://tools.ietf.org/html/rfc3339) format.
 *
 * The version of the OpenAPI document: 1.0.0
 *
 * Generated by: https://openapi-generator.tech
 */

/// Page : Representation of a page object

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Page {
    /// Title of the page
    #[serde(rename = "title")]
    pub title: String,
    /// Used to link to this page in URLs, must be unique and URL-safe
    #[serde(rename = "slug")]
    pub slug: String,
    /// For internal use, helps similar pages from one another
    #[serde(rename = "description")]
    pub description: String,
    /// The text (in markdown) of the ad (required)
    #[serde(
        rename = "body_markdown",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub body_markdown: Option<Option<String>>,
    /// For JSON pages, the JSON body
    #[serde(
        rename = "body_json",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub body_json: Option<Option<String>>,
    /// If true, the page is available at '/{slug}' instead of '/page/{slug}', use with caution
    #[serde(rename = "is_top_level_path", skip_serializing_if = "Option::is_none")]
    pub is_top_level_path: Option<bool>,
    #[serde(
        rename = "social_image",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub social_image: Option<Option<serde_json::Value>>,
    /// Controls what kind of layout the page is rendered in
    #[serde(rename = "template")]
    pub template: Template,
}

impl Page {
    /// Representation of a page object
    pub fn new(title: String, slug: String, description: String, template: Template) -> Page {
        Page {
            title,
            slug,
            description,
            body_markdown: None,
            body_json: None,
            is_top_level_path: None,
            social_image: None,
            template,
        }
    }
}

/// Controls what kind of layout the page is rendered in
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Template {
    #[serde(rename = "contained")]
    Contained,
    #[serde(rename = "full_within_layout")]
    FullWithinLayout,
    #[serde(rename = "nav_bar_included")]
    NavBarIncluded,
    #[serde(rename = "json")]
    Json,
}

impl Default for Template {
    fn default() -> Template {
        Self::Contained
    }
}