kepler.api.unit module

The module contains the functionality for REST API calls related to units.

class kepler.api.unit.AddUnitParams

Bases: kepler.api.api_util.ApiParamsBase

The parameter class for the REST API call add_unit.

description_en = The description of the unit to be added in English.
description_fi = The description of the unit to be added in Finnish.
max_user_group_size = The maximum number of users that can belong to a group ...
name_en = The name of the unit to be added in English.
name_fi = The name of the unit to be added in Finnish.
resources = A list of resources and their count that the unit shall have after the call.
class kepler.api.unit.DeleteUnitParams

Bases: kepler.api.api_util.ApiParamsBase

The parameter class for the REST API call delete_unit.

unit_id = The ID of the unit that will be deleted.
class kepler.api.unit.EditUnitParams

Bases: kepler.api.api_util.ApiParamsBase

The parameter class for the REST API call edit_unit.

description_en = The description of the unit to be added in English.
description_fi = The description of the unit to be added in Finnish.
max_user_group_size = The maximum number of users that can belong to a group ...
name_en = The name of the unit to be added in English.
name_fi = The name of the unit to be added in Finnish.
resources = A list of resources and their count that the unit shall have after the call.
unit_id = The ID of the unit that will be edited.
kepler.api.unit.add_unit(request)

The function implements the REST API call add_unit.

kepler.api.unit.delete_unit(request)

The function implements the REST API call delete_unit.

kepler.api.unit.edit_unit(request)

The function implements the REST API call edit_unit.

kepler.api.unit.get_units(request)

The REST API handler returns the list of units from the database.

Parameters:request – The Pyramid request object.
Returns:The list of units and unit types in JSON format.
kepler.api.unit.get_units_editable(request)

The REST API handler returns from the database the list of units with resources of the units.

Parameters:request – The Pyramid request object.
Returns:The list of units and their resources in JSON format.
kepler.api.unit.set_transl(lang_id, tr_id, translation)

The utility function adds a translation to the database.