atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.notification.listNotifications
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 ListNotifications<'a> {
19 #[serde(skip_serializing_if = "std::option::Option::is_none")]
20 #[serde(borrow)]
21 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
22 ///(default: 50, min: 1, max: 100)
23 #[serde(skip_serializing_if = "std::option::Option::is_none")]
24 pub limit: std::option::Option<i64>,
25 #[serde(skip_serializing_if = "std::option::Option::is_none")]
26 #[serde(borrow)]
27 pub reasons: std::option::Option<Vec<jacquard_common::CowStr<'a>>>,
28 #[serde(skip_serializing_if = "std::option::Option::is_none")]
29 pub seen_at: std::option::Option<jacquard_common::types::string::Datetime>,
30}
31
32pub mod list_notifications_state {
33
34 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
35 #[allow(unused)]
36 use ::core::marker::PhantomData;
37 mod sealed {
38 pub trait Sealed {}
39 }
40 /// State trait tracking which required fields have been set
41 pub trait State: sealed::Sealed {}
42 /// Empty state - all required fields are unset
43 pub struct Empty(());
44 impl sealed::Sealed for Empty {}
45 impl State for Empty {}
46 /// Marker types for field names
47 #[allow(non_camel_case_types)]
48 pub mod members {}
49}
50
51/// Builder for constructing an instance of this type
52pub struct ListNotificationsBuilder<'a, S: list_notifications_state::State> {
53 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
54 __unsafe_private_named: (
55 ::core::option::Option<jacquard_common::CowStr<'a>>,
56 ::core::option::Option<i64>,
57 ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>,
58 ::core::option::Option<jacquard_common::types::string::Datetime>,
59 ),
60 _phantom: ::core::marker::PhantomData<&'a ()>,
61}
62
63impl<'a> ListNotifications<'a> {
64 /// Create a new builder for this type
65 pub fn new() -> ListNotificationsBuilder<'a, list_notifications_state::Empty> {
66 ListNotificationsBuilder::new()
67 }
68}
69
70impl<'a> ListNotificationsBuilder<'a, list_notifications_state::Empty> {
71 /// Create a new builder with all fields unset
72 pub fn new() -> Self {
73 ListNotificationsBuilder {
74 _phantom_state: ::core::marker::PhantomData,
75 __unsafe_private_named: (None, None, None, None),
76 _phantom: ::core::marker::PhantomData,
77 }
78 }
79}
80
81impl<'a, S: list_notifications_state::State> ListNotificationsBuilder<'a, S> {
82 /// Set the `cursor` field (optional)
83 pub fn cursor(
84 mut self,
85 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
86 ) -> Self {
87 self.__unsafe_private_named.0 = value.into();
88 self
89 }
90 /// Set the `cursor` field to an Option value (optional)
91 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
92 self.__unsafe_private_named.0 = value;
93 self
94 }
95}
96
97impl<'a, S: list_notifications_state::State> ListNotificationsBuilder<'a, S> {
98 /// Set the `limit` field (optional)
99 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
100 self.__unsafe_private_named.1 = value.into();
101 self
102 }
103 /// Set the `limit` field to an Option value (optional)
104 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
105 self.__unsafe_private_named.1 = value;
106 self
107 }
108}
109
110impl<'a, S: list_notifications_state::State> ListNotificationsBuilder<'a, S> {
111 /// Set the `reasons` field (optional)
112 pub fn reasons(
113 mut self,
114 value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>,
115 ) -> Self {
116 self.__unsafe_private_named.2 = value.into();
117 self
118 }
119 /// Set the `reasons` field to an Option value (optional)
120 pub fn maybe_reasons(
121 mut self,
122 value: Option<Vec<jacquard_common::CowStr<'a>>>,
123 ) -> Self {
124 self.__unsafe_private_named.2 = value;
125 self
126 }
127}
128
129impl<'a, S: list_notifications_state::State> ListNotificationsBuilder<'a, S> {
130 /// Set the `seenAt` field (optional)
131 pub fn seen_at(
132 mut self,
133 value: impl Into<Option<jacquard_common::types::string::Datetime>>,
134 ) -> Self {
135 self.__unsafe_private_named.3 = value.into();
136 self
137 }
138 /// Set the `seenAt` field to an Option value (optional)
139 pub fn maybe_seen_at(
140 mut self,
141 value: Option<jacquard_common::types::string::Datetime>,
142 ) -> Self {
143 self.__unsafe_private_named.3 = value;
144 self
145 }
146}
147
148impl<'a, S> ListNotificationsBuilder<'a, S>
149where
150 S: list_notifications_state::State,
151{
152 /// Build the final struct
153 pub fn build(self) -> ListNotifications<'a> {
154 ListNotifications {
155 cursor: self.__unsafe_private_named.0,
156 limit: self.__unsafe_private_named.1,
157 reasons: self.__unsafe_private_named.2,
158 seen_at: self.__unsafe_private_named.3,
159 }
160 }
161}
162
163#[jacquard_derive::lexicon]
164#[derive(
165 serde::Serialize,
166 serde::Deserialize,
167 Debug,
168 Clone,
169 PartialEq,
170 Eq,
171 jacquard_derive::IntoStatic
172)]
173#[serde(rename_all = "camelCase")]
174pub struct ListNotificationsOutput<'a> {
175 #[serde(skip_serializing_if = "std::option::Option::is_none")]
176 #[serde(borrow)]
177 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
178 #[serde(borrow)]
179 pub notifications: Vec<crate::sh_weaver::notification::Notification<'a>>,
180 #[serde(skip_serializing_if = "std::option::Option::is_none")]
181 pub seen_at: std::option::Option<jacquard_common::types::string::Datetime>,
182}
183
184/// Response type for
185///sh.weaver.notification.listNotifications
186pub struct ListNotificationsResponse;
187impl jacquard_common::xrpc::XrpcResp for ListNotificationsResponse {
188 const NSID: &'static str = "sh.weaver.notification.listNotifications";
189 const ENCODING: &'static str = "application/json";
190 type Output<'de> = ListNotificationsOutput<'de>;
191 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
192}
193
194impl<'a> jacquard_common::xrpc::XrpcRequest for ListNotifications<'a> {
195 const NSID: &'static str = "sh.weaver.notification.listNotifications";
196 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
197 type Response = ListNotificationsResponse;
198}
199
200/// Endpoint type for
201///sh.weaver.notification.listNotifications
202pub struct ListNotificationsRequest;
203impl jacquard_common::xrpc::XrpcEndpoint for ListNotificationsRequest {
204 const PATH: &'static str = "/xrpc/sh.weaver.notification.listNotifications";
205 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
206 type Request<'de> = ListNotifications<'de>;
207 type Response = ListNotificationsResponse;
208}