added some examples for EPP transactions
This commit is contained in:
parent
70d8927989
commit
252d8676c1
|
@ -1,3 +1,5 @@
|
||||||
|
//! Types for EPP contact requests
|
||||||
|
|
||||||
pub mod check;
|
pub mod check;
|
||||||
pub mod create;
|
pub mod create;
|
||||||
pub mod delete;
|
pub mod delete;
|
||||||
|
|
|
@ -26,7 +26,10 @@ use serde::{Deserialize, Serialize};
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// // Create an EppContactCheck instance
|
/// // Create an EppContactCheck instance
|
||||||
/// let contact_check = EppContactCheck::new(vec!["epp-client-c1", "epp-client-c2"], generate_client_tr_id(&client).as_str());
|
/// let contact_check = EppContactCheck::new(
|
||||||
|
/// vec!["epp-client-c1", "epp-client-c2"],
|
||||||
|
/// generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
///
|
///
|
||||||
/// // send it to the registry and receive a response of type EppContactCheckResponse
|
/// // send it to the registry and receive a response of type EppContactCheckResponse
|
||||||
/// let response = client.transact::<_, EppContactCheckResponse>(&contact_check).await.unwrap();
|
/// let response = client.transact::<_, EppContactCheckResponse>(&contact_check).await.unwrap();
|
||||||
|
|
|
@ -9,6 +9,50 @@ use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for contact <create> command
|
/// Type that represents the <epp> request for contact <create> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::object::data::{Address, Phone, PostalInfo};
|
||||||
|
/// use epp_client::epp::{EppContactCreate, EppContactCreateResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create the address, postal_info, voice instances
|
||||||
|
/// let street = vec!["58", "Orchid Road"];
|
||||||
|
/// let address = Address::new(street, "New York", "New York", "392374", "US");
|
||||||
|
/// let postal_info = PostalInfo::new("int", "John Doe", "Acme Widgets", address);
|
||||||
|
/// let mut voice = Phone::new("+1.47237942");
|
||||||
|
/// voice.set_extension("123");
|
||||||
|
/// let mut fax = Phone::new("+1.86698799");
|
||||||
|
/// fax.set_extension("677");
|
||||||
|
///
|
||||||
|
/// // Create an EppContactCreate instance
|
||||||
|
/// let mut contact_create = EppContactCreate::new(
|
||||||
|
/// "eppdev-contact-100",
|
||||||
|
/// "contact@eppdev.net",
|
||||||
|
/// postal_info,
|
||||||
|
/// voice,
|
||||||
|
/// "epP4uthd#v",
|
||||||
|
/// generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
/// contact_create.set_fax(fax);
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppContactCreateResponse
|
||||||
|
/// let response = client.transact::<_, EppContactCreateResponse>(&contact_create).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppContactCreate = EppObject<Command<ContactCreate>>;
|
pub type EppContactCreate = EppObject<Command<ContactCreate>>;
|
||||||
|
|
||||||
/// Type for elements under the contact <create> tag
|
/// Type for elements under the contact <create> tag
|
||||||
|
|
|
@ -8,6 +8,35 @@ use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type for the <epp> request for contact <delete> command
|
/// Type for the <epp> request for contact <delete> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppContactDelete, EppContactDeleteResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppContactDelete instance
|
||||||
|
/// let contact_delete = EppContactDelete::new(
|
||||||
|
/// "eppdev-contact-100",
|
||||||
|
/// generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppContactDeleteResponse
|
||||||
|
/// let response = client.transact::<_, EppContactDeleteResponse>(&contact_delete).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppContactDelete = EppObject<Command<ContactDelete>>;
|
pub type EppContactDelete = EppObject<Command<ContactDelete>>;
|
||||||
|
|
||||||
/// Type containing the data for the <delete> tag for contacts
|
/// Type containing the data for the <delete> tag for contacts
|
||||||
|
|
|
@ -9,6 +9,36 @@ use crate::epp::xml::EPP_CONTACT_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type for the <epp> request for contact <info> command
|
/// Type for the <epp> request for contact <info> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppContactInfo, EppContactInfoResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppContactInfo instance
|
||||||
|
/// let contact_info = EppContactInfo::new(
|
||||||
|
/// "eppdev-contact-100",
|
||||||
|
/// "epP4uthd#v",
|
||||||
|
/// generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppContactInfoResponse
|
||||||
|
/// let response = client.transact::<_, EppContactInfoResponse>(&contact_info).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppContactInfo = EppObject<Command<ContactInfo>>;
|
pub type EppContactInfo = EppObject<Command<ContactInfo>>;
|
||||||
|
|
||||||
/// Type for elements under the contact <info> tag
|
/// Type for elements under the contact <info> tag
|
||||||
|
|
|
@ -11,6 +11,43 @@ use crate::error;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for contact <update> command
|
/// Type that represents the <epp> request for contact <update> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppContactUpdate, EppContactUpdateResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppContactUpdate instance
|
||||||
|
/// let mut contact_update = EppContactUpdate::new(
|
||||||
|
/// "eppdev-contact-100",
|
||||||
|
/// generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// let add_statuses = vec![
|
||||||
|
/// ContactStatus {
|
||||||
|
/// status: "clientTransferProhibited".to_string()
|
||||||
|
/// }
|
||||||
|
/// ];
|
||||||
|
///
|
||||||
|
/// contact_update.add(add_statuses);
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppContactUpdateResponse
|
||||||
|
/// let response = client.transact::<_, EppContactUpdateResponse>(&contact_update).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppContactUpdate = EppObject<Command<ContactUpdate>>;
|
pub type EppContactUpdate = EppObject<Command<ContactUpdate>>;
|
||||||
|
|
||||||
/// Type for elements under the <chg> tag for contact update request
|
/// Type for elements under the <chg> tag for contact update request
|
||||||
|
@ -96,12 +133,12 @@ impl EppContactUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the data for the <add> tag for the contact update request
|
/// Sets the data for the <add> tag for the contact update request
|
||||||
pub fn add_statuses(&mut self, statuses: Vec<ContactStatus>) {
|
pub fn add(&mut self, statuses: Vec<ContactStatus>) {
|
||||||
self.data.command.contact.add_statuses = Some(StatusList { status: statuses });
|
self.data.command.contact.add_statuses = Some(StatusList { status: statuses });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the data for the <rem> tag for the contact update request
|
/// Sets the data for the <rem> tag for the contact update request
|
||||||
pub fn remove_statuses(&mut self, statuses: Vec<ContactStatus>) {
|
pub fn remove(&mut self, statuses: Vec<ContactStatus>) {
|
||||||
self.data.command.contact.remove_statuses = Some(StatusList { status: statuses });
|
self.data.command.contact.remove_statuses = Some(StatusList { status: statuses });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Types for EPP domain requests
|
||||||
|
|
||||||
pub mod check;
|
pub mod check;
|
||||||
pub mod create;
|
pub mod create;
|
||||||
pub mod delete;
|
pub mod delete;
|
||||||
|
|
|
@ -8,6 +8,35 @@ use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for domain <check> command
|
/// Type that represents the <epp> request for domain <check> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppDomainCheck, EppDomainCheckResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainCheck instance
|
||||||
|
/// let domain_check = EppDomainCheck::new(
|
||||||
|
/// vec!["eppdev-100.com", "eppdev-100.net"],
|
||||||
|
/// generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainCheckResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainCheckResponse>(&domain_check).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainCheck = EppObject<Command<DomainCheck>>;
|
pub type EppDomainCheck = EppObject<Command<DomainCheck>>;
|
||||||
|
|
||||||
/// Type for <name> elements under the domain <check> tag
|
/// Type for <name> elements under the domain <check> tag
|
||||||
|
|
|
@ -12,6 +12,51 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for domain <create> command
|
/// Type that represents the <epp> request for domain <create> command
|
||||||
/// with <hostObj> elements in the request for <ns> list
|
/// with <hostObj> elements in the request for <ns> list
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::object::data::DomainContact;
|
||||||
|
/// use epp_client::epp::{EppDomainCreate, EppDomainCreateResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// /// Create a vector of existing domain contact IDs
|
||||||
|
/// let contacts = vec![
|
||||||
|
/// DomainContact {
|
||||||
|
/// contact_type: "admin".to_string(),
|
||||||
|
/// id: "eppdev-contact-2".to_string()
|
||||||
|
/// },
|
||||||
|
/// DomainContact {
|
||||||
|
/// contact_type: "tech".to_string(),
|
||||||
|
/// id: "eppdev-contact-2".to_string()
|
||||||
|
/// },
|
||||||
|
/// DomainContact {
|
||||||
|
/// contact_type: "billing".to_string(),
|
||||||
|
/// id: "eppdev-contact-2".to_string()
|
||||||
|
/// }
|
||||||
|
/// ];
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainCreate instance
|
||||||
|
/// let domain_create = EppDomainCreate::new(
|
||||||
|
/// "eppdev-100.com", 1, "eppdev-contact-2", "epP4uthd#v", contacts, generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainCreateResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainCreateResponse>(&domain_create).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainCreate = EppObject<Command<DomainCreate<HostObjList>>>;
|
pub type EppDomainCreate = EppObject<Command<DomainCreate<HostObjList>>>;
|
||||||
/// Type that represents the <epp> request for domain <create> command
|
/// Type that represents the <epp> request for domain <create> command
|
||||||
/// with <hostAttr> elements in the request for <ns> list
|
/// with <hostAttr> elements in the request for <ns> list
|
||||||
|
|
|
@ -8,6 +8,32 @@ use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for domain <delete> command
|
/// Type that represents the <epp> request for domain <delete> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppDomainDelete, EppDomainDeleteResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainDelete instance
|
||||||
|
/// let mut domain_delete = EppDomainDelete::new("eppdev-100.com", generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainDeleteResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainDeleteResponse>(&domain_delete).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainDelete = EppObject<Command<DomainDelete>>;
|
pub type EppDomainDelete = EppObject<Command<DomainDelete>>;
|
||||||
|
|
||||||
/// Type for <name> element under the domain <delete> tag
|
/// Type for <name> element under the domain <delete> tag
|
||||||
|
|
|
@ -8,6 +8,32 @@ use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for domain <info> command
|
/// Type that represents the <epp> request for domain <info> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppDomainInfo, EppDomainInfoResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainInfo instance
|
||||||
|
/// let domain_info = EppDomainInfo::new("eppdev-100.com", generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainInfoResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainInfoResponse>(&domain_info).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainInfo = EppObject<Command<DomainInfo>>;
|
pub type EppDomainInfo = EppObject<Command<DomainInfo>>;
|
||||||
|
|
||||||
/// Type for data under the <name> element tag for the domain <info> tag
|
/// Type for data under the <name> element tag for the domain <info> tag
|
||||||
|
|
|
@ -10,6 +10,36 @@ use chrono::NaiveDate;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for domain <renew> command
|
/// Type that represents the <epp> request for domain <renew> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use chrono::NaiveDate;
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppDomainRenew, EppDomainRenewResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create a date object to set the current expiry date
|
||||||
|
/// let exp_date = NaiveDate::from_ymd(2022, 7, 27);
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainRenew instance
|
||||||
|
/// let domain_renew = EppDomainRenew::new("eppdev-100.com", exp_date, 1, generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainRenewResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainRenewResponse>(&domain_renew).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainRenew = EppObject<Command<DomainRenew>>;
|
pub type EppDomainRenew = EppObject<Command<DomainRenew>>;
|
||||||
|
|
||||||
/// Type for data under the domain <renew> tag
|
/// Type for data under the domain <renew> tag
|
||||||
|
|
|
@ -9,14 +9,158 @@ use crate::epp::xml::EPP_DOMAIN_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for transfer request for domain
|
/// Type that represents the <epp> request for transfer request for domain
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppDomainTransferRequest, EppDomainTransferRequestResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainTransferRequest instance
|
||||||
|
/// let domain_transfer_request = EppDomainTransferRequest::request(
|
||||||
|
/// "eppdev-100.net", 1, "epP4uthd#v", generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainTransferRequestResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainTransferRequestResponse>(&domain_transfer_request).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainTransferRequest = EppObject<Command<DomainTransfer>>;
|
pub type EppDomainTransferRequest = EppObject<Command<DomainTransfer>>;
|
||||||
|
|
||||||
/// Type that represents the <epp> request for transfer approval for domains
|
/// Type that represents the <epp> request for transfer approval for domains
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppDomainTransferApprove, EppDomainTransferApproveResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainTransferApprove instance
|
||||||
|
/// let domain_transfer_approve = EppDomainTransferApprove::approve(
|
||||||
|
/// "eppdev-100.net", generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainTransferApproveResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainTransferApproveResponse>(&domain_transfer_approve).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainTransferApprove = EppObject<Command<DomainTransfer>>;
|
pub type EppDomainTransferApprove = EppObject<Command<DomainTransfer>>;
|
||||||
|
|
||||||
/// Type that represents the <epp> request for transfer rejection for domains
|
/// Type that represents the <epp> request for transfer rejection for domains
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppDomainTransferReject, EppDomainTransferRejectResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainTransferReject instance
|
||||||
|
/// let domain_transfer_reject = EppDomainTransferReject::reject(
|
||||||
|
/// "eppdev-100.net", generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainTransferRejectResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainTransferRejectResponse>(&domain_transfer_reject).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainTransferReject = EppObject<Command<DomainTransfer>>;
|
pub type EppDomainTransferReject = EppObject<Command<DomainTransfer>>;
|
||||||
|
|
||||||
/// Type that represents the <epp> request for transfer request cancellation for domains
|
/// Type that represents the <epp> request for transfer request cancellation for domains
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppDomainTransferCancel, EppDomainTransferCancelResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainTransferCancel instance
|
||||||
|
/// let domain_transfer_cancel = EppDomainTransferCancel::cancel(
|
||||||
|
/// "eppdev-100.net", generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainTransferCancelResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainTransferCancelResponse>(&domain_transfer_cancel).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainTransferCancel = EppObject<Command<DomainTransfer>>;
|
pub type EppDomainTransferCancel = EppObject<Command<DomainTransfer>>;
|
||||||
|
|
||||||
/// Type that represents the <epp> request for transfer request query for domains
|
/// Type that represents the <epp> request for transfer request query for domains
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppDomainTransferQuery, EppDomainTransferQueryResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainTransferQuery instance
|
||||||
|
/// let domain_transfer_query = EppDomainTransferQuery::query(
|
||||||
|
/// "eppdev-100.net", "epP4uthd#v", generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainTransferQueryResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainTransferQueryResponse>(&domain_transfer_query).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainTransferQuery = EppObject<Command<DomainTransfer>>;
|
pub type EppDomainTransferQuery = EppObject<Command<DomainTransfer>>;
|
||||||
|
|
||||||
/// Type for elements under the domain <transfer> tag
|
/// Type for elements under the domain <transfer> tag
|
||||||
|
|
|
@ -10,6 +10,57 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for domain <update> command
|
/// Type that represents the <epp> request for domain <update> command
|
||||||
/// with <hostObj> elements in the request for <ns> list
|
/// with <hostObj> elements in the request for <ns> list
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::object::data::{DomainStatus, DomainContact};
|
||||||
|
/// use epp_client::epp::{EppDomainUpdate, EppDomainUpdateResponse, DomainAddRemove};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppDomainUpdate instance
|
||||||
|
/// let mut domain_update = EppDomainUpdate::new("eppdev-100.com", generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// let add = DomainAddRemove {
|
||||||
|
/// ns: None,
|
||||||
|
/// contacts: None,
|
||||||
|
/// statuses: Some(vec![
|
||||||
|
/// DomainStatus {
|
||||||
|
/// status: "clientUpdateProhibited".to_string()
|
||||||
|
/// }
|
||||||
|
/// ])
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// let remove = DomainAddRemove {
|
||||||
|
/// ns: None,
|
||||||
|
/// contacts: Some(vec![
|
||||||
|
/// DomainContact {
|
||||||
|
/// contact_type: "billing".to_string(),
|
||||||
|
/// id: "eppdev-contact-2".to_string()
|
||||||
|
/// }
|
||||||
|
/// ]),
|
||||||
|
/// statuses: None,
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// domain_update.add(add);
|
||||||
|
/// domain_update.remove(remove);
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppDomainUpdateResponse
|
||||||
|
/// let response = client.transact::<_, EppDomainUpdateResponse>(&domain_update).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppDomainUpdate = EppObject<Command<DomainUpdate<HostObjList>>>;
|
pub type EppDomainUpdate = EppObject<Command<DomainUpdate<HostObjList>>>;
|
||||||
/// Type that represents the <epp> request for domain <update> command
|
/// Type that represents the <epp> request for domain <update> command
|
||||||
/// with <hostAttr> elements in the request for <ns> list
|
/// with <hostAttr> elements in the request for <ns> list
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Types for EPP host requests
|
||||||
|
|
||||||
pub mod check;
|
pub mod check;
|
||||||
pub mod create;
|
pub mod create;
|
||||||
pub mod delete;
|
pub mod delete;
|
||||||
|
|
|
@ -8,6 +8,35 @@ use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for host <check> command
|
/// Type that represents the <epp> request for host <check> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppHostCheck, EppHostCheckResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppHostCheck instance
|
||||||
|
/// let host_check = EppHostCheck::new(
|
||||||
|
/// vec!["ns1.eppdev-101.com", "ns2.eppdev-101.com"],
|
||||||
|
/// generate_client_tr_id(&client).as_str()
|
||||||
|
/// );
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppHostCheckResponse
|
||||||
|
/// let response = client.transact::<_, EppHostCheckResponse>(&host_check).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppHostCheck = EppObject<Command<HostCheck>>;
|
pub type EppHostCheck = EppObject<Command<HostCheck>>;
|
||||||
|
|
||||||
/// Type for data under the host <check> tag
|
/// Type for data under the host <check> tag
|
||||||
|
|
|
@ -2,13 +2,46 @@
|
||||||
|
|
||||||
use epp_client_macros::*;
|
use epp_client_macros::*;
|
||||||
|
|
||||||
use crate::epp::object::data::{Host, HostAddr};
|
use crate::epp::object::data::HostAddr;
|
||||||
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
|
||||||
use crate::epp::request::Command;
|
use crate::epp::request::Command;
|
||||||
use crate::epp::xml::EPP_HOST_XMLNS;
|
use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for host <create> command
|
/// Type that represents the <epp> request for host <create> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::object::data::HostAddr;
|
||||||
|
/// use epp_client::epp::{EppHostCreate, EppHostCreateResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create a vector of IP addresses to assign to the host
|
||||||
|
/// let addresses = vec![
|
||||||
|
/// HostAddr::new("v4", "29.245.122.14"),
|
||||||
|
/// HostAddr::new("v6", "2404:6800:4001:801::200e"),
|
||||||
|
/// ];
|
||||||
|
///
|
||||||
|
/// // Create an EppHostCreate instance
|
||||||
|
/// let host_create = EppHostCreate::new("ns1.eppdev-101.com", addresses, generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppHostCreateResponse
|
||||||
|
/// let response = client.transact::<_, EppHostCreateResponse>(&host_create).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppHostCreate = EppObject<Command<HostCreate>>;
|
pub type EppHostCreate = EppObject<Command<HostCreate>>;
|
||||||
|
|
||||||
/// Type for data under the host <create> tag
|
/// Type for data under the host <create> tag
|
||||||
|
@ -34,12 +67,12 @@ pub struct HostCreate {
|
||||||
|
|
||||||
impl EppHostCreate {
|
impl EppHostCreate {
|
||||||
/// Creates a new EppObject for host create corresponding to the <epp> tag in EPP XML
|
/// Creates a new EppObject for host create corresponding to the <epp> tag in EPP XML
|
||||||
pub fn new(host: Host, client_tr_id: &str) -> EppHostCreate {
|
pub fn new(host: &str, addresses: Vec<HostAddr>, client_tr_id: &str) -> EppHostCreate {
|
||||||
let host_create = HostCreate {
|
let host_create = HostCreate {
|
||||||
host: HostCreateData {
|
host: HostCreateData {
|
||||||
xmlns: EPP_HOST_XMLNS.to_string(),
|
xmlns: EPP_HOST_XMLNS.to_string(),
|
||||||
name: host.name,
|
name: host.to_string_value(),
|
||||||
addresses: host.addresses,
|
addresses: Some(addresses),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,32 @@ use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for host <delete> command
|
/// Type that represents the <epp> request for host <delete> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppHostDelete, EppHostDeleteResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppHostDelete instance
|
||||||
|
/// let host_delete = EppHostDelete::new("ns2.eppdev-101.com", generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppHostDeleteResponse
|
||||||
|
/// let response = client.transact::<_, EppHostDeleteResponse>(&host_delete).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppHostDelete = EppObject<Command<HostDelete>>;
|
pub type EppHostDelete = EppObject<Command<HostDelete>>;
|
||||||
|
|
||||||
/// Type for data under the host <delete> tag
|
/// Type for data under the host <delete> tag
|
||||||
|
|
|
@ -8,6 +8,32 @@ use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for host <info> command
|
/// Type that represents the <epp> request for host <info> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppHostInfo, EppHostInfoResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppHostCreate instance
|
||||||
|
/// let host_info = EppHostInfo::new("ns2.eppdev-101.com", generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppHostInfoResponse
|
||||||
|
/// let response = client.transact::<_, EppHostInfoResponse>(&host_info).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppHostInfo = EppObject<Command<HostInfo>>;
|
pub type EppHostInfo = EppObject<Command<HostInfo>>;
|
||||||
|
|
||||||
/// Type for data under the host <info> tag
|
/// Type for data under the host <info> tag
|
||||||
|
|
|
@ -9,6 +9,55 @@ use crate::epp::xml::EPP_HOST_XMLNS;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for host <update> command
|
/// Type that represents the <epp> request for host <update> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::object::StringValueTrait;
|
||||||
|
/// use epp_client::epp::object::data::{HostAddr, HostStatus};
|
||||||
|
/// use epp_client::epp::{EppHostUpdate, EppHostUpdateResponse, HostAddRemove, HostChangeInfo};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppHostUpdate instance
|
||||||
|
/// let mut host_update = EppHostUpdate::new("ns1.eppdev-101.com", generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// /// Prepare the add and remove sections for the update
|
||||||
|
/// let add = HostAddRemove {
|
||||||
|
/// addresses: Some(vec![
|
||||||
|
/// HostAddr::new("v4", "177.34.126.17")
|
||||||
|
/// ]),
|
||||||
|
/// statuses: None
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// let remove = HostAddRemove {
|
||||||
|
/// addresses: Some(vec![
|
||||||
|
/// HostAddr::new("v6", "2404:6800:4001:801::200e")
|
||||||
|
/// ]),
|
||||||
|
/// statuses: None,
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// host_update.add(add);
|
||||||
|
/// host_update.remove(remove);
|
||||||
|
///
|
||||||
|
/// // Send a <chg> section as well
|
||||||
|
/// host_update.info(HostChangeInfo { name: "ns2.eppdev-101.com".to_string_value() });
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppHostUpdateResponse
|
||||||
|
/// let response = client.transact::<_, EppHostUpdateResponse>(&host_update).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppHostUpdate = EppObject<Command<HostUpdate>>;
|
pub type EppHostUpdate = EppObject<Command<HostUpdate>>;
|
||||||
|
|
||||||
/// Type for data under the <chg> tag
|
/// Type for data under the <chg> tag
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
|
//! Types for EPP message requests
|
||||||
|
|
||||||
pub mod ack;
|
pub mod ack;
|
||||||
pub mod poll;
|
pub mod poll;
|
||||||
|
|
|
@ -7,6 +7,31 @@ use crate::epp::request::Command;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for registry <poll op="ack"> command
|
/// Type that represents the <epp> request for registry <poll op="ack"> command
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```ignore
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppMessageAck, EppMessageAckResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppMessageAck instance
|
||||||
|
/// let message_ack = EppMessageAck::new(12345, generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppMessageAckResponse
|
||||||
|
/// let response = client.transact::<_, EppMessageAckResponse>(&message_ack).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppMessageAck = EppObject<Command<MessageAck>>;
|
pub type EppMessageAck = EppObject<Command<MessageAck>>;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, ElementName)]
|
#[derive(Serialize, Deserialize, Debug, ElementName)]
|
||||||
|
|
|
@ -7,6 +7,32 @@ use crate::epp::request::Command;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Type that represents the <epp> request for registry <poll op="req"> command
|
/// Type that represents the <epp> request for registry <poll op="req"> command
|
||||||
|
///
|
||||||
|
/// ## Usage
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// use epp_client::EppClient;
|
||||||
|
/// use epp_client::epp::{EppMessagePoll, EppMessagePollResponse};
|
||||||
|
/// use epp_client::epp::generate_client_tr_id;
|
||||||
|
///
|
||||||
|
/// #[tokio::main]
|
||||||
|
/// async fn main() {
|
||||||
|
/// // Create an instance of EppClient, specifying the name of the registry as in
|
||||||
|
/// // the config file
|
||||||
|
/// let mut client = match EppClient::new("verisign").await {
|
||||||
|
/// Ok(client) => client,
|
||||||
|
/// Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
|
/// };
|
||||||
|
///
|
||||||
|
/// // Create an EppMessagePoll instance
|
||||||
|
/// let message_poll = EppMessagePoll::new(generate_client_tr_id(&client).as_str());
|
||||||
|
///
|
||||||
|
/// // send it to the registry and receive a response of type EppMessagePollResponse
|
||||||
|
/// let response = client.transact::<_, EppMessagePollResponse>(&message_poll).await.unwrap();
|
||||||
|
///
|
||||||
|
/// println!("{:?}", response);
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub type EppMessagePoll = EppObject<Command<MessagePoll>>;
|
pub type EppMessagePoll = EppObject<Command<MessagePoll>>;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, ElementName)]
|
#[derive(Serialize, Deserialize, Debug, ElementName)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! Module containing types for EPP contact transactions
|
//! Types for EPP contact responses
|
||||||
|
|
||||||
pub mod check;
|
pub mod check;
|
||||||
pub mod create;
|
pub mod create;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! Module containing types for EPP domain transactions
|
//! Types for EPP domain responses
|
||||||
|
|
||||||
pub mod check;
|
pub mod check;
|
||||||
pub mod create;
|
pub mod create;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! Module containing types for EPP host transactions
|
//! Types for EPP host responses
|
||||||
|
|
||||||
pub mod check;
|
pub mod check;
|
||||||
pub mod create;
|
pub mod create;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! Module containing types for EPP message transactions
|
//! Types for EPP message responses
|
||||||
|
|
||||||
pub mod ack;
|
pub mod ack;
|
||||||
pub mod poll;
|
pub mod poll;
|
||||||
|
|
|
@ -4,7 +4,7 @@ mod request {
|
||||||
use super::super::get_xml;
|
use super::super::get_xml;
|
||||||
use super::super::CLTRID;
|
use super::super::CLTRID;
|
||||||
use crate::epp::object::data::{
|
use crate::epp::object::data::{
|
||||||
Address, AuthInfo, ContactStatus, DomainContact, DomainStatus, Host, HostAddr, HostAttr,
|
Address, AuthInfo, ContactStatus, DomainContact, DomainStatus, HostAddr, HostAttr,
|
||||||
HostStatus, Phone, PostalInfo,
|
HostStatus, Phone, PostalInfo,
|
||||||
};
|
};
|
||||||
use crate::epp::object::StringValueTrait;
|
use crate::epp::object::StringValueTrait;
|
||||||
|
@ -106,11 +106,11 @@ mod request {
|
||||||
let add_statuses = vec![ContactStatus {
|
let add_statuses = vec![ContactStatus {
|
||||||
status: "clientTransferProhibited".to_string(),
|
status: "clientTransferProhibited".to_string(),
|
||||||
}];
|
}];
|
||||||
object.add_statuses(add_statuses);
|
object.add(add_statuses);
|
||||||
let remove_statuses = vec![ContactStatus {
|
let remove_statuses = vec![ContactStatus {
|
||||||
status: "clientDeleteProhibited".to_string(),
|
status: "clientDeleteProhibited".to_string(),
|
||||||
}];
|
}];
|
||||||
object.remove_statuses(remove_statuses);
|
object.remove(remove_statuses);
|
||||||
|
|
||||||
let serialized = object.serialize().unwrap();
|
let serialized = object.serialize().unwrap();
|
||||||
|
|
||||||
|
@ -395,15 +395,12 @@ mod request {
|
||||||
fn host_create() {
|
fn host_create() {
|
||||||
let xml = get_xml("request/host/create.xml").unwrap();
|
let xml = get_xml("request/host/create.xml").unwrap();
|
||||||
|
|
||||||
let host = Host {
|
let addresses = vec![
|
||||||
name: "host1.eppdev-1.com".to_string_value(),
|
HostAddr::new("v4", "29.245.122.14"),
|
||||||
addresses: Some(vec![
|
HostAddr::new("v6", "2404:6800:4001:801::200e"),
|
||||||
HostAddr::new("v4", "29.245.122.14"),
|
];
|
||||||
HostAddr::new("v6", "2404:6800:4001:801::200e"),
|
|
||||||
]),
|
|
||||||
};
|
|
||||||
|
|
||||||
let object = EppHostCreate::new(host, CLTRID);
|
let object = EppHostCreate::new("host1.eppdev-1.com", addresses, CLTRID);
|
||||||
|
|
||||||
let serialized = object.serialize().unwrap();
|
let serialized = object.serialize().unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue