diff --git a/epp-client/examples/client.rs b/epp-client/examples/client.rs index 48051d2..5ea335d 100644 --- a/epp-client/examples/client.rs +++ b/epp-client/examples/client.rs @@ -5,7 +5,8 @@ use epp_client::EppClient; use epp_client::epp::object::{StringValueTrait}; use epp_client::{epp::request, epp::xml::EppXml}; use epp_client::epp::object::data::{ - PostalInfo, Address, Phone, DomainContact, ContactStatus, DomainStatus, HostObjList, HostAttrList, HostAttr, HostAddr + PostalInfo, Address, Phone, DomainContact, ContactStatus, DomainStatus, HostObjList, HostAttrList, HostAttr, HostAddr, + Host, HostStatus }; use epp_client::epp::*; @@ -193,6 +194,72 @@ async fn query_transfer(client: &mut EppClient) { println!("{}\n\n", transfer_query.serialize().unwrap()); } +async fn check_hosts(client: &mut EppClient) { + let hosts_check = EppHostCheck::new(vec!["host1.eppdev-1.com", "ns1.testing.com"], gen_client_tr_id("eppdev").unwrap().as_str()); + + client.transact::<_, EppHostCheckResponse>(&hosts_check).await.unwrap(); +} + +async fn create_host(client: &mut EppClient) { + let host = Host { + name: "host1.eppdev-1.com".to_string_value(), + addresses: Some(vec![ + HostAddr::new("v4", "29.245.122.14"), + HostAddr::new("v6", "2400:6180:100:d0::8d6:4001"), + ]) + }; + + let host_create = EppHostCreate::new(host, gen_client_tr_id("eppdev").unwrap().as_str()); + + // println!("{}", host_create.serialize().unwrap()); + + client.transact::<_, EppHostCreateResponse>(&host_create).await.unwrap(); +} + +async fn query_host(client: &mut EppClient) { + let host_info = EppHostInfo::new("host2.eppdev-1.com", gen_client_tr_id("eppdev").unwrap().as_str()); + + // println!("{}", host_info.serialize().unwrap()); + + client.transact::<_, EppHostInfoResponse>(&host_info).await.unwrap(); +} + +async fn update_host(client: &mut EppClient) { + let addr = vec![ + HostAddr::new("v6", "2400:6180:100:d0::8d6:4001"), + ]; + + let add = HostAddRemove { + addresses: Some(addr), + statuses: None, + }; + + let remove = HostAddRemove { + addresses: None, + statuses: Some(vec![ + HostStatus { + status: "clientDeleteProhibited".to_string() + } + ]), + }; + + let mut host_update = EppHostUpdate::new("host1.eppdev-1.com", gen_client_tr_id("eppdev").unwrap().as_str()); + + host_update.add(add); + // host_update.remove(remove); + host_update.info(HostChangeInfo { name: "host2.eppdev-1.com".to_string_value() }); + + // println!("{}", host_update.serialize().unwrap()); + + client.transact::<_, EppHostUpdateResponse>(&host_update).await.unwrap(); +} + +async fn delete_host(client: &mut EppClient) { + let host_delete = EppHostDelete::new("host2.eppdev-1.com", gen_client_tr_id("eppdev").unwrap().as_str()); + + client.transact::<_, EppHostDeleteResponse>(&host_delete).await.unwrap(); +} + async fn hello(client: &mut EppClient) { let greeting = client.hello().await.unwrap(); @@ -227,7 +294,7 @@ async fn main() { // create_domain(&mut client).await; - // query_domain(&mut client).await; + query_domain(&mut client).await; // update_domain(&mut client).await; @@ -244,4 +311,14 @@ async fn main() { // reject_transfer(&mut client).await; // cancel_transfer(&mut client).await; + + // check_hosts(&mut client).await; + + // create_host(&mut client).await; + + // query_host(&mut client).await; + + // update_host(&mut client).await; + + // delete_host(&mut client).await; } diff --git a/epp-client/src/config.rs b/epp-client/src/config.rs index 2edccd7..b5b10b4 100644 --- a/epp-client/src/config.rs +++ b/epp-client/src/config.rs @@ -17,6 +17,7 @@ pub struct EppClientConnection { port: u16, username: String, password: String, + ext_uris: Option>, } #[derive(Serialize, Deserialize, Debug)] @@ -38,6 +39,9 @@ impl EppClientConnection { pub fn credentials(&self) -> (String, String) { (self.username.to_string(), self.password.to_string()) } + pub fn ext_uris(&self) -> Option<&Vec> { + self.ext_uris.as_ref() + } } impl EppClientConfig { diff --git a/epp-client/src/connection/client.rs b/epp-client/src/connection/client.rs index 786fe17..7f33792 100644 --- a/epp-client/src/connection/client.rs +++ b/epp-client/src/connection/client.rs @@ -22,13 +22,24 @@ async fn connect(registry: &'static str) -> Result> { tokio::spawn(async move { let stream = epp_connect(®istry_creds).await.unwrap(); let credentials = registry_creds.credentials(); + let ext_uris = registry_creds.ext_uris(); + + let ext_uris = match ext_uris { + Some(uris) => Some( + uris + .iter() + .map(|u| u.to_string()) + .collect::>() + ), + None => None, + }; let connection = EppConnection::new( registry.to_string(), stream ).await.unwrap(); - let client = EppClient::build(connection, credentials).await.unwrap(); + let client = EppClient::build(connection, credentials, ext_uris).await.unwrap(); tx.send(client).unwrap(); }); @@ -40,6 +51,7 @@ async fn connect(registry: &'static str) -> Result> { pub struct EppClient { credentials: (String, String), + ext_uris: Option>, connection: EppConnection, // pub client_tr_id_fn: Arc String + Send + Sync>, } @@ -66,15 +78,16 @@ impl EppClient { connect(registry).await } - async fn build(connection: EppConnection, credentials: (String, String)) -> Result> { + async fn build(connection: EppConnection, credentials: (String, String), ext_uris: Option>) -> Result> { let mut client = EppClient { connection: connection, credentials: credentials, + ext_uris: ext_uris, // client_tr_id_fn: Arc::new(default_client_tr_id_fn), }; let client_tr_id = generate_client_tr_id(&client.credentials.0)?; - let login_request = EppLogin::new(&client.credentials.0, &client.credentials.1, client_tr_id.as_str()); + let login_request = EppLogin::new(&client.credentials.0, &client.credentials.1, &client.ext_uris, client_tr_id.as_str()); client.transact::<_, EppCommandResponse>(&login_request).await?; diff --git a/epp-client/src/epp.rs b/epp-client/src/epp.rs index ffb7cfb..9fe39b5 100644 --- a/epp-client/src/epp.rs +++ b/epp-client/src/epp.rs @@ -17,6 +17,12 @@ pub use request::domain::info::*; pub use request::domain::renew::*; pub use request::domain::transfer::*; pub use request::domain::update::*; +pub use request::host::check::*; +pub use request::host::create::*; +pub use request::host::delete::*; +pub use request::host::info::*; +pub use request::host::update::*; +pub use request::message::poll::*; pub use response::contact::check::*; pub use response::contact::create::*; @@ -30,3 +36,9 @@ pub use response::domain::info::*; pub use response::domain::renew::*; pub use response::domain::transfer::*; pub use response::domain::update::*; +pub use response::host::check::*; +pub use response::host::create::*; +pub use response::host::delete::*; +pub use response::host::info::*; +pub use response::host::update::*; +pub use response::message::poll::*; diff --git a/epp-client/src/epp/object/data.rs b/epp-client/src/epp/object/data.rs index 2ff97aa..f479bca 100644 --- a/epp-client/src/epp/object/data.rs +++ b/epp-client/src/epp/object/data.rs @@ -1,6 +1,9 @@ use crate::epp::object::{StringValue, StringValueTrait}; use serde::{Deserialize, Serialize}; +pub type DomainStatus = ContactStatus; +pub type HostStatus = ContactStatus; + #[derive(Serialize, Deserialize, Debug)] pub enum DomainNsList { HostAttrList(HostAttrList), @@ -38,6 +41,13 @@ impl HostAddr { } } +#[derive(Serialize, Deserialize, Debug)] +pub struct Host { + pub name: StringValue, + #[serde(rename = "addr")] + pub addresses: Option>, +} + #[derive(Serialize, Deserialize, Debug)] pub struct HostAttr { #[serde(rename = "hostName")] @@ -86,12 +96,6 @@ impl Period { } } -#[derive(Serialize, Deserialize, Debug)] -pub struct DomainStatus { - #[serde(rename = "s")] - pub status: String, -} - #[derive(Serialize, Deserialize, Debug)] pub struct ContactStatus { #[serde(rename = "s")] diff --git a/epp-client/src/epp/request.rs b/epp-client/src/epp/request.rs index a12f2f8..36f15c6 100644 --- a/epp-client/src/epp/request.rs +++ b/epp-client/src/epp/request.rs @@ -1,5 +1,7 @@ pub mod contact; pub mod domain; +pub mod host; +pub mod message; use serde::{Deserialize, Serialize}; use std::error::Error; @@ -9,7 +11,7 @@ use crate::epp::command::Command; use crate::epp::object::{ ElementName, EppObject, Options, ServiceExtension, Services, StringValue, StringValueTrait, }; -use crate::epp::xml::{EPP_LANG, EPP_VERSION}; +use crate::epp::xml::{EPP_CONTACT_XMLNS, EPP_DOMAIN_XMLNS, EPP_HOST_XMLNS, EPP_LANG, EPP_VERSION}; use epp_client_macros::*; pub type EppHello = EppObject; @@ -44,7 +46,21 @@ pub struct Login { } impl EppLogin { - pub fn new(username: &str, password: &str, client_tr_id: &str) -> EppLogin { + pub fn new( + username: &str, + password: &str, + ext_uris: &Option>, + client_tr_id: &str, + ) -> EppLogin { + let ext_uris = match ext_uris { + Some(uris) => Some( + uris.iter() + .map(|u| u.to_string_value()) + .collect::>(), + ), + None => None, + }; + let login = Login { username: username.to_string_value(), password: password.to_string_value(), @@ -54,15 +70,11 @@ impl EppLogin { }, services: Services { obj_uris: vec![ - "urn:ietf:params:xml:ns:host-1.0".to_string_value(), - "urn:ietf:params:xml:ns:contact-1.0".to_string_value(), - "urn:ietf:params:xml:ns:domain-1.0".to_string_value(), + EPP_HOST_XMLNS.to_string_value(), + EPP_CONTACT_XMLNS.to_string_value(), + EPP_DOMAIN_XMLNS.to_string_value(), ], - svc_ext: Some(ServiceExtension { - ext_uris: Some(vec![ - "http://schema.ispapi.net/epp/xml/keyvalue-1.0".to_string_value() - ]), - }), + svc_ext: Some(ServiceExtension { ext_uris: ext_uris }), }, }; diff --git a/epp-client/src/epp/request/contact/check.rs b/epp-client/src/epp/request/contact/check.rs index f7dd0d8..60ab26c 100644 --- a/epp-client/src/epp/request/contact/check.rs +++ b/epp-client/src/epp/request/contact/check.rs @@ -9,7 +9,7 @@ pub type EppContactCheck = EppObject>; #[derive(Serialize, Deserialize, Debug)] pub struct ContactList { - pub xmlns: String, + xmlns: String, #[serde(rename = "id")] pub contact_ids: Vec, } diff --git a/epp-client/src/epp/request/contact/delete.rs b/epp-client/src/epp/request/contact/delete.rs index fd8f1eb..fbb810e 100644 --- a/epp-client/src/epp/request/contact/delete.rs +++ b/epp-client/src/epp/request/contact/delete.rs @@ -9,8 +9,8 @@ pub type EppContactDelete = EppObject>; #[derive(Serialize, Deserialize, Debug)] pub struct ContactDeleteData { - pub xmlns: String, - pub id: StringValue, + xmlns: String, + id: StringValue, } #[derive(Serialize, Deserialize, Debug, ElementName)] diff --git a/epp-client/src/epp/request/contact/info.rs b/epp-client/src/epp/request/contact/info.rs index 7062778..059e970 100644 --- a/epp-client/src/epp/request/contact/info.rs +++ b/epp-client/src/epp/request/contact/info.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; pub type EppContactInfo = EppObject>; #[derive(Serialize, Deserialize, Debug)] -pub struct ContactQuery { +pub struct ContactInfoData { xmlns: String, id: StringValue, #[serde(rename = "authInfo")] @@ -20,14 +20,14 @@ pub struct ContactQuery { #[element_name(name = "info")] pub struct ContactInfo { #[serde(rename = "info")] - query: ContactQuery, + info: ContactInfoData, } impl EppContactInfo { pub fn new(id: &str, auth_password: &str, client_tr_id: &str) -> EppContactInfo { EppObject::build(Command:: { command: ContactInfo { - query: ContactQuery { + info: ContactInfoData { xmlns: EPP_CONTACT_XMLNS.to_string(), id: id.to_string_value(), auth_info: AuthInfo::new(auth_password), diff --git a/epp-client/src/epp/request/domain/delete.rs b/epp-client/src/epp/request/domain/delete.rs index 454180e..8ef108f 100644 --- a/epp-client/src/epp/request/domain/delete.rs +++ b/epp-client/src/epp/request/domain/delete.rs @@ -9,8 +9,8 @@ pub type EppDomainDelete = EppObject>; #[derive(Serialize, Deserialize, Debug)] pub struct DomainDeleteData { - pub xmlns: String, - pub name: StringValue, + xmlns: String, + name: StringValue, } #[derive(Serialize, Deserialize, Debug, ElementName)] diff --git a/epp-client/src/epp/request/host.rs b/epp-client/src/epp/request/host.rs new file mode 100644 index 0000000..035f812 --- /dev/null +++ b/epp-client/src/epp/request/host.rs @@ -0,0 +1,5 @@ +pub mod check; +pub mod create; +pub mod delete; +pub mod info; +pub mod update; diff --git a/epp-client/src/epp/request/host/check.rs b/epp-client/src/epp/request/host/check.rs new file mode 100644 index 0000000..0440da4 --- /dev/null +++ b/epp-client/src/epp/request/host/check.rs @@ -0,0 +1,43 @@ +use epp_client_macros::*; + +use crate::epp::command::Command; +use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait}; +use crate::epp::xml::EPP_HOST_XMLNS; +use serde::{Deserialize, Serialize}; + +pub type EppHostCheck = EppObject>; + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostList { + xmlns: String, + #[serde(rename = "name")] + pub hosts: Vec, +} + +#[derive(Serialize, Deserialize, Debug, ElementName)] +#[element_name(name = "check")] +pub struct HostCheck { + #[serde(rename = "check")] + list: HostList, +} + +impl EppHostCheck { + pub fn new(hosts: Vec<&str>, client_tr_id: &str) -> EppHostCheck { + let hosts = hosts + .iter() + .filter_map(|d| Some(d.to_string_value())) + .collect::>(); + + let host_check = HostCheck { + list: HostList { + xmlns: EPP_HOST_XMLNS.to_string(), + hosts: hosts, + }, + }; + + EppObject::build(Command:: { + command: host_check, + client_tr_id: client_tr_id.to_string_value(), + }) + } +} diff --git a/epp-client/src/epp/request/host/create.rs b/epp-client/src/epp/request/host/create.rs new file mode 100644 index 0000000..5a8a301 --- /dev/null +++ b/epp-client/src/epp/request/host/create.rs @@ -0,0 +1,41 @@ +use epp_client_macros::*; + +use crate::epp::command::Command; +use crate::epp::object::data::{Host, HostAddr}; +use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait}; +use crate::epp::xml::EPP_HOST_XMLNS; +use serde::{Deserialize, Serialize}; + +pub type EppHostCreate = EppObject>; + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostCreateData { + xmlns: String, + pub name: StringValue, + #[serde(rename = "addr")] + pub addresses: Option>, +} + +#[derive(Serialize, Deserialize, Debug, ElementName)] +#[element_name(name = "create")] +pub struct HostCreate { + #[serde(rename = "create")] + host: HostCreateData, +} + +impl EppHostCreate { + pub fn new(host: Host, client_tr_id: &str) -> EppHostCreate { + let host_create = HostCreate { + host: HostCreateData { + xmlns: EPP_HOST_XMLNS.to_string(), + name: host.name, + addresses: host.addresses, + }, + }; + + EppObject::build(Command:: { + command: host_create, + client_tr_id: client_tr_id.to_string_value(), + }) + } +} diff --git a/epp-client/src/epp/request/host/delete.rs b/epp-client/src/epp/request/host/delete.rs new file mode 100644 index 0000000..a6913f2 --- /dev/null +++ b/epp-client/src/epp/request/host/delete.rs @@ -0,0 +1,35 @@ +use epp_client_macros::*; + +use crate::epp::command::Command; +use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait}; +use crate::epp::xml::EPP_HOST_XMLNS; +use serde::{Deserialize, Serialize}; + +pub type EppHostDelete = EppObject>; + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostDeleteData { + xmlns: String, + name: StringValue, +} + +#[derive(Serialize, Deserialize, Debug, ElementName)] +#[element_name(name = "delete")] +pub struct HostDelete { + #[serde(rename = "delete")] + host: HostDeleteData, +} + +impl EppHostDelete { + pub fn new(name: &str, client_tr_id: &str) -> EppHostDelete { + EppObject::build(Command:: { + command: HostDelete { + host: HostDeleteData { + xmlns: EPP_HOST_XMLNS.to_string(), + name: name.to_string_value(), + }, + }, + client_tr_id: client_tr_id.to_string_value(), + }) + } +} diff --git a/epp-client/src/epp/request/host/info.rs b/epp-client/src/epp/request/host/info.rs new file mode 100644 index 0000000..dd820d7 --- /dev/null +++ b/epp-client/src/epp/request/host/info.rs @@ -0,0 +1,35 @@ +use epp_client_macros::*; + +use crate::epp::command::Command; +use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait}; +use crate::epp::xml::EPP_HOST_XMLNS; +use serde::{Deserialize, Serialize}; + +pub type EppHostInfo = EppObject>; + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostInfoData { + xmlns: String, + name: StringValue, +} + +#[derive(Serialize, Deserialize, Debug, ElementName)] +#[element_name(name = "info")] +pub struct HostInfo { + #[serde(rename = "info")] + info: HostInfoData, +} + +impl EppHostInfo { + pub fn new(name: &str, client_tr_id: &str) -> EppHostInfo { + EppObject::build(Command:: { + command: HostInfo { + info: HostInfoData { + xmlns: EPP_HOST_XMLNS.to_string(), + name: name.to_string_value(), + }, + }, + client_tr_id: client_tr_id.to_string_value(), + }) + } +} diff --git a/epp-client/src/epp/request/host/update.rs b/epp-client/src/epp/request/host/update.rs new file mode 100644 index 0000000..cde769b --- /dev/null +++ b/epp-client/src/epp/request/host/update.rs @@ -0,0 +1,69 @@ +use epp_client_macros::*; + +use crate::epp::command::Command; +use crate::epp::object::data::{HostAddr, HostStatus}; +use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait}; +use crate::epp::xml::EPP_HOST_XMLNS; +use serde::{Deserialize, Serialize}; + +pub type EppHostUpdate = EppObject>; + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostChangeInfo { + pub name: StringValue, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostAddRemove { + #[serde(rename = "addr")] + pub addresses: Option>, + #[serde(rename = "status")] + pub statuses: Option>, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostUpdateData { + xmlns: String, + name: StringValue, + add: Option, + #[serde(rename = "rem")] + remove: Option, + #[serde(rename = "chg")] + change_info: Option, +} + +#[derive(Serialize, Deserialize, Debug, ElementName)] +#[element_name(name = "update")] +pub struct HostUpdate { + #[serde(rename = "update")] + host: HostUpdateData, +} + +impl EppHostUpdate { + pub fn new(name: &str, client_tr_id: &str) -> EppHostUpdate { + EppObject::build(Command:: { + command: HostUpdate { + host: HostUpdateData { + xmlns: EPP_HOST_XMLNS.to_string(), + name: name.to_string_value(), + add: None, + remove: None, + change_info: None, + }, + }, + client_tr_id: client_tr_id.to_string_value(), + }) + } + + pub fn info(&mut self, info: HostChangeInfo) { + self.data.command.host.change_info = Some(info); + } + + pub fn add(&mut self, add: HostAddRemove) { + self.data.command.host.add = Some(add); + } + + pub fn remove(&mut self, remove: HostAddRemove) { + self.data.command.host.remove = Some(remove); + } +} diff --git a/epp-client/src/epp/request/message.rs b/epp-client/src/epp/request/message.rs new file mode 100644 index 0000000..5726c38 --- /dev/null +++ b/epp-client/src/epp/request/message.rs @@ -0,0 +1 @@ +pub mod poll; diff --git a/epp-client/src/epp/request/message/poll.rs b/epp-client/src/epp/request/message/poll.rs new file mode 100644 index 0000000..252c660 --- /dev/null +++ b/epp-client/src/epp/request/message/poll.rs @@ -0,0 +1,24 @@ +use epp_client_macros::*; + +use crate::epp::command::Command; +use crate::epp::object::{ElementName, EppObject, StringValueTrait}; +use serde::{Deserialize, Serialize}; + +pub type EppMessagePoll = EppObject>; + +#[derive(Serialize, Deserialize, Debug, ElementName)] +#[element_name(name = "poll")] +pub struct MessagePoll { + op: String, +} + +impl EppMessagePoll { + pub fn new(client_tr_id: &str) -> EppMessagePoll { + EppObject::build(Command:: { + command: MessagePoll { + op: "req".to_string(), + }, + client_tr_id: client_tr_id.to_string_value(), + }) + } +} diff --git a/epp-client/src/epp/response.rs b/epp-client/src/epp/response.rs index 147f3cd..4b2c820 100644 --- a/epp-client/src/epp/response.rs +++ b/epp-client/src/epp/response.rs @@ -1,5 +1,7 @@ pub mod contact; pub mod domain; +pub mod host; +pub mod message; use epp_client_macros::*; use serde::{Deserialize, Deserializer, Serialize}; @@ -57,7 +59,7 @@ pub struct All; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Access { - all: All, + pub all: All, } #[derive(Serialize, Deserialize, Debug, PartialEq)] @@ -68,8 +70,8 @@ pub struct Prov; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Purpose { - admin: Admin, - prov: Prov, + pub admin: Admin, + pub prov: Prov, } #[derive(Serialize, Deserialize, Debug, PartialEq)] @@ -80,8 +82,8 @@ pub struct Public; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Recipient { - ours: Ours, - public: Public, + pub ours: Ours, + pub public: Public, } #[derive(Serialize, Deserialize, Debug, PartialEq)] @@ -89,20 +91,20 @@ pub struct Stated; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Retention { - stated: Stated, + pub stated: Stated, } #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Statement { - purpose: Purpose, - recipient: Recipient, - retention: Retention, + pub purpose: Purpose, + pub recipient: Recipient, + pub retention: Retention, } #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct Dcp { - access: Access, - statement: Statement, + pub access: Access, + pub statement: Statement, } #[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)] @@ -110,12 +112,12 @@ pub struct Dcp { #[element_name(name = "greeting")] pub struct Greeting { #[serde(rename = "svID")] - service_id: String, + pub service_id: String, #[serde(rename = "svDate")] - service_date: String, + pub service_date: String, #[serde(rename = "svcMenu")] - svc_menu: ServiceMenu, - dcp: Dcp, + pub svc_menu: ServiceMenu, + pub dcp: Dcp, } #[derive(Serialize, Deserialize, Debug, PartialEq)] @@ -130,8 +132,8 @@ pub struct ResultValue { #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct ExtValue { - value: ResultValue, - reason: StringValue, + pub value: ResultValue, + pub reason: StringValue, } #[derive(Serialize, Deserialize, Debug, PartialEq)] diff --git a/epp-client/src/epp/response/domain/create.rs b/epp-client/src/epp/response/domain/create.rs index 0aef271..b3a433c 100644 --- a/epp-client/src/epp/response/domain/create.rs +++ b/epp-client/src/epp/response/domain/create.rs @@ -9,11 +9,11 @@ pub type EppDomainCreateResponse = EppObject pub struct DomainCreateData { #[serde(rename = "xmlns:domain")] xmlns: String, - name: StringValue, + pub name: StringValue, #[serde(rename = "crDate")] - created_at: StringValue, + pub created_at: StringValue, #[serde(rename = "exDate")] - expiry_date: StringValue, + pub expiry_date: StringValue, } #[derive(Serialize, Deserialize, Debug)] diff --git a/epp-client/src/epp/response/domain/info.rs b/epp-client/src/epp/response/domain/info.rs index d99f00c..b2aa44d 100644 --- a/epp-client/src/epp/response/domain/info.rs +++ b/epp-client/src/epp/response/domain/info.rs @@ -53,5 +53,5 @@ pub struct DomainInfoData { #[derive(Serialize, Deserialize, Debug)] pub struct DomainInfoResult { #[serde(rename = "infData")] - pub check_data: DomainInfoData, + pub info_data: DomainInfoData, } diff --git a/epp-client/src/epp/response/domain/renew.rs b/epp-client/src/epp/response/domain/renew.rs index c648d2e..8e2bc0d 100644 --- a/epp-client/src/epp/response/domain/renew.rs +++ b/epp-client/src/epp/response/domain/renew.rs @@ -9,9 +9,9 @@ pub type EppDomainRenewResponse = EppObject>; pub struct DomainRenewData { #[serde(rename = "xmlns:domain")] xmlns: String, - name: StringValue, + pub name: StringValue, #[serde(rename = "exDate")] - expiry_date: StringValue, + pub expiry_date: StringValue, } #[derive(Serialize, Deserialize, Debug)] diff --git a/epp-client/src/epp/response/domain/transfer.rs b/epp-client/src/epp/response/domain/transfer.rs index cfcbe07..58e029e 100644 --- a/epp-client/src/epp/response/domain/transfer.rs +++ b/epp-client/src/epp/response/domain/transfer.rs @@ -14,19 +14,19 @@ pub type EppDomainTransferQueryResponse = EppObject>; + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostCheck { + #[serde(rename = "$value")] + pub name: StringValue, + #[serde(rename = "avail")] + pub available: u16, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostCheckDataItem { + pub name: HostCheck, + pub reason: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostCheckData { + #[serde(rename = "xmlns:host")] + xmlns: String, + #[serde(rename = "cd")] + pub host_list: Vec, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostCheckResult { + #[serde(rename = "chkData")] + pub check_data: HostCheckData, +} diff --git a/epp-client/src/epp/response/host/create.rs b/epp-client/src/epp/response/host/create.rs new file mode 100644 index 0000000..b4ba228 --- /dev/null +++ b/epp-client/src/epp/response/host/create.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; + +use crate::epp::object::{EppObject, StringValue}; +use crate::epp::response::CommandResponse; + +pub type EppHostCreateResponse = EppObject>; + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostCreateData { + #[serde(rename = "xmlns:host")] + xmlns: String, + pub name: StringValue, + #[serde(rename = "crDate")] + pub created_at: StringValue, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostCreateResult { + #[serde(rename = "creData")] + pub check_data: HostCreateData, +} diff --git a/epp-client/src/epp/response/host/delete.rs b/epp-client/src/epp/response/host/delete.rs new file mode 100644 index 0000000..691e23f --- /dev/null +++ b/epp-client/src/epp/response/host/delete.rs @@ -0,0 +1,3 @@ +use crate::epp::response::EppCommandResponse; + +pub type EppHostDeleteResponse = EppCommandResponse; diff --git a/epp-client/src/epp/response/host/info.rs b/epp-client/src/epp/response/host/info.rs new file mode 100644 index 0000000..44cd613 --- /dev/null +++ b/epp-client/src/epp/response/host/info.rs @@ -0,0 +1,37 @@ +use serde::{Deserialize, Serialize}; + +use crate::epp::object::data::{HostAddr, HostStatus}; +use crate::epp::object::{EppObject, StringValue}; +use crate::epp::response::CommandResponse; + +pub type EppHostInfoResponse = EppObject>; + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostInfoData { + #[serde(rename = "xmlns:host")] + xmlns: String, + pub name: StringValue, + pub roid: StringValue, + #[serde(rename = "status")] + pub statuses: Vec, + #[serde(rename = "addr")] + pub addresses: Vec, + #[serde(rename = "clID")] + pub client_id: StringValue, + #[serde(rename = "crID")] + pub creator_id: StringValue, + #[serde(rename = "crDate")] + pub created_at: StringValue, + #[serde(rename = "upID")] + pub updater_id: Option, + #[serde(rename = "upDate")] + pub updated_at: Option, + #[serde(rename = "trDate")] + pub transferred_at: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct HostInfoResult { + #[serde(rename = "infData")] + pub info_data: HostInfoData, +} diff --git a/epp-client/src/epp/response/host/update.rs b/epp-client/src/epp/response/host/update.rs new file mode 100644 index 0000000..64881f2 --- /dev/null +++ b/epp-client/src/epp/response/host/update.rs @@ -0,0 +1,3 @@ +use crate::epp::response::EppCommandResponse; + +pub type EppHostUpdateResponse = EppCommandResponse; diff --git a/epp-client/src/epp/response/message.rs b/epp-client/src/epp/response/message.rs new file mode 100644 index 0000000..5726c38 --- /dev/null +++ b/epp-client/src/epp/response/message.rs @@ -0,0 +1 @@ +pub mod poll; diff --git a/epp-client/src/epp/response/message/poll.rs b/epp-client/src/epp/response/message/poll.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/epp-client/src/epp/response/message/poll.rs @@ -0,0 +1 @@ + diff --git a/epp-client/src/epp/xml.rs b/epp-client/src/epp/xml.rs index 390aeff..c029d03 100644 --- a/epp-client/src/epp/xml.rs +++ b/epp-client/src/epp/xml.rs @@ -9,6 +9,7 @@ pub const EPP_XSI_SCHEMA_LOCATION: &str = "urn:ietf:params:xml:ns:epp-1.0 epp-1. pub const EPP_DOMAIN_XMLNS: &str = "urn:ietf:params:xml:ns:domain-1.0"; pub const EPP_CONTACT_XMLNS: &str = "urn:ietf:params:xml:ns:contact-1.0"; +pub const EPP_HOST_XMLNS: &str = "urn:ietf:params:xml:ns:host-1.0"; pub const EPP_VERSION: &str = "1.0"; pub const EPP_LANG: &str = "en";