Planning Entry

class moco_wrapper.models.PlanningEntry(moco)

Class for handling planning.

Note

This is the new way for handling planning (the old way was with Schedules)

create(project_id: int, starts_on: datetime.date, ends_on: datetime.date, hours_per_day: float, user_id: int = None, comment: str = None, symbol: moco_wrapper.models.planning_entry.PlanningEntrySymbol = None)

Create a new planning entry.

Parameters:
  • project_id (int) – Project id
  • starts_on (datetime.date, str) – Start date
  • ends_on (datetime.date, str) – End date
  • hours_per_day (float) – Hours per day the planning entry will consume
  • user_id (int) – User id the planning entry belongs to (default None)
  • comment (str) – A comment (default None)
  • symbol (PlanningEntrySymbol, int) – Symbol icon to use (default None)
Returns:

The created planning entry

Return type:

moco_wrapper.util.response.ObjectResponse

Note

If no user_id is supplied the entry will be created with the user_id of the executing request (the user_id the api key belongs to)

delete(planning_entry_id: int)

Delete a planning entry.

Parameters:planning_entry_id (int) – Id of the entry to delete
Returns:The deleted planning entry
Return type:moco_wrapper.util.response.ObjectResponse
static endpoints() → List[moco_wrapper.util.endpoint.endpoint.Endpoint]

Returns all endpoints associated with the model

Returns:List of Endpoint objects
Return type:moco_wrapper.util.endpoint.Endpoint
get(planning_entry_id: int)

Retrieve a single planning entry.

Parameters:planning_entry_id (int) – Id the of the entry
Returns:Single planning entry
Return type:moco_wrapper.util.response.ObjectResponse
getlist(start_date: datetime.date = None, end_date: datetime.date = None, user_id: int = None, project_id: int = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)

Retrieve a list of planning entries.

Parameters:
  • start_date (datetime.date, str) – Start date (if start_date is supplied, end_date must also be supplied) (default None)
  • end_date (datetime.date, str) – End date (if end_date is supplied, start_date must also be supplied) (default None)
  • user_id (int) – User id (default None)
  • project_id (int) – Project id (default None)
  • sort_by (str) – Field to sort by (default None)
  • sort_order (str) – asc or desc (default "asc")
  • page (int) – Page number (default 1)
Returns:

List of planning entries

Return type:

moco_wrapper.util.response.PagedListResponse

update(planning_entry_id: int, project_id: int = None, starts_on: datetime.date = None, ends_on: datetime.date = None, hours_per_day: float = None, user_id: int = None, comment: str = None, symbol: moco_wrapper.models.planning_entry.PlanningEntrySymbol = None)

Updates a planning entry.

Parameters:
  • planning_entry_id (int) – Id of the entry to update
  • project_id (int) – Project id (default None)
  • starts_on (datetime.date, str) – Start date (default None)
  • ends_on (datetime.date, str) – End date (default None)
  • hours_per_day (float) – Hours per day the planning entry will consume (default None)
  • user_id (int) – User id the planning entry belongs to (default None)
  • comment (str) – A comment (default None)
  • symbol (PlanningEntrySymbol, int) – Symbol icon to use (default None)
Returns:

The updated planning entry

Return type:

moco_wrapper.util.response.ObjectResponse

class moco_wrapper.models.planning_entry.PlanningEntrySymbol

Enumeration for allowed values for argument symbol for PlanningEntry.create().

from moco_wrapper.models.planning_entry import PlanningEntrySymbol
from moco_wrapper import Moco

m = Moco()

new_planning_entry = m.create(
    ..
    symbol = PlanningEntrySymbol.HOME
)
BABY_CARRIAGE = 7
BELLS = 6
BUILDING = 2
CAR = 3
COCKTAIL = 5
GRADUATION_CAP = 4
HOME = 1
INFO_CIRCLE = 10
MOON = 9
USERS = 8