Skip to content

Commit cfcd157

Browse files
committed
Improved Issue handling
1 parent 77579ca commit cfcd157

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

src/perisso/tapir_commands.py

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,12 +1690,17 @@ def GetView2DTransformations(
16901690

16911691
# endregion
16921692
# region Issue Management Commands
1693-
def CreateIssue(self, name: str, parentIssueId: str, tagText: str = None) -> dict:
1693+
def CreateIssue(
1694+
self,
1695+
name: str,
1696+
parentIssueId: str = "00000000-0000-0000-0000-000000000000",
1697+
tagText: str = None,
1698+
) -> dict:
16941699
"""Creates a new issue.
16951700
16961701
Args:
1697-
name (`str`): The name of the issue.
1698-
parentIssueId (`str`): The identifier of an issue.
1702+
name (*`str`): The name of the issue.
1703+
parentIssueId (`str`): The GUID of an existing issue to nest the issue into.
16991704
tagText (`str`): Tag text of the issue, optional.
17001705
"""
17011706
name_ = inspect.currentframe().f_code.co_name
@@ -1712,10 +1717,11 @@ def DeleteIssue(self, issueId: str, acceptAllElements: bool = False) -> dict:
17121717
params = {"issueId": {"guid": issueId}, "acceptAllElements": acceptAllElements}
17131718
return self._run(name_, params)
17141719

1715-
def GetIssues(self) -> Dict[str, Any]:
1716-
"""Retrieves information about existing issues."""
1720+
def GetIssues(self) -> List[Dict]:
1721+
"""Retrieves information about existing issues.\n
1722+
This command has no arguments."""
17171723
name_ = inspect.currentframe().f_code.co_name
1718-
return self._run(name_)
1724+
return self._run(name_)["issues"]
17191725

17201726
def AddCommentToIssue(
17211727
self, issueId, text: str, author: str = "", status: str = "Unknown"
@@ -1746,12 +1752,26 @@ def DetachElementsFromIssue(
17461752
return self._run(name_, params)
17471753

17481754
def GetElementsAttachedToIssue(
1749-
self, issueId: str, elements: "ElementCollection" | List[Dict[str, str]]
1750-
) -> Dict[str, Any]:
1751-
"""Retrieves attached elements of the specified issue, filtered by attachment type."""
1755+
self,
1756+
issueId: str,
1757+
type: Literal["Creation", "Highlight", "Deletion", "Modification"],
1758+
) -> List[str]:
1759+
"""Retrieves attached elements of the specified issue, filtered by attachment type.
1760+
1761+
Args:
1762+
issueID (*`str`): The GUID of the Issue.
1763+
type (*`Literal`): The attachment type of the elements you want to retrieve.
1764+
1765+
Returns:
1766+
Gives a back a list with GUIDs of the elements associated to the issue.
1767+
"""
17521768
name_ = inspect.currentframe().f_code.co_name
1753-
params = {"issueId": {"guid": issueId}, "elements": _ensure_elem_list(elements)}
1754-
return self._run(name_, params)
1769+
params = {"issueId": {"guid": issueId}, "type": type}
1770+
_elem = self._run(name_, params)["elements"]
1771+
guids = []
1772+
for e in _elem:
1773+
guids.append(e["elementId"]["guid"])
1774+
return guids
17551775

17561776
def ExportIssuesToBCF(
17571777
self,

0 commit comments

Comments
 (0)