File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Github \Api ;
4
+
5
+ /**
6
+ * @link https://developer.github.com/early-access/integrations/authentication/
7
+ * @author Nils Adermann <[email protected] >
8
+ */
9
+ class Installations extends AbstractApi
10
+ {
11
+ /**
12
+ * Create an access token for an installation
13
+ *
14
+ * @param int $installationId An integration installation id
15
+ * @param int $userId An optional user id on behalf of whom the
16
+ * token will be requested
17
+ *
18
+ * @return array token and token metadata
19
+ */
20
+ public function createAccessToken ($ installationId , $ userId = null )
21
+ {
22
+ $ parameters = array ();
23
+ if ($ userId ) {
24
+ $ paramters ['user_id ' ] = $ userId ;
25
+ }
26
+ return $ this ->post ('/installations/ ' .rawurlencode ($ installationId ).'/access_tokens ' , $ parameters );
27
+ }
28
+ }
Original file line number Diff line number Diff line change @@ -210,6 +210,11 @@ public function api($name)
210
210
$ api = new Api \Gists ($ this );
211
211
break ;
212
212
213
+ case 'installation ' :
214
+ case 'installations ' :
215
+ $ api = new Api \Installations ($ this );
216
+ break ;
217
+
213
218
case 'issue ' :
214
219
case 'issues ' :
215
220
$ api = new Api \Issue ($ this );
You can’t perform that action at this time.
0 commit comments