Source code for statsbiblioteket.harvest.expense_categories

import typing

from statsbiblioteket.harvest.harvest_types import ExpenseCategory
from statsbiblioteket.harvest.rest import Rest


[docs]class ExpenseCategories(Rest): # Expense Categories @property def expense_categories(self) -> typing.List[ExpenseCategory]: """ expense categories property """ return self._get('/expense_categories')
[docs] def create_expense_category(self, new_expense_category_id, **kwargs): # TODO types """ Create an expense category """ url = '/expense_categories/{0}'.format(new_expense_category_id) return self._post(url, data=kwargs)
[docs] def update_expense_category(self, expense_category_id, **kwargs): # TODO types """ Update an existing expense category """ url = '/expense_categories/{0}'.format(expense_category_id) return self._put(url, data=kwargs)
[docs] def get_expense_category(self, expense_category_id) -> ExpenseCategory: """ Get an expense category by expense_category_id """ url = '/expense_categories/{0}'.format(expense_category_id) return self._get(url)
[docs] def delete_expense_category(self, expense_category_id): """ Delete an expense category """ url = '/expense_categories/{0}'.format(expense_category_id) return self._delete(url)
[docs] def toggle_expense_category_active(self, expense_category_id): """ Toggle the active flag of an expense category """ url = '/expense_categories/{0}/toggle'.format(expense_category_id) return self._get(url)