use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use serde_json;
use futures::Future;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct ContactControllerApiClient<C: hyper::client::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::Connect> ContactControllerApiClient<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> ContactControllerApiClient<C> {
ContactControllerApiClient {
configuration,
}
}
}
pub trait ContactControllerApi {
fn create_contact(&self, create_contact_options: crate::models::CreateContactOptions) -> Box<dyn Future<Item = crate::models::ContactDto, Error = Error<serde_json::Value>>>;
fn delete_contact(&self, contact_id: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
fn get_all_contacts(&self, page: Option<i32>, size: Option<i32>, sort: Option<&str>) -> Box<dyn Future<Item = crate::models::PageContactProjection, Error = Error<serde_json::Value>>>;
fn get_contact(&self, contact_id: &str) -> Box<dyn Future<Item = crate::models::ContactDto, Error = Error<serde_json::Value>>>;
fn get_contacts(&self, ) -> Box<dyn Future<Item = Vec<crate::models::ContactProjection>, Error = Error<serde_json::Value>>>;
}
impl<C: hyper::client::Connect>ContactControllerApi for ContactControllerApiClient<C> {
fn create_contact(&self, create_contact_options: crate::models::CreateContactOptions) -> Box<dyn Future<Item = crate::models::ContactDto, Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::Post, "/contacts".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "x-api-key".to_owned(),
}))
;
req = req.with_body_param(create_contact_options);
req.execute(self.configuration.borrow())
}
fn delete_contact(&self, contact_id: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::Delete, "/contacts/{contactId}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "x-api-key".to_owned(),
}))
;
req = req.with_path_param("contactId".to_string(), contact_id.to_string());
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn get_all_contacts(&self, page: Option<i32>, size: Option<i32>, sort: Option<&str>) -> Box<dyn Future<Item = crate::models::PageContactProjection, Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::Get, "/contacts/paginated".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "x-api-key".to_owned(),
}))
;
if let Some(ref s) = page {
req = req.with_query_param("page".to_string(), s.to_string());
}
if let Some(ref s) = size {
req = req.with_query_param("size".to_string(), s.to_string());
}
if let Some(ref s) = sort {
req = req.with_query_param("sort".to_string(), s.to_string());
}
req.execute(self.configuration.borrow())
}
fn get_contact(&self, contact_id: &str) -> Box<dyn Future<Item = crate::models::ContactDto, Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::Get, "/contacts/{contactId}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "x-api-key".to_owned(),
}))
;
req = req.with_path_param("contactId".to_string(), contact_id.to_string());
req.execute(self.configuration.borrow())
}
fn get_contacts(&self, ) -> Box<dyn Future<Item = Vec<crate::models::ContactProjection>, Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::Get, "/contacts".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "x-api-key".to_owned(),
}))
;
req.execute(self.configuration.borrow())
}
}