atproto blogging
at main 472 lines 16 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.unspecced.searchPostsSkeleton 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 SearchPostsSkeleton<'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 #[serde(skip_serializing_if = "std::option::Option::is_none")] 26 #[serde(borrow)] 27 pub domain: std::option::Option<jacquard_common::CowStr<'a>>, 28 #[serde(skip_serializing_if = "std::option::Option::is_none")] 29 pub lang: std::option::Option<jacquard_common::types::string::Language>, 30 ///(default: 25, min: 1, max: 100) 31 #[serde(skip_serializing_if = "std::option::Option::is_none")] 32 pub limit: std::option::Option<i64>, 33 #[serde(skip_serializing_if = "std::option::Option::is_none")] 34 #[serde(borrow)] 35 pub mentions: std::option::Option<jacquard_common::types::ident::AtIdentifier<'a>>, 36 #[serde(borrow)] 37 pub q: jacquard_common::CowStr<'a>, 38 #[serde(skip_serializing_if = "std::option::Option::is_none")] 39 #[serde(borrow)] 40 pub since: std::option::Option<jacquard_common::CowStr<'a>>, 41 ///(default: "latest") 42 #[serde(skip_serializing_if = "std::option::Option::is_none")] 43 #[serde(borrow)] 44 pub sort: std::option::Option<jacquard_common::CowStr<'a>>, 45 #[serde(skip_serializing_if = "std::option::Option::is_none")] 46 #[serde(borrow)] 47 pub tag: std::option::Option<Vec<jacquard_common::CowStr<'a>>>, 48 #[serde(skip_serializing_if = "std::option::Option::is_none")] 49 #[serde(borrow)] 50 pub until: std::option::Option<jacquard_common::CowStr<'a>>, 51 #[serde(skip_serializing_if = "std::option::Option::is_none")] 52 #[serde(borrow)] 53 pub url: std::option::Option<jacquard_common::types::string::Uri<'a>>, 54 #[serde(skip_serializing_if = "std::option::Option::is_none")] 55 #[serde(borrow)] 56 pub viewer: std::option::Option<jacquard_common::types::string::Did<'a>>, 57} 58 59pub mod search_posts_skeleton_state { 60 61 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 62 #[allow(unused)] 63 use ::core::marker::PhantomData; 64 mod sealed { 65 pub trait Sealed {} 66 } 67 /// State trait tracking which required fields have been set 68 pub trait State: sealed::Sealed { 69 type Q; 70 } 71 /// Empty state - all required fields are unset 72 pub struct Empty(()); 73 impl sealed::Sealed for Empty {} 74 impl State for Empty { 75 type Q = Unset; 76 } 77 ///State transition - sets the `q` field to Set 78 pub struct SetQ<S: State = Empty>(PhantomData<fn() -> S>); 79 impl<S: State> sealed::Sealed for SetQ<S> {} 80 impl<S: State> State for SetQ<S> { 81 type Q = Set<members::q>; 82 } 83 /// Marker types for field names 84 #[allow(non_camel_case_types)] 85 pub mod members { 86 ///Marker type for the `q` field 87 pub struct q(()); 88 } 89} 90 91/// Builder for constructing an instance of this type 92pub struct SearchPostsSkeletonBuilder<'a, S: search_posts_skeleton_state::State> { 93 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 94 __unsafe_private_named: ( 95 ::core::option::Option<jacquard_common::types::ident::AtIdentifier<'a>>, 96 ::core::option::Option<jacquard_common::CowStr<'a>>, 97 ::core::option::Option<jacquard_common::CowStr<'a>>, 98 ::core::option::Option<jacquard_common::types::string::Language>, 99 ::core::option::Option<i64>, 100 ::core::option::Option<jacquard_common::types::ident::AtIdentifier<'a>>, 101 ::core::option::Option<jacquard_common::CowStr<'a>>, 102 ::core::option::Option<jacquard_common::CowStr<'a>>, 103 ::core::option::Option<jacquard_common::CowStr<'a>>, 104 ::core::option::Option<Vec<jacquard_common::CowStr<'a>>>, 105 ::core::option::Option<jacquard_common::CowStr<'a>>, 106 ::core::option::Option<jacquard_common::types::string::Uri<'a>>, 107 ::core::option::Option<jacquard_common::types::string::Did<'a>>, 108 ), 109 _phantom: ::core::marker::PhantomData<&'a ()>, 110} 111 112impl<'a> SearchPostsSkeleton<'a> { 113 /// Create a new builder for this type 114 pub fn new() -> SearchPostsSkeletonBuilder<'a, search_posts_skeleton_state::Empty> { 115 SearchPostsSkeletonBuilder::new() 116 } 117} 118 119impl<'a> SearchPostsSkeletonBuilder<'a, search_posts_skeleton_state::Empty> { 120 /// Create a new builder with all fields unset 121 pub fn new() -> Self { 122 SearchPostsSkeletonBuilder { 123 _phantom_state: ::core::marker::PhantomData, 124 __unsafe_private_named: ( 125 None, 126 None, 127 None, 128 None, 129 None, 130 None, 131 None, 132 None, 133 None, 134 None, 135 None, 136 None, 137 None, 138 ), 139 _phantom: ::core::marker::PhantomData, 140 } 141 } 142} 143 144impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 145 /// Set the `author` field (optional) 146 pub fn author( 147 mut self, 148 value: impl Into<Option<jacquard_common::types::ident::AtIdentifier<'a>>>, 149 ) -> Self { 150 self.__unsafe_private_named.0 = value.into(); 151 self 152 } 153 /// Set the `author` field to an Option value (optional) 154 pub fn maybe_author( 155 mut self, 156 value: Option<jacquard_common::types::ident::AtIdentifier<'a>>, 157 ) -> Self { 158 self.__unsafe_private_named.0 = value; 159 self 160 } 161} 162 163impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 164 /// Set the `cursor` field (optional) 165 pub fn cursor( 166 mut self, 167 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 168 ) -> Self { 169 self.__unsafe_private_named.1 = value.into(); 170 self 171 } 172 /// Set the `cursor` field to an Option value (optional) 173 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 174 self.__unsafe_private_named.1 = value; 175 self 176 } 177} 178 179impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 180 /// Set the `domain` field (optional) 181 pub fn domain( 182 mut self, 183 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 184 ) -> Self { 185 self.__unsafe_private_named.2 = value.into(); 186 self 187 } 188 /// Set the `domain` field to an Option value (optional) 189 pub fn maybe_domain(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 190 self.__unsafe_private_named.2 = value; 191 self 192 } 193} 194 195impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 196 /// Set the `lang` field (optional) 197 pub fn lang( 198 mut self, 199 value: impl Into<Option<jacquard_common::types::string::Language>>, 200 ) -> Self { 201 self.__unsafe_private_named.3 = value.into(); 202 self 203 } 204 /// Set the `lang` field to an Option value (optional) 205 pub fn maybe_lang( 206 mut self, 207 value: Option<jacquard_common::types::string::Language>, 208 ) -> Self { 209 self.__unsafe_private_named.3 = value; 210 self 211 } 212} 213 214impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 215 /// Set the `limit` field (optional) 216 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self { 217 self.__unsafe_private_named.4 = value.into(); 218 self 219 } 220 /// Set the `limit` field to an Option value (optional) 221 pub fn maybe_limit(mut self, value: Option<i64>) -> Self { 222 self.__unsafe_private_named.4 = value; 223 self 224 } 225} 226 227impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 228 /// Set the `mentions` field (optional) 229 pub fn mentions( 230 mut self, 231 value: impl Into<Option<jacquard_common::types::ident::AtIdentifier<'a>>>, 232 ) -> Self { 233 self.__unsafe_private_named.5 = value.into(); 234 self 235 } 236 /// Set the `mentions` field to an Option value (optional) 237 pub fn maybe_mentions( 238 mut self, 239 value: Option<jacquard_common::types::ident::AtIdentifier<'a>>, 240 ) -> Self { 241 self.__unsafe_private_named.5 = value; 242 self 243 } 244} 245 246impl<'a, S> SearchPostsSkeletonBuilder<'a, S> 247where 248 S: search_posts_skeleton_state::State, 249 S::Q: search_posts_skeleton_state::IsUnset, 250{ 251 /// Set the `q` field (required) 252 pub fn q( 253 mut self, 254 value: impl Into<jacquard_common::CowStr<'a>>, 255 ) -> SearchPostsSkeletonBuilder<'a, search_posts_skeleton_state::SetQ<S>> { 256 self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); 257 SearchPostsSkeletonBuilder { 258 _phantom_state: ::core::marker::PhantomData, 259 __unsafe_private_named: self.__unsafe_private_named, 260 _phantom: ::core::marker::PhantomData, 261 } 262 } 263} 264 265impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 266 /// Set the `since` field (optional) 267 pub fn since( 268 mut self, 269 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 270 ) -> Self { 271 self.__unsafe_private_named.7 = value.into(); 272 self 273 } 274 /// Set the `since` field to an Option value (optional) 275 pub fn maybe_since(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 276 self.__unsafe_private_named.7 = value; 277 self 278 } 279} 280 281impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 282 /// Set the `sort` field (optional) 283 pub fn sort( 284 mut self, 285 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 286 ) -> Self { 287 self.__unsafe_private_named.8 = value.into(); 288 self 289 } 290 /// Set the `sort` field to an Option value (optional) 291 pub fn maybe_sort(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 292 self.__unsafe_private_named.8 = value; 293 self 294 } 295} 296 297impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 298 /// Set the `tag` field (optional) 299 pub fn tag( 300 mut self, 301 value: impl Into<Option<Vec<jacquard_common::CowStr<'a>>>>, 302 ) -> Self { 303 self.__unsafe_private_named.9 = value.into(); 304 self 305 } 306 /// Set the `tag` field to an Option value (optional) 307 pub fn maybe_tag(mut self, value: Option<Vec<jacquard_common::CowStr<'a>>>) -> Self { 308 self.__unsafe_private_named.9 = value; 309 self 310 } 311} 312 313impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 314 /// Set the `until` field (optional) 315 pub fn until( 316 mut self, 317 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 318 ) -> Self { 319 self.__unsafe_private_named.10 = value.into(); 320 self 321 } 322 /// Set the `until` field to an Option value (optional) 323 pub fn maybe_until(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 324 self.__unsafe_private_named.10 = value; 325 self 326 } 327} 328 329impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 330 /// Set the `url` field (optional) 331 pub fn url( 332 mut self, 333 value: impl Into<Option<jacquard_common::types::string::Uri<'a>>>, 334 ) -> Self { 335 self.__unsafe_private_named.11 = value.into(); 336 self 337 } 338 /// Set the `url` field to an Option value (optional) 339 pub fn maybe_url( 340 mut self, 341 value: Option<jacquard_common::types::string::Uri<'a>>, 342 ) -> Self { 343 self.__unsafe_private_named.11 = value; 344 self 345 } 346} 347 348impl<'a, S: search_posts_skeleton_state::State> SearchPostsSkeletonBuilder<'a, S> { 349 /// Set the `viewer` field (optional) 350 pub fn viewer( 351 mut self, 352 value: impl Into<Option<jacquard_common::types::string::Did<'a>>>, 353 ) -> Self { 354 self.__unsafe_private_named.12 = value.into(); 355 self 356 } 357 /// Set the `viewer` field to an Option value (optional) 358 pub fn maybe_viewer( 359 mut self, 360 value: Option<jacquard_common::types::string::Did<'a>>, 361 ) -> Self { 362 self.__unsafe_private_named.12 = value; 363 self 364 } 365} 366 367impl<'a, S> SearchPostsSkeletonBuilder<'a, S> 368where 369 S: search_posts_skeleton_state::State, 370 S::Q: search_posts_skeleton_state::IsSet, 371{ 372 /// Build the final struct 373 pub fn build(self) -> SearchPostsSkeleton<'a> { 374 SearchPostsSkeleton { 375 author: self.__unsafe_private_named.0, 376 cursor: self.__unsafe_private_named.1, 377 domain: self.__unsafe_private_named.2, 378 lang: self.__unsafe_private_named.3, 379 limit: self.__unsafe_private_named.4, 380 mentions: self.__unsafe_private_named.5, 381 q: self.__unsafe_private_named.6.unwrap(), 382 since: self.__unsafe_private_named.7, 383 sort: self.__unsafe_private_named.8, 384 tag: self.__unsafe_private_named.9, 385 until: self.__unsafe_private_named.10, 386 url: self.__unsafe_private_named.11, 387 viewer: self.__unsafe_private_named.12, 388 } 389 } 390} 391 392#[jacquard_derive::lexicon] 393#[derive( 394 serde::Serialize, 395 serde::Deserialize, 396 Debug, 397 Clone, 398 PartialEq, 399 Eq, 400 jacquard_derive::IntoStatic 401)] 402#[serde(rename_all = "camelCase")] 403pub struct SearchPostsSkeletonOutput<'a> { 404 #[serde(skip_serializing_if = "std::option::Option::is_none")] 405 #[serde(borrow)] 406 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 407 /// Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. 408 #[serde(skip_serializing_if = "std::option::Option::is_none")] 409 pub hits_total: std::option::Option<i64>, 410 #[serde(borrow)] 411 pub posts: Vec<crate::app_bsky::unspecced::SkeletonSearchPost<'a>>, 412} 413 414#[jacquard_derive::open_union] 415#[derive( 416 serde::Serialize, 417 serde::Deserialize, 418 Debug, 419 Clone, 420 PartialEq, 421 Eq, 422 thiserror::Error, 423 miette::Diagnostic, 424 jacquard_derive::IntoStatic 425)] 426#[serde(tag = "error", content = "message")] 427#[serde(bound(deserialize = "'de: 'a"))] 428pub enum SearchPostsSkeletonError<'a> { 429 #[serde(rename = "BadQueryString")] 430 BadQueryString(std::option::Option<jacquard_common::CowStr<'a>>), 431} 432 433impl core::fmt::Display for SearchPostsSkeletonError<'_> { 434 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 435 match self { 436 Self::BadQueryString(msg) => { 437 write!(f, "BadQueryString")?; 438 if let Some(msg) = msg { 439 write!(f, ": {}", msg)?; 440 } 441 Ok(()) 442 } 443 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 444 } 445 } 446} 447 448/// Response type for 449///app.bsky.unspecced.searchPostsSkeleton 450pub struct SearchPostsSkeletonResponse; 451impl jacquard_common::xrpc::XrpcResp for SearchPostsSkeletonResponse { 452 const NSID: &'static str = "app.bsky.unspecced.searchPostsSkeleton"; 453 const ENCODING: &'static str = "application/json"; 454 type Output<'de> = SearchPostsSkeletonOutput<'de>; 455 type Err<'de> = SearchPostsSkeletonError<'de>; 456} 457 458impl<'a> jacquard_common::xrpc::XrpcRequest for SearchPostsSkeleton<'a> { 459 const NSID: &'static str = "app.bsky.unspecced.searchPostsSkeleton"; 460 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 461 type Response = SearchPostsSkeletonResponse; 462} 463 464/// Endpoint type for 465///app.bsky.unspecced.searchPostsSkeleton 466pub struct SearchPostsSkeletonRequest; 467impl jacquard_common::xrpc::XrpcEndpoint for SearchPostsSkeletonRequest { 468 const PATH: &'static str = "/xrpc/app.bsky.unspecced.searchPostsSkeleton"; 469 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 470 type Request<'de> = SearchPostsSkeleton<'de>; 471 type Response = SearchPostsSkeletonResponse; 472}