mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-02 04:59:49 +09:00
changes
This commit is contained in:
13
vendor/knplabs/github-api/.editorconfig
vendored
Normal file
13
vendor/knplabs/github-api/.editorconfig
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
14
vendor/knplabs/github-api/.php_cs
vendored
Normal file
14
vendor/knplabs/github-api/.php_cs
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->in(__DIR__);
|
||||
|
||||
$config = PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setRules([
|
||||
|
||||
])
|
||||
->setFinder($finder)
|
||||
;
|
||||
|
||||
return $config;
|
||||
5
vendor/knplabs/github-api/.styleci.yml
vendored
Normal file
5
vendor/knplabs/github-api/.styleci.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
preset: recommended
|
||||
|
||||
disabled:
|
||||
- align_double_arrow
|
||||
- no_multiline_whitespace_before_semicolons
|
||||
249
vendor/knplabs/github-api/CHANGELOG.md
vendored
Normal file
249
vendor/knplabs/github-api/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
# Change Log
|
||||
|
||||
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
|
||||
|
||||
## 2.10.1
|
||||
|
||||
### Fixed
|
||||
|
||||
- Convert the assignee parameter to array to avoid getting a 422 error on github (#738)
|
||||
- Fix GraphQL test warnings when they do not assert anything (#735)
|
||||
|
||||
### Changed
|
||||
|
||||
- Check for BC breaks during the travis build (#734)
|
||||
|
||||
## 2.10.0
|
||||
|
||||
### Added
|
||||
|
||||
- Support for "before" parameter on Notification API (#724)
|
||||
|
||||
### Changed
|
||||
|
||||
- Allow unspecified `event` when creating review (#723)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Adjust: installationn access token endpoint (#731)
|
||||
- Fixed "get single label" example and add correct example for getting issue's labels (#732)
|
||||
- Add comment about `Key` constructor argument (#722)
|
||||
|
||||
## 2.9.0
|
||||
|
||||
### Added
|
||||
|
||||
- API endpoint `Github\Api\Repo::transfer()`
|
||||
- API endpoint `Github\Api\Notification::markThreadRead()`
|
||||
- API endpoint `Github\Api\Search::topics()`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Make sure to always reset the "per page" in `Github\ResultPager::fetchAll()`.
|
||||
|
||||
## 2.8.0
|
||||
|
||||
### Added
|
||||
|
||||
- Allow our HTTP plugins to show up in the Symfony web profiler page. (#687)
|
||||
- Repository documentation to current user (#671)
|
||||
- Add collaborator permission call (#678)
|
||||
- Add missing parameters for User/CurrentUser Repositories (#684)
|
||||
- Pimp the readme with badge poser (#686)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Typo in assignee documentation
|
||||
- Missing use statement in security example
|
||||
- Fixed phpdoc typo (#695)
|
||||
- Replace use of deprecated api to the correct one in the security docs (#697)
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated requirements in readme (#689)
|
||||
|
||||
## 2.7.0
|
||||
|
||||
### Added
|
||||
|
||||
- Phpunit 6 compatibility
|
||||
- `Github\Api\AbstractApi::setPage()` to allow you to set the page on all endpoints.
|
||||
- Support for query parameters and request headers on `Github\Api\User::following` and `Github\Api\User::followers`
|
||||
- API endpoint `Github\Api\CurrentUser\Emails::allPublic()`
|
||||
- API endpoint `Github\Api\Search::commits()`
|
||||
- API endpoint `Github\Api\Miscellaneous\CodeOfConduct`
|
||||
- API endpoint `Github\Api\Repo::topics()`
|
||||
- API endpoint `Github\Api\Repo::replaceTopics()`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed bug in `PathPrepend` plugin where "api/vX" could be duplicated.
|
||||
|
||||
### Changed
|
||||
|
||||
- Improved documentation and doc blocks
|
||||
|
||||
### Removed
|
||||
|
||||
- Dropped support for php 5.5
|
||||
|
||||
### Deprecated
|
||||
|
||||
The following endpoints were deprecated by Github and are also deprecated in the client:
|
||||
|
||||
- `Github\Api\Repo::find()`
|
||||
- `Github\Api\User::find()`
|
||||
- `Github\Api\Issue::find()`
|
||||
|
||||
## 2.6.0
|
||||
|
||||
### Added
|
||||
|
||||
- Support for graphql api [variables](https://developer.github.com/v4/guides/forming-calls/#working-with-variables) (#612)
|
||||
- Added missing branch protection methods (#616)
|
||||
- Helper function `fromFile ` to get GraphQL queries from a file (#628)
|
||||
- Extra parameter `params` to collaborators api calls (#623)
|
||||
- Documentation for GitData API (#613)
|
||||
|
||||
### Fixed
|
||||
- Remove `body` as a required parameter when creating an issue (#624)
|
||||
- Minor fixes in example code (#617)
|
||||
|
||||
## 2.5.0
|
||||
|
||||
### Added
|
||||
|
||||
- Stable support for graphql api (V4) (#593)
|
||||
- Stable support for apps (previously integrations) (#592)
|
||||
- `Repo::events()`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Incorrect link in repository search docs (#594)
|
||||
- Added the required parameter `$message` on `Review::dismiss`.
|
||||
|
||||
## 2.4.0
|
||||
|
||||
### Added
|
||||
|
||||
- `Integrations::configure` to allow accessing early access program endpoints.
|
||||
- Add support for pagination and parameters in the pull request comments
|
||||
- Add the ability to fetch user installations (`CurrentUser::installations`)
|
||||
- Allow getting repo info by id (`Repo::showById`)
|
||||
- Allow fetching repositories for a specific installation and user (`CurrentUser::repositoriesByInstallation`)
|
||||
|
||||
### Changed
|
||||
|
||||
- `PullRequest\Review` and `PullRequest\ReviewRequest` is now part of the official API. No need to call `configure`.
|
||||
|
||||
## 2.3.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Issue where we serve the wrong cached response. We vary on authorization header now.
|
||||
|
||||
### Added
|
||||
|
||||
- `PullRequest::status`
|
||||
- Throw InvalidArgumentException on `PullRequest::merge` when wrong merge method is used.
|
||||
- Added `Protection::configure`
|
||||
|
||||
### Changed
|
||||
|
||||
- First argument to `Integrations::listRepositories()` is now optional.
|
||||
- Moved tests from "functional" to "integration"
|
||||
|
||||
## 2.2.0
|
||||
|
||||
### Added
|
||||
|
||||
- API support for Pull Request Review Requests.
|
||||
- API support for Traffic.
|
||||
- API support for issue Assignees.
|
||||
- API support for Miscellaneous Gitignore and Emojis.
|
||||
- Added endpoints for issue lock, unlock and issue label show.
|
||||
- Added more parameters to `User::starred`.
|
||||
- Fluid interface by allowing `configure()` to return `$this`.
|
||||
- `configure()` support for issues API.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Cache issue where some requests are not cached
|
||||
- Issue with `User::all()` creates a query with double question marks.
|
||||
|
||||
## 2.1.0
|
||||
|
||||
### Added
|
||||
|
||||
- Add support for retrieving a single notification info using his ID
|
||||
- Add a function to get user organizations
|
||||
- Added GraphQL support
|
||||
- Add page variable to organization repo list (Organization::repositories())
|
||||
- Add support for pull request review.
|
||||
- Add support for adding branch protection.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug with double slashes when using enterprise URL.
|
||||
- Bug when headers not being passed to request (#529)
|
||||
|
||||
## 2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- Support for JWT authentication
|
||||
- API for Organization\Members
|
||||
- API for Integrations
|
||||
- API for Repo\Cards
|
||||
- API for Repo\Columns
|
||||
- API for Repo\Projects
|
||||
- API for User\MyRepositories
|
||||
- Methods in Repo API for frequency and participation
|
||||
|
||||
### Changed
|
||||
|
||||
- `ApiLimitExceedException::__construct` has a new second parameter for the remaining API calls.
|
||||
- First parameter of `Github\Client` has changed type from `\Http\Client\HttpClient` to
|
||||
`Github\HttpClient\Builder`. A factory class was also added. To upgrade you need to change:
|
||||
|
||||
```php
|
||||
// Old way does not work:
|
||||
$github = new Github\Client($httpClient);
|
||||
|
||||
// New way will work:
|
||||
$github = new Github\Client(new Github\HttpClient\Builder($httpClient));
|
||||
$github = Github\Client::createWithHttpClient($httpClient);
|
||||
```
|
||||
- Renamed the currentuser `DeployKeys` api class to `PublicKeys` to reflect to github api name.
|
||||
|
||||
## 2.0.0-rc4
|
||||
|
||||
### Added
|
||||
|
||||
- HTTPlug to decouple from Guzzle
|
||||
- `Github\Client::getLastResponse` was added
|
||||
- Support for PSR-6 cache
|
||||
- `Github\Client::addPlugin` and `Github\Client::removePlugin`
|
||||
- `Github\Client::getApiVersion`
|
||||
- `Github\Client::removeCache`
|
||||
|
||||
### Changed
|
||||
|
||||
- Uses of `Github\HttpClient\HttpClientInterface` is replaced by `Http\Client\HttpClient` ie the constructor of `Github\Client`.
|
||||
- We use PSR-7's representation of HTTP message instead of `Guzzle\Http\Message\Response` and `Guzzle\Http\Message\Request`.
|
||||
- `Github\Client::addHeaders` was added instead of `Github\Client::setHeaders`
|
||||
- Signature of `Github\Client::useCache` has changed. First argument must be a `CacheItemPoolInterface`
|
||||
- We use PSR-4 instead of PSR-0
|
||||
|
||||
### Removed
|
||||
|
||||
- Support for PHP 5.3 and 5.4
|
||||
- `Github/HttpClient/HttpClientInterface` was removed
|
||||
- `Github/HttpClient/HttpClient` was removed
|
||||
- All classes in `Github/HttpClient/HttpClient/Listener/*` were removed
|
||||
- `Github/HttpClient/CachedHttpClient` was removed
|
||||
- All classes in `Github/HttpClient/Cache/*` were removed
|
||||
|
||||
## 1.7.1
|
||||
|
||||
No change log before this version
|
||||
22
vendor/knplabs/github-api/LICENSE
vendored
Normal file
22
vendor/knplabs/github-api/LICENSE
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2012 KnpLabs
|
||||
Copyright (c) 2010 Thibault Duplessis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
111
vendor/knplabs/github-api/README.md
vendored
Normal file
111
vendor/knplabs/github-api/README.md
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
# PHP GitHub API
|
||||
|
||||
[](https://travis-ci.org/KnpLabs/php-github-api)
|
||||
[](https://styleci.io/repos/3948501)
|
||||
[](https://packagist.org/packages/knplabs/github-api)
|
||||
[](https://packagist.org/packages/knplabs/github-api)
|
||||
[](https://packagist.org/packages/knplabs/github-api)
|
||||
[](https://packagist.org/packages/knplabs/github-api)
|
||||
[](https://packagist.org/packages/knplabs/github-api)
|
||||
|
||||
A simple Object Oriented wrapper for GitHub API, written with PHP5.
|
||||
|
||||
Uses [GitHub API v3](http://developer.github.com/v3/) & supports [GitHub API v4](http://developer.github.com/v4). The object API (v3) is very similar to the RESTful API.
|
||||
|
||||
## Features
|
||||
|
||||
* Light and fast thanks to lazy loading of API classes
|
||||
* Extensively tested and documented
|
||||
|
||||
## Requirements
|
||||
|
||||
* PHP >= 5.6
|
||||
* A [HTTP client](https://packagist.org/providers/php-http/client-implementation)
|
||||
* A [PSR-7 implementation](https://packagist.org/providers/psr/http-message-implementation)
|
||||
* (optional) PHPUnit to run tests.
|
||||
|
||||
## Install
|
||||
|
||||
Via Composer:
|
||||
|
||||
```bash
|
||||
$ composer require knplabs/github-api php-http/guzzle6-adapter
|
||||
```
|
||||
|
||||
Why `php-http/guzzle6-adapter`? We are decoupled from any HTTP messaging client with help by [HTTPlug](http://httplug.io/). Read about clients in our [docs](doc/customize.md).
|
||||
|
||||
|
||||
## Using Laravel?
|
||||
|
||||
[Laravel GitHub](https://github.com/GrahamCampbell/Laravel-GitHub) by [Graham Campbell](https://github.com/GrahamCampbell) might interest you.
|
||||
|
||||
## Basic usage of `php-github-api` client
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
// This file is generated by Composer
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$client = new \Github\Client();
|
||||
$repositories = $client->api('user')->repositories('ornicar');
|
||||
```
|
||||
|
||||
From `$client` object, you can access to all GitHub.
|
||||
|
||||
## Cache usage
|
||||
|
||||
This example uses the PSR6 cache pool [redis-adapter](https://github.com/php-cache/redis-adapter). See http://www.php-cache.com/ for alternatives.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
// This file is generated by Composer
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use Cache\Adapter\Redis\RedisCachePool;
|
||||
|
||||
$client = new \Redis();
|
||||
$client->connect('127.0.0.1', 6379);
|
||||
// Create a PSR6 cache pool
|
||||
$pool = new RedisCachePool($client);
|
||||
|
||||
$client = new \Github\Client();
|
||||
$client->addCache($pool);
|
||||
|
||||
// Do some request
|
||||
|
||||
// Stop using cache
|
||||
$client->removeCache();
|
||||
```
|
||||
|
||||
Using cache, the client will get cached responses if resources haven't changed since last time,
|
||||
**without** reaching the `X-Rate-Limit` [imposed by github](http://developer.github.com/v3/#rate-limiting).
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
See the [`doc` directory](doc/) for more detailed documentation.
|
||||
|
||||
## License
|
||||
|
||||
`php-github-api` is licensed under the MIT License - see the LICENSE file for details
|
||||
|
||||
## Credits
|
||||
|
||||
### Sponsored by
|
||||
|
||||
[](http://knplabs.com)
|
||||
|
||||
### Contributors
|
||||
|
||||
- Thanks to [Thibault Duplessis aka. ornicar](http://github.com/ornicar) for his first version of this library.
|
||||
- Thanks to [Joseph Bielawski aka. stloyd](http://github.com/stloyd) for his contributions and support.
|
||||
- Thanks to [noloh](http://github.com/noloh) for his contribution on the Object API.
|
||||
- Thanks to [bshaffer](http://github.com/bshaffer) for his contribution on the Repo API.
|
||||
- Thanks to [Rolf van de Krol](http://github.com/rolfvandekrol) for his countless contributions.
|
||||
- Thanks to [Nicolas Pastorino](http://github.com/jeanvoye) for his contribution on the Pull Request API.
|
||||
- Thanks to [Edoardo Rivello](http://github.com/erivello) for his contribution on the Gists API.
|
||||
- Thanks to [Miguel Piedrafita](https://github.com/m1guelpf) for his contribution to the v4 & Apps API.
|
||||
|
||||
Thanks to GitHub for the high quality API and documentation.
|
||||
49
vendor/knplabs/github-api/composer.json
vendored
Normal file
49
vendor/knplabs/github-api/composer.json
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "knplabs/github-api",
|
||||
"type": "library",
|
||||
"description": "GitHub API v3 client",
|
||||
"homepage": "https://github.com/KnpLabs/php-github-api",
|
||||
"keywords": ["github", "gh", "api", "gist"],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "KnpLabs Team",
|
||||
"homepage": "http://knplabs.com"
|
||||
},
|
||||
{
|
||||
"name": "Thibault Duplessis",
|
||||
"email": "thibault.duplessis@gmail.com",
|
||||
"homepage": "http://ornicar.github.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"psr/http-message": "^1.0",
|
||||
"psr/cache": "^1.0",
|
||||
"php-http/httplug": "^1.1",
|
||||
"php-http/discovery": "^1.0",
|
||||
"php-http/client-implementation": "^1.0",
|
||||
"php-http/client-common": "^1.6",
|
||||
"php-http/cache-plugin": "^1.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.5 || ^6.0",
|
||||
"php-http/guzzle6-adapter": "^1.0",
|
||||
"php-http/mock-client": "^1.0",
|
||||
"guzzlehttp/psr7": "^1.2",
|
||||
"cache/array-adapter": "^0.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Github\\": "lib/Github/" }
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": { "Github\\Tests\\": "test/Github/Tests/"}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.10.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
243
vendor/knplabs/github-api/lib/Github/Api/AbstractApi.php
vendored
Normal file
243
vendor/knplabs/github-api/lib/Github/Api/AbstractApi.php
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Client;
|
||||
use Github\HttpClient\Message\ResponseMediator;
|
||||
|
||||
/**
|
||||
* Abstract class for Api classes.
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
abstract class AbstractApi implements ApiInterface
|
||||
{
|
||||
/**
|
||||
* The client.
|
||||
*
|
||||
* @var Client
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* The requested page (GitHub pagination).
|
||||
*
|
||||
* @var null|int
|
||||
*/
|
||||
private $page;
|
||||
|
||||
/**
|
||||
* Number of items per page (GitHub pagination).
|
||||
*
|
||||
* @var null|int
|
||||
*/
|
||||
protected $perPage;
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
*/
|
||||
public function __construct(Client $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
public function configure()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getPage()
|
||||
{
|
||||
return $this->page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|int $page
|
||||
*/
|
||||
public function setPage($page)
|
||||
{
|
||||
$this->page = (null === $page ? $page : (int) $page);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getPerPage()
|
||||
{
|
||||
return $this->perPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|int $perPage
|
||||
*/
|
||||
public function setPerPage($perPage)
|
||||
{
|
||||
$this->perPage = (null === $perPage ? $perPage : (int) $perPage);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a GET request with query parameters.
|
||||
*
|
||||
* @param string $path Request path.
|
||||
* @param array $parameters GET parameters.
|
||||
* @param array $requestHeaders Request Headers.
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
protected function get($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
if (null !== $this->page && !isset($parameters['page'])) {
|
||||
$parameters['page'] = $this->page;
|
||||
}
|
||||
if (null !== $this->perPage && !isset($parameters['per_page'])) {
|
||||
$parameters['per_page'] = $this->perPage;
|
||||
}
|
||||
if (array_key_exists('ref', $parameters) && is_null($parameters['ref'])) {
|
||||
unset($parameters['ref']);
|
||||
}
|
||||
|
||||
if (count($parameters) > 0) {
|
||||
$path .= '?'.http_build_query($parameters);
|
||||
}
|
||||
|
||||
$response = $this->client->getHttpClient()->get($path, $requestHeaders);
|
||||
|
||||
return ResponseMediator::getContent($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a HEAD request with query parameters.
|
||||
*
|
||||
* @param string $path Request path.
|
||||
* @param array $parameters HEAD parameters.
|
||||
* @param array $requestHeaders Request headers.
|
||||
*
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*/
|
||||
protected function head($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
if (array_key_exists('ref', $parameters) && is_null($parameters['ref'])) {
|
||||
unset($parameters['ref']);
|
||||
}
|
||||
|
||||
$response = $this->client->getHttpClient()->head($path.'?'.http_build_query($parameters), $requestHeaders);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a POST request with JSON-encoded parameters.
|
||||
*
|
||||
* @param string $path Request path.
|
||||
* @param array $parameters POST parameters to be JSON encoded.
|
||||
* @param array $requestHeaders Request headers.
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
protected function post($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
return $this->postRaw(
|
||||
$path,
|
||||
$this->createJsonBody($parameters),
|
||||
$requestHeaders
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a POST request with raw data.
|
||||
*
|
||||
* @param string $path Request path.
|
||||
* @param string $body Request body.
|
||||
* @param array $requestHeaders Request headers.
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
protected function postRaw($path, $body, array $requestHeaders = [])
|
||||
{
|
||||
$response = $this->client->getHttpClient()->post(
|
||||
$path,
|
||||
$requestHeaders,
|
||||
$body
|
||||
);
|
||||
|
||||
return ResponseMediator::getContent($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a PATCH request with JSON-encoded parameters.
|
||||
*
|
||||
* @param string $path Request path.
|
||||
* @param array $parameters POST parameters to be JSON encoded.
|
||||
* @param array $requestHeaders Request headers.
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
protected function patch($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
$response = $this->client->getHttpClient()->patch(
|
||||
$path,
|
||||
$requestHeaders,
|
||||
$this->createJsonBody($parameters)
|
||||
);
|
||||
|
||||
return ResponseMediator::getContent($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a PUT request with JSON-encoded parameters.
|
||||
*
|
||||
* @param string $path Request path.
|
||||
* @param array $parameters POST parameters to be JSON encoded.
|
||||
* @param array $requestHeaders Request headers.
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
protected function put($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
$response = $this->client->getHttpClient()->put(
|
||||
$path,
|
||||
$requestHeaders,
|
||||
$this->createJsonBody($parameters)
|
||||
);
|
||||
|
||||
return ResponseMediator::getContent($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a DELETE request with JSON-encoded parameters.
|
||||
*
|
||||
* @param string $path Request path.
|
||||
* @param array $parameters POST parameters to be JSON encoded.
|
||||
* @param array $requestHeaders Request headers.
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
protected function delete($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
$response = $this->client->getHttpClient()->delete(
|
||||
$path,
|
||||
$requestHeaders,
|
||||
$this->createJsonBody($parameters)
|
||||
);
|
||||
|
||||
return ResponseMediator::getContent($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a JSON encoded version of an array of parameters.
|
||||
*
|
||||
* @param array $parameters Request parameters
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
protected function createJsonBody(array $parameters)
|
||||
{
|
||||
return (count($parameters) === 0) ? null : json_encode($parameters, empty($parameters) ? JSON_FORCE_OBJECT : 0);
|
||||
}
|
||||
}
|
||||
63
vendor/knplabs/github-api/lib/Github/Api/AcceptHeaderTrait.php
vendored
Normal file
63
vendor/knplabs/github-api/lib/Github/Api/AcceptHeaderTrait.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
/**
|
||||
* A trait to make sure we add accept headers on all requests.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
trait AcceptHeaderTrait
|
||||
{
|
||||
protected $acceptHeaderValue = null;
|
||||
|
||||
protected function get($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
return parent::get($path, $parameters, $this->mergeHeaders($requestHeaders));
|
||||
}
|
||||
|
||||
protected function head($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
return parent::head($path, $parameters, $this->mergeHeaders($requestHeaders));
|
||||
}
|
||||
|
||||
protected function post($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
return parent::post($path, $parameters, $this->mergeHeaders($requestHeaders));
|
||||
}
|
||||
|
||||
protected function postRaw($path, $body, array $requestHeaders = [])
|
||||
{
|
||||
return parent::postRaw($path, $body, $this->mergeHeaders($requestHeaders));
|
||||
}
|
||||
|
||||
protected function patch($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
return parent::patch($path, $parameters, $this->mergeHeaders($requestHeaders));
|
||||
}
|
||||
|
||||
protected function put($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
return parent::put($path, $parameters, $this->mergeHeaders($requestHeaders));
|
||||
}
|
||||
|
||||
protected function delete($path, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
return parent::delete($path, $parameters, $this->mergeHeaders($requestHeaders));
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a new accept header on all requests.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function mergeHeaders(array $headers = [])
|
||||
{
|
||||
$default = [];
|
||||
if ($this->acceptHeaderValue) {
|
||||
$default = ['Accept' => $this->acceptHeaderValue];
|
||||
}
|
||||
|
||||
return array_merge($default, $headers);
|
||||
}
|
||||
}
|
||||
15
vendor/knplabs/github-api/lib/Github/Api/ApiInterface.php
vendored
Normal file
15
vendor/knplabs/github-api/lib/Github/Api/ApiInterface.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
/**
|
||||
* Api interface.
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
interface ApiInterface
|
||||
{
|
||||
public function getPerPage();
|
||||
|
||||
public function setPerPage($perPage);
|
||||
}
|
||||
93
vendor/knplabs/github-api/lib/Github/Api/Apps.php
vendored
Normal file
93
vendor/knplabs/github-api/lib/Github/Api/Apps.php
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
<?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
|
||||
*
|
||||
* @link https://developer.github.com/v3/apps/#create-a-new-installation-token
|
||||
*
|
||||
* @return array token and token metadata
|
||||
*/
|
||||
public function createInstallationToken($installationId, $userId = null)
|
||||
{
|
||||
$parameters = [];
|
||||
if ($userId) {
|
||||
$parameters['user_id'] = $userId;
|
||||
}
|
||||
|
||||
return $this->post('/app/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 = [];
|
||||
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));
|
||||
}
|
||||
}
|
||||
122
vendor/knplabs/github-api/lib/Github/Api/Authorizations.php
vendored
Normal file
122
vendor/knplabs/github-api/lib/Github/Api/Authorizations.php
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
/**
|
||||
* Creating, deleting and listing authorizations.
|
||||
*
|
||||
* @link http://developer.github.com/v3/oauth_authorizations/
|
||||
*
|
||||
* @author Evgeniy Guseletov <d46k16@gmail.com>
|
||||
*/
|
||||
class Authorizations extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List all authorizations.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->get('/authorizations');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a single authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($clientId)
|
||||
{
|
||||
return $this->get('/authorizations/'.rawurlencode($clientId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an authorization.
|
||||
*
|
||||
* @param array $params
|
||||
* @param null $OTPCode
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create(array $params, $OTPCode = null)
|
||||
{
|
||||
$headers = null === $OTPCode ? [] : ['X-GitHub-OTP' => $OTPCode];
|
||||
|
||||
return $this->post('/authorizations', $params, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update($clientId, array $params)
|
||||
{
|
||||
return $this->patch('/authorizations/'.rawurlencode($clientId), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($clientId)
|
||||
{
|
||||
return $this->delete('/authorizations/'.rawurlencode($clientId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param $token
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function check($clientId, $token)
|
||||
{
|
||||
return $this->get('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param $token
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function reset($clientId, $token)
|
||||
{
|
||||
return $this->post('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an authorization.
|
||||
*
|
||||
* @param $clientId
|
||||
* @param $token
|
||||
*/
|
||||
public function revoke($clientId, $token)
|
||||
{
|
||||
$this->delete('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke all authorizations.
|
||||
*
|
||||
* @param $clientId
|
||||
*/
|
||||
public function revokeAll($clientId)
|
||||
{
|
||||
$this->delete('/applications/'.rawurlencode($clientId).'/tokens');
|
||||
}
|
||||
}
|
||||
207
vendor/knplabs/github-api/lib/Github/Api/CurrentUser.php
vendored
Normal file
207
vendor/knplabs/github-api/lib/Github/Api/CurrentUser.php
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Api\CurrentUser\Emails;
|
||||
use Github\Api\CurrentUser\Followers;
|
||||
use Github\Api\CurrentUser\Memberships;
|
||||
use Github\Api\CurrentUser\Notifications;
|
||||
use Github\Api\CurrentUser\PublicKeys;
|
||||
use Github\Api\CurrentUser\Starring;
|
||||
use Github\Api\CurrentUser\Watchers;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/users/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @author Felipe Valtl de Mello <eu@felipe.im>
|
||||
*/
|
||||
class CurrentUser extends AbstractApi
|
||||
{
|
||||
public function show()
|
||||
{
|
||||
return $this->get('/user');
|
||||
}
|
||||
|
||||
public function update(array $params)
|
||||
{
|
||||
return $this->patch('/user', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Emails
|
||||
*/
|
||||
public function emails()
|
||||
{
|
||||
return new Emails($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Followers
|
||||
*/
|
||||
public function follow()
|
||||
{
|
||||
return new Followers($this->client);
|
||||
}
|
||||
|
||||
public function followers($page = 1)
|
||||
{
|
||||
return $this->get('/user/followers', [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/issues/#list-issues
|
||||
*
|
||||
* @param array $params
|
||||
* @param bool $includeOrgIssues
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function issues(array $params = [], $includeOrgIssues = true)
|
||||
{
|
||||
return $this->get($includeOrgIssues ? '/issues' : '/user/issues', array_merge(['page' => 1], $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PublicKeys
|
||||
*/
|
||||
public function keys()
|
||||
{
|
||||
return new PublicKeys($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Notifications
|
||||
*/
|
||||
public function notifications()
|
||||
{
|
||||
return new Notifications($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Memberships
|
||||
*/
|
||||
public function memberships()
|
||||
{
|
||||
return new Memberships($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/orgs/#list-user-organizations
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function organizations()
|
||||
{
|
||||
return $this->get('/user/orgs');
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/orgs/teams/#list-user-teams
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function teams()
|
||||
{
|
||||
return $this->get('/user/teams');
|
||||
}
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/#list-your-repositories
|
||||
*
|
||||
* @param string $type role in the repository
|
||||
* @param string $sort sort by
|
||||
* @param string $direction direction of sort, asc or desc
|
||||
* @param string $visibility visibility of repository
|
||||
* @param string $affiliation relationship to repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function repositories($type = 'owner', $sort = 'full_name', $direction = 'asc', $visibility = null, $affiliation = null)
|
||||
{
|
||||
$params = [
|
||||
'type' => $type,
|
||||
'sort' => $sort,
|
||||
'direction' => $direction,
|
||||
];
|
||||
|
||||
if (null !== $visibility) {
|
||||
unset($params['type']);
|
||||
$params['visibility'] = $visibility;
|
||||
}
|
||||
|
||||
if (null !== $affiliation) {
|
||||
unset($params['type']);
|
||||
$params['affiliation'] = $affiliation;
|
||||
}
|
||||
|
||||
return $this->get('/user/repos', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Watchers
|
||||
*/
|
||||
public function watchers()
|
||||
{
|
||||
return new Watchers($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use watchers() instead
|
||||
*/
|
||||
public function watched($page = 1)
|
||||
{
|
||||
return $this->get('/user/watched', [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Starring
|
||||
*/
|
||||
public function starring()
|
||||
{
|
||||
return new Starring($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use starring() instead
|
||||
*/
|
||||
public function starred($page = 1)
|
||||
{
|
||||
return $this->get('/user/starred', [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/activity/watching/#list-repositories-being-watched
|
||||
*/
|
||||
public function subscriptions()
|
||||
{
|
||||
return $this->get('/user/subscriptions');
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/integrations/#list-installations-for-user
|
||||
*
|
||||
* @param array $params
|
||||
*/
|
||||
public function installations(array $params = [])
|
||||
{
|
||||
return $this->get('/user/installations', array_merge(['page' => 1], $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/integrations/installations/#list-repositories-accessible-to-the-user-for-an-installation
|
||||
*
|
||||
* @param string $installationId the ID of the Installation
|
||||
* @param array $params
|
||||
*/
|
||||
public function repositoriesByInstallation($installationId, array $params = [])
|
||||
{
|
||||
return $this->get(sprintf('/user/installations/%s/repositories', $installationId), array_merge(['page' => 1], $params));
|
||||
}
|
||||
}
|
||||
94
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Emails.php
vendored
Normal file
94
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Emails.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\CurrentUser;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/users/emails/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Emails extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List emails for the authenticated user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/users/emails/
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->get('/user/emails');
|
||||
}
|
||||
|
||||
/**
|
||||
* List public email addresses for a user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/users/emails/#list-public-email-addresses-for-a-user
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function allPublic()
|
||||
{
|
||||
return $this->get('/user/public_emails');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds one or more email for the authenticated user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/users/emails/
|
||||
*
|
||||
* @param string|array $emails
|
||||
*
|
||||
* @throws \Github\Exception\InvalidArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function add($emails)
|
||||
{
|
||||
if (is_string($emails)) {
|
||||
$emails = [$emails];
|
||||
} elseif (0 === count($emails)) {
|
||||
throw new InvalidArgumentException();
|
||||
}
|
||||
|
||||
return $this->post('/user/emails', $emails);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes one or more email for the authenticated user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/users/emails/
|
||||
*
|
||||
* @param string|array $emails
|
||||
*
|
||||
* @throws \Github\Exception\InvalidArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($emails)
|
||||
{
|
||||
if (is_string($emails)) {
|
||||
$emails = [$emails];
|
||||
} elseif (0 === count($emails)) {
|
||||
throw new InvalidArgumentException();
|
||||
}
|
||||
|
||||
return $this->delete('/user/emails', $emails);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle primary email visibility.
|
||||
*
|
||||
* @link https://developer.github.com/v3/users/emails/#toggle-primary-email-visibility
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toggleVisibility()
|
||||
{
|
||||
return $this->patch('/user/email/visibility');
|
||||
}
|
||||
}
|
||||
71
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Followers.php
vendored
Normal file
71
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Followers.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\CurrentUser;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/users/followers/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Followers extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List followed users by the authenticated user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/followers/
|
||||
*
|
||||
* @param int $page
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($page = 1)
|
||||
{
|
||||
return $this->get('/user/following', [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the authenticated user follows a user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/followers/
|
||||
*
|
||||
* @param string $username the username to follow
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function check($username)
|
||||
{
|
||||
return $this->get('/user/following/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the authenticated user follow a user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/followers/
|
||||
*
|
||||
* @param string $username the username to follow
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function follow($username)
|
||||
{
|
||||
return $this->put('/user/following/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the authenticated user un-follow a user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/followers/
|
||||
*
|
||||
* @param string $username the username to un-follow
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function unfollow($username)
|
||||
{
|
||||
return $this->delete('/user/following/'.rawurlencode($username));
|
||||
}
|
||||
}
|
||||
48
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Memberships.php
vendored
Normal file
48
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Memberships.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\CurrentUser;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
class Memberships extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List your organization memberships.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/members/#get-your-organization-membership
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->get('/user/memberships/orgs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get your organization membership.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/members/#get-your-organization-membership
|
||||
*
|
||||
* @param string $organization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function organization($organization)
|
||||
{
|
||||
return $this->get('/user/memberships/orgs/'.rawurlencode($organization));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit your organization membership.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/members/#edit-your-organization-membership
|
||||
*
|
||||
* @param string $organization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function edit($organization)
|
||||
{
|
||||
return $this->patch('/user/memberships/orgs/'.rawurlencode($organization), ['state' => 'active']);
|
||||
}
|
||||
}
|
||||
145
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Notifications.php
vendored
Normal file
145
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Notifications.php
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\CurrentUser;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/activity/notifications/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Notifications extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List all notifications for the authenticated user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/notifications/#list-your-notifications
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all(array $params = [])
|
||||
{
|
||||
return $this->get('/notifications', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all notifications for the authenticated user in selected repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function allInRepository($username, $repository, array $params = [])
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark all notifications as read.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/notifications/#mark-as-read
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function markAsReadAll(array $params = [])
|
||||
{
|
||||
return $this->put('/notifications', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark all notifications for a repository as read.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function markAsReadInRepository($username, $repository, array $params = [])
|
||||
{
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/notifications', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a notification as read.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
|
||||
*
|
||||
* @param int $id the notification number
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function markAsRead($id, array $params)
|
||||
{
|
||||
return $this->patch('/notifications/threads/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a notification.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/notifications/#view-a-single-thread
|
||||
*
|
||||
* @param int $id the notification number
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return $this->get('/notifications/threads/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a subscription.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/notifications/#get-a-thread-subscription
|
||||
*
|
||||
* @param int $id the notification number
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function showSubscription($id)
|
||||
{
|
||||
return $this->get('/notifications/threads/'.rawurlencode($id).'/subscription');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a subscription.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/notifications/#set-a-thread-subscription
|
||||
*
|
||||
* @param int $id the notification number
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function createSubscription($id, array $params)
|
||||
{
|
||||
return $this->put('/notifications/threads/'.rawurlencode($id).'/subscription', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a subscription.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription
|
||||
*
|
||||
* @param int $id the notification number
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function removeSubscription($id)
|
||||
{
|
||||
return $this->delete('/notifications/threads/'.rawurlencode($id).'/subscription');
|
||||
}
|
||||
}
|
||||
74
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/PublicKeys.php
vendored
Normal file
74
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/PublicKeys.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\CurrentUser;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/users/keys/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class PublicKeys extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List deploy keys for the authenticated user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/users/keys/
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->get('/user/keys');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows deploy key for the authenticated user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/users/keys/
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return $this->get('/user/keys/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds deploy key for the authenticated user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/users/keys/
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create(array $params)
|
||||
{
|
||||
if (!isset($params['title'], $params['key'])) {
|
||||
throw new MissingArgumentException(['title', 'key']);
|
||||
}
|
||||
|
||||
return $this->post('/user/keys', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes deploy key for the authenticated user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/users/keys/
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($id)
|
||||
{
|
||||
return $this->delete('/user/keys/'.rawurlencode($id));
|
||||
}
|
||||
}
|
||||
76
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Starring.php
vendored
Normal file
76
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Starring.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\CurrentUser;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/activity/starring/
|
||||
*
|
||||
* @author Felipe Valtl de Mello <eu@felipe.im>
|
||||
*/
|
||||
class Starring extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List repositories starred by the authenticated user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/starring/
|
||||
*
|
||||
* @param int $page
|
||||
* @param int $perPage
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($page = 1, $perPage = 30)
|
||||
{
|
||||
return $this->get('/user/starred', [
|
||||
'page' => $page,
|
||||
'per_page' => $perPage,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the authenticated user starres a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/starring/
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function check($username, $repository)
|
||||
{
|
||||
return $this->get('/user/starred/'.rawurlencode($username).'/'.rawurlencode($repository));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the authenticated user star a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/starring/
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function star($username, $repository)
|
||||
{
|
||||
return $this->put('/user/starred/'.rawurlencode($username).'/'.rawurlencode($repository));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the authenticated user unstar a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/starring
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function unstar($username, $repository)
|
||||
{
|
||||
return $this->delete('/user/starred/'.rawurlencode($username).'/'.rawurlencode($repository));
|
||||
}
|
||||
}
|
||||
75
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Watchers.php
vendored
Normal file
75
vendor/knplabs/github-api/lib/Github/Api/CurrentUser/Watchers.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\CurrentUser;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/activity/watching/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @revised Felipe Valtl de Mello <eu@felipe.im>
|
||||
*/
|
||||
class Watchers extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List repositories watched by the authenticated user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/watching/
|
||||
*
|
||||
* @param int $page
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($page = 1)
|
||||
{
|
||||
return $this->get('/user/subscriptions', [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the authenticated user watches a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/watching/
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function check($username, $repository)
|
||||
{
|
||||
return $this->get('/user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the authenticated user watch a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/watching/
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function watch($username, $repository)
|
||||
{
|
||||
return $this->put('/user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the authenticated user unwatch a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/watching/
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function unwatch($username, $repository)
|
||||
{
|
||||
return $this->delete('/user/subscriptions/'.rawurlencode($username).'/'.rawurlencode($repository));
|
||||
}
|
||||
}
|
||||
107
vendor/knplabs/github-api/lib/Github/Api/Deployment.php
vendored
Normal file
107
vendor/knplabs/github-api/lib/Github/Api/Deployment.php
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* Listing, creating and updating deployments.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/deployments/
|
||||
*/
|
||||
class Deployment extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List deployments for a particular repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/deployments/#list-deployments
|
||||
*
|
||||
* @param string $username the username of the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param array $params query parameters to filter deployments by (see link)
|
||||
*
|
||||
* @return array the deployments requested
|
||||
*/
|
||||
public function all($username, $repository, array $params = [])
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a deployment in selected repository.
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the deployment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new deployment for the given username and repo.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/deployments/#create-a-deployment
|
||||
*
|
||||
* Important: Once a deployment is created, it cannot be updated. Changes are indicated by creating new statuses.
|
||||
* @see updateStatus
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param array $params the new deployment data
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array information about the deployment
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['ref'])) {
|
||||
throw new MissingArgumentException(['ref']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a deployment by creating a new status update.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/deployments/#create-a-deployment-status
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $id the deployment number
|
||||
* @param array $params The information about the deployment update.
|
||||
* Must include a "state" field of pending, success, error, or failure.
|
||||
* May also be given a target_url and description, ßee link for more details.
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array information about the deployment
|
||||
*/
|
||||
public function updateStatus($username, $repository, $id, array $params)
|
||||
{
|
||||
if (!isset($params['state'])) {
|
||||
throw new MissingArgumentException(['state']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all of the status updates tied to a given deployment.
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $id the deployment identifier
|
||||
*
|
||||
* @return array the deployment statuses
|
||||
*/
|
||||
public function getStatuses($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/deployments/'.rawurlencode($id).'/statuses');
|
||||
}
|
||||
}
|
||||
51
vendor/knplabs/github-api/lib/Github/Api/Enterprise.php
vendored
Normal file
51
vendor/knplabs/github-api/lib/Github/Api/Enterprise.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Api\Enterprise\License;
|
||||
use Github\Api\Enterprise\ManagementConsole;
|
||||
use Github\Api\Enterprise\Stats;
|
||||
use Github\Api\Enterprise\UserAdmin;
|
||||
|
||||
/**
|
||||
* Getting information about a GitHub Enterprise instance.
|
||||
*
|
||||
* @link https://developer.github.com/v3/enterprise/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @author Guillermo A. Fisher <guillermoandraefisher@gmail.com>
|
||||
*/
|
||||
class Enterprise extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* @return Stats
|
||||
*/
|
||||
public function stats()
|
||||
{
|
||||
return new Stats($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return License
|
||||
*/
|
||||
public function license()
|
||||
{
|
||||
return new License($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ManagementConsole
|
||||
*/
|
||||
public function console()
|
||||
{
|
||||
return new ManagementConsole($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UserAdmin
|
||||
*/
|
||||
public function userAdmin()
|
||||
{
|
||||
return new UserAdmin($this->client);
|
||||
}
|
||||
}
|
||||
20
vendor/knplabs/github-api/lib/Github/Api/Enterprise/License.php
vendored
Normal file
20
vendor/knplabs/github-api/lib/Github/Api/Enterprise/License.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Enterprise;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
class License extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Provides information about your Enterprise license (only available to site admins).
|
||||
*
|
||||
* @link https://developer.github.com/v3/enterprise/license/
|
||||
*
|
||||
* @return array array of license information
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
return $this->get('/enterprise/settings/license');
|
||||
}
|
||||
}
|
||||
77
vendor/knplabs/github-api/lib/Github/Api/Enterprise/ManagementConsole.php
vendored
Normal file
77
vendor/knplabs/github-api/lib/Github/Api/Enterprise/ManagementConsole.php
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Enterprise;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
class ManagementConsole extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Checks the status of your installation’s most recent configuration process.
|
||||
*
|
||||
* @link https://developer.github.com/v3/enterprise/management_console/#check-configuration-status
|
||||
*
|
||||
* @param string $hash md5 hash of your license
|
||||
*
|
||||
* @return array array of configuration status information
|
||||
*/
|
||||
public function configcheck($hash)
|
||||
{
|
||||
return $this->getWithLicenseHash('/setup/api/configcheck', $hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves your installation’s settings.
|
||||
*
|
||||
* @link https://developer.github.com/v3/enterprise/management_console/#retrieve-settings
|
||||
*
|
||||
* @param string $hash md5 hash of your license
|
||||
*
|
||||
* @return array array of settings
|
||||
*/
|
||||
public function settings($hash)
|
||||
{
|
||||
return $this->getWithLicenseHash('/setup/api/settings', $hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks your installation’s maintenance status.
|
||||
*
|
||||
* @link https://developer.github.com/v3/enterprise/management_console/#check-maintenance-status
|
||||
*
|
||||
* @param string $hash md5 hash of your license
|
||||
*
|
||||
* @return array array of maintenance status information
|
||||
*/
|
||||
public function maintenance($hash)
|
||||
{
|
||||
return $this->getWithLicenseHash('/setup/api/maintenance', $hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves your installation’s authorized SSH keys.
|
||||
*
|
||||
* @link https://developer.github.com/v3/enterprise/management_console/#retrieve-authorized-ssh-keys
|
||||
*
|
||||
* @param string $hash md5 hash of your license
|
||||
*
|
||||
* @return array array of authorized keys
|
||||
*/
|
||||
public function keys($hash)
|
||||
{
|
||||
return $this->getWithLicenseHash('/setup/api/settings/authorized-keys', $hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an authenticated GET request.
|
||||
*
|
||||
* @param string $uri the request URI
|
||||
* @param string $hash md5 hash of your license
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
protected function getWithLicenseHash($uri, $hash)
|
||||
{
|
||||
return $this->get($uri, ['license_md5' => rawurlencode($hash)]);
|
||||
}
|
||||
}
|
||||
128
vendor/knplabs/github-api/lib/Github/Api/Enterprise/Stats.php
vendored
Normal file
128
vendor/knplabs/github-api/lib/Github/Api/Enterprise/Stats.php
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Enterprise;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
class Stats extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Returns the number of open and closed issues.
|
||||
*
|
||||
* @return array array with totals of open and closed issues
|
||||
*/
|
||||
public function issues()
|
||||
{
|
||||
return $this->show('issues');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of active and inactive hooks.
|
||||
*
|
||||
* @return array array with totals of active and inactive hooks
|
||||
*/
|
||||
public function hooks()
|
||||
{
|
||||
return $this->show('hooks');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of open and closed milestones.
|
||||
*
|
||||
* @return array array with totals of open and closed milestones
|
||||
*/
|
||||
public function milestones()
|
||||
{
|
||||
return $this->show('milestones');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of organizations, teams, team members, and disabled organizations.
|
||||
*
|
||||
* @return array array with totals of organizations, teams, team members, and disabled organizations
|
||||
*/
|
||||
public function orgs()
|
||||
{
|
||||
return $this->show('orgs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of comments on issues, pull requests, commits, and gists.
|
||||
*
|
||||
* @return array array with totals of comments on issues, pull requests, commits, and gists
|
||||
*/
|
||||
public function comments()
|
||||
{
|
||||
return $this->show('comments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of GitHub Pages sites.
|
||||
*
|
||||
* @return array array with totals of GitHub Pages sites
|
||||
*/
|
||||
public function pages()
|
||||
{
|
||||
return $this->show('pages');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of suspended and admin users.
|
||||
*
|
||||
* @return array array with totals of suspended and admin users
|
||||
*/
|
||||
public function users()
|
||||
{
|
||||
return $this->show('users');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of private and public gists.
|
||||
*
|
||||
* @return array array with totals of private and public gists
|
||||
*/
|
||||
public function gists()
|
||||
{
|
||||
return $this->show('gists');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of merged, mergeable, and unmergeable pull requests.
|
||||
*
|
||||
* @return array array with totals of merged, mergeable, and unmergeable pull requests
|
||||
*/
|
||||
public function pulls()
|
||||
{
|
||||
return $this->show('pulls');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of organization-owned repositories, root repositories, forks, pushed commits, and wikis.
|
||||
*
|
||||
* @return array array with totals of organization-owned repositories, root repositories, forks, pushed commits, and wikis
|
||||
*/
|
||||
public function repos()
|
||||
{
|
||||
return $this->show('repos');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all of the statistics.
|
||||
*
|
||||
* @return array array with all of the statistics
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->show('all');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type The type of statistics to show
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($type)
|
||||
{
|
||||
return $this->get('/enterprise/stats/'.rawurlencode($type));
|
||||
}
|
||||
}
|
||||
36
vendor/knplabs/github-api/lib/Github/Api/Enterprise/UserAdmin.php
vendored
Normal file
36
vendor/knplabs/github-api/lib/Github/Api/Enterprise/UserAdmin.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Enterprise;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
class UserAdmin extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Suspend a user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/users/administration/#suspend-a-user
|
||||
*
|
||||
* @param string $username
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function suspend($username)
|
||||
{
|
||||
return $this->put('/users/'.rawurldecode($username).'/suspended', ['Content-Length' => 0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsuspend a user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/users/administration/#unsuspend-a-user
|
||||
*
|
||||
* @param string $username
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function unsuspend($username)
|
||||
{
|
||||
return $this->delete('/users/'.rawurldecode($username).'/suspended');
|
||||
}
|
||||
}
|
||||
101
vendor/knplabs/github-api/lib/Github/Api/Gist/Comments.php
vendored
Normal file
101
vendor/knplabs/github-api/lib/Github/Api/Gist/Comments.php
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Gist;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/gists/comments/
|
||||
*
|
||||
* @author Kayla Daniels <kayladnls@gmail.com>
|
||||
*/
|
||||
class Comments extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @link https://developer.github.com/v3/gists/comments/#custom-media-types
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if (!in_array($bodyType, ['text', 'html', 'full'])) {
|
||||
$bodyType = 'raw';
|
||||
}
|
||||
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->client->getApiVersion(), $bodyType);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all comments for a gist.
|
||||
*
|
||||
* @param string $gist
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($gist)
|
||||
{
|
||||
return $this->get('/gists/'.rawurlencode($gist).'/comments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a comment of a gist.
|
||||
*
|
||||
* @param string $gist
|
||||
* @param int $comment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($gist, $comment)
|
||||
{
|
||||
return $this->get('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a comment for gist.
|
||||
*
|
||||
* @param string $gist
|
||||
* @param string $body
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($gist, $body)
|
||||
{
|
||||
return $this->post('/gists/'.rawurlencode($gist).'/comments', ['body' => $body]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a comment for a gist.
|
||||
*
|
||||
* @param string $gist
|
||||
* @param int $comment_id
|
||||
* @param string $body
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update($gist, $comment_id, $body)
|
||||
{
|
||||
return $this->patch('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment_id), ['body' => $body]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a comment for a gist.
|
||||
*
|
||||
* @param string $gist
|
||||
* @param int $comment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($gist, $comment)
|
||||
{
|
||||
return $this->delete('/gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment));
|
||||
}
|
||||
}
|
||||
116
vendor/knplabs/github-api/lib/Github/Api/Gists.php
vendored
Normal file
116
vendor/knplabs/github-api/lib/Github/Api/Gists.php
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Api\Gist\Comments;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* Creating, editing, deleting and listing gists.
|
||||
*
|
||||
* @link http://developer.github.com/v3/gists/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @author Edoardo Rivello <edoardo.rivello at gmail dot com>
|
||||
*/
|
||||
class Gists extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @link https://developer.github.com/v3/gists/#custom-media-types
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if (!in_array($bodyType, ['base64'])) {
|
||||
$bodyType = 'raw';
|
||||
}
|
||||
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s', $this->client->getApiVersion(), $bodyType);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function all($type = null)
|
||||
{
|
||||
if (!in_array($type, ['public', 'starred'])) {
|
||||
return $this->get('/gists');
|
||||
}
|
||||
|
||||
return $this->get('/gists/'.rawurlencode($type));
|
||||
}
|
||||
|
||||
public function show($number)
|
||||
{
|
||||
return $this->get('/gists/'.rawurlencode($number));
|
||||
}
|
||||
|
||||
public function create(array $params)
|
||||
{
|
||||
if (!isset($params['files']) || (!is_array($params['files']) || 0 === count($params['files']))) {
|
||||
throw new MissingArgumentException('files');
|
||||
}
|
||||
|
||||
$params['public'] = (bool) $params['public'];
|
||||
|
||||
return $this->post('/gists', $params);
|
||||
}
|
||||
|
||||
public function update($id, array $params)
|
||||
{
|
||||
return $this->patch('/gists/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
public function commits($id)
|
||||
{
|
||||
return $this->get('/gists/'.rawurlencode($id).'/commits');
|
||||
}
|
||||
|
||||
public function fork($id)
|
||||
{
|
||||
return $this->post('/gists/'.rawurlencode($id).'/fork');
|
||||
}
|
||||
|
||||
public function forks($id)
|
||||
{
|
||||
return $this->get('/gists/'.rawurlencode($id).'/forks');
|
||||
}
|
||||
|
||||
public function remove($id)
|
||||
{
|
||||
return $this->delete('/gists/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
public function check($id)
|
||||
{
|
||||
return $this->get('/gists/'.rawurlencode($id).'/star');
|
||||
}
|
||||
|
||||
public function star($id)
|
||||
{
|
||||
return $this->put('/gists/'.rawurlencode($id).'/star');
|
||||
}
|
||||
|
||||
public function unstar($id)
|
||||
{
|
||||
return $this->delete('/gists/'.rawurlencode($id).'/star');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a gist's comments.
|
||||
*
|
||||
* @link http://developer.github.com/v3/gists/comments/
|
||||
*
|
||||
* @return Comments
|
||||
*/
|
||||
public function comments()
|
||||
{
|
||||
return new Comments($this->client);
|
||||
}
|
||||
}
|
||||
59
vendor/knplabs/github-api/lib/Github/Api/GitData.php
vendored
Normal file
59
vendor/knplabs/github-api/lib/Github/Api/GitData.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Api\GitData\Blobs;
|
||||
use Github\Api\GitData\Commits;
|
||||
use Github\Api\GitData\References;
|
||||
use Github\Api\GitData\Tags;
|
||||
use Github\Api\GitData\Trees;
|
||||
|
||||
/**
|
||||
* Getting full versions of specific files and trees in your Git repositories.
|
||||
*
|
||||
* @link http://developer.github.com/v3/git/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class GitData extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* @return Blobs
|
||||
*/
|
||||
public function blobs()
|
||||
{
|
||||
return new Blobs($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Commits
|
||||
*/
|
||||
public function commits()
|
||||
{
|
||||
return new Commits($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return References
|
||||
*/
|
||||
public function references()
|
||||
{
|
||||
return new References($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Tags
|
||||
*/
|
||||
public function tags()
|
||||
{
|
||||
return new Tags($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Trees
|
||||
*/
|
||||
public function trees()
|
||||
{
|
||||
return new Trees($this->client);
|
||||
}
|
||||
}
|
||||
70
vendor/knplabs/github-api/lib/Github/Api/GitData/Blobs.php
vendored
Normal file
70
vendor/knplabs/github-api/lib/Github/Api/GitData/Blobs.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\GitData;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/git/blobs/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class Blobs extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the Accept header depending on the blob type.
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if ('raw' === $bodyType) {
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.raw', $this->client->getApiVersion());
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a blob of a sha for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $sha
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $sha)
|
||||
{
|
||||
$response = $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a blob of a sha for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['content'], $params['encoding'])) {
|
||||
throw new MissingArgumentException(['content', 'encoding']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs', $params);
|
||||
}
|
||||
}
|
||||
48
vendor/knplabs/github-api/lib/Github/Api/GitData/Commits.php
vendored
Normal file
48
vendor/knplabs/github-api/lib/Github/Api/GitData/Commits.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\GitData;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/git/commits/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Commits extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Show a commit for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $sha
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $sha)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits/'.rawurlencode($sha));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a commit for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['message'], $params['tree'], $params['parents'])) {
|
||||
throw new MissingArgumentException(['message', 'tree', 'parents']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/commits', $params);
|
||||
}
|
||||
}
|
||||
140
vendor/knplabs/github-api/lib/Github/Api/GitData/References.php
vendored
Normal file
140
vendor/knplabs/github-api/lib/Github/Api/GitData/References.php
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\GitData;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/git/references/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class References extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get all references of a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all branches of a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function branches($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/heads');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all tags of a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function tags($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the reference of a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $reference
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $reference)
|
||||
{
|
||||
$reference = $this->encodeReference($reference);
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a reference for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['ref'], $params['sha'])) {
|
||||
throw new MissingArgumentException(['ref', 'sha']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a reference for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $reference
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update($username, $repository, $reference, array $params)
|
||||
{
|
||||
if (!isset($params['sha'])) {
|
||||
throw new MissingArgumentException('sha');
|
||||
}
|
||||
|
||||
$reference = $this->encodeReference($reference);
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a reference of a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $reference
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($username, $repository, $reference)
|
||||
{
|
||||
$reference = $this->encodeReference($reference);
|
||||
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/'.$reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the raw reference.
|
||||
*
|
||||
* @param string $rawReference
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function encodeReference($rawReference)
|
||||
{
|
||||
return implode('/', array_map('rawurlencode', explode('/', $rawReference)));
|
||||
}
|
||||
}
|
||||
69
vendor/knplabs/github-api/lib/Github/Api/GitData/Tags.php
vendored
Normal file
69
vendor/knplabs/github-api/lib/Github/Api/GitData/Tags.php
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\GitData;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/git/tags/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Tags extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get all tags for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/refs/tags');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a tag for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $sha
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $sha)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags/'.rawurlencode($sha));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a tag for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['tag'], $params['message'], $params['object'], $params['type'])) {
|
||||
throw new MissingArgumentException(['tag', 'message', 'object', 'type']);
|
||||
}
|
||||
|
||||
if (!isset($params['tagger'])) {
|
||||
throw new MissingArgumentException('tagger');
|
||||
}
|
||||
|
||||
if (!isset($params['tagger']['name'], $params['tagger']['email'], $params['tagger']['date'])) {
|
||||
throw new MissingArgumentException(['tagger.name', 'tagger.email', 'tagger.date']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/tags', $params);
|
||||
}
|
||||
}
|
||||
64
vendor/knplabs/github-api/lib/Github/Api/GitData/Trees.php
vendored
Normal file
64
vendor/knplabs/github-api/lib/Github/Api/GitData/Trees.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\GitData;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/git/trees/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Trees extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get the tree for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $sha
|
||||
* @param bool $recursive
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $sha, $recursive = false)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees/'.rawurlencode($sha), $recursive ? ['recursive' => 1] : []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create tree for a repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['tree']) || !is_array($params['tree'])) {
|
||||
throw new MissingArgumentException('tree');
|
||||
}
|
||||
|
||||
if (!isset($params['tree'][0])) {
|
||||
$params['tree'] = [$params['tree']];
|
||||
}
|
||||
|
||||
foreach ($params['tree'] as $key => $tree) {
|
||||
if (!isset($tree['path'], $tree['mode'], $tree['type'])) {
|
||||
throw new MissingArgumentException(["tree.$key.path", "tree.$key.mode", "tree.$key.type"]);
|
||||
}
|
||||
|
||||
// If `sha` is not set, `content` is required
|
||||
if (!isset($tree['sha']) && !isset($tree['content'])) {
|
||||
throw new MissingArgumentException("tree.$key.content");
|
||||
}
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/trees', $params);
|
||||
}
|
||||
}
|
||||
47
vendor/knplabs/github-api/lib/Github/Api/GraphQL.php
vendored
Normal file
47
vendor/knplabs/github-api/lib/Github/Api/GraphQL.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
/**
|
||||
* GraphQL API.
|
||||
*
|
||||
* Part of the Github v4 API
|
||||
*
|
||||
* @link https://developer.github.com/v4/
|
||||
*
|
||||
* @author Miguel Piedrafita <soy@miguelpiedrafita.com>
|
||||
*/
|
||||
class GraphQL extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param array $variables
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function execute($query, array $variables = [])
|
||||
{
|
||||
$this->acceptHeaderValue = 'application/vnd.github.v4+json';
|
||||
$params = [
|
||||
'query' => $query,
|
||||
];
|
||||
if (!empty($variables)) {
|
||||
$params['variables'] = json_encode($variables);
|
||||
}
|
||||
|
||||
return $this->post('/graphql', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
* @param array $variables
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fromFile($file, array $variables = [])
|
||||
{
|
||||
return $this->execute(file_get_contents($file), $variables);
|
||||
}
|
||||
}
|
||||
26
vendor/knplabs/github-api/lib/Github/Api/Integrations.php
vendored
Normal file
26
vendor/knplabs/github-api/lib/Github/Api/Integrations.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
@trigger_error('The '.__NAMESPACE__.'\Integrations class is deprecated. Use the '.__NAMESPACE__.'\Apps class instead.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* @deprecated Use the Apps class
|
||||
* @link https://developer.github.com/v3/apps/
|
||||
*
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class Integrations extends Apps
|
||||
{
|
||||
/**
|
||||
* @deprecated
|
||||
* Configure the accept header for Early Access to the integrations api (DEPRECATED)
|
||||
* @see https://developer.github.com/v3/apps/
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
263
vendor/knplabs/github-api/lib/Github/Api/Issue.php
vendored
Normal file
263
vendor/knplabs/github-api/lib/Github/Api/Issue.php
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Api\Issue\Assignees;
|
||||
use Github\Api\Issue\Comments;
|
||||
use Github\Api\Issue\Events;
|
||||
use Github\Api\Issue\Labels;
|
||||
use Github\Api\Issue\Milestones;
|
||||
use Github\Api\Issue\Timeline;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* Listing issues, searching, editing and closing your projects issues.
|
||||
*
|
||||
* @link http://develop.github.com/p/issues.html
|
||||
*
|
||||
* @author Thibault Duplessis <thibault.duplessis at gmail dot com>
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Issue extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/#custom-media-types
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if (!in_array($bodyType, ['text', 'html', 'full'])) {
|
||||
$bodyType = 'raw';
|
||||
}
|
||||
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->client->getApiVersion(), $bodyType);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List issues by username, repo and state.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
|
||||
*
|
||||
* @return array list of issues found
|
||||
*/
|
||||
public function all($username, $repository, array $params = [])
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', array_merge(['page' => 1], $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Search issues by username, repo, state and keyword.
|
||||
*
|
||||
* @deprecated This method is deprecated use the Search api instead. See https://developer.github.com/v3/search/legacy/#legacy-search-api-is-deprecated
|
||||
* @link http://developer.github.com/v3/search/#search-issues
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param string $state the issue state, can be open or closed
|
||||
* @param string $keyword the keyword to filter issues by
|
||||
*
|
||||
* @return array list of issues found
|
||||
*/
|
||||
public function find($username, $repository, $state, $keyword)
|
||||
{
|
||||
if (!in_array($state, ['open', 'closed'])) {
|
||||
$state = 'open';
|
||||
}
|
||||
|
||||
return $this->get('/legacy/issues/search/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($state).'/'.rawurlencode($keyword));
|
||||
}
|
||||
|
||||
/**
|
||||
* List issues by organization.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/
|
||||
*
|
||||
* @param string $organization the organization
|
||||
* @param string $state the issue state, can be open or closed
|
||||
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
|
||||
*
|
||||
* @return array list of issues found
|
||||
*/
|
||||
public function org($organization, $state, array $params = [])
|
||||
{
|
||||
if (!in_array($state, ['open', 'closed'])) {
|
||||
$state = 'open';
|
||||
}
|
||||
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/issues', array_merge(['page' => 1, 'state' => $state], $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extended information about an issue by its username, repo and number.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $id the issue number
|
||||
*
|
||||
* @return array information about the issue
|
||||
*/
|
||||
public function show($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new issue for the given username and repo.
|
||||
* The issue is assigned to the authenticated user. Requires authentication.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param array $params the new issue data
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array information about the issue
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['title'])) {
|
||||
throw new MissingArgumentException(['title']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update issue information's by username, repo and issue number. Requires authentication.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $id the issue number
|
||||
* @param array $params key=>value user attributes to update.
|
||||
* key can be title or body
|
||||
*
|
||||
* @return array information about the issue
|
||||
*/
|
||||
public function update($username, $repository, $id, array $params)
|
||||
{
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lock an issue. Users with push access can lock an issue's conversation.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/#lock-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function lock($username, $repository, $id)
|
||||
{
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id).'/lock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock an issue. Users with push access can unlock an issue's conversation.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/#lock-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function unlock($username, $repository, $id)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($id).'/lock');
|
||||
}
|
||||
|
||||
/**
|
||||
* List an issue comments.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/comments/
|
||||
*
|
||||
* @return Comments
|
||||
*/
|
||||
public function comments()
|
||||
{
|
||||
return new Comments($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all project events.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/events/
|
||||
*
|
||||
* @return Events
|
||||
*/
|
||||
public function events()
|
||||
{
|
||||
return new Events($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all project labels.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/labels/
|
||||
*
|
||||
* @return Labels
|
||||
*/
|
||||
public function labels()
|
||||
{
|
||||
return new Labels($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all project milestones.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/milestones/
|
||||
*
|
||||
* @return Milestones
|
||||
*/
|
||||
public function milestones()
|
||||
{
|
||||
return new Milestones($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all assignees.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/assignees/
|
||||
*
|
||||
* @return Assignees
|
||||
*/
|
||||
public function assignees()
|
||||
{
|
||||
return new Assignees($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all events.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/timeline/
|
||||
*
|
||||
* @return Timeline
|
||||
*/
|
||||
public function timeline()
|
||||
{
|
||||
return new Timeline($this->client);
|
||||
}
|
||||
}
|
||||
91
vendor/knplabs/github-api/lib/Github/Api/Issue/Assignees.php
vendored
Normal file
91
vendor/knplabs/github-api/lib/Github/Api/Issue/Assignees.php
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Issue;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
class Assignees extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List all the available assignees to which issues may be assigned.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listAvailable($username, $repository, array $parameters = [])
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/assignees', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if a particular user is an assignee for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/assignees/#check-assignee
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $assignee
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function check($username, $repository, $assignee)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/assignees/'.rawurlencode($assignee));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add assignees to an Issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/assignees/#add-assignees-to-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $issue
|
||||
* @param array $parameters
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function add($username, $repository, $issue, array $parameters)
|
||||
{
|
||||
if (!isset($parameters['assignees'])) {
|
||||
throw new MissingArgumentException('assignees');
|
||||
}
|
||||
|
||||
if (!is_array($parameters['assignees'])) {
|
||||
@trigger_error(sprintf('Passing the "assignees" parameter as a string in "%s" is deprecated and will throw an exception in php-github-api version 3.0. Pass an array of strings instead', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
$parameters['assignees'] = [$parameters['assignees']];
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/assignees', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove assignees from an Issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/assignees/#remove-assignees-from-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $issue
|
||||
* @param array $parameters
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function remove($username, $repository, $issue, array $parameters)
|
||||
{
|
||||
if (!isset($parameters['assignees'])) {
|
||||
throw new MissingArgumentException('assignees');
|
||||
}
|
||||
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/assignees', $parameters);
|
||||
}
|
||||
}
|
||||
135
vendor/knplabs/github-api/lib/Github/Api/Issue/Comments.php
vendored
Normal file
135
vendor/knplabs/github-api/lib/Github/Api/Issue/Comments.php
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Issue;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/issues/comments/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class Comments extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/comments/#custom-media-types
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if (!in_array($bodyType, ['raw', 'text', 'html'])) {
|
||||
$bodyType = 'full';
|
||||
}
|
||||
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->client->getApiVersion(), $bodyType);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all comments for an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $issue
|
||||
* @param int $page
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository, $issue, $page = 1)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a comment for an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/comments/#get-a-single-comment
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $comment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $comment)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a comment for an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/comments/#create-a-comment
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $issue
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, $issue, array $params)
|
||||
{
|
||||
if (!isset($params['body'])) {
|
||||
throw new MissingArgumentException('body');
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/comments', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a comment for an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/comments/#edit-a-comment
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $comment
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update($username, $repository, $comment, array $params)
|
||||
{
|
||||
if (!isset($params['body'])) {
|
||||
throw new MissingArgumentException('body');
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a comment for an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/comments/#delete-a-comment
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $comment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($username, $repository, $comment)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/comments/'.rawurlencode($comment));
|
||||
}
|
||||
}
|
||||
54
vendor/knplabs/github-api/lib/Github/Api/Issue/Events.php
vendored
Normal file
54
vendor/knplabs/github-api/lib/Github/Api/Issue/Events.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Issue;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/issues/events/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Events extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get all events for an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/events/#list-events-for-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int|null $issue
|
||||
* @param int $page
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository, $issue = null, $page = 1)
|
||||
{
|
||||
if (null !== $issue) {
|
||||
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/events';
|
||||
} else {
|
||||
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events';
|
||||
}
|
||||
|
||||
return $this->get($path, [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display an event for an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/events/#get-a-single-event
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $event
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $event)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/events/'.rawurlencode($event));
|
||||
}
|
||||
}
|
||||
192
vendor/knplabs/github-api/lib/Github/Api/Issue/Labels.php
vendored
Normal file
192
vendor/knplabs/github-api/lib/Github/Api/Issue/Labels.php
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Issue;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\InvalidArgumentException;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/issues/labels/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Labels extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get all labels for a repository or the labels for a specific issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int|null $issue
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository, $issue = null)
|
||||
{
|
||||
if ($issue === null) {
|
||||
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels';
|
||||
} else {
|
||||
$path = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels';
|
||||
}
|
||||
|
||||
return $this->get($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single label.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#get-a-single-label
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $label
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $label)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a label for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#create-a-label
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['name'])) {
|
||||
throw new MissingArgumentException('name');
|
||||
}
|
||||
if (!isset($params['color'])) {
|
||||
$params['color'] = 'FFFFFF';
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a label for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $label
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function deleteLabel($username, $repository, $label)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a label for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#update-a-label
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $label
|
||||
* @param string $newName
|
||||
* @param string $color
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update($username, $repository, $label, $newName, $color)
|
||||
{
|
||||
$params = [
|
||||
'name' => $newName,
|
||||
'color' => $color,
|
||||
];
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a label to an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $issue
|
||||
* @param string $labels
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @thorws \Github\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function add($username, $repository, $issue, $labels)
|
||||
{
|
||||
if (is_string($labels)) {
|
||||
$labels = [$labels];
|
||||
} elseif (0 === count($labels)) {
|
||||
throw new InvalidArgumentException();
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $labels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace labels for an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $issue
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function replace($username, $repository, $issue, array $params)
|
||||
{
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a label for an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $issue
|
||||
* @param string $label
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function remove($username, $repository, $issue, $label)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels/'.rawurlencode($label));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all labels from an issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $issue
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function clear($username, $repository, $issue)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/labels');
|
||||
}
|
||||
}
|
||||
139
vendor/knplabs/github-api/lib/Github/Api/Issue/Milestones.php
vendored
Normal file
139
vendor/knplabs/github-api/lib/Github/Api/Issue/Milestones.php
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Issue;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/issues/milestones/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Milestones extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get all milestones for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/milestones/#list-milestones-for-a-repository
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository, array $params = [])
|
||||
{
|
||||
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed', 'all'])) {
|
||||
$params['state'] = 'open';
|
||||
}
|
||||
if (isset($params['sort']) && !in_array($params['sort'], ['due_date', 'completeness'])) {
|
||||
$params['sort'] = 'due_date';
|
||||
}
|
||||
if (isset($params['direction']) && !in_array($params['direction'], ['asc', 'desc'])) {
|
||||
$params['direction'] = 'asc';
|
||||
}
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', array_merge([
|
||||
'page' => 1,
|
||||
'state' => 'open',
|
||||
'sort' => 'due_date',
|
||||
'direction' => 'asc',
|
||||
], $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a milestone for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/milestones/#get-a-single-milestone
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a milestone for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/milestones/#create-a-milestone
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['title'])) {
|
||||
throw new MissingArgumentException('title');
|
||||
}
|
||||
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
|
||||
$params['state'] = 'open';
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a milestone for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/milestones/#update-a-milestone
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $id
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update($username, $repository, $id, array $params)
|
||||
{
|
||||
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
|
||||
$params['state'] = 'open';
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a milestone for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/milestones/#delete-a-milestone
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $id
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function remove($username, $repository, $id)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the labels of a milestone.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function labels($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/milestones/'.rawurlencode($id).'/labels');
|
||||
}
|
||||
}
|
||||
34
vendor/knplabs/github-api/lib/Github/Api/Issue/Timeline.php
vendored
Normal file
34
vendor/knplabs/github-api/lib/Github/Api/Issue/Timeline.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Issue;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
|
||||
class Timeline extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
public function configure()
|
||||
{
|
||||
$this->acceptHeaderValue = 'application/vnd.github.mockingbird-preview';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all events for a specific issue.
|
||||
*
|
||||
* @link https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $issue
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository, $issue)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues/'.rawurlencode($issue).'/timeline');
|
||||
}
|
||||
}
|
||||
49
vendor/knplabs/github-api/lib/Github/Api/Markdown.php
vendored
Normal file
49
vendor/knplabs/github-api/lib/Github/Api/Markdown.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
/**
|
||||
* Markdown Rendering API.
|
||||
*
|
||||
* @link http://developer.github.com/v3/markdown/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Markdown extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* @param string $text
|
||||
* @param string $mode
|
||||
* @param string $context
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render($text, $mode = 'markdown', $context = null)
|
||||
{
|
||||
if (!in_array($mode, ['gfm', 'markdown'])) {
|
||||
$mode = 'markdown';
|
||||
}
|
||||
|
||||
$params = [
|
||||
'text' => $text,
|
||||
'mode' => $mode,
|
||||
];
|
||||
if (null !== $context && 'gfm' === $mode) {
|
||||
$params['context'] = $context;
|
||||
}
|
||||
|
||||
return $this->post('/markdown', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderRaw($file)
|
||||
{
|
||||
return $this->post('/markdown/raw', [
|
||||
'file' => $file,
|
||||
]);
|
||||
}
|
||||
}
|
||||
23
vendor/knplabs/github-api/lib/Github/Api/Meta.php
vendored
Normal file
23
vendor/knplabs/github-api/lib/Github/Api/Meta.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
/**
|
||||
* Getting GitHub service information.
|
||||
*
|
||||
* @link https://developer.github.com/v3/meta/
|
||||
*
|
||||
* @author Claude Dioudonnat <claude.dioudonnat@gmail.com>
|
||||
*/
|
||||
class Meta extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get the ip address of the hook and git servers for the GitHub.com service.
|
||||
*
|
||||
* @return array Information about the service of GitHub.com
|
||||
*/
|
||||
public function service()
|
||||
{
|
||||
return $this->get('/meta');
|
||||
}
|
||||
}
|
||||
44
vendor/knplabs/github-api/lib/Github/Api/Miscellaneous/CodeOfConduct.php
vendored
Normal file
44
vendor/knplabs/github-api/lib/Github/Api/Miscellaneous/CodeOfConduct.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Miscellaneous;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
|
||||
class CodeOfConduct extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
public function configure()
|
||||
{
|
||||
$this->acceptHeaderValue = 'application/vnd.github.scarlet-witch-preview+json';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List all codes of conduct.
|
||||
*
|
||||
* @link https://developer.github.com/v3/codes_of_conduct/#list-all-codes-of-conduct
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->get('/codes_of_conduct');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an individual code of conduct.
|
||||
*
|
||||
* @link https://developer.github.com/v3/codes_of_conduct/#get-an-individual-code-of-conduct
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($key)
|
||||
{
|
||||
return $this->get('/codes_of_conduct/'.rawurlencode($key));
|
||||
}
|
||||
}
|
||||
20
vendor/knplabs/github-api/lib/Github/Api/Miscellaneous/Emojis.php
vendored
Normal file
20
vendor/knplabs/github-api/lib/Github/Api/Miscellaneous/Emojis.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Miscellaneous;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
class Emojis extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Lists all the emojis available to use on GitHub.
|
||||
*
|
||||
* @link https://developer.github.com/v3/emojis/
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->get('/emojis');
|
||||
}
|
||||
}
|
||||
34
vendor/knplabs/github-api/lib/Github/Api/Miscellaneous/Gitignore.php
vendored
Normal file
34
vendor/knplabs/github-api/lib/Github/Api/Miscellaneous/Gitignore.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Miscellaneous;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
class Gitignore extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List all templates available to pass as an option when creating a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/gitignore/#listing-available-templates
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->get('/gitignore/templates');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single template.
|
||||
*
|
||||
* @link https://developer.github.com/v3/gitignore/#get-a-single-template
|
||||
*
|
||||
* @param string $template
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($template)
|
||||
{
|
||||
return $this->get('/gitignore/templates/'.rawurlencode($template));
|
||||
}
|
||||
}
|
||||
90
vendor/knplabs/github-api/lib/Github/Api/Notification.php
vendored
Normal file
90
vendor/knplabs/github-api/lib/Github/Api/Notification.php
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* API for accessing Notifications from your Git/Github repositories.
|
||||
*
|
||||
* Important! You have to be authenticated to perform these methods
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/notifications/
|
||||
*
|
||||
* @author Dennis de Greef <github@link0.net>
|
||||
*/
|
||||
class Notification extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get a listing of notifications.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/notifications/
|
||||
*
|
||||
* @param bool $includingRead
|
||||
* @param bool $participating
|
||||
* @param DateTime|null $since
|
||||
*
|
||||
* @return array array of notifications
|
||||
*/
|
||||
public function all($includingRead = false, $participating = false, DateTime $since = null, DateTime $before = null)
|
||||
{
|
||||
$parameters = [
|
||||
'all' => $includingRead,
|
||||
'participating' => $participating,
|
||||
];
|
||||
|
||||
if ($since !== null) {
|
||||
$parameters['since'] = $since->format(DateTime::ISO8601);
|
||||
}
|
||||
|
||||
if ($before !== null) {
|
||||
$parameters['before'] = $before->format(DateTime::ISO8601);
|
||||
}
|
||||
|
||||
return $this->get('/notifications', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks all notifications as read from the current date.
|
||||
*
|
||||
* Optionally give DateTime to mark as read before that date.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/notifications/#mark-as-read
|
||||
*
|
||||
* @param DateTime|null $since
|
||||
*/
|
||||
public function markRead(DateTime $since = null)
|
||||
{
|
||||
$parameters = [];
|
||||
|
||||
if ($since !== null) {
|
||||
$parameters['last_read_at'] = $since->format(DateTime::ISO8601);
|
||||
}
|
||||
|
||||
$this->put('/notifications', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a single thread as read using its ID.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function markThreadRead($id)
|
||||
{
|
||||
$this->patch('/notifications/threads/'.$id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a single thread using its ID.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function id($id)
|
||||
{
|
||||
return $this->get('/notifications/threads/'.$id);
|
||||
}
|
||||
}
|
||||
104
vendor/knplabs/github-api/lib/Github/Api/Organization.php
vendored
Normal file
104
vendor/knplabs/github-api/lib/Github/Api/Organization.php
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Api\Organization\Hooks;
|
||||
use Github\Api\Organization\Members;
|
||||
use Github\Api\Organization\Teams;
|
||||
|
||||
/**
|
||||
* Getting organization information and managing authenticated organization account information.
|
||||
*
|
||||
* @link http://developer.github.com/v3/orgs/
|
||||
*
|
||||
* @author Antoine Berranger <antoine at ihqs dot net>
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Organization extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* @link https://developer.github.com/v3/orgs/#list-all-organizations
|
||||
*
|
||||
* @return array the organizations
|
||||
*/
|
||||
public function all($since = '')
|
||||
{
|
||||
return $this->get('/organizations?since='.rawurlencode($since));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extended information about an organization by its name.
|
||||
*
|
||||
* @link http://developer.github.com/v3/orgs/#get
|
||||
*
|
||||
* @param string $organization the organization to show
|
||||
*
|
||||
* @return array information about the organization
|
||||
*/
|
||||
public function show($organization)
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization));
|
||||
}
|
||||
|
||||
public function update($organization, array $params)
|
||||
{
|
||||
return $this->patch('/orgs/'.rawurlencode($organization), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all repositories across all the organizations that you can access.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/#list-organization-repositories
|
||||
*
|
||||
* @param string $organization the user name
|
||||
* @param string $type the type of repositories
|
||||
* @param int $page the page
|
||||
*
|
||||
* @return array the repositories
|
||||
*/
|
||||
public function repositories($organization, $type = 'all', $page = 1)
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/repos', [
|
||||
'type' => $type,
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Members
|
||||
*/
|
||||
public function members()
|
||||
{
|
||||
return new Members($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Hooks
|
||||
*/
|
||||
public function hooks()
|
||||
{
|
||||
return new Hooks($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Teams
|
||||
*/
|
||||
public function teams()
|
||||
{
|
||||
return new Teams($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/issues/#list-issues
|
||||
*
|
||||
* @param $organization
|
||||
* @param array $params
|
||||
* @param int $page
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function issues($organization, array $params = [], $page = 1)
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/issues', array_merge(['page' => $page], $params));
|
||||
}
|
||||
}
|
||||
111
vendor/knplabs/github-api/lib/Github/Api/Organization/Hooks.php
vendored
Normal file
111
vendor/knplabs/github-api/lib/Github/Api/Organization/Hooks.php
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Organization;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
class Hooks extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List hooks.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/hooks/#list-hooks
|
||||
*
|
||||
* @param string $organization
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($organization)
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/hooks');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single hook.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/hooks/#get-single-hook
|
||||
*
|
||||
* @param string $organization
|
||||
* @param int $id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($organization, $id)
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a hook.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/hooks/#create-a-hook
|
||||
*
|
||||
* @param string $organization
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($organization, array $params)
|
||||
{
|
||||
if (!isset($params['name'], $params['config'])) {
|
||||
throw new MissingArgumentException(['name', 'config']);
|
||||
}
|
||||
|
||||
return $this->post('/orgs/'.rawurlencode($organization).'/hooks', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a hook.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/hooks/#edit-a-hook
|
||||
*
|
||||
* @param string $organization
|
||||
* @param int $id
|
||||
* @param array $params
|
||||
*
|
||||
* @throws \Github\Exception\MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update($organization, $id, array $params)
|
||||
{
|
||||
if (!isset($params['config'])) {
|
||||
throw new MissingArgumentException(['config']);
|
||||
}
|
||||
|
||||
return $this->patch('/orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ping a hook.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/hooks/#ping-a-hook
|
||||
*
|
||||
* @param string $organization
|
||||
* @param int $id
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function ping($organization, $id)
|
||||
{
|
||||
return $this->post('/orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id).'/pings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a hook.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/hooks/#delete-a-hook
|
||||
*
|
||||
* @param string $organization
|
||||
* @param int $id
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function remove($organization, $id)
|
||||
{
|
||||
return $this->delete('/orgs/'.rawurlencode($organization).'/hooks/'.rawurlencode($id));
|
||||
}
|
||||
}
|
||||
75
vendor/knplabs/github-api/lib/Github/Api/Organization/Members.php
vendored
Normal file
75
vendor/knplabs/github-api/lib/Github/Api/Organization/Members.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Organization;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/orgs/members/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Members extends AbstractApi
|
||||
{
|
||||
public function all($organization, $type = null, $filter = 'all', $role = null)
|
||||
{
|
||||
$parameters = [];
|
||||
$path = '/orgs/'.rawurlencode($organization).'/';
|
||||
if (null === $type) {
|
||||
$path .= 'members';
|
||||
if (null !== $filter) {
|
||||
$parameters['filter'] = $filter;
|
||||
}
|
||||
if (null !== $role) {
|
||||
$parameters['role'] = $role;
|
||||
}
|
||||
} else {
|
||||
$path .= 'public_members';
|
||||
}
|
||||
|
||||
return $this->get($path, $parameters);
|
||||
}
|
||||
|
||||
public function show($organization, $username)
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
public function member($organization, $username)
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
public function check($organization, $username)
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
public function publicize($organization, $username)
|
||||
{
|
||||
return $this->put('/orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
public function conceal($organization, $username)
|
||||
{
|
||||
return $this->delete('/orgs/'.rawurlencode($organization).'/public_members/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
/*
|
||||
* Add user to organization
|
||||
*/
|
||||
public function add($organization, $username)
|
||||
{
|
||||
return $this->put('/orgs/'.rawurlencode($organization).'/memberships/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
public function addMember($organization, $username)
|
||||
{
|
||||
return $this->add($organization, $username);
|
||||
}
|
||||
|
||||
public function remove($organization, $username)
|
||||
{
|
||||
return $this->delete('/orgs/'.rawurlencode($organization).'/members/'.rawurlencode($username));
|
||||
}
|
||||
}
|
||||
23
vendor/knplabs/github-api/lib/Github/Api/Organization/Projects.php
vendored
Normal file
23
vendor/knplabs/github-api/lib/Github/Api/Organization/Projects.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Organization;
|
||||
|
||||
use Github\Api\Project\AbstractProjectApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
class Projects extends AbstractProjectApi
|
||||
{
|
||||
public function all($organization, array $params = [])
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/projects', array_merge(['page' => 1], $params));
|
||||
}
|
||||
|
||||
public function create($organization, array $params)
|
||||
{
|
||||
if (!isset($params['name'])) {
|
||||
throw new MissingArgumentException(['name']);
|
||||
}
|
||||
|
||||
return $this->post('/orgs/'.rawurlencode($organization).'/projects', $params);
|
||||
}
|
||||
}
|
||||
100
vendor/knplabs/github-api/lib/Github/Api/Organization/Teams.php
vendored
Normal file
100
vendor/knplabs/github-api/lib/Github/Api/Organization/Teams.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Organization;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/orgs/teams/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Teams extends AbstractApi
|
||||
{
|
||||
public function all($organization)
|
||||
{
|
||||
return $this->get('/orgs/'.rawurlencode($organization).'/teams');
|
||||
}
|
||||
|
||||
public function create($organization, array $params)
|
||||
{
|
||||
if (!isset($params['name'])) {
|
||||
throw new MissingArgumentException('name');
|
||||
}
|
||||
if (isset($params['repo_names']) && !is_array($params['repo_names'])) {
|
||||
$params['repo_names'] = [$params['repo_names']];
|
||||
}
|
||||
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin'])) {
|
||||
$params['permission'] = 'pull';
|
||||
}
|
||||
|
||||
return $this->post('/orgs/'.rawurlencode($organization).'/teams', $params);
|
||||
}
|
||||
|
||||
public function show($team)
|
||||
{
|
||||
return $this->get('/teams/'.rawurlencode($team));
|
||||
}
|
||||
|
||||
public function update($team, array $params)
|
||||
{
|
||||
if (!isset($params['name'])) {
|
||||
throw new MissingArgumentException('name');
|
||||
}
|
||||
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin'])) {
|
||||
$params['permission'] = 'pull';
|
||||
}
|
||||
|
||||
return $this->patch('/teams/'.rawurlencode($team), $params);
|
||||
}
|
||||
|
||||
public function remove($team)
|
||||
{
|
||||
return $this->delete('/teams/'.rawurlencode($team));
|
||||
}
|
||||
|
||||
public function members($team)
|
||||
{
|
||||
return $this->get('/teams/'.rawurlencode($team).'/members');
|
||||
}
|
||||
|
||||
public function check($team, $username)
|
||||
{
|
||||
return $this->get('/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
public function addMember($team, $username)
|
||||
{
|
||||
return $this->put('/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
public function removeMember($team, $username)
|
||||
{
|
||||
return $this->delete('/teams/'.rawurlencode($team).'/memberships/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
public function repositories($team)
|
||||
{
|
||||
return $this->get('/teams/'.rawurlencode($team).'/repos');
|
||||
}
|
||||
|
||||
public function repository($team, $organization, $repository)
|
||||
{
|
||||
return $this->get('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository));
|
||||
}
|
||||
|
||||
public function addRepository($team, $organization, $repository, $params = [])
|
||||
{
|
||||
if (isset($params['permission']) && !in_array($params['permission'], ['pull', 'push', 'admin'])) {
|
||||
$params['permission'] = 'pull';
|
||||
}
|
||||
|
||||
return $this->put('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository), $params);
|
||||
}
|
||||
|
||||
public function removeRepository($team, $organization, $repository)
|
||||
{
|
||||
return $this->delete('/teams/'.rawurlencode($team).'/repos/'.rawurlencode($organization).'/'.rawurlencode($repository));
|
||||
}
|
||||
}
|
||||
45
vendor/knplabs/github-api/lib/Github/Api/Project/AbstractProjectApi.php
vendored
Normal file
45
vendor/knplabs/github-api/lib/Github/Api/Project/AbstractProjectApi.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Project;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
|
||||
abstract class AbstractProjectApi extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the accept header for Early Access to the projects api.
|
||||
*
|
||||
* @see https://developer.github.com/v3/repos/projects/#projects
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure()
|
||||
{
|
||||
$this->acceptHeaderValue = 'application/vnd.github.inertia-preview+json';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function show($id, array $params = [])
|
||||
{
|
||||
return $this->get('/projects/'.rawurlencode($id), array_merge(['page' => 1], $params));
|
||||
}
|
||||
|
||||
public function update($id, array $params)
|
||||
{
|
||||
return $this->patch('/projects/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
public function deleteProject($id)
|
||||
{
|
||||
return $this->delete('/projects/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
public function columns()
|
||||
{
|
||||
return new Columns($this->client);
|
||||
}
|
||||
}
|
||||
60
vendor/knplabs/github-api/lib/Github/Api/Project/Cards.php
vendored
Normal file
60
vendor/knplabs/github-api/lib/Github/Api/Project/Cards.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Project;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
class Cards extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the accept header for Early Access to the projects api.
|
||||
*
|
||||
* @see https://developer.github.com/v3/repos/projects/#projects
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure()
|
||||
{
|
||||
$this->acceptHeaderValue = 'application/vnd.github.inertia-preview+json';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function all($columnId, array $params = [])
|
||||
{
|
||||
return $this->get('/projects/columns/'.rawurlencode($columnId).'/cards', array_merge(['page' => 1], $params));
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return $this->get('/projects/columns/cards/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
public function create($columnId, array $params)
|
||||
{
|
||||
return $this->post('/projects/columns/'.rawurlencode($columnId).'/cards', $params);
|
||||
}
|
||||
|
||||
public function update($id, array $params)
|
||||
{
|
||||
return $this->patch('/projects/columns/cards/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
public function deleteCard($id)
|
||||
{
|
||||
return $this->delete('/projects/columns/cards/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
public function move($id, array $params)
|
||||
{
|
||||
if (!isset($params['position'])) {
|
||||
throw new MissingArgumentException(['position']);
|
||||
}
|
||||
|
||||
return $this->post('/projects/columns/cards/'.rawurlencode($id).'/moves', $params);
|
||||
}
|
||||
}
|
||||
73
vendor/knplabs/github-api/lib/Github/Api/Project/Columns.php
vendored
Normal file
73
vendor/knplabs/github-api/lib/Github/Api/Project/Columns.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Project;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
class Columns extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the accept header for Early Access to the projects api.
|
||||
*
|
||||
* @see https://developer.github.com/v3/repos/projects/#projects
|
||||
*
|
||||
* return self
|
||||
*/
|
||||
public function configure()
|
||||
{
|
||||
$this->acceptHeaderValue = 'application/vnd.github.inertia-preview+json';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function all($projectId, array $params = [])
|
||||
{
|
||||
return $this->get('/projects/'.rawurlencode($projectId).'/columns', array_merge(['page' => 1], $params));
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return $this->get('/projects/columns/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
public function create($projectId, array $params)
|
||||
{
|
||||
if (!isset($params['name'])) {
|
||||
throw new MissingArgumentException(['name']);
|
||||
}
|
||||
|
||||
return $this->post('/projects/'.rawurlencode($projectId).'/columns', $params);
|
||||
}
|
||||
|
||||
public function update($id, array $params)
|
||||
{
|
||||
if (!isset($params['name'])) {
|
||||
throw new MissingArgumentException(['name']);
|
||||
}
|
||||
|
||||
return $this->patch('/projects/columns/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
public function deleteColumn($id)
|
||||
{
|
||||
return $this->delete('/projects/columns/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
public function move($id, array $params)
|
||||
{
|
||||
if (!isset($params['position'])) {
|
||||
throw new MissingArgumentException(['position']);
|
||||
}
|
||||
|
||||
return $this->post('/projects/columns/'.rawurlencode($id).'/moves', $params);
|
||||
}
|
||||
|
||||
public function cards()
|
||||
{
|
||||
return new Cards($this->client);
|
||||
}
|
||||
}
|
||||
203
vendor/knplabs/github-api/lib/Github/Api/PullRequest.php
vendored
Normal file
203
vendor/knplabs/github-api/lib/Github/Api/PullRequest.php
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Api\PullRequest\Comments;
|
||||
use Github\Api\PullRequest\Review;
|
||||
use Github\Api\PullRequest\ReviewRequest;
|
||||
use Github\Exception\InvalidArgumentException;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* API for accessing Pull Requests from your Git/Github repositories.
|
||||
*
|
||||
* @see http://developer.github.com/v3/pulls/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class PullRequest extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/#custom-media-types
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
* @param string|null $apiVersion
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null, $apiVersion = null)
|
||||
{
|
||||
if (!in_array($apiVersion, [])) {
|
||||
$apiVersion = $this->client->getApiVersion();
|
||||
}
|
||||
|
||||
if (!in_array($bodyType, ['text', 'html', 'full', 'diff', 'patch'])) {
|
||||
$bodyType = 'raw';
|
||||
}
|
||||
|
||||
if (!in_array($bodyType, ['diff', 'patch'])) {
|
||||
$bodyType .= '+json';
|
||||
}
|
||||
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s', $apiVersion, $bodyType);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a listing of a project's pull requests by the username, repository and (optionally) state.
|
||||
*
|
||||
* @link http://developer.github.com/v3/pulls/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param array $params a list of extra parameters.
|
||||
*
|
||||
* @return array array of pull requests for the project
|
||||
*/
|
||||
public function all($username, $repository, array $params = [])
|
||||
{
|
||||
$parameters = array_merge([
|
||||
'page' => 1,
|
||||
'per_page' => 30,
|
||||
], $params);
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all details of a pull request, including the discussions.
|
||||
*
|
||||
* @link http://developer.github.com/v3/pulls/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $id the ID of the pull request for which details are retrieved
|
||||
*
|
||||
* @return array|string pull request details
|
||||
*/
|
||||
public function show($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
public function commits($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/commits');
|
||||
}
|
||||
|
||||
public function files($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/files');
|
||||
}
|
||||
|
||||
/**
|
||||
* All statuses which are the statuses of its head branch.
|
||||
*
|
||||
* @see http://developer.github.com/v3/pulls/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $id the ID of the pull request for which statuses are retrieved
|
||||
*
|
||||
* @return array array of statuses for the project
|
||||
*/
|
||||
public function status($username, $repository, $id)
|
||||
{
|
||||
$link = $this->show($username, $repository, $id)['_links']['statuses']['href'];
|
||||
|
||||
return $this->get($link);
|
||||
}
|
||||
|
||||
public function comments()
|
||||
{
|
||||
return new Comments($this->client);
|
||||
}
|
||||
|
||||
public function reviews()
|
||||
{
|
||||
return new Review($this->client);
|
||||
}
|
||||
|
||||
public function reviewRequests()
|
||||
{
|
||||
return new ReviewRequest($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a pull request.
|
||||
*
|
||||
* @link http://developer.github.com/v3/pulls/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param array $params A String of the branch or commit SHA that you want your changes to be pulled to.
|
||||
* A String of the branch or commit SHA of your changes. Typically this will be a branch.
|
||||
* If the branch is in a fork of the original repository, specify the username first:
|
||||
* "my-user:some-branch". The String title of the Pull Request. The String body of
|
||||
* the Pull Request. The issue number. Used when title and body is not set.
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
// Two ways to create PR, using issue or title
|
||||
if (!isset($params['issue']) && !isset($params['title'])) {
|
||||
throw new MissingArgumentException(['issue', 'title']);
|
||||
}
|
||||
|
||||
if (!isset($params['base'], $params['head'])) {
|
||||
throw new MissingArgumentException(['base', 'head']);
|
||||
}
|
||||
|
||||
// If `issue` is not sent, then `body` must be sent
|
||||
if (!isset($params['issue']) && !isset($params['body'])) {
|
||||
throw new MissingArgumentException(['issue', 'body']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $params);
|
||||
}
|
||||
|
||||
public function update($username, $repository, $id, array $params)
|
||||
{
|
||||
if (isset($params['state']) && !in_array($params['state'], ['open', 'closed'])) {
|
||||
$params['state'] = 'open';
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
public function merged($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge');
|
||||
}
|
||||
|
||||
public function merge($username, $repository, $id, $message, $sha, $mergeMethod = 'merge', $title = null)
|
||||
{
|
||||
if (is_bool($mergeMethod)) {
|
||||
$mergeMethod = $mergeMethod ? 'squash' : 'merge';
|
||||
}
|
||||
|
||||
if (!in_array($mergeMethod, ['merge', 'squash', 'rebase'], true)) {
|
||||
throw new InvalidArgumentException(sprintf('"$mergeMethod" must be one of ["merge", "squash", "rebase"] ("%s" given).', $mergeMethod));
|
||||
}
|
||||
|
||||
$params = [
|
||||
'commit_message' => $message,
|
||||
'sha' => $sha,
|
||||
'merge_method' => $mergeMethod,
|
||||
];
|
||||
|
||||
if (is_string($title)) {
|
||||
$params['commit_title'] = $title;
|
||||
}
|
||||
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/merge', $params);
|
||||
}
|
||||
}
|
||||
153
vendor/knplabs/github-api/lib/Github/Api/PullRequest/Comments.php
vendored
Normal file
153
vendor/knplabs/github-api/lib/Github/Api/PullRequest/Comments.php
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\PullRequest;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/pulls/comments/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Comments extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/comments/#custom-media-types
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
* @param string|null @apiVersion
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null, $apiVersion = null)
|
||||
{
|
||||
if (!in_array($apiVersion, ['squirrel-girl-preview'])) {
|
||||
$apiVersion = $this->client->getApiVersion();
|
||||
}
|
||||
|
||||
if (!in_array($bodyType, ['text', 'html', 'full'])) {
|
||||
$bodyType = 'raw';
|
||||
}
|
||||
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $apiVersion, $bodyType);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a listing of a pull request's comments by the username, repository and pull request number
|
||||
* or all repository comments by the username and repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
|
||||
* @link https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int|null $pullRequest the pull request number
|
||||
* @param array $params a list of extra parameters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository, $pullRequest = null, array $params = [])
|
||||
{
|
||||
if (null !== $pullRequest) {
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments');
|
||||
}
|
||||
|
||||
$parameters = array_merge([
|
||||
'page' => 1,
|
||||
'per_page' => 30,
|
||||
], $params);
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single pull request comment by the username, repository and comment id.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/comments/#get-a-single-comment
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $comment the comment id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $comment)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a pull request comment by the username, repository and pull request number.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/comments/#create-a-comment
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $pullRequest the pull request number
|
||||
* @param array $params a list of extra parameters.
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, $pullRequest, array $params)
|
||||
{
|
||||
if (!isset($params['body'])) {
|
||||
throw new MissingArgumentException('body');
|
||||
}
|
||||
|
||||
// If `in_reply_to` is set, other options are not necessary anymore
|
||||
if (!isset($params['in_reply_to']) && !isset($params['commit_id'], $params['path'], $params['position'])) {
|
||||
throw new MissingArgumentException(['commit_id', 'path', 'position']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a pull request comment by the username, repository and comment id.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/comments/#edit-a-comment
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $comment the comment id
|
||||
* @param array $params a list of extra parameters.
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function update($username, $repository, $comment, array $params)
|
||||
{
|
||||
if (!isset($params['body'])) {
|
||||
throw new MissingArgumentException('body');
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a pull request comment by the username, repository and comment id.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/comments/#delete-a-comment
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $comment the comment id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function remove($username, $repository, $comment)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments/'.rawurlencode($comment));
|
||||
}
|
||||
}
|
||||
177
vendor/knplabs/github-api/lib/Github/Api/PullRequest/Review.php
vendored
Normal file
177
vendor/knplabs/github-api/lib/Github/Api/PullRequest/Review.php
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\PullRequest;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
use Github\Exception\InvalidArgumentException;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* API for accessing Pull Request Reviews from your Git/Github repositories.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/reviews/
|
||||
*
|
||||
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
|
||||
*/
|
||||
class Review extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
public function configure()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a listing of a pull request's reviews by the username, repository and pull request number.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $pullRequest the pull request number
|
||||
* @param array $params a list of extra parameters.
|
||||
*
|
||||
* @return array array of pull request reviews for the pull request
|
||||
*/
|
||||
public function all($username, $repository, $pullRequest, array $params = [])
|
||||
{
|
||||
$parameters = array_merge([
|
||||
'page' => 1,
|
||||
'per_page' => 30,
|
||||
], $params);
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single pull request review by the username, repository, pull request number and the review id.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/reviews/#get-a-single-review
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $pullRequest the pull request number
|
||||
* @param int $id the review id
|
||||
*
|
||||
* @return array the pull request review
|
||||
*/
|
||||
public function show($username, $repository, $pullRequest, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a single pull request review by the username, repository, pull request number and the review id.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $pullRequest the pull request number
|
||||
* @param int $id the review id
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function remove($username, $repository, $pullRequest, $id)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get comments for a single pull request review.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $pullRequest the pull request number
|
||||
* @param int $id the review id
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function comments($username, $repository, $pullRequest, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/reviews/'.rawurlencode($id).'/comments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a pull request review by the username, repository and pull request number.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $pullRequest the pull request number
|
||||
* @param array $params a list of extra parameters.
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array the pull request review
|
||||
*/
|
||||
public function create($username, $repository, $pullRequest, array $params = [])
|
||||
{
|
||||
if (array_key_exists('event', $params) && !in_array($params['event'], ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'], true)) {
|
||||
throw new InvalidArgumentException(sprintf('"event" must be one of ["APPROVE", "REQUEST_CHANGES", "COMMENT"] ("%s" given).', $params['event']));
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit a pull request review by the username, repository, pull request number and the review id.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $pullRequest the pull request number
|
||||
* @param int $id the review id
|
||||
* @param array $params a list of extra parameters.
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array the pull request review
|
||||
*/
|
||||
public function submit($username, $repository, $pullRequest, $id, array $params = [])
|
||||
{
|
||||
if (!isset($params['event'])) {
|
||||
throw new MissingArgumentException('event');
|
||||
}
|
||||
|
||||
if (!in_array($params['event'], ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'], true)) {
|
||||
throw new InvalidArgumentException(sprintf('"event" must be one of ["APPROVE", "REQUEST_CHANGES", "COMMENT"] ("%s" given).', $params['event']));
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/events', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss a pull request review by the username, repository, pull request number and the review id.
|
||||
*
|
||||
* @link https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the repository
|
||||
* @param int $pullRequest the pull request number
|
||||
* @param int $id the review id
|
||||
* @param string $message a mandatory dismissal message
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function dismiss($username, $repository, $pullRequest, $id, $message)
|
||||
{
|
||||
if (!is_string($message)) {
|
||||
throw new InvalidArgumentException(sprintf('"message" must be a valid string ("%s" given).', gettype($message)));
|
||||
}
|
||||
|
||||
if (empty($message)) {
|
||||
throw new InvalidArgumentException('"message" is mandatory and cannot be empty');
|
||||
}
|
||||
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/reviews/'.$id.'/dismissals', [
|
||||
'message' => $message,
|
||||
]);
|
||||
}
|
||||
}
|
||||
64
vendor/knplabs/github-api/lib/Github/Api/PullRequest/ReviewRequest.php
vendored
Normal file
64
vendor/knplabs/github-api/lib/Github/Api/PullRequest/ReviewRequest.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\PullRequest;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/pulls/review_requests/
|
||||
*/
|
||||
class ReviewRequest extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
public function configure()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/pulls/review_requests/#list-review-requests
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $pullRequest
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository, $pullRequest, array $params = [])
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/pulls/review_requests/#create-a-review-request
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $pullRequest
|
||||
* @param array $reviewers
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function create($username, $repository, $pullRequest, array $reviewers)
|
||||
{
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/pulls/review_requests/#delete-a-review-request
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $pullRequest
|
||||
* @param array $reviewers
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function remove($username, $repository, $pullRequest, array $reviewers)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.$pullRequest.'/requested_reviewers', ['reviewers' => $reviewers]);
|
||||
}
|
||||
}
|
||||
47
vendor/knplabs/github-api/lib/Github/Api/RateLimit.php
vendored
Normal file
47
vendor/knplabs/github-api/lib/Github/Api/RateLimit.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
/**
|
||||
* Get rate limits.
|
||||
*
|
||||
* @link https://developer.github.com/v3/rate_limit/
|
||||
*
|
||||
* @author Jeff Finley <quickliketurtle@gmail.com>
|
||||
*/
|
||||
class RateLimit extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get rate limits.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRateLimits()
|
||||
{
|
||||
return $this->get('/rate_limit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get core rate limit.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCoreLimit()
|
||||
{
|
||||
$response = $this->getRateLimits();
|
||||
|
||||
return $response['resources']['core']['limit'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get search rate limit.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSearchLimit()
|
||||
{
|
||||
$response = $this->getRateLimits();
|
||||
|
||||
return $response['resources']['search']['limit'];
|
||||
}
|
||||
}
|
||||
682
vendor/knplabs/github-api/lib/Github/Api/Repo.php
vendored
Normal file
682
vendor/knplabs/github-api/lib/Github/Api/Repo.php
vendored
Normal file
@@ -0,0 +1,682 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
use Github\Api\Repository\Collaborators;
|
||||
use Github\Api\Repository\Comments;
|
||||
use Github\Api\Repository\Commits;
|
||||
use Github\Api\Repository\Contents;
|
||||
use Github\Api\Repository\DeployKeys;
|
||||
use Github\Api\Repository\Downloads;
|
||||
use Github\Api\Repository\Forks;
|
||||
use Github\Api\Repository\Hooks;
|
||||
use Github\Api\Repository\Labels;
|
||||
use Github\Api\Repository\Projects;
|
||||
use Github\Api\Repository\Protection;
|
||||
use Github\Api\Repository\Releases;
|
||||
use Github\Api\Repository\Stargazers;
|
||||
use Github\Api\Repository\Statuses;
|
||||
use Github\Api\Repository\Traffic;
|
||||
|
||||
/**
|
||||
* Searching repositories, getting repository information
|
||||
* and managing repository information for authenticated users.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @author Thibault Duplessis <thibault.duplessis at gmail dot com>
|
||||
*/
|
||||
class Repo extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Search repositories by keyword.
|
||||
*
|
||||
* @deprecated This method is deprecated use the Search api instead. See https://developer.github.com/v3/search/legacy/#legacy-search-api-is-deprecated
|
||||
* @link http://developer.github.com/v3/search/#search-repositories
|
||||
*
|
||||
* @param string $keyword the search query
|
||||
* @param array $params
|
||||
*
|
||||
* @return array list of found repositories
|
||||
*/
|
||||
public function find($keyword, array $params = [])
|
||||
{
|
||||
return $this->get('/legacy/repos/search/'.rawurlencode($keyword), array_merge(['start_page' => 1], $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* List all public repositories.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/#list-all-public-repositories
|
||||
*
|
||||
* @param int|null $id The integer ID of the last Repository that you’ve seen.
|
||||
*
|
||||
* @return array list of users found
|
||||
*/
|
||||
public function all($id = null)
|
||||
{
|
||||
if (!is_int($id)) {
|
||||
return $this->get('/repositories');
|
||||
}
|
||||
|
||||
return $this->get('/repositories?since='.rawurldecode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last year of commit activity for a repository grouped by week.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/statistics/#commit-activity
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
*
|
||||
* @return array commit activity grouped by week
|
||||
*/
|
||||
public function activity($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/commit_activity');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contributor commit statistics for a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/statistics/#contributors
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
*
|
||||
* @return array list of contributors and their commit statistics
|
||||
*/
|
||||
public function statistics($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/contributors');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a weekly aggregate of the number of additions and deletions pushed to a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/statistics/#code-frequency
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
*
|
||||
* @return array list of weeks and their commit statistics
|
||||
*/
|
||||
public function frequency($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/code_frequency');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the weekly commit count for the repository owner and everyone else.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/statistics/#participation
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
*
|
||||
* @return array list of weekly commit count grouped by 'all' and 'owner'
|
||||
*/
|
||||
public function participation($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/participation');
|
||||
}
|
||||
|
||||
/**
|
||||
* List all repositories for an organization.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/#list-organization-repositories
|
||||
*
|
||||
* @param string $organization the name of the organization
|
||||
* @param array $params
|
||||
*
|
||||
* @return array list of organization repositories
|
||||
*/
|
||||
public function org($organization, array $params = [])
|
||||
{
|
||||
return $this->get('/orgs/'.$organization.'/repos', array_merge(['start_page' => 1], $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extended information about a repository by its username and repository name.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
*
|
||||
* @return array information about the repository
|
||||
*/
|
||||
public function show($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extended information about a repository by its id.
|
||||
* Note: at time of writing this is an undocumented feature but GitHub support have advised that it can be relied on.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
* @link https://github.com/piotrmurach/github/issues/283
|
||||
* @link https://github.com/piotrmurach/github/issues/282
|
||||
*
|
||||
* @param int $id the id of the repository
|
||||
*
|
||||
* @return array information about the repository
|
||||
*/
|
||||
public function showById($id)
|
||||
{
|
||||
return $this->get('/repositories/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @param string $name name of the repository
|
||||
* @param string $description repository description
|
||||
* @param string $homepage homepage url
|
||||
* @param bool $public `true` for public, `false` for private
|
||||
* @param null|string $organization username of organization if applicable
|
||||
* @param bool $hasIssues `true` to enable issues for this repository, `false` to disable them
|
||||
* @param bool $hasWiki `true` to enable the wiki for this repository, `false` to disable it
|
||||
* @param bool $hasDownloads `true` to enable downloads for this repository, `false` to disable them
|
||||
* @param int $teamId The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization.
|
||||
* @param bool $autoInit `true` to create an initial commit with empty README, `false` for no initial commit
|
||||
*
|
||||
* @return array returns repository data
|
||||
*/
|
||||
public function create(
|
||||
$name,
|
||||
$description = '',
|
||||
$homepage = '',
|
||||
$public = true,
|
||||
$organization = null,
|
||||
$hasIssues = false,
|
||||
$hasWiki = false,
|
||||
$hasDownloads = false,
|
||||
$teamId = null,
|
||||
$autoInit = false
|
||||
) {
|
||||
$path = null !== $organization ? '/orgs/'.$organization.'/repos' : '/user/repos';
|
||||
|
||||
$parameters = [
|
||||
'name' => $name,
|
||||
'description' => $description,
|
||||
'homepage' => $homepage,
|
||||
'private' => !$public,
|
||||
'has_issues' => $hasIssues,
|
||||
'has_wiki' => $hasWiki,
|
||||
'has_downloads' => $hasDownloads,
|
||||
'auto_init' => $autoInit,
|
||||
];
|
||||
|
||||
if ($organization && $teamId) {
|
||||
$parameters['team_id'] = $teamId;
|
||||
}
|
||||
|
||||
return $this->post($path, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set information of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param array $values the key => value pairs to post
|
||||
*
|
||||
* @return array information about the repository
|
||||
*/
|
||||
public function update($username, $repository, array $values)
|
||||
{
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository), $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
*
|
||||
* @return mixed null on success, array on error with 'message'
|
||||
*/
|
||||
public function remove($username, $repository)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the readme content for a repository by its username and repository name.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/contents/#get-the-readme
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param string $format one of formats: "raw", "html", or "v3+json"
|
||||
*
|
||||
* @return string|array the readme content
|
||||
*/
|
||||
public function readme($username, $repository, $format = 'raw')
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [], [
|
||||
'Accept' => "application/vnd.github.$format",
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the collaborators of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/collaborators/
|
||||
*
|
||||
* @return Collaborators
|
||||
*/
|
||||
public function collaborators()
|
||||
{
|
||||
return new Collaborators($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the comments of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/comments/
|
||||
*
|
||||
* @return Comments
|
||||
*/
|
||||
public function comments()
|
||||
{
|
||||
return new Comments($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the commits of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/commits/
|
||||
*
|
||||
* @return Commits
|
||||
*/
|
||||
public function commits()
|
||||
{
|
||||
return new Commits($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the content of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/contents/
|
||||
*
|
||||
* @return Contents
|
||||
*/
|
||||
public function contents()
|
||||
{
|
||||
return new Contents($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the content of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/downloads/
|
||||
*
|
||||
* @return Downloads
|
||||
*/
|
||||
public function downloads()
|
||||
{
|
||||
return new Downloads($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the releases of a repository (Currently Undocumented).
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @return Releases
|
||||
*/
|
||||
public function releases()
|
||||
{
|
||||
return new Releases($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the deploy keys of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/keys/
|
||||
*
|
||||
* @return DeployKeys
|
||||
*/
|
||||
public function keys()
|
||||
{
|
||||
return new DeployKeys($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the forks of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/forks/
|
||||
*
|
||||
* @return Forks
|
||||
*/
|
||||
public function forks()
|
||||
{
|
||||
return new Forks($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the stargazers of a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/activity/starring/#list-stargazers
|
||||
*
|
||||
* @return Stargazers
|
||||
*/
|
||||
public function stargazers()
|
||||
{
|
||||
return new Stargazers($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the hooks of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/jooks/
|
||||
*
|
||||
* @return Hooks
|
||||
*/
|
||||
public function hooks()
|
||||
{
|
||||
return new Hooks($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the labels of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/issues/labels/
|
||||
*
|
||||
* @return Labels
|
||||
*/
|
||||
public function labels()
|
||||
{
|
||||
return new Labels($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the statuses of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/statuses/
|
||||
*
|
||||
* @return Statuses
|
||||
*/
|
||||
public function statuses()
|
||||
{
|
||||
return new Statuses($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the branch(es) of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $repository the name of the repository
|
||||
* @param string $branch the name of the branch
|
||||
*
|
||||
* @return array list of the repository branches
|
||||
*/
|
||||
public function branches($username, $repository, $branch = null)
|
||||
{
|
||||
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches';
|
||||
if (null !== $branch) {
|
||||
$url .= '/'.rawurlencode($branch);
|
||||
}
|
||||
|
||||
return $this->get($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the protection of a repository branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#get-branch-protection
|
||||
*
|
||||
* @return Protection
|
||||
*/
|
||||
public function protection()
|
||||
{
|
||||
return new Protection($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contributors of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param bool $includingAnonymous by default, the list only shows GitHub users.
|
||||
* You can include non-users too by setting this to true
|
||||
*
|
||||
* @return array list of the repo contributors
|
||||
*/
|
||||
public function contributors($username, $repository, $includingAnonymous = false)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contributors', [
|
||||
'anon' => $includingAnonymous ?: null,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the language breakdown of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
*
|
||||
* @return array list of the languages
|
||||
*/
|
||||
public function languages($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/languages');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tags of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
|
||||
*
|
||||
* @return array list of the repository tags
|
||||
*/
|
||||
public function tags($username, $repository, array $params = [])
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/tags', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the teams of a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
*
|
||||
* @return array list of the languages
|
||||
*/
|
||||
public function teams($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/teams');
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated see subscribers method
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $page
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function watchers($username, $repository, $page = 1)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/watchers', [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $page
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function subscribers($username, $repository, $page = 1)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/subscribers', [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a merge.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/merging/
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $base The name of the base branch that the head will be merged into.
|
||||
* @param string $head The head to merge. This can be a branch name or a commit SHA1.
|
||||
* @param string $message Commit message to use for the merge commit. If omitted, a default message will be used.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function merge($username, $repository, $base, $head, $message = null)
|
||||
{
|
||||
$parameters = [
|
||||
'base' => $base,
|
||||
'head' => $head,
|
||||
];
|
||||
|
||||
if (is_string($message)) {
|
||||
$parameters['commit_message'] = $message;
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/merges', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function milestones($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/milestones');
|
||||
}
|
||||
|
||||
public function projects()
|
||||
{
|
||||
return new Projects($this->client);
|
||||
}
|
||||
|
||||
public function traffic()
|
||||
{
|
||||
return new Traffic($this->client);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $page
|
||||
*
|
||||
* @return array|string
|
||||
*
|
||||
* @see https://developer.github.com/v3/activity/events/#list-repository-events
|
||||
*/
|
||||
public function events($username, $repository, $page = 1)
|
||||
{
|
||||
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/events', ['page' => $page]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of a repository's code of conduct.
|
||||
*
|
||||
* @link https://developer.github.com/v3/codes_of_conduct/#get-the-contents-of-a-repositorys-code-of-conduct
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function codeOfConduct($username, $repository)
|
||||
{
|
||||
//This api is in preview mode, so set the correct accept-header
|
||||
$this->acceptHeaderValue = 'application/vnd.github.scarlet-witch-preview+json';
|
||||
|
||||
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/community/code_of_conduct');
|
||||
}
|
||||
|
||||
/**
|
||||
* List all topics for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/#list-all-topics-for-a-repository
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function topics($username, $repository)
|
||||
{
|
||||
//This api is in preview mode, so set the correct accept-header
|
||||
$this->acceptHeaderValue = 'application/vnd.github.mercy-preview+json';
|
||||
|
||||
return $this->get('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/topics');
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all topics for a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/#replace-all-topics-for-a-repository
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $topics
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function replaceTopics($username, $repository, array $topics)
|
||||
{
|
||||
//This api is in preview mode, so set the correct accept-header
|
||||
$this->acceptHeaderValue = 'application/vnd.github.mercy-preview+json';
|
||||
|
||||
return $this->put('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/topics', ['names' => $topics]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfer a repository.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/#transfer-a-repository
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $newOwner
|
||||
* @param array $teamId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transfer($username, $repository, $newOwner, $teamId = [])
|
||||
{
|
||||
//This api is in preview mode, so set the correct accept-header
|
||||
$this->acceptHeaderValue = 'application/vnd.github.nightshade-preview+json';
|
||||
|
||||
return $this->post('/repos/'.rawurldecode($username).'/'.rawurldecode($repository).'/transfer', ['new_owner' => $newOwner, 'team_id' => $teamId]);
|
||||
}
|
||||
}
|
||||
118
vendor/knplabs/github-api/lib/Github/Api/Repository/Assets.php
vendored
Normal file
118
vendor/knplabs/github-api/lib/Github/Api/Repository/Assets.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\ErrorException;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/releases/
|
||||
*
|
||||
* @author Evgeniy Guseletov <d46k16@gmail.com>
|
||||
*/
|
||||
class Assets extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get all release's assets in selected repository
|
||||
* GET /repos/:owner/:repo/releases/:id/assets.
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the release
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id).'/assets');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an asset in selected repository's release
|
||||
* GET /repos/:owner/:repo/releases/assets/:id.
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the asset
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an asset for selected repository's release
|
||||
* POST /repos/:owner/:repo/releases/:id/assets?name=:filename.
|
||||
*
|
||||
* Creating an asset requires support for server name indentification (SNI)
|
||||
* so this must be supported by your PHP version.
|
||||
*
|
||||
* @see http://developer.github.com/v3/repos/releases/#upload-a-release-asset
|
||||
* @see http://php.net/manual/en/openssl.constsni.php
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the release
|
||||
* @param string $name the filename for the asset
|
||||
* @param string $contentType the content type for the asset
|
||||
* @param string $content the content of the asset
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
* @throws ErrorException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, $id, $name, $contentType, $content)
|
||||
{
|
||||
if (!defined('OPENSSL_TLSEXT_SERVER_NAME') || !OPENSSL_TLSEXT_SERVER_NAME) {
|
||||
throw new ErrorException('Asset upload support requires Server Name Indication. This is not supported by your PHP version. See http://php.net/manual/en/openssl.constsni.php.');
|
||||
}
|
||||
|
||||
// Asset creation requires a separate endpoint, uploads.github.com.
|
||||
// Change the base url for the HTTP client temporarily while we execute
|
||||
// this request.
|
||||
$response = $this->postRaw('https://uploads.github.com/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id).'/assets?name='.$name, $content, ['Content-Type' => $contentType]);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit an asset in selected repository's release
|
||||
* PATCH /repos/:owner/:repo/releases/assets/:id.
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the asset
|
||||
* @param array $params request parameters
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function edit($username, $repository, $id, array $params)
|
||||
{
|
||||
if (!isset($params['name'])) {
|
||||
throw new MissingArgumentException('name');
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an asset in selected repository's release
|
||||
* DELETE /repos/:owner/:repo/releases/assets/:id.
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the asset
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($username, $repository, $id)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id));
|
||||
}
|
||||
}
|
||||
84
vendor/knplabs/github-api/lib/Github/Api/Repository/Collaborators.php
vendored
Normal file
84
vendor/knplabs/github-api/lib/Github/Api/Repository/Collaborators.php
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/collaborators/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Collaborators extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#list-collaborators
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function all($username, $repository, array $params = [])
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#check-if-a-user-is-a-collaborator
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $collaborator
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function check($username, $repository, $collaborator)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator));
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $collaborator
|
||||
* @param array $params
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function add($username, $repository, $collaborator, array $params = [])
|
||||
{
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#remove-user-as-a-collaborator
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $collaborator
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function remove($username, $repository, $collaborator)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator));
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/collaborators/#review-a-users-permission-level
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $collaborator
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public function permission($username, $repository, $collaborator)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/collaborators/'.rawurlencode($collaborator).'/permission');
|
||||
}
|
||||
}
|
||||
75
vendor/knplabs/github-api/lib/Github/Api/Repository/Comments.php
vendored
Normal file
75
vendor/knplabs/github-api/lib/Github/Api/Repository/Comments.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/comments/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class Comments extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/comments/#custom-media-types
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if (!in_array($bodyType, ['raw', 'text', 'html'])) {
|
||||
$bodyType = 'full';
|
||||
}
|
||||
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s+json', $this->client->getApiVersion(), $bodyType);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function all($username, $repository, $sha = null)
|
||||
{
|
||||
if (null === $sha) {
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments');
|
||||
}
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments');
|
||||
}
|
||||
|
||||
public function show($username, $repository, $comment)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment));
|
||||
}
|
||||
|
||||
public function create($username, $repository, $sha, array $params)
|
||||
{
|
||||
if (!isset($params['body'])) {
|
||||
throw new MissingArgumentException('body');
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/comments', $params);
|
||||
}
|
||||
|
||||
public function update($username, $repository, $comment, array $params)
|
||||
{
|
||||
if (!isset($params['body'])) {
|
||||
throw new MissingArgumentException('body');
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment), $params);
|
||||
}
|
||||
|
||||
public function remove($username, $repository, $comment)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/comments/'.rawurlencode($comment));
|
||||
}
|
||||
}
|
||||
33
vendor/knplabs/github-api/lib/Github/Api/Repository/Commits.php
vendored
Normal file
33
vendor/knplabs/github-api/lib/Github/Api/Repository/Commits.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/commits/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Commits extends AbstractApi
|
||||
{
|
||||
public function all($username, $repository, array $params)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits', $params);
|
||||
}
|
||||
|
||||
public function compare($username, $repository, $base, $head, $mediaType = null)
|
||||
{
|
||||
$headers = [];
|
||||
if (null !== $mediaType) {
|
||||
$headers['Accept'] = $mediaType;
|
||||
}
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/compare/'.rawurlencode($base).'...'.rawurlencode($head), [], $headers);
|
||||
}
|
||||
|
||||
public function show($username, $repository, $sha)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha));
|
||||
}
|
||||
}
|
||||
297
vendor/knplabs/github-api/lib/Github/Api/Repository/Contents.php
vendored
Normal file
297
vendor/knplabs/github-api/lib/Github/Api/Repository/Contents.php
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
use Github\Exception\ErrorException;
|
||||
use Github\Exception\InvalidArgumentException;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
use Github\Exception\TwoFactorAuthenticationRequiredException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/contents/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Contents extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repo/contents/#custom-media-types
|
||||
*
|
||||
* @param string|null $bodyType
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if (!in_array($bodyType, ['html', 'object'])) {
|
||||
$bodyType = 'raw';
|
||||
}
|
||||
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.%s', $this->client->getApiVersion(), $bodyType);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content of README file in a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/contents/
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param null|string $reference reference to a branch or commit
|
||||
*
|
||||
* @return array information for README file
|
||||
*/
|
||||
public function readme($username, $repository, $reference = null)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/readme', [
|
||||
'ref' => $reference,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get contents of any file or directory in a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/contents/
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param null|string $path path to file or directory
|
||||
* @param null|string $reference reference to a branch or commit
|
||||
*
|
||||
* @return array|string information for file | information for each item in directory
|
||||
*/
|
||||
public function show($username, $repository, $path = null, $reference = null)
|
||||
{
|
||||
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents';
|
||||
if (null !== $path) {
|
||||
$url .= '/'.rawurlencode($path);
|
||||
}
|
||||
|
||||
return $this->get($url, [
|
||||
'ref' => $reference,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new file in a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/contents/#create-a-file
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param string $path path to file
|
||||
* @param string $content contents of the new file
|
||||
* @param string $message the commit message
|
||||
* @param null|string $branch name of a branch
|
||||
* @param null|array $committer information about the committer
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array information about the new file
|
||||
*/
|
||||
public function create($username, $repository, $path, $content, $message, $branch = null, array $committer = null)
|
||||
{
|
||||
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path);
|
||||
|
||||
$parameters = [
|
||||
'content' => base64_encode($content),
|
||||
'message' => $message,
|
||||
];
|
||||
|
||||
if (null !== $branch) {
|
||||
$parameters['branch'] = $branch;
|
||||
}
|
||||
|
||||
if (null !== $committer) {
|
||||
if (!isset($committer['name'], $committer['email'])) {
|
||||
throw new MissingArgumentException(['name', 'email']);
|
||||
}
|
||||
$parameters['committer'] = $committer;
|
||||
}
|
||||
|
||||
return $this->put($url, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that a given path exists in a repository.
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param string $path path of file to check
|
||||
* @param null|string $reference reference to a branch or commit
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function exists($username, $repository, $path, $reference = null)
|
||||
{
|
||||
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents';
|
||||
|
||||
if (null !== $path) {
|
||||
$url .= '/'.rawurlencode($path);
|
||||
}
|
||||
|
||||
try {
|
||||
$response = $this->head($url, [
|
||||
'ref' => $reference,
|
||||
]);
|
||||
|
||||
if ($response->getStatusCode() != 200) {
|
||||
return false;
|
||||
}
|
||||
} catch (TwoFactorAuthenticationRequiredException $ex) {
|
||||
throw $ex;
|
||||
} catch (\Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the contents of a file in a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/contents/#update-a-file
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param string $path path to file
|
||||
* @param string $content contents of the new file
|
||||
* @param string $message the commit message
|
||||
* @param string $sha blob SHA of the file being replaced
|
||||
* @param null|string $branch name of a branch
|
||||
* @param null|array $committer information about the committer
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array information about the updated file
|
||||
*/
|
||||
public function update($username, $repository, $path, $content, $message, $sha, $branch = null, array $committer = null)
|
||||
{
|
||||
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path);
|
||||
|
||||
$parameters = [
|
||||
'content' => base64_encode($content),
|
||||
'message' => $message,
|
||||
'sha' => $sha,
|
||||
];
|
||||
|
||||
if (null !== $branch) {
|
||||
$parameters['branch'] = $branch;
|
||||
}
|
||||
|
||||
if (null !== $committer) {
|
||||
if (!isset($committer['name'], $committer['email'])) {
|
||||
throw new MissingArgumentException(['name', 'email']);
|
||||
}
|
||||
$parameters['committer'] = $committer;
|
||||
}
|
||||
|
||||
return $this->put($url, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a file from a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/contents/#delete-a-file
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param string $path path to file
|
||||
* @param string $message the commit message
|
||||
* @param string $sha blob SHA of the file being deleted
|
||||
* @param null|string $branch name of a branch
|
||||
* @param null|array $committer information about the committer
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array information about the updated file
|
||||
*/
|
||||
public function rm($username, $repository, $path, $message, $sha, $branch = null, array $committer = null)
|
||||
{
|
||||
$url = '/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/contents/'.rawurlencode($path);
|
||||
|
||||
$parameters = [
|
||||
'message' => $message,
|
||||
'sha' => $sha,
|
||||
];
|
||||
|
||||
if (null !== $branch) {
|
||||
$parameters['branch'] = $branch;
|
||||
}
|
||||
|
||||
if (null !== $committer) {
|
||||
if (!isset($committer['name'], $committer['email'])) {
|
||||
throw new MissingArgumentException(['name', 'email']);
|
||||
}
|
||||
$parameters['committer'] = $committer;
|
||||
}
|
||||
|
||||
return $this->delete($url, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content of archives in a repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/contents/
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param string $format format of archive: tarball or zipball
|
||||
* @param null|string $reference reference to a branch or commit
|
||||
*
|
||||
* @return string repository archive binary data
|
||||
*/
|
||||
public function archive($username, $repository, $format, $reference = null)
|
||||
{
|
||||
if (!in_array($format, ['tarball', 'zipball'])) {
|
||||
$format = 'tarball';
|
||||
}
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/'.rawurlencode($format).
|
||||
((null !== $reference) ? ('/'.rawurlencode($reference)) : ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of a file in a repository.
|
||||
*
|
||||
* @param string $username the user who owns the repository
|
||||
* @param string $repository the name of the repository
|
||||
* @param string $path path to file
|
||||
* @param null|string $reference reference to a branch or commit
|
||||
*
|
||||
* @throws InvalidArgumentException If $path is not a file or if its encoding is different from base64
|
||||
* @throws ErrorException If $path doesn't include a 'content' index
|
||||
*
|
||||
* @return null|string content of file, or null in case of base64_decode failure
|
||||
*/
|
||||
public function download($username, $repository, $path, $reference = null)
|
||||
{
|
||||
$file = $this->show($username, $repository, $path, $reference);
|
||||
|
||||
if (!isset($file['type']) || 'file' !== $file['type']) {
|
||||
throw new InvalidArgumentException(sprintf('Path "%s" is not a file.', $path));
|
||||
}
|
||||
|
||||
if (!isset($file['content'])) {
|
||||
throw new ErrorException(sprintf('Unable to access "content" for file "%s" (possible keys: "%s").', $path, implode(', ', array_keys($file))));
|
||||
}
|
||||
|
||||
if (!isset($file['encoding'])) {
|
||||
throw new InvalidArgumentException(sprintf('Can\'t decode content of file "%s", as no encoding is defined.', $path));
|
||||
}
|
||||
|
||||
if ('base64' !== $file['encoding']) {
|
||||
throw new InvalidArgumentException(sprintf('Encoding "%s" of file "%s" is not supported.', $file['encoding'], $path));
|
||||
}
|
||||
|
||||
return base64_decode($file['content']) ?: null;
|
||||
}
|
||||
}
|
||||
47
vendor/knplabs/github-api/lib/Github/Api/Repository/DeployKeys.php
vendored
Normal file
47
vendor/knplabs/github-api/lib/Github/Api/Repository/DeployKeys.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/keys/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class DeployKeys extends AbstractApi
|
||||
{
|
||||
public function all($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys');
|
||||
}
|
||||
|
||||
public function show($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['title'], $params['key'])) {
|
||||
throw new MissingArgumentException(['title', 'key']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys', $params);
|
||||
}
|
||||
|
||||
public function update($username, $repository, $id, array $params)
|
||||
{
|
||||
if (!isset($params['title'], $params['key'])) {
|
||||
throw new MissingArgumentException(['title', 'key']);
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
public function remove($username, $repository, $id)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id));
|
||||
}
|
||||
}
|
||||
60
vendor/knplabs/github-api/lib/Github/Api/Repository/Downloads.php
vendored
Normal file
60
vendor/knplabs/github-api/lib/Github/Api/Repository/Downloads.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/downloads/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Downloads extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List downloads in selected repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/downloads/#list-downloads-for-a-repository
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a download in selected repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/downloads/#get-a-single-download
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the download file
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a download in selected repository.
|
||||
*
|
||||
* @link http://developer.github.com/v3/repos/downloads/#delete-a-download
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the download file
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($username, $repository, $id)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/downloads/'.rawurlencode($id));
|
||||
}
|
||||
}
|
||||
27
vendor/knplabs/github-api/lib/Github/Api/Repository/Forks.php
vendored
Normal file
27
vendor/knplabs/github-api/lib/Github/Api/Repository/Forks.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/forks/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Forks extends AbstractApi
|
||||
{
|
||||
public function all($username, $repository, array $params = [])
|
||||
{
|
||||
if (isset($params['sort']) && !in_array($params['sort'], ['newest', 'oldest', 'watchers'])) {
|
||||
$params['sort'] = 'newest';
|
||||
}
|
||||
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', array_merge(['page' => 1], $params));
|
||||
}
|
||||
|
||||
public function create($username, $repository, array $params = [])
|
||||
{
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', $params);
|
||||
}
|
||||
}
|
||||
57
vendor/knplabs/github-api/lib/Github/Api/Repository/Hooks.php
vendored
Normal file
57
vendor/knplabs/github-api/lib/Github/Api/Repository/Hooks.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/hooks/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Hooks extends AbstractApi
|
||||
{
|
||||
public function all($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks');
|
||||
}
|
||||
|
||||
public function show($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['name'], $params['config'])) {
|
||||
throw new MissingArgumentException(['name', 'config']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks', $params);
|
||||
}
|
||||
|
||||
public function update($username, $repository, $id, array $params)
|
||||
{
|
||||
if (!isset($params['config'])) {
|
||||
throw new MissingArgumentException(['config']);
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
public function ping($username, $repository, $id)
|
||||
{
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id).'/pings');
|
||||
}
|
||||
|
||||
public function test($username, $repository, $id)
|
||||
{
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id).'/test');
|
||||
}
|
||||
|
||||
public function remove($username, $repository, $id)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/hooks/'.rawurlencode($id));
|
||||
}
|
||||
}
|
||||
47
vendor/knplabs/github-api/lib/Github/Api/Repository/Labels.php
vendored
Normal file
47
vendor/knplabs/github-api/lib/Github/Api/Repository/Labels.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/issues/labels/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Labels extends AbstractApi
|
||||
{
|
||||
public function all($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels');
|
||||
}
|
||||
|
||||
public function show($username, $repository, $label)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
|
||||
}
|
||||
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['name'], $params['color'])) {
|
||||
throw new MissingArgumentException(['name', 'color']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels', $params);
|
||||
}
|
||||
|
||||
public function update($username, $repository, $label, array $params)
|
||||
{
|
||||
if (!isset($params['name'], $params['color'])) {
|
||||
throw new MissingArgumentException(['name', 'color']);
|
||||
}
|
||||
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label), $params);
|
||||
}
|
||||
|
||||
public function remove($username, $repository, $label)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/labels/'.rawurlencode($label));
|
||||
}
|
||||
}
|
||||
23
vendor/knplabs/github-api/lib/Github/Api/Repository/Projects.php
vendored
Normal file
23
vendor/knplabs/github-api/lib/Github/Api/Repository/Projects.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\Project\AbstractProjectApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
class Projects extends AbstractProjectApi
|
||||
{
|
||||
public function all($username, $repository, array $params = [])
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/projects', array_merge(['page' => 1], $params));
|
||||
}
|
||||
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['name'])) {
|
||||
throw new MissingArgumentException(['name']);
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/projects', $params);
|
||||
}
|
||||
}
|
||||
441
vendor/knplabs/github-api/lib/Github/Api/Repository/Protection.php
vendored
Normal file
441
vendor/knplabs/github-api/lib/Github/Api/Repository/Protection.php
vendored
Normal file
@@ -0,0 +1,441 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/branches/
|
||||
*
|
||||
* @author Brandon Bloodgood <bbloodgood@gmail.com>
|
||||
*/
|
||||
class Protection extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
public function configure()
|
||||
{
|
||||
$this->acceptHeaderValue = 'application/vnd.github.loki-preview+json';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves configured protection for the provided branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#get-branch-protection
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*
|
||||
* @return array The branch protection information
|
||||
*/
|
||||
public function show($username, $repository, $branch)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the repo's branch protection.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#update-branch-protection
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The branch protection information
|
||||
*
|
||||
* @return array The updated branch protection information
|
||||
*/
|
||||
public function update($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the repo's branch protection.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#remove-branch-protection
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*/
|
||||
public function remove($username, $repository, $branch)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get required status checks of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#get-required-status-checks-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*
|
||||
* @return array The required status checks information
|
||||
*/
|
||||
public function showStatusChecks($username, $repository, $branch)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update required status checks of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#update-required-status-checks-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The branch status checks information
|
||||
*
|
||||
* @return array The updated branch status checks information
|
||||
*/
|
||||
public function updateStatusChecks($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove required status checks of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#remove-required-status-checks-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*/
|
||||
public function removeStatusChecks($username, $repository, $branch)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks');
|
||||
}
|
||||
|
||||
/**
|
||||
* List required status checks contexts of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#list-required-status-checks-contexts-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*
|
||||
* @return array The required status checks contexts information
|
||||
*/
|
||||
public function showStatusChecksContexts($username, $repository, $branch)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts');
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace required status checks contexts of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#replace-required-status-checks-contexts-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The branch status checks contexts information
|
||||
*
|
||||
* @return array The new branch status checks contexts information
|
||||
*/
|
||||
public function replaceStatusChecksContexts($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add required status checks contexts of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#add-required-status-checks-contexts-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The branch status checks contexts information
|
||||
*
|
||||
* @return array The updated branch status checks contexts information
|
||||
*/
|
||||
public function addStatusChecksContexts($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove required status checks contexts of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#remove-required-status-checks-contexts-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The branch status checks contexts information
|
||||
*
|
||||
* @return array The updated branch status checks contexts information
|
||||
*/
|
||||
public function removeStatusChecksContexts($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_status_checks/contexts', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pull request review enforcement of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#get-pull-request-review-enforcement-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*
|
||||
* @return array The pull request review enforcement information
|
||||
*/
|
||||
public function showPullRequestReviewEnforcement($username, $repository, $branch)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_pull_request_reviews');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update pull request review enforcement of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#update-pull-request-review-enforcement-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The branch status checks information
|
||||
*
|
||||
* @return array The updated branch status checks information
|
||||
*/
|
||||
public function updatePullRequestReviewEnforcement($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_pull_request_reviews', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove pull request review enforcement of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#remove-pull-request-review-enforcement-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*/
|
||||
public function removePullRequestReviewEnforcement($username, $repository, $branch)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/required_pull_request_reviews');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get admin enforcement of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#get-admin-enforcement-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*
|
||||
* @return array The admin enforcement information
|
||||
*/
|
||||
public function showAdminEnforcement($username, $repository, $branch)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/enforce_admins');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add admin enforcement of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#add-admin-enforcement-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*
|
||||
* @return array The updated admin enforcement information
|
||||
*/
|
||||
public function addAdminEnforcement($username, $repository, $branch)
|
||||
{
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/enforce_admins');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove admin enforcement of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#remove-admin-enforcement-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*/
|
||||
public function removeAdminEnforcement($username, $repository, $branch)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/enforce_admins');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#get-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*
|
||||
* @return array The branch restrictions information
|
||||
*/
|
||||
public function showRestrictions($username, $repository, $branch)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#remove-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*/
|
||||
public function removeRestrictions($username, $repository, $branch)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions');
|
||||
}
|
||||
|
||||
/**
|
||||
* List team restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#list-team-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*
|
||||
* @return array The branch team restrictions information
|
||||
*/
|
||||
public function showTeamRestrictions($username, $repository, $branch)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams');
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace team restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#replace-team-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The list of team slugs with push access
|
||||
*
|
||||
* @return array The new branch team restrictions information
|
||||
*/
|
||||
public function replaceTeamRestrictions($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add team restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#add-team-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The list of team slugs with push access
|
||||
*
|
||||
* @return array The branch team restrictions information
|
||||
*/
|
||||
public function addTeamRestrictions($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove team restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#remove-team-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The list of team slugs with push access
|
||||
*
|
||||
* @return array The updated branch team restrictions information
|
||||
*/
|
||||
public function removeTeamRestrictions($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/teams', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* List user restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#list-user-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
*
|
||||
* @return array The branch user restrictions information
|
||||
*/
|
||||
public function showUserRestrictions($username, $repository, $branch)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users');
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace user restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#replace-user-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The list of user logins with push access
|
||||
*
|
||||
* @return array The new branch user restrictions information
|
||||
*/
|
||||
public function replaceUserRestrictions($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add user restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#add-user-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The list of user logins with push access
|
||||
*
|
||||
* @return array The branch user restrictions information
|
||||
*/
|
||||
public function addUserRestrictions($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove user restrictions of protected branch.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/branches/#remove-user-restrictions-of-protected-branch
|
||||
*
|
||||
* @param string $username The user who owns the repository
|
||||
* @param string $repository The name of the repo
|
||||
* @param string $branch The name of the branch
|
||||
* @param array $params The list of user logins with push access
|
||||
*
|
||||
* @return array The updated branch user restrictions information
|
||||
*/
|
||||
public function removeUserRestrictions($username, $repository, $branch, array $params = [])
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection/restrictions/users', $params);
|
||||
}
|
||||
}
|
||||
127
vendor/knplabs/github-api/lib/Github/Api/Repository/Releases.php
vendored
Normal file
127
vendor/knplabs/github-api/lib/Github/Api/Repository/Releases.php
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/releases/
|
||||
*
|
||||
* @author Matthew Simo <matthew.a.simo@gmail.com>
|
||||
* @author Evgeniy Guseletov <d46k16@gmail.com>
|
||||
*/
|
||||
class Releases extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Get the latest release.
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function latest($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/latest');
|
||||
}
|
||||
|
||||
/**
|
||||
* List releases for a tag.
|
||||
*
|
||||
* @param $username
|
||||
* @param $repository
|
||||
* @param $tag
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function tag($username, $repository, $tag)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/tags/'.rawurlencode($tag));
|
||||
}
|
||||
|
||||
/**
|
||||
* List releases in selected repository.
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param array $params the additional parameters like milestone, assignees, labels, sort, direction
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all($username, $repository, array $params = [])
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a release in selected repository.
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the release
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $id)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new release in selected repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param array $params
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, array $params)
|
||||
{
|
||||
if (!isset($params['tag_name'])) {
|
||||
throw new MissingArgumentException('tag_name');
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit release in selected repository.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param int $id
|
||||
* @param array $params
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function edit($username, $repository, $id, array $params)
|
||||
{
|
||||
return $this->patch('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a release in selected repository (Not thoroughly tested!).
|
||||
*
|
||||
* @param string $username the user who owns the repo
|
||||
* @param string $repository the name of the repo
|
||||
* @param int $id the id of the release
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($username, $repository, $id)
|
||||
{
|
||||
return $this->delete('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Assets
|
||||
*/
|
||||
public function assets()
|
||||
{
|
||||
return new Assets($this->client);
|
||||
}
|
||||
}
|
||||
40
vendor/knplabs/github-api/lib/Github/Api/Repository/Stargazers.php
vendored
Normal file
40
vendor/knplabs/github-api/lib/Github/Api/Repository/Stargazers.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Api\AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/activity/starring/#list-stargazers
|
||||
*
|
||||
* @author Nicolas Dupont <nicolas@akeneo.com>
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class Stargazers extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Configure the body type.
|
||||
*
|
||||
* @see https://developer.github.com/v3/activity/starring/#alternative-response-with-star-creation-timestamps
|
||||
*
|
||||
* @param string $bodyType
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function configure($bodyType = null)
|
||||
{
|
||||
if ('star' === $bodyType) {
|
||||
$this->acceptHeaderValue = sprintf('application/vnd.github.%s.star+json', $this->client->getApiVersion());
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function all($username, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stargazers');
|
||||
}
|
||||
}
|
||||
63
vendor/knplabs/github-api/lib/Github/Api/Repository/Statuses.php
vendored
Normal file
63
vendor/knplabs/github-api/lib/Github/Api/Repository/Statuses.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
use Github\Exception\MissingArgumentException;
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/statuses/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class Statuses extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-sha
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $sha
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($username, $repository, $sha)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/statuses');
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $sha
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function combined($username, $repository, $sha)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/commits/'.rawurlencode($sha).'/status');
|
||||
}
|
||||
|
||||
/**
|
||||
* @link http://developer.github.com/v3/repos/statuses/#create-a-status
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $repository
|
||||
* @param string $sha
|
||||
* @param array $params
|
||||
*
|
||||
* @throws MissingArgumentException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function create($username, $repository, $sha, array $params = [])
|
||||
{
|
||||
if (!isset($params['state'])) {
|
||||
throw new MissingArgumentException('state');
|
||||
}
|
||||
|
||||
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/statuses/'.rawurlencode($sha), $params);
|
||||
}
|
||||
}
|
||||
67
vendor/knplabs/github-api/lib/Github/Api/Repository/Traffic.php
vendored
Normal file
67
vendor/knplabs/github-api/lib/Github/Api/Repository/Traffic.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api\Repository;
|
||||
|
||||
use Github\Api\AbstractApi;
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/traffic/
|
||||
*
|
||||
* @author Miguel Piedrafita <soy@miguelpiedrafita.com>
|
||||
*/
|
||||
class Traffic extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/traffic/#list-referrers
|
||||
*
|
||||
* @param string $owner
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function referers($owner, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($owner).'/'.rawurlencode($repository).'/traffic/popular/referrers');
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/traffic/#list-paths
|
||||
*
|
||||
* @param string $owner
|
||||
* @param string $repository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function paths($owner, $repository)
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($owner).'/'.rawurlencode($repository).'/traffic/popular/paths');
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/traffic/#views
|
||||
*
|
||||
* @param string $owner
|
||||
* @param string $repository
|
||||
* @param string $per
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function views($owner, $repository, $per = 'day')
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($owner).'/'.rawurlencode($repository).'/traffic/views?per='.rawurlencode($per));
|
||||
}
|
||||
|
||||
/**
|
||||
* @link https://developer.github.com/v3/repos/traffic/#clones
|
||||
*
|
||||
* @param string $owner
|
||||
* @param string $repository
|
||||
* @param string $per
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function clones($owner, $repository, $per = 'day')
|
||||
{
|
||||
return $this->get('/repos/'.rawurlencode($owner).'/'.rawurlencode($repository).'/traffic/clones?per='.rawurlencode($per));
|
||||
}
|
||||
}
|
||||
115
vendor/knplabs/github-api/lib/Github/Api/Search.php
vendored
Normal file
115
vendor/knplabs/github-api/lib/Github/Api/Search.php
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
/**
|
||||
* Implement the Search API.
|
||||
*
|
||||
* @link https://developer.github.com/v3/search/
|
||||
*
|
||||
* @author Greg Payne <greg.payne@gmail.com>
|
||||
*/
|
||||
class Search extends AbstractApi
|
||||
{
|
||||
use AcceptHeaderTrait;
|
||||
|
||||
/**
|
||||
* Search repositories by filter (q).
|
||||
*
|
||||
* @link https://developer.github.com/v3/search/#search-repositories
|
||||
*
|
||||
* @param string $q the filter
|
||||
* @param string $sort the sort field
|
||||
* @param string $order asc/desc
|
||||
*
|
||||
* @return array list of repositories found
|
||||
*/
|
||||
public function repositories($q, $sort = 'updated', $order = 'desc')
|
||||
{
|
||||
return $this->get('/search/repositories', ['q' => $q, 'sort' => $sort, 'order' => $order]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search issues by filter (q).
|
||||
*
|
||||
* @link https://developer.github.com/v3/search/#search-issues
|
||||
*
|
||||
* @param string $q the filter
|
||||
* @param string $sort the sort field
|
||||
* @param string $order asc/desc
|
||||
*
|
||||
* @return array list of issues found
|
||||
*/
|
||||
public function issues($q, $sort = 'updated', $order = 'desc')
|
||||
{
|
||||
return $this->get('/search/issues', ['q' => $q, 'sort' => $sort, 'order' => $order]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search code by filter (q).
|
||||
*
|
||||
* @link https://developer.github.com/v3/search/#search-code
|
||||
*
|
||||
* @param string $q the filter
|
||||
* @param string $sort the sort field
|
||||
* @param string $order asc/desc
|
||||
*
|
||||
* @return array list of code found
|
||||
*/
|
||||
public function code($q, $sort = 'updated', $order = 'desc')
|
||||
{
|
||||
return $this->get('/search/code', ['q' => $q, 'sort' => $sort, 'order' => $order]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search users by filter (q).
|
||||
*
|
||||
* @link https://developer.github.com/v3/search/#search-users
|
||||
*
|
||||
* @param string $q the filter
|
||||
* @param string $sort the sort field
|
||||
* @param string $order asc/desc
|
||||
*
|
||||
* @return array list of users found
|
||||
*/
|
||||
public function users($q, $sort = 'updated', $order = 'desc')
|
||||
{
|
||||
return $this->get('/search/users', ['q' => $q, 'sort' => $sort, 'order' => $order]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search commits by filter (q).
|
||||
*
|
||||
* @link https://developer.github.com/v3/search/#search-commits
|
||||
*
|
||||
* @param string $q the filter
|
||||
* @param string $sort the sort field
|
||||
* @param string $order sort order. asc/desc
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function commits($q, $sort = null, $order = 'desc')
|
||||
{
|
||||
//This api is in preview mode, so set the correct accept-header
|
||||
$this->acceptHeaderValue = 'application/vnd.github.cloak-preview';
|
||||
|
||||
return $this->get('/search/commits', ['q' => $q, 'sort' => $sort, 'order' => $order]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search commits by filter (q).
|
||||
*
|
||||
* @link https://developer.github.com/v3/search/#search-topics
|
||||
*
|
||||
* @param string $q the filter
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function topics($q)
|
||||
{
|
||||
//This api is in preview mode, so set the correct accept-header
|
||||
$this->acceptHeaderValue = 'application/vnd.github.mercy-preview+json';
|
||||
|
||||
return $this->get('/search/topics', ['q' => $q]);
|
||||
}
|
||||
}
|
||||
251
vendor/knplabs/github-api/lib/Github/Api/User.php
vendored
Normal file
251
vendor/knplabs/github-api/lib/Github/Api/User.php
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Api;
|
||||
|
||||
/**
|
||||
* Searching users, getting user information.
|
||||
*
|
||||
* @link http://developer.github.com/v3/users/
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @author Thibault Duplessis <thibault.duplessis at gmail dot com>
|
||||
*/
|
||||
class User extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* Search users by username.
|
||||
*
|
||||
* @deprecated This method is deprecated use the Search api instead. See https://developer.github.com/v3/search/legacy/#legacy-search-api-is-deprecated
|
||||
* @link http://developer.github.com/v3/search/#search-users
|
||||
*
|
||||
* @param string $keyword the keyword to search
|
||||
*
|
||||
* @return array list of users found
|
||||
*/
|
||||
public function find($keyword)
|
||||
{
|
||||
return $this->get('/legacy/user/search/'.rawurlencode($keyword));
|
||||
}
|
||||
|
||||
/**
|
||||
* Request all users.
|
||||
*
|
||||
* @link https://developer.github.com/v3/users/#get-all-users
|
||||
*
|
||||
* @param int|null $id ID of the last user that you've seen
|
||||
*
|
||||
* @return array list of users found
|
||||
*/
|
||||
public function all($id = null)
|
||||
{
|
||||
if (!is_int($id)) {
|
||||
return $this->get('/users');
|
||||
}
|
||||
|
||||
return $this->get('/users', ['since' => rawurldecode($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extended information about a user by its username.
|
||||
*
|
||||
* @link http://developer.github.com/v3/users/
|
||||
*
|
||||
* @param string $username the username to show
|
||||
*
|
||||
* @return array information about the user
|
||||
*/
|
||||
public function show($username)
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extended information about a user by its username.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/
|
||||
*
|
||||
* @param string $username the username to show
|
||||
*
|
||||
* @return array information about organizations that user belongs to
|
||||
*/
|
||||
public function organizations($username)
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/orgs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user organizations.
|
||||
*
|
||||
* @link https://developer.github.com/v3/orgs/#list-your-organizations
|
||||
*
|
||||
* @return array information about organizations that authenticated user belongs to
|
||||
*/
|
||||
public function orgs()
|
||||
{
|
||||
return $this->get('/user/orgs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the users that a specific user is following.
|
||||
*
|
||||
* @link http://developer.github.com/v3/users/followers/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param array $parameters parameters for the query string
|
||||
* @param array $requestHeaders additional headers to set in the request
|
||||
*
|
||||
* @return array list of followed users
|
||||
*/
|
||||
public function following($username, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/following', $parameters, $requestHeaders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the users following a specific user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/users/followers/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param array $parameters parameters for the query string
|
||||
* @param array $requestHeaders additional headers to set in the request
|
||||
*
|
||||
* @return array list of following users
|
||||
*/
|
||||
public function followers($username, array $parameters = [], array $requestHeaders = [])
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/followers', $parameters, $requestHeaders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the repository that a specific user is watching.
|
||||
*
|
||||
* @deprecated see subscriptions method
|
||||
*
|
||||
* @param string $username the username
|
||||
*
|
||||
* @return array list of watched repositories
|
||||
*/
|
||||
public function watched($username)
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/watched');
|
||||
}
|
||||
|
||||
/**
|
||||
* Request starred repositories that a specific user has starred.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/starring/
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param int $page the page number of the paginated result set
|
||||
* @param int $perPage the number of results per page
|
||||
* @param string $sort sort by (possible values: created, updated)
|
||||
* @param string $direction direction of sort (possible values: asc, desc)
|
||||
*
|
||||
* @return array list of starred repositories
|
||||
*/
|
||||
public function starred($username, $page = 1, $perPage = 30, $sort = 'created', $direction = 'desc')
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/starred', [
|
||||
'page' => $page,
|
||||
'per_page' => $perPage,
|
||||
'sort' => $sort,
|
||||
'direction' => $direction,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the repository that a specific user is watching.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/watching/
|
||||
*
|
||||
* @param string $username the username
|
||||
*
|
||||
* @return array list of watched repositories
|
||||
*/
|
||||
public function subscriptions($username)
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/subscriptions');
|
||||
}
|
||||
|
||||
/**
|
||||
* List public repositories for the specified user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/#list-user-repositories
|
||||
*
|
||||
* @param string $username the username
|
||||
* @param string $type role in the repository
|
||||
* @param string $sort sort by
|
||||
* @param string $direction direction of sort, asc or desc
|
||||
* @param string $visibility visibility of repository
|
||||
* @param string $affiliation relationship to repository
|
||||
*
|
||||
* @return array list of the user repositories
|
||||
*/
|
||||
public function repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc', $visibility = 'all', $affiliation = 'owner,collaborator,organization_member')
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/repos', [
|
||||
'type' => $type,
|
||||
'sort' => $sort,
|
||||
'direction' => $direction,
|
||||
'visibility' => $visibility,
|
||||
'affiliation' => $affiliation,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* List repositories that are accessible to the authenticated user.
|
||||
*
|
||||
* @link https://developer.github.com/v3/repos/#list-your-repositories
|
||||
*
|
||||
* @param array $params visibility, affiliation, type, sort, direction
|
||||
*
|
||||
* @return array list of the user repositories
|
||||
*/
|
||||
public function myRepositories(array $params = [])
|
||||
{
|
||||
return $this->get('/user/repos', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the public gists for a user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/gists/
|
||||
*
|
||||
* @param string $username the username
|
||||
*
|
||||
* @return array list of the user gists
|
||||
*/
|
||||
public function gists($username)
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/gists');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the public keys for a user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/users/keys/#list-public-keys-for-a-user
|
||||
*
|
||||
* @param string $username the username
|
||||
*
|
||||
* @return array list of the user public keys
|
||||
*/
|
||||
public function keys($username)
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/keys');
|
||||
}
|
||||
|
||||
/**
|
||||
* List events performed by a user.
|
||||
*
|
||||
* @link http://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
|
||||
*
|
||||
* @param string $username
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function publicEvents($username)
|
||||
{
|
||||
return $this->get('/users/'.rawurlencode($username).'/events/public');
|
||||
}
|
||||
}
|
||||
414
vendor/knplabs/github-api/lib/Github/Client.php
vendored
Normal file
414
vendor/knplabs/github-api/lib/Github/Client.php
vendored
Normal file
@@ -0,0 +1,414 @@
|
||||
<?php
|
||||
|
||||
namespace Github;
|
||||
|
||||
use Github\Api\ApiInterface;
|
||||
use Github\Exception\BadMethodCallException;
|
||||
use Github\Exception\InvalidArgumentException;
|
||||
use Github\HttpClient\Builder;
|
||||
use Github\HttpClient\Plugin\Authentication;
|
||||
use Github\HttpClient\Plugin\GithubExceptionThrower;
|
||||
use Github\HttpClient\Plugin\History;
|
||||
use Github\HttpClient\Plugin\PathPrepend;
|
||||
use Http\Client\Common\HttpMethodsClient;
|
||||
use Http\Client\Common\Plugin;
|
||||
use Http\Client\HttpClient;
|
||||
use Http\Discovery\UriFactoryDiscovery;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
|
||||
/**
|
||||
* Simple yet very cool PHP GitHub client.
|
||||
*
|
||||
* @method Api\CurrentUser currentUser()
|
||||
* @method Api\CurrentUser me()
|
||||
* @method Api\Enterprise ent()
|
||||
* @method Api\Enterprise enterprise()
|
||||
* @method Api\Miscellaneous\CodeOfConduct codeOfConduct()
|
||||
* @method Api\Miscellaneous\Emojis emojis()
|
||||
* @method Api\GitData git()
|
||||
* @method Api\GitData gitData()
|
||||
* @method Api\Gists gist()
|
||||
* @method Api\Gists gists()
|
||||
* @method Api\Miscellaneous\Gitignore gitignore()
|
||||
* @method Api\Integrations integration() (deprecated)
|
||||
* @method Api\Integrations integrations() (deprecated)
|
||||
* @method Api\Apps apps()
|
||||
* @method Api\Issue issue()
|
||||
* @method Api\Issue issues()
|
||||
* @method Api\Markdown markdown()
|
||||
* @method Api\Notification notification()
|
||||
* @method Api\Notification notifications()
|
||||
* @method Api\Organization organization()
|
||||
* @method Api\Organization organizations()
|
||||
* @method Api\Organization\Projects orgProject()
|
||||
* @method Api\Organization\Projects orgProjects()
|
||||
* @method Api\Organization\Projects organizationProject()
|
||||
* @method Api\Organization\Projects organizationProjects()
|
||||
* @method Api\PullRequest pr()
|
||||
* @method Api\PullRequest pullRequest()
|
||||
* @method Api\PullRequest pullRequests()
|
||||
* @method Api\RateLimit rateLimit()
|
||||
* @method Api\Repo repo()
|
||||
* @method Api\Repo repos()
|
||||
* @method Api\Repo repository()
|
||||
* @method Api\Repo repositories()
|
||||
* @method Api\Search search()
|
||||
* @method Api\Organization team()
|
||||
* @method Api\Organization teams()
|
||||
* @method Api\User user()
|
||||
* @method Api\User users()
|
||||
* @method Api\Authorizations authorization()
|
||||
* @method Api\Authorizations authorizations()
|
||||
* @method Api\Meta meta()
|
||||
* @method Api\GraphQL graphql()
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*
|
||||
* Website: http://github.com/KnpLabs/php-github-api
|
||||
*/
|
||||
class Client
|
||||
{
|
||||
/**
|
||||
* Constant for authentication method. Indicates the default, but deprecated
|
||||
* login with username and token in URL.
|
||||
*/
|
||||
const AUTH_URL_TOKEN = 'url_token';
|
||||
|
||||
/**
|
||||
* Constant for authentication method. Not indicates the new login, but allows
|
||||
* usage of unauthenticated rate limited requests for given client_id + client_secret.
|
||||
*/
|
||||
const AUTH_URL_CLIENT_ID = 'url_client_id';
|
||||
|
||||
/**
|
||||
* Constant for authentication method. Indicates the new favored login method
|
||||
* with username and password via HTTP Authentication.
|
||||
*/
|
||||
const AUTH_HTTP_PASSWORD = 'http_password';
|
||||
|
||||
/**
|
||||
* Constant for authentication method. Indicates the new login method with
|
||||
* with username and token via HTTP Authentication.
|
||||
*/
|
||||
const AUTH_HTTP_TOKEN = 'http_token';
|
||||
|
||||
/**
|
||||
* Constant for authentication method. Indicates JSON Web Token
|
||||
* authentication required for integration access to the API.
|
||||
*/
|
||||
const AUTH_JWT = 'jwt';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $apiVersion;
|
||||
|
||||
/**
|
||||
* @var Builder
|
||||
*/
|
||||
private $httpClientBuilder;
|
||||
|
||||
/**
|
||||
* @var History
|
||||
*/
|
||||
private $responseHistory;
|
||||
|
||||
/**
|
||||
* Instantiate a new GitHub client.
|
||||
*
|
||||
* @param Builder|null $httpClientBuilder
|
||||
* @param string|null $apiVersion
|
||||
* @param string|null $enterpriseUrl
|
||||
*/
|
||||
public function __construct(Builder $httpClientBuilder = null, $apiVersion = null, $enterpriseUrl = null)
|
||||
{
|
||||
$this->responseHistory = new History();
|
||||
$this->httpClientBuilder = $builder = $httpClientBuilder ?: new Builder();
|
||||
|
||||
$builder->addPlugin(new GithubExceptionThrower());
|
||||
$builder->addPlugin(new Plugin\HistoryPlugin($this->responseHistory));
|
||||
$builder->addPlugin(new Plugin\RedirectPlugin());
|
||||
$builder->addPlugin(new Plugin\AddHostPlugin(UriFactoryDiscovery::find()->createUri('https://api.github.com')));
|
||||
$builder->addPlugin(new Plugin\HeaderDefaultsPlugin([
|
||||
'User-Agent' => 'php-github-api (http://github.com/KnpLabs/php-github-api)',
|
||||
]));
|
||||
|
||||
$this->apiVersion = $apiVersion ?: 'v3';
|
||||
$builder->addHeaderValue('Accept', sprintf('application/vnd.github.%s+json', $this->apiVersion));
|
||||
|
||||
if ($enterpriseUrl) {
|
||||
$this->setEnterpriseUrl($enterpriseUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Github\Client using a HttpClient.
|
||||
*
|
||||
* @param HttpClient $httpClient
|
||||
*
|
||||
* @return Client
|
||||
*/
|
||||
public static function createWithHttpClient(HttpClient $httpClient)
|
||||
{
|
||||
$builder = new Builder($httpClient);
|
||||
|
||||
return new self($builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return ApiInterface
|
||||
*/
|
||||
public function api($name)
|
||||
{
|
||||
switch ($name) {
|
||||
case 'me':
|
||||
case 'current_user':
|
||||
case 'currentUser':
|
||||
$api = new Api\CurrentUser($this);
|
||||
break;
|
||||
case 'codeOfConduct':
|
||||
$api = new Api\Miscellaneous\CodeOfConduct($this);
|
||||
break;
|
||||
|
||||
case 'deployment':
|
||||
case 'deployments':
|
||||
$api = new Api\Deployment($this);
|
||||
break;
|
||||
|
||||
case 'ent':
|
||||
case 'enterprise':
|
||||
$api = new Api\Enterprise($this);
|
||||
break;
|
||||
|
||||
case 'emojis':
|
||||
$api = new Api\Miscellaneous\Emojis($this);
|
||||
break;
|
||||
|
||||
case 'git':
|
||||
case 'git_data':
|
||||
case 'gitData':
|
||||
$api = new Api\GitData($this);
|
||||
break;
|
||||
|
||||
case 'gist':
|
||||
case 'gists':
|
||||
$api = new Api\Gists($this);
|
||||
break;
|
||||
|
||||
case 'gitignore':
|
||||
$api = new Api\Miscellaneous\Gitignore($this);
|
||||
break;
|
||||
|
||||
case 'integration':
|
||||
case 'integrations':
|
||||
$api = new Api\Integrations($this);
|
||||
break;
|
||||
|
||||
case 'apps':
|
||||
$api = new Api\Apps($this);
|
||||
break;
|
||||
|
||||
case 'issue':
|
||||
case 'issues':
|
||||
$api = new Api\Issue($this);
|
||||
break;
|
||||
|
||||
case 'markdown':
|
||||
$api = new Api\Markdown($this);
|
||||
break;
|
||||
|
||||
case 'notification':
|
||||
case 'notifications':
|
||||
$api = new Api\Notification($this);
|
||||
break;
|
||||
|
||||
case 'organization':
|
||||
case 'organizations':
|
||||
$api = new Api\Organization($this);
|
||||
break;
|
||||
|
||||
case 'org_project':
|
||||
case 'orgProject':
|
||||
case 'org_projects':
|
||||
case 'orgProjects':
|
||||
case 'organization_project':
|
||||
case 'organizationProject':
|
||||
case 'organization_projects':
|
||||
case 'organizationProjects':
|
||||
$api = new Api\Organization\Projects($this);
|
||||
break;
|
||||
|
||||
case 'pr':
|
||||
case 'pulls':
|
||||
case 'pullRequest':
|
||||
case 'pull_request':
|
||||
case 'pullRequests':
|
||||
case 'pull_requests':
|
||||
$api = new Api\PullRequest($this);
|
||||
break;
|
||||
|
||||
case 'rateLimit':
|
||||
case 'rate_limit':
|
||||
$api = new Api\RateLimit($this);
|
||||
break;
|
||||
|
||||
case 'repo':
|
||||
case 'repos':
|
||||
case 'repository':
|
||||
case 'repositories':
|
||||
$api = new Api\Repo($this);
|
||||
break;
|
||||
|
||||
case 'search':
|
||||
$api = new Api\Search($this);
|
||||
break;
|
||||
|
||||
case 'team':
|
||||
case 'teams':
|
||||
$api = new Api\Organization\Teams($this);
|
||||
break;
|
||||
|
||||
case 'member':
|
||||
case 'members':
|
||||
$api = new Api\Organization\Members($this);
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
case 'users':
|
||||
$api = new Api\User($this);
|
||||
break;
|
||||
|
||||
case 'authorization':
|
||||
case 'authorizations':
|
||||
$api = new Api\Authorizations($this);
|
||||
break;
|
||||
|
||||
case 'meta':
|
||||
$api = new Api\Meta($this);
|
||||
break;
|
||||
|
||||
case 'graphql':
|
||||
$api = new Api\GraphQL($this);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new InvalidArgumentException(sprintf('Undefined api instance called: "%s"', $name));
|
||||
}
|
||||
|
||||
return $api;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate a user for all next requests.
|
||||
*
|
||||
* @param string $tokenOrLogin GitHub private token/username/client ID
|
||||
* @param null|string $password GitHub password/secret (optionally can contain $authMethod)
|
||||
* @param null|string $authMethod One of the AUTH_* class constants
|
||||
*
|
||||
* @throws InvalidArgumentException If no authentication method was given
|
||||
*/
|
||||
public function authenticate($tokenOrLogin, $password = null, $authMethod = null)
|
||||
{
|
||||
if (null === $password && null === $authMethod) {
|
||||
throw new InvalidArgumentException('You need to specify authentication method!');
|
||||
}
|
||||
|
||||
if (null === $authMethod && in_array($password, [self::AUTH_URL_TOKEN, self::AUTH_URL_CLIENT_ID, self::AUTH_HTTP_PASSWORD, self::AUTH_HTTP_TOKEN, self::AUTH_JWT])) {
|
||||
$authMethod = $password;
|
||||
$password = null;
|
||||
}
|
||||
|
||||
if (null === $authMethod) {
|
||||
$authMethod = self::AUTH_HTTP_PASSWORD;
|
||||
}
|
||||
|
||||
$this->getHttpClientBuilder()->removePlugin(Authentication::class);
|
||||
$this->getHttpClientBuilder()->addPlugin(new Authentication($tokenOrLogin, $password, $authMethod));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the URL of your GitHub Enterprise instance.
|
||||
*
|
||||
* @param string $enterpriseUrl URL of the API in the form of http(s)://hostname
|
||||
*/
|
||||
private function setEnterpriseUrl($enterpriseUrl)
|
||||
{
|
||||
$builder = $this->getHttpClientBuilder();
|
||||
$builder->removePlugin(Plugin\AddHostPlugin::class);
|
||||
$builder->removePlugin(PathPrepend::class);
|
||||
|
||||
$builder->addPlugin(new Plugin\AddHostPlugin(UriFactoryDiscovery::find()->createUri($enterpriseUrl)));
|
||||
$builder->addPlugin(new PathPrepend(sprintf('/api/%s', $this->getApiVersion())));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a cache plugin to cache responses locally.
|
||||
*
|
||||
* @param CacheItemPoolInterface $cache
|
||||
* @param array $config
|
||||
*/
|
||||
public function addCache(CacheItemPoolInterface $cachePool, array $config = [])
|
||||
{
|
||||
$this->getHttpClientBuilder()->addCache($cachePool, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the cache plugin.
|
||||
*/
|
||||
public function removeCache()
|
||||
{
|
||||
$this->getHttpClientBuilder()->removeCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*
|
||||
* @return ApiInterface
|
||||
*/
|
||||
public function __call($name, $args)
|
||||
{
|
||||
try {
|
||||
return $this->api($name);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
throw new BadMethodCallException(sprintf('Undefined method called: "%s"', $name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|\Psr\Http\Message\ResponseInterface
|
||||
*/
|
||||
public function getLastResponse()
|
||||
{
|
||||
return $this->responseHistory->getLastResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HttpMethodsClient
|
||||
*/
|
||||
public function getHttpClient()
|
||||
{
|
||||
return $this->getHttpClientBuilder()->getHttpClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
protected function getHttpClientBuilder()
|
||||
{
|
||||
return $this->httpClientBuilder;
|
||||
}
|
||||
}
|
||||
32
vendor/knplabs/github-api/lib/Github/Exception/ApiLimitExceedException.php
vendored
Normal file
32
vendor/knplabs/github-api/lib/Github/Exception/ApiLimitExceedException.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Exception;
|
||||
|
||||
/**
|
||||
* ApiLimitExceedException.
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class ApiLimitExceedException extends RuntimeException
|
||||
{
|
||||
private $limit;
|
||||
private $reset;
|
||||
|
||||
public function __construct($limit = 5000, $reset = 1800, $code = 0, $previous = null)
|
||||
{
|
||||
$this->limit = (int) $limit;
|
||||
$this->reset = (int) $reset;
|
||||
|
||||
parent::__construct(sprintf('You have reached GitHub hourly limit! Actual limit is: %d', $limit), $code, $previous);
|
||||
}
|
||||
|
||||
public function getLimit()
|
||||
{
|
||||
return $this->limit;
|
||||
}
|
||||
|
||||
public function getResetTime()
|
||||
{
|
||||
return $this->reset;
|
||||
}
|
||||
}
|
||||
12
vendor/knplabs/github-api/lib/Github/Exception/BadMethodCallException.php
vendored
Normal file
12
vendor/knplabs/github-api/lib/Github/Exception/BadMethodCallException.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Exception;
|
||||
|
||||
/**
|
||||
* BadMethodCallException.
|
||||
*
|
||||
* @author James Brooks <jbrooksuk@me.com>
|
||||
*/
|
||||
class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
12
vendor/knplabs/github-api/lib/Github/Exception/ErrorException.php
vendored
Normal file
12
vendor/knplabs/github-api/lib/Github/Exception/ErrorException.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Exception;
|
||||
|
||||
/**
|
||||
* ErrorException.
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class ErrorException extends \ErrorException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
9
vendor/knplabs/github-api/lib/Github/Exception/ExceptionInterface.php
vendored
Normal file
9
vendor/knplabs/github-api/lib/Github/Exception/ExceptionInterface.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Exception;
|
||||
|
||||
use Http\Client\Exception;
|
||||
|
||||
interface ExceptionInterface extends Exception
|
||||
{
|
||||
}
|
||||
12
vendor/knplabs/github-api/lib/Github/Exception/InvalidArgumentException.php
vendored
Normal file
12
vendor/knplabs/github-api/lib/Github/Exception/InvalidArgumentException.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Exception;
|
||||
|
||||
/**
|
||||
* InvalidArgumentException.
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
20
vendor/knplabs/github-api/lib/Github/Exception/MissingArgumentException.php
vendored
Normal file
20
vendor/knplabs/github-api/lib/Github/Exception/MissingArgumentException.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Exception;
|
||||
|
||||
/**
|
||||
* MissingArgumentException.
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class MissingArgumentException extends ErrorException
|
||||
{
|
||||
public function __construct($required, $code = 0, $previous = null)
|
||||
{
|
||||
if (is_string($required)) {
|
||||
$required = [$required];
|
||||
}
|
||||
|
||||
parent::__construct(sprintf('One or more of required ("%s") parameters is missing!', implode('", "', $required)), $code, $previous);
|
||||
}
|
||||
}
|
||||
12
vendor/knplabs/github-api/lib/Github/Exception/RuntimeException.php
vendored
Normal file
12
vendor/knplabs/github-api/lib/Github/Exception/RuntimeException.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Exception;
|
||||
|
||||
/**
|
||||
* RuntimeException.
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class RuntimeException extends \RuntimeException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
19
vendor/knplabs/github-api/lib/Github/Exception/TwoFactorAuthenticationRequiredException.php
vendored
Normal file
19
vendor/knplabs/github-api/lib/Github/Exception/TwoFactorAuthenticationRequiredException.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Exception;
|
||||
|
||||
class TwoFactorAuthenticationRequiredException extends RuntimeException
|
||||
{
|
||||
private $type;
|
||||
|
||||
public function __construct($type, $code = 0, $previous = null)
|
||||
{
|
||||
$this->type = $type;
|
||||
parent::__construct('Two factor authentication is enabled on this account', $code, $previous);
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
12
vendor/knplabs/github-api/lib/Github/Exception/ValidationFailedException.php
vendored
Normal file
12
vendor/knplabs/github-api/lib/Github/Exception/ValidationFailedException.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Github\Exception;
|
||||
|
||||
/**
|
||||
* When GitHub returns with a HTTP response that says our request is invalid.
|
||||
*
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
*/
|
||||
class ValidationFailedException extends ErrorException
|
||||
{
|
||||
}
|
||||
200
vendor/knplabs/github-api/lib/Github/HttpClient/Builder.php
vendored
Normal file
200
vendor/knplabs/github-api/lib/Github/HttpClient/Builder.php
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
namespace Github\HttpClient;
|
||||
|
||||
use Http\Client\Common\HttpMethodsClient;
|
||||
use Http\Client\Common\Plugin;
|
||||
use Http\Client\Common\Plugin\Cache\Generator\HeaderCacheKeyGenerator;
|
||||
use Http\Client\Common\PluginClientFactory;
|
||||
use Http\Client\HttpClient;
|
||||
use Http\Discovery\HttpClientDiscovery;
|
||||
use Http\Discovery\MessageFactoryDiscovery;
|
||||
use Http\Discovery\StreamFactoryDiscovery;
|
||||
use Http\Message\MessageFactory;
|
||||
use Http\Message\RequestFactory;
|
||||
use Http\Message\StreamFactory;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
|
||||
/**
|
||||
* A builder that builds the API client.
|
||||
* This will allow you to fluently add and remove plugins.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class Builder
|
||||
{
|
||||
/**
|
||||
* The object that sends HTTP messages.
|
||||
*
|
||||
* @var HttpClient
|
||||
*/
|
||||
private $httpClient;
|
||||
|
||||
/**
|
||||
* A HTTP client with all our plugins.
|
||||
*
|
||||
* @var HttpMethodsClient
|
||||
*/
|
||||
private $pluginClient;
|
||||
|
||||
/**
|
||||
* @var MessageFactory
|
||||
*/
|
||||
private $requestFactory;
|
||||
|
||||
/**
|
||||
* @var StreamFactory
|
||||
*/
|
||||
private $streamFactory;
|
||||
|
||||
/**
|
||||
* True if we should create a new Plugin client at next request.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $httpClientModified = true;
|
||||
|
||||
/**
|
||||
* @var Plugin[]
|
||||
*/
|
||||
private $plugins = [];
|
||||
|
||||
/**
|
||||
* This plugin is special treated because it has to be the very last plugin.
|
||||
*
|
||||
* @var Plugin\CachePlugin
|
||||
*/
|
||||
private $cachePlugin;
|
||||
|
||||
/**
|
||||
* Http headers.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $headers = [];
|
||||
|
||||
/**
|
||||
* @param HttpClient $httpClient
|
||||
* @param RequestFactory $requestFactory
|
||||
* @param StreamFactory $streamFactory
|
||||
*/
|
||||
public function __construct(
|
||||
HttpClient $httpClient = null,
|
||||
RequestFactory $requestFactory = null,
|
||||
StreamFactory $streamFactory = null
|
||||
) {
|
||||
$this->httpClient = $httpClient ?: HttpClientDiscovery::find();
|
||||
$this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find();
|
||||
$this->streamFactory = $streamFactory ?: StreamFactoryDiscovery::find();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HttpMethodsClient
|
||||
*/
|
||||
public function getHttpClient()
|
||||
{
|
||||
if ($this->httpClientModified) {
|
||||
$this->httpClientModified = false;
|
||||
|
||||
$plugins = $this->plugins;
|
||||
if ($this->cachePlugin) {
|
||||
$plugins[] = $this->cachePlugin;
|
||||
}
|
||||
|
||||
$this->pluginClient = new HttpMethodsClient(
|
||||
(new PluginClientFactory())->createClient($this->httpClient, $plugins),
|
||||
$this->requestFactory
|
||||
);
|
||||
}
|
||||
|
||||
return $this->pluginClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new plugin to the end of the plugin chain.
|
||||
*
|
||||
* @param Plugin $plugin
|
||||
*/
|
||||
public function addPlugin(Plugin $plugin)
|
||||
{
|
||||
$this->plugins[] = $plugin;
|
||||
$this->httpClientModified = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a plugin by its fully qualified class name (FQCN).
|
||||
*
|
||||
* @param string $fqcn
|
||||
*/
|
||||
public function removePlugin($fqcn)
|
||||
{
|
||||
foreach ($this->plugins as $idx => $plugin) {
|
||||
if ($plugin instanceof $fqcn) {
|
||||
unset($this->plugins[$idx]);
|
||||
$this->httpClientModified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears used headers.
|
||||
*/
|
||||
public function clearHeaders()
|
||||
{
|
||||
$this->headers = [];
|
||||
|
||||
$this->removePlugin(Plugin\HeaderAppendPlugin::class);
|
||||
$this->addPlugin(new Plugin\HeaderAppendPlugin($this->headers));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $headers
|
||||
*/
|
||||
public function addHeaders(array $headers)
|
||||
{
|
||||
$this->headers = array_merge($this->headers, $headers);
|
||||
|
||||
$this->removePlugin(Plugin\HeaderAppendPlugin::class);
|
||||
$this->addPlugin(new Plugin\HeaderAppendPlugin($this->headers));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $header
|
||||
* @param string $headerValue
|
||||
*/
|
||||
public function addHeaderValue($header, $headerValue)
|
||||
{
|
||||
if (!isset($this->headers[$header])) {
|
||||
$this->headers[$header] = $headerValue;
|
||||
} else {
|
||||
$this->headers[$header] = array_merge((array) $this->headers[$header], [$headerValue]);
|
||||
}
|
||||
|
||||
$this->removePlugin(Plugin\HeaderAppendPlugin::class);
|
||||
$this->addPlugin(new Plugin\HeaderAppendPlugin($this->headers));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a cache plugin to cache responses locally.
|
||||
*
|
||||
* @param CacheItemPoolInterface $cachePool
|
||||
* @param array $config
|
||||
*/
|
||||
public function addCache(CacheItemPoolInterface $cachePool, array $config = [])
|
||||
{
|
||||
if (!isset($config['cache_key_generator'])) {
|
||||
$config['cache_key_generator'] = new HeaderCacheKeyGenerator(['Authorization', 'Cookie', 'Accept', 'Content-type']);
|
||||
}
|
||||
$this->cachePlugin = Plugin\CachePlugin::clientCache($cachePool, $this->streamFactory, $config);
|
||||
$this->httpClientModified = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the cache plugin.
|
||||
*/
|
||||
public function removeCache()
|
||||
{
|
||||
$this->cachePlugin = null;
|
||||
$this->httpClientModified = true;
|
||||
}
|
||||
}
|
||||
82
vendor/knplabs/github-api/lib/Github/HttpClient/Message/ResponseMediator.php
vendored
Normal file
82
vendor/knplabs/github-api/lib/Github/HttpClient/Message/ResponseMediator.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Github\HttpClient\Message;
|
||||
|
||||
use Github\Exception\ApiLimitExceedException;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class ResponseMediator
|
||||
{
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public static function getContent(ResponseInterface $response)
|
||||
{
|
||||
$body = $response->getBody()->__toString();
|
||||
if (strpos($response->getHeaderLine('Content-Type'), 'application/json') === 0) {
|
||||
$content = json_decode($body, true);
|
||||
if (JSON_ERROR_NONE === json_last_error()) {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public static function getPagination(ResponseInterface $response)
|
||||
{
|
||||
if (!$response->hasHeader('Link')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$header = self::getHeader($response, 'Link');
|
||||
$pagination = [];
|
||||
foreach (explode(',', $header) as $link) {
|
||||
preg_match('/<(.*)>; rel="(.*)"/i', trim($link, ','), $match);
|
||||
|
||||
if (3 === count($match)) {
|
||||
$pagination[$match[2]] = $match[1];
|
||||
}
|
||||
}
|
||||
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public static function getApiLimit(ResponseInterface $response)
|
||||
{
|
||||
$remainingCalls = self::getHeader($response, 'X-RateLimit-Remaining');
|
||||
|
||||
if (null !== $remainingCalls && 1 > $remainingCalls) {
|
||||
throw new ApiLimitExceedException($remainingCalls);
|
||||
}
|
||||
|
||||
return $remainingCalls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for a single header.
|
||||
*
|
||||
* @param ResponseInterface $response
|
||||
* @param string $name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getHeader(ResponseInterface $response, $name)
|
||||
{
|
||||
$headers = $response->getHeader($name);
|
||||
|
||||
return array_shift($headers);
|
||||
}
|
||||
}
|
||||
85
vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/Authentication.php
vendored
Normal file
85
vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/Authentication.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace Github\HttpClient\Plugin;
|
||||
|
||||
use Github\Client;
|
||||
use Github\Exception\RuntimeException;
|
||||
use Http\Client\Common\Plugin;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* Add authentication to the request.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class Authentication implements Plugin
|
||||
{
|
||||
private $tokenOrLogin;
|
||||
private $password;
|
||||
private $method;
|
||||
|
||||
public function __construct($tokenOrLogin, $password, $method)
|
||||
{
|
||||
$this->tokenOrLogin = $tokenOrLogin;
|
||||
$this->password = $password;
|
||||
$this->method = $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handleRequest(RequestInterface $request, callable $next, callable $first)
|
||||
{
|
||||
switch ($this->method) {
|
||||
case Client::AUTH_HTTP_PASSWORD:
|
||||
$request = $request->withHeader(
|
||||
'Authorization',
|
||||
sprintf('Basic %s', base64_encode($this->tokenOrLogin.':'.$this->password))
|
||||
);
|
||||
break;
|
||||
|
||||
case Client::AUTH_HTTP_TOKEN:
|
||||
$request = $request->withHeader('Authorization', sprintf('token %s', $this->tokenOrLogin));
|
||||
break;
|
||||
|
||||
case Client::AUTH_URL_CLIENT_ID:
|
||||
$uri = $request->getUri();
|
||||
$query = $uri->getQuery();
|
||||
|
||||
$parameters = [
|
||||
'client_id' => $this->tokenOrLogin,
|
||||
'client_secret' => $this->password,
|
||||
];
|
||||
|
||||
$query .= empty($query) ? '' : '&';
|
||||
$query .= utf8_encode(http_build_query($parameters, '', '&'));
|
||||
|
||||
$uri = $uri->withQuery($query);
|
||||
$request = $request->withUri($uri);
|
||||
break;
|
||||
|
||||
case Client::AUTH_URL_TOKEN:
|
||||
$uri = $request->getUri();
|
||||
$query = $uri->getQuery();
|
||||
|
||||
$parameters = ['access_token' => $this->tokenOrLogin];
|
||||
|
||||
$query .= empty($query) ? '' : '&';
|
||||
$query .= utf8_encode(http_build_query($parameters, '', '&'));
|
||||
|
||||
$uri = $uri->withQuery($query);
|
||||
$request = $request->withUri($uri);
|
||||
break;
|
||||
|
||||
case Client::AUTH_JWT:
|
||||
$request = $request->withHeader('Authorization', sprintf('Bearer %s', $this->tokenOrLogin));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException(sprintf('%s not yet implemented', $this->method));
|
||||
break;
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
90
vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php
vendored
Normal file
90
vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace Github\HttpClient\Plugin;
|
||||
|
||||
use Github\Exception\ApiLimitExceedException;
|
||||
use Github\Exception\ErrorException;
|
||||
use Github\Exception\RuntimeException;
|
||||
use Github\Exception\TwoFactorAuthenticationRequiredException;
|
||||
use Github\Exception\ValidationFailedException;
|
||||
use Github\HttpClient\Message\ResponseMediator;
|
||||
use Http\Client\Common\Plugin;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* @author Joseph Bielawski <stloyd@gmail.com>
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class GithubExceptionThrower implements Plugin
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handleRequest(RequestInterface $request, callable $next, callable $first)
|
||||
{
|
||||
return $next($request)->then(function (ResponseInterface $response) use ($request) {
|
||||
if ($response->getStatusCode() < 400 || $response->getStatusCode() > 600) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
// If error:
|
||||
$remaining = ResponseMediator::getHeader($response, 'X-RateLimit-Remaining');
|
||||
if (null != $remaining && 1 > $remaining && 'rate_limit' !== substr($request->getRequestTarget(), 1, 10)) {
|
||||
$limit = ResponseMediator::getHeader($response, 'X-RateLimit-Limit');
|
||||
$reset = ResponseMediator::getHeader($response, 'X-RateLimit-Reset');
|
||||
|
||||
throw new ApiLimitExceedException($limit, $reset);
|
||||
}
|
||||
|
||||
if (401 === $response->getStatusCode()) {
|
||||
if ($response->hasHeader('X-GitHub-OTP') && 0 === strpos((string) ResponseMediator::getHeader($response, 'X-GitHub-OTP'), 'required;')) {
|
||||
$type = substr((string) ResponseMediator::getHeader($response, 'X-GitHub-OTP'), 9);
|
||||
|
||||
throw new TwoFactorAuthenticationRequiredException($type);
|
||||
}
|
||||
}
|
||||
|
||||
$content = ResponseMediator::getContent($response);
|
||||
if (is_array($content) && isset($content['message'])) {
|
||||
if (400 == $response->getStatusCode()) {
|
||||
throw new ErrorException($content['message'], 400);
|
||||
} elseif (422 == $response->getStatusCode() && isset($content['errors'])) {
|
||||
$errors = [];
|
||||
foreach ($content['errors'] as $error) {
|
||||
switch ($error['code']) {
|
||||
case 'missing':
|
||||
$errors[] = sprintf('The %s %s does not exist, for resource "%s"', $error['field'], $error['value'], $error['resource']);
|
||||
break;
|
||||
|
||||
case 'missing_field':
|
||||
$errors[] = sprintf('Field "%s" is missing, for resource "%s"', $error['field'], $error['resource']);
|
||||
break;
|
||||
|
||||
case 'invalid':
|
||||
if (isset($error['message'])) {
|
||||
$errors[] = sprintf('Field "%s" is invalid, for resource "%s": "%s"', $error['field'], $error['resource'], $error['message']);
|
||||
} else {
|
||||
$errors[] = sprintf('Field "%s" is invalid, for resource "%s"', $error['field'], $error['resource']);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'already_exists':
|
||||
$errors[] = sprintf('Field "%s" already exists, for resource "%s"', $error['field'], $error['resource']);
|
||||
break;
|
||||
|
||||
default:
|
||||
$errors[] = $error['message'];
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
throw new ValidationFailedException('Validation Failed: '.implode(', ', $errors), 422);
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException(isset($content['message']) ? $content['message'] : $content, $response->getStatusCode());
|
||||
});
|
||||
}
|
||||
}
|
||||
38
vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/History.php
vendored
Normal file
38
vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/History.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Github\HttpClient\Plugin;
|
||||
|
||||
use Http\Client\Common\Plugin\Journal;
|
||||
use Http\Client\Exception;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* A plugin to remember the last response.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class History implements Journal
|
||||
{
|
||||
/**
|
||||
* @var ResponseInterface
|
||||
*/
|
||||
private $lastResponse;
|
||||
|
||||
/**
|
||||
* @return ResponseInterface|null
|
||||
*/
|
||||
public function getLastResponse()
|
||||
{
|
||||
return $this->lastResponse;
|
||||
}
|
||||
|
||||
public function addSuccess(RequestInterface $request, ResponseInterface $response)
|
||||
{
|
||||
$this->lastResponse = $response;
|
||||
}
|
||||
|
||||
public function addFailure(RequestInterface $request, Exception $exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
38
vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/PathPrepend.php
vendored
Normal file
38
vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/PathPrepend.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Github\HttpClient\Plugin;
|
||||
|
||||
use Http\Client\Common\Plugin;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* Prepend the URI with a string.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class PathPrepend implements Plugin
|
||||
{
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function __construct($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handleRequest(RequestInterface $request, callable $next, callable $first)
|
||||
{
|
||||
$currentPath = $request->getUri()->getPath();
|
||||
if (strpos($currentPath, $this->path) !== 0) {
|
||||
$uri = $request->getUri()->withPath($this->path.$currentPath);
|
||||
$request = $request->withUri($uri);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
194
vendor/knplabs/github-api/lib/Github/ResultPager.php
vendored
Normal file
194
vendor/knplabs/github-api/lib/Github/ResultPager.php
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
|
||||
namespace Github;
|
||||
|
||||
use Github\Api\ApiInterface;
|
||||
use Github\Api\Search;
|
||||
use Github\HttpClient\Message\ResponseMediator;
|
||||
|
||||
/**
|
||||
* Pager class for supporting pagination in github classes.
|
||||
*
|
||||
* @author Ramon de la Fuente <ramon@future500.nl>
|
||||
* @author Mitchel Verschoof <mitchel@future500.nl>
|
||||
*/
|
||||
class ResultPager implements ResultPagerInterface
|
||||
{
|
||||
/**
|
||||
* The GitHub Client to use for pagination.
|
||||
*
|
||||
* @var \Github\Client
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* Comes from pagination headers in Github API results.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $pagination;
|
||||
|
||||
/**
|
||||
* The Github client to use for pagination.
|
||||
*
|
||||
* This must be the same instance that you got the Api instance from.
|
||||
*
|
||||
* Example code:
|
||||
*
|
||||
* $client = new \Github\Client();
|
||||
* $api = $client->api('someApi');
|
||||
* $pager = new \Github\ResultPager($client);
|
||||
*
|
||||
* @param \Github\Client $client
|
||||
*/
|
||||
public function __construct(Client $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPagination()
|
||||
{
|
||||
return $this->pagination;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch(ApiInterface $api, $method, array $parameters = [])
|
||||
{
|
||||
$result = $this->callApi($api, $method, $parameters);
|
||||
$this->postFetch();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll(ApiInterface $api, $method, array $parameters = [])
|
||||
{
|
||||
$isSearch = $api instanceof Search;
|
||||
|
||||
// get the perPage from the api
|
||||
$perPage = $api->getPerPage();
|
||||
|
||||
// set parameters per_page to GitHub max to minimize number of requests
|
||||
$api->setPerPage(100);
|
||||
|
||||
try {
|
||||
$result = $this->callApi($api, $method, $parameters);
|
||||
$this->postFetch();
|
||||
|
||||
if ($isSearch) {
|
||||
$result = isset($result['items']) ? $result['items'] : $result;
|
||||
}
|
||||
|
||||
while ($this->hasNext()) {
|
||||
$next = $this->fetchNext();
|
||||
|
||||
if ($isSearch) {
|
||||
$result = array_merge($result, $next['items']);
|
||||
} else {
|
||||
$result = array_merge($result, $next);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
// restore the perPage
|
||||
$api->setPerPage($perPage);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function postFetch()
|
||||
{
|
||||
$this->pagination = ResponseMediator::getPagination($this->client->getLastResponse());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasNext()
|
||||
{
|
||||
return $this->has('next');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchNext()
|
||||
{
|
||||
return $this->get('next');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasPrevious()
|
||||
{
|
||||
return $this->has('prev');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchPrevious()
|
||||
{
|
||||
return $this->get('prev');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchFirst()
|
||||
{
|
||||
return $this->get('first');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchLast()
|
||||
{
|
||||
return $this->get('last');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*/
|
||||
protected function has($key)
|
||||
{
|
||||
return !empty($this->pagination) && isset($this->pagination[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*/
|
||||
protected function get($key)
|
||||
{
|
||||
if ($this->has($key)) {
|
||||
$result = $this->client->getHttpClient()->get($this->pagination[$key]);
|
||||
$this->postFetch();
|
||||
|
||||
return ResponseMediator::getContent($result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ApiInterface $api
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function callApi(ApiInterface $api, $method, array $parameters)
|
||||
{
|
||||
return call_user_func_array([$api, $method], $parameters);
|
||||
}
|
||||
}
|
||||
90
vendor/knplabs/github-api/lib/Github/ResultPagerInterface.php
vendored
Normal file
90
vendor/knplabs/github-api/lib/Github/ResultPagerInterface.php
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace Github;
|
||||
|
||||
use Github\Api\ApiInterface;
|
||||
|
||||
/**
|
||||
* Pager interface.
|
||||
*
|
||||
* @author Ramon de la Fuente <ramon@future500.nl>
|
||||
* @author Mitchel Verschoof <mitchel@future500.nl>
|
||||
*/
|
||||
interface ResultPagerInterface
|
||||
{
|
||||
/**
|
||||
* @return null|array pagination result of last request
|
||||
*/
|
||||
public function getPagination();
|
||||
|
||||
/**
|
||||
* Fetch a single result (page) from an api call.
|
||||
*
|
||||
* @param ApiInterface $api the Api instance
|
||||
* @param string $method the method name to call on the Api instance
|
||||
* @param array $parameters the method parameters in an array
|
||||
*
|
||||
* @return array returns the result of the Api::$method() call
|
||||
*/
|
||||
public function fetch(ApiInterface $api, $method, array $parameters = []);
|
||||
|
||||
/**
|
||||
* Fetch all results (pages) from an api call.
|
||||
*
|
||||
* Use with care - there is no maximum.
|
||||
*
|
||||
* @param ApiInterface $api the Api instance
|
||||
* @param string $method the method name to call on the Api instance
|
||||
* @param array $parameters the method parameters in an array
|
||||
*
|
||||
* @return array returns a merge of the results of the Api::$method() call
|
||||
*/
|
||||
public function fetchAll(ApiInterface $api, $method, array $parameters = []);
|
||||
|
||||
/**
|
||||
* Method that performs the actual work to refresh the pagination property.
|
||||
*/
|
||||
public function postFetch();
|
||||
|
||||
/**
|
||||
* Check to determine the availability of a next page.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasNext();
|
||||
|
||||
/**
|
||||
* Check to determine the availability of a previous page.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPrevious();
|
||||
|
||||
/**
|
||||
* Fetch the next page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchNext();
|
||||
|
||||
/**
|
||||
* Fetch the previous page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchPrevious();
|
||||
|
||||
/**
|
||||
* Fetch the first page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchFirst();
|
||||
|
||||
/**
|
||||
* Fetch the last page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchLast();
|
||||
}
|
||||
Reference in New Issue
Block a user