atproto blogging
at main 162 lines 5.2 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.actor.getSuggestions 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 GetSuggestions<'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: 50, min: 1, max: 100) 23 #[serde(skip_serializing_if = "std::option::Option::is_none")] 24 pub limit: std::option::Option<i64>, 25} 26 27pub mod get_suggestions_state { 28 29 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 30 #[allow(unused)] 31 use ::core::marker::PhantomData; 32 mod sealed { 33 pub trait Sealed {} 34 } 35 /// State trait tracking which required fields have been set 36 pub trait State: sealed::Sealed {} 37 /// Empty state - all required fields are unset 38 pub struct Empty(()); 39 impl sealed::Sealed for Empty {} 40 impl State for Empty {} 41 /// Marker types for field names 42 #[allow(non_camel_case_types)] 43 pub mod members {} 44} 45 46/// Builder for constructing an instance of this type 47pub struct GetSuggestionsBuilder<'a, S: get_suggestions_state::State> { 48 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 49 __unsafe_private_named: ( 50 ::core::option::Option<jacquard_common::CowStr<'a>>, 51 ::core::option::Option<i64>, 52 ), 53 _phantom: ::core::marker::PhantomData<&'a ()>, 54} 55 56impl<'a> GetSuggestions<'a> { 57 /// Create a new builder for this type 58 pub fn new() -> GetSuggestionsBuilder<'a, get_suggestions_state::Empty> { 59 GetSuggestionsBuilder::new() 60 } 61} 62 63impl<'a> GetSuggestionsBuilder<'a, get_suggestions_state::Empty> { 64 /// Create a new builder with all fields unset 65 pub fn new() -> Self { 66 GetSuggestionsBuilder { 67 _phantom_state: ::core::marker::PhantomData, 68 __unsafe_private_named: (None, None), 69 _phantom: ::core::marker::PhantomData, 70 } 71 } 72} 73 74impl<'a, S: get_suggestions_state::State> GetSuggestionsBuilder<'a, S> { 75 /// Set the `cursor` field (optional) 76 pub fn cursor( 77 mut self, 78 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 79 ) -> Self { 80 self.__unsafe_private_named.0 = value.into(); 81 self 82 } 83 /// Set the `cursor` field to an Option value (optional) 84 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 85 self.__unsafe_private_named.0 = value; 86 self 87 } 88} 89 90impl<'a, S: get_suggestions_state::State> GetSuggestionsBuilder<'a, S> { 91 /// Set the `limit` field (optional) 92 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self { 93 self.__unsafe_private_named.1 = value.into(); 94 self 95 } 96 /// Set the `limit` field to an Option value (optional) 97 pub fn maybe_limit(mut self, value: Option<i64>) -> Self { 98 self.__unsafe_private_named.1 = value; 99 self 100 } 101} 102 103impl<'a, S> GetSuggestionsBuilder<'a, S> 104where 105 S: get_suggestions_state::State, 106{ 107 /// Build the final struct 108 pub fn build(self) -> GetSuggestions<'a> { 109 GetSuggestions { 110 cursor: self.__unsafe_private_named.0, 111 limit: self.__unsafe_private_named.1, 112 } 113 } 114} 115 116#[jacquard_derive::lexicon] 117#[derive( 118 serde::Serialize, 119 serde::Deserialize, 120 Debug, 121 Clone, 122 PartialEq, 123 Eq, 124 jacquard_derive::IntoStatic 125)] 126#[serde(rename_all = "camelCase")] 127pub struct GetSuggestionsOutput<'a> { 128 #[serde(borrow)] 129 pub actors: Vec<crate::app_bsky::actor::ProfileView<'a>>, 130 #[serde(skip_serializing_if = "std::option::Option::is_none")] 131 #[serde(borrow)] 132 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 133 /// Snowflake for this recommendation, use when submitting recommendation events. 134 #[serde(skip_serializing_if = "std::option::Option::is_none")] 135 pub rec_id: std::option::Option<i64>, 136} 137 138/// Response type for 139///app.bsky.actor.getSuggestions 140pub struct GetSuggestionsResponse; 141impl jacquard_common::xrpc::XrpcResp for GetSuggestionsResponse { 142 const NSID: &'static str = "app.bsky.actor.getSuggestions"; 143 const ENCODING: &'static str = "application/json"; 144 type Output<'de> = GetSuggestionsOutput<'de>; 145 type Err<'de> = jacquard_common::xrpc::GenericError<'de>; 146} 147 148impl<'a> jacquard_common::xrpc::XrpcRequest for GetSuggestions<'a> { 149 const NSID: &'static str = "app.bsky.actor.getSuggestions"; 150 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 151 type Response = GetSuggestionsResponse; 152} 153 154/// Endpoint type for 155///app.bsky.actor.getSuggestions 156pub struct GetSuggestionsRequest; 157impl jacquard_common::xrpc::XrpcEndpoint for GetSuggestionsRequest { 158 const PATH: &'static str = "/xrpc/app.bsky.actor.getSuggestions"; 159 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 160 type Request<'de> = GetSuggestions<'de>; 161 type Response = GetSuggestionsResponse; 162}