Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JGithubPulls
+ Graphe d'héritage de JGithubPulls:
+ Graphe de collaboration de JGithubPulls:

Liste de tous les membres

Fonctions membres publiques

 create ($user, $repo, $title, $base, $head, $body= '')
 createComment ($user, $repo, $pullId, $body, $commitId, $filePath, $position)
 createCommentReply ($user, $repo, $pullId, $body, $inReplyTo)
 createFromIssue ($user, $repo, $issueId, $base, $head)
 deleteComment ($user, $repo, $commentId)
 edit ($user, $repo, $pullId, $title=null, $body=null, $state=null)
 editComment ($user, $repo, $commentId, $body)
 get ($user, $repo, $pullId)
 getComment ($user, $repo, $commentId)
 getComments ($user, $repo, $pullId, $page=0, $limit=0)
 getCommits ($user, $repo, $pullId, $page=0, $limit=0)
 getFiles ($user, $repo, $pullId, $page=0, $limit=0)
 getList ($user, $repo, $state= 'open', $page=0, $limit=0)
 isMerged ($user, $repo, $pullId)
 merge ($user, $repo, $pullId, $message= '')
- Fonctions membres publiques inherited from JGithubObject
 __construct (JRegistry $options=null, JGithubHttp $client=null)

Additional Inherited Members

- Fonctions membres protégées inherited from JGithubObject
 fetchUrl ($path, $page=0, $limit=0)
 processResponse (JHttpResponse $response, $expectedCode=200)
- Attributs protégés inherited from JGithubObject
 $options
 $client

Description détaillée

Définition à la ligne 19 du fichier pulls.php.


Documentation des fonctions membres

JGithubPulls::create (   $user,
  $repo,
  $title,
  $base,
  $head,
  $body = '' 
)

Method to create a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
string$titleThe title of the new pull request.
string$baseThe branch (or git ref) you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repo that requests a merge to a base of another repo.
string$headThe branch (or git ref) where your changes are implemented.
string$bodyThe body text for the new pull request.
Renvoie:
object
Depuis:
11.3

Définition à la ligne 38 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls';
// Build the request data.
$data = json_encode(
array(
'title' => $title,
'base' => $base,
'head' => $head,
'body' => $body
)
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
// Validate the response code.
if ($response->code != 201)
{
// 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);
}
JGithubPulls::createComment (   $user,
  $repo,
  $pullId,
  $body,
  $commitId,
  $filePath,
  $position 
)

Method to create a comment on a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$pullIdThe pull request number.
string$bodyThe comment body text.
string$commitIdThe SHA1 hash of the commit to comment on.
string$filePathThe Relative path of the file to comment on.
string$positionThe line index in the diff to comment on.
Renvoie:
object
Depuis:
11.3

Définition à la ligne 82 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/' . (int) $pullId . '/comments';
// Build the request data.
$data = json_encode(
array(
'body' => $body,
'commit_id' => $commitId,
'path' => $filePath,
'position' => $position
)
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
// Validate the response code.
if ($response->code != 201)
{
// 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);
}
JGithubPulls::createCommentReply (   $user,
  $repo,
  $pullId,
  $body,
  $inReplyTo 
)

Method to create a comment in reply to another comment.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$pullIdThe pull request number.
string$bodyThe comment body text.
integer$inReplyToThe id of the comment to reply to.
Renvoie:
object
Depuis:
11.3

Définition à la ligne 124 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/' . (int) $pullId . '/comments';
// Build the request data.
$data = json_encode(
array(
'body' => $body,
'in_reply_to' => (int) $inReplyTo
)
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
// Validate the response code.
if ($response->code != 201)
{
// 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);
}
JGithubPulls::createFromIssue (   $user,
  $repo,
  $issueId,
  $base,
  $head 
)

Method to create a pull request from an existing issue.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$issueIdThe issue number for which to attach the new pull request.
string$baseThe branch (or git ref) you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repo that requests a merge to a base of another repo.
string$headThe branch (or git ref) where your changes are implemented.
Renvoie:
object
Depuis:
11.3

Définition à la ligne 167 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls';
// Build the request data.
$data = json_encode(
array(
'issue' => (int) $issueId,
'base' => $base,
'head' => $head
)
);
// Send the request.
$response = $this->client->post($this->fetchUrl($path), $data);
// Validate the response code.
if ($response->code != 201)
{
// 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);
}
JGithubPulls::deleteComment (   $user,
  $repo,
  $commentId 
)

Method to delete a comment on a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$commentIdThe id of the comment to delete.
Renvoie:
void
Depuis:
11.3

Définition à la ligne 206 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/comments/' . (int) $commentId;
// Send the request.
$response = $this->client->delete($this->fetchUrl($path));
// Validate the response code.
if ($response->code != 204)
{
// Decode the error response and throw an exception.
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
}
JGithubPulls::edit (   $user,
  $repo,
  $pullId,
  $title = null,
  $body = null,
  $state = null 
)

Method to update a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$pullIdThe pull request number.
string$titleThe optional new title for the pull request.
string$bodyThe optional new body text for the pull request.
string$stateThe optional new state for the pull request. [open, closed]
Renvoie:
object
Depuis:
11.3

Définition à la ligne 237 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/' . (int) $pullId;
// Craete the data object.
$data = new stdClass;
// If a title is set add it to the data object.
if (isset($title))
{
$data->title = $title;
}
// If a body is set add it to the data object.
if (isset($body))
{
$data->body = $body;
}
// If a state is set add it to the data object.
if (isset($state))
{
$data->state = $state;
}
// Encode the request data.
$data = json_encode($data);
// Send the request.
$response = $this->client->patch($this->fetchUrl($path), $data);
// 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);
}
JGithubPulls::editComment (   $user,
  $repo,
  $commentId,
  $body 
)

Method to update a comment on a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$commentIdThe id of the comment to update.
string$bodyThe new body text for the comment.
Renvoie:
object
Depuis:
11.3

Définition à la ligne 292 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/comments/' . (int) $commentId;
// Build the request data.
$data = json_encode(
array(
'body' => $body
)
);
// Send the request.
$response = $this->client->patch($this->fetchUrl($path), $data);
// 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);
}
JGithubPulls::get (   $user,
  $repo,
  $pullId 
)

Method to get a single pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$pullIdThe pull request number.
Renvoie:
object
Depuis:
11.3

Définition à la ligne 329 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/' . (int) $pullId;
// 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);
}
JGithubPulls::getComment (   $user,
  $repo,
  $commentId 
)

Method to get a specific comment on a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$commentIdThe comment id to get.
Renvoie:
object
Depuis:
11.3

Définition à la ligne 359 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/comments/' . (int) $commentId;
// 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);
}
JGithubPulls::getComments (   $user,
  $repo,
  $pullId,
  $page = 0,
  $limit = 0 
)

Method to get the list of comments on a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$pullIdThe pull request number.
integer$pageThe page number from which to get items.
integer$limitThe number of items on a page.
Renvoie:
array
Depuis:
11.3

Définition à la ligne 391 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/' . (int) $pullId . '/comments';
// Send the request.
$response = $this->client->get($this->fetchUrl($path, $page, $limit));
// 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);
}
JGithubPulls::getCommits (   $user,
  $repo,
  $pullId,
  $page = 0,
  $limit = 0 
)

Method to get a list of commits for a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$pullIdThe pull request number.
integer$pageThe page number from which to get items.
integer$limitThe number of items on a page.
Renvoie:
array
Depuis:
11.3

Définition à la ligne 423 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/' . (int) $pullId . '/commits';
// Send the request.
$response = $this->client->get($this->fetchUrl($path, $page, $limit));
// 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);
}
JGithubPulls::getFiles (   $user,
  $repo,
  $pullId,
  $page = 0,
  $limit = 0 
)

Method to get a list of files for a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$pullIdThe pull request number.
integer$pageThe page number from which to get items.
integer$limitThe number of items on a page.
Renvoie:
array
Depuis:
11.3

Définition à la ligne 455 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/' . (int) $pullId . '/files';
// Send the request.
$response = $this->client->get($this->fetchUrl($path, $page, $limit));
// 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);
}
JGithubPulls::getList (   $user,
  $repo,
  $state = 'open',
  $page = 0,
  $limit = 0 
)

Method to list pull requests.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
string$stateThe optional state to filter requests by. [open, closed]
integer$pageThe page number from which to get items.
integer$limitThe number of items on a page.
Renvoie:
array
Depuis:
11.3

Définition à la ligne 487 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls';
// If a state exists append it as an option.
if ($state != 'open')
{
$path .= '?state=' . $state;
}
// Send the request.
$response = $this->client->get($this->fetchUrl($path, $page, $limit));
// 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);
}
JGithubPulls::isMerged (   $user,
  $repo,
  $pullId 
)

Method to check if a pull request has been merged.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$pullIdThe pull request number. The pull request number.
Renvoie:
boolean True if the pull request has been merged.
Depuis:
11.3

Définition à la ligne 523 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/' . (int) $pullId . '/merge';
// Send the request.
$response = $this->client->get($this->fetchUrl($path));
// Validate the response code.
if ($response->code == 204)
{
return true;
}
elseif ($response->code == 404)
{
return false;
}
else
{
// Decode the error response and throw an exception.
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
}
JGithubPulls::merge (   $user,
  $repo,
  $pullId,
  $message = '' 
)

Method to merge a pull request.

Paramètres:
string$userThe name of the owner of the GitHub repository.
string$repoThe name of the GitHub repository.
integer$pullIdThe pull request number.
string$messageThe message that will be used for the merge commit.
Renvoie:
object
Depuis:
11.3

Définition à la ligne 560 du fichier pulls.php.

{
// Build the request path.
$path = '/repos/' . $user . '/' . $repo . '/pulls/' . (int) $pullId . '/merge';
// Build the request data.
$data = json_encode(
array(
'commit_message' => $message
)
);
// Send the request.
$response = $this->client->put($this->fetchUrl($path), $data);
// 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);
}

La documentation de cette classe a été générée à partir du fichier suivant :