jacquard-api 0.12.0-beta.2

Generated AT Protocol API bindings for Jacquard
Documentation
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: place.stream.metadata.contentWarnings
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[allow(unused_imports)]
use alloc::collections::BTreeMap;
use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Deserialize, Serialize};
/// The content contains information that can be used to identify a particular individual, such as a name, phone number, email address, physical address, or IP address.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Pii;
impl core::fmt::Display for Pii {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "PII")
    }
}

/// The content could be perceived as offensive due to the discussion or display of death.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Death;
impl core::fmt::Display for Death {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "death")
    }
}

/// The content contains a portrayal of the use or abuse of mind altering substances.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct DrugUse;
impl core::fmt::Display for DrugUse {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "drugUse")
    }
}

/// The content contains violent actions of a fantasy nature, involving human or non-human characters in situations easily distinguishable from real life.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct FantasyViolence;
impl core::fmt::Display for FantasyViolence {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "fantasyViolence")
    }
}

/// The content contains flashing lights that could be harmful to viewers with seizure disorders such as photosensitive epilepsy.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct FlashingLights;
impl core::fmt::Display for FlashingLights {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "flashingLights")
    }
}

/// The content could be perceived as offensive due to the language used.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Language;
impl core::fmt::Display for Language {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "language")
    }
}

/// Content warnings for a stream.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(
    rename_all = "camelCase",
    bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct ContentWarnings<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub warnings: Option<Vec<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// The content could be perceived as offensive due to nudity.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Nudity;
impl core::fmt::Display for Nudity {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "nudity")
    }
}

/// The content could be perceived as offensive due to the discussion or display of sexuality.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Sexuality;
impl core::fmt::Display for Sexuality {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "sexuality")
    }
}

/// The content could be perceived as distressing due to the discussion or display of suffering or triggering topics, including suicide, eating disorders or self harm.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Suffering;
impl core::fmt::Display for Suffering {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "suffering")
    }
}

/// The content could be perceived as offensive due to the discussion or display of violence.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Hash)]
pub struct Violence;
impl core::fmt::Display for Violence {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "violence")
    }
}

impl<S: BosStr> LexiconSchema for ContentWarnings<S> {
    fn nsid() -> &'static str {
        "place.stream.metadata.contentWarnings"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_place_stream_metadata_contentWarnings()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_place_stream_metadata_contentWarnings() -> LexiconDoc<'static> {
    use alloc::collections::BTreeMap;
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("place.stream.metadata.contentWarnings"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("PII"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("death"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("drugUse"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("fantasyViolence"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("flashingLights"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("language"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Object(LexObject {
                    description: Some(CowStr::new_static("Content warnings for a stream.")),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("warnings"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("nudity"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("sexuality"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("suffering"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("violence"),
                LexUserType::Token(LexToken {
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}