atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.unspecced.searchActorsSkeleton
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 SearchActorsSkeleton<'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: 25, min: 1, max: 100)
23 #[serde(skip_serializing_if = "std::option::Option::is_none")]
24 pub limit: std::option::Option<i64>,
25 #[serde(borrow)]
26 pub q: jacquard_common::CowStr<'a>,
27 #[serde(skip_serializing_if = "std::option::Option::is_none")]
28 pub typeahead: std::option::Option<bool>,
29 #[serde(skip_serializing_if = "std::option::Option::is_none")]
30 #[serde(borrow)]
31 pub viewer: std::option::Option<jacquard_common::types::string::Did<'a>>,
32}
33
34pub mod search_actors_skeleton_state {
35
36 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
37 #[allow(unused)]
38 use ::core::marker::PhantomData;
39 mod sealed {
40 pub trait Sealed {}
41 }
42 /// State trait tracking which required fields have been set
43 pub trait State: sealed::Sealed {
44 type Q;
45 }
46 /// Empty state - all required fields are unset
47 pub struct Empty(());
48 impl sealed::Sealed for Empty {}
49 impl State for Empty {
50 type Q = Unset;
51 }
52 ///State transition - sets the `q` field to Set
53 pub struct SetQ<S: State = Empty>(PhantomData<fn() -> S>);
54 impl<S: State> sealed::Sealed for SetQ<S> {}
55 impl<S: State> State for SetQ<S> {
56 type Q = Set<members::q>;
57 }
58 /// Marker types for field names
59 #[allow(non_camel_case_types)]
60 pub mod members {
61 ///Marker type for the `q` field
62 pub struct q(());
63 }
64}
65
66/// Builder for constructing an instance of this type
67pub struct SearchActorsSkeletonBuilder<'a, S: search_actors_skeleton_state::State> {
68 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
69 __unsafe_private_named: (
70 ::core::option::Option<jacquard_common::CowStr<'a>>,
71 ::core::option::Option<i64>,
72 ::core::option::Option<jacquard_common::CowStr<'a>>,
73 ::core::option::Option<bool>,
74 ::core::option::Option<jacquard_common::types::string::Did<'a>>,
75 ),
76 _phantom: ::core::marker::PhantomData<&'a ()>,
77}
78
79impl<'a> SearchActorsSkeleton<'a> {
80 /// Create a new builder for this type
81 pub fn new() -> SearchActorsSkeletonBuilder<
82 'a,
83 search_actors_skeleton_state::Empty,
84 > {
85 SearchActorsSkeletonBuilder::new()
86 }
87}
88
89impl<'a> SearchActorsSkeletonBuilder<'a, search_actors_skeleton_state::Empty> {
90 /// Create a new builder with all fields unset
91 pub fn new() -> Self {
92 SearchActorsSkeletonBuilder {
93 _phantom_state: ::core::marker::PhantomData,
94 __unsafe_private_named: (None, None, None, None, None),
95 _phantom: ::core::marker::PhantomData,
96 }
97 }
98}
99
100impl<'a, S: search_actors_skeleton_state::State> SearchActorsSkeletonBuilder<'a, S> {
101 /// Set the `cursor` field (optional)
102 pub fn cursor(
103 mut self,
104 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
105 ) -> Self {
106 self.__unsafe_private_named.0 = value.into();
107 self
108 }
109 /// Set the `cursor` field to an Option value (optional)
110 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
111 self.__unsafe_private_named.0 = value;
112 self
113 }
114}
115
116impl<'a, S: search_actors_skeleton_state::State> SearchActorsSkeletonBuilder<'a, S> {
117 /// Set the `limit` field (optional)
118 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
119 self.__unsafe_private_named.1 = value.into();
120 self
121 }
122 /// Set the `limit` field to an Option value (optional)
123 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
124 self.__unsafe_private_named.1 = value;
125 self
126 }
127}
128
129impl<'a, S> SearchActorsSkeletonBuilder<'a, S>
130where
131 S: search_actors_skeleton_state::State,
132 S::Q: search_actors_skeleton_state::IsUnset,
133{
134 /// Set the `q` field (required)
135 pub fn q(
136 mut self,
137 value: impl Into<jacquard_common::CowStr<'a>>,
138 ) -> SearchActorsSkeletonBuilder<'a, search_actors_skeleton_state::SetQ<S>> {
139 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
140 SearchActorsSkeletonBuilder {
141 _phantom_state: ::core::marker::PhantomData,
142 __unsafe_private_named: self.__unsafe_private_named,
143 _phantom: ::core::marker::PhantomData,
144 }
145 }
146}
147
148impl<'a, S: search_actors_skeleton_state::State> SearchActorsSkeletonBuilder<'a, S> {
149 /// Set the `typeahead` field (optional)
150 pub fn typeahead(mut self, value: impl Into<Option<bool>>) -> Self {
151 self.__unsafe_private_named.3 = value.into();
152 self
153 }
154 /// Set the `typeahead` field to an Option value (optional)
155 pub fn maybe_typeahead(mut self, value: Option<bool>) -> Self {
156 self.__unsafe_private_named.3 = value;
157 self
158 }
159}
160
161impl<'a, S: search_actors_skeleton_state::State> SearchActorsSkeletonBuilder<'a, S> {
162 /// Set the `viewer` field (optional)
163 pub fn viewer(
164 mut self,
165 value: impl Into<Option<jacquard_common::types::string::Did<'a>>>,
166 ) -> Self {
167 self.__unsafe_private_named.4 = value.into();
168 self
169 }
170 /// Set the `viewer` field to an Option value (optional)
171 pub fn maybe_viewer(
172 mut self,
173 value: Option<jacquard_common::types::string::Did<'a>>,
174 ) -> Self {
175 self.__unsafe_private_named.4 = value;
176 self
177 }
178}
179
180impl<'a, S> SearchActorsSkeletonBuilder<'a, S>
181where
182 S: search_actors_skeleton_state::State,
183 S::Q: search_actors_skeleton_state::IsSet,
184{
185 /// Build the final struct
186 pub fn build(self) -> SearchActorsSkeleton<'a> {
187 SearchActorsSkeleton {
188 cursor: self.__unsafe_private_named.0,
189 limit: self.__unsafe_private_named.1,
190 q: self.__unsafe_private_named.2.unwrap(),
191 typeahead: self.__unsafe_private_named.3,
192 viewer: self.__unsafe_private_named.4,
193 }
194 }
195}
196
197#[jacquard_derive::lexicon]
198#[derive(
199 serde::Serialize,
200 serde::Deserialize,
201 Debug,
202 Clone,
203 PartialEq,
204 Eq,
205 jacquard_derive::IntoStatic
206)]
207#[serde(rename_all = "camelCase")]
208pub struct SearchActorsSkeletonOutput<'a> {
209 #[serde(borrow)]
210 pub actors: Vec<crate::app_bsky::unspecced::SkeletonSearchActor<'a>>,
211 #[serde(skip_serializing_if = "std::option::Option::is_none")]
212 #[serde(borrow)]
213 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
214 /// Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits.
215 #[serde(skip_serializing_if = "std::option::Option::is_none")]
216 pub hits_total: std::option::Option<i64>,
217}
218
219#[jacquard_derive::open_union]
220#[derive(
221 serde::Serialize,
222 serde::Deserialize,
223 Debug,
224 Clone,
225 PartialEq,
226 Eq,
227 thiserror::Error,
228 miette::Diagnostic,
229 jacquard_derive::IntoStatic
230)]
231#[serde(tag = "error", content = "message")]
232#[serde(bound(deserialize = "'de: 'a"))]
233pub enum SearchActorsSkeletonError<'a> {
234 #[serde(rename = "BadQueryString")]
235 BadQueryString(std::option::Option<jacquard_common::CowStr<'a>>),
236}
237
238impl core::fmt::Display for SearchActorsSkeletonError<'_> {
239 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
240 match self {
241 Self::BadQueryString(msg) => {
242 write!(f, "BadQueryString")?;
243 if let Some(msg) = msg {
244 write!(f, ": {}", msg)?;
245 }
246 Ok(())
247 }
248 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
249 }
250 }
251}
252
253/// Response type for
254///app.bsky.unspecced.searchActorsSkeleton
255pub struct SearchActorsSkeletonResponse;
256impl jacquard_common::xrpc::XrpcResp for SearchActorsSkeletonResponse {
257 const NSID: &'static str = "app.bsky.unspecced.searchActorsSkeleton";
258 const ENCODING: &'static str = "application/json";
259 type Output<'de> = SearchActorsSkeletonOutput<'de>;
260 type Err<'de> = SearchActorsSkeletonError<'de>;
261}
262
263impl<'a> jacquard_common::xrpc::XrpcRequest for SearchActorsSkeleton<'a> {
264 const NSID: &'static str = "app.bsky.unspecced.searchActorsSkeleton";
265 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
266 type Response = SearchActorsSkeletonResponse;
267}
268
269/// Endpoint type for
270///app.bsky.unspecced.searchActorsSkeleton
271pub struct SearchActorsSkeletonRequest;
272impl jacquard_common::xrpc::XrpcEndpoint for SearchActorsSkeletonRequest {
273 const PATH: &'static str = "/xrpc/app.bsky.unspecced.searchActorsSkeleton";
274 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
275 type Request<'de> = SearchActorsSkeleton<'de>;
276 type Response = SearchActorsSkeletonResponse;
277}