atproto blogging
at main 277 lines 9.0 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.unspecced.searchStarterPacksSkeleton 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 SearchStarterPacksSkeleton<'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 #[serde(borrow)] 29 pub viewer: std::option::Option<jacquard_common::types::string::Did<'a>>, 30} 31 32pub mod search_starter_packs_skeleton_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 type Q; 43 } 44 /// Empty state - all required fields are unset 45 pub struct Empty(()); 46 impl sealed::Sealed for Empty {} 47 impl State for Empty { 48 type Q = Unset; 49 } 50 ///State transition - sets the `q` field to Set 51 pub struct SetQ<S: State = Empty>(PhantomData<fn() -> S>); 52 impl<S: State> sealed::Sealed for SetQ<S> {} 53 impl<S: State> State for SetQ<S> { 54 type Q = Set<members::q>; 55 } 56 /// Marker types for field names 57 #[allow(non_camel_case_types)] 58 pub mod members { 59 ///Marker type for the `q` field 60 pub struct q(()); 61 } 62} 63 64/// Builder for constructing an instance of this type 65pub struct SearchStarterPacksSkeletonBuilder< 66 'a, 67 S: search_starter_packs_skeleton_state::State, 68> { 69 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 70 __unsafe_private_named: ( 71 ::core::option::Option<jacquard_common::CowStr<'a>>, 72 ::core::option::Option<i64>, 73 ::core::option::Option<jacquard_common::CowStr<'a>>, 74 ::core::option::Option<jacquard_common::types::string::Did<'a>>, 75 ), 76 _phantom: ::core::marker::PhantomData<&'a ()>, 77} 78 79impl<'a> SearchStarterPacksSkeleton<'a> { 80 /// Create a new builder for this type 81 pub fn new() -> SearchStarterPacksSkeletonBuilder< 82 'a, 83 search_starter_packs_skeleton_state::Empty, 84 > { 85 SearchStarterPacksSkeletonBuilder::new() 86 } 87} 88 89impl< 90 'a, 91> SearchStarterPacksSkeletonBuilder<'a, search_starter_packs_skeleton_state::Empty> { 92 /// Create a new builder with all fields unset 93 pub fn new() -> Self { 94 SearchStarterPacksSkeletonBuilder { 95 _phantom_state: ::core::marker::PhantomData, 96 __unsafe_private_named: (None, None, None, None), 97 _phantom: ::core::marker::PhantomData, 98 } 99 } 100} 101 102impl< 103 'a, 104 S: search_starter_packs_skeleton_state::State, 105> SearchStarterPacksSkeletonBuilder<'a, S> { 106 /// Set the `cursor` field (optional) 107 pub fn cursor( 108 mut self, 109 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 110 ) -> Self { 111 self.__unsafe_private_named.0 = value.into(); 112 self 113 } 114 /// Set the `cursor` field to an Option value (optional) 115 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 116 self.__unsafe_private_named.0 = value; 117 self 118 } 119} 120 121impl< 122 'a, 123 S: search_starter_packs_skeleton_state::State, 124> SearchStarterPacksSkeletonBuilder<'a, S> { 125 /// Set the `limit` field (optional) 126 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self { 127 self.__unsafe_private_named.1 = value.into(); 128 self 129 } 130 /// Set the `limit` field to an Option value (optional) 131 pub fn maybe_limit(mut self, value: Option<i64>) -> Self { 132 self.__unsafe_private_named.1 = value; 133 self 134 } 135} 136 137impl<'a, S> SearchStarterPacksSkeletonBuilder<'a, S> 138where 139 S: search_starter_packs_skeleton_state::State, 140 S::Q: search_starter_packs_skeleton_state::IsUnset, 141{ 142 /// Set the `q` field (required) 143 pub fn q( 144 mut self, 145 value: impl Into<jacquard_common::CowStr<'a>>, 146 ) -> SearchStarterPacksSkeletonBuilder< 147 'a, 148 search_starter_packs_skeleton_state::SetQ<S>, 149 > { 150 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 151 SearchStarterPacksSkeletonBuilder { 152 _phantom_state: ::core::marker::PhantomData, 153 __unsafe_private_named: self.__unsafe_private_named, 154 _phantom: ::core::marker::PhantomData, 155 } 156 } 157} 158 159impl< 160 'a, 161 S: search_starter_packs_skeleton_state::State, 162> SearchStarterPacksSkeletonBuilder<'a, S> { 163 /// Set the `viewer` field (optional) 164 pub fn viewer( 165 mut self, 166 value: impl Into<Option<jacquard_common::types::string::Did<'a>>>, 167 ) -> Self { 168 self.__unsafe_private_named.3 = value.into(); 169 self 170 } 171 /// Set the `viewer` field to an Option value (optional) 172 pub fn maybe_viewer( 173 mut self, 174 value: Option<jacquard_common::types::string::Did<'a>>, 175 ) -> Self { 176 self.__unsafe_private_named.3 = value; 177 self 178 } 179} 180 181impl<'a, S> SearchStarterPacksSkeletonBuilder<'a, S> 182where 183 S: search_starter_packs_skeleton_state::State, 184 S::Q: search_starter_packs_skeleton_state::IsSet, 185{ 186 /// Build the final struct 187 pub fn build(self) -> SearchStarterPacksSkeleton<'a> { 188 SearchStarterPacksSkeleton { 189 cursor: self.__unsafe_private_named.0, 190 limit: self.__unsafe_private_named.1, 191 q: self.__unsafe_private_named.2.unwrap(), 192 viewer: self.__unsafe_private_named.3, 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 SearchStarterPacksSkeletonOutput<'a> { 209 #[serde(skip_serializing_if = "std::option::Option::is_none")] 210 #[serde(borrow)] 211 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 212 /// Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits. 213 #[serde(skip_serializing_if = "std::option::Option::is_none")] 214 pub hits_total: std::option::Option<i64>, 215 #[serde(borrow)] 216 pub starter_packs: Vec<crate::app_bsky::unspecced::SkeletonSearchStarterPack<'a>>, 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 SearchStarterPacksSkeletonError<'a> { 234 #[serde(rename = "BadQueryString")] 235 BadQueryString(std::option::Option<jacquard_common::CowStr<'a>>), 236} 237 238impl core::fmt::Display for SearchStarterPacksSkeletonError<'_> { 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.searchStarterPacksSkeleton 255pub struct SearchStarterPacksSkeletonResponse; 256impl jacquard_common::xrpc::XrpcResp for SearchStarterPacksSkeletonResponse { 257 const NSID: &'static str = "app.bsky.unspecced.searchStarterPacksSkeleton"; 258 const ENCODING: &'static str = "application/json"; 259 type Output<'de> = SearchStarterPacksSkeletonOutput<'de>; 260 type Err<'de> = SearchStarterPacksSkeletonError<'de>; 261} 262 263impl<'a> jacquard_common::xrpc::XrpcRequest for SearchStarterPacksSkeleton<'a> { 264 const NSID: &'static str = "app.bsky.unspecced.searchStarterPacksSkeleton"; 265 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 266 type Response = SearchStarterPacksSkeletonResponse; 267} 268 269/// Endpoint type for 270///app.bsky.unspecced.searchStarterPacksSkeleton 271pub struct SearchStarterPacksSkeletonRequest; 272impl jacquard_common::xrpc::XrpcEndpoint for SearchStarterPacksSkeletonRequest { 273 const PATH: &'static str = "/xrpc/app.bsky.unspecced.searchStarterPacksSkeleton"; 274 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 275 type Request<'de> = SearchStarterPacksSkeleton<'de>; 276 type Response = SearchStarterPacksSkeletonResponse; 277}