Source for file hooks.php
Documentation is available at hooks.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 Hooks class for the Joomla Platform.
* @package Joomla.Platform
* Array containing the allowed hook events
'push', 'issues', 'issue_comment', 'commit_comment', 'pull_request', 'gollum', 'watch', 'download', 'fork', 'fork_apply',
'member', 'public', 'status'
* Method to create a hook on a repository.
* @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 name of the service being called.
* @param array $config Array containing the config for the service.
* @param array $events The events the hook will be triggered for.
* @param boolean $active Flag to determine if the hook is active
* @throws DomainException
* @throws RuntimeException
public function create($user, $repo, $name, array $config, array $events =
array('push'), $active =
true)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/hooks';
// Check to ensure all events are in the allowed list
foreach ($events as $event)
throw
new RuntimeException('Your events array contains an unauthorized event.');
array('name' =>
$name, 'config' =>
$config, 'events' =>
$events, 'active' =>
$active)
* Method to delete a hook
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $id ID of the hook to delete.
* @throws DomainException
public function delete($user, $repo, $id)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/hooks/' .
$id;
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $id ID of the hook to edit.
* @param string $name The name of the service being called.
* @param array $config Array containing the config for the service.
* @param array $events The events the hook will be triggered for. This resets the currently set list
* @param array $addEvents Events to add to the hook.
* @param array $removeEvents Events to remove from the hook.
* @param boolean $active Flag to determine if the hook is active
* @throws DomainException
* @throws RuntimeException
public function edit($user, $repo, $id, $name, array $config, array $events =
array('push'), array $addEvents =
array(),
array $removeEvents =
array(), $active =
true)
// Check to ensure all events are in the allowed list
foreach ($events as $event)
throw
new RuntimeException('Your events array contains an unauthorized event.');
foreach ($addEvents as $event)
throw
new RuntimeException('Your active_events array contains an unauthorized event.');
foreach ($removeEvents as $event)
throw
new RuntimeException('Your remove_events array contains an unauthorized event.');
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/hooks/' .
$id;
'add_events' =>
$addEvents,
'remove_events' =>
$removeEvents,
* Method to get details about a single hook for the repository.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $id ID of the hook to retrieve
* @throws DomainException
public function get($user, $repo, $id)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/hooks/' .
$id;
* Method to list hooks for a repository.
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $page Page to request
* @param integer $limit Number of results to return per page
* @throws DomainException
public function getList($user, $repo, $page =
0, $limit =
0)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/hooks';
* Method to test a hook against the latest repository commit
* @param string $user The name of the owner of the GitHub repository.
* @param string $repo The name of the GitHub repository.
* @param integer $id ID of the hook to delete
* @throws DomainException
public function test($user, $repo, $id)
// Build the request path.
$path =
'/repos/' .
$user .
'/' .
$repo .
'/hooks/' .
$id .
'/test';
Documentation generated on Tue, 19 Nov 2013 15:04:44 +0100 by phpDocumentor 1.4.3