@@ -1191,6 +1191,34 @@ def get_issue_labels(self, issue_key):
11911191 return self .get (url )
11921192 return (self .get (url ) or {}).get ("fields" ).get ("labels" )
11931193
1194+ def update_issue (self , issue_key , update ):
1195+ """
1196+ :param issue: the issue to update
1197+ :param update: the update to make
1198+ :return: True if successful, False if not
1199+ """
1200+ endpoint = "/rest/api/2/issue/{issue_key}" .format (issue_key = issue_key )
1201+ return self .put (endpoint , data = update )
1202+
1203+
1204+ def label_issue (self , issue_key , labels ):
1205+ """
1206+ :param issue: the issue to update
1207+ :param labels: the labels to add
1208+ :return: True if successful, False if not
1209+ """
1210+ labels = [{"add" : l } for l in labels ]
1211+ return self .update_issue (issue_key , {"update" : {"labels" : labels }})
1212+
1213+ def unlabel_issue (self , issue_key , labels ):
1214+ """
1215+ :param issue: the issue to update
1216+ :param labels: the labels to remove
1217+ :return: True if successful, False if not
1218+ """
1219+ labels = [{"remove" : l } for l in labels ]
1220+ return self .update_issue (issue_key , {"update" : {"labels" : labels }})
1221+
11941222 def add_attachment (self , issue_key , filename ):
11951223 """
11961224 Add attachment to Issue
0 commit comments