zulip-api 0.0.8

Client library for interacting with the Zulip API
Documentation
use serde::{Deserialize, Serialize};

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

/// Represents the details of the default external account provider with the name of the website as the key.
///
/// 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 RealmDefaultExternalAccount {
    #[serde(skip_serializing_if = "Option::is_none")]
    name: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    text: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    hint: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    url_pattern: Option<String>,
}

impl RealmDefaultExternalAccount {
    /// Creates a new [RealmDefaultExternalAccount].
    pub const fn new() -> Self {
        Self {
            name: None,
            text: None,
            hint: None,
            url_pattern: None,
        }
    }
}

field_access! {
    RealmDefaultExternalAccount {
        /// The name of the external account provider
        name: option_cow_deref { str, String },
        /// The text describing the external account.
        text: option_cow_deref { str, String },
        /// The help text to be displayed for the custom profile field in user-facing settings UI for configuring custom profile fields for this account.
        hint: option_cow_deref { str, String },
        /// The regex pattern of the URL of a profile page on the external site.
        url_pattern: option_cow_deref { str, String },
    }
}

impl_default!(RealmDefaultExternalAccount);
impl_display!(RealmDefaultExternalAccount);