#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::{AtUri, Cid};
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
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::sh_weaver::actor::ProfileViewBasic;
use crate::sh_weaver::notebook::get_entry_notebooks;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetEntryNotebooks<S: BosStr = DefaultStr> {
pub entry: AtUri<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetEntryNotebooksOutput<S: BosStr = DefaultStr> {
pub notebooks: Vec<get_entry_notebooks::NotebookRef<S>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct NotebookRef<S: BosStr = DefaultStr> {
pub cid: Cid<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub owner: Option<ProfileViewBasic<S>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub title: Option<S>,
pub uri: AtUri<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct GetEntryNotebooksResponse;
impl jacquard_common::xrpc::XrpcResp for GetEntryNotebooksResponse {
const NSID: &'static str = "sh.weaver.notebook.getEntryNotebooks";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = GetEntryNotebooksOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetEntryNotebooks<S> {
const NSID: &'static str = "sh.weaver.notebook.getEntryNotebooks";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Response = GetEntryNotebooksResponse;
}
pub struct GetEntryNotebooksRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetEntryNotebooksRequest {
const PATH: &'static str = "/xrpc/sh.weaver.notebook.getEntryNotebooks";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
type Request<S: BosStr> = GetEntryNotebooks<S>;
type Response = GetEntryNotebooksResponse;
}
impl<S: BosStr> LexiconSchema for NotebookRef<S> {
fn nsid() -> &'static str {
"sh.weaver.notebook.getEntryNotebooks"
}
fn def_name() -> &'static str {
"notebookRef"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_sh_weaver_notebook_getEntryNotebooks()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod get_entry_notebooks_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 Entry;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Entry = Unset;
}
pub struct SetEntry<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEntry<St> {}
impl<St: State> State for SetEntry<St> {
type Entry = Set<members::entry>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct entry(());
}
}
pub struct GetEntryNotebooksBuilder<S: BosStr, St: get_entry_notebooks_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> GetEntryNotebooks<S> {
pub fn new() -> GetEntryNotebooksBuilder<S, get_entry_notebooks_state::Empty> {
GetEntryNotebooksBuilder::new()
}
}
impl<S: BosStr> GetEntryNotebooksBuilder<S, get_entry_notebooks_state::Empty> {
pub fn new() -> Self {
GetEntryNotebooksBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetEntryNotebooksBuilder<S, St>
where
St: get_entry_notebooks_state::State,
St::Entry: get_entry_notebooks_state::IsUnset,
{
pub fn entry(
mut self,
value: impl Into<AtUri<S>>,
) -> GetEntryNotebooksBuilder<S, get_entry_notebooks_state::SetEntry<St>> {
self._fields.0 = Option::Some(value.into());
GetEntryNotebooksBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> GetEntryNotebooksBuilder<S, St>
where
St: get_entry_notebooks_state::State,
St::Entry: get_entry_notebooks_state::IsSet,
{
pub fn build(self) -> GetEntryNotebooks<S> {
GetEntryNotebooks {
entry: self._fields.0.unwrap(),
}
}
}
pub mod notebook_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 Cid;
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Cid = Unset;
type Uri = Unset;
}
pub struct SetCid<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCid<St> {}
impl<St: State> State for SetCid<St> {
type Cid = Set<members::cid>;
type Uri = St::Uri;
}
pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetUri<St> {}
impl<St: State> State for SetUri<St> {
type Cid = St::Cid;
type Uri = Set<members::uri>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct cid(());
pub struct uri(());
}
}
pub struct NotebookRefBuilder<S: BosStr, St: notebook_ref_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<Cid<S>>, Option<ProfileViewBasic<S>>, Option<S>, Option<AtUri<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> NotebookRef<S> {
pub fn new() -> NotebookRefBuilder<S, notebook_ref_state::Empty> {
NotebookRefBuilder::new()
}
}
impl<S: BosStr> NotebookRefBuilder<S, notebook_ref_state::Empty> {
pub fn new() -> Self {
NotebookRefBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotebookRefBuilder<S, St>
where
St: notebook_ref_state::State,
St::Cid: notebook_ref_state::IsUnset,
{
pub fn cid(
mut self,
value: impl Into<Cid<S>>,
) -> NotebookRefBuilder<S, notebook_ref_state::SetCid<St>> {
self._fields.0 = Option::Some(value.into());
NotebookRefBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: notebook_ref_state::State> NotebookRefBuilder<S, St> {
pub fn owner(mut self, value: impl Into<Option<ProfileViewBasic<S>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_owner(mut self, value: Option<ProfileViewBasic<S>>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: notebook_ref_state::State> NotebookRefBuilder<S, St> {
pub fn title(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_title(mut self, value: Option<S>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St> NotebookRefBuilder<S, St>
where
St: notebook_ref_state::State,
St::Uri: notebook_ref_state::IsUnset,
{
pub fn uri(
mut self,
value: impl Into<AtUri<S>>,
) -> NotebookRefBuilder<S, notebook_ref_state::SetUri<St>> {
self._fields.3 = Option::Some(value.into());
NotebookRefBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> NotebookRefBuilder<S, St>
where
St: notebook_ref_state::State,
St::Cid: notebook_ref_state::IsSet,
St::Uri: notebook_ref_state::IsSet,
{
pub fn build(self) -> NotebookRef<S> {
NotebookRef {
cid: self._fields.0.unwrap(),
owner: self._fields.1,
title: self._fields.2,
uri: self._fields.3.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> NotebookRef<S> {
NotebookRef {
cid: self._fields.0.unwrap(),
owner: self._fields.1,
title: self._fields.2,
uri: self._fields.3.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_sh_weaver_notebook_getEntryNotebooks() -> 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("sh.weaver.notebook.getEntryNotebooks"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcQuery(LexXrpcQuery {
parameters: Some(
LexXrpcQueryParameter::Params(LexXrpcParameters {
required: Some(vec![SmolStr::new_static("entry")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("entry"),
LexXrpcParametersProperty::String(LexString {
description: Some(
CowStr::new_static("AT URI of the entry"),
),
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("notebookRef"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Reference to a notebook containing this entry.",
),
),
required: Some(
vec![SmolStr::new_static("uri"), SmolStr::new_static("cid")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("cid"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Cid),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("owner"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static(
"sh.weaver.actor.defs#profileViewBasic",
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map.insert(
SmolStr::new_static("uri"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}