diff --git a/openapi-administration.json b/openapi-administration.json index 437bbc1a6..262c588cb 100644 --- a/openapi-administration.json +++ b/openapi-administration.json @@ -86,8 +86,9 @@ "/ocs/v2.php/apps/notifications/api/{apiVersion}/admin_notifications/{userId}": { "post": { "operationId": "api-generate-notification", - "summary": "Generate a notification for a user", + "summary": "Generate a notification for a user (deprecated, use v3 instead)", "description": "This endpoint requires admin access", + "deprecated": true, "tags": [ "api" ], @@ -99,25 +100,31 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "shortMessage", - "in": "query", - "description": "Subject of the notification", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "longMessage", - "in": "query", - "description": "Message of the notification", - "schema": { - "type": "string", - "default": "" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "shortMessage" + ], + "properties": { + "shortMessage": { + "type": "string", + "description": "Subject of the notification" + }, + "longMessage": { + "type": "string", + "default": "", + "description": "Message of the notification" + } + } + } } - }, + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -273,13 +280,13 @@ } } }, - "/ocs/v2.php/apps/notifications/api/{apiVersion}/settings/admin": { + "/ocs/v2.php/apps/notifications/api/{apiVersion3}/admin_notifications/{userId}": { "post": { - "operationId": "settings-admin", - "summary": "Update default notification settings for new users", + "operationId": "api-generate-notification-v3", + "summary": "Generate a notification with rich object parameters for a user", "description": "This endpoint requires admin access", "tags": [ - "settings" + "api" ], "security": [ { @@ -289,35 +296,202 @@ "basic_auth": [] } ], + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "default": "", + "description": "Subject of the notification" + }, + "message": { + "type": "string", + "default": "", + "description": "Message of the notification" + }, + "subjectParameters": { + "type": "object", + "default": [], + "description": "Rich objects to fill the subject placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}", + "additionalProperties": { + "$ref": "#/components/schemas/RichObjectParameter" + } + }, + "messageParameters": { + "type": "object", + "default": [], + "description": "Rich objects to fill the message placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}", + "additionalProperties": { + "$ref": "#/components/schemas/RichObjectParameter" + } + } + } + } + } + } + }, "parameters": [ { - "name": "batchSetting", - "in": "query", - "description": "How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4)", + "name": "apiVersion3", + "in": "path", "required": true, "schema": { - "type": "integer", - "format": "int64" + "type": "string", + "pattern": "^(v3)$" } }, { - "name": "soundNotification", - "in": "query", - "description": "Enable sound for notifications ('yes' or 'no')", + "name": "userId", + "in": "path", + "description": "ID of the user", "required": true, "schema": { "type": "string" } }, { - "name": "soundTalk", - "in": "query", - "description": "Enable sound for Talk notifications ('yes' or 'no')", + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", "required": true, "schema": { - "type": "string" + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Notification generated successfully, returned id is the notification ID for future delete requests", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + } + } } }, + "400": { + "description": "Provided data was invalid, check error field of the response of log file for details", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/settings/admin": { + "post": { + "operationId": "settings-admin", + "summary": "Update default notification settings for new users", + "description": "This endpoint requires admin access", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "batchSetting", + "soundNotification", + "soundTalk" + ], + "properties": { + "batchSetting": { + "type": "integer", + "format": "int64", + "description": "How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4)" + }, + "soundNotification": { + "type": "string", + "description": "Enable sound for notifications ('yes' or 'no')" + }, + "soundTalk": { + "type": "string", + "description": "Enable sound for Talk notifications ('yes' or 'no')" + } + } + } + } + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -375,4 +549,4 @@ } }, "tags": [] -} \ No newline at end of file +} diff --git a/openapi-full.json b/openapi-full.json index c214b870e..3067c4f9c 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -111,7 +111,7 @@ "subjectRichParameters": { "type": "object", "additionalProperties": { - "type": "object" + "$ref": "#/components/schemas/RichObjectParameter" } }, "messageRich": { @@ -120,7 +120,7 @@ "messageRichParameters": { "type": "object", "additionalProperties": { - "type": "object" + "$ref": "#/components/schemas/RichObjectParameter" } }, "icon": { @@ -196,6 +196,114 @@ "type": "string" } } + }, + "RichObjectParameter": { + "type": "object", + "required": [ + "type", + "id", + "name" + ], + "properties": { + "type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "server": { + "type": "string" + }, + "link": { + "type": "string" + }, + "call-type": { + "type": "string", + "enum": [ + "one2one", + "group", + "public" + ] + }, + "icon-url": { + "type": "string" + }, + "message-id": { + "type": "string" + }, + "boardname": { + "type": "string" + }, + "stackname": { + "type": "string" + }, + "size": { + "type": "string" + }, + "path": { + "type": "string" + }, + "mimetype": { + "type": "string" + }, + "preview-available": { + "type": "string", + "enum": [ + "yes", + "no" + ] + }, + "mtime": { + "type": "string" + }, + "latitude": { + "type": "string" + }, + "longitude": { + "type": "string" + }, + "description": { + "type": "string" + }, + "thumb": { + "type": "string" + }, + "website": { + "type": "string" + }, + "visibility": { + "type": "string", + "enum": [ + "0", + "1" + ] + }, + "assignable": { + "type": "string", + "enum": [ + "0", + "1" + ] + }, + "conversation": { + "type": "string" + }, + "etag": { + "type": "string" + }, + "permissions": { + "type": "string" + }, + "width": { + "type": "string" + }, + "height": { + "type": "string" + } + } } } }, @@ -665,20 +773,30 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "ids[]", - "in": "query", - "description": "IDs of the notifications to check", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ids" + ], + "properties": { + "ids": { + "type": "array", + "description": "IDs of the notifications to check", + "items": { + "type": "integer", + "format": "int64" + } + } + } } } - }, + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -791,35 +909,37 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "batchSetting", - "in": "query", - "description": "How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4)", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - }, - { - "name": "soundNotification", - "in": "query", - "description": "Enable sound for notifications ('yes' or 'no')", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "soundTalk", - "in": "query", - "description": "Enable sound for Talk notifications ('yes' or 'no')", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "batchSetting", + "soundNotification", + "soundTalk" + ], + "properties": { + "batchSetting": { + "type": "integer", + "format": "int64", + "description": "How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4)" + }, + "soundNotification": { + "type": "string", + "description": "Enable sound for notifications ('yes' or 'no')" + }, + "soundTalk": { + "type": "string", + "description": "Enable sound for Talk notifications ('yes' or 'no')" + } + } + } } - }, + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -878,8 +998,9 @@ "/ocs/v2.php/apps/notifications/api/{apiVersion}/admin_notifications/{userId}": { "post": { "operationId": "api-generate-notification", - "summary": "Generate a notification for a user", + "summary": "Generate a notification for a user (deprecated, use v3 instead)", "description": "This endpoint requires admin access", + "deprecated": true, "tags": [ "api" ], @@ -891,25 +1012,31 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "shortMessage", - "in": "query", - "description": "Subject of the notification", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "longMessage", - "in": "query", - "description": "Message of the notification", - "schema": { - "type": "string", - "default": "" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "shortMessage" + ], + "properties": { + "shortMessage": { + "type": "string", + "description": "Subject of the notification" + }, + "longMessage": { + "type": "string", + "default": "", + "description": "Message of the notification" + } + } + } } - }, + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -1065,13 +1192,13 @@ } } }, - "/ocs/v2.php/apps/notifications/api/{apiVersion}/settings/admin": { + "/ocs/v2.php/apps/notifications/api/{apiVersion3}/admin_notifications/{userId}": { "post": { - "operationId": "settings-admin", - "summary": "Update default notification settings for new users", + "operationId": "api-generate-notification-v3", + "summary": "Generate a notification with rich object parameters for a user", "description": "This endpoint requires admin access", "tags": [ - "settings" + "api" ], "security": [ { @@ -1081,35 +1208,202 @@ "basic_auth": [] } ], + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "default": "", + "description": "Subject of the notification" + }, + "message": { + "type": "string", + "default": "", + "description": "Message of the notification" + }, + "subjectParameters": { + "type": "object", + "default": [], + "description": "Rich objects to fill the subject placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}", + "additionalProperties": { + "$ref": "#/components/schemas/RichObjectParameter" + } + }, + "messageParameters": { + "type": "object", + "default": [], + "description": "Rich objects to fill the message placeholders, {@see \\OCP\\RichObjectStrings\\Definitions}", + "additionalProperties": { + "$ref": "#/components/schemas/RichObjectParameter" + } + } + } + } + } + } + }, "parameters": [ { - "name": "batchSetting", - "in": "query", - "description": "How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4)", + "name": "apiVersion3", + "in": "path", "required": true, "schema": { - "type": "integer", - "format": "int64" + "type": "string", + "pattern": "^(v3)$" } }, { - "name": "soundNotification", - "in": "query", - "description": "Enable sound for notifications ('yes' or 'no')", + "name": "userId", + "in": "path", + "description": "ID of the user", "required": true, "schema": { "type": "string" } }, { - "name": "soundTalk", - "in": "query", - "description": "Enable sound for Talk notifications ('yes' or 'no')", + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", "required": true, "schema": { - "type": "string" + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Notification generated successfully, returned id is the notification ID for future delete requests", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + } + } } }, + "400": { + "description": "Provided data was invalid, check error field of the response of log file for details", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/ocs/v2.php/apps/notifications/api/{apiVersion}/settings/admin": { + "post": { + "operationId": "settings-admin", + "summary": "Update default notification settings for new users", + "description": "This endpoint requires admin access", + "tags": [ + "settings" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "batchSetting", + "soundNotification", + "soundTalk" + ], + "properties": { + "batchSetting": { + "type": "integer", + "format": "int64", + "description": "How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4)" + }, + "soundNotification": { + "type": "string", + "description": "Enable sound for notifications ('yes' or 'no')" + }, + "soundTalk": { + "type": "string", + "description": "Enable sound for Talk notifications ('yes' or 'no')" + } + } + } + } + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -1180,34 +1474,36 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "pushTokenHash", - "in": "query", - "description": "Hash of the push token", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "devicePublicKey", - "in": "query", - "description": "Public key of the device", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "proxyServer", - "in": "query", - "description": "Proxy server to be used", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "pushTokenHash", + "devicePublicKey", + "proxyServer" + ], + "properties": { + "pushTokenHash": { + "type": "string", + "description": "Hash of the push token" + }, + "devicePublicKey": { + "type": "string", + "description": "Public key of the device" + }, + "proxyServer": { + "type": "string", + "description": "Proxy server to be used" + } + } + } } - }, + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -1526,4 +1822,4 @@ } }, "tags": [] -} \ No newline at end of file +} diff --git a/openapi-push.json b/openapi-push.json index a5f555bdd..87bdc9b55 100644 --- a/openapi-push.json +++ b/openapi-push.json @@ -117,34 +117,36 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "pushTokenHash", - "in": "query", - "description": "Hash of the push token", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "devicePublicKey", - "in": "query", - "description": "Public key of the device", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "proxyServer", - "in": "query", - "description": "Proxy server to be used", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "pushTokenHash", + "devicePublicKey", + "proxyServer" + ], + "properties": { + "pushTokenHash": { + "type": "string", + "description": "Hash of the push token" + }, + "devicePublicKey": { + "type": "string", + "description": "Public key of the device" + }, + "proxyServer": { + "type": "string", + "description": "Proxy server to be used" + } + } + } } - }, + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -463,4 +465,4 @@ } }, "tags": [] -} \ No newline at end of file +} diff --git a/openapi.json b/openapi.json index 9ced3becf..d8bbee675 100644 --- a/openapi.json +++ b/openapi.json @@ -111,7 +111,7 @@ "subjectRichParameters": { "type": "object", "additionalProperties": { - "type": "object" + "$ref": "#/components/schemas/RichObjectParameter" } }, "messageRich": { @@ -120,7 +120,7 @@ "messageRichParameters": { "type": "object", "additionalProperties": { - "type": "object" + "$ref": "#/components/schemas/RichObjectParameter" } }, "icon": { @@ -177,6 +177,114 @@ "type": "string" } } + }, + "RichObjectParameter": { + "type": "object", + "required": [ + "type", + "id", + "name" + ], + "properties": { + "type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "server": { + "type": "string" + }, + "link": { + "type": "string" + }, + "call-type": { + "type": "string", + "enum": [ + "one2one", + "group", + "public" + ] + }, + "icon-url": { + "type": "string" + }, + "message-id": { + "type": "string" + }, + "boardname": { + "type": "string" + }, + "stackname": { + "type": "string" + }, + "size": { + "type": "string" + }, + "path": { + "type": "string" + }, + "mimetype": { + "type": "string" + }, + "preview-available": { + "type": "string", + "enum": [ + "yes", + "no" + ] + }, + "mtime": { + "type": "string" + }, + "latitude": { + "type": "string" + }, + "longitude": { + "type": "string" + }, + "description": { + "type": "string" + }, + "thumb": { + "type": "string" + }, + "website": { + "type": "string" + }, + "visibility": { + "type": "string", + "enum": [ + "0", + "1" + ] + }, + "assignable": { + "type": "string", + "enum": [ + "0", + "1" + ] + }, + "conversation": { + "type": "string" + }, + "etag": { + "type": "string" + }, + "permissions": { + "type": "string" + }, + "width": { + "type": "string" + }, + "height": { + "type": "string" + } + } } } }, @@ -646,20 +754,30 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "ids[]", - "in": "query", - "description": "IDs of the notifications to check", - "required": true, - "schema": { - "type": "array", - "items": { - "type": "integer", - "format": "int64" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ids" + ], + "properties": { + "ids": { + "type": "array", + "description": "IDs of the notifications to check", + "items": { + "type": "integer", + "format": "int64" + } + } + } } } - }, + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -772,35 +890,37 @@ "basic_auth": [] } ], - "parameters": [ - { - "name": "batchSetting", - "in": "query", - "description": "How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4)", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - }, - { - "name": "soundNotification", - "in": "query", - "description": "Enable sound for notifications ('yes' or 'no')", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "soundTalk", - "in": "query", - "description": "Enable sound for Talk notifications ('yes' or 'no')", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "batchSetting", + "soundNotification", + "soundTalk" + ], + "properties": { + "batchSetting": { + "type": "integer", + "format": "int64", + "description": "How often E-mails about missed notifications should be sent (hourly: 1; every three hours: 2; daily: 3; weekly: 4)" + }, + "soundNotification": { + "type": "string", + "description": "Enable sound for notifications ('yes' or 'no')" + }, + "soundTalk": { + "type": "string", + "description": "Enable sound for Talk notifications ('yes' or 'no')" + } + } + } } - }, + } + }, + "parameters": [ { "name": "apiVersion", "in": "path", @@ -858,4 +978,4 @@ } }, "tags": [] -} \ No newline at end of file +}