You are here

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

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

Namesort descending Modifiers Type Description Overrides
Github_Api::$client private property The client
Github_Api::get protected function Call any path, GET method Ex: $api->get('repos/show/my-username/my-repo')
Github_Api::post protected function Call any path, POST method Ex: $api->post('repos/show/my-username', array('email' => 'my-new-email@provider.org'))
Github_Api::__construct public function
Github_Api_Object::getRawData public function Returns the raw text content of the object. http://develop.github.com/p/object.html#raw_git_data
Github_Api_Object::listBlobs public function Lists the data blobs of a tree by tree SHA http://develop.github.com/p/object.html#blobs
Github_Api_Object::showBlob 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::showTree 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