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 AccountApiClient<C: hyper::client::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::Connect> AccountApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> AccountApiClient<C> {
AccountApiClient {
configuration: configuration,
}
}
}
pub trait AccountApi {
fn iserver_account_post(&self, body: ::models::SetAccount) -> Box<Future<Item = ::models::InlineResponse2001, Error = Error>>;
fn iserver_accounts_get(&self, ) -> Box<Future<Item = ::models::InlineResponse200, Error = Error>>;
fn portfolio_account_id_ledger_get(&self, account_id: &str) -> Box<Future<Item = ::models::InlineResponse20013, Error = Error>>;
fn portfolio_account_id_meta_get(&self, account_id: &str) -> Box<Future<Item = ::models::Accounts, Error = Error>>;
fn portfolio_account_id_summary_get(&self, account_id: &str) -> Box<Future<Item = ::models::InlineResponse20012, Error = Error>>;
fn portfolio_accounts_get(&self, ) -> Box<Future<Item = ::models::Accounts, Error = Error>>;
fn portfolio_subaccounts_get(&self, ) -> Box<Future<Item = ::models::Account, Error = Error>>;
}
impl<C: hyper::client::Connect>AccountApi for AccountApiClient<C> {
fn iserver_account_post(&self, body: ::models::SetAccount) -> Box<Future<Item = ::models::InlineResponse2001, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
let uri_str = format!("{}/iserver/account", configuration.base_path);
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::InlineResponse2001, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn iserver_accounts_get(&self, ) -> Box<Future<Item = ::models::InlineResponse200, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Get;
let uri_str = format!("{}/iserver/accounts", 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::InlineResponse200, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn portfolio_account_id_ledger_get(&self, account_id: &str) -> Box<Future<Item = ::models::InlineResponse20013, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Get;
let uri_str = format!("{}/portfolio/{accountId}/ledger", configuration.base_path, accountId=account_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<::models::InlineResponse20013, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn portfolio_account_id_meta_get(&self, account_id: &str) -> Box<Future<Item = ::models::Accounts, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Get;
let uri_str = format!("{}/portfolio/{accountId}/meta", configuration.base_path, accountId=account_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<::models::Accounts, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn portfolio_account_id_summary_get(&self, account_id: &str) -> Box<Future<Item = ::models::InlineResponse20012, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Get;
let uri_str = format!("{}/portfolio/{accountId}/summary", configuration.base_path, accountId=account_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<::models::InlineResponse20012, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn portfolio_accounts_get(&self, ) -> Box<Future<Item = ::models::Accounts, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Get;
let uri_str = format!("{}/portfolio/accounts", 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::Accounts, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn portfolio_subaccounts_get(&self, ) -> Box<Future<Item = ::models::Account, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Get;
let uri_str = format!("{}/portfolio/subaccounts", 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::Account, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
}