use std::rc::Rc;
use std::borrow::Borrow;
use hyper;
use serde_json;
use futures;
use futures::{Future, Stream};
use super::{Error, configuration};
pub struct OrderApiClient<C: hyper::client::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::Connect> OrderApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> OrderApiClient<C> {
OrderApiClient {
configuration: configuration,
}
}
}
pub trait OrderApi {
fn iserver_account_account_id_order_orig_customer_order_id_delete(&self, account_id: &str, orig_customer_order_id: &str) -> Box<Future<Item = Vec<::models::InlineResponse2006>, Error = Error>>;
fn iserver_account_account_id_order_orig_customer_order_id_post(&self, account_id: &str, orig_customer_order_id: &str, body: ::models::ModifyOrder) -> Box<Future<Item = Vec<::models::InlineResponse2006>, Error = Error>>;
fn iserver_account_account_id_order_post(&self, account_id: &str, body: ::models::OrderRequest) -> Box<Future<Item = Vec<::models::InlineResponse2003>, Error = Error>>;
fn iserver_account_account_id_order_whatif_post(&self, account_id: &str, body: ::models::OrderRequest) -> Box<Future<Item = ::models::InlineResponse2005, Error = Error>>;
fn iserver_account_orders_get(&self, ) -> Box<Future<Item = ::models::InlineResponse2002, Error = Error>>;
fn iserver_reply_replyid_post(&self, replyid: &str, body: ::models::Body) -> Box<Future<Item = Vec<::models::InlineResponse2004>, Error = Error>>;
}
impl<C: hyper::client::Connect>OrderApi for OrderApiClient<C> {
fn iserver_account_account_id_order_orig_customer_order_id_delete(&self, account_id: &str, orig_customer_order_id: &str) -> Box<Future<Item = Vec<::models::InlineResponse2006>, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Delete;
let uri_str = format!("{}/iserver/account/{accountId}/order/{origCustomerOrderId}", configuration.base_path, accountId=account_id, origCustomerOrderId=orig_customer_order_id);
let uri = uri_str.parse();
let mut req = hyper::Request::new(method, uri.unwrap());
Box::new(
configuration.client.request(req).and_then(|res| { res.body().concat2() })
.map_err(|e| Error::from(e))
.and_then(|body| {
let parsed: Result<Vec<::models::InlineResponse2006>, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn iserver_account_account_id_order_orig_customer_order_id_post(&self, account_id: &str, orig_customer_order_id: &str, body: ::models::ModifyOrder) -> Box<Future<Item = Vec<::models::InlineResponse2006>, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
let uri_str = format!("{}/iserver/account/{accountId}/order/{origCustomerOrderId}", configuration.base_path, accountId=account_id, origCustomerOrderId=orig_customer_order_id);
let uri = uri_str.parse();
let mut req = hyper::Request::new(method, uri.unwrap());
let serialized = serde_json::to_string(&body).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);
Box::new(
configuration.client.request(req).and_then(|res| { res.body().concat2() })
.map_err(|e| Error::from(e))
.and_then(|body| {
let parsed: Result<Vec<::models::InlineResponse2006>, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn iserver_account_account_id_order_post(&self, account_id: &str, body: ::models::OrderRequest) -> Box<Future<Item = Vec<::models::InlineResponse2003>, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
let uri_str = format!("{}/iserver/account/{accountId}/order", configuration.base_path, accountId=account_id);
let uri = uri_str.parse();
let mut req = hyper::Request::new(method, uri.unwrap());
let serialized = serde_json::to_string(&body).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);
Box::new(
configuration.client.request(req).and_then(|res| { res.body().concat2() })
.map_err(|e| Error::from(e))
.and_then(|body| {
let parsed: Result<Vec<::models::InlineResponse2003>, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn iserver_account_account_id_order_whatif_post(&self, account_id: &str, body: ::models::OrderRequest) -> Box<Future<Item = ::models::InlineResponse2005, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
let uri_str = format!("{}/iserver/account/{accountId}/order/whatif", configuration.base_path, accountId=account_id);
let uri = uri_str.parse();
let mut req = hyper::Request::new(method, uri.unwrap());
let serialized = serde_json::to_string(&body).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);
Box::new(
configuration.client.request(req).and_then(|res| { res.body().concat2() })
.map_err(|e| Error::from(e))
.and_then(|body| {
let parsed: Result<::models::InlineResponse2005, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn iserver_account_orders_get(&self, ) -> Box<Future<Item = ::models::InlineResponse2002, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Get;
let uri_str = format!("{}/iserver/account/orders", configuration.base_path);
let uri = uri_str.parse();
let mut req = hyper::Request::new(method, uri.unwrap());
Box::new(
configuration.client.request(req).and_then(|res| { res.body().concat2() })
.map_err(|e| Error::from(e))
.and_then(|body| {
let parsed: Result<::models::InlineResponse2002, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn iserver_reply_replyid_post(&self, replyid: &str, body: ::models::Body) -> Box<Future<Item = Vec<::models::InlineResponse2004>, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
let uri_str = format!("{}/iserver/reply/{replyid}", configuration.base_path, replyid=replyid);
let uri = uri_str.parse();
let mut req = hyper::Request::new(method, uri.unwrap());
let serialized = serde_json::to_string(&body).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);
Box::new(
configuration.client.request(req).and_then(|res| { res.body().concat2() })
.map_err(|e| Error::from(e))
.and_then(|body| {
let parsed: Result<Vec<::models::InlineResponse2004>, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
}