2024-04-25 08:03:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace OCA\AppTemplate\Controller;
|
|
|
|
|
|
|
|
use OCP\AppFramework\Http;
|
|
|
|
use OCP\AppFramework\Http\Attribute\ApiRoute;
|
|
|
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
|
|
|
use OCP\AppFramework\Http\DataResponse;
|
|
|
|
use OCP\AppFramework\OCSController;
|
|
|
|
|
2024-11-10 16:07:56 +00:00
|
|
|
class ApiController extends OCSController
|
|
|
|
{
|
2024-04-25 08:03:54 +00:00
|
|
|
/**
|
2024-11-10 16:07:56 +00:00
|
|
|
* An example API endpoint.
|
2024-04-25 08:03:54 +00:00
|
|
|
*
|
|
|
|
* @return DataResponse<Http::STATUS_OK, array{message: string}, array{}>
|
|
|
|
*
|
|
|
|
* 200: Data returned
|
|
|
|
*/
|
|
|
|
#[NoAdminRequired]
|
|
|
|
#[ApiRoute(verb: 'GET', url: '/api')]
|
|
|
|
public function index(): DataResponse {
|
|
|
|
return new DataResponse(
|
|
|
|
['message' => 'Hello world!']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|