Class Github\Api\Repository\Contents

InheritanceGithub\Api\Repository\Contents » Github\Api\AbstractApi
ImplementsGithub\Api\ApiInterface

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Github\Api\AbstractApi
archive() Get content of archives in a repository. Github\Api\Repository\Contents
configure() Github\Api\AbstractApi
create() Creates a new file in a repository. Github\Api\Repository\Contents
download() Get the contents of a file in a repository. Github\Api\Repository\Contents
exists() Checks that a given path exists in a repository. Github\Api\Repository\Contents
getPerPage() Github\Api\AbstractApi
readme() Get content of README file in a repository. Github\Api\Repository\Contents
rm() Deletes a file from a repository. Github\Api\Repository\Contents
setPerPage() Github\Api\AbstractApi
show() Get contents of any file or directory in a repository. Github\Api\Repository\Contents
update() Updates the contents of a file in a repository. Github\Api\Repository\Contents

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
createJsonBody() Create a JSON encoded version of an array of parameters. Github\Api\AbstractApi
delete() Send a DELETE request with JSON-encoded parameters. Github\Api\AbstractApi
get() Send a GET request with query parameters. Github\Api\AbstractApi
head() Send a HEAD request with query parameters. Github\Api\AbstractApi
patch() Send a PATCH request with JSON-encoded parameters. Github\Api\AbstractApi
post() Send a POST request with JSON-encoded parameters. Github\Api\AbstractApi
postRaw() Send a POST request with raw data. Github\Api\AbstractApi
put() Send a PUT request with JSON-encoded parameters. Github\Api\AbstractApi

Method Details

archive() public method

Get content of archives in a repository.

public array archive ( $username, $repository, $format, $reference null )
$username string

The user who owns the repository

$repository string

The name of the repository

$format string

Format of archive: tarball or zipball

$reference null|string

Reference to a branch or commit

return array

Information for archives

create() public method

Creates a new file in a repository.

public array create ( $username, $repository, $path, $content, $message, $branch null, array $committer null )
$username string

The user who owns the repository

$repository string

The name of the repository

$path string

Path to file

$content string

Contents of the new file

$message string

The commit message

$branch null|string

Name of a branch

$committer null|array

Information about the committer

return array

Information about the new file

throws Github\Exception\MissingArgumentException
download() public method

Get the contents of a file in a repository.

public null|string download ( $username, $repository, $path, $reference null )
$username string

The user who owns the repository

$repository string

The name of the repository

$path string

Path to file

$reference null|string

Reference to a branch or commit

return null|string

Content of file, or null in case of base64_decode failure

throws Github\Exception\InvalidArgumentException

If $path is not a file or if its encoding is different from base64

throws Github\Exception\ErrorException

If $path doesn't include a 'content' index

exists() public method

Checks that a given path exists in a repository.

public bool exists ( $username, $repository, $path, $reference null )
$username string

The user who owns the repository

$repository string

The name of the repository

$path string

Path of file to check

$reference null|string

Reference to a branch or commit

readme() public method

Get content of README file in a repository.

public array readme ( $username, $repository, $reference null )
$username string

The user who owns the repository

$repository string

The name of the repository

$reference null|string

Reference to a branch or commit

return array

Information for README file

rm() public method

Deletes a file from a repository.

public array rm ( $username, $repository, $path, $message, $sha, $branch null, array $committer null )
$username string

The user who owns the repository

$repository string

The name of the repository

$path string

Path to file

$message string

The commit message

$sha string

Blob SHA of the file being deleted

$branch null|string

Name of a branch

$committer null|array

Information about the committer

return array

Information about the updated file

throws Github\Exception\MissingArgumentException
show() public method

Get contents of any file or directory in a repository.

public array show ( $username, $repository, $path null, $reference null )
$username string

The user who owns the repository

$repository string

The name of the repository

$path null|string

Path to file or directory

$reference null|string

Reference to a branch or commit

return array

Information for file | information for each item in directory

update() public method

Updates the contents of a file in a repository.

public array update ( $username, $repository, $path, $content, $message, $sha, $branch null, array $committer null )
$username string

The user who owns the repository

$repository string

The name of the repository

$path string

Path to file

$content string

Contents of the new file

$message string

The commit message

$sha string

Blob SHA of the file being replaced

$branch null|string

Name of a branch

$committer null|array

Information about the committer

return array

Information about the updated file

throws Github\Exception\MissingArgumentException