Issue module
Methods attached to the Kili client, to run actions on issues.
Source code in kili/presentation/client/issue.py
class IssueClientMethods(BaseClientMethods):
"""Methods attached to the Kili client, to run actions on issues."""
@typechecked
def create_issues(
self,
project_id: str,
label_id_array: List[str],
object_mid_array: Optional[List[Optional[str]]] = None,
text_array: Optional[List[Optional[str]]] = None,
) -> List[Dict[Literal["id"], str]]:
"""Create an issue.
Args:
project_id: Id of the project.
label_id_array: List of Ids of the labels to add an issue to.
object_mid_array: List of mids of the objects in the labels to associate the issues to.
text_array: List of texts to associate to the issues.
Returns:
A list of dictionaries with the `id` key of the created issues.
"""
assert_all_arrays_have_same_size([label_id_array, object_mid_array, text_array])
issues = [
IssueToCreateUseCaseInput(label_id=label_id, object_mid=object_mid, text=text)
for (label_id, object_mid, text) in zip(
label_id_array,
object_mid_array or repeat(None),
text_array or repeat(None),
)
]
issue_service = IssueUseCases(self.kili_api_gateway)
issue_ids = issue_service.create_issues(project_id=project_id, issues=issues)
return [{"id": issue_id} for issue_id in issue_ids]
create_issues(self, project_id, label_id_array, object_mid_array=None, text_array=None)
Create an issue.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id |
str |
Id of the project. |
required |
label_id_array |
List[str] |
List of Ids of the labels to add an issue to. |
required |
object_mid_array |
Optional[List[Union[str, NoneType]]] |
List of mids of the objects in the labels to associate the issues to. |
None |
text_array |
Optional[List[Union[str, NoneType]]] |
List of texts to associate to the issues. |
None |
Returns:
Type | Description |
---|---|
List[Dict[Literal['id'], str]] |
A list of dictionaries with the |
Source code in kili/presentation/client/issue.py
def create_issues(
self,
project_id: str,
label_id_array: List[str],
object_mid_array: Optional[List[Optional[str]]] = None,
text_array: Optional[List[Optional[str]]] = None,
) -> List[Dict[Literal["id"], str]]:
"""Create an issue.
Args:
project_id: Id of the project.
label_id_array: List of Ids of the labels to add an issue to.
object_mid_array: List of mids of the objects in the labels to associate the issues to.
text_array: List of texts to associate to the issues.
Returns:
A list of dictionaries with the `id` key of the created issues.
"""
assert_all_arrays_have_same_size([label_id_array, object_mid_array, text_array])
issues = [
IssueToCreateUseCaseInput(label_id=label_id, object_mid=object_mid, text=text)
for (label_id, object_mid, text) in zip(
label_id_array,
object_mid_array or repeat(None),
text_array or repeat(None),
)
]
issue_service = IssueUseCases(self.kili_api_gateway)
issue_ids = issue_service.create_issues(project_id=project_id, issues=issues)
return [{"id": issue_id} for issue_id in issue_ids]