From 4ffcaa5e2cd8ea99031b92adb5ae8ad67d66e808 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 28 Oct 2023 17:33:51 +0200 Subject: [PATCH] feat(tests): Add a demo app for testing Signed-off-by: Joas Schilling --- .editorconfig | 14 + tests/appinfo/info.xml | 52 + tests/appinfo/routes.php | 42 + .../Controller/AdminSettingsController.php | 69 ++ tests/lib/Controller/SettingsController.php | 164 +++ tests/lib/ResponseDefinitions.php | 75 ++ tests/openapi.json | 934 ++++++++++++++++++ 7 files changed, 1350 insertions(+) create mode 100644 .editorconfig create mode 100644 tests/appinfo/info.xml create mode 100644 tests/appinfo/routes.php create mode 100644 tests/lib/Controller/AdminSettingsController.php create mode 100644 tests/lib/Controller/SettingsController.php create mode 100644 tests/lib/ResponseDefinitions.php create mode 100644 tests/openapi.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..35630aa --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false diff --git a/tests/appinfo/info.xml b/tests/appinfo/info.xml new file mode 100644 index 0000000..7147b0e --- /dev/null +++ b/tests/appinfo/info.xml @@ -0,0 +1,52 @@ + + + notifications + Notifications + + + + 2.16.0 + agpl + Joas Schilling + + + + + + tools + + https://github.com/nextcloud/notifications + https://github.com/nextcloud/notifications/issues + https://github.com/nextcloud/notifications.git + + + + + + + OCA\Notifications\BackgroundJob\GenerateUserSettings + OCA\Notifications\BackgroundJob\SendNotificationMails + + + + OCA\Notifications\Command\Generate + OCA\Notifications\Command\TestPush + + + + OCA\Notifications\Settings\Admin + OCA\Notifications\Settings\AdminSection + OCA\Notifications\Settings\Personal + OCA\Notifications\Settings\PersonalSection + + diff --git a/tests/appinfo/routes.php b/tests/appinfo/routes.php new file mode 100644 index 0000000..bda23d9 --- /dev/null +++ b/tests/appinfo/routes.php @@ -0,0 +1,42 @@ + + * @copyright Copyright (c) 2016, ownCloud, Inc. + * + * @author Joas Schilling + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see + * + */ + +return [ + 'ocs' => [ + ['name' => 'AdminSettings#adminScopeImplicitFromAdminRequired', 'url' => '/api/{apiVersion}/default-admin', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'AdminSettings#movedToDefaultScope', 'url' => '/api/{apiVersion}/default-admin-overwritten', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'AdminSettings#movedToSettingsTag', 'url' => '/api/{apiVersion}/moved-with-tag', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + + ['name' => 'Settings#federationByController', 'url' => '/api/{apiVersion}/controller-scope', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'Settings#ignoreByDeprecatedAttributeOnMethod', 'url' => '/api/{apiVersion}/ignore-openapi-attribute', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'Settings#ignoreByScopeOnMethod', 'url' => '/api/{apiVersion}/ignore-method-scope', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'Settings#movedToDefaultScope', 'url' => '/api/{apiVersion}/default-scope', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'Settings#movedToAdminScope', 'url' => '/api/{apiVersion}/admin-scope', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'Settings#defaultAndAdminScope', 'url' => '/api/{apiVersion}/default-and-admin-scope', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'Settings#nestedSchemas', 'url' => '/api/{apiVersion}/nested-schemas', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ['name' => 'Settings#listSchemas', 'url' => '/api/{apiVersion}/list-schemas', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']], + ], +]; diff --git a/tests/lib/Controller/AdminSettingsController.php b/tests/lib/Controller/AdminSettingsController.php new file mode 100644 index 0000000..f3fbd72 --- /dev/null +++ b/tests/lib/Controller/AdminSettingsController.php @@ -0,0 +1,69 @@ + + * + * @author Julien Barnoin + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Notifications\Controller; + +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\OpenAPI; +use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; + +class AdminSettingsController extends OCSController { + /** + * Route is only in the admin scope because there is no "NoAdminRequired" annotation or attribute + * + * @return DataResponse, array{}> + * + * 200: Personal settings updated + */ + public function adminScopeImplicitFromAdminRequired(): DataResponse { + return new DataResponse(); + } + + /** + * Route is in the default scope because the method overwrites with the Attribute + * + * @return DataResponse, array{}> + * + * 200: Personal settings updated + */ + #[OpenAPI] + public function movedToDefaultScope(): DataResponse { + return new DataResponse(); + } + + /** + * Route in default scope with tags + * + * @return DataResponse, array{}> + * + * 200: Personal settings updated + */ + #[OpenAPI(tags: ['settings', 'admin-settings'])] + public function movedToSettingsTag(): DataResponse { + return new DataResponse(); + } +} diff --git a/tests/lib/Controller/SettingsController.php b/tests/lib/Controller/SettingsController.php new file mode 100644 index 0000000..efd8c3a --- /dev/null +++ b/tests/lib/Controller/SettingsController.php @@ -0,0 +1,164 @@ + + * + * @author Julien Barnoin + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Notifications\Controller; + +use OCA\Notifications\ResponseDefinitions; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI; +use OCP\AppFramework\Http\Attribute\OpenAPI; +use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; + +/** + * @psalm-import-type NotificationsPushDevice from ResponseDefinitions + * @psalm-import-type NotificationsNotification from ResponseDefinitions + * @psalm-import-type NotificationsCollection from ResponseDefinitions + */ +#[OpenAPI(scope: OpenAPI::SCOPE_FEDERATION)] +class SettingsController extends OCSController { + + /** + * @NoAdminRequired + * + * Route is ignored because of scope on the controller + * + * @return DataResponse, array{}> + * + * 200: OK + */ + public function federationByController(): DataResponse { + return new DataResponse(); + } + + /** + * @NoAdminRequired + * + * Route is ignored because of IgnoreOpenAPI attribute on the method + * + * @return DataResponse, array{}> + * + * 200: OK + */ + #[IgnoreOpenAPI] + public function ignoreByDeprecatedAttributeOnMethod(): DataResponse { + return new DataResponse(); + } + + /** + * @NoAdminRequired + * + * Route is ignored because of scope on the method + * + * @return DataResponse, array{}> + * + * 200: OK + */ + #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] + public function ignoreByScopeOnMethod(): DataResponse { + return new DataResponse(); + } + + /** + * @NoAdminRequired + * + * Route is only in the default scope + * + * @return DataResponse, array{}> + * + * 200: Personal settings updated + */ + #[OpenAPI] + public function movedToDefaultScope(): DataResponse { + return new DataResponse(); + } + + /** + * @NoAdminRequired + * + * Route is only in the admin scope due to defined scope + * + * @return DataResponse + * + * 200: Admin settings updated + */ + #[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION)] + public function movedToAdminScope(): DataResponse { + return new DataResponse($this->createNotificationsPushDevice()); + } + + /** + * @return NotificationsPushDevice + */ + protected function createNotificationsPushDevice(): array { + return [ + 'publicKey' => 'publicKey', + 'deviceIdentifier' => 'deviceIdentifier', + 'signature' => 'signature', + ]; + } + + /** + * @NoAdminRequired + * + * Route is in admin and default scope + * + * @return DataResponse, array{}> + * + * 200: Admin settings updated + */ + #[OpenAPI] + #[OpenAPI(scope: OpenAPI::SCOPE_ADMINISTRATION)] + public function defaultAndAdminScope(): DataResponse { + return new DataResponse(); + } + + /** + * @NoAdminRequired + * + * Route is ignored because of scope on the controller + * + * @return DataResponse, array{}> + * + * 200: OK + */ + public function nestedSchemas(): DataResponse { + return new DataResponse(); + } + + /** + * @NoAdminRequired + * + * Route is ignored because of scope on the controller + * + * @return DataResponse + * + * 200: OK + */ + public function listSchemas(): DataResponse { + return new DataResponse(); + } +} diff --git a/tests/lib/ResponseDefinitions.php b/tests/lib/ResponseDefinitions.php new file mode 100644 index 0000000..88b1b21 --- /dev/null +++ b/tests/lib/ResponseDefinitions.php @@ -0,0 +1,75 @@ + + * + * @author Kate Döen + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Notifications; + +/** + * @psalm-type NotificationsItem = array{ + * label: string, + * link: string, + * type: string, + * primary: bool, + * } + * + * @psalm-type NotificationsCollection = list + * + * @psalm-type NotificationsNotificationAction = array{ + * label: string, + * link: string, + * type: string, + * primary: bool, + * } + * + * @psalm-type NotificationsNotification = array{ + * notification_id: int, + * app: string, + * user: string, + * datetime: string, + * object_type: string, + * object_id: string, + * subject: string, + * message: string, + * link: string, + * actions: NotificationsNotificationAction[], + * subjectRich?: string, + * subjectRichParameters?: array, + * messageRich?: string, + * messageRichParameters?: array, + * icon?: string, + * shouldNotify?: bool, + * } + * + * @psalm-type NotificationsPushDeviceBase = array{ + * deviceIdentifier: string, + * } + * + * @psalm-type NotificationsPushDevice = NotificationsPushDeviceBase&array{ + * publicKey: string, + * signature: string, + * } + */ +class ResponseDefinitions { +} diff --git a/tests/openapi.json b/tests/openapi.json new file mode 100644 index 0000000..f125dac --- /dev/null +++ b/tests/openapi.json @@ -0,0 +1,934 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "notifications", + "version": "0.0.1", + "description": "This app provides a backend and frontend for the notification API available in Nextcloud.", + "license": { + "name": "agpl" + } + }, + "components": { + "securitySchemes": { + "basic_auth": { + "type": "http", + "scheme": "basic" + }, + "bearer_auth": { + "type": "http", + "scheme": "bearer" + } + }, + "schemas": { + "Collection": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Item" + } + }, + "Item": { + "type": "object", + "required": [ + "label", + "link", + "type", + "primary" + ], + "properties": { + "label": { + "type": "string" + }, + "link": { + "type": "string" + }, + "type": { + "type": "string" + }, + "primary": { + "type": "boolean" + } + } + }, + "Notification": { + "type": "object", + "required": [ + "notification_id", + "app", + "user", + "datetime", + "object_type", + "object_id", + "subject", + "message", + "link", + "actions" + ], + "properties": { + "notification_id": { + "type": "integer", + "format": "int64" + }, + "app": { + "type": "string" + }, + "user": { + "type": "string" + }, + "datetime": { + "type": "string" + }, + "object_type": { + "type": "string" + }, + "object_id": { + "type": "string" + }, + "subject": { + "type": "string" + }, + "message": { + "type": "string" + }, + "link": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/NotificationAction" + } + }, + "subjectRich": { + "type": "string" + }, + "subjectRichParameters": { + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "messageRich": { + "type": "string" + }, + "messageRichParameters": { + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "icon": { + "type": "string" + }, + "shouldNotify": { + "type": "boolean" + } + } + }, + "NotificationAction": { + "type": "object", + "required": [ + "label", + "link", + "type", + "primary" + ], + "properties": { + "label": { + "type": "string" + }, + "link": { + "type": "string" + }, + "type": { + "type": "string" + }, + "primary": { + "type": "boolean" + } + } + }, + "OCSMeta": { + "type": "object", + "required": [ + "status", + "statuscode" + ], + "properties": { + "status": { + "type": "string" + }, + "statuscode": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "totalitems": { + "type": "string" + }, + "itemsperpage": { + "type": "string" + } + } + }, + "PushDevice": { + "allOf": [ + { + "$ref": "#/components/schemas/PushDeviceBase" + }, + { + "type": "object", + "required": [ + "publicKey", + "signature" + ], + "properties": { + "publicKey": { + "type": "string" + }, + "signature": { + "type": "string" + } + } + } + ] + }, + "PushDeviceBase": { + "type": "object", + "required": [ + "deviceIdentifier" + ], + "properties": { + "deviceIdentifier": { + "type": "string" + } + } + } + } + }, + "paths": { + "/ocs/v2.php/apps/notifications/api/{apiVersion}/default-admin": { + "post": { + "operationId": "admin_settings-admin-scope-implicit-from-admin-required", + "summary": "Route is only in the admin scope because there is no \"NoAdminRequired\" annotation or attribute", + "description": "This endpoint requires admin access", + "tags": [ + "admin_settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "Personal settings updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/default-admin-overwritten": { + "post": { + "operationId": "admin_settings-moved-to-default-scope", + "summary": "Route is in the default scope because the method overwrites with the Attribute", + "description": "This endpoint requires admin access", + "tags": [ + "admin_settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "Personal settings updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/moved-with-tag": { + "post": { + "operationId": "admin_settings-moved-to-settings-tag", + "summary": "Route in default scope with tags", + "description": "This endpoint requires admin access", + "tags": [ + "admin_settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "Personal settings updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/controller-scope": { + "post": { + "operationId": "settings-federation-by-controller", + "summary": "Route is ignored because of scope on the controller", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/ignore-method-scope": { + "post": { + "operationId": "settings-ignore-by-scope-on-method", + "summary": "Route is ignored because of scope on the method", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/default-scope": { + "post": { + "operationId": "settings-moved-to-default-scope", + "summary": "Route is only in the default scope", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "Personal settings updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/admin-scope": { + "post": { + "operationId": "settings-moved-to-admin-scope", + "summary": "Route is only in the admin scope due to defined scope", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "Admin settings updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/PushDevice" + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/default-and-admin-scope": { + "post": { + "operationId": "settings-default-and-admin-scope", + "summary": "Route is in admin and default scope", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "Admin settings updated", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/nested-schemas": { + "post": { + "operationId": "settings-nested-schemas", + "summary": "Route is ignored because of scope on the controller", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Notification" + } + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/list-schemas": { + "post": { + "operationId": "settings-list-schemas", + "summary": "Route is ignored because of scope on the controller", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "apiVersion", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "v2" + ], + "default": "v2" + } + }, + { + "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": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "$ref": "#/components/schemas/Collection" + } + } + } + } + } + } + } + } + } + } + } + }, + "tags": [] +} \ No newline at end of file