Rename EppRequest to Transaction

This commit is contained in:
Dirkjan Ochtman 2021-12-06 16:25:11 +01:00 committed by masalachai
parent 7039fdb7d6
commit 50c21a7037
25 changed files with 52 additions and 52 deletions

View File

@ -49,7 +49,7 @@ use crate::config::EppClientConfig;
use crate::error;
use crate::hello::{Greeting, GreetingDocument, HelloDocument};
use crate::registry::{epp_connect, EppConnection};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use crate::response::Response;
use crate::xml::EppXml;
@ -91,9 +91,9 @@ impl EppClient {
&mut self,
request: T,
id: &str,
) -> Result<Response<<T as EppRequest<E>>::Output, E::Response>, error::Error>
) -> Result<Response<<T as Transaction<E>>::Output, E::Response>, error::Error>
where
T: EppRequest<E> + Debug,
T: Transaction<E> + Debug,
E: EppExtension,
{
let epp_xml = request.serialize_request(id)?;

View File

@ -5,7 +5,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -14,7 +14,7 @@ pub struct ContactCheck<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for ContactCheck<E> {
impl<E: EppExtension> Transaction<E> for ContactCheck<E> {
type Input = ContactCheckRequest;
type Output = ContactCheckResponse;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ContactAuthInfo, ElementName, NoExtension, Phone, PostalInfo, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -13,7 +13,7 @@ pub struct ContactCreate<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for ContactCreate<E> {
impl<E: EppExtension> Transaction<E> for ContactCreate<E> {
type Input = ContactCreateRequest;
type Output = ContactCreateResponse;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use crate::response::ResponseStatus;
use serde::{Deserialize, Serialize};
@ -14,7 +14,7 @@ pub struct ContactDelete<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for ContactDelete<E> {
impl<E: EppExtension> Transaction<E> for ContactDelete<E> {
type Input = ContactDeleteRequest;
type Output = ResponseStatus;

View File

@ -6,7 +6,7 @@ use super::XMLNS;
use crate::common::{
ContactAuthInfo, ContactStatus, ElementName, NoExtension, Phone, PostalInfo, StringValue,
};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -15,7 +15,7 @@ pub struct ContactInfo<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for ContactInfo<E> {
impl<E: EppExtension> Transaction<E> for ContactInfo<E> {
type Input = ContactInfoRequest;
type Output = ContactInfoResponse;

View File

@ -6,7 +6,7 @@ use super::XMLNS;
use crate::common::{
ContactAuthInfo, ContactStatus, ElementName, NoExtension, Phone, PostalInfo, StringValue,
};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use crate::response::ResponseStatus;
use serde::{Deserialize, Serialize};
@ -16,7 +16,7 @@ pub struct ContactUpdate<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for ContactUpdate<E> {
impl<E: EppExtension> Transaction<E> for ContactUpdate<E> {
type Input = ContactUpdateRequest;
type Output = ResponseStatus;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -13,7 +13,7 @@ pub struct DomainCheck<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainCheck<E> {
impl<E: EppExtension> Transaction<E> for DomainCheck<E> {
type Input = DomainCheckRequest;
type Output = DomainCheckResponse;

View File

@ -6,7 +6,7 @@ use super::XMLNS;
use crate::common::{
DomainAuthInfo, DomainContact, ElementName, HostList, NoExtension, Period, StringValue,
};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -15,7 +15,7 @@ pub struct DomainCreate<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainCreate<E> {
impl<E: EppExtension> Transaction<E> for DomainCreate<E> {
type Input = DomainCreateRequest;
type Output = DomainCreateResponse;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use crate::response::ResponseStatus;
use serde::{Deserialize, Serialize};
@ -14,7 +14,7 @@ pub struct DomainDelete<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainDelete<E> {
impl<E: EppExtension> Transaction<E> for DomainDelete<E> {
type Input = DomainDeleteRequest;
type Output = ResponseStatus;

View File

@ -6,7 +6,7 @@ use super::XMLNS;
use crate::common::{
DomainAuthInfo, DomainContact, DomainStatus, ElementName, HostAttr, NoExtension, StringValue,
};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -15,7 +15,7 @@ pub struct DomainInfo<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainInfo<E> {
impl<E: EppExtension> Transaction<E> for DomainInfo<E> {
type Input = DomainInfoRequest;
type Output = DomainInfoResponse;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, Period, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use chrono::NaiveDate;
use serde::{Deserialize, Serialize};
@ -14,7 +14,7 @@ pub struct DomainRenew<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainRenew<E> {
impl<E: EppExtension> Transaction<E> for DomainRenew<E> {
type Input = DomainRenewRequest;
type Output = DomainRenewResponse;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{DomainAuthInfo, ElementName, NoExtension, Period, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -13,7 +13,7 @@ pub struct DomainTransferRequest<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainTransferRequest<E> {
impl<E: EppExtension> Transaction<E> for DomainTransferRequest<E> {
type Input = DomainTransferReq;
type Output = DomainTransferResponse;
@ -28,7 +28,7 @@ pub struct DomainTransferApprove<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainTransferApprove<E> {
impl<E: EppExtension> Transaction<E> for DomainTransferApprove<E> {
type Input = DomainTransferReq;
type Output = DomainTransferResponse;
@ -43,7 +43,7 @@ pub struct DomainTransferReject<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainTransferReject<E> {
impl<E: EppExtension> Transaction<E> for DomainTransferReject<E> {
type Input = DomainTransferReq;
type Output = DomainTransferResponse;
@ -58,7 +58,7 @@ pub struct DomainTransferCancel<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainTransferCancel<E> {
impl<E: EppExtension> Transaction<E> for DomainTransferCancel<E> {
type Input = DomainTransferReq;
type Output = DomainTransferResponse;
@ -73,7 +73,7 @@ pub struct DomainTransferQuery<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainTransferQuery<E> {
impl<E: EppExtension> Transaction<E> for DomainTransferQuery<E> {
type Input = DomainTransferReq;
type Output = DomainTransferResponse;

View File

@ -7,7 +7,7 @@ use crate::{
DomainAuthInfo, DomainContact, DomainStatus, ElementName, HostList, NoExtension,
StringValue,
},
request::{EppExtension, EppRequest},
request::{EppExtension, Transaction},
};
use super::XMLNS;
@ -21,7 +21,7 @@ pub struct DomainUpdate<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for DomainUpdate<E> {
impl<E: EppExtension> Transaction<E> for DomainUpdate<E> {
type Input = DomainUpdateRequest;
type Output = ResponseStatus;

View File

@ -6,7 +6,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -15,7 +15,7 @@ pub struct HostCheck<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for HostCheck<E> {
impl<E: EppExtension> Transaction<E> for HostCheck<E> {
type Input = HostCheckRequest;
type Output = HostCheckResponse;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, HostAddr, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -13,7 +13,7 @@ pub struct HostCreate<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for HostCreate<E> {
impl<E: EppExtension> Transaction<E> for HostCreate<E> {
type Input = HostCreateRequest;
type Output = HostCreateResponse;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use crate::response::ResponseStatus;
use serde::{Deserialize, Serialize};
@ -14,7 +14,7 @@ pub struct HostDelete<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for HostDelete<E> {
impl<E: EppExtension> Transaction<E> for HostDelete<E> {
type Input = HostDeleteRequest;
type Output = ResponseStatus;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, HostAddr, HostStatus, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -13,7 +13,7 @@ pub struct HostInfo<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for HostInfo<E> {
impl<E: EppExtension> Transaction<E> for HostInfo<E> {
type Input = HostInfoRequest;
type Output = HostInfoResponse;

View File

@ -4,7 +4,7 @@ use epp_client_macros::*;
use super::XMLNS;
use crate::common::{ElementName, HostAddr, HostStatus, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use crate::response::ResponseStatus;
use serde::{Deserialize, Serialize};
@ -14,7 +14,7 @@ pub struct HostUpdate<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for HostUpdate<E> {
impl<E: EppExtension> Transaction<E> for HostUpdate<E> {
type Input = HostUpdateRequest;
type Output = ResponseStatus;

View File

@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
use crate::{
common::{ElementName, NoExtension, Options, ServiceExtension, Services, StringValue},
contact, domain, host,
request::{EppExtension, EppRequest, EPP_LANG, EPP_VERSION},
request::{EppExtension, Transaction, EPP_LANG, EPP_VERSION},
response::ResponseStatus,
};
@ -16,7 +16,7 @@ pub struct Login<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for Login<E> {
impl<E: EppExtension> Transaction<E> for Login<E> {
type Input = LoginRequest;
type Output = ResponseStatus;

View File

@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use crate::{
common::{ElementName, NoExtension},
request::{EppExtension, EppRequest},
request::{EppExtension, Transaction},
response::ResponseStatus,
};
@ -15,7 +15,7 @@ pub struct Logout<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for Logout<E> {
impl<E: EppExtension> Transaction<E> for Logout<E> {
type Input = LogoutRequest;
type Output = ResponseStatus;

View File

@ -3,7 +3,7 @@
use epp_client_macros::*;
use crate::common::{ElementName, NoExtension};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -12,7 +12,7 @@ pub struct MessageAck<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for MessageAck<E> {
impl<E: EppExtension> Transaction<E> for MessageAck<E> {
type Input = MessageAckRequest;
type Output = String;

View File

@ -3,7 +3,7 @@
use epp_client_macros::*;
use crate::common::{ElementName, NoExtension, StringValue};
use crate::request::{EppExtension, EppRequest};
use crate::request::{EppExtension, Transaction};
use serde::{Deserialize, Serialize};
#[derive(Debug)]
@ -12,7 +12,7 @@ pub struct MessagePoll<E> {
extension: Option<E>,
}
impl<E: EppExtension> EppRequest<E> for MessagePoll<E> {
impl<E: EppExtension> Transaction<E> for MessagePoll<E> {
type Input = MessagePollRequest;
type Output = MessagePollResponse;

View File

@ -14,7 +14,7 @@ pub const EPP_VERSION: &str = "1.0";
pub const EPP_LANG: &str = "en";
/// Trait to set correct value for xml tags when tags are being generated from generic types
pub trait EppRequest<E: EppExtension>: Sized + Debug {
pub trait Transaction<E: EppExtension>: Sized + Debug {
type Input: ElementName + Serialize + Sized + Debug;
type Output: DeserializeOwned + Debug;

View File

@ -34,7 +34,7 @@ mod response {
use crate::logout::Logout;
use crate::message::ack::MessageAck;
use crate::message::poll::MessagePoll;
use crate::request::EppRequest;
use crate::request::Transaction;
use crate::response::ResultDocument;
use crate::xml::EppXml;

View File

@ -45,7 +45,7 @@ mod request {
use crate::logout::Logout;
use crate::message::ack::MessageAck;
use crate::message::poll::MessagePoll;
use crate::request::EppRequest;
use crate::request::Transaction;
use crate::xml::EppXml;
use chrono::{DateTime, NaiveDate};
use std::str::FromStr;