Skip to main content

zulip_api/message/
realm_embedded_bot.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5use crate::{field_access, impl_default, impl_display};
6
7/// Represents details of an embedded bot. Embedded bots are an experimental feature not enabled in production yet.
8///
9/// Modified from `openapi-generator-cli` output:
10///
11/// ```shell,no_build,no_run
12/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
13/// ```
14///
15/// ```text
16/// /*
17/// * Zulip REST API
18/// *
19/// * Powerful open source group chat
20/// *
21/// * The version of the OpenAPI document: 1.0.0
22/// *
23/// * Generated by: https://openapi-generator.tech
24/// */
25/// ```
26///
27/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
28///
29/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
30#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
31pub struct RealmEmbeddedBot {
32    #[serde(skip_serializing_if = "Option::is_none")]
33    name: Option<String>,
34    #[serde(skip_serializing_if = "Option::is_none")]
35    config: Option<HashMap<String, String>>,
36}
37
38impl RealmEmbeddedBot {
39    /// Object containing details of an embedded bot. Embedded bots are an experimental feature not enabled in production yet.
40    pub const fn new() -> Self {
41        Self {
42            name: None,
43            config: None,
44        }
45    }
46}
47
48field_access! {
49    RealmEmbeddedBot {
50        /// The name of the bot.
51        name: option_cow_deref { str, String },
52    }
53}
54
55field_access! {
56    RealmEmbeddedBot {
57        /// A dictionary of string key/value pairs, which describe the configuration for the bot.
58        ///
59        /// These are usually details like API keys, and are unique to the integration/bot.
60        /// Can be an empty dictionary.
61        config: option_ref { HashMap<String, String> },
62    }
63}
64
65impl_default!(RealmEmbeddedBot);
66impl_display!(RealmEmbeddedBot);