A better Rust ATProto crate
at main 3.4 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: buzz.bookhive.book 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// A book in the user's library 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 Book<'a> { 22 /// The authors of the book (tab separated) 23 #[serde(borrow)] 24 #[builder(into)] 25 pub authors: jacquard_common::CowStr<'a>, 26 /// Cover image of the book 27 #[serde(skip_serializing_if = "std::option::Option::is_none")] 28 #[builder(into)] 29 #[serde(borrow)] 30 pub cover: Option<jacquard_common::types::blob::Blob<'a>>, 31 pub created_at: jacquard_common::types::string::Datetime, 32 /// The date the user finished reading the book 33 #[serde(skip_serializing_if = "std::option::Option::is_none")] 34 #[builder(into)] 35 pub finished_at: Option<jacquard_common::types::string::Datetime>, 36 /// The book's hive id, used to correlate user's books with the hive 37 #[serde(borrow)] 38 #[builder(into)] 39 pub hive_id: jacquard_common::CowStr<'a>, 40 /// The book's review 41 #[serde(skip_serializing_if = "std::option::Option::is_none")] 42 #[builder(into)] 43 #[serde(borrow)] 44 pub review: Option<jacquard_common::CowStr<'a>>, 45 /// Number of stars given to the book (1-10) which will be mapped to 1-5 stars 46 #[serde(skip_serializing_if = "std::option::Option::is_none")] 47 #[builder(into)] 48 pub stars: Option<i64>, 49 /// The date the user started reading the book 50 #[serde(skip_serializing_if = "std::option::Option::is_none")] 51 #[builder(into)] 52 pub started_at: Option<jacquard_common::types::string::Datetime>, 53 #[serde(skip_serializing_if = "std::option::Option::is_none")] 54 #[builder(into)] 55 #[serde(borrow)] 56 pub status: Option<jacquard_common::CowStr<'a>>, 57 /// The title of the book 58 #[serde(borrow)] 59 #[builder(into)] 60 pub title: jacquard_common::CowStr<'a>, 61} 62 63/// Typed wrapper for GetRecord response with this collection's record type. 64#[derive( 65 serde::Serialize, 66 serde::Deserialize, 67 Debug, 68 Clone, 69 PartialEq, 70 Eq, 71 jacquard_derive::IntoStatic 72)] 73#[serde(rename_all = "camelCase")] 74pub struct BookGetRecordOutput<'a> { 75 #[serde(skip_serializing_if = "std::option::Option::is_none")] 76 #[serde(borrow)] 77 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 78 #[serde(borrow)] 79 pub uri: jacquard_common::types::string::AtUri<'a>, 80 #[serde(borrow)] 81 pub value: Book<'a>, 82} 83 84/// Marker type for deserializing records from this collection. 85pub struct BookRecord; 86impl jacquard_common::xrpc::XrpcResp for BookRecord { 87 const NSID: &'static str = "buzz.bookhive.book"; 88 const ENCODING: &'static str = "application/json"; 89 type Output<'de> = BookGetRecordOutput<'de>; 90 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 91} 92 93impl jacquard_common::types::collection::Collection for Book<'_> { 94 const NSID: &'static str = "buzz.bookhive.book"; 95 type Record = BookRecord; 96} 97 98impl From<BookGetRecordOutput<'_>> for Book<'_> { 99 fn from(output: BookGetRecordOutput<'_>) -> Self { 100 use jacquard_common::IntoStatic; 101 output.value.into_static() 102 } 103}