@@ -1082,13 +1082,7 @@ def issue(self, key, fields="*all", expand=None):
1082
1082
params ["expand" ] = expand
1083
1083
return self .get (url , params = params )
1084
1084
1085
- def get_issue (
1086
- self ,
1087
- issue_id_or_key ,
1088
- fields = None ,
1089
- properties = None ,
1090
- update_history = True ,
1091
- ):
1085
+ def get_issue (self , issue_id_or_key , fields = None , properties = None , update_history = True , expand = None ):
1092
1086
"""
1093
1087
Returns a full representation of the issue for the given issue key
1094
1088
By default, all fields are returned in this get-issue resource
@@ -1097,6 +1091,7 @@ def get_issue(
1097
1091
:param fields: str
1098
1092
:param properties: str
1099
1093
:param update_history: bool
1094
+ :param expand: str
1100
1095
:return: issue
1101
1096
"""
1102
1097
base_url = self .resource_url ("issue" )
@@ -1109,11 +1104,9 @@ def get_issue(
1109
1104
params ["fields" ] = fields
1110
1105
if properties is not None :
1111
1106
params ["properties" ] = properties
1112
- if update_history is True :
1113
- params ["updateHistory" ] = "true"
1114
- if update_history is False :
1115
- params ["updateHistory" ] = "false"
1116
-
1107
+ if expand :
1108
+ params ["expand" ] = expand
1109
+ params ["updateHistory" ] = str (update_history ).lower ()
1117
1110
return self .get (url , params = params )
1118
1111
1119
1112
def epic_issues (self , epic , fields = "*all" , expand = None ):
@@ -1867,6 +1860,20 @@ def set_issue_status(self, issue_key, status_name, fields=None, update=None):
1867
1860
data ["update" ] = update
1868
1861
return self .post (url , data = data )
1869
1862
1863
+ def get_issue_status_changelog (self , issue_id ):
1864
+ # Get the issue details with changelog
1865
+ response_get_issue = self .get_issue (issue_id , expand = "changelog" )
1866
+ status_change_history = []
1867
+ for history in response_get_issue ["changelog" ]["histories" ]:
1868
+ for item in history ["items" ]:
1869
+ # Check if the item is a status change
1870
+ if item ["field" ] == "status" :
1871
+ status_change_history .append (
1872
+ {"from" : item ["fromString" ], "to" : item ["toString" ], "date" : history ["created" ]}
1873
+ )
1874
+
1875
+ return status_change_history
1876
+
1870
1877
def set_issue_status_by_transition_id (self , issue_key , transition_id ):
1871
1878
"""
1872
1879
Setting status by transition_id
0 commit comments