diff --git a/api.yaml b/api.yaml index 2108278..386e9bb 100644 --- a/api.yaml +++ b/api.yaml @@ -154,37 +154,13 @@ paths: /api/upload: post: - summary: "Uploads a new article" + summary: Uploads a new article requestBody: required: true content: application/json: schema: - type: object - properties: - title: - type: string - description: "Name of the article. Must be unique" - summary: - type: string - description: A short overview summary of the article - authors: - type: array - items: - $ref: '#/components/schemas/Author' - description: List of additional author who contributed to the article. The author which sends this request is automatically added as (main) author - image: - type: string - description: Link to a preview image - nullable: true - tags: - type: array - description: Tags the article should have. If the tag does not exist, a new one is created automatically - items: - $ref: '#/components/schemas/Tag' - content: - type: string - description: The article itself, formatted as markdown + $ref: '#/components/schemas/Article' security: - cookie: [] responses: @@ -206,6 +182,66 @@ paths: application/json: schema: $ref: '#/components/schemas/ApiError' + + /api/edit: + post: + summary: Edit an already existing article + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Article' + security: + - cookie: [] + responses: + 200: + description: The article was edited + content: + application/json: + schema: + $ref: '#/components/schemas/ArticleSummary' + 401: + description: Not authorized + content: + application/json: + schema: + $ref: '#/components/schemas/ApiError' + 409: + description: A article with the same title already exists + content: + application/json: + schema: + $ref: '#/components/schemas/ApiError' + + /api/delete: + post: + summary: Deletes an article + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: number + description: ID of the article to delete + security: + - cookie: [] + responses: + 200: + description: The article was edited + content: + application/json: + schema: + $ref: '#/components/schemas/ArticleSummary' + 401: + description: Not authorized + content: + application/json: + schema: + $ref: '#/components/schemas/ApiError' components: schemas: @@ -215,6 +251,36 @@ components: message: type: string description: Error message + Article: + type: object + properties: + title: + type: string + description: "Name of the article. Must be unique" + summary: + type: string + description: A short overview summary of the article + authors: + type: array + items: + $ref: '#/components/schemas/Author' + description: List of additional author who contributed to the article. The author which sends this request is automatically added as (main) author + image: + type: string + description: Link to a preview image + nullable: true + tags: + type: array + description: Tags the article should have. If the tag does not exist, a new one is created automatically + items: + $ref: '#/components/schemas/Tag' + link: + type: string + description: The link name (last path of the url) which redirects to the article + nullable: true + content: + type: string + description: The article itself, formatted as markdown ArticleSummary: type: object properties: @@ -237,6 +303,12 @@ components: type: array items: $ref: '#/components/schemas/Tag' + created: + type: string + description: A RFC3339 formatted date when the article was created + modified: + type: string + description: A RFC3339 formatted date when the article was modified link: type: string description: Link to the article itself