Source for file issues.php
Documentation is available at issues.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* GitHub API Issues class for the Joomla Platform.
* @package Joomla.Platform
* Method to create an issue.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $title The title of the new issue.
* @param string $body The body text for the new issue.
* @param string $assignee The login for the GitHub user that this issue should be assigned to.
* @param integer $milestone The milestone to associate this issue with.
* @param array $labels The labels to associate with this issue.
public function create($user, $repo, $title, $body =
null, $assignee =
null, $milestone =
null, array $labels =
null)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/issues';
// Ensure that we have a non-associative array.
// Build the request data.
'milestone' =>
$milestone,
// Validate the response code.
if ($response->code !=
201)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to create a comment on an issue.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $issueId The issue number.
* @param string $body The comment body text.
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/issues/' . (int)
$issueId .
'/comments';
// Build the request data.
// Validate the response code.
if ($response->code !=
201)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to create a label on a 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.
* @param string $color The label color.
public function createLabel($user, $repo, $name, $color)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/labels';
// Build the request data.
// Validate the response code.
if ($response->code !=
201)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to delete a comment on an issue.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $commentId The id of the comment to delete.
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/issues/comments/' . (int)
$commentId;
// Validate the response code.
if ($response->code !=
204)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to delete a label on a repo.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $label The label name.
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/labels/' .
$label;
// Validate the response code.
if ($response->code !=
204)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to update an issue.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $issueId The issue number.
* @param string $state The optional new state for the issue. [open, closed]
* @param string $title The title of the new issue.
* @param string $body The body text for the new issue.
* @param string $assignee The login for the GitHub user that this issue should be assigned to.
* @param integer $milestone The milestone to associate this issue with.
* @param array $labels The labels to associate with this issue.
public function edit($user, $repo, $issueId, $state =
null, $title =
null, $body =
null, $assignee =
null, $milestone =
null, array $labels =
null)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/issues/' . (int)
$issueId;
// Craete the data object.
// If a title is set add it to the data object.
// If a body is set add it to the data object.
// If a state is set add it to the data object.
// If an assignee is set add it to the data object.
$data->assignee =
$assignee;
// If a milestone is set add it to the data object.
$data->milestone =
$milestone;
// If labels are set add them to the data object.
// Ensure that we have a non-associative array.
// Encode the request data.
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to update a comment on an issue.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $commentId The id of the comment to update.
* @param string $body The new body text for the comment.
public function editComment($user, $repo, $commentId, $body)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/issues/comments/' . (int)
$commentId;
// Build the request data.
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to update a label on a repo.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $label The label name.
* @param string $name The label name.
* @param string $color The label color.
public function editLabel($user, $repo, $label, $name, $color)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/labels/' .
$label;
// Build the request data.
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to get a single issue.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $issueId The issue number.
public function get($user, $repo, $issueId)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/issues/' . (int)
$issueId;
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to get a specific comment on an issue.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $commentId The comment id to get.
public function getComment($user, $repo, $commentId)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/issues/comments/' . (int)
$commentId;
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to get the list of comments on an issue.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $issueId The issue number.
* @param integer $page The page number from which to get items.
* @param integer $limit The number of items on a page.
public function getComments($user, $repo, $issueId, $page =
0, $limit =
0)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/issues/' . (int)
$issueId .
'/comments';
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to get a specific label on a 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.
public function getLabel($user, $repo, $name)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/labels/' .
$name;
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to get the list of labels on a repo.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/labels';
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to list an authenticated user's issues.
* @param string $filter The filter type: assigned, created, mentioned, subscribed.
* @param string $state The optional state to filter requests by. [open, closed]
* @param string $labels The list of comma separated Label names. Example: bug,ui,@high.
* @param string $sort The sort order: created, updated, comments, default: created.
* @param string $direction The list direction: asc or desc, default: desc.
* @param JDate $since The date/time since when issues should be returned.
* @param integer $page The page number from which to get items.
* @param integer $limit The number of items on a page.
public function getList($filter =
null, $state =
null, $labels =
null, $sort =
null, $direction =
null, JDate $since =
null, $page =
0, $limit =
0)
// Build the request path.
// TODO Implement the filtering options.
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param string $milestone The milestone number, 'none', or *.
* @param string $state The optional state to filter requests by. [open, closed]
* @param string $assignee The assignee name, 'none', or *.
* @param string $mentioned The GitHub user name.
* @param string $labels The list of comma separated Label names. Example: bug,ui,@high.
* @param string $sort The sort order: created, updated, comments, default: created.
* @param string $direction The list direction: asc or desc, default: desc.
* @param JDate $since The date/time since when issues should be returned.
* @param integer $page The page number from which to get items.
* @param integer $limit The number of items on a page.
public function getListByRepository($user, $repo, $milestone =
null, $state =
null, $assignee =
null, $mentioned =
null, $labels =
null,
$sort =
null, $direction =
null, JDate $since =
null, $page =
0, $limit =
0)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/issues';
$uri->setVar('milestone', $milestone);
$uri->setVar('state', $state);
$uri->setVar('assignee', $assignee);
$uri->setVar('mentioned', $mentioned);
$uri->setVar('labels', $labels);
$uri->setVar('sort', $sort);
$uri->setVar('direction', $direction);
$uri->setVar('since', $since->toISO8601());
$response =
$this->client->get((string)
$uri);
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
Documentation generated on Tue, 19 Nov 2013 15:05:52 +0100 by phpDocumentor 1.4.3