From dd1c9c1e66a93757e47481f5ededf9e45aeaca2c Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 27 Jan 2022 12:20:55 +0100 Subject: [PATCH] Share CheckResponse types for domain and host resources --- src/common.rs | 26 ++++++++++++++++++++++++ src/domain/check.rs | 48 +++++++-------------------------------------- src/host/check.rs | 42 +++++++-------------------------------- src/lib.rs | 4 ++-- tests/basic.rs | 5 +---- 5 files changed, 43 insertions(+), 82 deletions(-) diff --git a/src/common.rs b/src/common.rs index 7487774..df43b09 100644 --- a/src/common.rs +++ b/src/common.rs @@ -50,6 +50,32 @@ pub struct Available { pub available: bool, } +/// Type that represents the <cd> tag for domain check response +#[derive(Deserialize, Debug)] +pub struct CheckResponseDataItem { + /// Data under the <name> tag + #[serde(rename = "name")] + pub resource: Available, + /// The reason for (un)availability + pub reason: Option>, +} + +/// Type that represents the <chkData> tag for host check response +#[derive(Deserialize, Debug)] +pub struct CheckData { + /// Data under the <cd> tag + #[serde(rename = "cd")] + pub list: Vec, +} + +/// Type that represents the <resData> tag for host check response +#[derive(Deserialize, Debug)] +pub struct CheckResponse { + /// Data under the <chkData> tag + #[serde(rename = "chkData")] + pub check_data: CheckData, +} + /// The