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