Skip to main content

jacquard_api/app_bsky/contact/
remove_data.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.contact.removeData
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, BosStr, DefaultStr, FromStaticStr};
14use jacquard_common::deps::smol_str::SmolStr;
15use jacquard_common::types::value::Data;
16use jacquard_derive::{IntoStatic, open_union};
17use serde::{Serialize, Deserialize};
18
19#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
20#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
21pub struct RemoveData<S: BosStr = DefaultStr> {
22    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
23    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
24}
25
26
27#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
28#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
29pub struct RemoveDataOutput<S: BosStr = DefaultStr> {
30    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
31    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
32}
33
34
35#[derive(
36    Serialize,
37    Deserialize,
38    Debug,
39    Clone,
40    PartialEq,
41    Eq,
42    thiserror::Error,
43    miette::Diagnostic
44)]
45
46#[serde(tag = "error", content = "message")]
47pub enum RemoveDataError {
48    #[serde(rename = "InvalidDid")]
49    InvalidDid(Option<SmolStr>),
50    #[serde(rename = "InternalError")]
51    InternalError(Option<SmolStr>),
52    /// Catch-all for unknown error codes.
53    #[serde(untagged)]
54    Other { error: SmolStr, message: Option<SmolStr> },
55}
56
57impl core::fmt::Display for RemoveDataError {
58    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
59        match self {
60            Self::InvalidDid(msg) => {
61                write!(f, "InvalidDid")?;
62                if let Some(msg) = msg {
63                    write!(f, ": {}", msg)?;
64                }
65                Ok(())
66            }
67            Self::InternalError(msg) => {
68                write!(f, "InternalError")?;
69                if let Some(msg) = msg {
70                    write!(f, ": {}", msg)?;
71                }
72                Ok(())
73            }
74            Self::Other { error, message } => {
75                write!(f, "{}", error)?;
76                if let Some(msg) = message {
77                    write!(f, ": {}", msg)?;
78                }
79                Ok(())
80            }
81        }
82    }
83}
84
85/** Response marker for the `app.bsky.contact.removeData` procedure.
86
87Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `RemoveDataOutput<S>` for this endpoint.*/
88pub struct RemoveDataResponse;
89impl jacquard_common::xrpc::XrpcResp for RemoveDataResponse {
90    const NSID: &'static str = "app.bsky.contact.removeData";
91    const ENCODING: &'static str = "application/json";
92    type Output<S: BosStr> = RemoveDataOutput<S>;
93    type Err = RemoveDataError;
94}
95
96impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for RemoveData<S> {
97    const NSID: &'static str = "app.bsky.contact.removeData";
98    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
99        "application/json",
100    );
101    type Response = RemoveDataResponse;
102}
103
104/** Endpoint marker for the `app.bsky.contact.removeData` procedure.
105
106Path: `/xrpc/app.bsky.contact.removeData`. The request payload type is `RemoveData<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
107pub struct RemoveDataRequest;
108impl jacquard_common::xrpc::XrpcEndpoint for RemoveDataRequest {
109    const PATH: &'static str = "/xrpc/app.bsky.contact.removeData";
110    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
111        "application/json",
112    );
113    type Request<S: BosStr> = RemoveData<S>;
114    type Response = RemoveDataResponse;
115}