jacquard-api 0.12.0-beta.1

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

pub mod get_profile;
pub mod get_profiles;
pub mod profile;
pub mod profile_status;
pub mod search_actors;
pub mod status;


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

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Datetime;
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::{Serialize, Deserialize};
use crate::app_bsky::richtext::facet::Facet;
use crate::fm_teal::alpha::actor::profile::FeaturedItem;
use crate::fm_teal::alpha::feed::PlayView;
use crate::fm_teal::alpha::actor;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct MiniProfileView<S: BosStr = DefaultStr> {
    ///IPLD of the avatar
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avatar: Option<S>,
    ///The decentralized identifier of the actor
    #[serde(skip_serializing_if = "Option::is_none")]
    pub did: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub display_name: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub handle: Option<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ProfileView<S: BosStr = DefaultStr> {
    ///IPLD of the avatar
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avatar: Option<S>,
    ///IPLD of the banner image
    #[serde(skip_serializing_if = "Option::is_none")]
    pub banner: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<Datetime>,
    ///Free-form profile description text.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<S>,
    ///Annotations of text in the profile description (mentions, URLs, hashtags, etc). May be changed to another (backwards compatible) lexicon.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description_facets: Option<Vec<Facet<S>>>,
    ///The decentralized identifier of the actor
    #[serde(skip_serializing_if = "Option::is_none")]
    pub did: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub display_name: Option<S>,
    ///The user's most recent item featured on their profile.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub featured_item: Option<FeaturedItem<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<actor::StatusView<S>>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

/// A declaration of the status of the actor.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct StatusView<S: BosStr = DefaultStr> {
    ///The unix timestamp of the expiry time of the item. If unavailable, default to 10 minutes past the start time.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub expiry: Option<Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub item: Option<PlayView<S>>,
    ///The unix timestamp of when the item was recorded
    #[serde(skip_serializing_if = "Option::is_none")]
    pub time: Option<Datetime>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

impl<S: BosStr> LexiconSchema for MiniProfileView<S> {
    fn nsid() -> &'static str {
        "fm.teal.alpha.actor.defs"
    }
    fn def_name() -> &'static str {
        "miniProfileView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_fm_teal_alpha_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for ProfileView<S> {
    fn nsid() -> &'static str {
        "fm.teal.alpha.actor.defs"
    }
    fn def_name() -> &'static str {
        "profileView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_fm_teal_alpha_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for StatusView<S> {
    fn nsid() -> &'static str {
        "fm.teal.alpha.actor.defs"
    }
    fn def_name() -> &'static str {
        "statusView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_fm_teal_alpha_actor_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_fm_teal_alpha_actor_defs() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("fm.teal.alpha.actor.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("miniProfileView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("avatar"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("IPLD of the avatar")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The decentralized identifier of the actor",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("displayName"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("handle"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("profileView"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("avatar"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("IPLD of the avatar")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("banner"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("IPLD of the banner image"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("description"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Free-form profile description text."),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("descriptionFacets"),
                            LexObjectProperty::Array(LexArray {
                                description: Some(
                                    CowStr::new_static(
                                        "Annotations of text in the profile description (mentions, URLs, hashtags, etc). May be changed to another (backwards compatible) lexicon.",
                                    ),
                                ),
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("app.bsky.richtext.facet"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The decentralized identifier of the actor",
                                    ),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("displayName"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("featuredItem"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "fm.teal.alpha.actor.profile#featuredItem",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#statusView"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("statusView"),
                LexUserType::Object(LexObject {
                    description: Some(
                        CowStr::new_static("A declaration of the status of the actor."),
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("expiry"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The unix timestamp of the expiry time of the item. If unavailable, default to 10 minutes past the start time.",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("item"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static(
                                    "fm.teal.alpha.feed.defs#playView",
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("time"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static(
                                        "The unix timestamp of when the item was recorded",
                                    ),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}