@@ -1525,15 +1525,50 @@ def delete_issue(self, issue_id_or_key: str, delete_subtasks: bool = True):
1525
1525
return self .delete (url , params = params )
1526
1526
1527
1527
# @todo merge with edit_issue method
1528
- def issue_update (self , issue_key : str , fields : Union [str , dict ]):
1529
- log .info ('Updating issue "%s" with "%s"' , issue_key , fields )
1528
+ # https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-put
1529
+ def issue_update (
1530
+ self ,
1531
+ issue_key : str ,
1532
+ fields : Union [str , dict ],
1533
+ update : Optional [dict [Any , Any ]] = None ,
1534
+ history_metadata : Optional [dict [Any , Any ]] = None ,
1535
+ properties : Optional [list [Any ]] = None ,
1536
+ notify_users : bool = True ,
1537
+ ):
1538
+ """
1539
+ Updates a Jira issue with specified fields, updates, history metadata, and properties.
1540
+
1541
+
1542
+ :param issue_key: The key or ID of the issue to update.
1543
+ :param fields: A dictionary containing field updates.
1544
+ :param update: A dictionary containing advanced updates (e.g., add/remove operations for labels).
1545
+ :param history_metadata: Metadata for tracking the history of changes.
1546
+ :param properties: A list of properties to add or update on the issue.
1547
+ :param notify_users: Whether to notify users of the update. default: True
1548
+ :return: Response from the PUT request.
1549
+ """
1550
+ log .info (f'Updating issue "{ issue_key } " with "{ fields } ", "{ update } ", "{ history_metadata } ", and "{ properties } "' )
1551
+
1530
1552
base_url = self .resource_url ("issue" )
1531
1553
url = f"{ base_url } /{ issue_key } "
1532
- return self .put (url , data = {"fields" : fields })
1554
+ params = {
1555
+ "fields" : fields ,
1556
+ "update" : update or {},
1557
+ "historyMetadata" : history_metadata or {},
1558
+ "properties" : properties or [],
1559
+ }
1560
+ # Remove empty keys to avoid sending unnecessary data
1561
+ params = {key : value for key , value in params .items () if value }
1562
+ if notify_users is True :
1563
+ params ["notifyUsers" ] = "true"
1564
+ else :
1565
+ params ["notifyUsers" ] = "false"
1566
+ return self .put (url , data = params )
1533
1567
1568
+ # https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-put
1534
1569
def edit_issue (self , issue_id_or_key : str , fields : Union [str , dict ], notify_users : bool = True ):
1535
1570
"""
1536
- Edits an issue from a JSON representation
1571
+ Edits an issue fields from a JSON representation
1537
1572
The issue can either be updated by setting explicit the field
1538
1573
value(s) or by using an operation to change the field value
1539
1574
0 commit comments