feat(preset): Add list API

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2025-12-15 16:45:15 +01:00
parent 1d436cdd75
commit 0956c95116
No known key found for this signature in database
GPG key ID: F72FA5B49FFA96B0
2 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Talk\Controller;
use OCA\Talk\ResponseDefinitions;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\ApiRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\IRequest;
/**
* @psalm-import-type TalkConversationPreset from ResponseDefinitions
*/
class PresetController extends AEnvironmentAwareOCSController {
public function __construct(
string $appName,
IRequest $request,
) {
parent::__construct($appName, $request);
}
/**
* Get the list of available presets
*
* @return DataResponse<Http::STATUS_OK, list<TalkConversationPreset>, array{}>
*
* 200: Successfully got presets
*/
#[NoAdminRequired]
#[ApiRoute(verb: 'GET', url: '/api/{apiVersion}/preset', requirements: [
'apiVersion' => '(v1)',
'token' => '[a-z0-9]{4,30}',
])]
public function getPresets(): DataResponse {
return new DataResponse([], Http::STATUS_OK);
}
}

View file

@ -580,6 +580,13 @@ namespace OCA\Talk;
* sendAt: int,
* silent: bool,
* }
*
* @psalm-type TalkConversationPreset = {
* // Identifier of the preset, currently known: default, webinar, presentation, hallway
* id: string,
* // Translated name of the preset in user's language
* name: string,
* }
*/
class ResponseDefinitions {
}