A better Rust ATProto crate
at main 3.2 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: sh.weaver.notebook.authors 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// A single author in a Weaver 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 AuthorListItem<'a> { 22 #[serde(skip_serializing_if = "std::option::Option::is_none")] 23 #[builder(into)] 24 pub index: Option<i64>, 25 #[serde(skip_serializing_if = "std::option::Option::is_none")] 26 #[builder(into)] 27 #[serde(borrow)] 28 pub profile: Option<AuthorListItemProfile<'a>>, 29} 30 31#[jacquard_derive::open_union] 32#[derive( 33 serde::Serialize, 34 serde::Deserialize, 35 Debug, 36 Clone, 37 PartialEq, 38 Eq, 39 jacquard_derive::IntoStatic 40)] 41#[serde(tag = "$type")] 42#[serde(bound(deserialize = "'de: 'a"))] 43pub enum AuthorListItemProfile<'a> { 44 #[serde(rename = "app.bsky.actor.defs#profileViewBasic")] 45 ProfileViewBasic(Box<crate::app_bsky::actor::ProfileViewBasic<'a>>), 46 #[serde(rename = "sh.weaver.actor.defs#profileView")] 47 ProfileView(Box<crate::sh_weaver::actor::ProfileView<'a>>), 48} 49 50/// Authors of a Weaver notebook. 51#[jacquard_derive::lexicon] 52#[derive( 53 serde::Serialize, 54 serde::Deserialize, 55 Debug, 56 Clone, 57 PartialEq, 58 Eq, 59 jacquard_derive::IntoStatic, 60 bon::Builder 61)] 62#[serde(rename_all = "camelCase")] 63pub struct Authors<'a> { 64 #[serde(borrow)] 65 pub author_list: Vec<crate::sh_weaver::notebook::authors::AuthorListItem<'a>>, 66 #[serde(skip_serializing_if = "std::option::Option::is_none")] 67 #[builder(into)] 68 pub created_at: Option<jacquard_common::types::string::Datetime>, 69} 70 71/// Typed wrapper for GetRecord response with this collection's record type. 72#[derive( 73 serde::Serialize, 74 serde::Deserialize, 75 Debug, 76 Clone, 77 PartialEq, 78 Eq, 79 jacquard_derive::IntoStatic 80)] 81#[serde(rename_all = "camelCase")] 82pub struct AuthorsGetRecordOutput<'a> { 83 #[serde(skip_serializing_if = "std::option::Option::is_none")] 84 #[serde(borrow)] 85 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 86 #[serde(borrow)] 87 pub uri: jacquard_common::types::string::AtUri<'a>, 88 #[serde(borrow)] 89 pub value: Authors<'a>, 90} 91 92/// Marker type for deserializing records from this collection. 93pub struct AuthorsRecord; 94impl jacquard_common::xrpc::XrpcResp for AuthorsRecord { 95 const NSID: &'static str = "sh.weaver.notebook.authors"; 96 const ENCODING: &'static str = "application/json"; 97 type Output<'de> = AuthorsGetRecordOutput<'de>; 98 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 99} 100 101impl jacquard_common::types::collection::Collection for Authors<'_> { 102 const NSID: &'static str = "sh.weaver.notebook.authors"; 103 type Record = AuthorsRecord; 104} 105 106impl From<AuthorsGetRecordOutput<'_>> for Authors<'_> { 107 fn from(output: AuthorsGetRecordOutput<'_>) -> Self { 108 use jacquard_common::IntoStatic; 109 output.value.into_static() 110 } 111}