JGithubPackageRepositoriesContents
class JGithubPackageRepositoriesContents extends JGithubPackage
GitHub API Repositories Contents class for the Joomla Platform.
These API methods let you retrieve the contents of files within a repository as Base64 encoded content. See media types for requesting raw or other formats.
Methods
Get the README
Get contents
Get archive link
Details
object
getReadme(
string $owner,
string $repo,
string $ref = '')
Get the README
This method returns the preferred README for a repository.
GET /repos/:owner/:repo/readme
Parameters
ref Optional string - The String name of the Commit/Branch/Tag. Defaults to master.
Response
Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4999
{ "type": "file", "encoding": "base64", "_links": { "git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", "self": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md", "html": "https://github.com/octokit/octokit.rb/blob/master/README.md" }, "size": 5362, "name": "README.md", "path": "README.md", "content": "encoded content ...", "sha": "3d21ec53a331a6f037a91c368710b99387d012c1" }
object
get(
string $owner,
string $repo,
string $path,
string $ref = '')
Get contents
This method returns the contents of any file or directory in a repository.
GET /repos/:owner/:repo/contents/:path
Parameters
path Optional string - The content path. ref Optional string - The String name of the Commit/Branch/Tag. Defaults to master.
Response
Status: 200 OK X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4999
{ "type": "file", "encoding": "base64", "_links": { "git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", "self": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md", "html": "https://github.com/octokit/octokit.rb/blob/master/README.md" }, "size": 5362, "name": "README.md", "path": "README.md", "content": "encoded content ...", "sha": "3d21ec53a331a6f037a91c368710b99387d012c1" }
object
getArchiveLink(
string $owner,
string $repo,
string $archive_format = 'zipball',
string $ref = '')
Get archive link
This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request.
Note: For private repositories, these links are temporary and expire quickly.
GET /repos/:owner/:repo/:archive_format/:ref
Parameters
archive_format Either tarball or zipball ref Optional string - valid Git reference, defaults to master
Response
Status: 302 Found Location: http://github.com/me/myprivate/tarball/master?SSO=thistokenexpires X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4999
To follow redirects with curl, use the -L switch:
curl -L https://api.github.com/repos/octokit/octokit.rb/tarball > octokit.tar.gz