| Total Complexity | 4 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from .base import Resource |
||
| 2 | |||
| 3 | |||
| 4 | # ======================================================= |
||
| 5 | # Comments |
||
| 6 | # ======================================================= |
||
| 7 | class Comments(Resource): |
||
| 8 | def fetch(self, |
||
| 9 | ticket_id: int): |
||
| 10 | return self._get("/tickets/{ticket_id}/comments".format(ticket_id=ticket_id)) |
||
| 11 | |||
| 12 | def create(self, |
||
| 13 | ticket_id: str, |
||
| 14 | content: str, |
||
| 15 | attachment_ids: list = None, |
||
| 16 | content_as_html: bool = False): |
||
| 17 | comment = { |
||
| 18 | "content": { |
||
| 19 | "html" if content_as_html else "text": content, |
||
| 20 | } |
||
| 21 | } |
||
| 22 | |||
| 23 | if attachment_ids is not None: |
||
| 24 | comment["attachment_ids"] = ",".join(attachment_ids) |
||
| 25 | |||
| 26 | self._post("/tickets/{ticket_id}/comments".format(ticket_id=ticket_id), data={"comment": comment}) |
||
| 27 |