Comment¶
-
class
moco_wrapper.models.
Comment
(moco)¶ Class for handling comments.
Comments can be created for a multitude of objects. So when creating comments one must specify which type of object they mean (see
CommentTargetType
)Example Usage:
m = Moco() project_id = 22 comment_create = m.Comment.create( project_id, #id of the thing we comment "PROJECT", #object type "example comment text" )
-
create
(commentable_id: int, commentable_type: moco_wrapper.models.comment.CommentTargetType, text: str)¶ Create a single comment.
Parameters: - commentable_id (int) – Id of the object to create the comment of (i.e the project id of the project we want to comment on)
- commentable_type (
CommentTargetType
, str) – Type of object to create the comment for. - text (str) – Comment text
Returns: The created comment
-
create_bulk
(commentable_ids: list, commentable_type: moco_wrapper.models.comment.CommentTargetType, text: str)¶ Create a comment for multiple target objects.
Parameters: - commentable_ids (list) – ids of the objects we want to comment under ie. [123, 124, 125]
- commentable_type (
CommentTargetType
, str) – type of object to create the comment for. For allowed values seeCommentTargetType
. - text (str) – comment text
Returns: List of created comments.
-
delete
(comment_id: int)¶ Delete a comment.
Parameters: comment_id (int) – Id of the comment to delete Returns: Empty response on success
-
get
(comment_id: int)¶ Retrieve a single comment.
Parameters: comment_id (int) – Id of the comment Returns: Single comment
-
getlist
(commentable_type: moco_wrapper.models.comment.CommentTargetType = None, commentable_id: int = None, user_id: int = None, manual: bool = None, sort_by: str = None, sort_order: str = 'asc', page: int = 1)¶ Retrieve a list of comments.
Parameters: - commentable_type (
CommentTargetType
, str) – Type of object the comment(s) belong to - commentable_id (int) – Id of the object the comment belongs to
- user_id (int) – User id of the creator
- manual (bool) – If the comment was user-created of generated
- sort_by (str) – Field to sort the results by
- sort_order (str) – asc or desc
- page (int) – Page number (default 1)
Returns: list of comments
- commentable_type (
-
update
(comment_id: int, text: str)¶ Update a comment.
Parameters: - comment_id (int) – The id of the comment to update
- text (str) – Comment text
Returns: The created comment
-
-
class
moco_wrapper.models.comment.
CommentTargetType
¶ Enumeration for allowed values used that can be supplied for the
commentable_type
argument inComment.create()
,Comment.create_bulk()
andComment.getlist()
from moco_wrapper import Moco from moco_wrapper.models.comment import CommentTargetType m = Moco() comment_create = m.Comment.create( .. commentable_type = CommentTargetType.DEAL )
-
CONTACT
= 'Contact'¶
-
CUSTOMER
= 'Customer'¶
-
DEAL
= 'Deal'¶
-
INVOICE
= 'Invoice'¶
-
OFFER
= 'Offer'¶
-
OFFERCONFIRMATION
= 'OfferConfirmation'¶
-
PROJECT
= 'Project'¶
-
USER
= 'User'¶
-