jacquard_api/sh_weaver/notebook/
chapter.rs1#[jacquard_derive::lexicon]
10#[derive(
11 serde::Serialize,
12 serde::Deserialize,
13 Debug,
14 Clone,
15 PartialEq,
16 Eq,
17 jacquard_derive::IntoStatic,
18 bon::Builder
19)]
20#[serde(rename_all = "camelCase")]
21pub struct Chapter<'a> {
22 #[serde(skip_serializing_if = "std::option::Option::is_none")]
24 #[builder(into)]
25 pub created_at: Option<jacquard_common::types::string::Datetime>,
26 #[serde(borrow)]
27 pub entry_list: Vec<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
28 #[serde(borrow)]
30 pub notebook: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
31 #[serde(skip_serializing_if = "std::option::Option::is_none")]
32 #[builder(into)]
33 #[serde(borrow)]
34 pub tags: Option<crate::sh_weaver::notebook::Tags<'a>>,
35 #[serde(skip_serializing_if = "std::option::Option::is_none")]
36 #[builder(into)]
37 #[serde(borrow)]
38 pub title: Option<crate::sh_weaver::notebook::Title<'a>>,
39}
40
41impl<'a> Chapter<'a> {
42 pub fn uri(
43 uri: impl Into<jacquard_common::CowStr<'a>>,
44 ) -> Result<
45 jacquard_common::types::uri::RecordUri<'a, ChapterRecord>,
46 jacquard_common::types::uri::UriError,
47 > {
48 jacquard_common::types::uri::RecordUri::try_from_uri(
49 jacquard_common::types::string::AtUri::new_cow(uri.into())?,
50 )
51 }
52}
53
54#[derive(
56 serde::Serialize,
57 serde::Deserialize,
58 Debug,
59 Clone,
60 PartialEq,
61 Eq,
62 jacquard_derive::IntoStatic
63)]
64#[serde(rename_all = "camelCase")]
65pub struct ChapterGetRecordOutput<'a> {
66 #[serde(skip_serializing_if = "std::option::Option::is_none")]
67 #[serde(borrow)]
68 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
69 #[serde(borrow)]
70 pub uri: jacquard_common::types::string::AtUri<'a>,
71 #[serde(borrow)]
72 pub value: Chapter<'a>,
73}
74
75impl From<ChapterGetRecordOutput<'_>> for Chapter<'_> {
76 fn from(output: ChapterGetRecordOutput<'_>) -> Self {
77 use jacquard_common::IntoStatic;
78 output.value.into_static()
79 }
80}
81
82impl jacquard_common::types::collection::Collection for Chapter<'_> {
83 const NSID: &'static str = "sh.weaver.notebook.chapter";
84 type Record = ChapterRecord;
85}
86
87#[derive(Debug, serde::Serialize, serde::Deserialize)]
89pub struct ChapterRecord;
90impl jacquard_common::xrpc::XrpcResp for ChapterRecord {
91 const NSID: &'static str = "sh.weaver.notebook.chapter";
92 const ENCODING: &'static str = "application/json";
93 type Output<'de> = ChapterGetRecordOutput<'de>;
94 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
95}
96
97impl jacquard_common::types::collection::Collection for ChapterRecord {
98 const NSID: &'static str = "sh.weaver.notebook.chapter";
99 type Record = ChapterRecord;
100}