diff --git a/README.md b/README.md index c30f42b..99721c7 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ - [Appendix](#appendix) - [Annotation](#annotation) - [Metadata](#metadata) +- [Comment](#comment) - [Project](#project) - [Dataset](#dataset) - [Converter](#converter) @@ -2654,6 +2655,48 @@ Example of a metadata object } ``` +## Comment + +### Get Task Comments + +Get comments of a task. (Up to 1000 comments) + +```python +comments = client.get_task_comments(project="YOUR_PROJECT_SLUG", task_id="YOUR_TASK_ID") +``` + +### Response + +Example of a comment object + +```python +{ + "id": "YOUR_COMMENT_ID", + "taskId": "YOUR_TASK_ID", + "contentId": "YOUR_CONTENT_ID", + "type": "text", + "isResolved": False, + "points": [185.98, 86.55], + "scale": 0, + "frame": 0, + "status": "todo", + "priority": 0, + "taskAnnotationId": None, + "issueCategoryId": None, + "color": None, + "threads": [ + { + "id": "YOUR_THREAD_ID", + "text": "comment text", + "createdAt": "2026-03-03T03:51:55.247Z", + "updatedAt": "2026-03-03T03:51:55.247Z", + }, + ], + "createdAt": "2026-03-03T03:51:55.240Z", + "updatedAt": "2026-03-03T03:51:55.240Z", +} +``` + ## Project ### Create Project diff --git a/examples/get_task_comments.py b/examples/get_task_comments.py new file mode 100644 index 0000000..a1b6352 --- /dev/null +++ b/examples/get_task_comments.py @@ -0,0 +1,8 @@ +from pprint import pprint + +import fastlabel + +client = fastlabel.Client() + +comments = client.get_task_comments(project="YOUR_PROJECT_SLUG", task_id="YOUR_TASK_ID") +pprint(comments) diff --git a/fastlabel/__init__.py b/fastlabel/__init__.py index f581db8..1394fb7 100644 --- a/fastlabel/__init__.py +++ b/fastlabel/__init__.py @@ -5184,6 +5184,27 @@ def get_histories( return self.api.get_request(endpoint, params=params) + def get_task_comments( + self, + project: str, + task_id: str, + offset: int = None, + limit: int = 100, + ) -> list: + if limit > 1000: + raise FastLabelInvalidException( + "Limit must be less than or equal to 1000.", 422 + ) + endpoint = "comments" + params = {"project": project} + if task_id: + params["taskId"] = task_id + if offset: + params["offset"] = offset + if limit: + params["limit"] = limit + return self.api.get_request(endpoint, params=params) + def mask_to_fastlabel_segmentation_points( self, mask_image: Union[str, np.ndarray] ) -> List[List[List[int]]]: