From 7563eb703dc82ad60695c51f1926dedcba2d0eff Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sat, 24 Oct 2020 21:48:29 +0200 Subject: [PATCH] Public API: Add routes to get uploads by user or note Co-authored-by: Yannick Bungers Signed-off-by: David Mehren --- docs/dev/public_api.yml | 48 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/dev/public_api.yml b/docs/dev/public_api.yml index fecc46375..53c823743 100644 --- a/docs/dev/public_api.yml +++ b/docs/dev/public_api.yml @@ -148,6 +148,20 @@ paths: "$ref": "#/components/schemas/NoteMetadata" '401': "$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: post: tags: @@ -156,8 +170,8 @@ paths: operationId: createNoteFromMarkdown description: A random id will be assigned and the content will equal to the body of the received HTTP-request. security: - - bearerAuth: [] - - {} + - bearerAuth: [ ] + - { } requestBody: required: false description: The content of the note to be imported as markdown. @@ -454,6 +468,20 @@ paths: content: text/plain: 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: post: tags: @@ -828,6 +856,22 @@ components: description: The array that contains history objects. items: "$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: markdownExample: value: '# Some header\nSome normal text. **Some bold text**'