1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
/// Represents extra configuration details for the bot.
///
/// The fields in the object depend on the type of bot.
///
/// Modified from `openapi-generator-cli` output:
///
/// ```shell,no_build,no_run
/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
/// ```
///
/// ```text
/// /*
/// * Zulip REST API
/// *
/// * Powerful open source group chat
/// *
/// * The version of the OpenAPI document: 1.0.0
/// *
/// * Generated by: https://openapi-generator.tech
/// */
/// ```
///
/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
///
/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum BotService {
OutgoingWebhook(BotServiceOutgoingWebhook),
Embedded(BotServiceEmbedded),
}
impl BotService {
/// Creates a new [BotService].
pub const fn new() -> Self {
Self::OutgoingWebhook(BotServiceOutgoingWebhook::new())
}
}
impl Default for BotService {
fn default() -> Self {
Self::new()
}
}
/// Represents when the bot is an outgoing webhook.
///
/// Modified from `openapi-generator-cli` output:
///
/// ```shell,no_build,no_run
/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
/// ```
///
/// ```text
/// /*
/// * Zulip REST API
/// *
/// * Powerful open source group chat
/// *
/// * The version of the OpenAPI document: 1.0.0
/// *
/// * Generated by: https://openapi-generator.tech
/// */
/// ```
///
/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
///
/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BotServiceOutgoingWebhook {
/// The URL the outgoing webhook is configured to post to.
#[serde(skip_serializing_if = "Option::is_none")]
pub base_url: Option<String>,
/// A unique token that the third-party service can use to confirm that the request is indeed coming from Zulip.
#[serde(skip_serializing_if = "Option::is_none")]
pub token: Option<String>,
/// An integer indicating what format requests are posted in: - 1 = Zulip's native outgoing webhook format. - 2 = Emulate the Slack outgoing webhook format.
#[serde(skip_serializing_if = "Option::is_none")]
pub interface: Option<OutgoingWebhookInterface>,
}
/// Represents An integer indicating what format requests are posted in
///
/// Modified from `openapi-generator-cli` output:
///
/// ```shell,no_build,no_run
/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
/// ```
///
/// ```text
/// /*
/// * Zulip REST API
/// *
/// * Powerful open source group chat
/// *
/// * The version of the OpenAPI document: 1.0.0
/// *
/// * Generated by: https://openapi-generator.tech
/// */
/// ```
///
/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
///
/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize_repr, Serialize_repr)]
pub enum OutgoingWebhookInterface {
/// Zulip's native outgoing webhook format
Native = 1,
/// Emulate the Slack outgoing webhook format.
EmulateSlack = 2,
}
impl BotServiceOutgoingWebhook {
/// When the bot is an outgoing webhook.
pub const fn new() -> Self {
Self {
base_url: None,
token: None,
interface: None,
}
}
}
impl Default for BotServiceOutgoingWebhook {
fn default() -> Self {
Self::new()
}
}
/// Represents when the bot is an embedded bot.
///
/// Modified from `openapi-generator-cli` output:
///
/// ```shell,no_build,no_run
/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
/// ```
///
/// ```text
/// /*
/// * Zulip REST API
/// *
/// * Powerful open source group chat
/// *
/// * The version of the OpenAPI document: 1.0.0
/// *
/// * Generated by: https://openapi-generator.tech
/// */
/// ```
///
/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
///
/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BotServiceEmbedded {
/// The name of the bot.
#[serde(rename = "service_name", skip_serializing_if = "Option::is_none")]
pub service_name: Option<String>,
/// A dictionary of string key/value pairs, which describe the configuration for the bot. These are usually details like API keys, and are unique to the integration/bot. Can be an empty dictionary.
#[serde(rename = "config_data", skip_serializing_if = "Option::is_none")]
pub config_data: Option<std::collections::HashMap<String, String>>,
}
impl BotServiceEmbedded {
/// Creates a new [BotServiceEmbedded].
pub const fn new() -> Self {
Self {
service_name: None,
config_data: None,
}
}
}
impl Default for BotServiceEmbedded {
fn default() -> Self {
Self::new()
}
}