1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * 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 DomainControllerApiClient<C: hyper::client::Connect> {
    configuration: Rc<configuration::Configuration<C>>,
}

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

pub trait DomainControllerApi {
    fn add_domain_wildcard_catch_all(&self, id: &str) -> Box<dyn Future<Item = crate::models::DomainDto, Error = Error<serde_json::Value>>>;
    fn create_domain(&self, domain_options: crate::models::CreateDomainOptions) -> Box<dyn Future<Item = crate::models::DomainDto, Error = Error<serde_json::Value>>>;
    fn delete_domain(&self, id: &str) -> Box<dyn Future<Item = Vec<String>, Error = Error<serde_json::Value>>>;
    fn get_domain(&self, id: &str) -> Box<dyn Future<Item = crate::models::DomainDto, Error = Error<serde_json::Value>>>;
    fn get_domains(&self, ) -> Box<dyn Future<Item = Vec<crate::models::DomainPreview>, Error = Error<serde_json::Value>>>;
    fn update_domain(&self, id: &str, update_domain_dto: crate::models::UpdateDomainOptions) -> Box<dyn Future<Item = crate::models::DomainDto, Error = Error<serde_json::Value>>>;
}

impl<C: hyper::client::Connect>DomainControllerApi for DomainControllerApiClient<C> {
    fn add_domain_wildcard_catch_all(&self, id: &str) -> Box<dyn Future<Item = crate::models::DomainDto, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Post, "/domains/{id}/wildcard".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_path_param("id".to_string(), id.to_string());

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

    fn create_domain(&self, domain_options: crate::models::CreateDomainOptions) -> Box<dyn Future<Item = crate::models::DomainDto, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Post, "/domains".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(domain_options);

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

    fn delete_domain(&self, id: &str) -> Box<dyn Future<Item = Vec<String>, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Delete, "/domains/{id}".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_path_param("id".to_string(), id.to_string());

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

    fn get_domain(&self, id: &str) -> Box<dyn Future<Item = crate::models::DomainDto, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Get, "/domains/{id}".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_path_param("id".to_string(), id.to_string());

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

    fn get_domains(&self, ) -> Box<dyn Future<Item = Vec<crate::models::DomainPreview>, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Get, "/domains".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.execute(self.configuration.borrow())
    }

    fn update_domain(&self, id: &str, update_domain_dto: crate::models::UpdateDomainOptions) -> Box<dyn Future<Item = crate::models::DomainDto, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Put, "/domains/{id}".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_path_param("id".to_string(), id.to_string());
        req = req.with_body_param(update_domain_dto);

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

}