1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: buzz.bookhive.getBook
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[derive(
9 serde::Serialize,
10 serde::Deserialize,
11 Debug,
12 Clone,
13 PartialEq,
14 Eq,
15 bon::Builder,
16 jacquard_derive::IntoStatic
17)]
18#[builder(start_fn = new)]
19#[serde(rename_all = "camelCase")]
20pub struct GetBook<'a> {
21 #[serde(borrow)]
22 #[builder(into)]
23 pub id: jacquard_common::CowStr<'a>,
24}
25
26#[jacquard_derive::lexicon]
27#[derive(
28 serde::Serialize,
29 serde::Deserialize,
30 Debug,
31 Clone,
32 PartialEq,
33 Eq,
34 jacquard_derive::IntoStatic
35)]
36#[serde(rename_all = "camelCase")]
37pub struct GetBookOutput<'a> {
38 /// The hive book's info
39 #[serde(borrow)]
40 pub book: jacquard_common::types::value::Data<'a>,
41 /// Comments on the book
42 #[serde(borrow)]
43 pub comments: Vec<crate::buzz_bookhive::Comment<'a>>,
44 /// Cover image of the book
45 #[serde(skip_serializing_if = "std::option::Option::is_none")]
46 #[serde(borrow)]
47 pub cover: std::option::Option<jacquard_common::types::blob::Blob<'a>>,
48 #[serde(skip_serializing_if = "std::option::Option::is_none")]
49 pub created_at: std::option::Option<jacquard_common::types::string::Datetime>,
50 /// The date the user finished reading the book
51 #[serde(skip_serializing_if = "std::option::Option::is_none")]
52 pub finished_at: std::option::Option<jacquard_common::types::string::Datetime>,
53 /// The book's review
54 #[serde(skip_serializing_if = "std::option::Option::is_none")]
55 #[serde(borrow)]
56 pub review: std::option::Option<jacquard_common::CowStr<'a>>,
57 /// Reviews of the book
58 #[serde(borrow)]
59 pub reviews: Vec<crate::buzz_bookhive::Review<'a>>,
60 /// Number of stars given to the book (1-10) which will be mapped to 1-5 stars
61 #[serde(skip_serializing_if = "std::option::Option::is_none")]
62 pub stars: std::option::Option<i64>,
63 /// The date the user started reading the book
64 #[serde(skip_serializing_if = "std::option::Option::is_none")]
65 pub started_at: std::option::Option<jacquard_common::types::string::Datetime>,
66 #[serde(skip_serializing_if = "std::option::Option::is_none")]
67 #[serde(borrow)]
68 pub status: std::option::Option<jacquard_common::CowStr<'a>>,
69}
70
71///Response type for
72///buzz.bookhive.getBook
73pub struct GetBookResponse;
74impl jacquard_common::xrpc::XrpcResp for GetBookResponse {
75 const NSID: &'static str = "buzz.bookhive.getBook";
76 const ENCODING: &'static str = "application/json";
77 type Output<'de> = GetBookOutput<'de>;
78 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
79}
80
81impl<'a> jacquard_common::xrpc::XrpcRequest for GetBook<'a> {
82 const NSID: &'static str = "buzz.bookhive.getBook";
83 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
84 type Response = GetBookResponse;
85}
86
87///Endpoint type for
88///buzz.bookhive.getBook
89pub struct GetBookRequest;
90impl jacquard_common::xrpc::XrpcEndpoint for GetBookRequest {
91 const PATH: &'static str = "/xrpc/buzz.bookhive.getBook";
92 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
93 type Request<'de> = GetBook<'de>;
94 type Response = GetBookResponse;
95}