jacquard_api/chat_bsky/group/
withdraw_join_request.rs1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::deps::smol_str::SmolStr;
14use jacquard_common::types::value::Data;
15use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};
16use jacquard_derive::{IntoStatic, open_union};
17use serde::{Deserialize, Serialize};
18
19#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
20#[serde(
21 rename_all = "camelCase",
22 bound(deserialize = "S: Deserialize<'de> + BosStr")
23)]
24pub struct WithdrawJoinRequest<S: BosStr = DefaultStr> {
25 pub convo_id: S,
26 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
27 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
28}
29
30#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
31#[serde(
32 rename_all = "camelCase",
33 bound(deserialize = "S: Deserialize<'de> + BosStr")
34)]
35pub struct WithdrawJoinRequestOutput<S: BosStr = DefaultStr> {
36 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
37 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
38}
39
40#[derive(
41 Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic,
42)]
43#[serde(tag = "error", content = "message")]
44pub enum WithdrawJoinRequestError {
45 #[serde(rename = "InvalidJoinRequest")]
46 InvalidJoinRequest(Option<SmolStr>),
47 #[serde(untagged)]
49 Other {
50 error: SmolStr,
51 message: Option<SmolStr>,
52 },
53}
54
55impl core::fmt::Display for WithdrawJoinRequestError {
56 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
57 match self {
58 Self::InvalidJoinRequest(msg) => {
59 write!(f, "InvalidJoinRequest")?;
60 if let Some(msg) = msg {
61 write!(f, ": {}", msg)?;
62 }
63 Ok(())
64 }
65 Self::Other { error, message } => {
66 write!(f, "{}", error)?;
67 if let Some(msg) = message {
68 write!(f, ": {}", msg)?;
69 }
70 Ok(())
71 }
72 }
73 }
74}
75
76pub struct WithdrawJoinRequestResponse;
80impl jacquard_common::xrpc::XrpcResp for WithdrawJoinRequestResponse {
81 const NSID: &'static str = "chat.bsky.group.withdrawJoinRequest";
82 const ENCODING: &'static str = "application/json";
83 type Output<S: BosStr> = WithdrawJoinRequestOutput<S>;
84 type Err = WithdrawJoinRequestError;
85}
86
87impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for WithdrawJoinRequest<S> {
88 const NSID: &'static str = "chat.bsky.group.withdrawJoinRequest";
89 const METHOD: jacquard_common::xrpc::XrpcMethod =
90 jacquard_common::xrpc::XrpcMethod::Procedure("application/json");
91 type Response = WithdrawJoinRequestResponse;
92}
93
94pub struct WithdrawJoinRequestRequest;
98impl jacquard_common::xrpc::XrpcEndpoint for WithdrawJoinRequestRequest {
99 const PATH: &'static str = "/xrpc/chat.bsky.group.withdrawJoinRequest";
100 const METHOD: jacquard_common::xrpc::XrpcMethod =
101 jacquard_common::xrpc::XrpcMethod::Procedure("application/json");
102 type Request<S: BosStr> = WithdrawJoinRequest<S>;
103 type Response = WithdrawJoinRequestResponse;
104}