-
-
Notifications
You must be signed in to change notification settings - Fork 598
Integrations are now Apps! #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
baee5cc
Update and rename Integrations.php to Apps.php
m1guelpf 53c433d
Update Client.php
m1guelpf 46da271
Update tests
m1guelpf 8fa6ab0
Fix
m1guelpf 62b16fc
Fix
m1guelpf 1a0b96d
Fix
m1guelpf 5a052f9
Keep BC
m1guelpf a0a1f0e
Keep BC
m1guelpf aeba969
StyleCI
m1guelpf 78a7422
Update docs index
m1guelpf fb92df9
Update docs
m1guelpf aa27c9c
Add deprecation notice
m1guelpf 66d5e1f
Remove deprecated class
m1guelpf 8871411
Keep BC
m1guelpf 499d23a
Keep BC
m1guelpf afcf4aa
cs
m1guelpf 0438974
Wording
m1guelpf 3c464dd
Retry Travis build
m1guelpf bf113ef
StyleCI
m1guelpf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
|
||
namespace Github\Api; | ||
|
||
/** | ||
* @link https://developer.github.com/v3/apps/ | ||
* @author Nils Adermann <naderman@naderman.de> | ||
*/ | ||
class Apps extends AbstractApi | ||
{ | ||
/** | ||
* Create an access token for an installation | ||
* | ||
* @param int $installationId An integration installation id | ||
* @param int $userId An optional user id on behalf of whom the | ||
* token will be requested | ||
* | ||
* @return array token and token metadata | ||
*/ | ||
public function createInstallationToken($installationId, $userId = null) | ||
{ | ||
$parameters = array(); | ||
if ($userId) { | ||
$parameters['user_id'] = $userId; | ||
} | ||
|
||
return $this->post('/installations/'.rawurlencode($installationId).'/access_tokens', $parameters); | ||
} | ||
|
||
/** | ||
* Find all installations for the authenticated application. | ||
* | ||
* @link https://developer.github.com/v3/apps/#find-installations | ||
* | ||
* @return array | ||
*/ | ||
public function findInstallations() | ||
{ | ||
return $this->get('/app/installations'); | ||
} | ||
|
||
/** | ||
* List repositories that are accessible to the authenticated installation. | ||
* | ||
* @link https://developer.github.com/v3/apps/installations/#list-repositories | ||
* | ||
* @param int $userId | ||
* | ||
* @return array | ||
*/ | ||
public function listRepositories($userId = null) | ||
{ | ||
$parameters = array(); | ||
if ($userId) { | ||
$parameters['user_id'] = $userId; | ||
} | ||
|
||
return $this->get('/installation/repositories', $parameters); | ||
} | ||
|
||
/** | ||
* Add a single repository to an installation. | ||
* | ||
* @link https://developer.github.com/v3/apps/installations/#add-repository-to-installation | ||
* | ||
* @param int $installationId | ||
* @param int $repositoryId | ||
* | ||
* @return array | ||
*/ | ||
public function addRepository($installationId, $repositoryId) | ||
{ | ||
return $this->put('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); | ||
} | ||
|
||
/** | ||
* Remove a single repository from an installation. | ||
* | ||
* @link https://developer.github.com/v3/apps/installations/#remove-repository-from-installation | ||
* | ||
* @param int $installationId | ||
* @param int $repositoryId | ||
* | ||
* @return array | ||
*/ | ||
public function removeRepository($installationId, $repositoryId) | ||
{ | ||
return $this->delete('/installations/'.rawurlencode($installationId).'/repositories/'.rawurlencode($repositoryId)); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could leave these comments.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes indeed keep the old methods (to the deprecated class) so a user will know they have to change their code to the new methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍