jmap_client/vacation_response/
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, Get, Set};
13
14use super::VacationResponse;
15
16impl VacationResponse<Get> {
17    pub fn id(&self) -> Option<&str> {
18        self.id.as_deref()
19    }
20
21    pub fn is_enabled(&self) -> bool {
22        self.is_enabled.unwrap_or(false)
23    }
24
25    pub fn from_date(&self) -> Option<i64> {
26        self.from_date.as_ref().map(|dt| dt.timestamp())
27    }
28
29    pub fn to_date(&self) -> Option<i64> {
30        self.to_date.as_ref().map(|dt| dt.timestamp())
31    }
32
33    pub fn subject(&self) -> Option<&str> {
34        self.subject.as_deref()
35    }
36
37    pub fn text_body(&self) -> Option<&str> {
38        self.text_body.as_deref()
39    }
40
41    pub fn html_body(&self) -> Option<&str> {
42        self.html_body.as_deref()
43    }
44}
45
46impl GetObject for VacationResponse<Set> {
47    type GetArguments = ();
48}
49
50impl GetObject for VacationResponse<Get> {
51    type GetArguments = ();
52}