jacquard_api/place_stream/server/
delete_webhook.rs1#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic,
17 Default
18)]
19#[serde(rename_all = "camelCase")]
20pub struct DeleteWebhook<'a> {
21 #[serde(borrow)]
23 pub id: jacquard_common::CowStr<'a>,
24}
25
26#[jacquard_derive::lexicon]
27#[derive(
28 serde::Serialize,
29 serde::Deserialize,
30 Debug,
31 Clone,
32 PartialEq,
33 Eq,
34 jacquard_derive::IntoStatic
35)]
36#[serde(rename_all = "camelCase")]
37pub struct DeleteWebhookOutput<'a> {
38 pub success: bool,
40}
41
42#[jacquard_derive::open_union]
43#[derive(
44 serde::Serialize,
45 serde::Deserialize,
46 Debug,
47 Clone,
48 PartialEq,
49 Eq,
50 thiserror::Error,
51 miette::Diagnostic,
52 jacquard_derive::IntoStatic
53)]
54#[serde(tag = "error", content = "message")]
55#[serde(bound(deserialize = "'de: 'a"))]
56pub enum DeleteWebhookError<'a> {
57 #[serde(rename = "WebhookNotFound")]
59 WebhookNotFound(std::option::Option<String>),
60 #[serde(rename = "Unauthorized")]
62 Unauthorized(std::option::Option<String>),
63}
64
65impl std::fmt::Display for DeleteWebhookError<'_> {
66 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
67 match self {
68 Self::WebhookNotFound(msg) => {
69 write!(f, "WebhookNotFound")?;
70 if let Some(msg) = msg {
71 write!(f, ": {}", msg)?;
72 }
73 Ok(())
74 }
75 Self::Unauthorized(msg) => {
76 write!(f, "Unauthorized")?;
77 if let Some(msg) = msg {
78 write!(f, ": {}", msg)?;
79 }
80 Ok(())
81 }
82 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
83 }
84 }
85}
86
87pub struct DeleteWebhookResponse;
90impl jacquard_common::xrpc::XrpcResp for DeleteWebhookResponse {
91 const NSID: &'static str = "place.stream.server.deleteWebhook";
92 const ENCODING: &'static str = "application/json";
93 type Output<'de> = DeleteWebhookOutput<'de>;
94 type Err<'de> = DeleteWebhookError<'de>;
95}
96
97impl<'a> jacquard_common::xrpc::XrpcRequest for DeleteWebhook<'a> {
98 const NSID: &'static str = "place.stream.server.deleteWebhook";
99 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
100 "application/json",
101 );
102 type Response = DeleteWebhookResponse;
103}
104
105pub struct DeleteWebhookRequest;
108impl jacquard_common::xrpc::XrpcEndpoint for DeleteWebhookRequest {
109 const PATH: &'static str = "/xrpc/place.stream.server.deleteWebhook";
110 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
111 "application/json",
112 );
113 type Request<'de> = DeleteWebhook<'de>;
114 type Response = DeleteWebhookResponse;
115}