jacquard_api/sh_weaver/notification/
get_unread_count.rs1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::types::string::Datetime;
14use jacquard_derive::{IntoStatic, lexicon};
15use serde::{Serialize, Deserialize};
16
17#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
18#[serde(rename_all = "camelCase")]
19pub struct GetUnreadCount {
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub seen_at: Option<Datetime>,
22}
23
24
25#[lexicon]
26#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
27#[serde(rename_all = "camelCase")]
28pub struct GetUnreadCountOutput<'a> {
29 pub count: i64,
30}
31
32pub struct GetUnreadCountResponse;
34impl jacquard_common::xrpc::XrpcResp for GetUnreadCountResponse {
35 const NSID: &'static str = "sh.weaver.notification.getUnreadCount";
36 const ENCODING: &'static str = "application/json";
37 type Output<'de> = GetUnreadCountOutput<'de>;
38 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
39}
40
41impl jacquard_common::xrpc::XrpcRequest for GetUnreadCount {
42 const NSID: &'static str = "sh.weaver.notification.getUnreadCount";
43 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
44 type Response = GetUnreadCountResponse;
45}
46
47pub struct GetUnreadCountRequest;
49impl jacquard_common::xrpc::XrpcEndpoint for GetUnreadCountRequest {
50 const PATH: &'static str = "/xrpc/sh.weaver.notification.getUnreadCount";
51 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
52 type Request<'de> = GetUnreadCount;
53 type Response = GetUnreadCountResponse;
54}
55
56pub mod get_unread_count_state {
57
58 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
59 #[allow(unused)]
60 use ::core::marker::PhantomData;
61 mod sealed {
62 pub trait Sealed {}
63 }
64 pub trait State: sealed::Sealed {}
66 pub struct Empty(());
68 impl sealed::Sealed for Empty {}
69 impl State for Empty {}
70 #[allow(non_camel_case_types)]
72 pub mod members {}
73}
74
75pub struct GetUnreadCountBuilder<S: get_unread_count_state::State> {
77 _state: PhantomData<fn() -> S>,
78 _fields: (Option<Datetime>,),
79}
80
81impl GetUnreadCount {
82 pub fn new() -> GetUnreadCountBuilder<get_unread_count_state::Empty> {
84 GetUnreadCountBuilder::new()
85 }
86}
87
88impl GetUnreadCountBuilder<get_unread_count_state::Empty> {
89 pub fn new() -> Self {
91 GetUnreadCountBuilder {
92 _state: PhantomData,
93 _fields: (None,),
94 }
95 }
96}
97
98impl<S: get_unread_count_state::State> GetUnreadCountBuilder<S> {
99 pub fn seen_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
101 self._fields.0 = value.into();
102 self
103 }
104 pub fn maybe_seen_at(mut self, value: Option<Datetime>) -> Self {
106 self._fields.0 = value;
107 self
108 }
109}
110
111impl<S> GetUnreadCountBuilder<S>
112where
113 S: get_unread_count_state::State,
114{
115 pub fn build(self) -> GetUnreadCount {
117 GetUnreadCount {
118 seen_at: self._fields.0,
119 }
120 }
121}