Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/ResponseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ public static function getAll(): array {
null,
null,
),
new ResponseType(
'StreamTraversableResponse',
false,
false,
null,
null,
null,
),
new ResponseType(
'TemplateResponse',
false,
Expand Down
32 changes: 32 additions & 0 deletions tests/lib/Controller/StreamingController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Notifications\Controller;

use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\ApiRoute;
use OCP\AppFramework\OCSController;

class StreamingController extends OCSController {
/**
* Use StreamTraversableResponse response type
*
* @return StreamTraversableResponse<Http::STATUS_OK, array{}>
*
* 200: Export OK
*/
#[ApiRoute(verb: 'GET', url: '/streaming/traversable')]
public function traversable(): StreamTraversableResponse {
return new StreamTraversableResponse($this->generator());
}

private function generator(): \Generator {
yield from [];
}
}
91 changes: 91 additions & 0 deletions tests/openapi-administration.json
Original file line number Diff line number Diff line change
Expand Up @@ -9648,6 +9648,97 @@
}
}
},
"/ocs/v2.php/apps/notifications/streaming/traversable": {
"get": {
"operationId": "streaming-traversable",
"summary": "Use StreamTraversableResponse response type",
"description": "This endpoint requires admin access",
"tags": [
"streaming"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Export OK"
},
"401": {
"description": "Current user is not logged in",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
},
"403": {
"description": "Logged in account must be an admin",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}
},
"/index.php/tests/attribute-index/{param}": {
"get": {
"operationId": "routing-attribute-index-route",
Expand Down
91 changes: 91 additions & 0 deletions tests/openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -9848,6 +9848,97 @@
}
}
},
"/ocs/v2.php/apps/notifications/streaming/traversable": {
"get": {
"operationId": "streaming-traversable",
"summary": "Use StreamTraversableResponse response type",
"description": "This endpoint requires admin access",
"tags": [
"streaming"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Export OK"
},
"401": {
"description": "Current user is not logged in",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
},
"403": {
"description": "Logged in account must be an admin",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}
},
"/index.php/tests/attribute-index/{param}": {
"get": {
"operationId": "routing-attribute-index-route",
Expand Down