repod/lib/Controller/ToplistController.php

48 lines
1.2 KiB
PHP
Raw Normal View History

2023-07-03 00:12:40 +02:00
<?php
declare(strict_types=1);
namespace OCA\RePod\Controller;
use OCA\GPodderSync\Core\PodcastData\PodcastData;
2023-07-03 00:12:40 +02:00
use OCA\RePod\AppInfo\Application;
2023-07-28 02:37:57 +02:00
use OCA\RePod\Service\FyydService;
2023-07-03 00:12:40 +02:00
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
2023-07-03 00:12:40 +02:00
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\Response;
2023-07-03 00:12:40 +02:00
use OCP\IRequest;
class ToplistController extends Controller
2023-07-03 00:12:40 +02:00
{
2023-07-03 00:52:14 +02:00
public function __construct(
IRequest $request,
2024-11-12 10:11:21 +01:00
private readonly FyydService $fyydService
2023-07-03 00:52:14 +02:00
) {
2023-07-03 00:12:40 +02:00
parent::__construct(Application::APP_ID, $request);
}
/**
* @return JSONResponse<Http::STATUS_OK, PodcastData[], array{}>
*/
#[NoAdminRequired]
#[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/toplist/hot')]
public function hot(): Response {
2023-12-24 16:59:34 +01:00
return new JSONResponse($this->fyydService->hot());
2023-07-03 00:12:40 +02:00
}
2024-01-10 17:50:06 +01:00
/**
* @return JSONResponse<Http::STATUS_OK, PodcastData[], array{}>
*/
#[NoAdminRequired]
#[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/toplist/new')]
public function new(): Response {
2024-01-10 17:50:06 +01:00
return new JSONResponse($this->fyydService->latest());
}
2023-07-03 00:12:40 +02:00
}