#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
use async_trait::async_trait;
use futures::Stream;
use std::error::Error;
use std::task::{Poll, Context};
use swagger::{ApiError, ContextWrapper};
use serde::{Serialize, Deserialize};
type ServiceError = Box<dyn Error + Send + Sync + 'static>;
pub const BASE_PATH: &'static str = "";
pub const API_VERSION: &'static str = "0.11.0";
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum AddDeaneryResponse {
SuccessfulOperation
(models::DeaneryMutation)
,
InvalidInput
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum DeleteDeaneryResponse {
SuccessfulOperation
,
InvalidIDSupplied
,
DeaneryNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetDeaneriesResponse {
SuccessfulOperation
(models::DeaneryCollection)
,
InvalidIDSupplied
,
DeaneryNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetDeaneryByIdResponse {
SuccessfulOperation
(models::DeaneryView)
,
InvalidIDSupplied
,
DeaneryNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum UpdateDeaneryResponse {
SuccessfulOperation
(models::DeaneryMutation)
,
InvalidIDSupplied
,
DeaneryNotFound
,
ValidationException
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum AddDioceseResponse {
SuccessfulOperation
(models::DioceseMutation)
,
InvalidInput
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum DeleteDioceseResponse {
SuccessfulOperation
,
InvalidIDSupplied
,
DioceseNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetDioceseByIdResponse {
SuccessfulOperation
(models::DioceseView)
,
InvalidIDSupplied
,
DioceseNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetDiocesesResponse {
SuccessfulOperation
(models::DioceseCollection)
,
InvalidIDSupplied
,
DioceseNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum UpdateDioceseResponse {
SuccessfulOperation
(models::DioceseMutation)
,
InvalidIDSupplied
,
DioceseNotFound
,
ValidationException
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum AddInstituteResponse {
SuccessfulOperation
(models::InstituteMutation)
,
InvalidInput
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum DeleteInstituteResponse {
SuccessfulOperation
,
InvalidIDSupplied
,
InstituteNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetInstituteByIdResponse {
SuccessfulOperation
(models::InstituteView)
,
InvalidIDSupplied
,
InstituteNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetInstitutesResponse {
SuccessfulOperation
(models::InstituteCollection)
,
InvalidIDSupplied
,
InstituteNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum UpdateInstituteResponse {
SuccessfulOperation
(models::InstituteMutation)
,
InvalidIDSupplied
,
InstituteNotFound
,
ValidationException
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum AddParishResponse {
SuccessfulOperation
(models::ParishMutation)
,
InvalidInput
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum DeleteParishResponse {
SuccessfulOperation
,
InvalidIDSupplied
,
ParishNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetParishByIdResponse {
SuccessfulOperation
(models::ParishView)
,
InvalidIDSupplied
,
ParishNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetParishesResponse {
SuccessfulOperation
(models::ParishCollection)
,
InvalidIDSupplied
,
ParishNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum UpdateParishResponse {
SuccessfulOperation
(models::ParishMutation)
,
InvalidIDSupplied
,
ParishNotFound
,
ValidationException
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum AddProvinceResponse {
SuccessfulOperation
(models::ProvinceMutation)
,
InvalidInput
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum DeleteProvinceResponse {
SuccessfulOperation
,
InvalidIDSupplied
,
ProvinceNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetProvinceByIdResponse {
SuccessfulOperation
(models::ProvinceView)
,
InvalidIDSupplied
,
ProvinceNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum GetProvincesResponse {
SuccessfulOperation
(models::ProvinceCollection)
,
InvalidIDSupplied
,
ProvinceNotFound
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[must_use]
pub enum UpdateProvinceResponse {
SuccessfulOperation
(models::ProvinceMutation)
,
InvalidIDSupplied
,
ProvinceNotFound
,
ValidationException
}
#[async_trait]
pub trait Api<C: Send + Sync> {
fn poll_ready(&self, _cx: &mut Context) -> Poll<Result<(), Box<dyn Error + Send + Sync + 'static>>> {
Poll::Ready(Ok(()))
}
async fn add_deanery(
&self,
deanery_mutation: models::DeaneryMutation,
context: &C) -> Result<AddDeaneryResponse, ApiError>;
async fn delete_deanery(
&self,
id: uuid::Uuid,
context: &C) -> Result<DeleteDeaneryResponse, ApiError>;
async fn get_deaneries(
&self,
diocese_id: Option<uuid::Uuid>,
name: Option<String>,
offset: Option<i32>,
count: Option<i32>,
context: &C) -> Result<GetDeaneriesResponse, ApiError>;
async fn get_deanery_by_id(
&self,
id: uuid::Uuid,
context: &C) -> Result<GetDeaneryByIdResponse, ApiError>;
async fn update_deanery(
&self,
id: uuid::Uuid,
deanery_mutation: models::DeaneryMutation,
context: &C) -> Result<UpdateDeaneryResponse, ApiError>;
async fn add_diocese(
&self,
diocese_mutation: models::DioceseMutation,
context: &C) -> Result<AddDioceseResponse, ApiError>;
async fn delete_diocese(
&self,
id: uuid::Uuid,
context: &C) -> Result<DeleteDioceseResponse, ApiError>;
async fn get_diocese_by_id(
&self,
id: uuid::Uuid,
context: &C) -> Result<GetDioceseByIdResponse, ApiError>;
async fn get_dioceses(
&self,
province_id: Option<uuid::Uuid>,
province_code: Option<models::Code>,
province_name: Option<String>,
name: Option<String>,
location_name: Option<String>,
location_address: Option<String>,
location_email: Option<String>,
person_in_charge: Option<String>,
sorts: Option<&Vec<models::DioceseSortCriteria>>,
offset: Option<i32>,
count: Option<i32>,
context: &C) -> Result<GetDiocesesResponse, ApiError>;
async fn update_diocese(
&self,
id: uuid::Uuid,
diocese_mutation: models::DioceseMutation,
context: &C) -> Result<UpdateDioceseResponse, ApiError>;
async fn add_institute(
&self,
institute_mutation: models::InstituteMutation,
context: &C) -> Result<AddInstituteResponse, ApiError>;
async fn delete_institute(
&self,
id: uuid::Uuid,
context: &C) -> Result<DeleteInstituteResponse, ApiError>;
async fn get_institute_by_id(
&self,
id: uuid::Uuid,
context: &C) -> Result<GetInstituteByIdResponse, ApiError>;
async fn get_institutes(
&self,
name: Option<String>,
location_name: Option<String>,
location_address: Option<String>,
location_email: Option<String>,
person_in_charge: Option<String>,
sorts: Option<&Vec<models::InstituteSortCriteria>>,
offset: Option<i32>,
count: Option<i32>,
context: &C) -> Result<GetInstitutesResponse, ApiError>;
async fn update_institute(
&self,
id: uuid::Uuid,
institute_mutation: models::InstituteMutation,
context: &C) -> Result<UpdateInstituteResponse, ApiError>;
async fn add_parish(
&self,
parish_mutation: Option<models::ParishMutation>,
context: &C) -> Result<AddParishResponse, ApiError>;
async fn delete_parish(
&self,
id: uuid::Uuid,
context: &C) -> Result<DeleteParishResponse, ApiError>;
async fn get_parish_by_id(
&self,
id: uuid::Uuid,
context: &C) -> Result<GetParishByIdResponse, ApiError>;
async fn get_parishes(
&self,
deanery_id: Option<uuid::Uuid>,
diocese_id: Option<uuid::Uuid>,
name: Option<String>,
offset: Option<i32>,
count: Option<i32>,
context: &C) -> Result<GetParishesResponse, ApiError>;
async fn update_parish(
&self,
id: uuid::Uuid,
parish_mutation: Option<models::ParishMutation>,
context: &C) -> Result<UpdateParishResponse, ApiError>;
async fn add_province(
&self,
province_mutation: Option<models::ProvinceMutation>,
context: &C) -> Result<AddProvinceResponse, ApiError>;
async fn delete_province(
&self,
id: uuid::Uuid,
context: &C) -> Result<DeleteProvinceResponse, ApiError>;
async fn get_province_by_id(
&self,
id: uuid::Uuid,
context: &C) -> Result<GetProvinceByIdResponse, ApiError>;
async fn get_provinces(
&self,
name: Option<String>,
province_code: Option<models::Code>,
offset: Option<i32>,
count: Option<i32>,
context: &C) -> Result<GetProvincesResponse, ApiError>;
async fn update_province(
&self,
id: uuid::Uuid,
province_mutation: Option<models::ProvinceMutation>,
context: &C) -> Result<UpdateProvinceResponse, ApiError>;
}
#[async_trait]
pub trait ApiNoContext<C: Send + Sync> {
fn poll_ready(&self, _cx: &mut Context) -> Poll<Result<(), Box<dyn Error + Send + Sync + 'static>>>;
fn context(&self) -> &C;
async fn add_deanery(
&self,
deanery_mutation: models::DeaneryMutation,
) -> Result<AddDeaneryResponse, ApiError>;
async fn delete_deanery(
&self,
id: uuid::Uuid,
) -> Result<DeleteDeaneryResponse, ApiError>;
async fn get_deaneries(
&self,
diocese_id: Option<uuid::Uuid>,
name: Option<String>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetDeaneriesResponse, ApiError>;
async fn get_deanery_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetDeaneryByIdResponse, ApiError>;
async fn update_deanery(
&self,
id: uuid::Uuid,
deanery_mutation: models::DeaneryMutation,
) -> Result<UpdateDeaneryResponse, ApiError>;
async fn add_diocese(
&self,
diocese_mutation: models::DioceseMutation,
) -> Result<AddDioceseResponse, ApiError>;
async fn delete_diocese(
&self,
id: uuid::Uuid,
) -> Result<DeleteDioceseResponse, ApiError>;
async fn get_diocese_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetDioceseByIdResponse, ApiError>;
async fn get_dioceses(
&self,
province_id: Option<uuid::Uuid>,
province_code: Option<models::Code>,
province_name: Option<String>,
name: Option<String>,
location_name: Option<String>,
location_address: Option<String>,
location_email: Option<String>,
person_in_charge: Option<String>,
sorts: Option<&Vec<models::DioceseSortCriteria>>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetDiocesesResponse, ApiError>;
async fn update_diocese(
&self,
id: uuid::Uuid,
diocese_mutation: models::DioceseMutation,
) -> Result<UpdateDioceseResponse, ApiError>;
async fn add_institute(
&self,
institute_mutation: models::InstituteMutation,
) -> Result<AddInstituteResponse, ApiError>;
async fn delete_institute(
&self,
id: uuid::Uuid,
) -> Result<DeleteInstituteResponse, ApiError>;
async fn get_institute_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetInstituteByIdResponse, ApiError>;
async fn get_institutes(
&self,
name: Option<String>,
location_name: Option<String>,
location_address: Option<String>,
location_email: Option<String>,
person_in_charge: Option<String>,
sorts: Option<&Vec<models::InstituteSortCriteria>>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetInstitutesResponse, ApiError>;
async fn update_institute(
&self,
id: uuid::Uuid,
institute_mutation: models::InstituteMutation,
) -> Result<UpdateInstituteResponse, ApiError>;
async fn add_parish(
&self,
parish_mutation: Option<models::ParishMutation>,
) -> Result<AddParishResponse, ApiError>;
async fn delete_parish(
&self,
id: uuid::Uuid,
) -> Result<DeleteParishResponse, ApiError>;
async fn get_parish_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetParishByIdResponse, ApiError>;
async fn get_parishes(
&self,
deanery_id: Option<uuid::Uuid>,
diocese_id: Option<uuid::Uuid>,
name: Option<String>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetParishesResponse, ApiError>;
async fn update_parish(
&self,
id: uuid::Uuid,
parish_mutation: Option<models::ParishMutation>,
) -> Result<UpdateParishResponse, ApiError>;
async fn add_province(
&self,
province_mutation: Option<models::ProvinceMutation>,
) -> Result<AddProvinceResponse, ApiError>;
async fn delete_province(
&self,
id: uuid::Uuid,
) -> Result<DeleteProvinceResponse, ApiError>;
async fn get_province_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetProvinceByIdResponse, ApiError>;
async fn get_provinces(
&self,
name: Option<String>,
province_code: Option<models::Code>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetProvincesResponse, ApiError>;
async fn update_province(
&self,
id: uuid::Uuid,
province_mutation: Option<models::ProvinceMutation>,
) -> Result<UpdateProvinceResponse, ApiError>;
}
pub trait ContextWrapperExt<C: Send + Sync> where Self: Sized
{
fn with_context(self: Self, context: C) -> ContextWrapper<Self, C>;
}
impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ContextWrapperExt<C> for T {
fn with_context(self: T, context: C) -> ContextWrapper<T, C> {
ContextWrapper::<T, C>::new(self, context)
}
}
#[async_trait]
impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ApiNoContext<C> for ContextWrapper<T, C> {
fn poll_ready(&self, cx: &mut Context) -> Poll<Result<(), ServiceError>> {
self.api().poll_ready(cx)
}
fn context(&self) -> &C {
ContextWrapper::context(self)
}
async fn add_deanery(
&self,
deanery_mutation: models::DeaneryMutation,
) -> Result<AddDeaneryResponse, ApiError>
{
let context = self.context().clone();
self.api().add_deanery(deanery_mutation, &context).await
}
async fn delete_deanery(
&self,
id: uuid::Uuid,
) -> Result<DeleteDeaneryResponse, ApiError>
{
let context = self.context().clone();
self.api().delete_deanery(id, &context).await
}
async fn get_deaneries(
&self,
diocese_id: Option<uuid::Uuid>,
name: Option<String>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetDeaneriesResponse, ApiError>
{
let context = self.context().clone();
self.api().get_deaneries(diocese_id, name, offset, count, &context).await
}
async fn get_deanery_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetDeaneryByIdResponse, ApiError>
{
let context = self.context().clone();
self.api().get_deanery_by_id(id, &context).await
}
async fn update_deanery(
&self,
id: uuid::Uuid,
deanery_mutation: models::DeaneryMutation,
) -> Result<UpdateDeaneryResponse, ApiError>
{
let context = self.context().clone();
self.api().update_deanery(id, deanery_mutation, &context).await
}
async fn add_diocese(
&self,
diocese_mutation: models::DioceseMutation,
) -> Result<AddDioceseResponse, ApiError>
{
let context = self.context().clone();
self.api().add_diocese(diocese_mutation, &context).await
}
async fn delete_diocese(
&self,
id: uuid::Uuid,
) -> Result<DeleteDioceseResponse, ApiError>
{
let context = self.context().clone();
self.api().delete_diocese(id, &context).await
}
async fn get_diocese_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetDioceseByIdResponse, ApiError>
{
let context = self.context().clone();
self.api().get_diocese_by_id(id, &context).await
}
async fn get_dioceses(
&self,
province_id: Option<uuid::Uuid>,
province_code: Option<models::Code>,
province_name: Option<String>,
name: Option<String>,
location_name: Option<String>,
location_address: Option<String>,
location_email: Option<String>,
person_in_charge: Option<String>,
sorts: Option<&Vec<models::DioceseSortCriteria>>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetDiocesesResponse, ApiError>
{
let context = self.context().clone();
self.api().get_dioceses(province_id, province_code, province_name, name, location_name, location_address, location_email, person_in_charge, sorts, offset, count, &context).await
}
async fn update_diocese(
&self,
id: uuid::Uuid,
diocese_mutation: models::DioceseMutation,
) -> Result<UpdateDioceseResponse, ApiError>
{
let context = self.context().clone();
self.api().update_diocese(id, diocese_mutation, &context).await
}
async fn add_institute(
&self,
institute_mutation: models::InstituteMutation,
) -> Result<AddInstituteResponse, ApiError>
{
let context = self.context().clone();
self.api().add_institute(institute_mutation, &context).await
}
async fn delete_institute(
&self,
id: uuid::Uuid,
) -> Result<DeleteInstituteResponse, ApiError>
{
let context = self.context().clone();
self.api().delete_institute(id, &context).await
}
async fn get_institute_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetInstituteByIdResponse, ApiError>
{
let context = self.context().clone();
self.api().get_institute_by_id(id, &context).await
}
async fn get_institutes(
&self,
name: Option<String>,
location_name: Option<String>,
location_address: Option<String>,
location_email: Option<String>,
person_in_charge: Option<String>,
sorts: Option<&Vec<models::InstituteSortCriteria>>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetInstitutesResponse, ApiError>
{
let context = self.context().clone();
self.api().get_institutes(name, location_name, location_address, location_email, person_in_charge, sorts, offset, count, &context).await
}
async fn update_institute(
&self,
id: uuid::Uuid,
institute_mutation: models::InstituteMutation,
) -> Result<UpdateInstituteResponse, ApiError>
{
let context = self.context().clone();
self.api().update_institute(id, institute_mutation, &context).await
}
async fn add_parish(
&self,
parish_mutation: Option<models::ParishMutation>,
) -> Result<AddParishResponse, ApiError>
{
let context = self.context().clone();
self.api().add_parish(parish_mutation, &context).await
}
async fn delete_parish(
&self,
id: uuid::Uuid,
) -> Result<DeleteParishResponse, ApiError>
{
let context = self.context().clone();
self.api().delete_parish(id, &context).await
}
async fn get_parish_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetParishByIdResponse, ApiError>
{
let context = self.context().clone();
self.api().get_parish_by_id(id, &context).await
}
async fn get_parishes(
&self,
deanery_id: Option<uuid::Uuid>,
diocese_id: Option<uuid::Uuid>,
name: Option<String>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetParishesResponse, ApiError>
{
let context = self.context().clone();
self.api().get_parishes(deanery_id, diocese_id, name, offset, count, &context).await
}
async fn update_parish(
&self,
id: uuid::Uuid,
parish_mutation: Option<models::ParishMutation>,
) -> Result<UpdateParishResponse, ApiError>
{
let context = self.context().clone();
self.api().update_parish(id, parish_mutation, &context).await
}
async fn add_province(
&self,
province_mutation: Option<models::ProvinceMutation>,
) -> Result<AddProvinceResponse, ApiError>
{
let context = self.context().clone();
self.api().add_province(province_mutation, &context).await
}
async fn delete_province(
&self,
id: uuid::Uuid,
) -> Result<DeleteProvinceResponse, ApiError>
{
let context = self.context().clone();
self.api().delete_province(id, &context).await
}
async fn get_province_by_id(
&self,
id: uuid::Uuid,
) -> Result<GetProvinceByIdResponse, ApiError>
{
let context = self.context().clone();
self.api().get_province_by_id(id, &context).await
}
async fn get_provinces(
&self,
name: Option<String>,
province_code: Option<models::Code>,
offset: Option<i32>,
count: Option<i32>,
) -> Result<GetProvincesResponse, ApiError>
{
let context = self.context().clone();
self.api().get_provinces(name, province_code, offset, count, &context).await
}
async fn update_province(
&self,
id: uuid::Uuid,
province_mutation: Option<models::ProvinceMutation>,
) -> Result<UpdateProvinceResponse, ApiError>
{
let context = self.context().clone();
self.api().update_province(id, province_mutation, &context).await
}
}
#[cfg(feature = "client")]
pub mod client;
#[cfg(feature = "client")]
pub use client::Client;
#[cfg(feature = "server")]
pub mod server;
#[cfg(feature = "server")]
pub use self::server::Service;
#[cfg(feature = "server")]
pub mod context;
pub mod models;
#[cfg(any(feature = "client", feature = "server"))]
pub(crate) mod header;