You are here

class Github_Api_Commit in Bibliography Module 7.2

Getting information on specific commits, the diffs they introduce, the files they've changed.

@link http://develop.github.com/p/commits.html @author Thibault Duplessis <thibault.duplessis at gmail dot com> @license MIT License

Hierarchy

Expanded class hierarchy of Github_Api_Commit

File

modules/CiteProc/Github/Api/Commit.php, line 11

View source
class Github_Api_Commit extends Github_Api {

  /**
   * List commits by username, repo and branch
   * http://develop.github.com/p/commits.html#listing_commits_on_a_branch
   *
   * @param   string  $username         the username
   * @param   string  $repo             the repo
   * @param   string  $branch           the branch
   * @return  array                     list of users found
   */
  public function getBranchCommits($username, $repo, $branch) {
    $response = $this
      ->get('commits/list/' . urlencode($username) . '/' . urlencode($repo) . '/' . urlencode($branch));
    return $response['commits'];
  }

  /**
   * List commits by username, repo, branch and path
   * http://develop.github.com/p/commits.html#listing_commits_for_a_file
   *
   * @param   string  $username         the username
   * @param   string  $repo             the repo
   * @param   string  $branch           the branch
   * @param   string  $path             the path
   * @return  array                     list of users found
   */
  public function getFileCommits($username, $repo, $branch, $path) {
    $response = $this
      ->get('commits/list/' . urlencode($username) . '/' . urlencode($repo) . '/' . urlencode($branch) . '/' . urlencode($path));
    return $response['commits'];
  }

  /**
   * Show a specific commit
   * http://develop.github.com/p/commits.html#showing_a_specific_commit
   *
   * @param   string  $username         the username
   * @param   string  $repo             the repo
   * @param   string  $sha              the commit sha
   */
  public function getCommit($username, $repo, $sha) {
    $response = $this
      ->get('commits/show/' . urlencode($username) . '/' . urlencode($repo) . '/' . urlencode($sha));
    return $response['commit'];
  }

}

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_Commit::getBranchCommits public function List commits by username, repo and branch http://develop.github.com/p/commits.html#listing_commits_on_a_branch
Github_Api_Commit::getCommit public function Show a specific commit http://develop.github.com/p/commits.html#showing_a_specific_commit
Github_Api_Commit::getFileCommits public function List commits by username, repo, branch and path http://develop.github.com/p/commits.html#listing_commits_for_a_file