Skip to main content

jacquard_api/app_bsky/notification/
get_unread_count.rs

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#[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
34/// Response type for app.bsky.notification.getUnreadCount
35pub 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
49/// Endpoint type for app.bsky.notification.getUnreadCount
50pub 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    /// State trait tracking which required fields have been set
67    pub trait State: sealed::Sealed {}
68    /// Empty state - all required fields are unset
69    pub struct Empty(());
70    impl sealed::Sealed for Empty {}
71    impl State for Empty {}
72    /// Marker types for field names
73    #[allow(non_camel_case_types)]
74    pub mod members {}
75}
76
77/// Builder for constructing an instance of this type
78pub struct GetUnreadCountBuilder<S: get_unread_count_state::State> {
79    _state: PhantomData<fn() -> S>,
80    _fields: (Option<bool>, Option<Datetime>),
81}
82
83impl GetUnreadCount {
84    /// Create a new builder for this type
85    pub fn new() -> GetUnreadCountBuilder<get_unread_count_state::Empty> {
86        GetUnreadCountBuilder::new()
87    }
88}
89
90impl GetUnreadCountBuilder<get_unread_count_state::Empty> {
91    /// Create a new builder with all fields unset
92    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    /// Set the `priority` field (optional)
102    pub fn priority(mut self, value: impl Into<Option<bool>>) -> Self {
103        self._fields.0 = value.into();
104        self
105    }
106    /// Set the `priority` field to an Option value (optional)
107    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    /// Set the `seenAt` field (optional)
115    pub fn seen_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
116        self._fields.1 = value.into();
117        self
118    }
119    /// Set the `seenAt` field to an Option value (optional)
120    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    /// Build the final struct
131    pub fn build(self) -> GetUnreadCount {
132        GetUnreadCount {
133            priority: self._fields.0,
134            seen_at: self._fields.1,
135        }
136    }
137}