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 ScannerApiClient<C: hyper::client::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::Connect> ScannerApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> ScannerApiClient<C> {
ScannerApiClient {
configuration: configuration,
}
}
}
pub trait ScannerApi {
fn iserver_scanner_params_get(&self, ) -> Box<Future<Item = ::models::InlineResponse2009, Error = Error>>;
fn iserver_scanner_run_post(&self, body: ::models::ScannerParams) -> Box<Future<Item = Vec<::models::InlineResponse20010>, Error = Error>>;
}
impl<C: hyper::client::Connect>ScannerApi for ScannerApiClient<C> {
fn iserver_scanner_params_get(&self, ) -> Box<Future<Item = ::models::InlineResponse2009, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Get;
let uri_str = format!("{}/iserver/scanner/params", 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::InlineResponse2009, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
fn iserver_scanner_run_post(&self, body: ::models::ScannerParams) -> Box<Future<Item = Vec<::models::InlineResponse20010>, Error = Error>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
let uri_str = format!("{}/iserver/scanner/run", 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<Vec<::models::InlineResponse20010>, _> = serde_json::from_slice(&body);
parsed.map_err(|e| Error::from(e))
}).map_err(|e| Error::from(e))
)
}
}