Project Task

class moco_wrapper.models.ProjectTask(moco)

Class for handling tasks of a project.

create(project_id: int, name: str, billable: bool = True, active: bool = True, budget: float = None, hourly_rate: float = None)

Create a task for a project.

Parameters:
  • project_id (int) – Id of the project the created task will belong to
  • name (str) – Name of the task
  • billable (bool) – If this expense billable (default True)
  • active (bool) – If this expense active (default True)
  • budget (float) – Budget for the task (e.g. 200.75) (default None)
  • hourly_rate (float) – How much is the hourly rate for the task (e.g.: 120.5) (default None)
Returns:

The created project task

Return type:

moco_wrapper.util.response.ObjectResponse

delete(project_id: int, task_id: int)

Delete project task.

Parameters:
  • project_id (int) – Id of the project the task belongs to
  • task_id (int) – Id of the task to delete
Returns:

Empty response on success

Return type:

moco_wrapper.util.response.EmptyResponse

Note

Deletion of a task is only possible as long as no hours were tracked for the task

destroy_all(project_id: int)

Delete all tasks on a project that can be deleted

Parameters:project_id (int) – Id of the project to destroy all tasks
Returns:Empty response on success
Return type:moco_wrapper.util.response.EmptyResponse

Note

Tasks that cannot be deleted will be skipped

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(project_id: int, task_id: int)

Retrieve a single project task.

Parameters:
  • project_id (int) – Id of the project the task belongs to
  • task_id (int) – Id of the task
Returns:

Single project task

Return type:

moco_wrapper.util.response.ObjectResponse

getlist(project_id: int, sort_by: str = None, sort_order: str = 'asc', page: int = 1)

Retrieve a list of tasks for a project.

Parameters:
  • project_id (int) – Id of the project
  • sort_by (str) – Field to sort results by (default None)
  • sort_order (str) – asc or desc (default "asc")
  • page (int) – Page number (default 1)
Returns:

List of project tasks

Return type:

moco_wrapper.util.response.PagedListResponse

update(project_id: int, task_id: int, name: str = None, billable: bool = None, active: bool = None, budget: float = None, hourly_rate: float = None)

Update a task for a project.

Parameters:
  • project_id (int) – Id of the project the task belongs to
  • task_id (int) – Id of the task to update
  • name (str) – Name of the task (default None)
  • billable (bool) – If this expense billable (default None)
  • active (bool) – If this expense active (default None)
  • budget (float) – Budget for the task (e.g. 200.75) (default None)
  • hourly_rate (float) – How much is the hourly rate for the task (e.g.: 120.5) (default None)
Returns:

The updated project task

Return type:

moco_wrapper.util.response.ObjectResponse