Tagging

class moco_wrapper.models.Tagging(moco)

Class for handling tags/labels.

add(entity: moco_wrapper.models.tagging.TaggingEntity, entity_id: int, tags: list)

Add tags to an entity.

Parameters:
  • entity (TaggingEntity, str) – Type of entity to add tags to
  • entity_id (int) – Id of the entity
  • tags (list) – List of tags to add
Returns:

List of tags assigned to the entity

Return type:

moco_wrapper.util.response.ListResponse

Note

If you supply tags that already exist for the entity they will be ignored.

delete(entity: moco_wrapper.models.tagging.TaggingEntity, entity_id: int, tags: list)

Removes supplied tags from an entity

Parameters:
  • entity (TaggingEntity, str) – Type of entity to remove tags for
  • entity_id (int) – Id of the entity
  • tags (list) – List of tags to remove
Returns:

List of tags assigned to the entity

Return type:

moco_wrapper.util.response.ListResponse

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(entity: moco_wrapper.models.tagging.TaggingEntity, entity_id: int)

Get the tags associated with an entity

Parameters:
  • entity (TaggingEntity, str) – Type of entity to add tags to
  • entity_id (int) – Id of the entity
Returns:

List of tags assigned to the entity

Return type:

moco_wrapper.util.response.ListResponse

replace(entity: moco_wrapper.models.tagging.TaggingEntity, entity_id: int, tags: list)

Replace the tags of an entity.

Parameters:
  • entity (TaggingEntity, str) – Type of entity to replace tags for
  • entity_id (int) – Id of the entity
  • tags (list) – New list of tags for the entity
Returns:

List of tags assigned to the entity

Return type:

moco_wrapper.util.response.ListResponse

Note

You can remove all tags from an entity by supplying an empty list.

class moco_wrapper.models.tagging.TaggingEntity

Enumeration for all available entity types that can be supplied for the entity argument of Tagging.add(), Tagging.replace() and Tagging.delete().

Example Usage:

from moco_wrapper import Moco
from moco_wrapper.models.tagging import TaggingEntity

m = Moco()

project_id = 22
tags_add = m.Tagging.add(
    entity = TaggingEntity.PROJECT,
    entity_id = project_id,
    tags = [ "these", "are", "the", "tags" ]
)
COMPANY = 'Company'
CONTACT = 'Contact'
DEAL = 'Deal'
OFFER = 'Offer'
PROJECT = 'Project'
PURCHASE = 'Invoice'