// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: com.atproto.sync.getLatestCommit // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, bon::Builder )] #[builder(start_fn = new)] #[serde(rename_all = "camelCase")] pub struct GetLatestCommit<'a> { #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, } impl jacquard_common::IntoStatic for GetLatestCommit<'_> { type Output = GetLatestCommit<'static>; fn into_static(self) -> Self::Output { GetLatestCommit { did: self.did.into_static(), } } } #[jacquard_derive::lexicon] #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct GetLatestCommitOutput<'a> { #[serde(borrow)] pub cid: jacquard_common::types::string::Cid<'a>, pub rev: jacquard_common::types::string::Tid, } impl jacquard_common::IntoStatic for GetLatestCommitOutput<'_> { type Output = GetLatestCommitOutput<'static>; fn into_static(self) -> Self::Output { GetLatestCommitOutput { cid: self.cid.into_static(), rev: self.rev.into_static(), extra_data: self.extra_data.into_static(), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum GetLatestCommitError<'a> { #[serde(rename = "RepoNotFound")] RepoNotFound(std::option::Option), #[serde(rename = "RepoTakendown")] RepoTakendown(std::option::Option), #[serde(rename = "RepoSuspended")] RepoSuspended(std::option::Option), #[serde(rename = "RepoDeactivated")] RepoDeactivated(std::option::Option), } impl std::fmt::Display for GetLatestCommitError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::RepoNotFound(msg) => { write!(f, "RepoNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::RepoTakendown(msg) => { write!(f, "RepoTakendown")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::RepoSuspended(msg) => { write!(f, "RepoSuspended")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::RepoDeactivated(msg) => { write!(f, "RepoDeactivated")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } impl jacquard_common::IntoStatic for GetLatestCommitError<'_> { type Output = GetLatestCommitError<'static>; fn into_static(self) -> Self::Output { match self { GetLatestCommitError::RepoNotFound(v) => { GetLatestCommitError::RepoNotFound(v.into_static()) } GetLatestCommitError::RepoTakendown(v) => { GetLatestCommitError::RepoTakendown(v.into_static()) } GetLatestCommitError::RepoSuspended(v) => { GetLatestCommitError::RepoSuspended(v.into_static()) } GetLatestCommitError::RepoDeactivated(v) => { GetLatestCommitError::RepoDeactivated(v.into_static()) } GetLatestCommitError::Unknown(v) => { GetLatestCommitError::Unknown(v.into_static()) } } } } impl jacquard_common::types::xrpc::XrpcRequest for GetLatestCommit<'_> { const NSID: &'static str = "com.atproto.sync.getLatestCommit"; const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query; const OUTPUT_ENCODING: &'static str = "application/json"; type Output<'de> = GetLatestCommitOutput<'de>; type Err<'de> = GetLatestCommitError<'de>; }