jacquard_api/sh_weaver/edit/
cursor.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.edit.cursor
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10    serde::Serialize,
11    serde::Deserialize,
12    Debug,
13    Clone,
14    PartialEq,
15    Eq,
16    jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct ContainerId<'a> {
20    #[serde(borrow)]
21    pub value: ContainerIdValue<'a>,
22}
23
24#[jacquard_derive::open_union]
25#[derive(
26    serde::Serialize,
27    serde::Deserialize,
28    Debug,
29    Clone,
30    PartialEq,
31    Eq,
32    jacquard_derive::IntoStatic
33)]
34#[serde(tag = "$type")]
35#[serde(bound(deserialize = "'de: 'a"))]
36pub enum ContainerIdValue<'a> {
37    #[serde(rename = "sh.weaver.edit.cursor#normalContainerId")]
38    NormalContainerId(Box<crate::sh_weaver::edit::cursor::NormalContainerId<'a>>),
39    #[serde(rename = "sh.weaver.edit.cursor#rootContainerId")]
40    RootContainerId(Box<crate::sh_weaver::edit::cursor::RootContainerId<'a>>),
41}
42
43#[jacquard_derive::lexicon]
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 CursorSide<'a> {
55    ///The side of an item the cursor is on (left = -1, right = 1, middle = 0)
56    pub value: i64,
57}
58
59#[jacquard_derive::lexicon]
60#[derive(
61    serde::Serialize,
62    serde::Deserialize,
63    Debug,
64    Clone,
65    PartialEq,
66    Eq,
67    jacquard_derive::IntoStatic
68)]
69#[serde(rename_all = "camelCase")]
70pub struct Id<'a> {
71    pub counter: i64,
72    pub peer: i64,
73}
74
75///An edit record for a notebook.
76#[jacquard_derive::lexicon]
77#[derive(
78    serde::Serialize,
79    serde::Deserialize,
80    Debug,
81    Clone,
82    PartialEq,
83    Eq,
84    jacquard_derive::IntoStatic
85)]
86#[serde(rename_all = "camelCase")]
87pub struct Cursor<'a> {
88    #[serde(borrow)]
89    pub container: crate::sh_weaver::edit::cursor::ContainerId<'a>,
90    #[serde(skip_serializing_if = "std::option::Option::is_none")]
91    #[serde(borrow)]
92    pub id: std::option::Option<crate::sh_weaver::edit::cursor::Id<'a>>,
93    #[serde(skip_serializing_if = "std::option::Option::is_none")]
94    #[serde(borrow)]
95    pub side: std::option::Option<crate::sh_weaver::edit::cursor::CursorSide<'a>>,
96}
97
98/// Typed wrapper for GetRecord response with this collection's record type.
99#[derive(
100    serde::Serialize,
101    serde::Deserialize,
102    Debug,
103    Clone,
104    PartialEq,
105    Eq,
106    jacquard_derive::IntoStatic
107)]
108#[serde(rename_all = "camelCase")]
109pub struct CursorGetRecordOutput<'a> {
110    #[serde(skip_serializing_if = "std::option::Option::is_none")]
111    #[serde(borrow)]
112    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
113    #[serde(borrow)]
114    pub uri: jacquard_common::types::string::AtUri<'a>,
115    #[serde(borrow)]
116    pub value: Cursor<'a>,
117}
118
119/// Marker type for deserializing records from this collection.
120pub struct CursorRecord;
121impl jacquard_common::xrpc::XrpcResp for CursorRecord {
122    const NSID: &'static str = "sh.weaver.edit.cursor";
123    const ENCODING: &'static str = "application/json";
124    type Output<'de> = CursorGetRecordOutput<'de>;
125    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
126}
127
128impl jacquard_common::types::collection::Collection for Cursor<'_> {
129    const NSID: &'static str = "sh.weaver.edit.cursor";
130    type Record = CursorRecord;
131}
132
133impl From<CursorGetRecordOutput<'_>> for Cursor<'_> {
134    fn from(output: CursorGetRecordOutput<'_>) -> Self {
135        use jacquard_common::IntoStatic;
136        output.value.into_static()
137    }
138}
139
140#[jacquard_derive::lexicon]
141#[derive(
142    serde::Serialize,
143    serde::Deserialize,
144    Debug,
145    Clone,
146    PartialEq,
147    Eq,
148    jacquard_derive::IntoStatic
149)]
150#[serde(rename_all = "camelCase")]
151pub struct NormalContainerId<'a> {
152    #[serde(borrow)]
153    pub container_type: jacquard_common::CowStr<'a>,
154    pub counter: i64,
155    pub peer: i64,
156}
157
158#[jacquard_derive::lexicon]
159#[derive(
160    serde::Serialize,
161    serde::Deserialize,
162    Debug,
163    Clone,
164    PartialEq,
165    Eq,
166    jacquard_derive::IntoStatic
167)]
168#[serde(rename_all = "camelCase")]
169pub struct RootContainerId<'a> {
170    #[serde(borrow)]
171    pub container_type: jacquard_common::CowStr<'a>,
172    #[serde(borrow)]
173    pub name: jacquard_common::CowStr<'a>,
174}