2021-11-29 22:38:37 +00:00
|
|
|
use std::fmt::Debug;
|
|
|
|
|
|
|
|
use epp_client_macros::ElementName;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
use crate::{
|
2021-11-26 22:21:38 +00:00
|
|
|
common::{ElementName, NoExtension},
|
2021-12-06 15:25:11 +00:00
|
|
|
request::{EppExtension, Transaction},
|
2021-12-02 13:16:03 +00:00
|
|
|
response::ResponseStatus,
|
2021-11-29 22:38:37 +00:00
|
|
|
};
|
|
|
|
|
2021-11-26 22:21:38 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Logout<E> {
|
|
|
|
request: LogoutRequest,
|
|
|
|
extension: Option<E>,
|
|
|
|
}
|
2021-11-29 22:38:37 +00:00
|
|
|
|
2021-12-06 15:25:11 +00:00
|
|
|
impl<E: EppExtension> Transaction<E> for Logout<E> {
|
2021-11-26 22:21:38 +00:00
|
|
|
type Input = LogoutRequest;
|
2021-12-02 13:16:03 +00:00
|
|
|
type Output = ResponseStatus;
|
2021-11-26 22:21:38 +00:00
|
|
|
|
|
|
|
fn into_parts(self) -> (Self::Input, Option<E>) {
|
|
|
|
(self.request, self.extension)
|
2021-11-29 22:38:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-26 22:21:38 +00:00
|
|
|
impl<E: EppExtension> Logout<E> {
|
|
|
|
pub fn new() -> Logout<NoExtension> {
|
|
|
|
Logout {
|
|
|
|
request: LogoutRequest {},
|
|
|
|
extension: None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn with_extension<F: EppExtension>(self, extension: F) -> Logout<F> {
|
|
|
|
Logout {
|
|
|
|
request: self.request,
|
|
|
|
extension: Some(extension),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-11-29 22:38:37 +00:00
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
|
|
|
|
#[element_name(name = "logout")]
|
|
|
|
/// Type corresponding to the <logout> tag in an EPP XML logout request
|
2021-11-26 22:21:38 +00:00
|
|
|
pub struct LogoutRequest;
|