// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.weaver.edit.listDrafts // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. /// Hydrated view of a draft with edit state. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct DraftView<'a> { #[serde(borrow)] pub cid: jacquard_common::types::string::Cid<'a>, pub created_at: jacquard_common::types::string::Datetime, /// Associated edit root if one exists #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub edit_root: std::option::Option< crate::com_atproto::repo::strong_ref::StrongRef<'a>, >, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub last_edit_at: std::option::Option, /// Extracted title if available from edit state #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub title: std::option::Option>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, } 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 {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Cid; type CreatedAt; type Uri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Cid = Unset; type CreatedAt = Unset; type Uri = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { type Cid = Set; type CreatedAt = S::CreatedAt; type Uri = S::Uri; } ///State transition - sets the `created_at` field to Set pub struct SetCreatedAt(PhantomData S>); impl sealed::Sealed for SetCreatedAt {} impl State for SetCreatedAt { type Cid = S::Cid; type CreatedAt = Set; type Uri = S::Uri; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type Cid = S::Cid; type CreatedAt = S::CreatedAt; type Uri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `created_at` field pub struct created_at(()); ///Marker type for the `uri` field pub struct uri(()); } } /// Builder for constructing an instance of this type pub struct DraftViewBuilder<'a, S: draft_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> DraftView<'a> { /// Create a new builder for this type pub fn new() -> DraftViewBuilder<'a, draft_view_state::Empty> { DraftViewBuilder::new() } } impl<'a> DraftViewBuilder<'a, draft_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { DraftViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None, None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DraftViewBuilder<'a, S> where S: draft_view_state::State, S::Cid: draft_view_state::IsUnset, { /// Set the `cid` field (required) pub fn cid( mut self, value: impl Into>, ) -> DraftViewBuilder<'a, draft_view_state::SetCid> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); DraftViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DraftViewBuilder<'a, S> where S: draft_view_state::State, S::CreatedAt: draft_view_state::IsUnset, { /// Set the `createdAt` field (required) pub fn created_at( mut self, value: impl Into, ) -> DraftViewBuilder<'a, draft_view_state::SetCreatedAt> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); DraftViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: draft_view_state::State> DraftViewBuilder<'a, S> { /// Set the `editRoot` field (optional) pub fn edit_root( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `editRoot` field to an Option value (optional) pub fn maybe_edit_root( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S: draft_view_state::State> DraftViewBuilder<'a, S> { /// Set the `lastEditAt` field (optional) pub fn last_edit_at( mut self, value: impl Into>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `lastEditAt` field to an Option value (optional) pub fn maybe_last_edit_at( mut self, value: Option, ) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S: draft_view_state::State> DraftViewBuilder<'a, S> { /// Set the `title` field (optional) pub fn title( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.4 = value.into(); self } /// Set the `title` field to an Option value (optional) pub fn maybe_title(mut self, value: Option>) -> Self { self.__unsafe_private_named.4 = value; self } } impl<'a, S> DraftViewBuilder<'a, S> where S: draft_view_state::State, S::Uri: draft_view_state::IsUnset, { /// Set the `uri` field (required) pub fn uri( mut self, value: impl Into>, ) -> DraftViewBuilder<'a, draft_view_state::SetUri> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); DraftViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DraftViewBuilder<'a, S> where S: draft_view_state::State, S::Cid: draft_view_state::IsSet, S::CreatedAt: draft_view_state::IsSet, S::Uri: draft_view_state::IsSet, { /// Build the final struct pub fn build(self) -> DraftView<'a> { DraftView { cid: self.__unsafe_private_named.0.unwrap(), created_at: self.__unsafe_private_named.1.unwrap(), edit_root: self.__unsafe_private_named.2, last_edit_at: self.__unsafe_private_named.3, title: self.__unsafe_private_named.4, uri: self.__unsafe_private_named.5.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> DraftView<'a> { DraftView { cid: self.__unsafe_private_named.0.unwrap(), created_at: self.__unsafe_private_named.1.unwrap(), edit_root: self.__unsafe_private_named.2, last_edit_at: self.__unsafe_private_named.3, title: self.__unsafe_private_named.4, uri: self.__unsafe_private_named.5.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_sh_weaver_edit_listDrafts() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("sh.weaver.edit.listDrafts"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("draftView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Hydrated view of a draft with edit state.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_common::smol_str::SmolStr::new_static("createdAt") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Cid, ), 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::smol_str::SmolStr::new_static( "createdAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, 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::smol_str::SmolStr::new_static("editRoot"), ::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::smol_str::SmolStr::new_static( "lastEditAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, 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::smol_str::SmolStr::new_static("title"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "Extracted title if available from edit state", ), ), 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::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), 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::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::XrpcQuery(::jacquard_lexicon::lexicon::LexXrpcQuery { description: None, parameters: Some( ::jacquard_lexicon::lexicon::LexXrpcQueryParameter::Params(::jacquard_lexicon::lexicon::LexXrpcParameters { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("actor") ], ), properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("actor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::String(::jacquard_lexicon::lexicon::LexString { description: Some( ::jacquard_common::CowStr::new_static( "DID or handle of the actor", ), ), format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtIdentifier, ), 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::smol_str::SmolStr::new_static("cursor"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::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.insert( ::jacquard_common::smol_str::SmolStr::new_static("limit"), ::jacquard_lexicon::lexicon::LexXrpcParametersProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map }, }), ), output: None, errors: None, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DraftView<'a> { fn nsid() -> &'static str { "sh.weaver.edit.listDrafts" } fn def_name() -> &'static str { "draftView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_edit_listDrafts() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ListDrafts<'a> { #[serde(borrow)] pub actor: jacquard_common::types::ident::AtIdentifier<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cursor: std::option::Option>, ///(default: 50, min: 1, max: 100) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub limit: std::option::Option, } pub mod list_drafts_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Actor; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Actor = Unset; } ///State transition - sets the `actor` field to Set pub struct SetActor(PhantomData S>); impl sealed::Sealed for SetActor {} impl State for SetActor { type Actor = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `actor` field pub struct actor(()); } } /// Builder for constructing an instance of this type pub struct ListDraftsBuilder<'a, S: list_drafts_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ListDrafts<'a> { /// Create a new builder for this type pub fn new() -> ListDraftsBuilder<'a, list_drafts_state::Empty> { ListDraftsBuilder::new() } } impl<'a> ListDraftsBuilder<'a, list_drafts_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ListDraftsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ListDraftsBuilder<'a, S> where S: list_drafts_state::State, S::Actor: list_drafts_state::IsUnset, { /// Set the `actor` field (required) pub fn actor( mut self, value: impl Into>, ) -> ListDraftsBuilder<'a, list_drafts_state::SetActor> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ListDraftsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: list_drafts_state::State> ListDraftsBuilder<'a, S> { /// Set the `cursor` field (optional) pub fn cursor( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.1 = value.into(); self } /// Set the `cursor` field to an Option value (optional) pub fn maybe_cursor(mut self, value: Option>) -> Self { self.__unsafe_private_named.1 = value; self } } impl<'a, S: list_drafts_state::State> ListDraftsBuilder<'a, S> { /// Set the `limit` field (optional) pub fn limit(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `limit` field to an Option value (optional) pub fn maybe_limit(mut self, value: Option) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S> ListDraftsBuilder<'a, S> where S: list_drafts_state::State, S::Actor: list_drafts_state::IsSet, { /// Build the final struct pub fn build(self) -> ListDrafts<'a> { ListDrafts { actor: self.__unsafe_private_named.0.unwrap(), cursor: self.__unsafe_private_named.1, limit: self.__unsafe_private_named.2, } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ListDraftsOutput<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cursor: std::option::Option>, #[serde(borrow)] pub drafts: Vec>, } /// Response type for ///sh.weaver.edit.listDrafts pub struct ListDraftsResponse; impl jacquard_common::xrpc::XrpcResp for ListDraftsResponse { const NSID: &'static str = "sh.weaver.edit.listDrafts"; const ENCODING: &'static str = "application/json"; type Output<'de> = ListDraftsOutput<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for ListDrafts<'a> { const NSID: &'static str = "sh.weaver.edit.listDrafts"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Response = ListDraftsResponse; } /// Endpoint type for ///sh.weaver.edit.listDrafts pub struct ListDraftsRequest; impl jacquard_common::xrpc::XrpcEndpoint for ListDraftsRequest { const PATH: &'static str = "/xrpc/sh.weaver.edit.listDrafts"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request<'de> = ListDrafts<'de>; type Response = ListDraftsResponse; }