Skip to main content

jacquard_api/app_bsky/contact/
get_sync_status.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.contact.getSyncStatus
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14use jacquard_derive::{IntoStatic, lexicon, open_union};
15use serde::{Serialize, Deserialize};
16use crate::app_bsky::contact::SyncStatus;
17
18#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
19#[serde(rename_all = "camelCase")]
20pub struct GetSyncStatus;
21
22#[lexicon]
23#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
24#[serde(rename_all = "camelCase")]
25pub struct GetSyncStatusOutput<'a> {
26    ///If present, indicates the user has imported their contacts. If not present, indicates the user never used the feature or called `app.bsky.contact.removeData` and didn't import again since.
27    #[serde(skip_serializing_if = "Option::is_none")]
28    #[serde(borrow)]
29    pub sync_status: Option<SyncStatus<'a>>,
30}
31
32
33#[open_union]
34#[derive(
35    Serialize,
36    Deserialize,
37    Debug,
38    Clone,
39    PartialEq,
40    Eq,
41    thiserror::Error,
42    miette::Diagnostic,
43    IntoStatic
44)]
45
46#[serde(tag = "error", content = "message")]
47#[serde(bound(deserialize = "'de: 'a"))]
48pub enum GetSyncStatusError<'a> {
49    #[serde(rename = "InvalidDid")]
50    InvalidDid(Option<CowStr<'a>>),
51    #[serde(rename = "InternalError")]
52    InternalError(Option<CowStr<'a>>),
53}
54
55impl core::fmt::Display for GetSyncStatusError<'_> {
56    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
57        match self {
58            Self::InvalidDid(msg) => {
59                write!(f, "InvalidDid")?;
60                if let Some(msg) = msg {
61                    write!(f, ": {}", msg)?;
62                }
63                Ok(())
64            }
65            Self::InternalError(msg) => {
66                write!(f, "InternalError")?;
67                if let Some(msg) = msg {
68                    write!(f, ": {}", msg)?;
69                }
70                Ok(())
71            }
72            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
73        }
74    }
75}
76
77/// Response type for app.bsky.contact.getSyncStatus
78pub struct GetSyncStatusResponse;
79impl jacquard_common::xrpc::XrpcResp for GetSyncStatusResponse {
80    const NSID: &'static str = "app.bsky.contact.getSyncStatus";
81    const ENCODING: &'static str = "application/json";
82    type Output<'de> = GetSyncStatusOutput<'de>;
83    type Err<'de> = GetSyncStatusError<'de>;
84}
85
86impl jacquard_common::xrpc::XrpcRequest for GetSyncStatus {
87    const NSID: &'static str = "app.bsky.contact.getSyncStatus";
88    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
89    type Response = GetSyncStatusResponse;
90}
91
92/// Endpoint type for app.bsky.contact.getSyncStatus
93pub struct GetSyncStatusRequest;
94impl jacquard_common::xrpc::XrpcEndpoint for GetSyncStatusRequest {
95    const PATH: &'static str = "/xrpc/app.bsky.contact.getSyncStatus";
96    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
97    type Request<'de> = GetSyncStatus;
98    type Response = GetSyncStatusResponse;
99}