Merge pull request #544 from codimd/public-api-uploads

This commit is contained in:
David Mehren 2020-10-31 20:24:03 +01:00 committed by GitHub
commit f9f596c0d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,11 +93,11 @@ paths:
"$ref": "#/components/schemas/HistoryUpdate" "$ref": "#/components/schemas/HistoryUpdate"
responses: responses:
'200': '200':
description: The new history. description: The new history object.
content: content:
application/json: application/json:
schema: schema:
"$ref": "#/components/schemas/HistoryObject" "$ref": "#/components/schemas/History"
'401': '401':
"$ref": "#/components/responses/UnauthorizedError" "$ref": "#/components/responses/UnauthorizedError"
'404': '404':
@ -150,6 +150,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:
@ -158,8 +172,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.
@ -458,6 +472,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:
@ -869,6 +897,22 @@ components:
pinned: pinned:
type: boolean type: boolean
description: Whether the user has pinned this note. description: Whether the user has pinned this note.
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**'