[#40196] added missing endpoints

- removed subject from notification representer
pull/10468/head
Eric Schubert 3 years ago
parent 38483b015c
commit 0a629440ad
No known key found for this signature in database
GPG Key ID: 1D346C019BD4BAA2
  1. 8
      docs/api/apiv3/components/schemas/notification_model.yml
  2. 8
      docs/api/apiv3/openapi-spec.yml
  3. 33
      docs/api/apiv3/paths/notification_read.yml
  4. 33
      docs/api/apiv3/paths/notification_unread.yml
  5. 47
      docs/api/apiv3/paths/notifications_read.yml
  6. 47
      docs/api/apiv3/paths/notifications_unread.yml
  7. 3
      lib/api/v3/notifications/notification_representer.rb

@ -45,7 +45,6 @@ properties:
type: object
required:
- self
- readIAN
- project
- actor
- activity
@ -62,7 +61,12 @@ properties:
allOf:
- "$ref": "./link.yml"
- description: |-
Request to mark the notification as read.
Request to mark the notification as read. Only available if the notification is currently unread.
unreadIAN:
allOf:
- "$ref": "./link.yml"
- description: |-
Request to mark the notification as unread. Only available if the notification is currently read.
project:
allOf:
- "$ref": "./link.yml"

@ -222,8 +222,16 @@ paths:
"$ref": "./paths/news_item.yml"
"/api/v3/notifications":
"$ref": "./paths/notifications.yml"
"/api/v3/notifications/read_ian":
"$ref": "./paths/notifications_read.yml"
"/api/v3/notifications/unread_ian":
"$ref": "./paths/notifications_unread.yml"
"/api/v3/notifications/{id}":
"$ref": "./paths/notification.yml"
"/api/v3/notifications/{id}/read_ian":
"$ref": "./paths/notification_read.yml"
"/api/v3/notifications/{id}/unread_ian":
"$ref": "./paths/notification_unread.yml"
"/api/v3/posts/{id}":
"$ref": "./paths/post.yml"
"/api/v3/posts/{id}/attachments":

@ -0,0 +1,33 @@
# /api/v3/notifications/{id}/read_ian
---
post:
summary: Read notification
operationId: Read_Notification
tags:
- Notifications
description: |-
Marks the given notification as read.
parameters:
- name: id
in: path
description: notification id
example: '1'
required: true
schema:
type: integer
responses:
'204':
description: OK
'404':
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
description: |-
Returned if the notification does not exist or if the user does not have permission to view it.
**Required permission** being recipient of the notification

@ -0,0 +1,33 @@
# /api/v3/notifications/{id}/unread_ian
---
post:
summary: Unread notification
operationId: Unread_Notification
tags:
- Notifications
description: |-
Marks the given notification as unread.
parameters:
- name: id
in: path
description: notification id
example: '1'
required: true
schema:
type: integer
responses:
'204':
description: OK
'404':
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
message: The requested resource could not be found.
description: |-
Returned if the notification does not exist or if the user does not have permission to view it.
**Required permission** being recipient of the notification

@ -0,0 +1,47 @@
# /api/v3/notifications/read_ian
---
post:
summary: Read all notifications
operationId: Read_Notification_Collection
tags:
- Notifications
description: |-
Marks the whole notification collection as read. The collection contains only elements the authenticated user can
see, and can be further reduced with filters.
parameters:
- name: filters
in: query
description: |-
JSON specifying filter conditions.
Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/)
endpoint. Currently supported filters are:
+ id: Filter by primary key
+ project: Filter by the project the notification was created in
+ reason: Filter by the reason, e.g. 'mentioned' or 'assigned' the notification was created because of
+ resourceId: Filter by the id of the resource the notification was created for. Ideally used together with the
`resourceType` filter.
+ resourceType: Filter by the type of the resource the notification was created for. Ideally used together with
the `resourceId` filter.
example: '[{ "reason": { "operator": "=", "values": ["mentioned"] } }]'
required: false
schema:
type: string
responses:
'204':
description: OK
'400':
description: Returned if the request is not properly formatted.
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery
message:
- Filters Invalid filter does not exist.

@ -0,0 +1,47 @@
# /api/v3/notifications/unread_ian
---
post:
summary: Unread all notifications
operationId: Unread_Notification_Collection
tags:
- Notifications
description: |-
Marks the whole notification collection as unread. The collection contains only elements the authenticated user can
see, and can be further reduced with filters.
parameters:
- name: filters
in: query
description: |-
JSON specifying filter conditions.
Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/)
endpoint. Currently supported filters are:
+ id: Filter by primary key
+ project: Filter by the project the notification was created in
+ reason: Filter by the reason, e.g. 'mentioned' or 'assigned' the notification was created because of
+ resourceId: Filter by the id of the resource the notification was created for. Ideally used together with the
`resourceType` filter.
+ resourceType: Filter by the type of the resource the notification was created for. Ideally used together with
the `resourceId` filter.
example: '[{ "reason": { "operator": "=", "values": ["mentioned"] } }]'
required: false
schema:
type: string
responses:
'204':
description: OK
'400':
description: Returned if the request is not properly formatted.
content:
application/hal+json:
schema:
$ref: '../components/schemas/error_response.yml'
example:
_type: Error
errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery
message:
- Filters Invalid filter does not exist.

@ -34,10 +34,7 @@ module API
include API::Decorators::LinkedResource
extend API::Decorators::PolymorphicResource
self_link title_getter: ->(*) { represented.subject }
property :id
property :subject
property :read_ian,
as: :readIAN

Loading…
Cancel
Save