Skip to main content

jacquard_api/chat_bsky/group/
disable_join_link.rs

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