atrium_api/app/bsky/richtext/
facet.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `app.bsky.richtext.facet` namespace.
3///Annotation of a sub-string within rich text.
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct MainData {
7    pub features: Vec<crate::types::Union<MainFeaturesItem>>,
8    pub index: ByteSlice,
9}
10pub type Main = crate::types::Object<MainData>;
11///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.
12#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
13#[serde(rename_all = "camelCase")]
14pub struct ByteSliceData {
15    pub byte_end: usize,
16    pub byte_start: usize,
17}
18pub type ByteSlice = crate::types::Object<ByteSliceData>;
19///Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.
20#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
21#[serde(rename_all = "camelCase")]
22pub struct LinkData {
23    pub uri: String,
24}
25pub type Link = crate::types::Object<LinkData>;
26///Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID.
27#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
28#[serde(rename_all = "camelCase")]
29pub struct MentionData {
30    pub did: crate::types::string::Did,
31}
32pub type Mention = crate::types::Object<MentionData>;
33///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').
34#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
35#[serde(rename_all = "camelCase")]
36pub struct TagData {
37    pub tag: String,
38}
39pub type Tag = crate::types::Object<TagData>;
40#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
41#[serde(tag = "$type")]
42pub enum MainFeaturesItem {
43    #[serde(rename = "app.bsky.richtext.facet#mention")]
44    Mention(Box<Mention>),
45    #[serde(rename = "app.bsky.richtext.facet#link")]
46    Link(Box<Link>),
47    #[serde(rename = "app.bsky.richtext.facet#tag")]
48    Tag(Box<Tag>),
49}