A better Rust ATProto crate
at oauth 4.6 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 bon::Builder 16)] 17#[builder(start_fn = new)] 18#[serde(rename_all = "camelCase")] 19pub struct GetAuthorFeed<'a> { 20 #[serde(borrow)] 21 pub actor: jacquard_common::types::ident::AtIdentifier<'a>, 22 #[serde(skip_serializing_if = "std::option::Option::is_none")] 23 #[serde(borrow)] 24 #[builder(into)] 25 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 26 ///(default: "posts_with_replies") 27 #[serde(skip_serializing_if = "std::option::Option::is_none")] 28 #[serde(borrow)] 29 #[builder(into)] 30 pub filter: std::option::Option<jacquard_common::CowStr<'a>>, 31 ///(default: false) 32 #[serde(skip_serializing_if = "std::option::Option::is_none")] 33 pub include_pins: std::option::Option<bool>, 34 ///(default: 50, min: 1, max: 100) 35 #[serde(skip_serializing_if = "std::option::Option::is_none")] 36 pub limit: std::option::Option<i64>, 37} 38 39impl jacquard_common::IntoStatic for GetAuthorFeed<'_> { 40 type Output = GetAuthorFeed<'static>; 41 fn into_static(self) -> Self::Output { 42 GetAuthorFeed { 43 actor: self.actor.into_static(), 44 cursor: self.cursor.into_static(), 45 filter: self.filter.into_static(), 46 include_pins: self.include_pins.into_static(), 47 limit: self.limit.into_static(), 48 } 49 } 50} 51 52#[jacquard_derive::lexicon] 53#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 54#[serde(rename_all = "camelCase")] 55pub struct GetAuthorFeedOutput<'a> { 56 #[serde(skip_serializing_if = "std::option::Option::is_none")] 57 #[serde(borrow)] 58 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 59 #[serde(borrow)] 60 pub feed: Vec<crate::app_bsky::feed::FeedViewPost<'a>>, 61} 62 63impl jacquard_common::IntoStatic for GetAuthorFeedOutput<'_> { 64 type Output = GetAuthorFeedOutput<'static>; 65 fn into_static(self) -> Self::Output { 66 GetAuthorFeedOutput { 67 cursor: self.cursor.into_static(), 68 feed: self.feed.into_static(), 69 extra_data: self.extra_data.into_static(), 70 } 71 } 72} 73 74#[jacquard_derive::open_union] 75#[derive( 76 serde::Serialize, 77 serde::Deserialize, 78 Debug, 79 Clone, 80 PartialEq, 81 Eq, 82 thiserror::Error, 83 miette::Diagnostic 84)] 85#[serde(tag = "error", content = "message")] 86#[serde(bound(deserialize = "'de: 'a"))] 87pub enum GetAuthorFeedError<'a> { 88 #[serde(rename = "BlockedActor")] 89 BlockedActor(std::option::Option<String>), 90 #[serde(rename = "BlockedByActor")] 91 BlockedByActor(std::option::Option<String>), 92} 93 94impl std::fmt::Display for GetAuthorFeedError<'_> { 95 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 96 match self { 97 Self::BlockedActor(msg) => { 98 write!(f, "BlockedActor")?; 99 if let Some(msg) = msg { 100 write!(f, ": {}", msg)?; 101 } 102 Ok(()) 103 } 104 Self::BlockedByActor(msg) => { 105 write!(f, "BlockedByActor")?; 106 if let Some(msg) = msg { 107 write!(f, ": {}", msg)?; 108 } 109 Ok(()) 110 } 111 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 112 } 113 } 114} 115 116impl jacquard_common::IntoStatic for GetAuthorFeedError<'_> { 117 type Output = GetAuthorFeedError<'static>; 118 fn into_static(self) -> Self::Output { 119 match self { 120 GetAuthorFeedError::BlockedActor(v) => { 121 GetAuthorFeedError::BlockedActor(v.into_static()) 122 } 123 GetAuthorFeedError::BlockedByActor(v) => { 124 GetAuthorFeedError::BlockedByActor(v.into_static()) 125 } 126 GetAuthorFeedError::Unknown(v) => { 127 GetAuthorFeedError::Unknown(v.into_static()) 128 } 129 } 130 } 131} 132 133impl jacquard_common::types::xrpc::XrpcRequest for GetAuthorFeed<'_> { 134 const NSID: &'static str = "app.bsky.feed.getAuthorFeed"; 135 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query; 136 const OUTPUT_ENCODING: &'static str = "application/json"; 137 type Output<'de> = GetAuthorFeedOutput<'de>; 138 type Err<'de> = GetAuthorFeedError<'de>; 139}