proto-blue-api 0.3.3

AT Protocol high-level API: agent, rich text, moderation, generated types
Documentation
// Generated by atproto-codegen. Do not edit.
//! Lexicon: app.bsky.feed.post
#![allow(clippy::pedantic, clippy::nursery, clippy::all)]

use serde::{Deserialize, Serialize};

/// Deprecated: use facets instead.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Entity {
    pub index: TextSlice,
    #[serde(rename = "type")]
    pub r#type: String,
    pub value: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum MainEmbedRefs {
    #[serde(rename = "app.bsky.embed.images")]
    BskyEmbedImages(Box<crate::app::bsky::embed::images::Main>),
    #[serde(rename = "app.bsky.embed.video")]
    BskyEmbedVideo(Box<crate::app::bsky::embed::video::Main>),
    #[serde(rename = "app.bsky.embed.external")]
    BskyEmbedExternal(Box<crate::app::bsky::embed::external::Main>),
    #[serde(rename = "app.bsky.embed.record")]
    BskyEmbedRecord(Box<crate::app::bsky::embed::record::Main>),
    #[serde(rename = "app.bsky.embed.recordWithMedia")]
    BskyEmbedRecordWithMedia(Box<crate::app::bsky::embed::record_with_media::Main>),
    #[serde(other)]
    Other,
}

/// Self-label values for this post. Effectively content warnings.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum MainLabelsRefs {
    #[serde(rename = "com.atproto.label.defs#selfLabels")]
    AtprotoLabelDefsSelfLabels(Box<crate::com::atproto::label::defs::SelfLabels>),
    #[serde(other)]
    Other,
}

/// `$type` discriminator for this record on the wire.
pub const TYPE: &str = "app.bsky.feed.post";

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Main {
    /// The `$type` discriminator. Defaults to [`TYPE`] on construction.
    #[serde(rename = "$type", default = "default_type")]
    pub r#type: String,
    pub created_at: proto_blue_syntax::Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub embed: Option<MainEmbedRefs>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub entities: Option<Vec<Entity>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub facets: Option<Vec<crate::app::bsky::richtext::facet::Main>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<MainLabelsRefs>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub langs: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reply: Option<ReplyRef>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<String>>,
    pub text: String,
}

fn default_type() -> String {
    TYPE.to_string()
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReplyRef {
    pub parent: crate::com::atproto::repo::strong_ref::Main,
    pub root: crate::com::atproto::repo::strong_ref::Main,
}

/// Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct TextSlice {
    pub end: i64,
    pub start: i64,
}