jacquard_api/sh_weaver/edit/
diff.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.edit.diff
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8/// An edit record for a notebook.
9#[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 Diff<'a> {
22    #[serde(borrow)]
23    pub doc: crate::sh_weaver::edit::DocRef<'a>,
24    #[serde(borrow)]
25    pub root: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
26    #[serde(borrow)]
27    pub snapshot: jacquard_common::types::blob::BlobRef<'a>,
28}
29
30impl<'a> Diff<'a> {
31    pub fn uri(
32        uri: impl Into<jacquard_common::CowStr<'a>>,
33    ) -> Result<
34        jacquard_common::types::uri::RecordUri<'a, DiffRecord>,
35        jacquard_common::types::uri::UriError,
36    > {
37        jacquard_common::types::uri::RecordUri::try_from_uri(
38            jacquard_common::types::string::AtUri::new_cow(uri.into())?,
39        )
40    }
41}
42
43/// Typed wrapper for GetRecord response with this collection's record type.
44#[derive(
45    serde::Serialize,
46    serde::Deserialize,
47    Debug,
48    Clone,
49    PartialEq,
50    Eq,
51    jacquard_derive::IntoStatic
52)]
53#[serde(rename_all = "camelCase")]
54pub struct DiffGetRecordOutput<'a> {
55    #[serde(skip_serializing_if = "std::option::Option::is_none")]
56    #[serde(borrow)]
57    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
58    #[serde(borrow)]
59    pub uri: jacquard_common::types::string::AtUri<'a>,
60    #[serde(borrow)]
61    pub value: Diff<'a>,
62}
63
64impl From<DiffGetRecordOutput<'_>> for Diff<'_> {
65    fn from(output: DiffGetRecordOutput<'_>) -> Self {
66        use jacquard_common::IntoStatic;
67        output.value.into_static()
68    }
69}
70
71impl jacquard_common::types::collection::Collection for Diff<'_> {
72    const NSID: &'static str = "sh.weaver.edit.diff";
73    type Record = DiffRecord;
74}
75
76/// Marker type for deserializing records from this collection.
77#[derive(Debug, serde::Serialize, serde::Deserialize)]
78pub struct DiffRecord;
79impl jacquard_common::xrpc::XrpcResp for DiffRecord {
80    const NSID: &'static str = "sh.weaver.edit.diff";
81    const ENCODING: &'static str = "application/json";
82    type Output<'de> = DiffGetRecordOutput<'de>;
83    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
84}
85
86impl jacquard_common::types::collection::Collection for DiffRecord {
87    const NSID: &'static str = "sh.weaver.edit.diff";
88    type Record = DiffRecord;
89}