Schedule¶
-
class
moco_wrapper.models.
Schedule
(moco)¶ Class for handling user schedules.
-
create
(schedule_date: datetime.date, project_id: int = None, absence_code: moco_wrapper.models.schedule.ScheduleAbsenceCode = None, user_id: int = None, am: bool = None, pm: bool = None, comment: str = None, symbol: moco_wrapper.models.schedule.ScheduleSymbol = None, overwrite: bool = None)¶ Create a new schedule entry.
Parameters: - schedule_date – date of the entry
- project_id – Project id
- absence_code – Type of absence. For allowed values see
ScheduleAbsenceCode
- user_id – User id
- am – Morning yes/no
- pm – Afternoon yes/no
- comment – Comment text
- symbol – Symbol to use for the schedule item. For allowed values see
ScheduleSymbol
- overwrite – yes/no overwrite existing entry
Returns: The created planning entry
Note
Define either
project_id
ORabsence_code
, specify one, not both.
-
delete
(id: int)¶ Delete a schedule entry.
Parameters: id – Id of the entry to delete Returns: Empty response on success
-
get
(id: int)¶ Retrieve a single schedule object.
Parameters: id – Id of the entry Returns: Single schedule object
-
getlist
(from_date: datetime.date = None, to_date: datetime.date = None, user_id: int = None, project_id: int = None, absence_code: moco_wrapper.models.schedule.ScheduleAbsenceCode = None, sort_by: str = None, sort_order: str = 'asc', page=1)¶ Retrieve all planned schedule items.
Parameters: - from_date – Start date
- to_date – End date
- user_id – user id the planned entries are belonging to
- project_id – project id
- absence_code – Type of absence. For allowed values see
ScheduleAbsenceCode
- sort_by – Field to sort the results by
- sort_order – asc or desc (default asc)
- page – Page number (default 1)
Returns: List of schedule objects
-
update
(id: int, project_id: int = None, absence_code: moco_wrapper.models.schedule.ScheduleAbsenceCode = None, am: bool = None, pm: bool = None, comment: str = None, symbol: moco_wrapper.models.schedule.ScheduleSymbol = None, overwrite: bool = None)¶ Update a schedule entry.
Parameters: - id – Id of the entry to update
- project_id – Project id
- absence_code – Type of absence. For allowed values see
ScheduleAbsenceCode
- am – Morning yes/no
- pm – Afternoon yes/no
- comment – Comment text
- symbol – Symbol to use for the schedule item. For allowed values see
ScheduleSymbol
- overwrite – yes/no overwrite existing entry
Returns: The updated schedule entry
Note
Define either
project_id
ORabsence_code
, specify one, not both.
-
-
class
moco_wrapper.models.schedule.
ScheduleAbsenceCode
¶ Enumeration for allowed values of argument
absence_code
ofSchedule.getlist()
,Schedule.create()
andSchedule.update()
from moco_wrapper.models.schedule import ScheduleAbsenceCode from moco_wrapper import Moco m = Moco() new_schedule = m.Schedule.create( .. absence_code = ScheduleAbsenceCode.SICK_DAY )
-
ABSENCE
= 5¶
-
HOLIDAY
= 4¶
-
PUBLIC_HOLIDAY
= 2¶
-
SICK_DAY
= 3¶
-
UNPLANNED
= 1¶
-
-
class
moco_wrapper.models.schedule.
ScheduleSymbol
¶ Enumeration for allowed values of arguemnt
symbol
ofSchedule.create()
andSchedule.update()
from moco_wrapper.models.schedule import ScheduleSymbol from moco_wrapper import Moco m = Moco() new_schedule = m.Schedule.create( .. symbol = ScheduleSymbol.HOME )
-
BABY_CARRIAGE
= 7¶
-
BELLS
= 6¶
-
BUILDING
= 2¶
-
CAR
= 3¶
-
COCKTAIL
= 5¶
-
GRADUATION_CAP
= 4¶
-
HOME
= 1¶
-
INFO_CIRCLE
= 10¶
-
MOON
= 9¶
-
USERS
= 8¶
-