A better Rust ATProto crate
at lifetimes 3.8 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.sync.getRepoStatus 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 jacquard_derive::IntoStatic 17)] 18#[builder(start_fn = new)] 19#[serde(rename_all = "camelCase")] 20pub struct GetRepoStatus<'a> { 21 #[serde(borrow)] 22 pub did: jacquard_common::types::string::Did<'a>, 23} 24 25#[jacquard_derive::lexicon] 26#[derive( 27 serde::Serialize, 28 serde::Deserialize, 29 Debug, 30 Clone, 31 PartialEq, 32 Eq, 33 jacquard_derive::IntoStatic 34)] 35#[serde(rename_all = "camelCase")] 36pub struct GetRepoStatusOutput<'a> { 37 pub active: bool, 38 #[serde(borrow)] 39 pub did: jacquard_common::types::string::Did<'a>, 40 ///Optional field, the current rev of the repo, if active=true 41 #[serde(skip_serializing_if = "std::option::Option::is_none")] 42 pub rev: std::option::Option<jacquard_common::types::string::Tid>, 43 ///If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. 44 #[serde(skip_serializing_if = "std::option::Option::is_none")] 45 #[serde(borrow)] 46 pub status: std::option::Option<jacquard_common::CowStr<'a>>, 47} 48 49#[jacquard_derive::open_union] 50#[derive( 51 serde::Serialize, 52 serde::Deserialize, 53 Debug, 54 Clone, 55 PartialEq, 56 Eq, 57 thiserror::Error, 58 miette::Diagnostic 59)] 60#[serde(tag = "error", content = "message")] 61#[serde(bound(deserialize = "'de: 'a"))] 62pub enum GetRepoStatusError<'a> { 63 #[serde(rename = "RepoNotFound")] 64 RepoNotFound(std::option::Option<String>), 65} 66 67impl std::fmt::Display for GetRepoStatusError<'_> { 68 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 69 match self { 70 Self::RepoNotFound(msg) => { 71 write!(f, "RepoNotFound")?; 72 if let Some(msg) = msg { 73 write!(f, ": {}", msg)?; 74 } 75 Ok(()) 76 } 77 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 78 } 79 } 80} 81 82impl jacquard_common::IntoStatic for GetRepoStatusError<'_> { 83 type Output = GetRepoStatusError<'static>; 84 fn into_static(self) -> Self::Output { 85 match self { 86 GetRepoStatusError::RepoNotFound(v) => { 87 GetRepoStatusError::RepoNotFound(v.into_static()) 88 } 89 GetRepoStatusError::Unknown(v) => { 90 GetRepoStatusError::Unknown(v.into_static()) 91 } 92 } 93 } 94} 95 96///Response type for 97///com.atproto.sync.getRepoStatus 98pub struct GetRepoStatusResponse; 99impl jacquard_common::xrpc::XrpcResp for GetRepoStatusResponse { 100 const NSID: &'static str = "com.atproto.sync.getRepoStatus"; 101 const ENCODING: &'static str = "application/json"; 102 type Output<'de> = GetRepoStatusOutput<'de>; 103 type Err<'de> = GetRepoStatusError<'de>; 104} 105 106impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetRepoStatus<'de> { 107 const NSID: &'static str = "com.atproto.sync.getRepoStatus"; 108 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 109 type Response = GetRepoStatusResponse; 110} 111 112///Endpoint type for 113///com.atproto.sync.getRepoStatus 114pub struct GetRepoStatusRequest; 115impl jacquard_common::xrpc::XrpcEndpoint for GetRepoStatusRequest { 116 const PATH: &'static str = "/xrpc/com.atproto.sync.getRepoStatus"; 117 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 118 type Request<'de> = GetRepoStatus<'de>; 119 type Response = GetRepoStatusResponse; 120}