1 | <?php |
||
9 | class GitHub extends AbstractService |
||
10 | { |
||
11 | /** |
||
12 | * Defined scopes, see http://developer.github.com/v3/oauth/ for definitions. |
||
13 | */ |
||
14 | |||
15 | /** |
||
16 | * Public read-only access (includes public user profile info, public repo info, and gists) |
||
17 | */ |
||
18 | const SCOPE_READONLY = ''; |
||
19 | |||
20 | /** |
||
21 | * Read/write access to profile info only. |
||
22 | * |
||
23 | * Includes SCOPE_USER_EMAIL and SCOPE_USER_FOLLOW. |
||
24 | */ |
||
25 | const SCOPE_USER = 'user'; |
||
26 | |||
27 | /** |
||
28 | * Read access to a user’s email addresses. |
||
29 | */ |
||
30 | const SCOPE_USER_EMAIL = 'user:email'; |
||
31 | |||
32 | /** |
||
33 | * Access to follow or unfollow other users. |
||
34 | */ |
||
35 | const SCOPE_USER_FOLLOW = 'user:follow'; |
||
36 | |||
37 | /** |
||
38 | * Read/write access to public repos and organizations. |
||
39 | */ |
||
40 | const SCOPE_PUBLIC_REPO = 'public_repo'; |
||
41 | |||
42 | /** |
||
43 | * Read/write access to public and private repos and organizations. |
||
44 | * |
||
45 | * Includes SCOPE_REPO_STATUS. |
||
46 | */ |
||
47 | const SCOPE_REPO = 'repo'; |
||
48 | |||
49 | /** |
||
50 | * Grants access to deployment statuses for public and private repositories. |
||
51 | * This scope is only necessary to grant other users or services access to deployment statuses, |
||
52 | * without granting access to the code. |
||
53 | */ |
||
54 | const SCOPE_REPO_DEPLOYMENT = 'repo_deployment'; |
||
55 | |||
56 | /** |
||
57 | * Read/write access to public and private repository commit statuses. This scope is only necessary to grant other |
||
58 | * users or services access to private repository commit statuses without granting access to the code. The repo and |
||
59 | * public_repo scopes already include access to commit status for private and public repositories, respectively. |
||
60 | */ |
||
61 | const SCOPE_REPO_STATUS = 'repo:status'; |
||
62 | |||
63 | /** |
||
64 | * Delete access to adminable repositories. |
||
65 | */ |
||
66 | const SCOPE_DELETE_REPO = 'delete_repo'; |
||
67 | |||
68 | /** |
||
69 | * Read access to a user’s notifications. repo is accepted too. |
||
70 | */ |
||
71 | const SCOPE_NOTIFICATIONS = 'notifications'; |
||
72 | |||
73 | /** |
||
74 | * Write access to gists. |
||
75 | */ |
||
76 | const SCOPE_GIST = 'gist'; |
||
77 | |||
78 | /** |
||
79 | * Grants read and ping access to hooks in public or private repositories. |
||
80 | */ |
||
81 | const SCOPE_HOOKS_READ = 'read:repo_hook'; |
||
82 | |||
83 | /** |
||
84 | * Grants read, write, and ping access to hooks in public or private repositories. |
||
85 | */ |
||
86 | const SCOPE_HOOKS_WRITE = 'write:repo_hook'; |
||
87 | |||
88 | /** |
||
89 | * Grants read, write, ping, and delete access to hooks in public or private repositories. |
||
90 | */ |
||
91 | const SCOPE_HOOKS_ADMIN = 'admin:repo_hook'; |
||
92 | |||
93 | /** |
||
94 | * Read-only access to organization, teams, and membership. |
||
95 | */ |
||
96 | const SCOPE_ORG_READ = 'read:org'; |
||
97 | |||
98 | /** |
||
99 | * Publicize and unpublicize organization membership. |
||
100 | */ |
||
101 | const SCOPE_ORG_WRITE = 'write:org'; |
||
102 | |||
103 | /** |
||
104 | * Fully manage organization, teams, and memberships. |
||
105 | */ |
||
106 | const SCOPE_ORG_ADMIN = 'admin:org'; |
||
107 | |||
108 | /** |
||
109 | * List and view details for public keys. |
||
110 | */ |
||
111 | const SCOPE_PUBLIC_KEY_READ = 'read:public_key'; |
||
112 | |||
113 | /** |
||
114 | * Create, list, and view details for public keys. |
||
115 | */ |
||
116 | const SCOPE_PUBLIC_KEY_WRITE = 'write:public_key'; |
||
117 | |||
118 | /** |
||
119 | * Fully manage public keys. |
||
120 | */ |
||
121 | const SCOPE_PUBLIC_KEY_ADMIN = 'admin:public_key'; |
||
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | */ |
||
126 | protected function init() |
||
132 | |||
133 | /** |
||
134 | * {@inheritdoc} |
||
135 | */ |
||
136 | public function getAuthorizationEndpoint() |
||
140 | |||
141 | /** |
||
142 | * {@inheritdoc} |
||
143 | */ |
||
144 | public function getAccessTokenEndpoint() |
||
148 | |||
149 | /** |
||
150 | * {@inheritdoc} |
||
151 | */ |
||
152 | protected function getAuthorizationMethod() |
||
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | protected function parseAccessTokenResponse($responseBody) |
||
180 | |||
181 | /** |
||
182 | * Used to configure response type -- we want JSON from github, default is query string format |
||
183 | * |
||
184 | * @return array |
||
185 | */ |
||
186 | protected function getExtraOAuthHeaders() |
||
190 | |||
191 | /** |
||
192 | * Required for GitHub API calls. |
||
193 | * |
||
194 | * @return array |
||
195 | */ |
||
196 | protected function getExtraApiHeaders() |
||
200 | |||
201 | /** |
||
202 | * {@inheritdoc} |
||
203 | */ |
||
204 | protected function getScopesDelimiter() |
||
208 | } |
||
209 |