From 25b21dab5397b9a457f02a9cdb79e2579cfbc92a Mon Sep 17 00:00:00 2001 From: Joe Prosser Date: Wed, 31 Jan 2024 12:34:44 +0000 Subject: [PATCH] chore(api): don't serialize options --- api/src/resources/integration.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/api/src/resources/integration.rs b/api/src/resources/integration.rs index 88890c9..ec7ab9d 100644 --- a/api/src/resources/integration.rs +++ b/api/src/resources/integration.rs @@ -7,8 +7,10 @@ use crate::{Email, ProjectName}; #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct NewIntegration { - pub title: Title, - pub enabled: bool, + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option<bool>, pub configuration: Configuration, } @@ -66,6 +68,7 @@ pub enum DisabledReason { #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct Configuration { + #[serde(skip_serializing_if = "Option::is_none")] pub connection: Option<Connection>, pub mailboxes: Vec<Mailbox>, } @@ -74,7 +77,9 @@ pub struct Configuration { pub struct Connection { access: AccessType, application: ApplicationType, + #[serde(skip_serializing_if = "Option::is_none")] ews_endpoint: Option<String>, + #[serde(skip_serializing_if = "Option::is_none")] build_version: Option<String>, } @@ -103,15 +108,23 @@ pub struct CustomApplicationConfig { #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] pub struct Mailbox { + #[serde(skip_serializing_if = "Option::is_none")] pub disabled_reason: Option<DisabledReason>, pub email: Email, pub enabled: bool, + #[serde(skip_serializing_if = "Option::is_none")] pub folder_allowlist: Option<Vec<Vec<String>>>, + #[serde(skip_serializing_if = "Option::is_none")] pub folder_denylist: Option<Vec<Vec<String>>>, + #[serde(skip_serializing_if = "Option::is_none")] pub participant_allowlist: Option<Vec<Email>>, + #[serde(skip_serializing_if = "Option::is_none")] pub participant_denylist: Option<Vec<Email>>, + #[serde(skip_serializing_if = "Option::is_none")] pub participant_domain_allowlist: Option<Vec<String>>, + #[serde(skip_serializing_if = "Option::is_none")] pub participant_domain_denylist: Option<Vec<String>>, + #[serde(skip_serializing_if = "Option::is_none")] pub start_timestamp: Option<DateTime<Utc>>, pub bucket_specification: BucketSpecification, }