Rename CommandWithExtension to Command
This commit is contained in:
parent
8f43800a3d
commit
140f6830a9
|
@ -25,7 +25,7 @@ pub trait EppRequest<E: EppExtension>: Sized + Debug {
|
||||||
fn serialize_request(self, client_tr_id: &str) -> Result<String, Box<dyn std::error::Error>> {
|
fn serialize_request(self, client_tr_id: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||||
let (command, extension) = self.into_parts();
|
let (command, extension) = self.into_parts();
|
||||||
let extension = extension.map(|data| Extension { data });
|
let extension = extension.map(|data| Extension { data });
|
||||||
EppXml::serialize(&EppObject::build(CommandWithExtension {
|
EppXml::serialize(&EppObject::build(Command {
|
||||||
command,
|
command,
|
||||||
extension,
|
extension,
|
||||||
client_tr_id: client_tr_id.into(),
|
client_tr_id: client_tr_id.into(),
|
||||||
|
@ -54,7 +54,7 @@ pub trait EppExtension: ElementName + DeserializeOwned + Serialize + Sized + Deb
|
||||||
#[element_name(name = "command")]
|
#[element_name(name = "command")]
|
||||||
/// Type corresponding to the <command> tag in an EPP XML request
|
/// Type corresponding to the <command> tag in an EPP XML request
|
||||||
/// with an <extension> tag
|
/// with an <extension> tag
|
||||||
pub struct CommandWithExtension<T: ElementName, E: ElementName> {
|
pub struct Command<T: ElementName, E: ElementName> {
|
||||||
/// The instance that will be used to populate the <command> tag
|
/// The instance that will be used to populate the <command> tag
|
||||||
pub command: T,
|
pub command: T,
|
||||||
/// The client TRID
|
/// The client TRID
|
||||||
|
@ -63,9 +63,7 @@ pub struct CommandWithExtension<T: ElementName, E: ElementName> {
|
||||||
pub client_tr_id: StringValue,
|
pub client_tr_id: StringValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ElementName + Serialize, E: ElementName + Serialize> Serialize
|
impl<T: ElementName + Serialize, E: ElementName + Serialize> Serialize for Command<T, E> {
|
||||||
for CommandWithExtension<T, E>
|
|
||||||
{
|
|
||||||
/// Serializes the generic type T to the proper XML tag (set by the `#[element_name(name = <tagname>)]` attribute) for the request
|
/// Serializes the generic type T to the proper XML tag (set by the `#[element_name(name = <tagname>)]` attribute) for the request
|
||||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
|
@ -79,10 +77,10 @@ impl<T: ElementName + Serialize, E: ElementName + Serialize> Serialize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ElementName, E: ElementName> CommandWithExtension<T, E> {
|
impl<T: ElementName, E: ElementName> Command<T, E> {
|
||||||
/// Creates a new <command> tag for an EPP document with a containing <extension> tag
|
/// Creates a new <command> tag for an EPP document with a containing <extension> tag
|
||||||
pub fn build(command: T, ext: E, client_tr_id: &str) -> CommandWithExtension<T, E> {
|
pub fn build(command: T, ext: E, client_tr_id: &str) -> Command<T, E> {
|
||||||
CommandWithExtension {
|
Command {
|
||||||
command,
|
command,
|
||||||
extension: Some(Extension { data: ext }),
|
extension: Some(Extension { data: ext }),
|
||||||
client_tr_id: client_tr_id.into(),
|
client_tr_id: client_tr_id.into(),
|
||||||
|
|
Loading…
Reference in New Issue