billecta 1.14.0

Generated Billecta API
Documentation
//! # Accounting
//!
//! In the accounting section you manage all the accounting/bookkeeping data and settings. You
//! get, create and manage payment means (method of payments) which describes how payments are
//! booked. SIE4/CSV export file generation is made through the endpoints below. An
//! alternative to export SIE/Visma files is that you can extract the raw data for bookkeeping
//! as AccountingRecords and generate/import your own data.
//!
use crate::{
    AccountingExport, AccountingExportCreation, AccountingExportFormatType, AccountingExports,
    AccountingPaymentMean, AccountingPaymentMeans, AccountingSettings,
    AccountingVoucherExportCreation, AccountingVoucherRecords, Date, EmptyResponse, LockedPeriod,
    Request, RequestBuilder, Uuid,
};

///Returns all generated bookkeeping files (SIE4, Visma, etc). Exports
///are not generated automatically and must be triggered by users in
///Portal or API (see PUT method).
pub fn get_accounting_bookkeeping_export_files_sie4_etc(id: Uuid) -> Request<AccountingExports> {
    RequestBuilder::new(http::Method::GET, "/v1/accounting/accountingexports/")
        .path_param(id)
        .build()
}
///Generates a new bookkeeping file (SIE4, Visma, etc) file for import in
///external bookkeeping application. Parameter 'Period' can be any date
///in the month and bookkeeping data for the entire full month will be
///written to file. Bookkeeping export is retrieved using GET. Addon
///'CSV-bookkeeping' must be added in Portal before CSV format can be
///used
pub fn create_accounting_bookkeeping_file_for_a_specific_month_with_parameters(
    id: Uuid,
    period: Date,
    format: &AccountingExportFormatType,
) -> Request<AccountingExport> {
    RequestBuilder::new(http::Method::PUT, "/v1/accounting/accountingexports/")
        .path_param(id)
        .query_param("period", period)
        .query_param("format", *format)
        .build()
}
///Generates a new bookkeeping file (SIE4, Visma, etc) file for import in
///external bookkeeping application. Parameter 'Period' can be any date
///in the month and bookkeeping data for the entire full month will be
///written to file. Bookkeeping export is retrieved using GET. Addon
///'CSV-bookkeeping' must be added in Portal before CSV format can be
///used. Setting BookKeepingTypesFilter to empty list is equal to
///specifying all types.
pub fn create_accounting_bookkeeping_file_for_a_specific_month_with_content(
    body: &AccountingExportCreation,
) -> Request<AccountingExport> {
    RequestBuilder::new(http::Method::PUT, "/v1/accounting/accountingexports")
        .body(body)
        .build()
}
///Accounting/Bookkeeping settings are the creditors configuration on how
///bookkeeping events should be handled in the system. If no settings
///have been defined the default setting will be used (see Bookkeeping
///settings in portal)
pub fn get_accounting_bookkeeping_settings(id: Uuid) -> Request<AccountingSettings> {
    RequestBuilder::new(http::Method::GET, "/v1/accounting/accountingsettings/")
        .path_param(id)
        .build()
}
pub fn update_accounting_bookkeeping_settings(body: &AccountingSettings) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/accounting/accountingsettings")
        .body(body)
        .build()
}
///Generates a set of bookkeeping vouchers for analyzing or using as
///export to external bookkeeping application. Setting
///BookKeepingTypesFilter to empty list is equal to specifying all types.
pub fn get_accounting_bookkeeping_vouchers_for_a_specific_period_beta_and_are_possibly_up_for_changes(
    body: &AccountingVoucherExportCreation,
) -> Request<AccountingVoucherRecords> {
    RequestBuilder::new(http::Method::PUT, "/v1/accounting/accountingvouchers")
        .body(body)
        .build()
}
///Get locked period for the bookkeeping. You can set the period to a
///date and no invoices can be attested before or on that date
pub fn get_locked_bookeeping_period(id: Uuid) -> Request<LockedPeriod> {
    RequestBuilder::new(http::Method::GET, "/v1/accounting/lockedperiod/")
        .path_param(id)
        .build()
}
///The to date is inclusive
pub fn update_the_locked_bookeeping_period(id: Uuid, to: Date) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::POST, "/v1/accounting/lockedperiod/")
        .path_param(id)
        .query_param("to", to)
        .build()
}
pub fn delete_locked_bookeeping_period(id: Uuid) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::DELETE, "/v1/accounting/lockedperiod/")
        .path_param(id)
        .build()
}
///Returns all defined payment means (method of payment and their
///bookkeeping setup).
pub fn get_payment_means(id: Uuid) -> Request<AccountingPaymentMeans> {
    RequestBuilder::new(http::Method::GET, "/v1/accounting/paymentmeans/")
        .path_param(id)
        .build()
}
///Returns a single defined payment mean (method of payment and their
///bookkeeping setup).
pub fn get_a_single_payment_mean(
    id: Uuid,
    paymentmeancode: &str,
) -> Request<AccountingPaymentMean> {
    RequestBuilder::new(http::Method::GET, "/v1/accounting/paymentmeans/")
        .path_param(id)
        .query_param("paymentmeancode", paymentmeancode)
        .build()
}
pub fn update_a_payment_mean(body: &AccountingPaymentMean) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/accounting/paymentmeans")
        .body(body)
        .build()
}
pub fn create_a_payment_mean(body: &AccountingPaymentMean) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::POST, "/v1/accounting/paymentmeans")
        .body(body)
        .build()
}
///Deletes a payment mean if possible. Used payment means can't be
///deleted and will return a Bad Request response
pub fn delete_a_payment_mean(id: Uuid, paymentmeancode: &str) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::DELETE, "/v1/accounting/paymentmeans/")
        .path_param(id)
        .query_param("paymentmeancode", paymentmeancode)
        .build()
}