atproto blogging
at main 158 lines 4.4 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: chat.bsky.convo.updateAllRead 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 jacquard_derive::IntoStatic, 17 Default 18)] 19#[serde(rename_all = "camelCase")] 20pub struct UpdateAllRead<'a> { 21 #[serde(skip_serializing_if = "std::option::Option::is_none")] 22 #[serde(borrow)] 23 pub status: std::option::Option<UpdateAllReadStatus<'a>>, 24} 25 26#[derive(Debug, Clone, PartialEq, Eq, Hash)] 27pub enum UpdateAllReadStatus<'a> { 28 Request, 29 Accepted, 30 Other(jacquard_common::CowStr<'a>), 31} 32 33impl<'a> UpdateAllReadStatus<'a> { 34 pub fn as_str(&self) -> &str { 35 match self { 36 Self::Request => "request", 37 Self::Accepted => "accepted", 38 Self::Other(s) => s.as_ref(), 39 } 40 } 41} 42 43impl<'a> From<&'a str> for UpdateAllReadStatus<'a> { 44 fn from(s: &'a str) -> Self { 45 match s { 46 "request" => Self::Request, 47 "accepted" => Self::Accepted, 48 _ => Self::Other(jacquard_common::CowStr::from(s)), 49 } 50 } 51} 52 53impl<'a> From<String> for UpdateAllReadStatus<'a> { 54 fn from(s: String) -> Self { 55 match s.as_str() { 56 "request" => Self::Request, 57 "accepted" => Self::Accepted, 58 _ => Self::Other(jacquard_common::CowStr::from(s)), 59 } 60 } 61} 62 63impl<'a> core::fmt::Display for UpdateAllReadStatus<'a> { 64 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 65 write!(f, "{}", self.as_str()) 66 } 67} 68 69impl<'a> AsRef<str> for UpdateAllReadStatus<'a> { 70 fn as_ref(&self) -> &str { 71 self.as_str() 72 } 73} 74 75impl<'a> serde::Serialize for UpdateAllReadStatus<'a> { 76 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> 77 where 78 S: serde::Serializer, 79 { 80 serializer.serialize_str(self.as_str()) 81 } 82} 83 84impl<'de, 'a> serde::Deserialize<'de> for UpdateAllReadStatus<'a> 85where 86 'de: 'a, 87{ 88 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> 89 where 90 D: serde::Deserializer<'de>, 91 { 92 let s = <&'de str>::deserialize(deserializer)?; 93 Ok(Self::from(s)) 94 } 95} 96 97impl<'a> Default for UpdateAllReadStatus<'a> { 98 fn default() -> Self { 99 Self::Other(Default::default()) 100 } 101} 102 103impl jacquard_common::IntoStatic for UpdateAllReadStatus<'_> { 104 type Output = UpdateAllReadStatus<'static>; 105 fn into_static(self) -> Self::Output { 106 match self { 107 UpdateAllReadStatus::Request => UpdateAllReadStatus::Request, 108 UpdateAllReadStatus::Accepted => UpdateAllReadStatus::Accepted, 109 UpdateAllReadStatus::Other(v) => UpdateAllReadStatus::Other(v.into_static()), 110 } 111 } 112} 113 114#[jacquard_derive::lexicon] 115#[derive( 116 serde::Serialize, 117 serde::Deserialize, 118 Debug, 119 Clone, 120 PartialEq, 121 Eq, 122 jacquard_derive::IntoStatic 123)] 124#[serde(rename_all = "camelCase")] 125pub struct UpdateAllReadOutput<'a> { 126 /// The count of updated convos. 127 pub updated_count: i64, 128} 129 130/// Response type for 131///chat.bsky.convo.updateAllRead 132pub struct UpdateAllReadResponse; 133impl jacquard_common::xrpc::XrpcResp for UpdateAllReadResponse { 134 const NSID: &'static str = "chat.bsky.convo.updateAllRead"; 135 const ENCODING: &'static str = "application/json"; 136 type Output<'de> = UpdateAllReadOutput<'de>; 137 type Err<'de> = jacquard_common::xrpc::GenericError<'de>; 138} 139 140impl<'a> jacquard_common::xrpc::XrpcRequest for UpdateAllRead<'a> { 141 const NSID: &'static str = "chat.bsky.convo.updateAllRead"; 142 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 143 "application/json", 144 ); 145 type Response = UpdateAllReadResponse; 146} 147 148/// Endpoint type for 149///chat.bsky.convo.updateAllRead 150pub struct UpdateAllReadRequest; 151impl jacquard_common::xrpc::XrpcEndpoint for UpdateAllReadRequest { 152 const PATH: &'static str = "/xrpc/chat.bsky.convo.updateAllRead"; 153 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 154 "application/json", 155 ); 156 type Request<'de> = UpdateAllRead<'de>; 157 type Response = UpdateAllReadResponse; 158}