pub mod create_draft;
pub mod delete_draft;
pub mod get_drafts;
pub mod update_draft;
#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{Tid, Datetime, Language, UriValue};
use jacquard_derive::{IntoStatic, lexicon, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::app_bsky::feed::postgate::DisableRule;
use crate::app_bsky::feed::threadgate::FollowerRule;
use crate::app_bsky::feed::threadgate::FollowingRule;
use crate::app_bsky::feed::threadgate::ListRule;
use crate::app_bsky::feed::threadgate::MentionRule;
use crate::com_atproto::label::SelfLabels;
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::app_bsky::draft;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Draft<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub device_id: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub device_name: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub langs: Option<Vec<Language>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub postgate_embedding_rules: Option<Vec<DisableRule<'a>>>,
#[serde(borrow)]
pub posts: Vec<draft::DraftPost<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub threadgate_allow: Option<Vec<DraftThreadgateAllowItem<'a>>>,
}
#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type", bound(deserialize = "'de: 'a"))]
pub enum DraftThreadgateAllowItem<'a> {
#[serde(rename = "app.bsky.feed.threadgate#mentionRule")]
ThreadgateMentionRule(Box<MentionRule<'a>>),
#[serde(rename = "app.bsky.feed.threadgate#followerRule")]
ThreadgateFollowerRule(Box<FollowerRule<'a>>),
#[serde(rename = "app.bsky.feed.threadgate#followingRule")]
ThreadgateFollowingRule(Box<FollowingRule<'a>>),
#[serde(rename = "app.bsky.feed.threadgate#listRule")]
ThreadgateListRule(Box<ListRule<'a>>),
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedCaption<'a> {
#[serde(borrow)]
pub content: CowStr<'a>,
pub lang: Language,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedExternal<'a> {
#[serde(borrow)]
pub uri: UriValue<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedImage<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub alt: Option<CowStr<'a>>,
#[serde(borrow)]
pub local_ref: draft::DraftEmbedLocalRef<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedLocalRef<'a> {
#[serde(borrow)]
pub path: CowStr<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedRecord<'a> {
#[serde(borrow)]
pub record: StrongRef<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DraftEmbedVideo<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub alt: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub captions: Option<Vec<draft::DraftEmbedCaption<'a>>>,
#[serde(borrow)]
pub local_ref: draft::DraftEmbedLocalRef<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct DraftPost<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub embed_externals: Option<Vec<draft::DraftEmbedExternal<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub embed_images: Option<Vec<draft::DraftEmbedImage<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub embed_records: Option<Vec<draft::DraftEmbedRecord<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub embed_videos: Option<Vec<draft::DraftEmbedVideo<'a>>>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub labels: Option<SelfLabels<'a>>,
#[serde(borrow)]
pub text: CowStr<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DraftView<'a> {
pub created_at: Datetime,
#[serde(borrow)]
pub draft: draft::Draft<'a>,
pub id: Tid,
pub updated_at: Datetime,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct DraftWithId<'a> {
#[serde(borrow)]
pub draft: draft::Draft<'a>,
pub id: Tid,
}
impl<'a> LexiconSchema for Draft<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draft"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.device_id {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("device_id"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.device_name {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("device_name"),
max: 100usize,
actual: <str>::len(value.as_ref()),
});
}
}
if let Some(ref value) = self.langs {
#[allow(unused_comparisons)]
if value.len() > 3usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("langs"),
max: 3usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.postgate_embedding_rules {
#[allow(unused_comparisons)]
if value.len() > 5usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("postgate_embedding_rules"),
max: 5usize,
actual: value.len(),
});
}
}
{
let value = &self.posts;
#[allow(unused_comparisons)]
if value.len() > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("posts"),
max: 100usize,
actual: value.len(),
});
}
}
{
let value = &self.posts;
#[allow(unused_comparisons)]
if value.len() < 1usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("posts"),
min: 1usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.threadgate_allow {
#[allow(unused_comparisons)]
if value.len() > 5usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("threadgate_allow"),
max: 5usize,
actual: value.len(),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for DraftEmbedCaption<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draftEmbedCaption"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.content;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("content"),
max: 10000usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for DraftEmbedExternal<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draftEmbedExternal"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for DraftEmbedImage<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draftEmbedImage"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.alt {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 2000usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("alt"),
max: 2000usize,
actual: count,
});
}
}
}
Ok(())
}
}
impl<'a> LexiconSchema for DraftEmbedLocalRef<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draftEmbedLocalRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.path;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 1024usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("path"),
max: 1024usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.path;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) < 1usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("path"),
min: 1usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for DraftEmbedRecord<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draftEmbedRecord"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for DraftEmbedVideo<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draftEmbedVideo"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.alt {
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 2000usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("alt"),
max: 2000usize,
actual: count,
});
}
}
}
if let Some(ref value) = self.captions {
#[allow(unused_comparisons)]
if value.len() > 20usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("captions"),
max: 20usize,
actual: value.len(),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for DraftPost<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draftPost"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.embed_externals {
#[allow(unused_comparisons)]
if value.len() > 1usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("embed_externals"),
max: 1usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.embed_images {
#[allow(unused_comparisons)]
if value.len() > 4usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("embed_images"),
max: 4usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.embed_records {
#[allow(unused_comparisons)]
if value.len() > 1usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("embed_records"),
max: 1usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.embed_videos {
#[allow(unused_comparisons)]
if value.len() > 1usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("embed_videos"),
max: 1usize,
actual: value.len(),
});
}
}
{
let value = &self.text;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 10000usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("text"),
max: 10000usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.text;
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 1000usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("text"),
max: 1000usize,
actual: count,
});
}
}
}
Ok(())
}
}
impl<'a> LexiconSchema for DraftView<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draftView"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for DraftWithId<'a> {
fn nsid() -> &'static str {
"app.bsky.draft.defs"
}
fn def_name() -> &'static str {
"draftWithId"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_app_bsky_draft_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod draft_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 Posts;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Posts = Unset;
}
pub struct SetPosts<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPosts<S> {}
impl<S: State> State for SetPosts<S> {
type Posts = Set<members::posts>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct posts(());
}
}
pub struct DraftBuilder<'a, S: draft_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<CowStr<'a>>,
Option<CowStr<'a>>,
Option<Vec<Language>>,
Option<Vec<DisableRule<'a>>>,
Option<Vec<draft::DraftPost<'a>>>,
Option<Vec<DraftThreadgateAllowItem<'a>>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Draft<'a> {
pub fn new() -> DraftBuilder<'a, draft_state::Empty> {
DraftBuilder::new()
}
}
impl<'a> DraftBuilder<'a, draft_state::Empty> {
pub fn new() -> Self {
DraftBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
pub fn device_id(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_device_id(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
pub fn device_name(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_device_name(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
pub fn langs(mut self, value: impl Into<Option<Vec<Language>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_langs(mut self, value: Option<Vec<Language>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
pub fn postgate_embedding_rules(
mut self,
value: impl Into<Option<Vec<DisableRule<'a>>>>,
) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_postgate_embedding_rules(
mut self,
value: Option<Vec<DisableRule<'a>>>,
) -> Self {
self._fields.3 = value;
self
}
}
impl<'a, S> DraftBuilder<'a, S>
where
S: draft_state::State,
S::Posts: draft_state::IsUnset,
{
pub fn posts(
mut self,
value: impl Into<Vec<draft::DraftPost<'a>>>,
) -> DraftBuilder<'a, draft_state::SetPosts<S>> {
self._fields.4 = Option::Some(value.into());
DraftBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: draft_state::State> DraftBuilder<'a, S> {
pub fn threadgate_allow(
mut self,
value: impl Into<Option<Vec<DraftThreadgateAllowItem<'a>>>>,
) -> Self {
self._fields.5 = value.into();
self
}
pub fn maybe_threadgate_allow(
mut self,
value: Option<Vec<DraftThreadgateAllowItem<'a>>>,
) -> Self {
self._fields.5 = value;
self
}
}
impl<'a, S> DraftBuilder<'a, S>
where
S: draft_state::State,
S::Posts: draft_state::IsSet,
{
pub fn build(self) -> Draft<'a> {
Draft {
device_id: self._fields.0,
device_name: self._fields.1,
langs: self._fields.2,
postgate_embedding_rules: self._fields.3,
posts: self._fields.4.unwrap(),
threadgate_allow: self._fields.5,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Draft<'a> {
Draft {
device_id: self._fields.0,
device_name: self._fields.1,
langs: self._fields.2,
postgate_embedding_rules: self._fields.3,
posts: self._fields.4.unwrap(),
threadgate_allow: self._fields.5,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_app_bsky_draft_defs() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("app.bsky.draft.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("draft"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("A draft containing an array of draft posts."),
),
required: Some(vec![SmolStr::new_static("posts")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("deviceId"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"UUIDv4 identifier of the device that created this draft.",
),
),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("deviceName"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The device and/or platform on which the draft was created.",
),
),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("langs"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Indicates human language of posts primary text content.",
),
),
items: LexArrayItem::String(LexString {
format: Some(LexStringFormat::Language),
..Default::default()
}),
max_length: Some(3usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("postgateEmbeddingRules"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Embedding rules for the postgates to be created when this draft is published.",
),
),
items: LexArrayItem::Union(LexRefUnion {
refs: vec![
CowStr::new_static("app.bsky.feed.postgate#disableRule")
],
..Default::default()
}),
max_length: Some(5usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("posts"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Array of draft posts that compose this draft.",
),
),
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#draftPost"),
..Default::default()
}),
min_length: Some(1usize),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("threadgateAllow"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Allow-rules for the threadgate to be created when this draft is published.",
),
),
items: LexArrayItem::Union(LexRefUnion {
refs: vec![
CowStr::new_static("app.bsky.feed.threadgate#mentionRule"),
CowStr::new_static("app.bsky.feed.threadgate#followerRule"),
CowStr::new_static("app.bsky.feed.threadgate#followingRule"),
CowStr::new_static("app.bsky.feed.threadgate#listRule")
],
..Default::default()
}),
max_length: Some(5usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftEmbedCaption"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("lang"), SmolStr::new_static("content")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("content"),
LexObjectProperty::String(LexString {
max_length: Some(10000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("lang"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Language),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftEmbedExternal"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("uri")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftEmbedImage"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("localRef")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("alt"),
LexObjectProperty::String(LexString {
max_graphemes: Some(2000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("localRef"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#draftEmbedLocalRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftEmbedLocalRef"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("path")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("path"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Local, on-device ref to file to be embedded. Embeds are currently device-bound for drafts.",
),
),
min_length: Some(1usize),
max_length: Some(1024usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftEmbedRecord"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("record")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("record"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftEmbedVideo"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("localRef")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("alt"),
LexObjectProperty::String(LexString {
max_graphemes: Some(2000usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("captions"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#draftEmbedCaption"),
..Default::default()
}),
max_length: Some(20usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("localRef"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#draftEmbedLocalRef"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftPost"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("One of the posts that compose a draft."),
),
required: Some(vec![SmolStr::new_static("text")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("embedExternals"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#draftEmbedExternal"),
..Default::default()
}),
max_length: Some(1usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("embedImages"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#draftEmbedImage"),
..Default::default()
}),
max_length: Some(4usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("embedRecords"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#draftEmbedRecord"),
..Default::default()
}),
max_length: Some(1usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("embedVideos"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#draftEmbedVideo"),
..Default::default()
}),
max_length: Some(1usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("labels"),
LexObjectProperty::Union(LexRefUnion {
description: Some(
CowStr::new_static(
"Self-label values for this post. Effectively content warnings.",
),
),
refs: vec![
CowStr::new_static("com.atproto.label.defs#selfLabels")
],
..Default::default()
}),
);
map.insert(
SmolStr::new_static("text"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The primary post content. It has a higher limit than post contents to allow storing a larger text that can later be refined into smaller posts.",
),
),
max_length: Some(10000usize),
max_graphemes: Some(1000usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftView"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("View to present drafts data to users."),
),
required: Some(
vec![
SmolStr::new_static("id"), SmolStr::new_static("draft"),
SmolStr::new_static("createdAt"),
SmolStr::new_static("updatedAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The time the draft was created."),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draft"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#draft"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("id"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"A TID to be used as a draft identifier.",
),
),
format: Some(LexStringFormat::Tid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("updatedAt"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("The time the draft was last updated."),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("draftWithId"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"A draft with an identifier, used to store drafts in private storage (stash).",
),
),
required: Some(
vec![SmolStr::new_static("id"), SmolStr::new_static("draft")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("draft"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#draft"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("id"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"A TID to be used as a draft identifier.",
),
),
format: Some(LexStringFormat::Tid),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod draft_embed_caption_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 Lang;
type Content;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Lang = Unset;
type Content = Unset;
}
pub struct SetLang<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLang<S> {}
impl<S: State> State for SetLang<S> {
type Lang = Set<members::lang>;
type Content = S::Content;
}
pub struct SetContent<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetContent<S> {}
impl<S: State> State for SetContent<S> {
type Lang = S::Lang;
type Content = Set<members::content>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct lang(());
pub struct content(());
}
}
pub struct DraftEmbedCaptionBuilder<'a, S: draft_embed_caption_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<Language>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> DraftEmbedCaption<'a> {
pub fn new() -> DraftEmbedCaptionBuilder<'a, draft_embed_caption_state::Empty> {
DraftEmbedCaptionBuilder::new()
}
}
impl<'a> DraftEmbedCaptionBuilder<'a, draft_embed_caption_state::Empty> {
pub fn new() -> Self {
DraftEmbedCaptionBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftEmbedCaptionBuilder<'a, S>
where
S: draft_embed_caption_state::State,
S::Content: draft_embed_caption_state::IsUnset,
{
pub fn content(
mut self,
value: impl Into<CowStr<'a>>,
) -> DraftEmbedCaptionBuilder<'a, draft_embed_caption_state::SetContent<S>> {
self._fields.0 = Option::Some(value.into());
DraftEmbedCaptionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftEmbedCaptionBuilder<'a, S>
where
S: draft_embed_caption_state::State,
S::Lang: draft_embed_caption_state::IsUnset,
{
pub fn lang(
mut self,
value: impl Into<Language>,
) -> DraftEmbedCaptionBuilder<'a, draft_embed_caption_state::SetLang<S>> {
self._fields.1 = Option::Some(value.into());
DraftEmbedCaptionBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftEmbedCaptionBuilder<'a, S>
where
S: draft_embed_caption_state::State,
S::Lang: draft_embed_caption_state::IsSet,
S::Content: draft_embed_caption_state::IsSet,
{
pub fn build(self) -> DraftEmbedCaption<'a> {
DraftEmbedCaption {
content: self._fields.0.unwrap(),
lang: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> DraftEmbedCaption<'a> {
DraftEmbedCaption {
content: self._fields.0.unwrap(),
lang: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod draft_embed_external_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 Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
}
pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUri<S> {}
impl<S: State> State for SetUri<S> {
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
}
}
pub struct DraftEmbedExternalBuilder<'a, S: draft_embed_external_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<UriValue<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> DraftEmbedExternal<'a> {
pub fn new() -> DraftEmbedExternalBuilder<'a, draft_embed_external_state::Empty> {
DraftEmbedExternalBuilder::new()
}
}
impl<'a> DraftEmbedExternalBuilder<'a, draft_embed_external_state::Empty> {
pub fn new() -> Self {
DraftEmbedExternalBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftEmbedExternalBuilder<'a, S>
where
S: draft_embed_external_state::State,
S::Uri: draft_embed_external_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<UriValue<'a>>,
) -> DraftEmbedExternalBuilder<'a, draft_embed_external_state::SetUri<S>> {
self._fields.0 = Option::Some(value.into());
DraftEmbedExternalBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftEmbedExternalBuilder<'a, S>
where
S: draft_embed_external_state::State,
S::Uri: draft_embed_external_state::IsSet,
{
pub fn build(self) -> DraftEmbedExternal<'a> {
DraftEmbedExternal {
uri: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> DraftEmbedExternal<'a> {
DraftEmbedExternal {
uri: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod draft_embed_image_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 LocalRef;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type LocalRef = Unset;
}
pub struct SetLocalRef<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLocalRef<S> {}
impl<S: State> State for SetLocalRef<S> {
type LocalRef = Set<members::local_ref>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct local_ref(());
}
}
pub struct DraftEmbedImageBuilder<'a, S: draft_embed_image_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<draft::DraftEmbedLocalRef<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> DraftEmbedImage<'a> {
pub fn new() -> DraftEmbedImageBuilder<'a, draft_embed_image_state::Empty> {
DraftEmbedImageBuilder::new()
}
}
impl<'a> DraftEmbedImageBuilder<'a, draft_embed_image_state::Empty> {
pub fn new() -> Self {
DraftEmbedImageBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: draft_embed_image_state::State> DraftEmbedImageBuilder<'a, S> {
pub fn alt(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_alt(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S> DraftEmbedImageBuilder<'a, S>
where
S: draft_embed_image_state::State,
S::LocalRef: draft_embed_image_state::IsUnset,
{
pub fn local_ref(
mut self,
value: impl Into<draft::DraftEmbedLocalRef<'a>>,
) -> DraftEmbedImageBuilder<'a, draft_embed_image_state::SetLocalRef<S>> {
self._fields.1 = Option::Some(value.into());
DraftEmbedImageBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftEmbedImageBuilder<'a, S>
where
S: draft_embed_image_state::State,
S::LocalRef: draft_embed_image_state::IsSet,
{
pub fn build(self) -> DraftEmbedImage<'a> {
DraftEmbedImage {
alt: self._fields.0,
local_ref: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> DraftEmbedImage<'a> {
DraftEmbedImage {
alt: self._fields.0,
local_ref: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod draft_embed_record_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 Record;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Record = Unset;
}
pub struct SetRecord<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRecord<S> {}
impl<S: State> State for SetRecord<S> {
type Record = Set<members::record>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct record(());
}
}
pub struct DraftEmbedRecordBuilder<'a, S: draft_embed_record_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<StrongRef<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> DraftEmbedRecord<'a> {
pub fn new() -> DraftEmbedRecordBuilder<'a, draft_embed_record_state::Empty> {
DraftEmbedRecordBuilder::new()
}
}
impl<'a> DraftEmbedRecordBuilder<'a, draft_embed_record_state::Empty> {
pub fn new() -> Self {
DraftEmbedRecordBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftEmbedRecordBuilder<'a, S>
where
S: draft_embed_record_state::State,
S::Record: draft_embed_record_state::IsUnset,
{
pub fn record(
mut self,
value: impl Into<StrongRef<'a>>,
) -> DraftEmbedRecordBuilder<'a, draft_embed_record_state::SetRecord<S>> {
self._fields.0 = Option::Some(value.into());
DraftEmbedRecordBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftEmbedRecordBuilder<'a, S>
where
S: draft_embed_record_state::State,
S::Record: draft_embed_record_state::IsSet,
{
pub fn build(self) -> DraftEmbedRecord<'a> {
DraftEmbedRecord {
record: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> DraftEmbedRecord<'a> {
DraftEmbedRecord {
record: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod draft_embed_video_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 LocalRef;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type LocalRef = Unset;
}
pub struct SetLocalRef<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetLocalRef<S> {}
impl<S: State> State for SetLocalRef<S> {
type LocalRef = Set<members::local_ref>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct local_ref(());
}
}
pub struct DraftEmbedVideoBuilder<'a, S: draft_embed_video_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<CowStr<'a>>,
Option<Vec<draft::DraftEmbedCaption<'a>>>,
Option<draft::DraftEmbedLocalRef<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> DraftEmbedVideo<'a> {
pub fn new() -> DraftEmbedVideoBuilder<'a, draft_embed_video_state::Empty> {
DraftEmbedVideoBuilder::new()
}
}
impl<'a> DraftEmbedVideoBuilder<'a, draft_embed_video_state::Empty> {
pub fn new() -> Self {
DraftEmbedVideoBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S: draft_embed_video_state::State> DraftEmbedVideoBuilder<'a, S> {
pub fn alt(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_alt(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.0 = value;
self
}
}
impl<'a, S: draft_embed_video_state::State> DraftEmbedVideoBuilder<'a, S> {
pub fn captions(
mut self,
value: impl Into<Option<Vec<draft::DraftEmbedCaption<'a>>>>,
) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_captions(
mut self,
value: Option<Vec<draft::DraftEmbedCaption<'a>>>,
) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S> DraftEmbedVideoBuilder<'a, S>
where
S: draft_embed_video_state::State,
S::LocalRef: draft_embed_video_state::IsUnset,
{
pub fn local_ref(
mut self,
value: impl Into<draft::DraftEmbedLocalRef<'a>>,
) -> DraftEmbedVideoBuilder<'a, draft_embed_video_state::SetLocalRef<S>> {
self._fields.2 = Option::Some(value.into());
DraftEmbedVideoBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftEmbedVideoBuilder<'a, S>
where
S: draft_embed_video_state::State,
S::LocalRef: draft_embed_video_state::IsSet,
{
pub fn build(self) -> DraftEmbedVideo<'a> {
DraftEmbedVideo {
alt: self._fields.0,
captions: self._fields.1,
local_ref: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> DraftEmbedVideo<'a> {
DraftEmbedVideo {
alt: self._fields.0,
captions: self._fields.1,
local_ref: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod draft_view_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 CreatedAt;
type Draft;
type Id;
type UpdatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Draft = Unset;
type Id = Unset;
type UpdatedAt = Unset;
}
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 CreatedAt = Set<members::created_at>;
type Draft = S::Draft;
type Id = S::Id;
type UpdatedAt = S::UpdatedAt;
}
pub struct SetDraft<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDraft<S> {}
impl<S: State> State for SetDraft<S> {
type CreatedAt = S::CreatedAt;
type Draft = Set<members::draft>;
type Id = S::Id;
type UpdatedAt = S::UpdatedAt;
}
pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetId<S> {}
impl<S: State> State for SetId<S> {
type CreatedAt = S::CreatedAt;
type Draft = S::Draft;
type Id = Set<members::id>;
type UpdatedAt = S::UpdatedAt;
}
pub struct SetUpdatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetUpdatedAt<S> {}
impl<S: State> State for SetUpdatedAt<S> {
type CreatedAt = S::CreatedAt;
type Draft = S::Draft;
type Id = S::Id;
type UpdatedAt = Set<members::updated_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct draft(());
pub struct id(());
pub struct updated_at(());
}
}
pub struct DraftViewBuilder<'a, S: draft_view_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<Datetime>, Option<draft::Draft<'a>>, Option<Tid>, Option<Datetime>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> DraftView<'a> {
pub fn new() -> DraftViewBuilder<'a, draft_view_state::Empty> {
DraftViewBuilder::new()
}
}
impl<'a> DraftViewBuilder<'a, draft_view_state::Empty> {
pub fn new() -> Self {
DraftViewBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftViewBuilder<'a, S>
where
S: draft_view_state::State,
S::CreatedAt: draft_view_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> DraftViewBuilder<'a, draft_view_state::SetCreatedAt<S>> {
self._fields.0 = Option::Some(value.into());
DraftViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftViewBuilder<'a, S>
where
S: draft_view_state::State,
S::Draft: draft_view_state::IsUnset,
{
pub fn draft(
mut self,
value: impl Into<draft::Draft<'a>>,
) -> DraftViewBuilder<'a, draft_view_state::SetDraft<S>> {
self._fields.1 = Option::Some(value.into());
DraftViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftViewBuilder<'a, S>
where
S: draft_view_state::State,
S::Id: draft_view_state::IsUnset,
{
pub fn id(
mut self,
value: impl Into<Tid>,
) -> DraftViewBuilder<'a, draft_view_state::SetId<S>> {
self._fields.2 = Option::Some(value.into());
DraftViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftViewBuilder<'a, S>
where
S: draft_view_state::State,
S::UpdatedAt: draft_view_state::IsUnset,
{
pub fn updated_at(
mut self,
value: impl Into<Datetime>,
) -> DraftViewBuilder<'a, draft_view_state::SetUpdatedAt<S>> {
self._fields.3 = Option::Some(value.into());
DraftViewBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftViewBuilder<'a, S>
where
S: draft_view_state::State,
S::CreatedAt: draft_view_state::IsSet,
S::Draft: draft_view_state::IsSet,
S::Id: draft_view_state::IsSet,
S::UpdatedAt: draft_view_state::IsSet,
{
pub fn build(self) -> DraftView<'a> {
DraftView {
created_at: self._fields.0.unwrap(),
draft: self._fields.1.unwrap(),
id: self._fields.2.unwrap(),
updated_at: self._fields.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> DraftView<'a> {
DraftView {
created_at: self._fields.0.unwrap(),
draft: self._fields.1.unwrap(),
id: self._fields.2.unwrap(),
updated_at: self._fields.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod draft_with_id_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 Id;
type Draft;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Id = Unset;
type Draft = Unset;
}
pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetId<S> {}
impl<S: State> State for SetId<S> {
type Id = Set<members::id>;
type Draft = S::Draft;
}
pub struct SetDraft<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetDraft<S> {}
impl<S: State> State for SetDraft<S> {
type Id = S::Id;
type Draft = Set<members::draft>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct id(());
pub struct draft(());
}
}
pub struct DraftWithIdBuilder<'a, S: draft_with_id_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<draft::Draft<'a>>, Option<Tid>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> DraftWithId<'a> {
pub fn new() -> DraftWithIdBuilder<'a, draft_with_id_state::Empty> {
DraftWithIdBuilder::new()
}
}
impl<'a> DraftWithIdBuilder<'a, draft_with_id_state::Empty> {
pub fn new() -> Self {
DraftWithIdBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftWithIdBuilder<'a, S>
where
S: draft_with_id_state::State,
S::Draft: draft_with_id_state::IsUnset,
{
pub fn draft(
mut self,
value: impl Into<draft::Draft<'a>>,
) -> DraftWithIdBuilder<'a, draft_with_id_state::SetDraft<S>> {
self._fields.0 = Option::Some(value.into());
DraftWithIdBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftWithIdBuilder<'a, S>
where
S: draft_with_id_state::State,
S::Id: draft_with_id_state::IsUnset,
{
pub fn id(
mut self,
value: impl Into<Tid>,
) -> DraftWithIdBuilder<'a, draft_with_id_state::SetId<S>> {
self._fields.1 = Option::Some(value.into());
DraftWithIdBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> DraftWithIdBuilder<'a, S>
where
S: draft_with_id_state::State,
S::Id: draft_with_id_state::IsSet,
S::Draft: draft_with_id_state::IsSet,
{
pub fn build(self) -> DraftWithId<'a> {
DraftWithId {
draft: self._fields.0.unwrap(),
id: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> DraftWithId<'a> {
DraftWithId {
draft: self._fields.0.unwrap(),
id: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}