appwrite/models/
o_auth2_spotify.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7#[cfg_attr(test, derive(Default))]
8pub struct OAuth2Spotify {
9 #[serde(rename = "$id")]
11 pub id: String,
12 #[serde(rename = "enabled")]
14 pub enabled: bool,
15 #[serde(rename = "clientId")]
17 pub client_id: String,
18 #[serde(rename = "clientSecret")]
20 pub client_secret: String,
21}
22
23impl OAuth2Spotify {
24 pub fn id(&self) -> &String {
26 &self.id
27 }
28
29 pub fn enabled(&self) -> &bool {
31 &self.enabled
32 }
33
34 pub fn client_id(&self) -> &String {
36 &self.client_id
37 }
38
39 pub fn client_secret(&self) -> &String {
41 &self.client_secret
42 }
43
44}
45
46#[cfg(test)]
47mod tests {
48 use super::*;
49
50 #[test]
51 fn test_o_auth2_spotify_creation() {
52 let _model = <OAuth2Spotify as Default>::default();
53 let _ = _model.id();
54 let _ = _model.enabled();
55 let _ = _model.client_id();
56 let _ = _model.client_secret();
57 }
58
59 #[test]
60 fn test_o_auth2_spotify_serialization() {
61 let model = <OAuth2Spotify as Default>::default();
62 let json = serde_json::to_string(&model);
63 assert!(json.is_ok());
64
65 let deserialized: Result<OAuth2Spotify, _> = serde_json::from_str(&json.unwrap());
66 assert!(deserialized.is_ok());
67 }
68}