fix #601 add consistency, add type key, rename install_name -> name

This commit is contained in:
Nicolas Le Goff
2012-04-26 19:08:08 +02:00
parent bd65aff49a
commit 3f81b4a7f4
2 changed files with 22 additions and 19 deletions

View File

@@ -30,32 +30,35 @@ return call_user_func(function() {
$app["appbox"] = \appbox::get_instance($app['Core']);
$app->get(
'/', function() use ($app) {
'/', function(Request $request) use ($app) {
$registry = $app["Core"]->getRegistry();
$apiAdapter = new \API_V1_adapter(false, $app["appbox"], $app["Core"]);
$versionNumber = (float) \Alchemy\Phrasea\Core\Version::getNumber();
$ret = array(
'install_name' => $registry->get('GV_homeTitle'),
'description' => $registry->get('GV_metaDescription'),
'documentation' => 'https://docs.phraseanet.com/Devel',
'versions' => array(
'1' => array(
'number' => $apiAdapter->get_version(),
'uri' => '/api/v1/',
'authenticationProtocol' => 'OAuth2',
'authenticationVersion' => 'draft#v9',
'authenticationEndPoints' => array(
'authorization_token' => '/api/oauthv2/authorize',
'access_token' => '/api/oauthv2/token'
$result = new \API_V1_result($request, $apiAdapter);
$result->set_datas(
array(
'name' => $registry->get('GV_homeTitle'),
'type' => 'phraseanet',
'description' => $registry->get('GV_metaDescription'),
'documentation' => 'https://docs.phraseanet.com/Devel',
'versions' => array(
'1' => array(
'number' => $apiAdapter->get_version(),
'uri' => '/api/v1/',
'authenticationProtocol' => 'OAuth2',
'authenticationVersion' => 'draft#v9',
'authenticationEndPoints' => array(
'authorization_token' => '/api/oauthv2/authorize',
'access_token' => '/api/oauthv2/token'
)
)
)
)
);
$json = $app["Core"]['Serializer']->serialize($ret, 'json');
return new Response($json, 200, array('content-type' => 'application/json'));
return $result->get_response();
});
return $app;

View File

@@ -24,7 +24,7 @@ class API_V1_adapter extends API_V1_Abstract
*
* @var string
*/
protected $version = '1.1';
protected $version = '1.2';
/**
* Appbox where the API works