diff --git a/epp-client/src/connection/client.rs b/epp-client/src/connection/client.rs index 18ba96f..72ea0f2 100644 --- a/epp-client/src/connection/client.rs +++ b/epp-client/src/connection/client.rs @@ -41,7 +41,7 @@ //! //! // Execute an EPP Command against the registry with distinct request and response objects //! let domain_check = DomainCheck::::new(vec!["eppdev.com", "eppdev.net"]); -//! let response = client.transact_new(domain_check, generate_client_tr_id(&client).as_str()).await.unwrap(); +//! let response = client.transact(domain_check, generate_client_tr_id(&client).as_str()).await.unwrap(); //! println!("{:?}", response); //! //! } @@ -58,10 +58,7 @@ use crate::hello::{EppGreeting, EppHello}; use crate::login::Login; use crate::logout::Logout; use crate::request::{generate_client_tr_id, EppExtension, EppRequest}; -use crate::response::{ - CommandResponseStatus, CommandResponseWithExtension, EppCommandResponse, - EppCommandResponseError, -}; +use crate::response::{CommandResponseStatus, CommandResponseWithExtension}; use crate::xml::EppXml; /// Instances of the EppClient type are used to transact with the registry. /// Once initialized, the EppClient instance can serialize EPP requests to XML and send them @@ -125,7 +122,7 @@ impl EppClient { ); client - .transact_new(login_request, client_tr_id.as_str()) + .transact(login_request, client_tr_id.as_str()) .await?; Ok(client) @@ -141,28 +138,7 @@ impl EppClient { Ok(EppGreeting::deserialize(&response)?) } - /// Accepts an EPP request object to convert to a request to send to the registry. The response from the - /// registry is deserialized to response type E and returned. - pub async fn transact( - &mut self, - request: &T, - ) -> Result { - let epp_xml = request.serialize()?; - - let response = self.connection.transact(&epp_xml).await?; - - let status = EppCommandResponse::deserialize(&response)?; - - if status.data.result.code < 2000 { - let response = E::deserialize(&response)?; - Ok(response) - } else { - let epp_error = EppCommandResponseError::deserialize(&response)?; - Err(error::Error::EppCommandError(epp_error)) - } - } - - pub async fn transact_new( + pub async fn transact( &mut self, request: T, id: &str, @@ -209,7 +185,7 @@ impl EppClient { let client_tr_id = generate_client_tr_id(&self.credentials.0).unwrap(); let epp_logout = Logout::::new(); - let response = self.transact_new(epp_logout, client_tr_id.as_str()).await?; + let response = self.transact(epp_logout, client_tr_id.as_str()).await?; self.connection.shutdown().await?; diff --git a/epp-client/src/contact/check.rs b/epp-client/src/contact/check.rs index b6afcb9..90e35aa 100644 --- a/epp-client/src/contact/check.rs +++ b/epp-client/src/contact/check.rs @@ -66,7 +66,7 @@ impl EppRequest for ContactCheck { /// /// // send it to the registry and receive a response of type ContactCheckResponse /// -/// let response = client.transact_new(contact_check, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(contact_check, generate_client_tr_id(&client).as_str()).await.unwrap(); /// println!("{:?}", response); /// /// client.logout().await.unwrap(); diff --git a/epp-client/src/contact/create.rs b/epp-client/src/contact/create.rs index 9139b8e..95cfdcc 100644 --- a/epp-client/src/contact/create.rs +++ b/epp-client/src/contact/create.rs @@ -79,7 +79,7 @@ impl EppRequest for ContactCreate { /// contact_create.set_fax(fax); /// /// // send it to the registry and receive a response of type ContactCreateResponse -/// let response = client.transact_new(contact_create, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(contact_create, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/contact/delete.rs b/epp-client/src/contact/delete.rs index 12bb81e..479197a 100644 --- a/epp-client/src/contact/delete.rs +++ b/epp-client/src/contact/delete.rs @@ -65,7 +65,7 @@ impl EppRequest for ContactDelete { /// ); /// /// // send it to the registry and receive a response of type ContactDeleteResponse -/// let response = client.transact_new(contact_delete, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(contact_delete, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/contact/info.rs b/epp-client/src/contact/info.rs index 6b10d15..f12287d 100644 --- a/epp-client/src/contact/info.rs +++ b/epp-client/src/contact/info.rs @@ -67,7 +67,7 @@ impl EppRequest for ContactInfo { /// ); /// /// // send it to the registry and receive a response of type ContactInfoResponse -/// let response = client.transact_new(contact_info, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(contact_info, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/contact/update.rs b/epp-client/src/contact/update.rs index 89a4980..bedaeb7 100644 --- a/epp-client/src/contact/update.rs +++ b/epp-client/src/contact/update.rs @@ -76,7 +76,7 @@ impl EppRequest for ContactUpdate { /// contact_update.add(add_statuses); /// /// // send it to the registry and receive a response of type ContactUpdateResponse -/// let response = client.transact_new(contact_update, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(contact_update, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/domain/check.rs b/epp-client/src/domain/check.rs index f39fd15..86f199f 100644 --- a/epp-client/src/domain/check.rs +++ b/epp-client/src/domain/check.rs @@ -64,7 +64,7 @@ impl EppRequest for DomainCheck { /// ); /// /// // send it to the registry and receive a response of type EppDomainCheckResponse -/// let response = client.transact_new(domain_check, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_check, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/domain/create.rs b/epp-client/src/domain/create.rs index 95b9d22..9778092 100644 --- a/epp-client/src/domain/create.rs +++ b/epp-client/src/domain/create.rs @@ -94,7 +94,7 @@ impl EppRequest for DomainCreate { /// ); /// /// // send it to the registry and receive a response of type EppDomainCreateResponse -/// let response = client.transact_new(domain_create, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_create, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/domain/delete.rs b/epp-client/src/domain/delete.rs index 5bdb414..f7a4a91 100644 --- a/epp-client/src/domain/delete.rs +++ b/epp-client/src/domain/delete.rs @@ -63,7 +63,7 @@ impl EppRequest for DomainDelete { /// let mut domain_delete = DomainDelete::::new("eppdev-100.com"); /// /// // send it to the registry and receive a response of type DomainDeleteResponse -/// let response = client.transact_new(domain_delete, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_delete, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/domain/info.rs b/epp-client/src/domain/info.rs index 8f7c984..3c462b2 100644 --- a/epp-client/src/domain/info.rs +++ b/epp-client/src/domain/info.rs @@ -64,7 +64,7 @@ impl EppRequest for DomainInfo { /// let domain_info = DomainInfo::::new("eppdev-100.com"); /// /// // send it to the registry and receive a response of type DomainInfoResponse -/// let response = client.transact_new(domain_info, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_info, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/domain/renew.rs b/epp-client/src/domain/renew.rs index 7973381..29cc6cf 100644 --- a/epp-client/src/domain/renew.rs +++ b/epp-client/src/domain/renew.rs @@ -68,7 +68,7 @@ impl EppRequest for DomainRenew { /// let domain_renew = DomainRenew::::new("eppdev-100.com", exp_date, 1); /// /// // send it to the registry and receive a response of type DomainRenewResponse -/// let response = client.transact_new(domain_renew, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_renew, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/domain/rgp/report.rs b/epp-client/src/domain/rgp/report.rs index 2bb9b48..980a6eb 100644 --- a/epp-client/src/domain/rgp/report.rs +++ b/epp-client/src/domain/rgp/report.rs @@ -75,7 +75,7 @@ use serde::{Deserialize, Serialize}; /// let mut domain_update = DomainUpdate::::new("eppdev-100.com").with_extension(domain_restore_report); /// /// // send it to the registry and receive a response of type EppDomainUpdateResponse -/// let response = client.transact_new(domain_update, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_update, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/domain/rgp/request.rs b/epp-client/src/domain/rgp/request.rs index f090392..87c6390 100644 --- a/epp-client/src/domain/rgp/request.rs +++ b/epp-client/src/domain/rgp/request.rs @@ -52,7 +52,7 @@ use serde::{Deserialize, Serialize}; /// let mut domain_update = DomainUpdate::::new("eppdev-100.com").with_extension(domain_restore_req); /// /// // send it to the registry and receive a response of type EppDomainUpdateResponse -/// let response = client.transact_new(domain_update, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_update, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/domain/transfer.rs b/epp-client/src/domain/transfer.rs index b1f07fb..405e407 100644 --- a/epp-client/src/domain/transfer.rs +++ b/epp-client/src/domain/transfer.rs @@ -125,7 +125,7 @@ impl EppRequest for DomainTransferQuery { /// ); /// /// // send it to the registry and receive a response of type DomainTransferRequestResponse -/// let response = client.transact_new(domain_transfer_request, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_transfer_request, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// @@ -198,7 +198,7 @@ impl DomainTransferRequest { /// ); /// /// // send it to the registry and receive a response of type DomainTransferApproveResponse -/// let response = client.transact_new(domain_transfer_approve, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_transfer_approve, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// @@ -271,7 +271,7 @@ impl DomainTransferApprove { /// ); /// /// // send it to the registry and receive a response of type DomainTransferRejectResponse -/// let response = client.transact_new(domain_transfer_reject, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_transfer_reject, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// @@ -344,7 +344,7 @@ impl DomainTransferReject { /// ); /// /// // send it to the registry and receive a response of type DomainTransferCancelResponse -/// let response = client.transact_new(domain_transfer_cancel, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_transfer_cancel, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// @@ -417,7 +417,7 @@ impl DomainTransferCancel { /// ); /// /// // send it to the registry and receive a response of type DomainTransferQueryResponse -/// let response = client.transact_new(domain_transfer_query, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_transfer_query, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/domain/update.rs b/epp-client/src/domain/update.rs index 7974090..41e3809 100644 --- a/epp-client/src/domain/update.rs +++ b/epp-client/src/domain/update.rs @@ -96,7 +96,7 @@ impl EppRequest for DomainUpdate { /// domain_update.remove(remove); /// /// // send it to the registry and receive a response of type EppDomainUpdateResponse -/// let response = client.transact_new(domain_update, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(domain_update, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/host/check.rs b/epp-client/src/host/check.rs index e729f66..8c07ed3 100644 --- a/epp-client/src/host/check.rs +++ b/epp-client/src/host/check.rs @@ -66,7 +66,7 @@ impl EppRequest for HostCheck { /// ); /// /// // send it to the registry and receive a response of type HostCheckResponse -/// let response = client.transact_new(host_check, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(host_check, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/host/create.rs b/epp-client/src/host/create.rs index 97898ca..16a5df9 100644 --- a/epp-client/src/host/create.rs +++ b/epp-client/src/host/create.rs @@ -69,7 +69,7 @@ impl EppRequest for HostCreate { /// let host_create = HostCreate::::new("ns1.eppdev-101.com", addresses); /// /// // send it to the registry and receive a response of type HostCreateResponse -/// let response = client.transact_new(host_create, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(host_create, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/host/delete.rs b/epp-client/src/host/delete.rs index 6d33edf..7a5780e 100644 --- a/epp-client/src/host/delete.rs +++ b/epp-client/src/host/delete.rs @@ -63,7 +63,7 @@ impl EppRequest for HostDelete { /// let host_delete = HostDelete::::new("ns2.eppdev-101.com"); /// /// // send it to the registry and receive a response of type HostDeleteResponse -/// let response = client.transact_new(host_delete, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(host_delete, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/host/info.rs b/epp-client/src/host/info.rs index 782a82c..29dbd73 100644 --- a/epp-client/src/host/info.rs +++ b/epp-client/src/host/info.rs @@ -62,7 +62,7 @@ impl EppRequest for HostInfo { /// let host_info = HostInfo::::new("ns2.eppdev-101.com"); /// /// // send it to the registry and receive a response of type HostInfoResponse -/// let response = client.transact_new(host_info, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(host_info, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/host/update.rs b/epp-client/src/host/update.rs index 3312eeb..5b1c42e 100644 --- a/epp-client/src/host/update.rs +++ b/epp-client/src/host/update.rs @@ -85,7 +85,7 @@ impl EppRequest for HostUpdate { /// host_update.info(HostChangeInfo { name: "ns2.eppdev-101.com".into() }); /// /// // send it to the registry and receive a response of type HostUpdateResponse -/// let response = client.transact_new(host_update, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(host_update, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/lib.rs b/epp-client/src/lib.rs index 72765c2..9ef6619 100644 --- a/epp-client/src/lib.rs +++ b/epp-client/src/lib.rs @@ -77,7 +77,7 @@ //! vec!["eppdev.com", "eppdev.net"], //! ); //! -//! let response = client.transact_new(domain_check, generate_client_tr_id(&client).as_str()).await.unwrap(); +//! let response = client.transact(domain_check, generate_client_tr_id(&client).as_str()).await.unwrap(); //! //! // print the availability results //! response.res_data.unwrap().check_data.domain_list diff --git a/epp-client/src/message/ack.rs b/epp-client/src/message/ack.rs index 653cc53..c744757 100644 --- a/epp-client/src/message/ack.rs +++ b/epp-client/src/message/ack.rs @@ -60,7 +60,7 @@ impl EppRequest for MessageAck { /// let message_ack = MessageAck::::new(12345); /// /// // send it to the registry and receive a response of type MessageAckResponse -/// let response = client.transact_new(message_ack, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(message_ack, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); /// diff --git a/epp-client/src/message/poll.rs b/epp-client/src/message/poll.rs index 692f794..132b68f 100644 --- a/epp-client/src/message/poll.rs +++ b/epp-client/src/message/poll.rs @@ -61,7 +61,7 @@ impl EppRequest for MessagePoll { /// let message_poll = MessagePoll::::new(); /// /// // send it to the registry and receive a response of type MessagePollResponse -/// let response = client.transact_new(message_poll, generate_client_tr_id(&client).as_str()).await.unwrap(); +/// let response = client.transact(message_poll, generate_client_tr_id(&client).as_str()).await.unwrap(); /// /// println!("{:?}", response); ///