Skip to content

Commit e1c9865

Browse files
author
CobbleCity
authored
Added change assignee and delete method
- Added a method to delete issues - Added a mathod to update the assignee field, if the field is not in the edit dialog of the project (see https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue - Quote: "If a field is not configured to appear on the edit screen, then it will not be in the editmeta, and a field validation error will occur if it is submitted; however connect add-on with admin scope are able to override the screen security."
1 parent f543216 commit e1c9865

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/Issue/IssueService.php

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,44 @@ public function addComment($issueIdOrKey, $comment)
203203

204204
return $comment;
205205
}
206-
206+
207+
/**
208+
* Change a issue assignee
209+
*
210+
* @param issueIdOrKey Issue id or key
211+
* @param assignee array of assigne field informations
212+
*
213+
*/
214+
public function changeAssignee($issueIdOrKey, $assignee)
215+
{
216+
$this->log->addInfo("changeAssignee=\n");
217+
218+
$data = json_encode($assignee);
219+
220+
$ret = $this->exec($this->uri."/$issueIdOrKey/assignee", $data, 'PUT');
221+
222+
$this->log->addInfo('change assignee of '.$issueIdOrKey.' to '.json_encode($assignee).' result='.var_export($ret, true));
223+
224+
return $ret;
225+
}
226+
227+
/**
228+
* Delete a issue.
229+
*
230+
* @param issueIdOrKey Issue id or key
231+
*
232+
*/
233+
public function deleteIssue($issueIdOrKey)
234+
{
235+
$this->log->addInfo("deleteIssue=\n");
236+
237+
$ret = $this->exec($this->uri."/$issueIdOrKey", '', 'DELETE');
238+
239+
$this->log->addInfo('delete issue '.$issueIdOrKey.' result='.var_export($ret, true));
240+
241+
return $ret;
242+
}
243+
207244
/**
208245
* Get a list of the transitions possible for this issue by the current user, along with fields that are required and their types.
209246
*

0 commit comments

Comments
 (0)