Deal Category

class moco_wrapper.models.DealCategory(moco)

Model for handling the different deal_categories used by a pending deal.

A deal (see moco_wrapper.models.Deal) that is in the state PENDING (see moco_wrapper.models.deal.DealStatus) must be assigned to deal category. A category has a name and a probability of success (in percent).

Typically a deal that is in PENDING starts at 1% and moves into the state WON if the probability reaches 100%.

from moco_wrapper import Moco

m = Moco()

#create a category with 75% success probability
new_category = m.DealCategory.create(
    "Second round of negotiation",
    75
)
create(name: str, probability: int)

Create a new deal category.

Parameters:
  • name (str) – Name of the deal category (must be unique)
  • probability (int) – Deal category success probability (between 1 and 100)
Returns:

The created deal category

Return type:

moco_wrapper.util.response.ObjectResponse

delete(category_id: int)

Delete a deal category.

Parameters:category_id (int) – Id of the deal category 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(category_id: int)

Retrieves a single deal category.

Parameters:category_id (int) – Id of the deal category to retrieve
Returns:Single deal category
Return type:moco_wrapper.util.response.ObjectResponse
getlist()

Retrieves a list of a deal categories.

Returns:List of deal categories
Return type:moco_wrapper.util.response.ListResponse
update(category_id: int, name: str = None, probability: int = None)

Updates an existing deal category.

Parameters:
  • category_id (int) – Id of the deal category to update
  • name (str) – Name of the deal category (must be unique) (default None)
  • probability (int) – Deal category success probability (between 1 and 100) (default None)
Returns:

The updated deal category

Return type:

moco_wrapper.util.response.ObjectResponse