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