1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: buzz.bookhive.hiveBook
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 within the hive
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)]
19#[serde(rename_all = "camelCase")]
20pub struct HiveBook<'a> {
21 ///The authors of the book (tab separated)
22 #[serde(borrow)]
23 pub authors: jacquard_common::CowStr<'a>,
24 ///URL to full-size cover image
25 #[serde(skip_serializing_if = "std::option::Option::is_none")]
26 #[serde(borrow)]
27 pub cover: std::option::Option<jacquard_common::CowStr<'a>>,
28 pub created_at: jacquard_common::types::string::Datetime,
29 ///Book description/summary
30 #[serde(skip_serializing_if = "std::option::Option::is_none")]
31 #[serde(borrow)]
32 pub description: std::option::Option<jacquard_common::CowStr<'a>>,
33 ///The book's hive id, used to correlate user's books with the hive
34 #[serde(borrow)]
35 pub id: jacquard_common::CowStr<'a>,
36 ///Average rating (0-1000)
37 #[serde(skip_serializing_if = "std::option::Option::is_none")]
38 pub rating: std::option::Option<i64>,
39 ///Number of ratings
40 #[serde(skip_serializing_if = "std::option::Option::is_none")]
41 pub ratings_count: std::option::Option<i64>,
42 ///The source service name (e.g. Goodreads)
43 #[serde(skip_serializing_if = "std::option::Option::is_none")]
44 #[serde(borrow)]
45 pub source: std::option::Option<jacquard_common::CowStr<'a>>,
46 ///ID of the book in the source service
47 #[serde(skip_serializing_if = "std::option::Option::is_none")]
48 #[serde(borrow)]
49 pub source_id: std::option::Option<jacquard_common::CowStr<'a>>,
50 ///URL to the book on the source service
51 #[serde(skip_serializing_if = "std::option::Option::is_none")]
52 #[serde(borrow)]
53 pub source_url: std::option::Option<jacquard_common::CowStr<'a>>,
54 ///URL to thumbnail image
55 #[serde(borrow)]
56 pub thumbnail: jacquard_common::CowStr<'a>,
57 ///The title of the book
58 #[serde(borrow)]
59 pub title: jacquard_common::CowStr<'a>,
60 pub updated_at: jacquard_common::types::string::Datetime,
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 HiveBookGetRecordOutput<'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: HiveBook<'a>,
82}
83
84/// Marker type for deserializing records from this collection.
85pub struct HiveBookRecord;
86impl jacquard_common::xrpc::XrpcResp for HiveBookRecord {
87 const NSID: &'static str = "buzz.bookhive.hiveBook";
88 const ENCODING: &'static str = "application/json";
89 type Output<'de> = HiveBookGetRecordOutput<'de>;
90 type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
91}
92
93impl jacquard_common::types::collection::Collection for HiveBook<'_> {
94 const NSID: &'static str = "buzz.bookhive.hiveBook";
95 type Record = HiveBookRecord;
96}
97
98impl From<HiveBookGetRecordOutput<'_>> for HiveBook<'_> {
99 fn from(output: HiveBookGetRecordOutput<'_>) -> Self {
100 use jacquard_common::IntoStatic;
101 output.value.into_static()
102 }
103}