1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage GitHub
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * GitHub API Activity Events class for the Joomla Platform.
14 *
15 * @documentation https://developer.github.com/v3/activity/events/
16 *
17 * @since 3.3 (CMS)
18 * @deprecated 4.0 Use the `joomla/github` package via Composer instead
19 */
20 class JGithubPackageActivityEvents extends JGithubPackage
21 {
22 /**
23 * List public events.
24 *
25 * @since 12.3
26 * @return object
27 */
28 public function getPublic()
29 {
30 // Build the request path.
31 $path = '/events';
32
33 return $this->processResponse(
34 $this->client->get($this->fetchUrl($path))
35 );
36 }
37
38 /**
39 * List repository events.
40 *
41 * @param string $owner Repository owner.
42 * @param string $repo Repository name.
43 *
44 * @since 12.3
45 *
46 * @return object
47 */
48 public function getRepository($owner, $repo)
49 {
50 // Build the request path.
51 $path = '/repos/' . $owner . '/' . $repo . '/events';
52
53 return $this->processResponse(
54 $this->client->get($this->fetchUrl($path))
55 );
56 }
57
58 /**
59 * List issue events for a repository.
60 *
61 * @param string $owner Repository owner.
62 * @param string $repo Repository name.
63 *
64 * @since 12.3
65 * @return object
66 */
67 public function getIssue($owner, $repo)
68 {
69 // Build the request path.
70 $path = '/repos/' . $owner . '/' . $repo . '/issues/events';
71
72 return $this->processResponse(
73 $this->client->get($this->fetchUrl($path))
74 );
75 }
76
77 /**
78 * List public events for a network of repositories.
79 *
80 * @param string $owner Repository owner.
81 * @param string $repo Repository name.
82 *
83 * @since 12.3
84 * @return object
85 */
86 public function getNetwork($owner, $repo)
87 {
88 // Build the request path.
89 $path = '/networks/' . $owner . '/' . $repo . '/events';
90
91 return $this->processResponse(
92 $this->client->get($this->fetchUrl($path))
93 );
94 }
95
96 /**
97 * List public events for an organization.
98 *
99 * @param string $org Organisation.
100 *
101 * @since 12.3
102 * @return object
103 */
104 public function getOrg($org)
105 {
106 // Build the request path.
107 $path = '/orgs/' . $org . '/events';
108
109 return $this->processResponse(
110 $this->client->get($this->fetchUrl($path))
111 );
112 }
113
114 /**
115 * List events that a user has received.
116 *
117 * These are events that you’ve received by watching repos and following users.
118 * If you are authenticated as the given user, you will see private events.
119 * Otherwise, you’ll only see public events.
120 *
121 * @param string $user User name.
122 *
123 * @since 12.3
124 * @return object
125 */
126 public function getUser($user)
127 {
128 // Build the request path.
129 $path = '/users/' . $user . '/received_events';
130
131 return $this->processResponse(
132 $this->client->get($this->fetchUrl($path))
133 );
134 }
135
136 /**
137 * List public events that a user has received.
138 *
139 * @param string $user User name.
140 *
141 * @since 12.3
142 * @return object
143 */
144 public function getUserPublic($user)
145 {
146 // Build the request path.
147 $path = '/users/' . $user . '/received_events/public';
148
149 return $this->processResponse(
150 $this->client->get($this->fetchUrl($path))
151 );
152 }
153
154 /**
155 * List events performed by a user.
156 *
157 * If you are authenticated as the given user, you will see your private events.
158 * Otherwise, you’ll only see public events.
159 *
160 * @param string $user User name.
161 *
162 * @since 12.3
163 * @return object
164 */
165 public function getByUser($user)
166 {
167 // Build the request path.
168 $path = '/users/' . $user . '/events';
169
170 return $this->processResponse(
171 $this->client->get($this->fetchUrl($path))
172 );
173 }
174
175 /**
176 * List public events performed by a user.
177 *
178 * @param string $user User name.
179 *
180 * @since 12.3
181 * @return object
182 */
183 public function getByUserPublic($user)
184 {
185 // Build the request path.
186 $path = '/users/' . $user . '/events/public';
187
188 return $this->processResponse(
189 $this->client->get($this->fetchUrl($path))
190 );
191 }
192
193 /**
194 * List events for an organization.
195 *
196 * This is the user’s organization dashboard.
197 * You must be authenticated as the user to view this.
198 *
199 * @param string $user User name.
200 * @param string $org Organisation.
201 *
202 * @since 12.3
203 * @return object
204 */
205 public function getUserOrg($user, $org)
206 {
207 // Build the request path.
208 $path = '/users/' . $user . '/events/orgs/' . $org;
209
210 return $this->processResponse(
211 $this->client->get($this->fetchUrl($path))
212 );
213 }
214 }
215