File tree Expand file tree Collapse file tree 3 files changed +153
-0
lines changed
Expand file tree Collapse file tree 3 files changed +153
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace JiraRestApi \IssueLink ;
4+
5+ use JiraRestApi \ClassSerialize ;
6+
7+ class IssueLink implements \JsonSerializable
8+ {
9+ use ClassSerialize;
10+
11+ public function jsonSerialize ()
12+ {
13+ $ vars = array_filter (get_object_vars ($ this ));
14+
15+ return $ vars ;
16+ }
17+
18+ /**
19+ * @param $typeName issue type string(ex: 'Duplicate')
20+ * @return $this
21+ */
22+ public function setLinkTypeName ($ typeName )
23+ {
24+ $ this ->type ['name ' ] = $ typeName ;
25+
26+ return $ this ;
27+ }
28+
29+ /**
30+ * @param $issueKey inward issue key or id
31+ * @return $this
32+ */
33+ public function setInwardIssue ($ issueKey )
34+ {
35+ $ this ->inwardIssue ['key ' ] = $ issueKey ;
36+
37+ return $ this ;
38+ }
39+
40+ /**
41+ * @param $issueKey out ward issue key or id
42+ * @return $this
43+ */
44+ public function setOutwardIssue ($ issueKey )
45+ {
46+ $ this ->outwardIssue ['key ' ] = $ issueKey ;
47+
48+ return $ this ;
49+ }
50+
51+ public function setComments ($ comment )
52+ {
53+ $ this ->comment = $ comment ;
54+
55+ return $ this ;
56+ }
57+
58+ /** @var array */
59+ public $ type ;
60+
61+ /** @var \JiraRestApi\Issue\Issue */
62+ public $ inwardIssue ;
63+
64+ /** @var \JiraRestApi\Issue\Issue */
65+ public $ outwardIssue ;
66+
67+ /** @var \JiraRestApi\Issue\Comment */
68+ public $ comment ;
69+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace JiraRestApi \IssueLink ;
4+
5+ use JiraRestApi \JiraException ;
6+
7+ class IssueLinkService extends \JiraRestApi \JiraClient
8+ {
9+ private $ uri = '' ;
10+
11+ public function addIssueLink ($ issueLink )
12+ {
13+ $ this ->log ->addInfo ("addIssueLink= \n" );
14+
15+ $ data = json_encode ($ issueLink );
16+
17+ $ this ->log ->addDebug ("Create IssueLink= \n" .$ data );
18+
19+ $ url = $ this ->uri . "/issueLink " ;
20+ $ type = 'POST ' ;
21+
22+ $ ret = $ this ->exec ($ url , $ data , $ type );
23+
24+ $ this ->log ->addDebug ('add issue link result= ' .var_export ($ ret , true ));
25+ //$comment = $this->json_mapper->map(
26+ // json_decode($ret), new Comment()
27+ //);
28+
29+ return $ this ->http_response === 201 ? true : 'qqq ' ;
30+ //https://docs.atlassian.com/jira/REST/server/#api/2/issueLink-linkIssues
31+ }
32+
33+ public function getIssueLinkTypes ()
34+ {
35+ $ this ->log ->addInfo ("getIssueLinkTYpes= \n" );
36+
37+ $ url = $ this ->uri . "/issueLinkType " ;
38+
39+ $ ret = $ this ->exec ($ url );
40+
41+ $ linkTypes = $ this ->json_mapper ->mapArray (
42+ json_decode ($ ret ), new \ArrayObject (), '\JiraRestApi\IssueLink\IssueLinkType '
43+ );
44+
45+ return $ linkTypes ;
46+ }
47+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace JiraRestApi \IssueLink ;
4+
5+ use JiraRestApi \ClassSerialize ;
6+
7+ /**
8+ * Class IssueLinkType
9+ * @package JiraRestApi\Issue
10+ * @see https://docs.atlassian.com/jira/REST/server/#api/2/issueLinkType-createIssueLinkType
11+ */
12+ class IssueLinkType implements \JsonSerializable
13+ {
14+ use ClassSerialize;
15+
16+ public function jsonSerialize ()
17+ {
18+ $ vars = array_filter (get_object_vars ($ this ));
19+
20+ return $ vars ;
21+ }
22+
23+ /** @var integer */
24+ public $ id ;
25+
26+ /** @var string */
27+ public $ name ;
28+
29+ /** @var string */
30+ public $ inward ;
31+
32+ /** @var string */
33+ public $ outward ;
34+
35+ /** @var string */
36+ public $ self ;
37+ }
You can’t perform that action at this time.
0 commit comments