Skip to content

Commit 0956c95

Browse files
committed
feat(preset): Add list API
Signed-off-by: Joas Schilling <[email protected]>
1 parent 1d436cd commit 0956c95

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\Talk\Controller;
11+
12+
use OCA\Talk\ResponseDefinitions;
13+
use OCP\AppFramework\Http;
14+
use OCP\AppFramework\Http\Attribute\ApiRoute;
15+
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
16+
use OCP\AppFramework\Http\DataResponse;
17+
use OCP\IRequest;
18+
19+
/**
20+
* @psalm-import-type TalkConversationPreset from ResponseDefinitions
21+
*/
22+
class PresetController extends AEnvironmentAwareOCSController {
23+
24+
public function __construct(
25+
string $appName,
26+
IRequest $request,
27+
) {
28+
parent::__construct($appName, $request);
29+
}
30+
31+
/**
32+
* Get the list of available presets
33+
*
34+
* @return DataResponse<Http::STATUS_OK, list<TalkConversationPreset>, array{}>
35+
*
36+
* 200: Successfully got presets
37+
*/
38+
#[NoAdminRequired]
39+
#[ApiRoute(verb: 'GET', url: '/api/{apiVersion}/preset', requirements: [
40+
'apiVersion' => '(v1)',
41+
'token' => '[a-z0-9]{4,30}',
42+
])]
43+
public function getPresets(): DataResponse {
44+
return new DataResponse([], Http::STATUS_OK);
45+
}
46+
}

lib/ResponseDefinitions.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,13 @@
580580
* sendAt: int,
581581
* silent: bool,
582582
* }
583+
*
584+
* @psalm-type TalkConversationPreset = {
585+
* // Identifier of the preset, currently known: default, webinar, presentation, hallway
586+
* id: string,
587+
* // Translated name of the preset in user's language
588+
* name: string,
589+
* }
583590
*/
584591
class ResponseDefinitions {
585592
}

0 commit comments

Comments
 (0)