diff --git a/shared/specs/notifications-openapi.adoc b/shared/specs/notifications-openapi.adoc index d0484cf1..85b1453e 100644 --- a/shared/specs/notifications-openapi.adoc +++ b/shared/specs/notifications-openapi.adoc @@ -39,7 +39,7 @@ Notifications Plugin - OpenAPI Specs [.createNotification] ==== createNotification -`POST /` +`POST /api/notifications` Create a notification @@ -48,7 +48,7 @@ Create a notification Create a notification -// markup not found, no include::{specDir}POST/spec.adoc[opts=optional] +// markup not found, no include::{specDir}api/notifications/POST/spec.adoc[opts=optional] @@ -99,20 +99,240 @@ array[<>] ===== Samples -// markup not found, no include::{snippetDir}POST/http-request.adoc[opts=optional] +// markup not found, no include::{snippetDir}api/notifications/POST/http-request.adoc[opts=optional] -// markup not found, no include::{snippetDir}POST/http-response.adoc[opts=optional] +// markup not found, no include::{snippetDir}api/notifications/POST/http-response.adoc[opts=optional] -// file not found, no * wiremock data link :POST/POST.json[] +// file not found, no * wiremock data link :api/notifications/POST/POST.json[] ifdef::internal-generation[] ===== Implementation -// markup not found, no include::{specDir}POST/implementation.adoc[opts=optional] +// markup not found, no include::{specDir}api/notifications/POST/implementation.adoc[opts=optional] + + +endif::internal-generation[] + + +[.getNotifications] +==== getNotifications + +`GET /api/notifications` + +Get user's notifications + +===== Description + +Get user's notifications + + +// markup not found, no include::{specDir}api/notifications/GET/spec.adoc[opts=optional] + + + +===== Parameters + + + + + + + +===== Return Type + +<> + + +===== Content Type + +* application/json + +===== Responses + +.HTTP Response Codes +[cols="2,3,1"] +|=== +| Code | Message | Datatype + + +| 200 +| Successful operation +| <> + +|=== + +===== Samples + + +// markup not found, no include::{snippetDir}api/notifications/GET/http-request.adoc[opts=optional] + + +// markup not found, no include::{snippetDir}api/notifications/GET/http-response.adoc[opts=optional] + + + +// file not found, no * wiremock data link :api/notifications/GET/GET.json[] + + +ifdef::internal-generation[] +===== Implementation + +// markup not found, no include::{specDir}api/notifications/GET/implementation.adoc[opts=optional] + + +endif::internal-generation[] + + +[.getStatus] +==== getStatus + +`GET /api/notifications/status` + +Get user's count of unread+read notifications + +===== Description + +Get user's count of unread+read notifications + + +// markup not found, no include::{specDir}api/notifications/status/GET/spec.adoc[opts=optional] + + + +===== Parameters + + + + + + + +===== Return Type + +<> + + +===== Content Type + +* application/json + +===== Responses + +.HTTP Response Codes +[cols="2,3,1"] +|=== +| Code | Message | Datatype + + +| 200 +| Successful operation +| <> + +|=== + +===== Samples + + +// markup not found, no include::{snippetDir}api/notifications/status/GET/http-request.adoc[opts=optional] + + +// markup not found, no include::{snippetDir}api/notifications/status/GET/http-response.adoc[opts=optional] + + + +// file not found, no * wiremock data link :api/notifications/status/GET/GET.json[] + + +ifdef::internal-generation[] +===== Implementation + +// markup not found, no include::{specDir}api/notifications/status/GET/implementation.adoc[opts=optional] + + +endif::internal-generation[] + + +[.setRead] +==== setRead + +`POST /api/notifications/update` + +Set read/unread notifications + +===== Description + +Set read/unread notifications + + +// markup not found, no include::{specDir}api/notifications/update/POST/spec.adoc[opts=optional] + + + +===== Parameters + + +====== Body Parameter + +[cols="2,3,1,1,1"] +|=== +|Name| Description| Required| Default| Pattern + +| SetReadRequest +| <> +| - +| +| + +|=== + + + + + +===== Return Type + +array[<>] + + +===== Content Type + +* application/json + +===== Responses + +.HTTP Response Codes +[cols="2,3,1"] +|=== +| Code | Message | Datatype + + +| 200 +| Successful operation +| List[<>] + +|=== + +===== Samples + + +// markup not found, no include::{snippetDir}api/notifications/update/POST/http-request.adoc[opts=optional] + + +// markup not found, no include::{snippetDir}api/notifications/update/POST/http-response.adoc[opts=optional] + + + +// file not found, no * wiremock data link :api/notifications/update/POST/POST.json[] + + +ifdef::internal-generation[] +===== Implementation + +// markup not found, no include::{specDir}api/notifications/update/POST/implementation.adoc[opts=optional] endif::internal-generation[] @@ -122,6 +342,35 @@ endif::internal-generation[] == Models +[#Count] +=== _Count_ + + + + +[.fields-Count] +[cols="2,1,1,2,4,1"] +|=== +| Field Name| Required| Nullable | Type| Description | Format + +| unread +| X +| +| BigDecimal +| +| + +| read +| X +| +| BigDecimal +| +| + +|=== + + + [#CreateBody] === _CreateBody_ @@ -187,6 +436,35 @@ endif::internal-generation[] +[#GetNotifications] +=== _GetNotifications_ + + + + +[.fields-GetNotifications] +[cols="2,1,1,2,4,1"] +|=== +| Field Name| Required| Nullable | Type| Description | Format + +| totalCount +| +| +| BigDecimal +| +| + +| notifications +| +| +| List of <> +| +| + +|=== + + + [#Notification] === _Notification_ @@ -229,9 +507,9 @@ endif::internal-generation[] | read | | -| Date +| BigDecimal | -| date-time +| | updated | @@ -322,3 +600,32 @@ endif::internal-generation[] +[#SetReadRequest] +=== _SetReadRequest_ + + + + +[.fields-SetReadRequest] +[cols="2,1,1,2,4,1"] +|=== +| Field Name| Required| Nullable | Type| Description | Format + +| ids +| X +| +| List of <> +| +| + +| read +| X +| +| Boolean +| +| + +|=== + + + diff --git a/shared/specs/notifications-openapi.yaml b/shared/specs/notifications-openapi.yaml index b6ef5352..a885fd71 100644 --- a/shared/specs/notifications-openapi.yaml +++ b/shared/specs/notifications-openapi.yaml @@ -13,6 +13,21 @@ security: - BearerToken: [] paths: /api/notifications: + get: + tags: + - "notifications" + summary: Get user's notifications + description: Get user's notifications + operationId: getNotifications + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/GetNotifications" + security: + - BearerToken: [] post: tags: - "notifications" @@ -33,6 +48,43 @@ paths: $ref: "#/components/schemas/Notifications" security: - BearerToken: [] + /api/notifications/status: + get: + tags: + - "notifications" + summary: Get user's count of unread+read notifications + description: Get user's count of unread+read notifications + operationId: getStatus + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/Count" + security: + - BearerToken: [] + /api/notifications/update: + post: + tags: + - "notifications" + summary: Set read/unread notifications + description: Set read/unread notifications + operationId: setRead + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SetReadRequest" + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/Notifications" + security: + - BearerToken: [] components: schemas: NotificationPayload: @@ -92,8 +144,7 @@ components: type: string format: date-time read: - type: string - format: date-time + type: number updated: type: string format: date-time @@ -106,6 +157,33 @@ components: type: array items: $ref: "#/components/schemas/Notification" + Count: + type: object + properties: + unread: + type: number + read: + type: number + required: [unread, read] + SetReadRequest: + type: object + properties: + ids: + type: array + items: + type: string + minItems: 1 + read: + type: boolean + required: [ids, read] + GetNotifications: + type: object + properties: + totalCount: + type: number + notifications: + type: object + $ref: "#/components/schemas/Notifications" securitySchemes: BearerToken: type: http