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 PnlApiClient<C: hyper::client::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::Connect> PnlApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> PnlApiClient<C> {
PnlApiClient {
configuration: configuration,
}
}
}
pub trait PnlApi {
fn iserver_account_pnl_partitioned_get(&self, ) -> Box<Future<Item = ::models::InlineResponse20011, Error = Error>>;
}
impl<C: hyper::client::Connect>PnlApi for PnlApiClient<C> {
fn iserver_account_pnl_partitioned_get(&self, ) -> Box<Future<Item = ::models::InlineResponse20011, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Get;
let uri_str = format!("{}/iserver/account/pnl/partitioned", 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::InlineResponse20011, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
}