|
2 | 2 |
|
3 | 3 | namespace Github\Api; |
4 | 4 |
|
5 | | -use Github\Api\AcceptHeaderTrait; |
| 5 | +@trigger_error('The '.__NAMESPACE__.'\Integrations class is deprecated. Use the '.__NAMESPACE__.'\Apps class instead.', E_USER_DEPRECATED); |
6 | 6 |
|
7 | 7 | /** |
8 | | - * @link https://developer.github.com/v3/integrations/ |
| 8 | + * @deprecated Use the Apps class |
| 9 | + * @link https://developer.github.com/v3/apps/ |
9 | 10 | * @author Nils Adermann <naderman@naderman.de> |
10 | 11 | */ |
11 | | -class Integrations extends AbstractApi |
| 12 | +class Integrations extends Apps |
12 | 13 | { |
13 | | - use AcceptHeaderTrait; |
14 | | - |
15 | 14 | /** |
16 | | - * Configure the accept header for Early Access to the integrations api |
| 15 | + * @deprecated |
| 16 | + * Configure the accept header for Early Access to the integrations api (DEPRECATED) |
17 | 17 | * |
18 | | - * @see https://developer.github.com/v3/integrations/ |
| 18 | + * @see https://developer.github.com/v3/apps/ |
19 | 19 | * |
20 | 20 | * @return self |
21 | 21 | */ |
22 | 22 | public function configure() |
23 | 23 | { |
24 | | - $this->acceptHeaderValue = 'application/vnd.github.machine-man-preview+json'; |
25 | | - |
26 | 24 | return $this; |
27 | 25 | } |
28 | | - |
29 | | - /** |
30 | | - * Create an access token for an installation |
31 | | - * |
32 | | - * @param int $installationId An integration installation id |
33 | | - * @param int $userId An optional user id on behalf of whom the |
34 | | - * token will be requested |
35 | | - * |
36 | | - * @return array token and token metadata |
37 | | - */ |
38 | | - public function createInstallationToken($installationId, $userId = null) |
39 | | - { |
40 | | - $parameters = array(); |
41 | | - if ($userId) { |
42 | | - $parameters['user_id'] = $userId; |
43 | | - } |
44 | | - |
45 | | - return $this->post('/installations/'.rawurlencode($installationId).'/access_tokens', $parameters); |
46 | | - } |
47 | | - |
48 | | - /** |
49 | | - * Find all installations for the authenticated integration. |
50 | | - * |
51 | | - * @link https://developer.github.com/v3/integrations/#find-installations |
52 | | - * |
53 | | - * @return array |
54 | | - */ |
55 | | - public function findInstallations() |
56 | | - { |
57 | | - return $this->get('/integration/installations'); |
58 | | - } |
59 | | - |
60 | | - /** |
61 | | - * List repositories that are accessible to the authenticated installation. |
62 | | - * |
63 | | - * @link https://developer.github.com/v3/integrations/installations/#list-repositories |
64 | | - * |
65 | | - * @param int $userId |
66 | | - * |
67 | | - * @return array |
68 | | - */ |
69 | | - public function listRepositories($userId = null) |
70 | | - { |
71 | | - $parameters = array(); |
72 | | - if ($userId) { |
73 | | - $parameters['user_id'] = $userId; |
74 | | - } |
75 | | - |
76 | | - return $this->get('/installation/repositories', $parameters); |
77 | | - } |
78 | | - |
79 | | - /** |
80 | | - * Add a single repository to an installation. |
81 | | - * |
82 | | - * @link https://developer.github.com/v3/integrations/installations/#add-repository-to-installation |
83 | | - * |
84 | | - * @param int $installationId |
85 | | - * @param int $repositoryId |
86 | | - * |
87 | | - * @return array |
88 | | - */ |
89 | | - public function addRepository($installationId, $repositoryId) |
90 | | - { |
91 | | - return $this->put('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); |
92 | | - } |
93 | | - |
94 | | - /** |
95 | | - * Remove a single repository from an installation. |
96 | | - * |
97 | | - * @link https://developer.github.com/v3/integrations/installations/#remove-repository-from-installation |
98 | | - * |
99 | | - * @param int $installationId |
100 | | - * @param int $repositoryId |
101 | | - * |
102 | | - * @return array |
103 | | - */ |
104 | | - public function removeRepository($installationId, $repositoryId) |
105 | | - { |
106 | | - return $this->delete('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); |
107 | | - } |
108 | 26 | } |
0 commit comments