forked from joomla/gitea
Update 2024-07-11 23:09:12
This commit is contained in:
parent
94ccf47e41
commit
7d1ecf3d74
@ -13,7 +13,7 @@
|
|||||||
@startuml
|
@startuml
|
||||||
class Contents #Gold {
|
class Contents #Gold {
|
||||||
+ get(string $owner, string $repo, ...) : mixed
|
+ get(string $owner, string $repo, ...) : mixed
|
||||||
+ metadata(string $owner, string $repo, ...) : ?object
|
+ metadata(string $owner, string $repo, ...) : null|array|object
|
||||||
+ create(string $owner, string $repo, ...) : ?object
|
+ create(string $owner, string $repo, ...) : ?object
|
||||||
+ root(string $owner, string $repo, ...) : ?array
|
+ root(string $owner, string $repo, ...) : ?array
|
||||||
+ update(string $owner, string $repo, ...) : ?object
|
+ update(string $owner, string $repo, ...) : ?object
|
||||||
@ -42,7 +42,7 @@ or a list of entries if a directory.
|
|||||||
Default the repository's default branch (usually master).
|
Default the repository's default branch (usually master).
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: ?object
|
return: null|array|object
|
||||||
|
|
||||||
arguments:
|
arguments:
|
||||||
string $owner
|
string $owner
|
||||||
@ -68,7 +68,7 @@ note right of Contents::create
|
|||||||
?string $authorEmail = null
|
?string $authorEmail = null
|
||||||
?string $committerName = null
|
?string $committerName = null
|
||||||
?string $committerEmail = null
|
?string $committerEmail = null
|
||||||
?bool $newBranch = false
|
?string $newBranch = null
|
||||||
?string $authorDate = null
|
?string $authorDate = null
|
||||||
?string $committerDate = null
|
?string $committerDate = null
|
||||||
?bool $signoff = null
|
?bool $signoff = null
|
||||||
|
@ -64,10 +64,10 @@ class Contents extends Api
|
|||||||
* @param string|null $ref Optional. The name of the commit/branch/tag.
|
* @param string|null $ref Optional. The name of the commit/branch/tag.
|
||||||
* Default the repository's default branch (usually master).
|
* Default the repository's default branch (usually master).
|
||||||
*
|
*
|
||||||
* @return object|null
|
* @return null|array|object
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
**/
|
**/
|
||||||
public function metadata(string $owner, string $repo, string $filepath, ?string $ref = null): ?object
|
public function metadata(string $owner, string $repo, string $filepath, ?string $ref = null): null|array|object
|
||||||
{
|
{
|
||||||
// Build the request path.
|
// Build the request path.
|
||||||
$path = "/repos/{$owner}/{$repo}/contents/{$filepath}";
|
$path = "/repos/{$owner}/{$repo}/contents/{$filepath}";
|
||||||
@ -100,7 +100,7 @@ class Contents extends Api
|
|||||||
* @param string|null $authorEmail The author's email.
|
* @param string|null $authorEmail The author's email.
|
||||||
* @param string|null $committerName The committer's name.
|
* @param string|null $committerName The committer's name.
|
||||||
* @param string|null $committerEmail The committer's email.
|
* @param string|null $committerEmail The committer's email.
|
||||||
* @param bool|null $newBranch Whether to create a new branch. Defaults to false.
|
* @param string|null $newBranch Whether to create a new branch. Defaults to null.
|
||||||
* @param string|null $authorDate The author's date.
|
* @param string|null $authorDate The author's date.
|
||||||
* @param string|null $committerDate The committer's date.
|
* @param string|null $committerDate The committer's date.
|
||||||
* @param bool|null $signoff Add a Signed-off-by trailer. Defaults to null.
|
* @param bool|null $signoff Add a Signed-off-by trailer. Defaults to null.
|
||||||
@ -119,7 +119,7 @@ class Contents extends Api
|
|||||||
?string $authorEmail = null,
|
?string $authorEmail = null,
|
||||||
?string $committerName = null,
|
?string $committerName = null,
|
||||||
?string $committerEmail = null,
|
?string $committerEmail = null,
|
||||||
?bool $newBranch = false,
|
?string $newBranch = null,
|
||||||
?string $authorDate = null,
|
?string $authorDate = null,
|
||||||
?string $committerDate = null,
|
?string $committerDate = null,
|
||||||
?bool $signoff = null
|
?bool $signoff = null
|
||||||
|
@ -40,10 +40,10 @@
|
|||||||
* @param string|null $ref Optional. The name of the commit/branch/tag.
|
* @param string|null $ref Optional. The name of the commit/branch/tag.
|
||||||
* Default the repository's default branch (usually master).
|
* Default the repository's default branch (usually master).
|
||||||
*
|
*
|
||||||
* @return object|null
|
* @return null|array|object
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
**/
|
**/
|
||||||
public function metadata(string $owner, string $repo, string $filepath, ?string $ref = null): ?object
|
public function metadata(string $owner, string $repo, string $filepath, ?string $ref = null): null|array|object
|
||||||
{
|
{
|
||||||
// Build the request path.
|
// Build the request path.
|
||||||
$path = "/repos/{$owner}/{$repo}/contents/{$filepath}";
|
$path = "/repos/{$owner}/{$repo}/contents/{$filepath}";
|
||||||
@ -76,7 +76,7 @@
|
|||||||
* @param string|null $authorEmail The author's email.
|
* @param string|null $authorEmail The author's email.
|
||||||
* @param string|null $committerName The committer's name.
|
* @param string|null $committerName The committer's name.
|
||||||
* @param string|null $committerEmail The committer's email.
|
* @param string|null $committerEmail The committer's email.
|
||||||
* @param bool|null $newBranch Whether to create a new branch. Defaults to false.
|
* @param string|null $newBranch Whether to create a new branch. Defaults to null.
|
||||||
* @param string|null $authorDate The author's date.
|
* @param string|null $authorDate The author's date.
|
||||||
* @param string|null $committerDate The committer's date.
|
* @param string|null $committerDate The committer's date.
|
||||||
* @param bool|null $signoff Add a Signed-off-by trailer. Defaults to null.
|
* @param bool|null $signoff Add a Signed-off-by trailer. Defaults to null.
|
||||||
@ -95,7 +95,7 @@
|
|||||||
?string $authorEmail = null,
|
?string $authorEmail = null,
|
||||||
?string $committerName = null,
|
?string $committerName = null,
|
||||||
?string $committerEmail = null,
|
?string $committerEmail = null,
|
||||||
?bool $newBranch = false,
|
?string $newBranch = null,
|
||||||
?string $authorDate = null,
|
?string $authorDate = null,
|
||||||
?string $committerDate = null,
|
?string $committerDate = null,
|
||||||
?bool $signoff = null
|
?bool $signoff = null
|
||||||
|
@ -29,7 +29,7 @@ final class Http extends JoomlaHttp
|
|||||||
* @var string
|
* @var string
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
protected string $_token_; // to avoid collusions (but allow swapping)
|
protected string $_token_; // to avoid collisions (but allow swapping)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -52,7 +52,7 @@ final class Http extends JoomlaHttp
|
|||||||
// add the token if given
|
// add the token if given
|
||||||
if (is_string($token))
|
if (is_string($token))
|
||||||
{
|
{
|
||||||
$config['headers']['Authorization'] = $token;
|
$config['headers']['Authorization'] = 'token ' . $token;
|
||||||
$this->_token_ = $token;
|
$this->_token_ = $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ final class Http extends JoomlaHttp
|
|||||||
);
|
);
|
||||||
|
|
||||||
// add the token
|
// add the token
|
||||||
$headers['Authorization'] = $token;
|
$headers['Authorization'] = 'token ' . $token;
|
||||||
$this->_token_ = $token;
|
$this->_token_ = $token;
|
||||||
|
|
||||||
$this->setOption('headers', $headers);
|
$this->setOption('headers', $headers);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* @var string
|
* @var string
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
protected string $_token_; // to avoid collusions (but allow swapping)
|
protected string $_token_; // to avoid collisions (but allow swapping)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -27,7 +27,7 @@
|
|||||||
// add the token if given
|
// add the token if given
|
||||||
if (is_string($token))
|
if (is_string($token))
|
||||||
{
|
{
|
||||||
$config['headers']['Authorization'] = $token;
|
$config['headers']['Authorization'] = 'token ' . $token;
|
||||||
$this->_token_ = $token;
|
$this->_token_ = $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
// add the token
|
// add the token
|
||||||
$headers['Authorization'] = $token;
|
$headers['Authorization'] = 'token ' . $token;
|
||||||
$this->_token_ = $token;
|
$this->_token_ = $token;
|
||||||
|
|
||||||
$this->setOption('headers', $headers);
|
$this->setOption('headers', $headers);
|
||||||
|
Loading…
Reference in New Issue
Block a user