Skip to main content

jacquard_api/place_stream/server/
delete_webhook.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: place.stream.server.deleteWebhook
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};
16
17#[lexicon]
18#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
19#[serde(rename_all = "camelCase")]
20pub struct DeleteWebhook<'a> {
21    ///The ID of the webhook to delete.
22    #[serde(borrow)]
23    pub id: CowStr<'a>,
24}
25
26
27#[lexicon]
28#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
29#[serde(rename_all = "camelCase")]
30pub struct DeleteWebhookOutput<'a> {
31    ///Whether the webhook was successfully deleted.
32    pub success: bool,
33}
34
35
36#[open_union]
37#[derive(
38    Serialize,
39    Deserialize,
40    Debug,
41    Clone,
42    PartialEq,
43    Eq,
44    thiserror::Error,
45    miette::Diagnostic,
46    IntoStatic
47)]
48
49#[serde(tag = "error", content = "message")]
50#[serde(bound(deserialize = "'de: 'a"))]
51pub enum DeleteWebhookError<'a> {
52    /// The specified webhook was not found.
53    #[serde(rename = "WebhookNotFound")]
54    WebhookNotFound(Option<CowStr<'a>>),
55    /// The authenticated user does not have access to this webhook.
56    #[serde(rename = "Unauthorized")]
57    Unauthorized(Option<CowStr<'a>>),
58}
59
60impl core::fmt::Display for DeleteWebhookError<'_> {
61    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
62        match self {
63            Self::WebhookNotFound(msg) => {
64                write!(f, "WebhookNotFound")?;
65                if let Some(msg) = msg {
66                    write!(f, ": {}", msg)?;
67                }
68                Ok(())
69            }
70            Self::Unauthorized(msg) => {
71                write!(f, "Unauthorized")?;
72                if let Some(msg) = msg {
73                    write!(f, ": {}", msg)?;
74                }
75                Ok(())
76            }
77            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
78        }
79    }
80}
81
82/// Response type for place.stream.server.deleteWebhook
83pub struct DeleteWebhookResponse;
84impl jacquard_common::xrpc::XrpcResp for DeleteWebhookResponse {
85    const NSID: &'static str = "place.stream.server.deleteWebhook";
86    const ENCODING: &'static str = "application/json";
87    type Output<'de> = DeleteWebhookOutput<'de>;
88    type Err<'de> = DeleteWebhookError<'de>;
89}
90
91impl<'a> jacquard_common::xrpc::XrpcRequest for DeleteWebhook<'a> {
92    const NSID: &'static str = "place.stream.server.deleteWebhook";
93    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
94        "application/json",
95    );
96    type Response = DeleteWebhookResponse;
97}
98
99/// Endpoint type for place.stream.server.deleteWebhook
100pub struct DeleteWebhookRequest;
101impl jacquard_common::xrpc::XrpcEndpoint for DeleteWebhookRequest {
102    const PATH: &'static str = "/xrpc/place.stream.server.deleteWebhook";
103    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
104        "application/json",
105    );
106    type Request<'de> = DeleteWebhook<'de>;
107    type Response = DeleteWebhookResponse;
108}