@@ -1191,6 +1191,33 @@ def get_issue_labels(self, issue_key):
1191
1191
return self .get (url )
1192
1192
return (self .get (url ) or {}).get ("fields" ).get ("labels" )
1193
1193
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" : label } for label 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" : label } for label in labels ]
1219
+ return self .update_issue (issue_key , {"update" : {"labels" : labels }})
1220
+
1194
1221
def add_attachment (self , issue_key , filename ):
1195
1222
"""
1196
1223
Add attachment to Issue
0 commit comments