Skip to content

Commit c83d384

Browse files
committed
fix(openapi): Reorganize openapi specs
Signed-off-by: Joas Schilling <[email protected]>
1 parent 326aaa1 commit c83d384

13 files changed

+43
-17
lines changed

lib/Controller/BotController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
use OCP\AppFramework\Http;
4949
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
5050
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
51+
use OCP\AppFramework\Http\Attribute\OpenAPI;
5152
use OCP\AppFramework\Http\Attribute\PublicPage;
5253
use OCP\AppFramework\Http\DataResponse;
5354
use OCP\AppFramework\Utility\ITimeFactory;
@@ -140,6 +141,7 @@ protected function getBotFromHeaders(string $token, string $message): Bot {
140141
* 413: Message too long
141142
*/
142143
#[BruteForceProtection(action: 'bot')]
144+
#[OpenAPI(scope: 'bots')]
143145
#[PublicPage]
144146
public function sendMessage(string $token, string $message, string $referenceId = '', int $replyTo = 0, bool $silent = false): DataResponse {
145147
if (trim($message) === '') {
@@ -202,6 +204,7 @@ public function sendMessage(string $token, string $message, string $referenceId
202204
* 404: Reaction not found
203205
*/
204206
#[BruteForceProtection(action: 'bot')]
207+
#[OpenAPI(scope: 'bots')]
205208
#[PublicPage]
206209
public function react(string $token, int $messageId, string $reaction): DataResponse {
207210
try {
@@ -254,6 +257,7 @@ public function react(string $token, int $messageId, string $reaction): DataResp
254257
* 404: Reaction not found
255258
*/
256259
#[BruteForceProtection(action: 'bot')]
260+
#[OpenAPI(scope: 'bots')]
257261
#[PublicPage]
258262
public function deleteReaction(string $token, int $messageId, string $reaction): DataResponse {
259263
try {
@@ -297,6 +301,7 @@ public function deleteReaction(string $token, int $messageId, string $reaction):
297301
*
298302
* 200: Bot list returned
299303
*/
304+
#[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION, tags: ['settings'])]
300305
public function adminListBots(): DataResponse {
301306
$data = [];
302307
$bots = $this->botServerMapper->getAllBots();

lib/Controller/CertificateController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
use OCA\Talk\Service\CertificateService;
3030
use OCP\AppFramework\Http;
31+
use OCP\AppFramework\Http\Attribute\OpenAPI;
3132
use OCP\AppFramework\Http\DataResponse;
3233
use OCP\AppFramework\OCSController;
3334
use OCP\IL10N;
@@ -53,6 +54,7 @@ public function __construct(
5354
* 200: Certificate expiration returned
5455
* 400: Getting certificate expiration is not possible
5556
*/
57+
#[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION, tags: ['settings'])]
5658
public function getCertificateExpiration(string $host): DataResponse {
5759
try {
5860
$expirationInDays = $this->certificateService->getCertificateExpirationInDays($host);

lib/Controller/CommandController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
use OCA\Talk\Model\Command;
3030
use OCA\Talk\Service\CommandService;
31-
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
31+
use OCP\AppFramework\Http\Attribute\OpenAPI;
3232
use OCP\AppFramework\Http\DataResponse;
3333
use OCP\AppFramework\OCSController;
3434
use OCP\IRequest;
@@ -46,7 +46,7 @@ public function __construct(
4646
/**
4747
* @deprecated Commands are deprecated in favor of Bots
4848
*/
49-
#[IgnoreOpenAPI]
49+
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
5050
public function index(): DataResponse {
5151
$commands = $this->commandService->findAll();
5252

lib/Controller/FederationController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
use OCA\Talk\ResponseDefinitions;
3636
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
3737
use OCP\AppFramework\Http;
38-
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
3938
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
39+
use OCP\AppFramework\Http\Attribute\OpenAPI;
4040
use OCP\AppFramework\Http\DataResponse;
4141
use OCP\AppFramework\OCSController;
4242
use OCP\DB\Exception as DBException;
@@ -49,7 +49,7 @@
4949
*
5050
* @psalm-import-type TalkFederationInvite from ResponseDefinitions
5151
*/
52-
#[IgnoreOpenAPI]
52+
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
5353
class FederationController extends OCSController {
5454

5555
public function __construct(

lib/Controller/HostedSignalingServerController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
use OCA\Talk\Exceptions\HostedSignalingServerInputException;
3333
use OCA\Talk\Service\HostedSignalingServerService;
3434
use OCP\AppFramework\Http;
35-
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
35+
use OCP\AppFramework\Http\Attribute\OpenAPI;
3636
use OCP\AppFramework\Http\Attribute\PublicPage;
3737
use OCP\AppFramework\Http\DataResponse;
3838
use OCP\AppFramework\OCSController;
@@ -64,7 +64,7 @@ public function __construct(
6464
* 200: Authentication credentials returned
6565
* 412: Getting authentication credentials is not possible
6666
*/
67-
#[IgnoreOpenAPI]
67+
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
6868
#[PublicPage]
6969
public function auth(): DataResponse {
7070
$storedNonce = $this->config->getAppValue('spreed', 'hosted-signaling-server-nonce', '');

lib/Controller/MatterbridgeSettingsController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use OCA\Talk\Exceptions\WrongPermissionsException;
3131
use OCA\Talk\MatterbridgeManager;
3232
use OCP\AppFramework\Http;
33+
use OCP\AppFramework\Http\Attribute\OpenAPI;
3334
use OCP\AppFramework\Http\DataResponse;
3435
use OCP\AppFramework\OCSController;
3536
use OCP\IRequest;
@@ -52,6 +53,7 @@ public function __construct(
5253
* 200: Bridge version returned
5354
* 400: Getting bridge version is not possible
5455
*/
56+
#[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION, tags: ['matterbridge'])]
5557
public function getMatterbridgeVersion(): DataResponse {
5658
try {
5759
$version = $this->bridgeManager->getCurrentVersionFromBinary();
@@ -79,6 +81,7 @@ public function getMatterbridgeVersion(): DataResponse {
7981
* 200: All bridges stopped successfully
8082
* 406: Stopping all bridges is not possible
8183
*/
84+
#[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION, tags: ['matterbridge'])]
8285
public function stopAllBridges(): DataResponse {
8386
try {
8487
$success = $this->bridgeManager->stopAllBridges();

lib/Controller/PageController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
use OCP\AppFramework\Controller;
4343
use OCP\AppFramework\Http;
4444
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
45-
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
4645
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
46+
use OCP\AppFramework\Http\Attribute\OpenAPI;
4747
use OCP\AppFramework\Http\Attribute\PublicPage;
4848
use OCP\AppFramework\Http\Attribute\UseSession;
4949
use OCP\AppFramework\Http\ContentSecurityPolicy;
@@ -69,7 +69,7 @@
6969
use OCP\Security\Bruteforce\IThrottler;
7070
use Psr\Log\LoggerInterface;
7171

72-
#[IgnoreOpenAPI]
72+
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
7373
class PageController extends Controller {
7474
use TInitialState;
7575

lib/Controller/PublicShareAuthController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use OCA\Talk\Room;
3030
use OCA\Talk\Service\RoomService;
3131
use OCP\AppFramework\Http;
32+
use OCP\AppFramework\Http\Attribute\OpenAPI;
3233
use OCP\AppFramework\Http\Attribute\PublicPage;
3334
use OCP\AppFramework\Http\DataResponse;
3435
use OCP\AppFramework\OCSController;
@@ -71,6 +72,7 @@ public function __construct(
7172
* 404: Share not found
7273
*/
7374
#[PublicPage]
75+
#[OpenAPI(tags: ['files_integration'])]
7476
public function createRoom(string $shareToken): DataResponse {
7577
try {
7678
$share = $this->shareManager->getShareByToken($shareToken);

lib/Controller/RecordingController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
use OCA\Talk\Service\RoomService;
4343
use OCP\AppFramework\Http;
4444
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
45-
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
4645
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
46+
use OCP\AppFramework\Http\Attribute\OpenAPI;
4747
use OCP\AppFramework\Http\Attribute\PublicPage;
4848
use OCP\AppFramework\Http\DataResponse;
4949
use OCP\Http\Client\IClientService;
@@ -77,6 +77,7 @@ public function __construct(
7777
* 200: Welcome message returned
7878
* 404: Recording server not found or not configured
7979
*/
80+
#[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION, tags: ['settings'])]
8081
public function getWelcomeMessage(int $serverId): DataResponse {
8182
$recordingServers = $this->talkConfig->getRecordingServers();
8283
if (empty($recordingServers) || !isset($recordingServers[$serverId])) {
@@ -175,7 +176,7 @@ protected function getInputStream(): string {
175176
* 403: Missing permissions to update recording status
176177
* 404: Room not found
177178
*/
178-
#[IgnoreOpenAPI]
179+
#[OpenAPI(scope: 'backend-recording')]
179180
#[PublicPage]
180181
#[BruteForceProtection(action: 'talkRecordingSecret')]
181182
public function backend(): DataResponse {
@@ -366,6 +367,7 @@ public function stop(): DataResponse {
366367
*/
367368
#[PublicPage]
368369
#[BruteForceProtection(action: 'talkRecordingSecret')]
370+
#[OpenAPI(scope: 'backend-recording')]
369371
#[RequireRoom]
370372
public function store(string $owner): DataResponse {
371373
$data = $this->room->getToken();

lib/Controller/RoomController.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
use OCP\App\IAppManager;
6767
use OCP\AppFramework\Http;
6868
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
69-
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
7069
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
70+
use OCP\AppFramework\Http\Attribute\OpenAPI;
7171
use OCP\AppFramework\Http\Attribute\PublicPage;
7272
use OCP\AppFramework\Http\DataResponse;
7373
use OCP\AppFramework\Utility\ITimeFactory;
@@ -311,6 +311,8 @@ public function getBreakoutRooms(): DataResponse {
311311
#[BruteForceProtection(action: 'talkFederationAccess')]
312312
#[BruteForceProtection(action: 'talkRoomToken')]
313313
#[BruteForceProtection(action: 'talkSipBridgeSecret')]
314+
#[OpenAPI]
315+
#[OpenAPI(scope: 'backend-sipbridge')]
314316
public function getSingleRoom(string $token): DataResponse {
315317
try {
316318
$isSIPBridgeRequest = $this->validateSIPBridgeRequest($token);
@@ -1528,9 +1530,9 @@ public function joinRoom(string $token, string $password = '', bool $force = tru
15281530
* 404: Participant not found
15291531
* 501: SIP dial-in is not configured
15301532
*/
1531-
#[IgnoreOpenAPI]
15321533
#[PublicPage]
15331534
#[BruteForceProtection(action: 'talkSipBridgeSecret')]
1535+
#[OpenAPI(scope: 'backend-sipbridge')]
15341536
#[RequireRoom]
15351537
public function verifyDialInPin(string $pin): DataResponse {
15361538
try {
@@ -1568,11 +1570,12 @@ public function verifyDialInPin(string $pin): DataResponse {
15681570
* 200: Participant created successfully
15691571
* 400: Phone number and details could not be confirmed
15701572
* 401: SIP request invalid
1573+
* 404: Phone number is not invited as a participant
15711574
* 501: SIP dial-out is not configured
15721575
*/
1573-
#[IgnoreOpenAPI]
15741576
#[PublicPage]
15751577
#[BruteForceProtection(action: 'talkSipBridgeSecret')]
1578+
#[OpenAPI(scope: 'backend-sipbridge')]
15761579
#[RequireRoom]
15771580
public function verifyDialOutNumber(string $number, array $options = []): DataResponse {
15781581
try {
@@ -1617,9 +1620,9 @@ public function verifyDialOutNumber(string $number, array $options = []): DataRe
16171620
* 400: SIP not enabled
16181621
* 401: SIP request invalid
16191622
*/
1620-
#[IgnoreOpenAPI]
16211623
#[PublicPage]
16221624
#[BruteForceProtection(action: 'talkSipBridgeSecret')]
1625+
#[OpenAPI(scope: 'backend-sipbridge')]
16231626
#[RequireRoom]
16241627
public function createGuestByDialIn(): DataResponse {
16251628
try {
@@ -1656,9 +1659,9 @@ public function createGuestByDialIn(): DataResponse {
16561659
* 404: Participant was not found
16571660
* 501: SIP dial-out is not configured
16581661
*/
1659-
#[IgnoreOpenAPI]
16601662
#[PublicPage]
16611663
#[BruteForceProtection(action: 'talkSipBridgeSecret')]
1664+
#[OpenAPI(scope: 'backend-sipbridge')]
16621665
#[RequireRoom]
16631666
public function rejectedDialOutRequest(string $callId, array $options = []): DataResponse {
16641667
try {

0 commit comments

Comments
 (0)