Skip to main content

zulip_api/message/
realm_default_external_account.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{field_access, impl_default, impl_display};
4
5/// Represents the details of the default external account provider with the name of the website as the key.
6///
7/// Modified from `openapi-generator-cli` output:
8///
9/// ```shell,no_build,no_run
10/// $ openapi-generator-cli generate -g rust -i ./zerver/openapi/zulip.yaml -o zulip-openapi --skip-validate-spec
11/// ```
12///
13/// ```text
14/// /*
15/// * Zulip REST API
16/// *
17/// * Powerful open source group chat
18/// *
19/// * The version of the OpenAPI document: 1.0.0
20/// *
21/// * Generated by: https://openapi-generator.tech
22/// */
23/// ```
24///
25/// See [zerver/openapi/zulip.yaml](https://github.com/zulip/zulip/blob/main/zerver/openapi/zulip.yaml) for the original OpenAPI configuration.
26///
27/// Configuration slightly modified to work with the Rust generator of [`openapi-generator-cli`](https://openapi-generator.tech).
28#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
29pub struct RealmDefaultExternalAccount {
30    #[serde(skip_serializing_if = "Option::is_none")]
31    name: Option<String>,
32    #[serde(skip_serializing_if = "Option::is_none")]
33    text: Option<String>,
34    #[serde(skip_serializing_if = "Option::is_none")]
35    hint: Option<String>,
36    #[serde(skip_serializing_if = "Option::is_none")]
37    url_pattern: Option<String>,
38}
39
40impl RealmDefaultExternalAccount {
41    /// Creates a new [RealmDefaultExternalAccount].
42    pub const fn new() -> Self {
43        Self {
44            name: None,
45            text: None,
46            hint: None,
47            url_pattern: None,
48        }
49    }
50}
51
52field_access! {
53    RealmDefaultExternalAccount {
54        /// The name of the external account provider
55        name: option_cow_deref { str, String },
56        /// The text describing the external account.
57        text: option_cow_deref { str, String },
58        /// The help text to be displayed for the custom profile field in user-facing settings UI for configuring custom profile fields for this account.
59        hint: option_cow_deref { str, String },
60        /// The regex pattern of the URL of a profile page on the external site.
61        url_pattern: option_cow_deref { str, String },
62    }
63}
64
65impl_default!(RealmDefaultExternalAccount);
66impl_display!(RealmDefaultExternalAccount);