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