proto-blue-api 0.3.1

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

use serde::{Deserialize, Serialize};

/// Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ByteSlice {
    pub byte_end: i64,
    pub byte_start: i64,
}

/// Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Link {
    pub uri: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum MainFeaturesItemRefs {
    #[serde(rename = "app.bsky.richtext.facet#mention")]
    BskyRichtextFacetMention(Box<Mention>),
    #[serde(rename = "app.bsky.richtext.facet#link")]
    BskyRichtextFacetLink(Box<Link>),
    #[serde(rename = "app.bsky.richtext.facet#tag")]
    BskyRichtextFacetTag(Box<Tag>),
    #[serde(other)]
    Other,
}

/// Annotation of a sub-string within rich text.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Main {
    pub features: Vec<MainFeaturesItemRefs>,
    pub index: ByteSlice,
}

/// Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Mention {
    pub did: proto_blue_syntax::Did,
}

/// Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags').
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Tag {
    pub tag: String,
}