appwrite 0.5.0

Appwrite SDK for Rust
Documentation
//! OAuth2Notion model for Appwrite SDK

use serde::{Deserialize, Serialize};

/// OAuth2Notion
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(test, derive(Default))]
pub struct OAuth2Notion {
    /// OAuth2 provider ID.
    #[serde(rename = "$id")]
    pub id: String,
    /// OAuth2 provider is active and can be used to create sessions.
    #[serde(rename = "enabled")]
    pub enabled: bool,
    /// Notion OAuth2 client ID.
    #[serde(rename = "oauthClientId")]
    pub oauth_client_id: String,
    /// Notion OAuth2 client secret.
    #[serde(rename = "oauthClientSecret")]
    pub oauth_client_secret: String,
}

impl OAuth2Notion {
    /// Get id
    pub fn id(&self) -> &String {
        &self.id
    }

    /// Get enabled
    pub fn enabled(&self) -> &bool {
        &self.enabled
    }

    /// Get oauth_client_id
    pub fn oauth_client_id(&self) -> &String {
        &self.oauth_client_id
    }

    /// Get oauth_client_secret
    pub fn oauth_client_secret(&self) -> &String {
        &self.oauth_client_secret
    }

}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_o_auth2_notion_creation() {
        let _model = <OAuth2Notion as Default>::default();
        let _ = _model.id();
        let _ = _model.enabled();
        let _ = _model.oauth_client_id();
        let _ = _model.oauth_client_secret();
    }

    #[test]
    fn test_o_auth2_notion_serialization() {
        let model = <OAuth2Notion as Default>::default();
        let json = serde_json::to_string(&model);
        assert!(json.is_ok());

        let deserialized: Result<OAuth2Notion, _> = serde_json::from_str(&json.unwrap());
        assert!(deserialized.is_ok());
    }
}