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 bon::Builder,
17 jacquard_derive::IntoStatic
18)]
19#[serde(rename_all = "camelCase")]
20#[builder(start_fn = new)]
21pub struct DeleteWebhook<'a> {
22 #[serde(borrow)]
24 #[builder(into)]
25 pub id: jacquard_common::CowStr<'a>,
26 #[serde(flatten)]
27 #[serde(borrow)]
28 #[builder(default)]
29 pub extra_data: ::std::collections::BTreeMap<
30 ::jacquard_common::smol_str::SmolStr,
31 ::jacquard_common::types::value::Data<'a>,
32 >,
33}
34
35#[jacquard_derive::lexicon]
36#[derive(
37 serde::Serialize,
38 serde::Deserialize,
39 Debug,
40 Clone,
41 PartialEq,
42 Eq,
43 jacquard_derive::IntoStatic
44)]
45#[serde(rename_all = "camelCase")]
46pub struct DeleteWebhookOutput<'a> {
47 pub success: bool,
49}
50
51#[jacquard_derive::open_union]
52#[derive(
53 serde::Serialize,
54 serde::Deserialize,
55 Debug,
56 Clone,
57 PartialEq,
58 Eq,
59 thiserror::Error,
60 miette::Diagnostic,
61 jacquard_derive::IntoStatic
62)]
63#[serde(tag = "error", content = "message")]
64#[serde(bound(deserialize = "'de: 'a"))]
65pub enum DeleteWebhookError<'a> {
66 #[serde(rename = "WebhookNotFound")]
68 WebhookNotFound(std::option::Option<String>),
69 #[serde(rename = "Unauthorized")]
71 Unauthorized(std::option::Option<String>),
72}
73
74impl std::fmt::Display for DeleteWebhookError<'_> {
75 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
76 match self {
77 Self::WebhookNotFound(msg) => {
78 write!(f, "WebhookNotFound")?;
79 if let Some(msg) = msg {
80 write!(f, ": {}", msg)?;
81 }
82 Ok(())
83 }
84 Self::Unauthorized(msg) => {
85 write!(f, "Unauthorized")?;
86 if let Some(msg) = msg {
87 write!(f, ": {}", msg)?;
88 }
89 Ok(())
90 }
91 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
92 }
93 }
94}
95
96pub struct DeleteWebhookResponse;
99impl jacquard_common::xrpc::XrpcResp for DeleteWebhookResponse {
100 const NSID: &'static str = "place.stream.server.deleteWebhook";
101 const ENCODING: &'static str = "application/json";
102 type Output<'de> = DeleteWebhookOutput<'de>;
103 type Err<'de> = DeleteWebhookError<'de>;
104}
105
106impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for DeleteWebhook<'de> {
107 const NSID: &'static str = "place.stream.server.deleteWebhook";
108 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
109 "application/json",
110 );
111 type Response = DeleteWebhookResponse;
112}
113
114pub struct DeleteWebhookRequest;
117impl jacquard_common::xrpc::XrpcEndpoint for DeleteWebhookRequest {
118 const PATH: &'static str = "/xrpc/place.stream.server.deleteWebhook";
119 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
120 "application/json",
121 );
122 type Request<'de> = DeleteWebhook<'de>;
123 type Response = DeleteWebhookResponse;
124}