A better Rust ATProto crate
at oauth 4.4 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: chat.bsky.convo.removeReaction 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[jacquard_derive::lexicon] 9#[derive( 10 serde::Serialize, 11 serde::Deserialize, 12 Debug, 13 Clone, 14 PartialEq, 15 Eq, 16 bon::Builder 17)] 18#[serde(rename_all = "camelCase")] 19#[builder(start_fn = new)] 20pub struct RemoveReaction<'a> { 21 #[serde(borrow)] 22 #[builder(into)] 23 pub convo_id: jacquard_common::CowStr<'a>, 24 #[serde(borrow)] 25 #[builder(into)] 26 pub message_id: jacquard_common::CowStr<'a>, 27 #[serde(borrow)] 28 #[builder(into)] 29 pub value: jacquard_common::CowStr<'a>, 30 #[serde(flatten)] 31 #[serde(borrow)] 32 #[builder(default)] 33 pub extra_data: ::std::collections::BTreeMap< 34 ::jacquard_common::smol_str::SmolStr, 35 ::jacquard_common::types::value::Data<'a>, 36 >, 37} 38 39impl jacquard_common::IntoStatic for RemoveReaction<'_> { 40 type Output = RemoveReaction<'static>; 41 fn into_static(self) -> Self::Output { 42 RemoveReaction { 43 convo_id: self.convo_id.into_static(), 44 message_id: self.message_id.into_static(), 45 value: self.value.into_static(), 46 extra_data: self.extra_data.into_static(), 47 } 48 } 49} 50 51#[jacquard_derive::lexicon] 52#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 53#[serde(rename_all = "camelCase")] 54pub struct RemoveReactionOutput<'a> { 55 #[serde(borrow)] 56 pub message: crate::chat_bsky::convo::MessageView<'a>, 57} 58 59impl jacquard_common::IntoStatic for RemoveReactionOutput<'_> { 60 type Output = RemoveReactionOutput<'static>; 61 fn into_static(self) -> Self::Output { 62 RemoveReactionOutput { 63 message: self.message.into_static(), 64 extra_data: self.extra_data.into_static(), 65 } 66 } 67} 68 69#[jacquard_derive::open_union] 70#[derive( 71 serde::Serialize, 72 serde::Deserialize, 73 Debug, 74 Clone, 75 PartialEq, 76 Eq, 77 thiserror::Error, 78 miette::Diagnostic 79)] 80#[serde(tag = "error", content = "message")] 81#[serde(bound(deserialize = "'de: 'a"))] 82pub enum RemoveReactionError<'a> { 83 ///Indicates that the message has been deleted and reactions can no longer be added/removed. 84 #[serde(rename = "ReactionMessageDeleted")] 85 ReactionMessageDeleted(std::option::Option<String>), 86 ///Indicates the value for the reaction is not acceptable. In general, this means it is not an emoji. 87 #[serde(rename = "ReactionInvalidValue")] 88 ReactionInvalidValue(std::option::Option<String>), 89} 90 91impl std::fmt::Display for RemoveReactionError<'_> { 92 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 93 match self { 94 Self::ReactionMessageDeleted(msg) => { 95 write!(f, "ReactionMessageDeleted")?; 96 if let Some(msg) = msg { 97 write!(f, ": {}", msg)?; 98 } 99 Ok(()) 100 } 101 Self::ReactionInvalidValue(msg) => { 102 write!(f, "ReactionInvalidValue")?; 103 if let Some(msg) = msg { 104 write!(f, ": {}", msg)?; 105 } 106 Ok(()) 107 } 108 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 109 } 110 } 111} 112 113impl jacquard_common::IntoStatic for RemoveReactionError<'_> { 114 type Output = RemoveReactionError<'static>; 115 fn into_static(self) -> Self::Output { 116 match self { 117 RemoveReactionError::ReactionMessageDeleted(v) => { 118 RemoveReactionError::ReactionMessageDeleted(v.into_static()) 119 } 120 RemoveReactionError::ReactionInvalidValue(v) => { 121 RemoveReactionError::ReactionInvalidValue(v.into_static()) 122 } 123 RemoveReactionError::Unknown(v) => { 124 RemoveReactionError::Unknown(v.into_static()) 125 } 126 } 127 } 128} 129 130impl jacquard_common::types::xrpc::XrpcRequest for RemoveReaction<'_> { 131 const NSID: &'static str = "chat.bsky.convo.removeReaction"; 132 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Procedure( 133 "application/json", 134 ); 135 const OUTPUT_ENCODING: &'static str = "application/json"; 136 type Output<'de> = RemoveReactionOutput<'de>; 137 type Err<'de> = RemoveReactionError<'de>; 138}