#![allow(unused_imports)]
use std::sync::Arc;
use std::borrow::Borrow;
use std::borrow::Cow;
use std::collections::HashMap;
use hyper;
use serde_json;
use serde_json::Value;
use tokio::runtime::Runtime;
use futures;
use futures::{Future, Stream};
use bigdecimal::BigDecimal;
use hyper::Body;
use hyper::body::Bytes;
use hyper::body::HttpBody;
use std::str::FromStr;
use chrono::{Date, NaiveDateTime, DateTime, FixedOffset, Utc, SecondsFormat};
use crate::{OutlinePrint};
use crate::models::*;
use super::{Error, configuration};
use headers::{Authorization, Header};
use headers::authorization::Credentials;
pub struct AppsApiClient<C: hyper::client::connect::Connect + Clone + Send + Sync> {
configuration: Arc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect + Clone + Send + Sync + 'static> AppsApiClient<C> {
pub fn new(configuration: Arc<configuration::Configuration<C>>) -> AppsApiClient<C> {
AppsApiClient {
configuration: configuration,
}
}
}
#[async_trait::async_trait]
pub trait AppsApi {
async fn delete_using_delete(&self, any_state_app_id: i64) -> Result<GenericMapBasedApiResponse, Error<serde_json::Value>>;
async fn get_app_types_using_get(&self, ) -> Result<AppTypesResponse, Error<serde_json::Value>>;
async fn get_using_get1(&self, any_state_app_id: i64) -> Result<AppResponse, Error<serde_json::Value>>;
async fn invite_app_guests_using_post1(&self, body: crate::models::Invitation) -> Result<GenericMapBasedApiResponse, Error<serde_json::Value>>;
async fn list_apps_users_using_get(&self, ) -> Result<AppsResponse, Error<serde_json::Value>>;
async fn list_using_get1(&self, ) -> Result<AppsResponse, Error<serde_json::Value>>;
async fn update_description_using_put1(&self, any_state_app_id: i64, body: crate::models::AppDescription) -> Result<AppResponse, Error<serde_json::Value>>;
async fn update_using_put3(&self, body: crate::models::UpdateAppInfo, any_state_app_id: i64) -> Result<AppResponse, Error<serde_json::Value>>;
}
#[async_trait::async_trait]
impl<C: hyper::client::connect::Connect + Clone + Send + Sync + 'static>AppsApi for AppsApiClient<C> {
async fn delete_using_delete(&self, any_state_app_id: i64) -> Result<GenericMapBasedApiResponse, Error<serde_json::Value>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
let mut auth_query = HashMap::<String, String>::new();
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let val = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
auth_headers.insert("Authorization".to_owned(), val);
};
let method = hyper::Method::DELETE;
let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
let has_query_params = false;
for (key, val) in &auth_query {
query.append_pair(key, val);
}
if has_query_params || auth_query.len()>0 {
format!("/?{}", query.finish())
} else {
"".to_string()
}
};
let uri_str = format!("{}users-web/api/v3/apps/{anyStateAppId}{}", configuration.base_path, query_string, anyStateAppId=any_state_app_id);
let uri: hyper::Uri = uri_str.parse().unwrap();
let mut req =
hyper::Request::builder()
.method(method)
.uri(uri);
let headers = req.headers_mut().unwrap();
if let Some(ref user_agent) = configuration.user_agent {
headers.insert(hyper::header::USER_AGENT, user_agent.parse().unwrap());
}
for (key, val) in auth_headers {
headers.insert(
hyper::header::HeaderName::from_str(key.as_ref()).unwrap(),
val.parse().unwrap(),
);
}
let somebody = Body::empty();
let req = req.body(somebody).unwrap();
let res = configuration
.client.request(req)
.await
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
let mut res = res?;
let status = res.status();
let mut res_body: Vec<u8> = vec![];
while let Some(chunk) = res.body_mut().data().await {
let mut chunk_vec = chunk.unwrap().to_vec();
res_body.append(chunk_vec.as_mut());
}
let res_body =
if status.is_success() {
Ok(res_body)
} else {
Err(Error::from((status, res_body.borrow())))
};
let mut res_body = res_body?;
let res_body =
serde_json::from_slice(res_body.borrow())
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
res_body
}
async fn get_app_types_using_get(&self, ) -> Result<AppTypesResponse, Error<serde_json::Value>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
let mut auth_query = HashMap::<String, String>::new();
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let val = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
auth_headers.insert("Authorization".to_owned(), val);
};
let method = hyper::Method::GET;
let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
let has_query_params = false;
for (key, val) in &auth_query {
query.append_pair(key, val);
}
if has_query_params || auth_query.len()>0 {
format!("/?{}", query.finish())
} else {
"".to_string()
}
};
let uri_str = format!("{}users-web/api/v3/apps/types{}", configuration.base_path, query_string);
let uri: hyper::Uri = uri_str.parse().unwrap();
let mut req =
hyper::Request::builder()
.method(method)
.uri(uri);
let headers = req.headers_mut().unwrap();
if let Some(ref user_agent) = configuration.user_agent {
headers.insert(hyper::header::USER_AGENT, user_agent.parse().unwrap());
}
for (key, val) in auth_headers {
headers.insert(
hyper::header::HeaderName::from_str(key.as_ref()).unwrap(),
val.parse().unwrap(),
);
}
let somebody = Body::empty();
let req = req.body(somebody).unwrap();
let res = configuration
.client.request(req)
.await
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
let mut res = res?;
let status = res.status();
let mut res_body: Vec<u8> = vec![];
while let Some(chunk) = res.body_mut().data().await {
let mut chunk_vec = chunk.unwrap().to_vec();
res_body.append(chunk_vec.as_mut());
}
let res_body =
if status.is_success() {
Ok(res_body)
} else {
Err(Error::from((status, res_body.borrow())))
};
let mut res_body = res_body?;
let res_body =
serde_json::from_slice(res_body.borrow())
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
res_body
}
async fn get_using_get1(&self, any_state_app_id: i64) -> Result<AppResponse, Error<serde_json::Value>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
let mut auth_query = HashMap::<String, String>::new();
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let val = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
auth_headers.insert("Authorization".to_owned(), val);
};
let method = hyper::Method::GET;
let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
let has_query_params = false;
for (key, val) in &auth_query {
query.append_pair(key, val);
}
if has_query_params || auth_query.len()>0 {
format!("/?{}", query.finish())
} else {
"".to_string()
}
};
let uri_str = format!("{}users-web/api/v3/apps/{anyStateAppId}{}", configuration.base_path, query_string, anyStateAppId=any_state_app_id);
let uri: hyper::Uri = uri_str.parse().unwrap();
let mut req =
hyper::Request::builder()
.method(method)
.uri(uri);
let headers = req.headers_mut().unwrap();
if let Some(ref user_agent) = configuration.user_agent {
headers.insert(hyper::header::USER_AGENT, user_agent.parse().unwrap());
}
for (key, val) in auth_headers {
headers.insert(
hyper::header::HeaderName::from_str(key.as_ref()).unwrap(),
val.parse().unwrap(),
);
}
let somebody = Body::empty();
let req = req.body(somebody).unwrap();
let res = configuration
.client.request(req)
.await
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
let mut res = res?;
let status = res.status();
let mut res_body: Vec<u8> = vec![];
while let Some(chunk) = res.body_mut().data().await {
let mut chunk_vec = chunk.unwrap().to_vec();
res_body.append(chunk_vec.as_mut());
}
let res_body =
if status.is_success() {
Ok(res_body)
} else {
Err(Error::from((status, res_body.borrow())))
};
let mut res_body = res_body?;
let res_body =
serde_json::from_slice(res_body.borrow())
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
res_body
}
async fn invite_app_guests_using_post1(&self, body: crate::models::Invitation) -> Result<GenericMapBasedApiResponse, Error<serde_json::Value>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
let mut auth_query = HashMap::<String, String>::new();
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let val = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
auth_headers.insert("Authorization".to_owned(), val);
};
let method = hyper::Method::POST;
let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
let has_query_params = false;
for (key, val) in &auth_query {
query.append_pair(key, val);
}
if has_query_params || auth_query.len()>0 {
format!("/?{}", query.finish())
} else {
"".to_string()
}
};
let uri_str = format!("{}users-web/api/v3/apps/guests{}", configuration.base_path, query_string);
let uri: hyper::Uri = uri_str.parse().unwrap();
let mut req =
hyper::Request::builder()
.method(method)
.uri(uri);
let headers = req.headers_mut().unwrap();
if let Some(ref user_agent) = configuration.user_agent {
headers.insert(hyper::header::USER_AGENT, user_agent.parse().unwrap());
}
for (key, val) in auth_headers {
headers.insert(
hyper::header::HeaderName::from_str(key.as_ref()).unwrap(),
val.parse().unwrap(),
);
}
let somebody = Body::empty();
let serialized = serde_json::to_string(&body).unwrap();
headers.insert(hyper::header::CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(hyper::header::CONTENT_LENGTH, format!("{}", serialized.len()).parse().unwrap());
let somebody = Body::from(serialized);
let req = req.body(somebody).unwrap();
let res = configuration
.client.request(req)
.await
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
let mut res = res?;
let status = res.status();
let mut res_body: Vec<u8> = vec![];
while let Some(chunk) = res.body_mut().data().await {
let mut chunk_vec = chunk.unwrap().to_vec();
res_body.append(chunk_vec.as_mut());
}
let res_body =
if status.is_success() {
Ok(res_body)
} else {
Err(Error::from((status, res_body.borrow())))
};
let mut res_body = res_body?;
let res_body =
serde_json::from_slice(res_body.borrow())
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
res_body
}
async fn list_apps_users_using_get(&self, ) -> Result<AppsResponse, Error<serde_json::Value>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
let mut auth_query = HashMap::<String, String>::new();
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let val = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
auth_headers.insert("Authorization".to_owned(), val);
};
let method = hyper::Method::GET;
let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
let has_query_params = false;
for (key, val) in &auth_query {
query.append_pair(key, val);
}
if has_query_params || auth_query.len()>0 {
format!("/?{}", query.finish())
} else {
"".to_string()
}
};
let uri_str = format!("{}users-web/api/v3/apps/users{}", configuration.base_path, query_string);
let uri: hyper::Uri = uri_str.parse().unwrap();
let mut req =
hyper::Request::builder()
.method(method)
.uri(uri);
let headers = req.headers_mut().unwrap();
if let Some(ref user_agent) = configuration.user_agent {
headers.insert(hyper::header::USER_AGENT, user_agent.parse().unwrap());
}
for (key, val) in auth_headers {
headers.insert(
hyper::header::HeaderName::from_str(key.as_ref()).unwrap(),
val.parse().unwrap(),
);
}
let somebody = Body::empty();
let req = req.body(somebody).unwrap();
let res = configuration
.client.request(req)
.await
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
let mut res = res?;
let status = res.status();
let mut res_body: Vec<u8> = vec![];
while let Some(chunk) = res.body_mut().data().await {
let mut chunk_vec = chunk.unwrap().to_vec();
res_body.append(chunk_vec.as_mut());
}
let res_body =
if status.is_success() {
Ok(res_body)
} else {
Err(Error::from((status, res_body.borrow())))
};
let mut res_body = res_body?;
let res_body =
serde_json::from_slice(res_body.borrow())
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
res_body
}
async fn list_using_get1(&self, ) -> Result<AppsResponse, Error<serde_json::Value>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
let mut auth_query = HashMap::<String, String>::new();
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let val = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
auth_headers.insert("Authorization".to_owned(), val);
};
let method = hyper::Method::GET;
let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
let has_query_params = false;
for (key, val) in &auth_query {
query.append_pair(key, val);
}
if has_query_params || auth_query.len()>0 {
format!("/?{}", query.finish())
} else {
"".to_string()
}
};
let uri_str = format!("{}users-web/api/v3/apps{}", configuration.base_path, query_string);
let uri: hyper::Uri = uri_str.parse().unwrap();
let mut req =
hyper::Request::builder()
.method(method)
.uri(uri);
let headers = req.headers_mut().unwrap();
if let Some(ref user_agent) = configuration.user_agent {
headers.insert(hyper::header::USER_AGENT, user_agent.parse().unwrap());
}
for (key, val) in auth_headers {
headers.insert(
hyper::header::HeaderName::from_str(key.as_ref()).unwrap(),
val.parse().unwrap(),
);
}
let somebody = Body::empty();
let req = req.body(somebody).unwrap();
let res = configuration
.client.request(req)
.await
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
let mut res = res?;
let status = res.status();
let mut res_body: Vec<u8> = vec![];
while let Some(chunk) = res.body_mut().data().await {
let mut chunk_vec = chunk.unwrap().to_vec();
res_body.append(chunk_vec.as_mut());
}
let res_body =
if status.is_success() {
Ok(res_body)
} else {
Err(Error::from((status, res_body.borrow())))
};
let mut res_body = res_body?;
let res_body =
serde_json::from_slice(res_body.borrow())
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
res_body
}
async fn update_description_using_put1(&self, any_state_app_id: i64, body: crate::models::AppDescription) -> Result<AppResponse, Error<serde_json::Value>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
let mut auth_query = HashMap::<String, String>::new();
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let val = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
auth_headers.insert("Authorization".to_owned(), val);
};
let method = hyper::Method::PUT;
let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
let has_query_params = false;
for (key, val) in &auth_query {
query.append_pair(key, val);
}
if has_query_params || auth_query.len()>0 {
format!("/?{}", query.finish())
} else {
"".to_string()
}
};
let uri_str = format!("{}users-web/api/v3/apps/{anyStateAppId}/description{}", configuration.base_path, query_string, anyStateAppId=any_state_app_id);
let uri: hyper::Uri = uri_str.parse().unwrap();
let mut req =
hyper::Request::builder()
.method(method)
.uri(uri);
let headers = req.headers_mut().unwrap();
if let Some(ref user_agent) = configuration.user_agent {
headers.insert(hyper::header::USER_AGENT, user_agent.parse().unwrap());
}
for (key, val) in auth_headers {
headers.insert(
hyper::header::HeaderName::from_str(key.as_ref()).unwrap(),
val.parse().unwrap(),
);
}
let somebody = Body::empty();
let serialized = serde_json::to_string(&body).unwrap();
headers.insert(hyper::header::CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(hyper::header::CONTENT_LENGTH, format!("{}", serialized.len()).parse().unwrap());
let somebody = Body::from(serialized);
let req = req.body(somebody).unwrap();
let res = configuration
.client.request(req)
.await
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
let mut res = res?;
let status = res.status();
let mut res_body: Vec<u8> = vec![];
while let Some(chunk) = res.body_mut().data().await {
let mut chunk_vec = chunk.unwrap().to_vec();
res_body.append(chunk_vec.as_mut());
}
let res_body =
if status.is_success() {
Ok(res_body)
} else {
Err(Error::from((status, res_body.borrow())))
};
let mut res_body = res_body?;
let res_body =
serde_json::from_slice(res_body.borrow())
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
res_body
}
async fn update_using_put3(&self, body: crate::models::UpdateAppInfo, any_state_app_id: i64) -> Result<AppResponse, Error<serde_json::Value>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
let mut auth_query = HashMap::<String, String>::new();
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
let val = match apikey.prefix {
Some(ref prefix) => format!("{} {}", prefix, key),
None => key,
};
auth_headers.insert("Authorization".to_owned(), val);
};
let method = hyper::Method::PUT;
let query_string = {
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
let has_query_params = false;
for (key, val) in &auth_query {
query.append_pair(key, val);
}
if has_query_params || auth_query.len()>0 {
format!("/?{}", query.finish())
} else {
"".to_string()
}
};
let uri_str = format!("{}users-web/api/v3/apps/{anyStateAppId}{}", configuration.base_path, query_string, anyStateAppId=any_state_app_id);
let uri: hyper::Uri = uri_str.parse().unwrap();
let mut req =
hyper::Request::builder()
.method(method)
.uri(uri);
let headers = req.headers_mut().unwrap();
if let Some(ref user_agent) = configuration.user_agent {
headers.insert(hyper::header::USER_AGENT, user_agent.parse().unwrap());
}
for (key, val) in auth_headers {
headers.insert(
hyper::header::HeaderName::from_str(key.as_ref()).unwrap(),
val.parse().unwrap(),
);
}
let somebody = Body::empty();
let serialized = serde_json::to_string(&body).unwrap();
headers.insert(hyper::header::CONTENT_TYPE, "application/json".parse().unwrap());
headers.insert(hyper::header::CONTENT_LENGTH, format!("{}", serialized.len()).parse().unwrap());
let somebody = Body::from(serialized);
let req = req.body(somebody).unwrap();
let res = configuration
.client.request(req)
.await
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
let mut res = res?;
let status = res.status();
let mut res_body: Vec<u8> = vec![];
while let Some(chunk) = res.body_mut().data().await {
let mut chunk_vec = chunk.unwrap().to_vec();
res_body.append(chunk_vec.as_mut());
}
let res_body =
if status.is_success() {
Ok(res_body)
} else {
Err(Error::from((status, res_body.borrow())))
};
let mut res_body = res_body?;
let res_body =
serde_json::from_slice(res_body.borrow())
.map_err(|e| -> Error<serde_json::Value> { Error::from(e) });
res_body
}
}