use crate::runtime::{
push_query_param, ApiClient, ApiError, HttpMethod, QueryParam, ResponseEnvelope,
};
use serde::de::DeserializeOwned;
use serde_json::Value;
pub struct ISalesIssueController;
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::sales::view_models::SaleDocumentIssue,
}
#[async_trait::async_trait]
impl<'a> Overload for ByIssue<'a> {
type Output = crate::web_api::interface::sales::view_models::SaleDocument;
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::sales::view_models::SaleDocument, _>(
HttpMethod::Post,
"/api/SalesIssue/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/SalesIssue/New",
query,
self.document,
)
.await
}
}
pub struct ByIssueNewCorrection<'a> {
pub issue: bool,
pub correction: &'a crate::web_api::interface::sales::view_models::SaleCorrectionIssue,
}
#[async_trait::async_trait]
impl<'a> Overload for ByIssueNewCorrection<'a> {
type Output = crate::web_api::interface::sales::view_models::SaleCorrection;
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::sales::view_models::SaleCorrection, _>(HttpMethod::Post, "/api/SalesIssue/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/SalesIssue/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::sales::view_models::SaleDocument;
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::sales::view_models::SaleDocument>(
HttpMethod::Put,
"/api/SalesIssue/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/SalesIssue/InBuffer", query)
.await
}
}
pub struct ByNumber {
pub number: String,
}
#[async_trait::async_trait]
impl Overload for ByNumber {
type Output = crate::web_api::interface::sales::view_models::SaleDocument;
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::sales::view_models::SaleDocument>(
HttpMethod::Put,
"/api/SalesIssue/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/SalesIssue/InBuffer", query)
.await
}
}
}
pub mod issue_advance_payment {
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<'a> {
pub document_id: i32,
pub options: &'a crate::web_api::interface::sales::view_models::AdvancePaymentOptions,
}
#[async_trait::async_trait]
impl<'a> Overload for ByDocumentId<'a> {
type Output = crate::web_api::interface::sales::view_models::SaleDocument;
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_with_body::<crate::web_api::interface::sales::view_models::SaleDocument, _>(
HttpMethod::Put,
"/api/SalesIssue/AdvancePayment",
query,
self.options,
)
.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_with_body_raw(
HttpMethod::Put,
"/api/SalesIssue/AdvancePayment",
query,
self.options,
)
.await
}
}
pub struct ByDocumentNumber<'a> {
pub document_number: String,
pub options: &'a crate::web_api::interface::sales::view_models::AdvancePaymentOptions,
}
#[async_trait::async_trait]
impl<'a> Overload for ByDocumentNumber<'a> {
type Output = crate::web_api::interface::sales::view_models::SaleDocument;
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_with_body::<crate::web_api::interface::sales::view_models::SaleDocument, _>(
HttpMethod::Put,
"/api/SalesIssue/AdvancePayment",
query,
self.options,
)
.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_with_body_raw(
HttpMethod::Put,
"/api/SalesIssue/AdvancePayment",
query,
self.options,
)
.await
}
}
}
pub mod issue_wz {
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 ByDocumentIdInBuffer {
pub document_id: i32,
pub in_buffer: Option<i32>,
}
#[async_trait::async_trait]
impl Overload for ByDocumentIdInBuffer {
type Output = Vec<crate::web_api::interface::sales::view_models::SaleDocumentWZ>;
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, "inBuffer", &self.in_buffer)?;
api.request_no_body::<Vec<crate::web_api::interface::sales::view_models::SaleDocumentWZ>>(HttpMethod::Put, "/api/SalesIssue/WZ", 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, "inBuffer", &self.in_buffer)?;
api.request_no_body_raw(HttpMethod::Put, "/api/SalesIssue/WZ", query)
.await
}
}
pub struct ByDocumentNumberInBuffer {
pub document_number: String,
pub in_buffer: Option<i32>,
}
#[async_trait::async_trait]
impl Overload for ByDocumentNumberInBuffer {
type Output = Vec<crate::web_api::interface::sales::view_models::SaleDocumentWZ>;
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, "inBuffer", &self.in_buffer)?;
api.request_no_body::<Vec<crate::web_api::interface::sales::view_models::SaleDocumentWZ>>(HttpMethod::Put, "/api/SalesIssue/WZ", 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, "inBuffer", &self.in_buffer)?;
api.request_no_body_raw(HttpMethod::Put, "/api/SalesIssue/WZ", query)
.await
}
}
}
pub mod issue_wz_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::sales::view_models::SaleDocumentWZ>;
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::sales::view_models::SaleDocumentWZ>>(HttpMethod::Put, "/api/SalesIssue/IssueWZCorrection", 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/SalesIssue/IssueWZCorrection", 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::sales::view_models::SaleDocumentWZ>;
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::sales::view_models::SaleDocumentWZ>>(HttpMethod::Put, "/api/SalesIssue/IssueWZCorrection", 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/SalesIssue/IssueWZCorrection", query)
.await
}
}
}
pub mod issue_pn {
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 = ();
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::<()>(HttpMethod::Put, "/api/SalesIssue/IssuePayment", 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/SalesIssue/IssuePayment", query)
.await
}
}
pub struct ByDocumentNumber {
pub document_number: String,
}
#[async_trait::async_trait]
impl Overload for ByDocumentNumber {
type Output = ();
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::<()>(HttpMethod::Put, "/api/SalesIssue/IssuePayment", 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/SalesIssue/IssuePayment", query)
.await
}
}
}
pub mod change_fiscal_status {
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 = ();
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::<()>(HttpMethod::Patch, "/api/SalesIssue/FiscalStatus", 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::Patch, "/api/SalesIssue/FiscalStatus", query)
.await
}
}
pub struct ByDocumentNumber {
pub document_number: String,
}
#[async_trait::async_trait]
impl Overload for ByDocumentNumber {
type Output = ();
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::<()>(HttpMethod::Patch, "/api/SalesIssue/FiscalStatus", 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::Patch, "/api/SalesIssue/FiscalStatus", query)
.await
}
}
}
#[allow(non_snake_case)]
impl ISalesIssueController {
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 IssueAdvancePayment<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<T::Output>, ApiError>
where
T: issue_advance_payment::Overload,
{
overload.call(api).await
}
pub async fn IssueAdvancePaymentRaw<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<Value>, ApiError>
where
T: issue_advance_payment::Overload,
{
overload.call_raw(api).await
}
pub async fn IssueWZ<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<T::Output>, ApiError>
where
T: issue_wz::Overload,
{
overload.call(api).await
}
pub async fn IssueWZRaw<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<Value>, ApiError>
where
T: issue_wz::Overload,
{
overload.call_raw(api).await
}
pub async fn IssueWZCorrection<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<T::Output>, ApiError>
where
T: issue_wz_correction::Overload,
{
overload.call(api).await
}
pub async fn IssueWZCorrectionRaw<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<Value>, ApiError>
where
T: issue_wz_correction::Overload,
{
overload.call_raw(api).await
}
pub async fn IssuePN<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<T::Output>, ApiError>
where
T: issue_pn::Overload,
{
overload.call(api).await
}
pub async fn IssuePNRaw<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<Value>, ApiError>
where
T: issue_pn::Overload,
{
overload.call_raw(api).await
}
pub async fn ChangeFiscalStatus<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<T::Output>, ApiError>
where
T: change_fiscal_status::Overload,
{
overload.call(api).await
}
pub async fn ChangeFiscalStatusRaw<T>(
api: &ApiClient,
overload: T,
) -> Result<ResponseEnvelope<Value>, ApiError>
where
T: change_fiscal_status::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/SalesIssue/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/SalesIssue/DocumentNumber", query)
.await
}
}