class Github_Api_Object in Bibliography Module 7.2
Getting full versions of specific files and trees in your Git repositories.
@link http://develop.github.com/p/object.html @author Thibault Duplessis <thibault.duplessis at gmail dot com> @license MIT License
Hierarchy
- class \Github_Api implements Github_ApiInterface
- class \Github_Api_Object
Expanded class hierarchy of Github_Api_Object
File
- modules/
CiteProc/ Github/ Api/ Object.php, line 10
View source
class Github_Api_Object extends Github_Api {
/**
* Get a listing of the root tree of a project by the username, repo, and tree SHA
* http://develop.github.com/p/object.html#trees
*
* @param string $username the username
* @param string $repo the repo
* @param string $treeSHA the tree sha
* @return array root tree of the project
*/
public function showTree($username, $repo, $treeSHA) {
$response = $this
->get('tree/show/' . urlencode($username) . '/' . urlencode($repo) . '/' . urlencode($treeSHA));
return $response['tree'];
}
/**
* Lists the data blobs of a tree by tree SHA
* http://develop.github.com/p/object.html#blobs
*
* @param string $username the username
* @param string $repo the repo
* @param string $treeSHA the tree sha
* @param string $path the path
* @return array data blobs of tree
*/
public function listBlobs($username, $repo, $treeSHA) {
$response = $this
->get('blob/all/' . urlencode($username) . '/' . urlencode($repo) . '/' . urlencode($treeSHA));
return $response['blobs'];
}
/**
* Get the data about a blob by tree SHA and file path.
* http://develop.github.com/p/object.html#blobs
*
* @param string $username the username
* @param string $repo the repo
* @param string $treeSHA the tree sha
* @param string $path the path
* @return array data blob of tree and path
*/
public function showBlob($username, $repo, $treeSHA, $path) {
$response = $this
->get('blob/show/' . urlencode($username) . '/' . urlencode($repo) . '/' . urlencode($treeSHA) . '/' . urlencode($path));
return $response['blob'];
}
/**
* Returns the raw text content of the object.
* http://develop.github.com/p/object.html#raw_git_data
*
* @param string $username the username
* @param string $repo the repo
* @param string $objectSHA the object sha can be either a blob SHA1, a tree SHA1 or a commit SHA1
* @return string raw text content of the blob, tree or commit object
*/
public function getRawData($username, $repo, $objectSHA) {
$response = $this
->get('blob/show/' . urlencode($username) . '/' . urlencode($repo) . '/' . urlencode($objectSHA), array(), array(
'format' => 'text',
));
return $response;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Github_Api:: |
private | property | The client | |
Github_Api:: |
protected | function | Call any path, GET method Ex: $api->get('repos/show/my-username/my-repo') | |
Github_Api:: |
protected | function | Call any path, POST method Ex: $api->post('repos/show/my-username', array('email' => 'my-new-email@provider.org')) | |
Github_Api:: |
public | function | ||
Github_Api_Object:: |
public | function | Returns the raw text content of the object. http://develop.github.com/p/object.html#raw_git_data | |
Github_Api_Object:: |
public | function | Lists the data blobs of a tree by tree SHA http://develop.github.com/p/object.html#blobs | |
Github_Api_Object:: |
public | function | Get the data about a blob by tree SHA and file path. http://develop.github.com/p/object.html#blobs | |
Github_Api_Object:: |
public | function | Get a listing of the root tree of a project by the username, repo, and tree SHA http://develop.github.com/p/object.html#trees |