jacquard_api/app_bsky/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 priority: Option<bool>,
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub seen_at: Option<Datetime>,
24}
25
26
27#[lexicon]
28#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
29#[serde(rename_all = "camelCase")]
30pub struct GetUnreadCountOutput<'a> {
31 pub count: i64,
32}
33
34pub struct GetUnreadCountResponse;
36impl jacquard_common::xrpc::XrpcResp for GetUnreadCountResponse {
37 const NSID: &'static str = "app.bsky.notification.getUnreadCount";
38 const ENCODING: &'static str = "application/json";
39 type Output<'de> = GetUnreadCountOutput<'de>;
40 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
41}
42
43impl jacquard_common::xrpc::XrpcRequest for GetUnreadCount {
44 const NSID: &'static str = "app.bsky.notification.getUnreadCount";
45 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
46 type Response = GetUnreadCountResponse;
47}
48
49pub struct GetUnreadCountRequest;
51impl jacquard_common::xrpc::XrpcEndpoint for GetUnreadCountRequest {
52 const PATH: &'static str = "/xrpc/app.bsky.notification.getUnreadCount";
53 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
54 type Request<'de> = GetUnreadCount;
55 type Response = GetUnreadCountResponse;
56}
57
58pub mod get_unread_count_state {
59
60 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
61 #[allow(unused)]
62 use ::core::marker::PhantomData;
63 mod sealed {
64 pub trait Sealed {}
65 }
66 pub trait State: sealed::Sealed {}
68 pub struct Empty(());
70 impl sealed::Sealed for Empty {}
71 impl State for Empty {}
72 #[allow(non_camel_case_types)]
74 pub mod members {}
75}
76
77pub struct GetUnreadCountBuilder<S: get_unread_count_state::State> {
79 _state: PhantomData<fn() -> S>,
80 _fields: (Option<bool>, Option<Datetime>),
81}
82
83impl GetUnreadCount {
84 pub fn new() -> GetUnreadCountBuilder<get_unread_count_state::Empty> {
86 GetUnreadCountBuilder::new()
87 }
88}
89
90impl GetUnreadCountBuilder<get_unread_count_state::Empty> {
91 pub fn new() -> Self {
93 GetUnreadCountBuilder {
94 _state: PhantomData,
95 _fields: (None, None),
96 }
97 }
98}
99
100impl<S: get_unread_count_state::State> GetUnreadCountBuilder<S> {
101 pub fn priority(mut self, value: impl Into<Option<bool>>) -> Self {
103 self._fields.0 = value.into();
104 self
105 }
106 pub fn maybe_priority(mut self, value: Option<bool>) -> Self {
108 self._fields.0 = value;
109 self
110 }
111}
112
113impl<S: get_unread_count_state::State> GetUnreadCountBuilder<S> {
114 pub fn seen_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
116 self._fields.1 = value.into();
117 self
118 }
119 pub fn maybe_seen_at(mut self, value: Option<Datetime>) -> Self {
121 self._fields.1 = value;
122 self
123 }
124}
125
126impl<S> GetUnreadCountBuilder<S>
127where
128 S: get_unread_count_state::State,
129{
130 pub fn build(self) -> GetUnreadCount {
132 GetUnreadCount {
133 priority: self._fields.0,
134 seen_at: self._fields.1,
135 }
136 }
137}