diff --git a/src/Board/BoardService.php b/src/Board/BoardService.php index 2f209101..0d638b9d 100644 --- a/src/Board/BoardService.php +++ b/src/Board/BoardService.php @@ -4,6 +4,7 @@ use JiraRestApi\Configuration\ConfigurationInterface; use JiraRestApi\Issue\Issue; +use JiraRestApi\Sprint\Sprint; use Psr\Log\LoggerInterface; class BoardService extends \JiraRestApi\JiraClient @@ -17,13 +18,13 @@ public function __construct(ConfigurationInterface $configuration = null, Logger } /** - * get all project list. + * get all boards list. * * @param array $paramArray * * @throws \JiraRestApi\JiraException * - * @return Project[] array of Project class + * @return Board[] array of Board class */ public function getBoardList($paramArray = []) { @@ -48,10 +49,22 @@ public function getBoard($id, $paramArray = []) public function getBoardIssues($id, $paramArray = []) { $json = $this->exec($this->uri.'/'.$id.'/issue'.$this->toHttpQueryParameter($paramArray), null); - $board = $this->json_mapper->mapArray( + $issues = $this->json_mapper->mapArray( json_decode($json)->issues, new \ArrayObject(), Issue::class ); - return $board; + return $issues; + } + + public function getBoardSprints($boardId, $paramArray = []) + { + $json = $this->exec($this->uri.'/'.$boardId.'/sprint'.$this->toHttpQueryParameter($paramArray), null); + $sprints = $this->json_mapper->mapArray( + json_decode($json)->values, + new \ArrayObject(), + Sprint::class + ); + + return $sprints; } } diff --git a/src/Sprint/SprintService.php b/src/Sprint/SprintService.php index b81a5882..80785c80 100644 --- a/src/Sprint/SprintService.php +++ b/src/Sprint/SprintService.php @@ -9,6 +9,7 @@ namespace JiraRestApi\Sprint; use JiraRestApi\Configuration\ConfigurationInterface; +use JiraRestApi\Issue\Issue; use JiraRestApi\JiraClient; use JiraRestApi\JiraException; use Psr\Log\LoggerInterface; @@ -53,4 +54,17 @@ public function getSprint($sprintId) json_decode($ret), new Sprint() ); } + + public function getSprintIssues($sprintId, $paramArray = []) + { + $json = $this->exec($this->uri.'/'.$sprintId.'/issue'.$this->toHttpQueryParameter($paramArray), null); + + $issues = $this->json_mapper->mapArray( + json_decode($json)->issues, + new \ArrayObject(), + Issue::class + ); + + return $issues; + } }