|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace JiraRestApi\Version; |
| 4 | + |
| 5 | +use JiraRestApi\Issue\IssueType; |
| 6 | +use JiraRestApi\Issue\Reporter; |
| 7 | +use JiraRestApi\Issue\Version; |
| 8 | +use JiraRestApi\JiraException; |
| 9 | +use JiraRestApi\Project\ProjectService; |
| 10 | + |
| 11 | +class VersionService extends \JiraRestApi\JiraClient |
| 12 | +{ |
| 13 | + private $uri = '/version'; |
| 14 | + |
| 15 | + /** |
| 16 | + * create version |
| 17 | + * |
| 18 | + * @see https://docs.atlassian.com/jira/REST/server/#api/2/version-createVersion |
| 19 | + * |
| 20 | + */ |
| 21 | + public function create($version) |
| 22 | + { |
| 23 | + throw new JiraException("create version not yet implemented"); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * Modify a version's sequence within a project. |
| 28 | + * |
| 29 | + * @param $version |
| 30 | + * @throws JiraException |
| 31 | + */ |
| 32 | + public function move($version) |
| 33 | + { |
| 34 | + throw new JiraException("move version not yet implemented"); |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * get project version |
| 39 | + * |
| 40 | + * @param $id version id |
| 41 | + * |
| 42 | + * @return Version |
| 43 | + * |
| 44 | + * @see ProjectService::getVersions() |
| 45 | + */ |
| 46 | + public function get($id) |
| 47 | + { |
| 48 | + $ret = $this->exec($this->uri.'/'.$id); |
| 49 | + |
| 50 | + $this->log->addInfo('Result='.$ret); |
| 51 | + |
| 52 | + $json = json_decode($ret); |
| 53 | + $results = array_map(function ($elem) { |
| 54 | + return $this->json_mapper->map($elem, new ProjectType()); |
| 55 | + }, $json); |
| 56 | + |
| 57 | + return $results; |
| 58 | + } |
| 59 | + |
| 60 | + public function update($ver) |
| 61 | + { |
| 62 | + throw new JiraException("update version not yet implemented"); |
| 63 | + } |
| 64 | + |
| 65 | + public function delete($ver) |
| 66 | + { |
| 67 | + throw new JiraException("delete version not yet implemented"); |
| 68 | + } |
| 69 | + |
| 70 | + public function merge($ver) |
| 71 | + { |
| 72 | + throw new JiraException("merge version not yet implemented"); |
| 73 | + } |
| 74 | + |
| 75 | + |
| 76 | + /** |
| 77 | + * Returns a bean containing the number of fixed in and affected issues for the given version. |
| 78 | + * |
| 79 | + * @param $id int version id |
| 80 | + * |
| 81 | + * @throws JiraException |
| 82 | + * |
| 83 | + * @see https://docs.atlassian.com/jira/REST/server/#api/2/version-getVersionRelatedIssues |
| 84 | + */ |
| 85 | + public function getRelatedIssues($id) |
| 86 | + { |
| 87 | + throw new JiraException("get version Related Issues not yet implemented"); |
| 88 | + } |
| 89 | +} |
0 commit comments