mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-14 03:42:41 +09:00
changes
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user