1905 lines
84 KiB
Rust
1905 lines
84 KiB
Rust
// This file is @generated by prost-build.
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct PostJournalRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
/// Absent creates a new journal. Present must identify an existing journal;
|
|
/// an unknown id is never treated as a request to create one.
|
|
#[prost(int64, optional, tag = "2")]
|
|
pub journal_id: ::core::option::Option<i64>,
|
|
/// Required when creating. When appending, empty uses the journal currency;
|
|
/// a supplied value must match it exactly.
|
|
#[prost(string, tag = "3")]
|
|
pub currency: ::prost::alloc::string::String,
|
|
/// Applied when creating and required to be empty when appending.
|
|
#[prost(string, tag = "4")]
|
|
pub description: ::prost::alloc::string::String,
|
|
/// At least one line is required. The lines are inserted atomically and the
|
|
/// journal is allowed to remain unbalanced.
|
|
#[prost(message, repeated, tag = "5")]
|
|
pub lines: ::prost::alloc::vec::Vec<JournalLineInput>,
|
|
/// Required, unique within the profile, and at most 10 characters when
|
|
/// creating. Must be empty when appending to an existing journal selected by
|
|
/// journal_id.
|
|
#[prost(string, tag = "6")]
|
|
pub journal_name: ::prost::alloc::string::String,
|
|
/// Accounting date in YYYY-MM-DD. Empty defaults to the current UTC date when
|
|
/// creating. Must be empty when appending. Rejected when it falls at or before
|
|
/// the latest closed or approved accounting boundary for the profile.
|
|
#[prost(string, tag = "7")]
|
|
pub accounting_date: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct JournalLineInput {
|
|
#[prost(enumeration = "JournalSide", tag = "1")]
|
|
pub side: i32,
|
|
#[prost(string, tag = "2")]
|
|
pub account_code: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub amount: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub description: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct CloseJournalRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub journal_id: i64,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct ReopenJournalRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub journal_id: i64,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct GetJournalRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub journal_id: i64,
|
|
/// False by default. True is reserved for a future Casbin permission granted
|
|
/// only to superadmin and is rejected until that permission is implemented.
|
|
#[prost(bool, tag = "3")]
|
|
pub include_deleted: bool,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct GetAccountingStatusRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct SearchJournalsRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
/// Case-insensitive literal substring. Empty returns all profile journals.
|
|
#[prost(string, tag = "2")]
|
|
pub name_query: ::prost::alloc::string::String,
|
|
/// Zero uses 50. The maximum is 500.
|
|
#[prost(int32, tag = "3")]
|
|
pub page_size: i32,
|
|
/// Opaque cursor returned by the previous response.
|
|
#[prost(string, tag = "4")]
|
|
pub page_token: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct JournalSummary {
|
|
#[prost(int64, tag = "1")]
|
|
pub journal_id: i64,
|
|
#[prost(string, tag = "2")]
|
|
pub journal_name: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub currency: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "5")]
|
|
pub total_debit: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "6")]
|
|
pub total_credit: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "7")]
|
|
pub balance: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "8")]
|
|
pub active_line_count: i64,
|
|
#[prost(bool, tag = "9")]
|
|
pub closed: bool,
|
|
#[prost(string, tag = "10")]
|
|
pub created_at: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "11")]
|
|
pub accounting_date: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct SearchJournalsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub journals: ::prost::alloc::vec::Vec<JournalSummary>,
|
|
#[prost(int64, tag = "2")]
|
|
pub total_count: i64,
|
|
#[prost(string, tag = "3")]
|
|
pub next_page_token: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct AccountingStatus {
|
|
#[prost(bool, tag = "1")]
|
|
pub all_journals_balanced: bool,
|
|
#[prost(int64, tag = "2")]
|
|
pub journal_count: i64,
|
|
#[prost(int64, tag = "3")]
|
|
pub balanced_journal_count: i64,
|
|
#[prost(int64, tag = "4")]
|
|
pub unbalanced_journal_count: i64,
|
|
#[prost(string, tag = "5")]
|
|
pub calculated_at: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct ListUnbalancedJournalsRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
/// Zero uses 50. The maximum is 500.
|
|
#[prost(int32, tag = "2")]
|
|
pub page_size: i32,
|
|
/// Opaque cursor returned by the previous response. Empty starts at the
|
|
/// oldest unbalanced journal.
|
|
#[prost(string, tag = "3")]
|
|
pub page_token: ::prost::alloc::string::String,
|
|
/// Optional ISO 4217 currency filter. Empty includes every currency.
|
|
#[prost(string, tag = "4")]
|
|
pub currency: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct UnbalancedJournalSummary {
|
|
#[prost(int64, tag = "1")]
|
|
pub journal_id: i64,
|
|
#[prost(string, tag = "2")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub currency: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub total_debit: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "5")]
|
|
pub total_credit: ::prost::alloc::string::String,
|
|
/// Signed credits-minus-debits difference.
|
|
#[prost(string, tag = "6")]
|
|
pub balance: ::prost::alloc::string::String,
|
|
/// Side and positive amount needed to make the journal balance zero.
|
|
#[prost(enumeration = "JournalSide", tag = "7")]
|
|
pub missing_side: i32,
|
|
#[prost(string, tag = "8")]
|
|
pub missing_amount: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "9")]
|
|
pub active_line_count: i64,
|
|
#[prost(string, tag = "10")]
|
|
pub created_at: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "11")]
|
|
pub journal_name: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "12")]
|
|
pub accounting_date: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListUnbalancedJournalsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub journals: ::prost::alloc::vec::Vec<UnbalancedJournalSummary>,
|
|
#[prost(int64, tag = "2")]
|
|
pub total_unbalanced_count: i64,
|
|
#[prost(string, tag = "3")]
|
|
pub next_page_token: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct SoftDeleteJournalLineRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub journal_id: i64,
|
|
#[prost(int64, tag = "3")]
|
|
pub journal_line_id: i64,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct JournalLine {
|
|
#[prost(int64, tag = "1")]
|
|
pub id: i64,
|
|
#[prost(int32, tag = "2")]
|
|
pub line_number: i32,
|
|
#[prost(enumeration = "JournalSide", tag = "3")]
|
|
pub side: i32,
|
|
#[prost(string, tag = "4")]
|
|
pub account_code: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "5")]
|
|
pub amount: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "6")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(bool, tag = "7")]
|
|
pub deleted: bool,
|
|
#[prost(string, tag = "8")]
|
|
pub created_at: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "9")]
|
|
pub deleted_at: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "10")]
|
|
pub source_table_name: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "11")]
|
|
pub source_record_id: i64,
|
|
#[prost(int64, tag = "12")]
|
|
pub source_row_revision: i64,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct Journal {
|
|
#[prost(int64, tag = "1")]
|
|
pub id: i64,
|
|
#[prost(string, tag = "2")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub currency: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "5")]
|
|
pub created_at: ::prost::alloc::string::String,
|
|
#[prost(message, repeated, tag = "6")]
|
|
pub lines: ::prost::alloc::vec::Vec<JournalLine>,
|
|
#[prost(string, tag = "7")]
|
|
pub total_debit: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "8")]
|
|
pub total_credit: ::prost::alloc::string::String,
|
|
/// Informational difference calculated as credits minus debits.
|
|
#[prost(string, tag = "9")]
|
|
pub balance: ::prost::alloc::string::String,
|
|
#[prost(bool, tag = "10")]
|
|
pub closed: bool,
|
|
#[prost(string, tag = "11")]
|
|
pub closed_at: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "12")]
|
|
pub closed_by_user_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "13")]
|
|
pub journal_name: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "14")]
|
|
pub accounting_date: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct ConfigureAccountingPeriodRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
/// First day of the period, YYYY-MM-DD. Must be the first day of a month.
|
|
#[prost(string, tag = "2")]
|
|
pub period_start: ::prost::alloc::string::String,
|
|
/// Optional link to the preceding period in a carry chain.
|
|
#[prost(int64, optional, tag = "4")]
|
|
pub previous_period_id: ::core::option::Option<i64>,
|
|
/// Required. Decides the length of the period.
|
|
#[prost(enumeration = "AccountingPeriodType", tag = "5")]
|
|
pub period_type: i32,
|
|
/// Last day of the period, YYYY-MM-DD. Required for PARTIAL and rejected for
|
|
/// every other type, whose end follows from the start.
|
|
#[prost(string, tag = "6")]
|
|
pub period_end: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct CloseAccountingPeriodRequest {
|
|
#[prost(int64, tag = "1")]
|
|
pub period_id: i64,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct ReopenAccountingPeriodRequest {
|
|
#[prost(int64, tag = "1")]
|
|
pub period_id: i64,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct ApproveAccountingPeriodRequest {
|
|
#[prost(int64, tag = "1")]
|
|
pub period_id: i64,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct GetAccountingPeriodRequest {
|
|
#[prost(int64, tag = "1")]
|
|
pub period_id: i64,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct ListAccountingPeriodsRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListAccountingPeriodsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub periods: ::prost::alloc::vec::Vec<AccountingPeriod>,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct AccountingPeriod {
|
|
#[prost(int64, tag = "1")]
|
|
pub id: i64,
|
|
#[prost(string, tag = "2")]
|
|
pub profile_name: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub period_start: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub period_end: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "AccountingPeriodStatus", tag = "5")]
|
|
pub status: i32,
|
|
#[prost(int64, tag = "6")]
|
|
pub previous_period_id: i64,
|
|
#[prost(string, tag = "7")]
|
|
pub closed_at: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "8")]
|
|
pub closed_by_user_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "9")]
|
|
pub approved_at: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "10")]
|
|
pub approved_by_user_id: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "AccountingPeriodType", tag = "11")]
|
|
pub period_type: i32,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct ListPeriodBalancesRequest {
|
|
#[prost(int64, tag = "1")]
|
|
pub period_id: i64,
|
|
}
|
|
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
pub struct PeriodBalance {
|
|
#[prost(int64, tag = "1")]
|
|
pub period_id: i64,
|
|
#[prost(string, tag = "2")]
|
|
pub account_code: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub currency: ::prost::alloc::string::String,
|
|
/// Signed nets use debit-positive convention.
|
|
#[prost(string, tag = "4")]
|
|
pub opening_balance: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "5")]
|
|
pub period_debit: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "6")]
|
|
pub period_credit: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "7")]
|
|
pub closing_balance: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListPeriodBalancesResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub balances: ::prost::alloc::vec::Vec<PeriodBalance>,
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum JournalSide {
|
|
Unspecified = 0,
|
|
Debit = 1,
|
|
Credit = 2,
|
|
}
|
|
impl JournalSide {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "JOURNAL_SIDE_UNSPECIFIED",
|
|
Self::Debit => "JOURNAL_SIDE_DEBIT",
|
|
Self::Credit => "JOURNAL_SIDE_CREDIT",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"JOURNAL_SIDE_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"JOURNAL_SIDE_DEBIT" => Some(Self::Debit),
|
|
"JOURNAL_SIDE_CREDIT" => Some(Self::Credit),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum AccountingPeriodStatus {
|
|
Unspecified = 0,
|
|
Open = 1,
|
|
Closed = 2,
|
|
Approved = 3,
|
|
}
|
|
impl AccountingPeriodStatus {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "ACCOUNTING_PERIOD_STATUS_UNSPECIFIED",
|
|
Self::Open => "ACCOUNTING_PERIOD_STATUS_OPEN",
|
|
Self::Closed => "ACCOUNTING_PERIOD_STATUS_CLOSED",
|
|
Self::Approved => "ACCOUNTING_PERIOD_STATUS_APPROVED",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"ACCOUNTING_PERIOD_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"ACCOUNTING_PERIOD_STATUS_OPEN" => Some(Self::Open),
|
|
"ACCOUNTING_PERIOD_STATUS_CLOSED" => Some(Self::Closed),
|
|
"ACCOUNTING_PERIOD_STATUS_APPROVED" => Some(Self::Approved),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// How long one accounting period lasts. MONTH and YEAR span whole months, so
|
|
/// the caller states only the start and the end is derived. PARTIAL is the
|
|
/// exception for periods real life cut short.
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum AccountingPeriodType {
|
|
Unspecified = 0,
|
|
/// One calendar month.
|
|
Month = 1,
|
|
/// Twelve consecutive months. Starting in January gives the calendar year;
|
|
/// any other start month gives a business year (hospodársky rok).
|
|
Year = 2,
|
|
/// Neither a whole month nor a whole year, because the entity was formed or
|
|
/// terminated part-way through one. The only type carrying an explicit end.
|
|
Partial = 3,
|
|
}
|
|
impl AccountingPeriodType {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unspecified => "ACCOUNTING_PERIOD_TYPE_UNSPECIFIED",
|
|
Self::Month => "ACCOUNTING_PERIOD_TYPE_MONTH",
|
|
Self::Year => "ACCOUNTING_PERIOD_TYPE_YEAR",
|
|
Self::Partial => "ACCOUNTING_PERIOD_TYPE_PARTIAL",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"ACCOUNTING_PERIOD_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
|
|
"ACCOUNTING_PERIOD_TYPE_MONTH" => Some(Self::Month),
|
|
"ACCOUNTING_PERIOD_TYPE_YEAR" => Some(Self::Year),
|
|
"ACCOUNTING_PERIOD_TYPE_PARTIAL" => Some(Self::Partial),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// Generated client implementations.
|
|
pub mod accounting_client {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
use tonic::codegen::http::Uri;
|
|
/// Mutable informational journals. A journal may contain only debits, only
|
|
/// credits, or any non-zero balance. Balance is reported but never enforced.
|
|
/// Accounting periods close date ranges inside a profile and freeze account sums
|
|
/// without replacing the live accounts projection. Closed periods can be reopened;
|
|
/// approved periods are final.
|
|
#[derive(Debug, Clone)]
|
|
pub struct AccountingClient<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl AccountingClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> AccountingClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::Body>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
|
|
{
|
|
pub fn new(inner: T) -> Self {
|
|
let inner = tonic::client::Grpc::new(inner);
|
|
Self { inner }
|
|
}
|
|
pub fn with_origin(inner: T, origin: Uri) -> Self {
|
|
let inner = tonic::client::Grpc::with_origin(inner, origin);
|
|
Self { inner }
|
|
}
|
|
pub fn with_interceptor<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> AccountingClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::Body>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::Body>,
|
|
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
|
|
{
|
|
AccountingClient::new(InterceptedService::new(inner, interceptor))
|
|
}
|
|
/// Compress requests with the given encoding.
|
|
///
|
|
/// This requires the server to support it otherwise it might respond with an
|
|
/// error.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.send_compressed(encoding);
|
|
self
|
|
}
|
|
/// Enable decompressing responses.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.accept_compressed(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_decoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[must_use]
|
|
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_encoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Create a journal with its first lines when journal_id is absent, or append
|
|
/// all supplied lines atomically when journal_id identifies an existing one.
|
|
pub async fn post_journal(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::PostJournalRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/PostJournal",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("komp_ac.accounting.Accounting", "PostJournal"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Close a balanced journal. Closed journals can be reopened while their
|
|
/// accounting period is open.
|
|
pub async fn close_journal(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::CloseJournalRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/CloseJournal",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("komp_ac.accounting.Accounting", "CloseJournal"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn reopen_journal(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ReopenJournalRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/ReopenJournal",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("komp_ac.accounting.Accounting", "ReopenJournal"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Return journal lines and credits-minus-debits informational balance.
|
|
pub async fn get_journal(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetJournalRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/GetJournal",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("komp_ac.accounting.Accounting", "GetJournal"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Search profile journals by user-facing name while retaining journal ids
|
|
/// as the stable relationship keys.
|
|
pub async fn search_journals(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SearchJournalsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::SearchJournalsResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/SearchJournals",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("komp_ac.accounting.Accounting", "SearchJournals"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Return the profile-wide count of balanced and unbalanced journals.
|
|
pub async fn get_accounting_status(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetAccountingStatusRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingStatus>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/GetAccountingStatus",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"GetAccountingStatus",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Return an oldest-first, paginated queue of unbalanced journals.
|
|
pub async fn list_unbalanced_journals(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ListUnbalancedJournalsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListUnbalancedJournalsResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/ListUnbalancedJournals",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"ListUnbalancedJournals",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Soft-delete one line while retaining it for audit display.
|
|
pub async fn soft_delete_journal_line(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SoftDeleteJournalLineRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/SoftDeleteJournalLine",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"SoftDeleteJournalLine",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Create an open accounting period for a profile. Periods may be any length
|
|
/// (month, half-year, year). Overlapping ranges for the same profile are rejected.
|
|
pub async fn configure_accounting_period(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ConfigureAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/ConfigureAccountingPeriod",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"ConfigureAccountingPeriod",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Closing snapshots balances and blocks mutations through the period end.
|
|
/// A closed period may be reopened; approval makes it final.
|
|
pub async fn close_accounting_period(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::CloseAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/CloseAccountingPeriod",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"CloseAccountingPeriod",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn reopen_accounting_period(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ReopenAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/ReopenAccountingPeriod",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"ReopenAccountingPeriod",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn approve_accounting_period(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ApproveAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/ApproveAccountingPeriod",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"ApproveAccountingPeriod",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn get_accounting_period(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/GetAccountingPeriod",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"GetAccountingPeriod",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn list_accounting_periods(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ListAccountingPeriodsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListAccountingPeriodsResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/ListAccountingPeriods",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"ListAccountingPeriods",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
pub async fn list_period_balances(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ListPeriodBalancesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListPeriodBalancesResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/komp_ac.accounting.Accounting/ListPeriodBalances",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"komp_ac.accounting.Accounting",
|
|
"ListPeriodBalances",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
}
|
|
}
|
|
/// Generated server implementations.
|
|
pub mod accounting_server {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
/// Generated trait containing gRPC methods that should be implemented for use with AccountingServer.
|
|
#[async_trait]
|
|
pub trait Accounting: std::marker::Send + std::marker::Sync + 'static {
|
|
/// Create a journal with its first lines when journal_id is absent, or append
|
|
/// all supplied lines atomically when journal_id identifies an existing one.
|
|
async fn post_journal(
|
|
&self,
|
|
request: tonic::Request<super::PostJournalRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
|
|
/// Close a balanced journal. Closed journals can be reopened while their
|
|
/// accounting period is open.
|
|
async fn close_journal(
|
|
&self,
|
|
request: tonic::Request<super::CloseJournalRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
|
|
async fn reopen_journal(
|
|
&self,
|
|
request: tonic::Request<super::ReopenJournalRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
|
|
/// Return journal lines and credits-minus-debits informational balance.
|
|
async fn get_journal(
|
|
&self,
|
|
request: tonic::Request<super::GetJournalRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
|
|
/// Search profile journals by user-facing name while retaining journal ids
|
|
/// as the stable relationship keys.
|
|
async fn search_journals(
|
|
&self,
|
|
request: tonic::Request<super::SearchJournalsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::SearchJournalsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
/// Return the profile-wide count of balanced and unbalanced journals.
|
|
async fn get_accounting_status(
|
|
&self,
|
|
request: tonic::Request<super::GetAccountingStatusRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingStatus>,
|
|
tonic::Status,
|
|
>;
|
|
/// Return an oldest-first, paginated queue of unbalanced journals.
|
|
async fn list_unbalanced_journals(
|
|
&self,
|
|
request: tonic::Request<super::ListUnbalancedJournalsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListUnbalancedJournalsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
/// Soft-delete one line while retaining it for audit display.
|
|
async fn soft_delete_journal_line(
|
|
&self,
|
|
request: tonic::Request<super::SoftDeleteJournalLineRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
|
|
/// Create an open accounting period for a profile. Periods may be any length
|
|
/// (month, half-year, year). Overlapping ranges for the same profile are rejected.
|
|
async fn configure_accounting_period(
|
|
&self,
|
|
request: tonic::Request<super::ConfigureAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
>;
|
|
/// Closing snapshots balances and blocks mutations through the period end.
|
|
/// A closed period may be reopened; approval makes it final.
|
|
async fn close_accounting_period(
|
|
&self,
|
|
request: tonic::Request<super::CloseAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
>;
|
|
async fn reopen_accounting_period(
|
|
&self,
|
|
request: tonic::Request<super::ReopenAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
>;
|
|
async fn approve_accounting_period(
|
|
&self,
|
|
request: tonic::Request<super::ApproveAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_accounting_period(
|
|
&self,
|
|
request: tonic::Request<super::GetAccountingPeriodRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::AccountingPeriod>,
|
|
tonic::Status,
|
|
>;
|
|
async fn list_accounting_periods(
|
|
&self,
|
|
request: tonic::Request<super::ListAccountingPeriodsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListAccountingPeriodsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn list_period_balances(
|
|
&self,
|
|
request: tonic::Request<super::ListPeriodBalancesRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListPeriodBalancesResponse>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
/// Mutable informational journals. A journal may contain only debits, only
|
|
/// credits, or any non-zero balance. Balance is reported but never enforced.
|
|
/// Accounting periods close date ranges inside a profile and freeze account sums
|
|
/// without replacing the live accounts projection. Closed periods can be reopened;
|
|
/// approved periods are final.
|
|
#[derive(Debug)]
|
|
pub struct AccountingServer<T> {
|
|
inner: Arc<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
impl<T> AccountingServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> Self {
|
|
Self {
|
|
inner,
|
|
accept_compression_encodings: Default::default(),
|
|
send_compression_encodings: Default::default(),
|
|
max_decoding_message_size: None,
|
|
max_encoding_message_size: None,
|
|
}
|
|
}
|
|
pub fn with_interceptor<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
{
|
|
InterceptedService::new(Self::new(inner), interceptor)
|
|
}
|
|
/// Enable decompressing requests with the given encoding.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.accept_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Compress responses with the given encoding, if the client supports it.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.send_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.max_decoding_message_size = Some(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[must_use]
|
|
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
|
|
self.max_encoding_message_size = Some(limit);
|
|
self
|
|
}
|
|
}
|
|
impl<T, B> tonic::codegen::Service<http::Request<B>> for AccountingServer<T>
|
|
where
|
|
T: Accounting,
|
|
B: Body + std::marker::Send + 'static,
|
|
B::Error: Into<StdError> + std::marker::Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::Body>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
match req.uri().path() {
|
|
"/komp_ac.accounting.Accounting/PostJournal" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct PostJournalSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::PostJournalRequest>
|
|
for PostJournalSvc<T> {
|
|
type Response = super::Journal;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::PostJournalRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::post_journal(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = PostJournalSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/CloseJournal" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CloseJournalSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::CloseJournalRequest>
|
|
for CloseJournalSvc<T> {
|
|
type Response = super::Journal;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CloseJournalRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::close_journal(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = CloseJournalSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/ReopenJournal" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ReopenJournalSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::ReopenJournalRequest>
|
|
for ReopenJournalSvc<T> {
|
|
type Response = super::Journal;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ReopenJournalRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::reopen_journal(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = ReopenJournalSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/GetJournal" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetJournalSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::GetJournalRequest>
|
|
for GetJournalSvc<T> {
|
|
type Response = super::Journal;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetJournalRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::get_journal(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = GetJournalSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/SearchJournals" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SearchJournalsSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::SearchJournalsRequest>
|
|
for SearchJournalsSvc<T> {
|
|
type Response = super::SearchJournalsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SearchJournalsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::search_journals(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = SearchJournalsSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/GetAccountingStatus" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetAccountingStatusSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::GetAccountingStatusRequest>
|
|
for GetAccountingStatusSvc<T> {
|
|
type Response = super::AccountingStatus;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetAccountingStatusRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::get_accounting_status(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = GetAccountingStatusSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/ListUnbalancedJournals" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListUnbalancedJournalsSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::ListUnbalancedJournalsRequest>
|
|
for ListUnbalancedJournalsSvc<T> {
|
|
type Response = super::ListUnbalancedJournalsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListUnbalancedJournalsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::list_unbalanced_journals(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = ListUnbalancedJournalsSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/SoftDeleteJournalLine" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SoftDeleteJournalLineSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::SoftDeleteJournalLineRequest>
|
|
for SoftDeleteJournalLineSvc<T> {
|
|
type Response = super::Journal;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SoftDeleteJournalLineRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::soft_delete_journal_line(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = SoftDeleteJournalLineSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/ConfigureAccountingPeriod" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ConfigureAccountingPeriodSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<
|
|
super::ConfigureAccountingPeriodRequest,
|
|
> for ConfigureAccountingPeriodSvc<T> {
|
|
type Response = super::AccountingPeriod;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<
|
|
super::ConfigureAccountingPeriodRequest,
|
|
>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::configure_accounting_period(
|
|
&inner,
|
|
request,
|
|
)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = ConfigureAccountingPeriodSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/CloseAccountingPeriod" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CloseAccountingPeriodSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::CloseAccountingPeriodRequest>
|
|
for CloseAccountingPeriodSvc<T> {
|
|
type Response = super::AccountingPeriod;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CloseAccountingPeriodRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::close_accounting_period(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = CloseAccountingPeriodSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/ReopenAccountingPeriod" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ReopenAccountingPeriodSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::ReopenAccountingPeriodRequest>
|
|
for ReopenAccountingPeriodSvc<T> {
|
|
type Response = super::AccountingPeriod;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ReopenAccountingPeriodRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::reopen_accounting_period(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = ReopenAccountingPeriodSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/ApproveAccountingPeriod" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ApproveAccountingPeriodSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::ApproveAccountingPeriodRequest>
|
|
for ApproveAccountingPeriodSvc<T> {
|
|
type Response = super::AccountingPeriod;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<
|
|
super::ApproveAccountingPeriodRequest,
|
|
>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::approve_accounting_period(
|
|
&inner,
|
|
request,
|
|
)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = ApproveAccountingPeriodSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/GetAccountingPeriod" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetAccountingPeriodSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::GetAccountingPeriodRequest>
|
|
for GetAccountingPeriodSvc<T> {
|
|
type Response = super::AccountingPeriod;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetAccountingPeriodRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::get_accounting_period(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = GetAccountingPeriodSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/ListAccountingPeriods" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListAccountingPeriodsSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::ListAccountingPeriodsRequest>
|
|
for ListAccountingPeriodsSvc<T> {
|
|
type Response = super::ListAccountingPeriodsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListAccountingPeriodsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::list_accounting_periods(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = ListAccountingPeriodsSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/komp_ac.accounting.Accounting/ListPeriodBalances" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListPeriodBalancesSvc<T: Accounting>(pub Arc<T>);
|
|
impl<
|
|
T: Accounting,
|
|
> tonic::server::UnaryService<super::ListPeriodBalancesRequest>
|
|
for ListPeriodBalancesSvc<T> {
|
|
type Response = super::ListPeriodBalancesResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListPeriodBalancesRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as Accounting>::list_period_balances(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let method = ListPeriodBalancesSvc(inner);
|
|
let codec = tonic_prost::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
_ => {
|
|
Box::pin(async move {
|
|
let mut response = http::Response::new(
|
|
tonic::body::Body::default(),
|
|
);
|
|
let headers = response.headers_mut();
|
|
headers
|
|
.insert(
|
|
tonic::Status::GRPC_STATUS,
|
|
(tonic::Code::Unimplemented as i32).into(),
|
|
);
|
|
headers
|
|
.insert(
|
|
http::header::CONTENT_TYPE,
|
|
tonic::metadata::GRPC_CONTENT_TYPE,
|
|
);
|
|
Ok(response)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
impl<T> Clone for AccountingServer<T> {
|
|
fn clone(&self) -> Self {
|
|
let inner = self.inner.clone();
|
|
Self {
|
|
inner,
|
|
accept_compression_encodings: self.accept_compression_encodings,
|
|
send_compression_encodings: self.send_compression_encodings,
|
|
max_decoding_message_size: self.max_decoding_message_size,
|
|
max_encoding_message_size: self.max_encoding_message_size,
|
|
}
|
|
}
|
|
}
|
|
/// Generated gRPC service name
|
|
pub const SERVICE_NAME: &str = "komp_ac.accounting.Accounting";
|
|
impl<T> tonic::server::NamedService for AccountingServer<T> {
|
|
const NAME: &'static str = SERVICE_NAME;
|
|
}
|
|
}
|