Project Contract

class moco_wrapper.models.ProjectContract(moco)

Class for handling project contracts.

When a user gets assigned to a project, that is called a project contract. This can be done with this model.

create(project_id: int, user_id: int, billable: bool = None, active: bool = None, budget: float = None, hourly_rate: float = None)

Assign a user to a project.

Parameters:
  • project_id (int) – Id of the project
  • user_id (int) – User id of the person to assign
  • billable (bool) – If the contract is billable (default None)
  • active (bool) – If the contract is active (default None)
  • budget (float) – Contract budget (default None)
  • hourly_rate (float) – Contract hourly rate (default None)
Returns:

Created contract object

Return type:

moco_wrapper.util.response.ObjectResponse

delete(project_id: int, contract_id: int)

Delete a project contract.

Deleting a staff assignment is only possible as long as there no hours tracked from the assigned person for the project.

Parameters:
  • project_id (int) – Id of the project
  • contract_id (int) – Id of the contract to delete
Returns:

Empty response on success

Return type:

moco_wrapper.util.response.EmptyResponse

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, contract_id: int)

Retrieve a project contract.

Parameters:
  • project_id (int) – Id of the project
  • contract_id (int) – Id of the contract
Returns:

The contract object

Return type:

moco_wrapper.util.response.ObjectResponse

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

Retrieve all active contracts for a project.

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

List of contract objects

Return type:

moco_wrapper.util.response.PagedListResponse

update(project_id: int, contract_id: int, billable: bool = None, active: bool = None, budget: float = None, hourly_rate: float = None)

Update an existing project contract.

Parameters:
  • project_id (int) – Id of the project to update the contract for
  • contract_id (int) – Id of the contract to update
  • billable (bool) – If the contract is billable (default None)
  • active (bool) – If the contract is active (default None)
  • budget (float) – Contract budget (default None)
  • hourly_rate (float) – Contract hourly rate (default None)
Returns:

The updated project contract

Return type:

moco_wrapper.util.response.ObjectResponse