use std::borrow::Borrow;
use std::rc::Rc;
use futures;
use futures::Future;
use hyper;
use super::{configuration, query, Error};
pub struct SyncReportsApiClient<C: hyper::client::connect::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> SyncReportsApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> SyncReportsApiClient<C> {
SyncReportsApiClient {
configuration: configuration,
}
}
}
pub trait SyncReportsApi {
fn get_report_subreport(
&self,
report_subreport_id: &str,
rid: &str,
) -> Box<dyn Future<Item = crate::models::ReportSubreports, Error = Error>>;
fn get_report_subreports(
&self,
rid: &str,
sort: &str,
resume: &str,
newer_than: i32,
state: &str,
limit: i32,
dir: &str,
) -> Box<dyn Future<Item = crate::models::ReportSubreportsExtended, Error = Error>>;
}
impl<C: hyper::client::connect::Connect + 'static> SyncReportsApi for SyncReportsApiClient<C> {
fn get_report_subreport(
&self,
report_subreport_id: &str,
rid: &str,
) -> Box<dyn Future<Item = crate::models::ReportSubreports, Error = Error>> {
let uri_str = format!(
"{}/platform/4/sync/reports/{Rid}/subreports/{ReportSubreportId}",
self.configuration.base_path,
ReportSubreportId = report_subreport_id,
Rid = rid
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_report_subreports(
&self,
rid: &str,
sort: &str,
resume: &str,
newer_than: i32,
state: &str,
limit: i32,
dir: &str,
) -> Box<dyn Future<Item = crate::models::ReportSubreportsExtended, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("sort", &sort.to_string())
.append_pair("resume", &resume.to_string())
.append_pair("newer_than", &newer_than.to_string())
.append_pair("state", &state.to_string())
.append_pair("limit", &limit.to_string())
.append_pair("dir", &dir.to_string())
.finish();
let uri_str = format!(
"{}/platform/4/sync/reports/{Rid}/subreports?{}",
self.configuration.base_path,
q,
Rid = rid
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
}