1 | <?php |
||
24 | class Authorization extends AbstractPackage |
||
25 | { |
||
26 | /** |
||
27 | * Method to create an authorization. |
||
28 | * |
||
29 | * @param array $scopes A list of scopes that this authorization is in. |
||
30 | * @param string $note A note to remind you what the OAuth token is for. |
||
31 | * @param string $url A URL to remind you what app the OAuth token is for. |
||
32 | * |
||
33 | * @return object |
||
34 | * |
||
35 | * @since 1.0 |
||
36 | * @throws \DomainException |
||
37 | */ |
||
38 | public function create(array $scopes = array(), $note = '', $url = '') |
||
50 | |||
51 | /** |
||
52 | * Method to delete an authorization |
||
53 | * |
||
54 | * @param integer $id ID of the authorization to delete |
||
55 | * |
||
56 | * @return object |
||
57 | * |
||
58 | * @since 1.0 |
||
59 | * @throws \DomainException |
||
60 | */ |
||
61 | public function delete($id) |
||
69 | |||
70 | /** |
||
71 | * Delete a grant |
||
72 | * |
||
73 | * Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. |
||
74 | * |
||
75 | * @param integer $id ID of the authorization to delete |
||
76 | * |
||
77 | * @return object |
||
78 | * |
||
79 | * @since 1.5.0 |
||
80 | * @throws \DomainException |
||
81 | */ |
||
82 | public function deleteGrant($id) |
||
90 | |||
91 | /** |
||
92 | * Method to edit an authorization. |
||
93 | * |
||
94 | * @param integer $id ID of the authorization to edit |
||
95 | * @param array $scopes Replaces the authorization scopes with these. |
||
96 | * @param array $addScopes A list of scopes to add to this authorization. |
||
97 | * @param array $removeScopes A list of scopes to remove from this authorization. |
||
98 | * @param string $note A note to remind you what the OAuth token is for. |
||
99 | * @param string $url A URL to remind you what app the OAuth token is for. |
||
100 | * |
||
101 | * @return object |
||
102 | * |
||
103 | * @since 1.0 |
||
104 | * @throws \DomainException |
||
105 | * @throws \RuntimeException |
||
106 | */ |
||
107 | public function edit($id, array $scopes = array(), array $addScopes = array(), array $removeScopes = array(), $note = '', $url = '') |
||
155 | |||
156 | /** |
||
157 | * Method to get details about an authorised application for the authenticated user. |
||
158 | * |
||
159 | * @param integer $id ID of the authorization to retrieve |
||
160 | * |
||
161 | * @return object |
||
162 | * |
||
163 | * @since 1.0 |
||
164 | * @throws \DomainException |
||
165 | */ |
||
166 | public function get($id) |
||
174 | |||
175 | /** |
||
176 | * Get a single grant |
||
177 | * |
||
178 | * @param integer $id ID of the authorization to retrieve |
||
179 | * |
||
180 | * @return object |
||
181 | * |
||
182 | * @since 1.5.0 |
||
183 | * @throws \DomainException |
||
184 | */ |
||
185 | public function getGrant($id) |
||
193 | |||
194 | /** |
||
195 | * Method to get the authorised applications for the authenticated user. |
||
196 | * |
||
197 | * @return object |
||
198 | * |
||
199 | * @since 1.0 |
||
200 | * @throws \DomainException |
||
201 | */ |
||
202 | public function getList() |
||
210 | |||
211 | /** |
||
212 | * List your grants. |
||
213 | * |
||
214 | * You can use this API to list the set of OAuth applications that have been granted access to your account. |
||
215 | * |
||
216 | * @return object |
||
217 | * |
||
218 | * @since 1.5.0 |
||
219 | * @throws \DomainException |
||
220 | */ |
||
221 | public function getListGrants() |
||
229 | |||
230 | /** |
||
231 | * Method to get the rate limit for the authenticated user. |
||
232 | * |
||
233 | * @return object Returns an object with the properties of `limit` and `remaining`. If there is no limit, the |
||
234 | * `limit` property will be false. |
||
235 | * |
||
236 | * @since 1.0 |
||
237 | * @throws UnexpectedResponseException |
||
238 | */ |
||
239 | public function getRateLimit() |
||
263 | |||
264 | /** |
||
265 | * 1. Request authorization on GitHub. |
||
266 | * |
||
267 | * @param string $client_id The client ID you received from GitHub when you registered. |
||
268 | * @param string $redirect_uri URL in your app where users will be sent after authorization. |
||
269 | * @param string $scope Comma separated list of scopes. |
||
270 | * @param string $state An unguessable random string. It is used to protect against |
||
271 | * cross-site request forgery attacks. |
||
272 | * |
||
273 | * @return string |
||
274 | * |
||
275 | * @since 1.0 |
||
276 | */ |
||
277 | public function getAuthorizationLink($client_id, $redirect_uri = '', $scope = '', $state = '') |
||
300 | |||
301 | /** |
||
302 | * 2. Request the access token. |
||
303 | * |
||
304 | * @param string $client_id The client ID you received from GitHub when you registered. |
||
305 | * @param string $client_secret The client secret you received from GitHub when you registered. |
||
306 | * @param string $code The code you received as a response to Step 1. |
||
307 | * @param string $redirect_uri URL in your app where users will be sent after authorization. |
||
308 | * @param string $format The response format (json, xml, ). |
||
309 | * |
||
310 | * @return string |
||
311 | * |
||
312 | * @since 1.0 |
||
313 | * @throws \UnexpectedValueException |
||
314 | */ |
||
315 | public function requestToken($client_id, $client_secret, $code, $redirect_uri = '', $format = '') |
||
354 | |||
355 | /** |
||
356 | * Revoke a grant for an application |
||
357 | * |
||
358 | * OAuth application owners can revoke a grant for their OAuth application and a specific user. |
||
359 | * |
||
360 | * @param integer $clientId The application client ID |
||
361 | * @param integer $accessToken The access token to revoke |
||
362 | * |
||
363 | * @return object |
||
364 | * |
||
365 | * @since 1.5.0 |
||
366 | * @throws \DomainException |
||
367 | */ |
||
368 | public function revokeGrantForApplication($clientId, $accessToken) |
||
376 | } |
||
377 |