1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Part of the Joomla Framework Github Package |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. |
6
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Joomla\Github\Package\Issues; |
10
|
|
|
|
11
|
|
|
use Joomla\Github\AbstractPackage; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* GitHub API Issues Events class for the Joomla Framework. |
15
|
|
|
* |
16
|
|
|
* Records various events that occur around an Issue or Pull Request. |
17
|
|
|
* This is useful both for display on issue/pull request information pages and also |
18
|
|
|
* to determine who should be notified of comments. |
19
|
|
|
* |
20
|
|
|
* @documentation http://developer.github.com/v3/issues/events/ |
21
|
|
|
* |
22
|
|
|
* @since 1.0 |
23
|
|
|
*/ |
24
|
|
|
class Events extends AbstractPackage |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* List events for an issue. |
28
|
|
|
* |
29
|
|
|
* @param string $owner The name of the owner of the GitHub repository. |
30
|
|
|
* @param string $repo The name of the GitHub repository. |
31
|
|
|
* @param integer $issue_number The issue number. |
32
|
|
|
* @param integer $page The page number from which to get items. |
33
|
|
|
* @param integer $limit The number of items on a page. |
34
|
|
|
* |
35
|
|
|
* @return object |
36
|
|
|
*/ |
37
|
|
|
public function getList($owner, $repo, $issue_number, $page = 0, $limit = 0) |
38
|
|
|
{ |
39
|
|
|
// Build the request path. |
40
|
|
|
$path = '/repos/' . $owner . '/' . $repo . '/issues/' . (int) $issue_number . '/events'; |
41
|
|
|
|
42
|
|
|
// Send the request. |
43
|
|
|
return $this->processResponse( |
44
|
|
|
$this->client->get($this->fetchUrl($path, $page, $limit)) |
45
|
|
|
); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* List events for a repository. |
50
|
|
|
* |
51
|
|
|
* @param string $owner The name of the owner of the GitHub repository. |
52
|
|
|
* @param string $repo The name of the GitHub repository. |
53
|
|
|
* @param integer $issueId The issue number. |
54
|
|
|
* @param integer $page The page number from which to get items. |
55
|
|
|
* @param integer $limit The number of items on a page. |
56
|
|
|
* |
57
|
|
|
* @return object |
58
|
|
|
*/ |
59
|
|
|
public function getListRepository($owner, $repo, $issueId, $page = 0, $limit = 0) |
60
|
|
|
{ |
61
|
|
|
// Build the request path. |
62
|
|
|
$path = '/repos/' . $owner . '/' . $repo . '/issues/' . (int) $issueId . '/comments'; |
63
|
|
|
|
64
|
|
|
// Send the request. |
65
|
|
|
return $this->processResponse( |
66
|
|
|
$this->client->get($this->fetchUrl($path, $page, $limit)) |
67
|
|
|
); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Get a single event. |
72
|
|
|
* |
73
|
|
|
* @param string $owner The name of the owner of the GitHub repository. |
74
|
|
|
* @param string $repo The name of the GitHub repository. |
75
|
|
|
* @param integer $id The event number. |
76
|
|
|
* |
77
|
|
|
* @return object |
78
|
|
|
*/ |
79
|
|
|
public function get($owner, $repo, $id) |
80
|
|
|
{ |
81
|
|
|
// Build the request path. |
82
|
|
|
$path = '/repos/' . $owner . '/' . $repo . '/issues/events/' . (int) $id; |
83
|
|
|
|
84
|
|
|
// Send the request. |
85
|
|
|
return $this->processResponse( |
86
|
|
|
$this->client->get($this->fetchUrl($path)) |
87
|
|
|
); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|