Rename ResponseWithExtension to just Response

Since there is no longer a different type that has no extension.
This commit is contained in:
Dirkjan Ochtman 2021-12-02 13:52:42 +01:00 committed by masalachai
parent 340cc9c90a
commit 627b7d3e23
3 changed files with 8 additions and 11 deletions

View File

@ -58,7 +58,7 @@ use crate::login::Login;
use crate::logout::Logout;
use crate::registry::{epp_connect, EppConnection};
use crate::request::{generate_client_tr_id, EppExtension, EppRequest};
use crate::response::{ResponseStatus, ResponseWithExtension};
use crate::response::{Response, ResponseStatus};
use crate::xml::EppXml;
/// Instances of the EppClient type are used to transact with the registry.
@ -143,7 +143,7 @@ impl EppClient {
&mut self,
request: T,
id: &str,
) -> Result<ResponseWithExtension<<T as EppRequest<E>>::Output, E::Response>, error::Error>
) -> Result<Response<<T as EppRequest<E>>::Output, E::Response>, error::Error>
where
T: EppRequest<E> + Debug,
E: EppExtension,
@ -179,7 +179,7 @@ impl EppClient {
/// Sends the EPP Logout command to log out of the EPP session
pub async fn logout(
&mut self,
) -> Result<ResponseWithExtension<EppObject<ResponseStatus>, NoExtension>, error::Error> {
) -> Result<Response<EppObject<ResponseStatus>, NoExtension>, error::Error> {
let client_tr_id = generate_client_tr_id(&self.credentials.0).unwrap();
let epp_logout = Logout::<NoExtension>::new();

View File

@ -8,7 +8,7 @@ use std::time::SystemTime;
use crate::{
common::NoExtension,
common::{ElementName, EppObject, Extension, StringValue},
response::{ResponseStatus, ResponseWithExtension},
response::{Response, ResponseStatus},
xml::EppXml,
};
use epp_client_macros::ElementName;
@ -35,11 +35,8 @@ pub trait EppRequest<E: EppExtension>: Sized + Debug {
fn deserialize_response(
epp_xml: &str,
) -> Result<ResponseWithExtension<Self::Output, E::Response>, crate::error::Error> {
let rsp =
<EppObject<ResponseWithExtension<Self::Output, E::Response>> as EppXml>::deserialize(
epp_xml,
)?;
) -> Result<Response<Self::Output, E::Response>, crate::error::Error> {
let rsp = <EppObject<Response<Self::Output, E::Response>> as EppXml>::deserialize(epp_xml)?;
match rsp.data.result.code {
0..=2000 => Ok(rsp.data),
_ => Err(crate::error::Error::EppCommandError(EppObject::build(

View File

@ -76,7 +76,7 @@ pub struct MessageQueue {
#[element_name(name = "response")]
/// Type corresponding to the &lt;response&gt; tag in an EPP response XML
/// containing an &lt;extension&gt; tag
pub struct ResponseWithExtension<T, E: ElementName> {
pub struct Response<T, E: ElementName> {
/// Data under the <result> tag
pub result: EppResult,
/// Data under the <msgQ> tag
@ -104,7 +104,7 @@ pub struct ResponseStatus {
pub tr_ids: ResponseTRID,
}
impl<T, E: ElementName> ResponseWithExtension<T, E> {
impl<T, E: ElementName> Response<T, E> {
/// Returns the data under the corresponding &lt;resData&gt; from the EPP XML
pub fn res_data(&self) -> Option<&T> {
match &self.res_data {