proto-blue-api 0.3.2

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

use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum DraftPostgateEmbeddingRulesItemRefs {
    #[serde(rename = "app.bsky.feed.postgate#disableRule")]
    BskyFeedPostgateDisableRule(Box<crate::app::bsky::feed::postgate::DisableRule>),
    #[serde(other)]
    Other,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum DraftThreadgateAllowItemRefs {
    #[serde(rename = "app.bsky.feed.threadgate#mentionRule")]
    BskyFeedThreadgateMentionRule(Box<crate::app::bsky::feed::threadgate::MentionRule>),
    #[serde(rename = "app.bsky.feed.threadgate#followerRule")]
    BskyFeedThreadgateFollowerRule(Box<crate::app::bsky::feed::threadgate::FollowerRule>),
    #[serde(rename = "app.bsky.feed.threadgate#followingRule")]
    BskyFeedThreadgateFollowingRule(Box<crate::app::bsky::feed::threadgate::FollowingRule>),
    #[serde(rename = "app.bsky.feed.threadgate#listRule")]
    BskyFeedThreadgateListRule(Box<crate::app::bsky::feed::threadgate::ListRule>),
    #[serde(other)]
    Other,
}

/// A draft containing an array of draft posts.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Draft {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub device_id: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub device_name: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub langs: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub postgate_embedding_rules: Option<Vec<DraftPostgateEmbeddingRulesItemRefs>>,
    pub posts: Vec<DraftPost>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub threadgate_allow: Option<Vec<DraftThreadgateAllowItemRefs>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedCaption {
    pub content: String,
    pub lang: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedExternal {
    pub uri: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedImage {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alt: Option<String>,
    pub local_ref: DraftEmbedLocalRef,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedLocalRef {
    pub path: String,
}

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

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedVideo {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub alt: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub captions: Option<Vec<DraftEmbedCaption>>,
    pub local_ref: DraftEmbedLocalRef,
}

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

/// One of the posts that compose a draft.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DraftPost {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub embed_externals: Option<Vec<DraftEmbedExternal>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub embed_images: Option<Vec<DraftEmbedImage>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub embed_records: Option<Vec<DraftEmbedRecord>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub embed_videos: Option<Vec<DraftEmbedVideo>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<DraftPostLabelsRefs>,
    pub text: String,
}

/// View to present drafts data to users.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DraftView {
    pub created_at: proto_blue_syntax::Datetime,
    pub draft: Draft,
    pub id: proto_blue_syntax::Tid,
    pub updated_at: proto_blue_syntax::Datetime,
}

/// A draft with an identifier, used to store drafts in private storage (stash).
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DraftWithId {
    pub draft: Draft,
    pub id: proto_blue_syntax::Tid,
}