A better Rust ATProto crate
at oauth 2.9 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: tools.ozone.moderation.getRepo 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 GetRepo<'a> { 20 #[serde(borrow)] 21 pub did: jacquard_common::types::string::Did<'a>, 22} 23 24impl jacquard_common::IntoStatic for GetRepo<'_> { 25 type Output = GetRepo<'static>; 26 fn into_static(self) -> Self::Output { 27 GetRepo { 28 did: self.did.into_static(), 29 } 30 } 31} 32 33#[jacquard_derive::lexicon] 34#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 35#[serde(rename_all = "camelCase")] 36pub struct GetRepoOutput<'a> { 37 #[serde(flatten)] 38 #[serde(borrow)] 39 pub value: crate::tools_ozone::moderation::RepoViewDetail<'a>, 40} 41 42impl jacquard_common::IntoStatic for GetRepoOutput<'_> { 43 type Output = GetRepoOutput<'static>; 44 fn into_static(self) -> Self::Output { 45 GetRepoOutput { 46 value: self.value.into_static(), 47 extra_data: self.extra_data.into_static(), 48 } 49 } 50} 51 52#[jacquard_derive::open_union] 53#[derive( 54 serde::Serialize, 55 serde::Deserialize, 56 Debug, 57 Clone, 58 PartialEq, 59 Eq, 60 thiserror::Error, 61 miette::Diagnostic 62)] 63#[serde(tag = "error", content = "message")] 64#[serde(bound(deserialize = "'de: 'a"))] 65pub enum GetRepoError<'a> { 66 #[serde(rename = "RepoNotFound")] 67 RepoNotFound(std::option::Option<String>), 68} 69 70impl std::fmt::Display for GetRepoError<'_> { 71 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 72 match self { 73 Self::RepoNotFound(msg) => { 74 write!(f, "RepoNotFound")?; 75 if let Some(msg) = msg { 76 write!(f, ": {}", msg)?; 77 } 78 Ok(()) 79 } 80 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 81 } 82 } 83} 84 85impl jacquard_common::IntoStatic for GetRepoError<'_> { 86 type Output = GetRepoError<'static>; 87 fn into_static(self) -> Self::Output { 88 match self { 89 GetRepoError::RepoNotFound(v) => GetRepoError::RepoNotFound(v.into_static()), 90 GetRepoError::Unknown(v) => GetRepoError::Unknown(v.into_static()), 91 } 92 } 93} 94 95impl jacquard_common::types::xrpc::XrpcRequest for GetRepo<'_> { 96 const NSID: &'static str = "tools.ozone.moderation.getRepo"; 97 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query; 98 const OUTPUT_ENCODING: &'static str = "application/json"; 99 type Output<'de> = GetRepoOutput<'de>; 100 type Err<'de> = GetRepoError<'de>; 101}