Source code for divera.models.events

from divera.api.v2.events import *
from divera.models import Event as _Event
from . import PullModel as _PullModel


_RESPONSE_OPTIONS = {
    0: [],
    1: [
        [1, "Ja"],
        [3, "Nein"],
    ],
    2: [
        [1, "Ja"],
        [2, "Unsicher"],
        [3, "Nein"],
    ],
}


[docs]class Event(_Event):
[docs] @staticmethod def get_all( ): return _PullModel.get_all( model=Event, )
[docs] @staticmethod def ics(): request = ICS( ) return request
[docs] def get_response_options(self, response_type: int = None): """ Return all the accepted answers for this event. :param response_type: :return: response option id and response option human-readable text """ if response_type is None: response_type = self.response_type if response_type is None: raise ValueError("Event has no response type set.") return _RESPONSE_OPTIONS[response_type]