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

View File

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