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)]
17#[builder(start_fn = new)]
18#[serde(rename_all = "camelCase")]
19pub struct GetRepoStatus<'a> {
20 #[serde(borrow)]
21 pub did: jacquard_common::types::string::Did<'a>,
22}
23
24impl jacquard_common::IntoStatic for GetRepoStatus<'_> {
25 type Output = GetRepoStatus<'static>;
26 fn into_static(self) -> Self::Output {
27 GetRepoStatus {
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 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
49impl jacquard_common::IntoStatic for GetRepoStatusOutput<'_> {
50 type Output = GetRepoStatusOutput<'static>;
51 fn into_static(self) -> Self::Output {
52 GetRepoStatusOutput {
53 active: self.active.into_static(),
54 did: self.did.into_static(),
55 rev: self.rev.into_static(),
56 status: self.status.into_static(),
57 extra_data: self.extra_data.into_static(),
58 }
59 }
60}
61
62#[jacquard_derive::open_union]
63#[derive(
64 serde::Serialize,
65 serde::Deserialize,
66 Debug,
67 Clone,
68 PartialEq,
69 Eq,
70 thiserror::Error,
71 miette::Diagnostic
72)]
73#[serde(tag = "error", content = "message")]
74#[serde(bound(deserialize = "'de: 'a"))]
75pub enum GetRepoStatusError<'a> {
76 #[serde(rename = "RepoNotFound")]
77 RepoNotFound(std::option::Option<String>),
78}
79
80impl std::fmt::Display for GetRepoStatusError<'_> {
81 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
82 match self {
83 Self::RepoNotFound(msg) => {
84 write!(f, "RepoNotFound")?;
85 if let Some(msg) = msg {
86 write!(f, ": {}", msg)?;
87 }
88 Ok(())
89 }
90 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
91 }
92 }
93}
94
95impl jacquard_common::IntoStatic for GetRepoStatusError<'_> {
96 type Output = GetRepoStatusError<'static>;
97 fn into_static(self) -> Self::Output {
98 match self {
99 GetRepoStatusError::RepoNotFound(v) => {
100 GetRepoStatusError::RepoNotFound(v.into_static())
101 }
102 GetRepoStatusError::Unknown(v) => {
103 GetRepoStatusError::Unknown(v.into_static())
104 }
105 }
106 }
107}
108
109impl jacquard_common::types::xrpc::XrpcRequest for GetRepoStatus<'_> {
110 const NSID: &'static str = "com.atproto.sync.getRepoStatus";
111 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query;
112 const OUTPUT_ENCODING: &'static str = "application/json";
113 type Output<'de> = GetRepoStatusOutput<'de>;
114 type Err<'de> = GetRepoStatusError<'de>;
115}