@@ -1191,6 +1191,33 @@ 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+ def label_issue (self , issue_key , labels ):
1204+ """
1205+ :param issue: the issue to update
1206+ :param labels: the labels to add
1207+ :return: True if successful, False if not
1208+ """
1209+ labels = [{"add" : l } for l in labels ]
1210+ return self .update_issue (issue_key , {"update" : {"labels" : labels }})
1211+
1212+ def unlabel_issue (self , issue_key , labels ):
1213+ """
1214+ :param issue: the issue to update
1215+ :param labels: the labels to remove
1216+ :return: True if successful, False if not
1217+ """
1218+ labels = [{"remove" : l } for l in labels ]
1219+ return self .update_issue (issue_key , {"update" : {"labels" : labels }})
1220+
11941221 def add_attachment (self , issue_key , filename ):
11951222 """
11961223 Add attachment to Issue
0 commit comments