zulip-api 0.0.8

Client library for interacting with the Zulip API
Documentation
use std::collections::HashMap;

use serde::{Deserialize, Serialize};

use crate::{field_access, impl_default, impl_display};

/// Represents details of an embedded bot. Embedded bots are an experimental feature not enabled in production yet.
///
/// 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 RealmEmbeddedBot {
    #[serde(skip_serializing_if = "Option::is_none")]
    name: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    config: Option<HashMap<String, String>>,
}

impl RealmEmbeddedBot {
    /// Object containing details of an embedded bot. Embedded bots are an experimental feature not enabled in production yet.
    pub const fn new() -> Self {
        Self {
            name: None,
            config: None,
        }
    }
}

field_access! {
    RealmEmbeddedBot {
        /// The name of the bot.
        name: option_cow_deref { str, String },
    }
}

field_access! {
    RealmEmbeddedBot {
        /// 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.
        config: option_ref { HashMap<String, String> },
    }
}

impl_default!(RealmEmbeddedBot);
impl_display!(RealmEmbeddedBot);