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