[API] add endpoint to check notifications [Extend #9488] (#9595)

* introduce GET /notifications/new

* add TEST

* use Sprintf instead of path.Join

* Error more verbose

* return number of notifications if unreaded exist

* 200 http status for available notifications
This commit is contained in:
6543 2020-01-14 16:37:19 +01:00 committed by Antoine GIRARD
parent ce274d652f
commit 44de66bf50
9 changed files with 107 additions and 5 deletions

View file

@ -494,6 +494,23 @@
}
}
},
"/notifications/new": {
"get": {
"tags": [
"notification"
],
"summary": "Check if unread notifications exist",
"operationId": "notifyNewAvailable",
"responses": {
"200": {
"$ref": "#/responses/NotificationCount"
},
"204": {
"description": "No unread notification"
}
}
}
},
"/notifications/threads/{id}": {
"get": {
"consumes": [
@ -10911,6 +10928,18 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"NotificationCount": {
"description": "NotificationCount number of unread notifications",
"type": "object",
"properties": {
"new": {
"type": "integer",
"format": "int64",
"x-go-name": "New"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"NotificationSubject": {
"description": "NotificationSubject contains the notification subject (Issue/Pull/Commit)",
"type": "object",
@ -12397,6 +12426,12 @@
}
}
},
"NotificationCount": {
"description": "Number of unread notifications",
"schema": {
"$ref": "#/definitions/NotificationCount"
}
},
"NotificationThread": {
"description": "NotificationThread",
"schema": {