/*
 * 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 AttachmentControllerApiClient<C: hyper::client::Connect> {
    configuration: Rc<configuration::Configuration<C>>,
}

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

pub trait AttachmentControllerApi {
    fn upload_attachment(&self, upload_options: crate::models::UploadAttachmentOptions) -> Box<dyn Future<Item = Vec<String>, Error = Error<serde_json::Value>>>;
    fn upload_attachment_bytes(&self, string: Option<&str>, filename: Option<&str>, byte_array: Option<String>) -> Box<dyn Future<Item = Vec<String>, Error = Error<serde_json::Value>>>;
    fn upload_multipart_form(&self, file: std::path::PathBuf, content_type: Option<&str>, filename: Option<&str>, x_filename: Option<&str>) -> Box<dyn Future<Item = Vec<String>, Error = Error<serde_json::Value>>>;
}

impl<C: hyper::client::Connect>AttachmentControllerApi for AttachmentControllerApiClient<C> {
    fn upload_attachment(&self, upload_options: crate::models::UploadAttachmentOptions) -> Box<dyn Future<Item = Vec<String>, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Post, "/attachments".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(upload_options);

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

    fn upload_attachment_bytes(&self, string: Option<&str>, filename: Option<&str>, byte_array: Option<String>) -> Box<dyn Future<Item = Vec<String>, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Post, "/attachments/bytes".to_string())
            .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
                in_header: true,
                in_query: false,
                param_name: "x-api-key".to_owned(),
            }))
        ;
        if let Some(ref s) = string {
            req = req.with_query_param("String".to_string(), s.to_string());
        }
        if let Some(ref s) = filename {
            req = req.with_query_param("filename".to_string(), s.to_string());
        }
        req = req.with_body_param(byte_array);

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

    fn upload_multipart_form(&self, file: std::path::PathBuf, content_type: Option<&str>, filename: Option<&str>, x_filename: Option<&str>) -> Box<dyn Future<Item = Vec<String>, Error = Error<serde_json::Value>>> {
        let mut req = __internal_request::Request::new(hyper::Method::Post, "/attachments/multipart".to_string())
            .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
                in_header: true,
                in_query: false,
                param_name: "x-api-key".to_owned(),
            }))
        ;
        if let Some(ref s) = content_type {
            req = req.with_query_param("contentType".to_string(), s.to_string());
        }
        if let Some(ref s) = filename {
            req = req.with_query_param("filename".to_string(), s.to_string());
        }
        if let Some(ref s) = x_filename {
            req = req.with_query_param("x-filename".to_string(), s.to_string());
        }
        req = req.with_form_param("file".to_string(), unimplemented!());

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

}
