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 FormControllerApiClient<C: hyper::client::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::Connect> FormControllerApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> FormControllerApiClient<C> {
FormControllerApiClient {
configuration,
}
}
}
pub trait FormControllerApi {
fn submit_form(&self, _email_address: Option<&str>, _redirect_to: Option<&str>, _spam_check: Option<&str>, _subject: Option<&str>, _success_message: Option<&str>, _to: Option<&str>, other_parameters: Option<&str>) -> Box<dyn Future<Item = String, Error = Error<serde_json::Value>>>;
}
impl<C: hyper::client::Connect>FormControllerApi for FormControllerApiClient<C> {
fn submit_form(&self, _email_address: Option<&str>, _redirect_to: Option<&str>, _spam_check: Option<&str>, _subject: Option<&str>, _success_message: Option<&str>, _to: Option<&str>, other_parameters: Option<&str>) -> Box<dyn Future<Item = String, Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::Post, "/forms".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(param_value) = _email_address {
req = req.with_form_param("_emailAddress".to_string(), param_value.to_string());
}
if let Some(param_value) = _redirect_to {
req = req.with_form_param("_redirectTo".to_string(), param_value.to_string());
}
if let Some(param_value) = _spam_check {
req = req.with_form_param("_spamCheck".to_string(), param_value.to_string());
}
if let Some(param_value) = _subject {
req = req.with_form_param("_subject".to_string(), param_value.to_string());
}
if let Some(param_value) = _success_message {
req = req.with_form_param("_successMessage".to_string(), param_value.to_string());
}
if let Some(param_value) = _to {
req = req.with_form_param("_to".to_string(), param_value.to_string());
}
if let Some(param_value) = other_parameters {
req = req.with_form_param("otherParameters".to_string(), param_value.to_string());
}
req.execute(self.configuration.borrow())
}
}