<?php declare(strict_types=1); namespace OCA\RePod\Controller; use OCA\GPodderSync\Core\PodcastData\PodcastData; use OCA\RePod\AppInfo\Application; use OCA\RePod\Service\FyydService; 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; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\Response; use OCP\IRequest; class ToplistController extends Controller { public function __construct( IRequest $request, private readonly FyydService $fyydService ) { 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 { return new JSONResponse($this->fyydService->hot()); } /** * @return JSONResponse<Http::STATUS_OK, PodcastData[], array{}> */ #[NoAdminRequired] #[NoCSRFRequired] #[FrontpageRoute(verb: 'GET', url: '/toplist/new')] public function new(): Response { return new JSONResponse($this->fyydService->latest()); } }