/*
 * MailSlurp API
 *
 * MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more.   ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository 
 *
 * The version of the OpenAPI document: 6.5.2
 * 
 * Generated by: https://openapi-generator.tech
 */

use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;

use hyper;
use serde_json;
use futures::Future;

use super::{Error, configuration};
use super::request as __internal_request;

pub struct MailServerControllerApiClient<C: hyper::client::Connect> {
    configuration: Rc<configuration::Configuration<C>>,
}

impl<C: hyper::client::Connect> MailServerControllerApiClient<C> {
    pub fn new(configuration: Rc<configuration::Configuration<C>>) -> MailServerControllerApiClient<C> {
        MailServerControllerApiClient {
            configuration,
        }
    }
}

pub trait MailServerControllerApi {
    fn describe_mail_server_domain(&self, describe_options: crate::models::DescribeDomainOptions) -> Box<dyn Future<Item = crate::models::DescribeMailServerDomainResult, Error = Error<serde_json::Value>>>;
    fn get_dns_lookup(&self, dns_lookup_options: crate::models::DnsLookupOptions) -> Box<dyn Future<Item = crate::models::DnsLookupResults, Error = Error<serde_json::Value>>>;
    fn get_ip_address(&self, name: &str) -> Box<dyn Future<Item = crate::models::IpAddressResult, Error = Error<serde_json::Value>>>;
    fn verify_email_address(&self, verify_options: crate::models::VerifyEmailAddressOptions) -> Box<dyn Future<Item = crate::models::EmailVerificationResult, Error = Error<serde_json::Value>>>;
}

impl<C: hyper::client::Connect>MailServerControllerApi for MailServerControllerApiClient<C> {
    fn describe_mail_server_domain(&self, describe_options: crate::models::DescribeDomainOptions) -> Box<dyn Future<Item = crate::models::DescribeMailServerDomainResult, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Post, "/mail-server/describe/domain".to_string())
            .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
                in_header: true,
                in_query: false,
                param_name: "x-api-key".to_owned(),
            }))
        ;
        req = req.with_body_param(describe_options);

        req.execute(self.configuration.borrow())
    }

    fn get_dns_lookup(&self, dns_lookup_options: crate::models::DnsLookupOptions) -> Box<dyn Future<Item = crate::models::DnsLookupResults, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Post, "/mail-server/describe/dns-lookup".to_string())
            .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
                in_header: true,
                in_query: false,
                param_name: "x-api-key".to_owned(),
            }))
        ;
        req = req.with_body_param(dns_lookup_options);

        req.execute(self.configuration.borrow())
    }

    fn get_ip_address(&self, name: &str) -> Box<dyn Future<Item = crate::models::IpAddressResult, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Post, "/mail-server/describe/ip-address".to_string())
            .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
                in_header: true,
                in_query: false,
                param_name: "x-api-key".to_owned(),
            }))
        ;
        req = req.with_query_param("name".to_string(), name.to_string());

        req.execute(self.configuration.borrow())
    }

    fn verify_email_address(&self, verify_options: crate::models::VerifyEmailAddressOptions) -> Box<dyn Future<Item = crate::models::EmailVerificationResult, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Post, "/mail-server/verify/email-address".to_string())
            .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
                in_header: true,
                in_query: false,
                param_name: "x-api-key".to_owned(),
            }))
        ;
        req = req.with_body_param(verify_options);

        req.execute(self.configuration.borrow())
    }

}
