Skip to content

Commit 552186d

Browse files
authored
Merge pull request #101 from alex89200/master
Add function to get issue watchers
2 parents 23a4c63 + cb955f9 commit 552186d

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/Issue/IssueService.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,28 @@ public function getCustomFields($priorityId)
616616
return $prio;
617617
}
618618

619+
/**
620+
* get watchers.
621+
*
622+
* @param $issueIdOrKey
623+
*
624+
* @return Watcher[]
625+
*/
626+
public function getWatchers($issueIdOrKey)
627+
{
628+
$this->log->addInfo("getWatchers=\n");
629+
630+
$url = $this->uri."/$issueIdOrKey/watchers";
631+
632+
$ret = $this->exec($url, null);
633+
634+
$watchers = $this->json_mapper->mapArray(
635+
json_decode($ret, false)->watchers, new \ArrayObject(), '\JiraRestApi\Issue\Watcher'
636+
);
637+
638+
return $watchers;
639+
}
640+
619641
/**
620642
* add watcher to issue.
621643
*

src/Issue/Watcher.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ class Watcher implements \JsonSerializable
1313

1414
/** @var string */
1515
public $name;
16+
/** @var string */
17+
public $displayName;
18+
/** @var string */
19+
public $emailAddress;
20+
/** @var bool */
21+
public $active;
1622

1723
public function __construct($name)
1824
{

0 commit comments

Comments
 (0)