Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Commit

Permalink
Created two methods to get labels ina repo
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Apr 5, 2012
1 parent 63ef7e7 commit 0662bc1
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions libraries/joomla/github/issues.php
Expand Up @@ -349,6 +349,65 @@ public function getComments($user, $repo, $issueId, $page = 0, $limit = 0)
return json_decode($response->body);
}

/**
* Method to get a specific label on an repo.
*
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $name The label name to get.
*
* @return object
*
* @since 12.1
*/
public function getLabel($user, $repo, $name)
{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/labels/' . $name;

// Send the request.
$response = $this->client->get($this->fetchUrl($path));

// Validate the response code.
if ($response->code != 200)
{
// Decode the error response and throw an exception.
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}

return json_decode($response->body);
}

/**
* Method to get the list of labels on an issue.
*
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
*
* @return array
*
* @since 12.1
*/
public function getLabels($user, $repo)
{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/labels/';

// Send the request.
$response = $this->client->get($this->fetchUrl($path));

// Validate the response code.
if ($response->code != 200)
{
// Decode the error response and throw an exception.
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}

return json_decode($response->body);
}

/**
* Method to list an authenticated user's issues.
*
Expand Down

0 comments on commit 0662bc1

Please sign in to comment.