Rename ResponseWithExtension to just Response
Since there is no longer a different type that has no extension.
This commit is contained in:
parent
340cc9c90a
commit
627b7d3e23
|
@ -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();
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -76,7 +76,7 @@ pub struct MessageQueue {
|
|||
#[element_name(name = "response")]
|
||||
/// Type corresponding to the <response> tag in an EPP response XML
|
||||
/// containing an <extension> 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 <resData> from the EPP XML
|
||||
pub fn res_data(&self) -> Option<&T> {
|
||||
match &self.res_data {
|
||||
|
|
Loading…
Reference in New Issue