Public API: Add routes to get uploads by user or note

Co-authored-by: Yannick Bungers <git@innay.de>
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-10-24 21:48:29 +02:00
parent 23c07dc67d
commit 4a975dcca2
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -148,6 +148,20 @@ paths:
"$ref": "#/components/schemas/NoteMetadata" "$ref": "#/components/schemas/NoteMetadata"
'401': '401':
"$ref": "#/components/responses/UnauthorizedError" "$ref": "#/components/responses/UnauthorizedError"
/me/media:
get:
tags: [ user, media ]
summary: Get list of uploaded files owned by the current user
operationId: getOwnMedia
responses:
'200':
description:
content:
application/json:
schema:
type: array
items:
"$ref": "#/components/schemas/MediaUpload"
/notes: /notes:
post: post:
tags: tags:
@ -156,8 +170,8 @@ paths:
operationId: createNoteFromMarkdown operationId: createNoteFromMarkdown
description: A random id will be assigned and the content will equal to the body of the received HTTP-request. description: A random id will be assigned and the content will equal to the body of the received HTTP-request.
security: security:
- bearerAuth: [] - bearerAuth: [ ]
- {} - { }
requestBody: requestBody:
required: false required: false
description: The content of the note to be imported as markdown. description: The content of the note to be imported as markdown.
@ -454,6 +468,20 @@ paths:
content: content:
text/plain: text/plain:
example: my-note example: my-note
/notes/{note}/media:
get:
tags: [ note, media ]
summary: Get list of files uploaded to the note
operationId: getOwnMedia
responses:
'200':
description:
content:
application/json:
schema:
type: array
items:
"$ref": "#/components/schemas/MediaUpload"
/media: /media:
post: post:
tags: tags:
@ -828,6 +856,22 @@ components:
description: The array that contains history objects. description: The array that contains history objects.
items: items:
"$ref": "#/components/schemas/HistoryObject" "$ref": "#/components/schemas/HistoryObject"
MediaUpload:
type: object
properties:
note:
type: string
description: ID of the note the file was uploaded to
user:
type: string
description: username of the user who uploaded the file
url:
type: string
description: URL of the file
createdAt:
type: string
format: date-time
description: Date when the file was upladed
examples: examples:
markdownExample: markdownExample:
value: '# Some header\nSome normal text. **Some bold text**' value: '# Some header\nSome normal text. **Some bold text**'