From 1d839282da54774451f8d0f86144ba7e0eac91da Mon Sep 17 00:00:00 2001 From: Poscat Date: Wed, 25 Aug 2021 22:12:08 +0800 Subject: [PATCH] fix: allow dns record types to be specified without the corresponding value when listing dns records --- cloudflare/src/endpoints/dns.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cloudflare/src/endpoints/dns.rs b/cloudflare/src/endpoints/dns.rs index f9eca221..7c7b0a3f 100644 --- a/cloudflare/src/endpoints/dns.rs +++ b/cloudflare/src/endpoints/dns.rs @@ -135,7 +135,7 @@ pub enum ListDnsRecordsOrder { #[derive(Serialize, Clone, Debug, Default)] pub struct ListDnsRecordsParams { #[serde(flatten)] - pub record_type: Option, + pub record_type: Option, pub name: Option, pub page: Option, pub per_page: Option, @@ -167,6 +167,21 @@ pub enum DnsContent { SRV { content: String }, } +/// Type of the DNS record, along with a optional value +/// Similar to [`DnsContent`], but is only used in [`ListDnsRecordsParams`] +#[serde_with::skip_serializing_none] +#[derive(Serialize, Clone, Debug)] +#[serde(tag = "type")] +pub enum DnsRecordTypeWithOptionalContent { + A { content: Option }, + AAAA { content: Option }, + CNAME { content: Option }, + NS { content: Option }, + MX { content: Option }, + TXT { content: Option }, + SRV { content: Option }, +} + #[derive(Deserialize, Debug)] pub struct DeleteDnsRecordResponse { /// DNS record identifier tag