BexioApiClient.Accounting (bexio_api_client v2.0.0)

Copy Markdown

Bexio API for the accounting part of the API.

Summary

Types

One multipart/form-data part for uploading files to manual entries, following the :form_multipart format of Req.

Functions

Upload one or multiple files and attach them to a manual compound entry.

Upload one or multiple files and attach them to a manual entry line (only for the entry types :manual_single_entry and :manual_group_entry).

Create a currency. The name must be in the ISO 4217 format and must be unique.

Create a manual entry for the account ledger.

Delete the connection between a file and a manual compound entry.

Delete the connection between a file and a manual entry line (only for the entry types :manual_single_entry and :manual_group_entry).

Delete a tax.

Update a currency (only the round factor can be changed).

Update a manual entry.

Fetch a list of account groups.

Fetch a list of accounts.

Fetch a single business year.

Fetch a list of business years.

Fetch a single calendar year.

Fetch a list of calendar years.

Fetch a list of currencies.

Fetch a single currency.

Fetch all possible currency codes (in the format CHF, EUR, etc.).

Fetch a list of currency exchange rates.

Fetch the accounting journal.

Fetch a file attached to a manual compound entry.

Fetch the files attached to a manual compound entry.

Fetch a list of manual entries.

Fetch a file attached to a manual entry line (only for the entry types :manual_single_entry and :manual_group_entry).

Fetch the files attached to a manual entry line.

Fetch the next reference number for a manual entry.

Fetch a single tax.

Fetch a single vat period.

Fetch a list of vat periods.

Search accounts via query. The following search fields are supported

Search calendar years via query.

Types

api_error_type()

@type api_error_type() :: BexioApiClient.Helpers.api_error_type()

file_upload_part()

@type file_upload_part() :: {String.t() | atom(), any()}

One multipart/form-data part for uploading files to manual entries, following the :form_multipart format of Req.

file_upload_parts()

@type file_upload_parts() :: [file_upload_part()]

Functions

add_manual_compound_entry_file(req, manual_entry_id, files)

@spec add_manual_compound_entry_file(
  req :: Req.Request.t(),
  manual_entry_id :: non_neg_integer(),
  files :: file_upload_parts()
) :: {:ok, [BexioApiClient.Accounting.ManualEntryFile.t()]} | api_error_type()

Upload one or multiple files and attach them to a manual compound entry.

The files are passed to Req as :form_multipart, e.g.:

[fileName1: {"<file content>", filename: "screenshot.png"}]

Max. file size is 12MB, supported formats are PNG, JPG, JPEG, GIF, DOC, DOCX, XLS, XLSX, PPT, PPTX and PDF.

add_manual_entry_line_file(req, manual_entry_id, entry_id, files)

@spec add_manual_entry_line_file(
  req :: Req.Request.t(),
  manual_entry_id :: non_neg_integer(),
  entry_id :: non_neg_integer(),
  files :: file_upload_parts()
) :: {:ok, [BexioApiClient.Accounting.ManualEntryFile.t()]} | api_error_type()

Upload one or multiple files and attach them to a manual entry line (only for the entry types :manual_single_entry and :manual_group_entry).

The files are passed to Req as :form_multipart, e.g.:

[fileName1: {"<file content>", filename: "screenshot.png"}]

Max. file size is 12MB, supported formats are PNG, JPG, JPEG, GIF, DOC, DOCX, XLS, XLSX, PPT, PPTX and PDF.

create_calendar_year(req, year, opts \\ [])

@spec create_calendar_year(
  req :: Req.Request.t(),
  year :: String.t() | non_neg_integer(),
  opts :: [
    vat_subject?: boolean(),
    annual_reporting?: boolean(),
    vat_accounting_method: :effective | :net_tax,
    vat_accounting_type: :agreed | :collected,
    default_tax_income_id: integer(),
    default_tax_expense_id: integer()
  ]
) :: {:ok, [BexioApiClient.Accounting.CalendarYear.t()]} | api_error_type()

Create a calendar year.

If only the year is given, the next year is created with the same settings as the year before, otherwise all settings must be given.

The response is a list of calendar years because bexio creates all the years in between when creating a future year.

create_currency(req, currency)

@spec create_currency(
  req :: Req.Request.t(),
  currency :: BexioApiClient.Accounting.Currency.t()
) ::
  {:ok, BexioApiClient.Accounting.Currency.t()} | api_error_type()

Create a currency. The name must be in the ISO 4217 format and must be unique.

create_manual_entry(req, manual_entry)

@spec create_manual_entry(
  req :: Req.Request.t(),
  manual_entry :: BexioApiClient.Accounting.ManualEntry.t()
) :: {:ok, BexioApiClient.Accounting.ManualEntry.t()} | api_error_type()

Create a manual entry for the account ledger.

delete_currency(req, currency_id)

@spec delete_currency(req :: Req.Request.t(), currency_id :: non_neg_integer()) ::
  {:ok, boolean()} | api_error_type()

Delete a currency.

delete_manual_compound_entry_file(req, manual_entry_id, file_id)

@spec delete_manual_compound_entry_file(
  req :: Req.Request.t(),
  manual_entry_id :: non_neg_integer(),
  file_id :: non_neg_integer()
) :: {:ok, boolean()} | api_error_type()

Delete the connection between a file and a manual compound entry.

delete_manual_entry(req, manual_entry_id)

@spec delete_manual_entry(
  req :: Req.Request.t(),
  manual_entry_id :: non_neg_integer()
) ::
  {:ok, boolean()} | api_error_type()

Delete a manual entry.

delete_manual_entry_line_file(req, manual_entry_id, entry_id, file_id)

@spec delete_manual_entry_line_file(
  req :: Req.Request.t(),
  manual_entry_id :: non_neg_integer(),
  entry_id :: non_neg_integer(),
  file_id :: non_neg_integer()
) :: {:ok, boolean()} | api_error_type()

Delete the connection between a file and a manual entry line (only for the entry types :manual_single_entry and :manual_group_entry).

delete_tax(req, tax_id)

@spec delete_tax(req :: Req.Request.t(), tax_id :: non_neg_integer()) ::
  {:ok, boolean()} | api_error_type()

Delete a tax.

Taxes which are used and/or referenced within bexio, and taxes assigned to the digit 000 can not be deleted — the API answers with a conflict error.

edit_currency(req, currency)

@spec edit_currency(
  req :: Req.Request.t(),
  currency :: BexioApiClient.Accounting.Currency.t()
) ::
  {:ok, BexioApiClient.Accounting.Currency.t()} | api_error_type()

Update a currency (only the round factor can be changed).

edit_manual_entry(req, manual_entry)

@spec edit_manual_entry(
  req :: Req.Request.t(),
  manual_entry :: BexioApiClient.Accounting.ManualEntry.t()
) :: {:ok, BexioApiClient.Accounting.ManualEntry.t()} | api_error_type()

Update a manual entry.

fetch_account_groups(req, opts \\ [])

Fetch a list of account groups.

fetch_accounts(req, opts \\ [])

Fetch a list of accounts.

fetch_business_year(req, business_year_id)

@spec fetch_business_year(
  req :: Req.Request.t(),
  business_year_id :: non_neg_integer()
) ::
  {:ok, BexioApiClient.Accounting.BusinessYear.t()} | api_error_type()

Fetch a single business year.

fetch_business_years(req, opts \\ [])

Fetch a list of business years.

fetch_calendar_year(req, calendar_year_id)

@spec fetch_calendar_year(
  req :: Req.Request.t(),
  calendar_year_id :: non_neg_integer()
) ::
  {:ok, BexioApiClient.Accounting.CalendarYear.t()} | api_error_type()

Fetch a single calendar year.

fetch_calendar_years(req, opts \\ [])

Fetch a list of calendar years.

fetch_currencies(req, opts \\ [])

Fetch a list of currencies.

fetch_currency(req, currency_id)

@spec fetch_currency(req :: Req.Request.t(), currency_id :: non_neg_integer()) ::
  {:ok, BexioApiClient.Accounting.Currency.t()} | api_error_type()

Fetch a single currency.

fetch_currency_codes(req)

@spec fetch_currency_codes(req :: Req.Request.t()) ::
  {:ok, [String.t()]} | api_error_type()

Fetch all possible currency codes (in the format CHF, EUR, etc.).

fetch_exchange_rates(req, id, opts \\ [])

Fetch a list of currency exchange rates.

fetch_journal(req, opts \\ [])

@spec fetch_journal(
  req :: Req.Request.t(),
  opts :: [
    BexioApiClient.GlobalArguments.offset_without_order_by_arg()
    | {:from, Date.t()}
    | {:to, Date.t()}
    | {:account_uuid, String.t()}
  ]
) :: {:ok, [BexioApiClient.Accounting.JournalEntry.t()]} | api_error_type()

Fetch the accounting journal.

Arguments (in opts):

  • :from - filter for entries after this date
  • :to - filter for entries until this date
  • :account_uuid - filter for entries with an account with this uuid

fetch_manual_compound_entry_file(req, manual_entry_id, file_id)

@spec fetch_manual_compound_entry_file(
  req :: Req.Request.t(),
  manual_entry_id :: non_neg_integer(),
  file_id :: non_neg_integer()
) :: {:ok, BexioApiClient.Accounting.ManualEntryFile.t()} | api_error_type()

Fetch a file attached to a manual compound entry.

fetch_manual_compound_entry_files(req, manual_entry_id, opts \\ [])

@spec fetch_manual_compound_entry_files(
  req :: Req.Request.t(),
  manual_entry_id :: non_neg_integer(),
  opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()]
) :: {:ok, [BexioApiClient.Accounting.ManualEntryFile.t()]} | api_error_type()

Fetch the files attached to a manual compound entry.

fetch_manual_entries(req, opts \\ [])

Fetch a list of manual entries.

fetch_manual_entry_line_file(req, manual_entry_id, entry_id, file_id)

@spec fetch_manual_entry_line_file(
  req :: Req.Request.t(),
  manual_entry_id :: non_neg_integer(),
  entry_id :: non_neg_integer(),
  file_id :: non_neg_integer()
) :: {:ok, BexioApiClient.Accounting.ManualEntryFile.t()} | api_error_type()

Fetch a file attached to a manual entry line (only for the entry types :manual_single_entry and :manual_group_entry).

fetch_manual_entry_line_files(req, manual_entry_id, entry_id, opts \\ [])

@spec fetch_manual_entry_line_files(
  req :: Req.Request.t(),
  manual_entry_id :: non_neg_integer(),
  entry_id :: non_neg_integer(),
  opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()]
) :: {:ok, [BexioApiClient.Accounting.ManualEntryFile.t()]} | api_error_type()

Fetch the files attached to a manual entry line.

fetch_next_manual_entry_reference_nr(req)

@spec fetch_next_manual_entry_reference_nr(req :: Req.Request.t()) ::
  {:ok, String.t()} | api_error_type()

Fetch the next reference number for a manual entry.

fetch_tax(req, tax_id)

@spec fetch_tax(req :: Req.Request.t(), tax_id :: non_neg_integer()) ::
  {:ok, BexioApiClient.Accounting.Tax.t()} | api_error_type()

Fetch a single tax.

fetch_taxes(req, date \\ nil, types \\ nil, opts \\ [])

@spec fetch_taxes(
  req :: Req.Request.t(),
  date :: Date.t() | nil,
  types :: :sales_tax | :pre_tax | nil,
  opts :: [BexioApiClient.GlobalArguments.offset_without_order_by_arg()]
) :: {:ok, [BexioApiClient.Accounting.Tax.t()]} | api_error_type()

Fetch a list of taxes.

Arguments:

  • date - all taxes which are active at the date given
  • types - filter the types of tax (:sales_tax or :pre_tax)

fetch_vat_period(req, vat_period_id)

@spec fetch_vat_period(req :: Req.Request.t(), vat_period_id :: non_neg_integer()) ::
  {:ok, BexioApiClient.Accounting.VatPeriod.t()} | api_error_type()

Fetch a single vat period.

fetch_vat_periods(req, opts \\ [])

Fetch a list of vat periods.

search_accounts(req, criteria, opts \\ [])

Search accounts via query. The following search fields are supported:

  • account_no
  • fibo_account_group_id (TODO: test this)
  • name
  • account_type

search_calendar_years(req, criteria, opts \\ [])

Search calendar years via query.

If you want to search for the end date, use the :like criteria instead of :equal, because searching for equality requires the date in the format "2018-12-31 23:59:59".