jmap_client/principal/
get.rs

1/*
2 * Copyright Stalwart Labs LLC See the COPYING
3 * file at the top-level directory of this distribution.
4 *
5 * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 * https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 * <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
8 * option. This file may not be copied, modified, or distributed
9 * except according to those terms.
10 */
11
12use super::{Principal, Type, ACL, DKIM};
13use crate::{core::get::GetObject, Get, Set};
14use ahash::AHashMap;
15
16impl Principal<Get> {
17    pub fn id(&self) -> Option<&str> {
18        self.id.as_deref()
19    }
20
21    pub fn take_id(&mut self) -> String {
22        self.id.take().unwrap_or_default()
23    }
24
25    pub fn ptype(&self) -> Option<&Type> {
26        self.ptype.as_ref()
27    }
28
29    pub fn name(&self) -> Option<&str> {
30        self.name.as_deref()
31    }
32
33    pub fn email(&self) -> Option<&str> {
34        self.email.as_deref()
35    }
36
37    pub fn description(&self) -> Option<&str> {
38        self.description.as_deref()
39    }
40
41    pub fn timezone(&self) -> Option<&str> {
42        self.timezone.as_deref()
43    }
44
45    pub fn secret(&self) -> Option<&str> {
46        self.secret.as_deref()
47    }
48
49    pub fn picture(&self) -> Option<&str> {
50        self.picture.as_deref()
51    }
52
53    pub fn quota(&self) -> Option<u32> {
54        self.quota
55    }
56
57    pub fn capabilities(&self) -> Option<&[String]> {
58        self.capabilities.as_deref()
59    }
60
61    pub fn aliases(&self) -> Option<&[String]> {
62        self.aliases.as_deref()
63    }
64
65    pub fn members(&self) -> Option<&[String]> {
66        self.members.as_deref()
67    }
68
69    pub fn dkim(&self) -> Option<&DKIM> {
70        self.dkim.as_ref()
71    }
72
73    pub fn acl(&self) -> Option<&AHashMap<String, Vec<ACL>>> {
74        self.acl.as_ref()
75    }
76}
77
78impl GetObject for Principal<Set> {
79    type GetArguments = ();
80}
81
82impl GetObject for Principal<Get> {
83    type GetArguments = ();
84}