1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-15 13:45:04 -05:00

[add] routes for archives and mark as unread

This commit is contained in:
Nicolas Lœuillet 2014-01-09 22:09:00 +01:00
parent 56bffbba73
commit 74e70939db
2 changed files with 27 additions and 3 deletions

View File

@ -14,11 +14,10 @@ $api->before(function (Request $request) {
$api->get('/', function () { return 'API home page'; });
$api->get('/entries', function () use ($app) {
$entries = $app['entry_api']->getEntries();
$entries = $app['entry_api']->getEntries('unread');
return $app->json($entries, 200);
});
$api->post('/entries', function (Request $request) use ($app) {
$url = $request->request->get('url');
@ -27,6 +26,11 @@ $api->post('/entries', function (Request $request) use ($app) {
return $app->json($entry, 201);
});
$api->get('/archives', function () use ($app) {
$entries = $app['entry_api']->getEntries('read');
return $app->json($entries, 200);
});
$api->get('/get', function (Request $request) use ($app) {
$id = $request->request->get('id');
@ -43,4 +47,12 @@ $api->get('/mark-read', function (Request $request) use ($app) {
return $app->json($entry, 201);
});
$api->get('/mark-unread', function (Request $request) use ($app) {
$id = $request->request->get('id');
$entry = $app['entry_api']->markAsUnread($id);
return $app->json($entry, 201);
});
return $api;

View File

@ -23,10 +23,22 @@ $front->get('/mark-read/{id}', function (Request $request, $id) use ($app) {
$entry = $app['entry_api']->markAsRead($id);
return $app->redirect('/view/' . $id);
$referer = $request->headers->get('referer');
return $app->redirect($referer);
})
->bind('mark_entry_read');
$front->get('/mark-unread/{id}', function (Request $request, $id) use ($app) {
$entry = $app['entry_api']->markAsUnread($id);
$referer = $request->headers->get('referer');
return $app->redirect($referer);
})
->bind('mark_entry_unread');
$front->match('/add', function (Request $request) use ($app) {
$data = array('url');