jacquard_api/place_stream/server/
list_webhooks.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: place.stream.server.listWebhooks
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 ListWebhooks<'a> {
21    #[serde(skip_serializing_if = "std::option::Option::is_none")]
22    pub active: std::option::Option<bool>,
23    #[serde(skip_serializing_if = "std::option::Option::is_none")]
24    #[serde(borrow)]
25    #[builder(into)]
26    pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
27    #[serde(skip_serializing_if = "std::option::Option::is_none")]
28    #[serde(borrow)]
29    #[builder(into)]
30    pub event: std::option::Option<jacquard_common::CowStr<'a>>,
31    ///(default: 50, min: 1, max: 100)
32    #[serde(skip_serializing_if = "std::option::Option::is_none")]
33    pub limit: std::option::Option<i64>,
34}
35
36#[jacquard_derive::lexicon]
37#[derive(
38    serde::Serialize,
39    serde::Deserialize,
40    Debug,
41    Clone,
42    PartialEq,
43    Eq,
44    jacquard_derive::IntoStatic
45)]
46#[serde(rename_all = "camelCase")]
47pub struct ListWebhooksOutput<'a> {
48    ///A cursor for pagination, if there are more results.
49    #[serde(skip_serializing_if = "std::option::Option::is_none")]
50    #[serde(borrow)]
51    pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
52    #[serde(borrow)]
53    pub webhooks: Vec<crate::place_stream::server::Webhook<'a>>,
54}
55
56#[jacquard_derive::open_union]
57#[derive(
58    serde::Serialize,
59    serde::Deserialize,
60    Debug,
61    Clone,
62    PartialEq,
63    Eq,
64    thiserror::Error,
65    miette::Diagnostic
66)]
67#[serde(tag = "error", content = "message")]
68#[serde(bound(deserialize = "'de: 'a"))]
69pub enum ListWebhooksError<'a> {
70    ///The provided cursor is invalid or expired.
71    #[serde(rename = "InvalidCursor")]
72    InvalidCursor(std::option::Option<String>),
73}
74
75impl std::fmt::Display for ListWebhooksError<'_> {
76    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
77        match self {
78            Self::InvalidCursor(msg) => {
79                write!(f, "InvalidCursor")?;
80                if let Some(msg) = msg {
81                    write!(f, ": {}", msg)?;
82                }
83                Ok(())
84            }
85            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
86        }
87    }
88}
89
90impl jacquard_common::IntoStatic for ListWebhooksError<'_> {
91    type Output = ListWebhooksError<'static>;
92    fn into_static(self) -> Self::Output {
93        match self {
94            ListWebhooksError::InvalidCursor(v) => {
95                ListWebhooksError::InvalidCursor(v.into_static())
96            }
97            ListWebhooksError::Unknown(v) => ListWebhooksError::Unknown(v.into_static()),
98        }
99    }
100}
101
102///Response type for
103///place.stream.server.listWebhooks
104pub struct ListWebhooksResponse;
105impl jacquard_common::xrpc::XrpcResp for ListWebhooksResponse {
106    const NSID: &'static str = "place.stream.server.listWebhooks";
107    const ENCODING: &'static str = "application/json";
108    type Output<'de> = ListWebhooksOutput<'de>;
109    type Err<'de> = ListWebhooksError<'de>;
110}
111
112impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for ListWebhooks<'de> {
113    const NSID: &'static str = "place.stream.server.listWebhooks";
114    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
115    type Response = ListWebhooksResponse;
116}
117
118///Endpoint type for
119///place.stream.server.listWebhooks
120pub struct ListWebhooksRequest;
121impl jacquard_common::xrpc::XrpcEndpoint for ListWebhooksRequest {
122    const PATH: &'static str = "/xrpc/place.stream.server.listWebhooks";
123    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
124    type Request<'de> = ListWebhooks<'de>;
125    type Response = ListWebhooksResponse;
126}