atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.notification.getUnreadCount
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 jacquard_derive::IntoStatic
16)]
17#[serde(rename_all = "camelCase")]
18pub struct GetUnreadCount {
19 #[serde(skip_serializing_if = "std::option::Option::is_none")]
20 pub priority: std::option::Option<bool>,
21 #[serde(skip_serializing_if = "std::option::Option::is_none")]
22 pub seen_at: std::option::Option<jacquard_common::types::string::Datetime>,
23}
24
25pub mod get_unread_count_state {
26
27 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
28 #[allow(unused)]
29 use ::core::marker::PhantomData;
30 mod sealed {
31 pub trait Sealed {}
32 }
33 /// State trait tracking which required fields have been set
34 pub trait State: sealed::Sealed {}
35 /// Empty state - all required fields are unset
36 pub struct Empty(());
37 impl sealed::Sealed for Empty {}
38 impl State for Empty {}
39 /// Marker types for field names
40 #[allow(non_camel_case_types)]
41 pub mod members {}
42}
43
44/// Builder for constructing an instance of this type
45pub struct GetUnreadCountBuilder<S: get_unread_count_state::State> {
46 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
47 __unsafe_private_named: (
48 ::core::option::Option<bool>,
49 ::core::option::Option<jacquard_common::types::string::Datetime>,
50 ),
51}
52
53impl GetUnreadCount {
54 /// Create a new builder for this type
55 pub fn new() -> GetUnreadCountBuilder<get_unread_count_state::Empty> {
56 GetUnreadCountBuilder::new()
57 }
58}
59
60impl GetUnreadCountBuilder<get_unread_count_state::Empty> {
61 /// Create a new builder with all fields unset
62 pub fn new() -> Self {
63 GetUnreadCountBuilder {
64 _phantom_state: ::core::marker::PhantomData,
65 __unsafe_private_named: (None, None),
66 }
67 }
68}
69
70impl<S: get_unread_count_state::State> GetUnreadCountBuilder<S> {
71 /// Set the `priority` field (optional)
72 pub fn priority(mut self, value: impl Into<Option<bool>>) -> Self {
73 self.__unsafe_private_named.0 = value.into();
74 self
75 }
76 /// Set the `priority` field to an Option value (optional)
77 pub fn maybe_priority(mut self, value: Option<bool>) -> Self {
78 self.__unsafe_private_named.0 = value;
79 self
80 }
81}
82
83impl<S: get_unread_count_state::State> GetUnreadCountBuilder<S> {
84 /// Set the `seenAt` field (optional)
85 pub fn seen_at(
86 mut self,
87 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
88 ) -> Self {
89 self.__unsafe_private_named.1 = value.into();
90 self
91 }
92 /// Set the `seenAt` field to an Option value (optional)
93 pub fn maybe_seen_at(
94 mut self,
95 value: Option<jacquard_common::types::string::Datetime>,
96 ) -> Self {
97 self.__unsafe_private_named.1 = value;
98 self
99 }
100}
101
102impl<S> GetUnreadCountBuilder<S>
103where
104 S: get_unread_count_state::State,
105{
106 /// Build the final struct
107 pub fn build(self) -> GetUnreadCount {
108 GetUnreadCount {
109 priority: self.__unsafe_private_named.0,
110 seen_at: self.__unsafe_private_named.1,
111 }
112 }
113}
114
115#[jacquard_derive::lexicon]
116#[derive(
117 serde::Serialize,
118 serde::Deserialize,
119 Debug,
120 Clone,
121 PartialEq,
122 Eq,
123 jacquard_derive::IntoStatic
124)]
125#[serde(rename_all = "camelCase")]
126pub struct GetUnreadCountOutput<'a> {
127 pub count: i64,
128}
129
130/// Response type for
131///app.bsky.notification.getUnreadCount
132pub struct GetUnreadCountResponse;
133impl jacquard_common::xrpc::XrpcResp for GetUnreadCountResponse {
134 const NSID: &'static str = "app.bsky.notification.getUnreadCount";
135 const ENCODING: &'static str = "application/json";
136 type Output<'de> = GetUnreadCountOutput<'de>;
137 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
138}
139
140impl jacquard_common::xrpc::XrpcRequest for GetUnreadCount {
141 const NSID: &'static str = "app.bsky.notification.getUnreadCount";
142 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
143 type Response = GetUnreadCountResponse;
144}
145
146/// Endpoint type for
147///app.bsky.notification.getUnreadCount
148pub struct GetUnreadCountRequest;
149impl jacquard_common::xrpc::XrpcEndpoint for GetUnreadCountRequest {
150 const PATH: &'static str = "/xrpc/app.bsky.notification.getUnreadCount";
151 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
152 type Request<'de> = GetUnreadCount;
153 type Response = GetUnreadCountResponse;
154}