use crate::runtime::{
push_query_param, ApiClient, ApiError, HttpMethod, QueryParam, ResponseEnvelope,
};
use serde::de::DeserializeOwned;
use serde_json::Value;
pub struct IPurchasesIssueController;
pub mod add_new {
use super::*;
#[async_trait::async_trait]
pub trait Overload {
type Output: DeserializeOwned;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError>;
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError>;
}
pub struct ByIssue<'a> {
pub issue: bool,
pub document: &'a crate::web_api::interface::purchases::view_models::PurchaseDocumentIssue,
}
#[async_trait::async_trait]
impl<'a> Overload for ByIssue<'a> {
type Output = crate::web_api::interface::purchases::view_models::PurchaseDocument;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "issue", &self.issue)?;
api.request_with_body::<crate::web_api::interface::purchases::view_models::PurchaseDocument, _>(HttpMethod::Post, "/api/PurchasesIssue/New", query, self.document).await
}
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "issue", &self.issue)?;
api.request_with_body_raw(
HttpMethod::Post,
"/api/PurchasesIssue/New",
query,
self.document,
)
.await
}
}
pub struct ByIssueNewCorrection<'a> {
pub issue: bool,
pub correction:
&'a crate::web_api::interface::purchases::view_models::PurchaseCorrectionIssue,
}
#[async_trait::async_trait]
impl<'a> Overload for ByIssueNewCorrection<'a> {
type Output = crate::web_api::interface::purchases::view_models::PurchaseCorrection;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "issue", &self.issue)?;
api.request_with_body::<crate::web_api::interface::purchases::view_models::PurchaseCorrection, _>(HttpMethod::Post, "/api/PurchasesIssue/NewCorrection", query, self.correction).await
}
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "issue", &self.issue)?;
api.request_with_body_raw(
HttpMethod::Post,
"/api/PurchasesIssue/NewCorrection",
query,
self.correction,
)
.await
}
}
}
pub mod issue {
use super::*;
#[async_trait::async_trait]
pub trait Overload {
type Output: DeserializeOwned;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError>;
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError>;
}
pub struct ById {
pub id: i32,
}
#[async_trait::async_trait]
impl Overload for ById {
type Output = crate::web_api::interface::purchases::view_models::PurchaseDocument;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "id", &self.id)?;
api.request_no_body::<crate::web_api::interface::purchases::view_models::PurchaseDocument>(HttpMethod::Put, "/api/PurchasesIssue/InBuffer", query).await
}
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "id", &self.id)?;
api.request_no_body_raw(HttpMethod::Put, "/api/PurchasesIssue/InBuffer", query)
.await
}
}
pub struct ByNumber {
pub number: String,
}
#[async_trait::async_trait]
impl Overload for ByNumber {
type Output = crate::web_api::interface::purchases::view_models::PurchaseDocument;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "number", &self.number)?;
api.request_no_body::<crate::web_api::interface::purchases::view_models::PurchaseDocument>(HttpMethod::Put, "/api/PurchasesIssue/InBuffer", query).await
}
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "number", &self.number)?;
api.request_no_body_raw(HttpMethod::Put, "/api/PurchasesIssue/InBuffer", query)
.await
}
}
}
pub mod issue_pz {
use super::*;
#[async_trait::async_trait]
pub trait Overload {
type Output: DeserializeOwned;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError>;
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError>;
}
pub struct ByDocumentId {
pub document_id: i32,
}
#[async_trait::async_trait]
impl Overload for ByDocumentId {
type Output = Vec<crate::web_api::interface::purchases::view_models::PurchaseDocumentPZ>;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "documentId", &self.document_id)?;
api.request_no_body::<Vec<crate::web_api::interface::purchases::view_models::PurchaseDocumentPZ>>(HttpMethod::Put, "/api/PurchasesIssue/PZ", query).await
}
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "documentId", &self.document_id)?;
api.request_no_body_raw(HttpMethod::Put, "/api/PurchasesIssue/PZ", query)
.await
}
}
pub struct ByDocumentNumber {
pub document_number: String,
}
#[async_trait::async_trait]
impl Overload for ByDocumentNumber {
type Output = Vec<crate::web_api::interface::purchases::view_models::PurchaseDocumentPZ>;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "documentNumber", &self.document_number)?;
api.request_no_body::<Vec<crate::web_api::interface::purchases::view_models::PurchaseDocumentPZ>>(HttpMethod::Put, "/api/PurchasesIssue/PZ", query).await
}
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "documentNumber", &self.document_number)?;
api.request_no_body_raw(HttpMethod::Put, "/api/PurchasesIssue/PZ", query)
.await
}
}
}
pub mod issue_pz_correction {
use super::*;
#[async_trait::async_trait]
pub trait Overload {
type Output: DeserializeOwned;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError>;
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError>;
}
pub struct ByDocumentIdIssue {
pub document_id: i32,
pub issue: bool,
}
#[async_trait::async_trait]
impl Overload for ByDocumentIdIssue {
type Output = Vec<crate::web_api::interface::purchases::view_models::PurchaseDocumentPZ>;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "documentId", &self.document_id)?;
push_query_param(&mut query, "issue", &self.issue)?;
api.request_no_body::<Vec<crate::web_api::interface::purchases::view_models::PurchaseDocumentPZ>>(HttpMethod::Put, "/api/PurchasesIssue/PZCorrection", query).await
}
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "documentId", &self.document_id)?;
push_query_param(&mut query, "issue", &self.issue)?;
api.request_no_body_raw(HttpMethod::Put, "/api/PurchasesIssue/PZCorrection", query)
.await
}
}
pub struct ByDocumentNumberIssue {
pub document_number: String,
pub issue: bool,
}
#[async_trait::async_trait]
impl Overload for ByDocumentNumberIssue {
type Output = Vec<crate::web_api::interface::purchases::view_models::PurchaseDocumentPZ>;
async fn call(self, api: &ApiClient) -> Result<ResponseEnvelope<Self::Output>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "documentNumber", &self.document_number)?;
push_query_param(&mut query, "issue", &self.issue)?;
api.request_no_body::<Vec<crate::web_api::interface::purchases::view_models::PurchaseDocumentPZ>>(HttpMethod::Put, "/api/PurchasesIssue/PZCorrection", query).await
}
async fn call_raw(self, api: &ApiClient) -> Result<ResponseEnvelope<Value>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "documentNumber", &self.document_number)?;
push_query_param(&mut query, "issue", &self.issue)?;
api.request_no_body_raw(HttpMethod::Put, "/api/PurchasesIssue/PZCorrection", query)
.await
}
}
}
#[allow(non_snake_case)]
impl IPurchasesIssueController {
pub async fn AddNew<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<T::Output>, ApiError>
where
T: add_new::Overload,
{
overload.call(api).await
}
pub async fn AddNewRaw<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<Value>, ApiError>
where
T: add_new::Overload,
{
overload.call_raw(api).await
}
pub async fn Issue<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<T::Output>, ApiError>
where
T: issue::Overload,
{
overload.call(api).await
}
pub async fn IssueRaw<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<Value>, ApiError>
where
T: issue::Overload,
{
overload.call_raw(api).await
}
pub async fn IssuePZ<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<T::Output>, ApiError>
where
T: issue_pz::Overload,
{
overload.call(api).await
}
pub async fn IssuePZRaw<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<Value>, ApiError>
where
T: issue_pz::Overload,
{
overload.call_raw(api).await
}
pub async fn IssuePZCorrection<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<T::Output>, ApiError>
where
T: issue_pz_correction::Overload,
{
overload.call(api).await
}
pub async fn IssuePZCorrectionRaw<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<Value>, ApiError>
where
T: issue_pz_correction::Overload,
{
overload.call_raw(api).await
}
pub async fn ChangeDocumentNumber(
api: &ApiClient,
id: i32,
number: String,
) -> Result<ResponseEnvelope<()>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "id", &id)?;
push_query_param(&mut query, "number", &number)?;
api.request_no_body::<()>(
HttpMethod::Patch,
"/api/PurchasesIssue/DocumentNumber",
query,
)
.await
}
pub async fn ChangeDocumentNumberRaw(
api: &ApiClient,
id: i32,
number: String,
) -> Result<ResponseEnvelope<Value>, ApiError> {
let mut query = Vec::<QueryParam>::new();
push_query_param(&mut query, "id", &id)?;
push_query_param(&mut query, "number", &number)?;
api.request_no_body_raw(
HttpMethod::Patch,
"/api/PurchasesIssue/DocumentNumber",
query,
)
.await
}
}