jmap_client/identity/
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 crate::{core::get::GetObject, email::EmailAddress, Get, Set};
13
14use super::Identity;
15
16impl Identity<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 name(&self) -> Option<&str> {
26        self.name.as_deref()
27    }
28
29    pub fn email(&self) -> Option<&str> {
30        self.email.as_deref()
31    }
32
33    pub fn reply_to(&self) -> Option<&[EmailAddress]> {
34        self.reply_to.as_deref()
35    }
36
37    pub fn bcc(&self) -> Option<&[EmailAddress]> {
38        self.bcc.as_deref()
39    }
40
41    pub fn text_signature(&self) -> Option<&str> {
42        self.text_signature.as_deref()
43    }
44
45    pub fn html_signature(&self) -> Option<&str> {
46        self.html_signature.as_deref()
47    }
48
49    pub fn may_delete(&self) -> bool {
50        self.may_delete.unwrap_or(false)
51    }
52}
53
54impl GetObject for Identity<Set> {
55    type GetArguments = ();
56}
57
58impl GetObject for Identity<Get> {
59    type GetArguments = ();
60}