use std::borrow::Borrow;
use std::rc::Rc;
use futures;
use futures::Future;
use hyper;
use super::{configuration, query, Error};
pub struct LicenseApiClient<C: hyper::client::connect::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> LicenseApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> LicenseApiClient<C> {
LicenseApiClient {
configuration: configuration,
}
}
}
pub trait LicenseApi {
fn create_license_license(
&self,
license_license: crate::models::LicenseLicenseCreateParams,
) -> Box<dyn Future<Item = crate::models::Empty, Error = Error>>;
fn get_license_generate(
&self,
action: &str,
licenses_to_include: &str,
licenses_to_exclude: &str,
only_these_licenses: &str,
) -> Box<dyn Future<Item = crate::models::LicenseGenerate, Error = Error>>;
fn get_license_license(
&self,
license_license_id: &str,
) -> Box<dyn Future<Item = crate::models::LicenseLicenses, Error = Error>>;
fn list_license_licenses(
&self,
) -> Box<dyn Future<Item = crate::models::LicenseLicensesExtended, Error = Error>>;
}
impl<C: hyper::client::connect::Connect + 'static> LicenseApi for LicenseApiClient<C> {
fn create_license_license(
&self,
license_license: crate::models::LicenseLicenseCreateParams,
) -> Box<dyn Future<Item = crate::models::Empty, Error = Error>> {
let uri_str = format!(
"{}/platform/5/license/licenses",
self.configuration.base_path
);
query(
self.configuration.borrow(),
&uri_str,
&license_license,
hyper::Method::POST,
)
}
fn get_license_generate(
&self,
action: &str,
licenses_to_include: &str,
licenses_to_exclude: &str,
only_these_licenses: &str,
) -> Box<dyn Future<Item = crate::models::LicenseGenerate, Error = Error>> {
let q = ::url::form_urlencoded::Serializer::new(String::new())
.append_pair("action", &action.to_string())
.append_pair("licenses_to_include", &licenses_to_include.to_string())
.append_pair("licenses_to_exclude", &licenses_to_exclude.to_string())
.append_pair("only_these_licenses", &only_these_licenses.to_string())
.finish();
let uri_str = format!(
"{}/platform/5/license/generate?{}",
self.configuration.base_path, q
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn get_license_license(
&self,
license_license_id: &str,
) -> Box<dyn Future<Item = crate::models::LicenseLicenses, Error = Error>> {
let uri_str = format!(
"{}/platform/5/license/licenses/{LicenseLicenseId}",
self.configuration.base_path,
LicenseLicenseId = license_license_id
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
fn list_license_licenses(
&self,
) -> Box<dyn Future<Item = crate::models::LicenseLicensesExtended, Error = Error>> {
let uri_str = format!(
"{}/platform/5/license/licenses",
self.configuration.base_path
);
query(
self.configuration.borrow(),
&uri_str,
&"",
hyper::Method::GET,
)
}
}