#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Entity<'a> {
#[serde(borrow)]
pub index: crate::app_bsky::feed::post::TextSlice<'a>,
#[serde(borrow)]
pub r#type: jacquard_common::CowStr<'a>,
#[serde(borrow)]
pub value: jacquard_common::CowStr<'a>,
}
pub mod entity_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Value;
type Index;
type Type;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Value = Unset;
type Index = Unset;
type Type = Unset;
}
pub struct SetValue<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetValue<S> {}
impl<S: State> State for SetValue<S> {
type Value = Set<members::value>;
type Index = S::Index;
type Type = S::Type;
}
pub struct SetIndex<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetIndex<S> {}
impl<S: State> State for SetIndex<S> {
type Value = S::Value;
type Index = Set<members::index>;
type Type = S::Type;
}
pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetType<S> {}
impl<S: State> State for SetType<S> {
type Value = S::Value;
type Index = S::Index;
type Type = Set<members::r#type>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct value(());
pub struct index(());
pub struct r#type(());
}
}
pub struct EntityBuilder<'a, S: entity_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<crate::app_bsky::feed::post::TextSlice<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Entity<'a> {
pub fn new() -> EntityBuilder<'a, entity_state::Empty> {
EntityBuilder::new()
}
}
impl<'a> EntityBuilder<'a, entity_state::Empty> {
pub fn new() -> Self {
EntityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> EntityBuilder<'a, S>
where
S: entity_state::State,
S::Index: entity_state::IsUnset,
{
pub fn index(
mut self,
value: impl Into<crate::app_bsky::feed::post::TextSlice<'a>>,
) -> EntityBuilder<'a, entity_state::SetIndex<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
EntityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> EntityBuilder<'a, S>
where
S: entity_state::State,
S::Type: entity_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> EntityBuilder<'a, entity_state::SetType<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
EntityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> EntityBuilder<'a, S>
where
S: entity_state::State,
S::Value: entity_state::IsUnset,
{
pub fn value(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> EntityBuilder<'a, entity_state::SetValue<S>> {
self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
EntityBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> EntityBuilder<'a, S>
where
S: entity_state::State,
S::Value: entity_state::IsSet,
S::Index: entity_state::IsSet,
S::Type: entity_state::IsSet,
{
pub fn build(self) -> Entity<'a> {
Entity {
index: self.__unsafe_private_named.0.unwrap(),
r#type: self.__unsafe_private_named.1.unwrap(),
value: self.__unsafe_private_named.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Entity<'a> {
Entity {
index: self.__unsafe_private_named.0.unwrap(),
r#type: self.__unsafe_private_named.1.unwrap(),
value: self.__unsafe_private_named.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_feed_post() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("app.bsky.feed.post"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("entity"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Deprecated: use facets instead.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("index"),
::jacquard_common::deps::smol_str::SmolStr::new_static("type"),
::jacquard_common::deps::smol_str::SmolStr::new_static("value")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"index",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#textSlice"),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"type",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Expected values are 'mention' and 'link'.",
),
),
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"value",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
description: Some(
::jacquard_common::CowStr::new_static(
"Record containing a Bluesky post.",
),
),
key: Some(::jacquard_common::CowStr::new_static("tid")),
record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("text"),
::jacquard_common::deps::smol_str::SmolStr::new_static("createdAt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"Client-declared timestamp when this post was originally created.",
),
),
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"embed",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: None,
refs: vec![
::jacquard_common::CowStr::new_static("app.bsky.embed.images"),
::jacquard_common::CowStr::new_static("app.bsky.embed.video"),
::jacquard_common::CowStr::new_static("app.bsky.embed.external"),
::jacquard_common::CowStr::new_static("app.bsky.embed.record"),
::jacquard_common::CowStr::new_static("app.bsky.embed.recordWithMedia")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"entities",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"DEPRECATED: replaced by app.bsky.richtext.facet.",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#entity"),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"facets",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Annotations of text (mentions, URLs, hashtags, etc)",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"app.bsky.richtext.facet",
),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"labels",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion {
description: Some(
::jacquard_common::CowStr::new_static(
"Self-label values for this post. Effectively content warnings.",
),
),
refs: vec![
::jacquard_common::CowStr::new_static("com.atproto.label.defs#selfLabels")
],
closed: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"langs",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Indicates human language of post primary text content.",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Language,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
min_length: None,
max_length: Some(3usize),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"reply",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static("#replyRef"),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"tags",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: Some(
::jacquard_common::CowStr::new_static(
"Additional hashtags, in addition to any included in post text and facets.",
),
),
items: ::jacquard_lexicon::lexicon::LexArrayItem::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: Some(640usize),
min_graphemes: None,
max_graphemes: Some(64usize),
r#enum: None,
r#const: None,
known_values: None,
}),
min_length: None,
max_length: Some(8usize),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"text",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: Some(
::jacquard_common::CowStr::new_static(
"The primary post content. May be an empty string, if there are embeds.",
),
),
format: None,
default: None,
min_length: None,
max_length: Some(3000usize),
min_graphemes: None,
max_graphemes: Some(300usize),
r#enum: None,
r#const: None,
known_values: None,
}),
);
map
},
}),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("replyRef"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("root"),
::jacquard_common::deps::smol_str::SmolStr::new_static("parent")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"parent",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"root",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"com.atproto.repo.strongRef",
),
}),
);
map
},
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("textSlice"),
::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
description: Some(
::jacquard_common::CowStr::new_static(
"Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings.",
),
),
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("start"),
::jacquard_common::deps::smol_str::SmolStr::new_static("end")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"end",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(0i64),
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"start",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: Some(0i64),
maximum: None,
r#enum: None,
r#const: None,
}),
);
map
},
}),
);
map
},
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Entity<'a> {
fn nsid() -> &'static str {
"app.bsky.feed.post"
}
fn def_name() -> &'static str {
"entity"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_bsky_feed_post()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Post<'a> {
pub created_at: jacquard_common::types::string::Datetime,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub embed: std::option::Option<PostEmbed<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub entities: std::option::Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub facets: std::option::Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub labels: std::option::Option<crate::com_atproto::label::SelfLabels<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub langs: std::option::Option<Vec<jacquard_common::types::string::Language>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub reply: std::option::Option<crate::app_bsky::feed::post::ReplyRef<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub tags: std::option::Option<Vec<jacquard_common::CowStr<'a>>>,
#[serde(borrow)]
pub text: jacquard_common::CowStr<'a>,
}
pub mod post_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Text;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Text = Unset;
type CreatedAt = Unset;
}
pub struct SetText<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetText<S> {}
impl<S: State> State for SetText<S> {
type Text = Set<members::text>;
type CreatedAt = S::CreatedAt;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Text = S::Text;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct text(());
pub struct created_at(());
}
}
pub struct PostBuilder<'a, S: post_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<PostEmbed<'a>>,
::core::option::Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>,
::core::option::Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>,
::core::option::Option<crate::com_atproto::label::SelfLabels<'a>>,
::core::option::Option<Vec<jacquard_common::types::string::Language>>,
::core::option::Option<crate::app_bsky::feed::post::ReplyRef<'a>>,
::core::option::Option<Vec<jacquard_common::CowStr<'a>>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Post<'a> {
pub fn new() -> PostBuilder<'a, post_state::Empty> {
PostBuilder::new()
}
}
impl<'a> PostBuilder<'a, post_state::Empty> {
pub fn new() -> Self {
PostBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> PostBuilder<'a, S>
where
S: post_state::State,
S::CreatedAt: post_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> PostBuilder<'a, post_state::SetCreatedAt<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
PostBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: post_state::State> PostBuilder<'a, S> {
pub fn embed(mut self, value: impl Into<Option<PostEmbed<'a>>>) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_embed(mut self, value: Option<PostEmbed<'a>>) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S: post_state::State> PostBuilder<'a, S> {
pub fn entities(
mut self,
value: impl Into<Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_entities(
mut self,
value: Option<Vec<crate::app_bsky::feed::post::Entity<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S: post_state::State> PostBuilder<'a, S> {
pub fn facets(
mut self,
value: impl Into<Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>>,
) -> Self {
self.__unsafe_private_named.3 = value.into();
self
}
pub fn maybe_facets(
mut self,
value: Option<Vec<crate::app_bsky::richtext::facet::Facet<'a>>>,
) -> Self {
self.__unsafe_private_named.3 = value;
self
}
}
impl<'a, S: post_state::State> PostBuilder<'a, S> {
pub fn labels(
mut self,
value: impl Into<Option<crate::com_atproto::label::SelfLabels<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_labels(
mut self,
value: Option<crate::com_atproto::label::SelfLabels<'a>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S: post_state::State> PostBuilder<'a, S> {
pub fn langs(
mut self,
value: impl Into<Option<Vec<jacquard_common::types::string::Language>>>,
) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_langs(
mut self,
value: Option<Vec<jacquard_common::types::string::Language>>,
) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S: post_state::State> PostBuilder<'a, S> {
pub fn reply(
mut self,
value: impl Into<Option<crate::app_bsky::feed::post::ReplyRef<'a>>>,
) -> Self {
self.__unsafe_private_named.6 = value.into();
self
}
pub fn maybe_reply(
mut self,
value: Option<crate::app_bsky::feed::post::ReplyRef<'a>>,
) -> Self {
self.__unsafe_private_named.6 = value;
self
}
}
impl<'a, S: post_state::State> PostBuilder<'a, S> {
pub fn tags(
mut self,
value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>,
) -> Self {
self.__unsafe_private_named.7 = value.into();
self
}
pub fn maybe_tags(
mut self,
value: Option<Vec<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.7 = value;
self
}
}
impl<'a, S> PostBuilder<'a, S>
where
S: post_state::State,
S::Text: post_state::IsUnset,
{
pub fn text(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> PostBuilder<'a, post_state::SetText<S>> {
self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
PostBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> PostBuilder<'a, S>
where
S: post_state::State,
S::Text: post_state::IsSet,
S::CreatedAt: post_state::IsSet,
{
pub fn build(self) -> Post<'a> {
Post {
created_at: self.__unsafe_private_named.0.unwrap(),
embed: self.__unsafe_private_named.1,
entities: self.__unsafe_private_named.2,
facets: self.__unsafe_private_named.3,
labels: self.__unsafe_private_named.4,
langs: self.__unsafe_private_named.5,
reply: self.__unsafe_private_named.6,
tags: self.__unsafe_private_named.7,
text: self.__unsafe_private_named.8.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Post<'a> {
Post {
created_at: self.__unsafe_private_named.0.unwrap(),
embed: self.__unsafe_private_named.1,
entities: self.__unsafe_private_named.2,
facets: self.__unsafe_private_named.3,
labels: self.__unsafe_private_named.4,
langs: self.__unsafe_private_named.5,
reply: self.__unsafe_private_named.6,
tags: self.__unsafe_private_named.7,
text: self.__unsafe_private_named.8.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> Post<'a> {
pub fn uri(
uri: impl Into<jacquard_common::CowStr<'a>>,
) -> Result<
jacquard_common::types::uri::RecordUri<'a, PostRecord>,
jacquard_common::types::uri::UriError,
> {
jacquard_common::types::uri::RecordUri::try_from_uri(
jacquard_common::types::string::AtUri::new_cow(uri.into())?,
)
}
}
#[jacquard_derive::open_union]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum PostEmbed<'a> {
#[serde(rename = "app.bsky.embed.images")]
Images(Box<crate::app_bsky::embed::images::Images<'a>>),
#[serde(rename = "app.bsky.embed.video")]
Video(Box<crate::app_bsky::embed::video::Video<'a>>),
#[serde(rename = "app.bsky.embed.external")]
External(Box<crate::app_bsky::embed::external::ExternalRecord<'a>>),
#[serde(rename = "app.bsky.embed.record")]
Record(Box<crate::app_bsky::embed::record::Record<'a>>),
#[serde(rename = "app.bsky.embed.recordWithMedia")]
RecordWithMedia(Box<crate::app_bsky::embed::record_with_media::RecordWithMedia<'a>>),
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct PostGetRecordOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
#[serde(borrow)]
pub uri: jacquard_common::types::string::AtUri<'a>,
#[serde(borrow)]
pub value: Post<'a>,
}
impl From<PostGetRecordOutput<'_>> for Post<'_> {
fn from(output: PostGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl jacquard_common::types::collection::Collection for Post<'_> {
const NSID: &'static str = "app.bsky.feed.post";
type Record = PostRecord;
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct PostRecord;
impl jacquard_common::xrpc::XrpcResp for PostRecord {
const NSID: &'static str = "app.bsky.feed.post";
const ENCODING: &'static str = "application/json";
type Output<'de> = PostGetRecordOutput<'de>;
type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}
impl jacquard_common::types::collection::Collection for PostRecord {
const NSID: &'static str = "app.bsky.feed.post";
type Record = PostRecord;
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Post<'a> {
fn nsid() -> &'static str {
"app.bsky.feed.post"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_bsky_feed_post()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
if let Some(ref value) = self.langs {
#[allow(unused_comparisons)]
if value.len() > 3usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"langs",
),
max: 3usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.tags {
#[allow(unused_comparisons)]
if value.len() > 8usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"tags",
),
max: 8usize,
actual: value.len(),
});
}
}
{
let value = &self.text;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 3000usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 3000usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.text;
{
let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes(
value.as_ref(),
true,
)
.count();
if count > 300usize {
return Err(::jacquard_lexicon::validation::ConstraintError::MaxGraphemes {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"text",
),
max: 300usize,
actual: count,
});
}
}
}
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ReplyRef<'a> {
#[serde(borrow)]
pub parent: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
#[serde(borrow)]
pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
}
pub mod reply_ref_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Root;
type Parent;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Root = Unset;
type Parent = Unset;
}
pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRoot<S> {}
impl<S: State> State for SetRoot<S> {
type Root = Set<members::root>;
type Parent = S::Parent;
}
pub struct SetParent<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetParent<S> {}
impl<S: State> State for SetParent<S> {
type Root = S::Root;
type Parent = Set<members::parent>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct root(());
pub struct parent(());
}
}
pub struct ReplyRefBuilder<'a, S: reply_ref_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> ReplyRef<'a> {
pub fn new() -> ReplyRefBuilder<'a, reply_ref_state::Empty> {
ReplyRefBuilder::new()
}
}
impl<'a> ReplyRefBuilder<'a, reply_ref_state::Empty> {
pub fn new() -> Self {
ReplyRefBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ReplyRefBuilder<'a, S>
where
S: reply_ref_state::State,
S::Parent: reply_ref_state::IsUnset,
{
pub fn parent(
mut self,
value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> ReplyRefBuilder<'a, reply_ref_state::SetParent<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
ReplyRefBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ReplyRefBuilder<'a, S>
where
S: reply_ref_state::State,
S::Root: reply_ref_state::IsUnset,
{
pub fn root(
mut self,
value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
) -> ReplyRefBuilder<'a, reply_ref_state::SetRoot<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
ReplyRefBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> ReplyRefBuilder<'a, S>
where
S: reply_ref_state::State,
S::Root: reply_ref_state::IsSet,
S::Parent: reply_ref_state::IsSet,
{
pub fn build(self) -> ReplyRef<'a> {
ReplyRef {
parent: self.__unsafe_private_named.0.unwrap(),
root: self.__unsafe_private_named.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> ReplyRef<'a> {
ReplyRef {
parent: self.__unsafe_private_named.0.unwrap(),
root: self.__unsafe_private_named.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ReplyRef<'a> {
fn nsid() -> &'static str {
"app.bsky.feed.post"
}
fn def_name() -> &'static str {
"replyRef"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_bsky_feed_post()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct TextSlice<'a> {
pub end: i64,
pub start: i64,
}
pub mod text_slice_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Start;
type End;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Start = Unset;
type End = Unset;
}
pub struct SetStart<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetStart<S> {}
impl<S: State> State for SetStart<S> {
type Start = Set<members::start>;
type End = S::End;
}
pub struct SetEnd<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetEnd<S> {}
impl<S: State> State for SetEnd<S> {
type Start = S::Start;
type End = Set<members::end>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct start(());
pub struct end(());
}
}
pub struct TextSliceBuilder<'a, S: text_slice_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (::core::option::Option<i64>, ::core::option::Option<i64>),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> TextSlice<'a> {
pub fn new() -> TextSliceBuilder<'a, text_slice_state::Empty> {
TextSliceBuilder::new()
}
}
impl<'a> TextSliceBuilder<'a, text_slice_state::Empty> {
pub fn new() -> Self {
TextSliceBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (None, None),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TextSliceBuilder<'a, S>
where
S: text_slice_state::State,
S::End: text_slice_state::IsUnset,
{
pub fn end(
mut self,
value: impl Into<i64>,
) -> TextSliceBuilder<'a, text_slice_state::SetEnd<S>> {
self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
TextSliceBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TextSliceBuilder<'a, S>
where
S: text_slice_state::State,
S::Start: text_slice_state::IsUnset,
{
pub fn start(
mut self,
value: impl Into<i64>,
) -> TextSliceBuilder<'a, text_slice_state::SetStart<S>> {
self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
TextSliceBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S> TextSliceBuilder<'a, S>
where
S: text_slice_state::State,
S::Start: text_slice_state::IsSet,
S::End: text_slice_state::IsSet,
{
pub fn build(self) -> TextSlice<'a> {
TextSlice {
end: self.__unsafe_private_named.0.unwrap(),
start: self.__unsafe_private_named.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> TextSlice<'a> {
TextSlice {
end: self.__unsafe_private_named.0.unwrap(),
start: self.__unsafe_private_named.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for TextSlice<'a> {
fn nsid() -> &'static str {
"app.bsky.feed.post"
}
fn def_name() -> &'static str {
"textSlice"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_app_bsky_feed_post()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
{
let value = &self.end;
if *value < 0i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"end",
),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.start;
if *value < 0i64 {
return Err(::jacquard_lexicon::validation::ConstraintError::Minimum {
path: ::jacquard_lexicon::validation::ValidationPath::from_field(
"start",
),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}