Class HawkApi
This class treats the interface with the Hawk site, to get the informations from the site database via an Restful API
Methods summary
public
array
|
|
public
string
|
|
public
array
|
|
public
string
|
|
public
array
|
|
public
array
|
|
public
string
|
|
public
array
|
|
public
array
|
#
getAllAvailableUpdates( array $plugins, array $themes )
Get all available updates on Hawk, plugins and themes |
Constants summary
string |
VERSION_PATTERN
The pattern for a plugin / theme version |
#
'/^(\d{1,2}\.){2,3}\d{1,2}$/'
|
string |
VERSION_PATTERN_URI
The pattern for a plugin or theme version, in a URI |
#
'(?:\d{1,2}\.){2,3}\d{1,2}'
|
Properties summary
public static
array
|
$routes
The callable routes on the API, with their parameters |
#
array(
// Search plugins
'api-search-plugins' => array(
'method' => 'get',
'uri' => '/plugins/search',
'where' => array(
'params' => array(
'search' => array(
'required' => true,
)
)
)
),
// Install a plugin
'api-install-plugin' => array(
'method' => 'get',
'uri' => '/plugins/{name}/install',
'where' => array(
'path' => array(
'name' => Plugin::NAME_PATTERN
)
),
'dataType' => 'application/octet-stream'
),
// Get the available updates on plugins
'api-plugins-available-updates' => array(
'method' => 'get',
'uri' => '/plugins/available-updates',
'where' => array(
'params' => array(
'plugins' => array(
'required' => true,
)
)
)
),
// Search themes
'api-search-themes' => array(
'method' => 'get',
'uri' => '/themes/search',
'where' => array(
'params' => array(
'search' => array(
'required' => true,
)
)
)
),
// Install a theme
'api-install-theme' => array(
'method' => 'get',
'uri' => '/themes/{name}/install',
'where' => array(
'path' => array(
'name' => Theme::NAME_PATTERN
)
),
'dataType' => 'application/octet-stream'
),
// Get the available updates on themes
'api-themes-available-updates' => array(
'method' => 'get',
'uri' => '/themes/available-updates',
'where' => array(
'params' => array(
'themes' => array(
'required' => true,
)
)
)
),
// Search for available updates on the core
'api-core-available-updates' => array(
'method' => 'get',
'uri' => '/hawk/updates',
'where' => array(
'params' => array(
'version' => array(
'required' => true,
'pattern' => self::VERSION_PATTERN
)
)
)
),
// Update Hawk
'api-core-update' => array(
'method' => 'get',
'uri' => '/hawk/update/{to}',
'where' => array(
'path' => array(
'to' => self::VERSION_PATTERN_URI
)
),
'dataType' => 'application/octet-stream'
),
// Search for updates on Hawk, plugins and theme in one request
'api-all-updates' => array(
'method' => 'post',
'uri' => '/updates',
'where' => array(
'body' => array(
'hawk' => array(
'required' => true,
'pattern' => self::VERSION_PATTERN
),
'plugins' => array(
'required' => true
),
'themes' => array(
'required' => true
)
)
)
)
)
|