2017-03-19 02:30:36 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace JKingWeb\NewsSync\REST\NextCloudNews;
|
2017-03-20 01:50:00 +00:00
|
|
|
use JKingWeb\NewsSync\REST\Response;
|
2017-03-19 02:30:36 +00:00
|
|
|
|
|
|
|
class Versions implements \JKingWeb\NewsSync\REST\Handler {
|
|
|
|
function __construct(\JKingWeb\NewsSync\RuntimeData $data) {
|
|
|
|
}
|
|
|
|
|
|
|
|
function dispatch(\JKingWeb\NewsSync\REST\Request $req): \JKingWeb\NewsSync\REST\Response {
|
2017-03-20 01:50:00 +00:00
|
|
|
$path = $req->url;
|
|
|
|
$query = "";
|
|
|
|
if(strpos($path, "?") !== false) {
|
|
|
|
list($path, $query) = explode("?", $path);
|
|
|
|
}
|
|
|
|
if($req->method != "GET") {
|
|
|
|
return new Response(405);
|
|
|
|
}
|
|
|
|
if(preg_match("<^/?$>",$path)) {
|
2017-03-20 01:54:28 +00:00
|
|
|
$out = [
|
|
|
|
'apiLevels' => [
|
|
|
|
'v1-2'
|
|
|
|
]
|
|
|
|
];
|
|
|
|
return new Response(200, $out);
|
2017-03-20 01:50:00 +00:00
|
|
|
} else {
|
|
|
|
return new Response(404);
|
|
|
|
}
|
2017-03-19 02:30:36 +00:00
|
|
|
}
|
|
|
|
}
|