jacquard_api/place_stream/server/
get_webhook.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: place.stream.server.getWebhook
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[derive(
9    serde::Serialize,
10    serde::Deserialize,
11    Debug,
12    Clone,
13    PartialEq,
14    Eq,
15    bon::Builder,
16    jacquard_derive::IntoStatic
17)]
18#[builder(start_fn = new)]
19#[serde(rename_all = "camelCase")]
20pub struct GetWebhook<'a> {
21    #[serde(borrow)]
22    #[builder(into)]
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 GetWebhookOutput<'a> {
38    #[serde(borrow)]
39    pub webhook: crate::place_stream::server::Webhook<'a>,
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)]
53#[serde(tag = "error", content = "message")]
54#[serde(bound(deserialize = "'de: 'a"))]
55pub enum GetWebhookError<'a> {
56    ///The specified webhook was not found.
57    #[serde(rename = "WebhookNotFound")]
58    WebhookNotFound(std::option::Option<String>),
59    ///The authenticated user does not have access to this webhook.
60    #[serde(rename = "Unauthorized")]
61    Unauthorized(std::option::Option<String>),
62}
63
64impl std::fmt::Display for GetWebhookError<'_> {
65    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
66        match self {
67            Self::WebhookNotFound(msg) => {
68                write!(f, "WebhookNotFound")?;
69                if let Some(msg) = msg {
70                    write!(f, ": {}", msg)?;
71                }
72                Ok(())
73            }
74            Self::Unauthorized(msg) => {
75                write!(f, "Unauthorized")?;
76                if let Some(msg) = msg {
77                    write!(f, ": {}", msg)?;
78                }
79                Ok(())
80            }
81            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
82        }
83    }
84}
85
86impl jacquard_common::IntoStatic for GetWebhookError<'_> {
87    type Output = GetWebhookError<'static>;
88    fn into_static(self) -> Self::Output {
89        match self {
90            GetWebhookError::WebhookNotFound(v) => {
91                GetWebhookError::WebhookNotFound(v.into_static())
92            }
93            GetWebhookError::Unauthorized(v) => {
94                GetWebhookError::Unauthorized(v.into_static())
95            }
96            GetWebhookError::Unknown(v) => GetWebhookError::Unknown(v.into_static()),
97        }
98    }
99}
100
101///Response type for
102///place.stream.server.getWebhook
103pub struct GetWebhookResponse;
104impl jacquard_common::xrpc::XrpcResp for GetWebhookResponse {
105    const NSID: &'static str = "place.stream.server.getWebhook";
106    const ENCODING: &'static str = "application/json";
107    type Output<'de> = GetWebhookOutput<'de>;
108    type Err<'de> = GetWebhookError<'de>;
109}
110
111impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for GetWebhook<'de> {
112    const NSID: &'static str = "place.stream.server.getWebhook";
113    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
114    type Response = GetWebhookResponse;
115}
116
117///Endpoint type for
118///place.stream.server.getWebhook
119pub struct GetWebhookRequest;
120impl jacquard_common::xrpc::XrpcEndpoint for GetWebhookRequest {
121    const PATH: &'static str = "/xrpc/place.stream.server.getWebhook";
122    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
123    type Request<'de> = GetWebhook<'de>;
124    type Response = GetWebhookResponse;
125}