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 target (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, attachment: moco_wrapper.util.io.file.File = None)¶ 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
- attachment (
moco_wrapper.util.io.file.File
) – Attachment file
Returns: The created comment
Return type:
-
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. - text (str) – Comment text
Returns: List of created comments.
Return type: ..note:
At the moment it is not possible to bulk create comments with attachments
-
delete
(comment_id: int)¶ Delete a comment.
Parameters: comment_id (int) – Id of the comment 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
(comment_id: int)¶ Retrieve a single comment.
Parameters: comment_id (int) – Id of the comment Returns: Single comment Return type: moco_wrapper.util.response.ObjectResponse
-
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 (defaultNone
) - commentable_id (int) – Id of the object the comment belongs to (default
None
) - user_id (int) – User id of the creator (default
None
) - manual (bool) – If the comment was user-created of generated (default
None
) - sort_by (str) – Field to sort the results by (default
None
) - sort_order (str) – asc or desc (default
"asc"
) - page (int) – Page number (default
1
)
Returns: list of comments
Return type: - commentable_type (
-
update
(comment_id: int, text: str, attachment: moco_wrapper.util.io.file.File = None)¶ Update a comment.
Parameters: - comment_id (int) – The id of the comment to update
- text (str) – Comment text
Returns: The created comment
Return type:
-
-
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 )
-
COMPANY
= 'Company'¶
-
CONTACT
= 'Contact'¶
-
DEAL
= 'Deal'¶
-
EXPENSE
= 'Expense'¶
-
INVOICE
= 'Invoice'¶
-
INVOICE_BOOKKEEPING_EXPORT
= 'InvoiceBookkeepingExport'¶
-
INVOICE_DELETION
= 'InvoiceDeletion'¶
-
INVOICE_REMINDER
= 'InvoiceReminder'¶
-
OFFER
= 'Offer'¶
-
OFFER_CONFIRMATION
= 'OfferConfirmation'¶
-
PROJECT
= 'Project'¶
-
PURCHASE
= 'Purchase'¶
-
PURCHASE_BOOKKEEPING_EXPORT
= 'PurchaseBookkeepingExport'¶
-
PURCHASE_DRAFT
= 'PurchaseDraft'¶
-
RECEIPT
= 'Receipt'¶
-
RECEIPT_REFUND_REQUEST
= 'ReceiptRefundRequest'¶
-
RECURRING_EXPENSE
= 'RecurringExpense'¶
-
UNIT
= 'Unit'¶
-
USER
= 'User'¶
-