atproto blogging
at main 279 lines 9.1 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.feed.getAuthorFeed 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 GetAuthorFeed<'a> { 19 #[serde(borrow)] 20 pub actor: jacquard_common::types::ident::AtIdentifier<'a>, 21 #[serde(skip_serializing_if = "std::option::Option::is_none")] 22 #[serde(borrow)] 23 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 24 ///(default: "posts_with_replies") 25 #[serde(skip_serializing_if = "std::option::Option::is_none")] 26 #[serde(borrow)] 27 pub filter: std::option::Option<jacquard_common::CowStr<'a>>, 28 /// (default: false) 29 #[serde(skip_serializing_if = "std::option::Option::is_none")] 30 pub include_pins: std::option::Option<bool>, 31 ///(default: 50, min: 1, max: 100) 32 #[serde(skip_serializing_if = "std::option::Option::is_none")] 33 pub limit: std::option::Option<i64>, 34} 35 36pub mod get_author_feed_state { 37 38 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 39 #[allow(unused)] 40 use ::core::marker::PhantomData; 41 mod sealed { 42 pub trait Sealed {} 43 } 44 /// State trait tracking which required fields have been set 45 pub trait State: sealed::Sealed { 46 type Actor; 47 } 48 /// Empty state - all required fields are unset 49 pub struct Empty(()); 50 impl sealed::Sealed for Empty {} 51 impl State for Empty { 52 type Actor = Unset; 53 } 54 ///State transition - sets the `actor` field to Set 55 pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>); 56 impl<S: State> sealed::Sealed for SetActor<S> {} 57 impl<S: State> State for SetActor<S> { 58 type Actor = Set<members::actor>; 59 } 60 /// Marker types for field names 61 #[allow(non_camel_case_types)] 62 pub mod members { 63 ///Marker type for the `actor` field 64 pub struct actor(()); 65 } 66} 67 68/// Builder for constructing an instance of this type 69pub struct GetAuthorFeedBuilder<'a, S: get_author_feed_state::State> { 70 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 71 __unsafe_private_named: ( 72 ::core::option::Option<jacquard_common::types::ident::AtIdentifier<'a>>, 73 ::core::option::Option<jacquard_common::CowStr<'a>>, 74 ::core::option::Option<jacquard_common::CowStr<'a>>, 75 ::core::option::Option<bool>, 76 ::core::option::Option<i64>, 77 ), 78 _phantom: ::core::marker::PhantomData<&'a ()>, 79} 80 81impl<'a> GetAuthorFeed<'a> { 82 /// Create a new builder for this type 83 pub fn new() -> GetAuthorFeedBuilder<'a, get_author_feed_state::Empty> { 84 GetAuthorFeedBuilder::new() 85 } 86} 87 88impl<'a> GetAuthorFeedBuilder<'a, get_author_feed_state::Empty> { 89 /// Create a new builder with all fields unset 90 pub fn new() -> Self { 91 GetAuthorFeedBuilder { 92 _phantom_state: ::core::marker::PhantomData, 93 __unsafe_private_named: (None, None, None, None, None), 94 _phantom: ::core::marker::PhantomData, 95 } 96 } 97} 98 99impl<'a, S> GetAuthorFeedBuilder<'a, S> 100where 101 S: get_author_feed_state::State, 102 S::Actor: get_author_feed_state::IsUnset, 103{ 104 /// Set the `actor` field (required) 105 pub fn actor( 106 mut self, 107 value: impl Into<jacquard_common::types::ident::AtIdentifier<'a>>, 108 ) -> GetAuthorFeedBuilder<'a, get_author_feed_state::SetActor<S>> { 109 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 110 GetAuthorFeedBuilder { 111 _phantom_state: ::core::marker::PhantomData, 112 __unsafe_private_named: self.__unsafe_private_named, 113 _phantom: ::core::marker::PhantomData, 114 } 115 } 116} 117 118impl<'a, S: get_author_feed_state::State> GetAuthorFeedBuilder<'a, S> { 119 /// Set the `cursor` field (optional) 120 pub fn cursor( 121 mut self, 122 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 123 ) -> Self { 124 self.__unsafe_private_named.1 = value.into(); 125 self 126 } 127 /// Set the `cursor` field to an Option value (optional) 128 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 129 self.__unsafe_private_named.1 = value; 130 self 131 } 132} 133 134impl<'a, S: get_author_feed_state::State> GetAuthorFeedBuilder<'a, S> { 135 /// Set the `filter` field (optional) 136 pub fn filter( 137 mut self, 138 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 139 ) -> Self { 140 self.__unsafe_private_named.2 = value.into(); 141 self 142 } 143 /// Set the `filter` field to an Option value (optional) 144 pub fn maybe_filter(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 145 self.__unsafe_private_named.2 = value; 146 self 147 } 148} 149 150impl<'a, S: get_author_feed_state::State> GetAuthorFeedBuilder<'a, S> { 151 /// Set the `includePins` field (optional) 152 pub fn include_pins(mut self, value: impl Into<Option<bool>>) -> Self { 153 self.__unsafe_private_named.3 = value.into(); 154 self 155 } 156 /// Set the `includePins` field to an Option value (optional) 157 pub fn maybe_include_pins(mut self, value: Option<bool>) -> Self { 158 self.__unsafe_private_named.3 = value; 159 self 160 } 161} 162 163impl<'a, S: get_author_feed_state::State> GetAuthorFeedBuilder<'a, S> { 164 /// Set the `limit` field (optional) 165 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self { 166 self.__unsafe_private_named.4 = value.into(); 167 self 168 } 169 /// Set the `limit` field to an Option value (optional) 170 pub fn maybe_limit(mut self, value: Option<i64>) -> Self { 171 self.__unsafe_private_named.4 = value; 172 self 173 } 174} 175 176impl<'a, S> GetAuthorFeedBuilder<'a, S> 177where 178 S: get_author_feed_state::State, 179 S::Actor: get_author_feed_state::IsSet, 180{ 181 /// Build the final struct 182 pub fn build(self) -> GetAuthorFeed<'a> { 183 GetAuthorFeed { 184 actor: self.__unsafe_private_named.0.unwrap(), 185 cursor: self.__unsafe_private_named.1, 186 filter: self.__unsafe_private_named.2, 187 include_pins: self.__unsafe_private_named.3, 188 limit: self.__unsafe_private_named.4, 189 } 190 } 191} 192 193#[jacquard_derive::lexicon] 194#[derive( 195 serde::Serialize, 196 serde::Deserialize, 197 Debug, 198 Clone, 199 PartialEq, 200 Eq, 201 jacquard_derive::IntoStatic 202)] 203#[serde(rename_all = "camelCase")] 204pub struct GetAuthorFeedOutput<'a> { 205 #[serde(skip_serializing_if = "std::option::Option::is_none")] 206 #[serde(borrow)] 207 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 208 #[serde(borrow)] 209 pub feed: Vec<crate::app_bsky::feed::FeedViewPost<'a>>, 210} 211 212#[jacquard_derive::open_union] 213#[derive( 214 serde::Serialize, 215 serde::Deserialize, 216 Debug, 217 Clone, 218 PartialEq, 219 Eq, 220 thiserror::Error, 221 miette::Diagnostic, 222 jacquard_derive::IntoStatic 223)] 224#[serde(tag = "error", content = "message")] 225#[serde(bound(deserialize = "'de: 'a"))] 226pub enum GetAuthorFeedError<'a> { 227 #[serde(rename = "BlockedActor")] 228 BlockedActor(std::option::Option<jacquard_common::CowStr<'a>>), 229 #[serde(rename = "BlockedByActor")] 230 BlockedByActor(std::option::Option<jacquard_common::CowStr<'a>>), 231} 232 233impl core::fmt::Display for GetAuthorFeedError<'_> { 234 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 235 match self { 236 Self::BlockedActor(msg) => { 237 write!(f, "BlockedActor")?; 238 if let Some(msg) = msg { 239 write!(f, ": {}", msg)?; 240 } 241 Ok(()) 242 } 243 Self::BlockedByActor(msg) => { 244 write!(f, "BlockedByActor")?; 245 if let Some(msg) = msg { 246 write!(f, ": {}", msg)?; 247 } 248 Ok(()) 249 } 250 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 251 } 252 } 253} 254 255/// Response type for 256///app.bsky.feed.getAuthorFeed 257pub struct GetAuthorFeedResponse; 258impl jacquard_common::xrpc::XrpcResp for GetAuthorFeedResponse { 259 const NSID: &'static str = "app.bsky.feed.getAuthorFeed"; 260 const ENCODING: &'static str = "application/json"; 261 type Output<'de> = GetAuthorFeedOutput<'de>; 262 type Err<'de> = GetAuthorFeedError<'de>; 263} 264 265impl<'a> jacquard_common::xrpc::XrpcRequest for GetAuthorFeed<'a> { 266 const NSID: &'static str = "app.bsky.feed.getAuthorFeed"; 267 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 268 type Response = GetAuthorFeedResponse; 269} 270 271/// Endpoint type for 272///app.bsky.feed.getAuthorFeed 273pub struct GetAuthorFeedRequest; 274impl jacquard_common::xrpc::XrpcEndpoint for GetAuthorFeedRequest { 275 const PATH: &'static str = "/xrpc/app.bsky.feed.getAuthorFeed"; 276 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 277 type Request<'de> = GetAuthorFeed<'de>; 278 type Response = GetAuthorFeedResponse; 279}