swagger: new comment endpoint.

master
ALI Hamza 2020-09-10 21:01:31 +07:00
parent bf9528ad2b
commit 0010525760
Signed by: hamza
GPG Key ID: 22473A32291F8CB6
1 changed files with 55 additions and 14 deletions

@ -92,7 +92,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/User'
/users/{username}/posts:
get:
tags:
@ -124,12 +123,11 @@ paths:
$ref: '#/components/responses/Unprocessable'
500:
$ref: '#/components/responses/ServerError'
/users/{username}/comments:
get:
tags:
- User Endpoints
- Comments Endpoints
- Comment Endpoints
parameters:
- name: username
required: true
@ -161,7 +159,7 @@ paths:
get:
tags:
- Post Endpoints
summary: Get a list of paginated posts
summary: Get a list of paginated posts.
description: The items retrieved will always show newest first.
parameters:
- name: filter
@ -188,23 +186,22 @@ paths:
$ref: '#/components/responses/Unprocessable'
500:
$ref: '#/components/responses/ServerError'
/posts/new:
post:
tags:
- Post Endpoints
security:
- token: [ ]
summary: Create a new post
description: This endpoint will take information that new posts require and then create a new entry that will be submitted to the website.
summary: Submit a new comment.
description: This endpoint will take information that new comments require, a post ID, and ssubmits a comment to a post.
requestBody:
description: Submit a new post with this endpoint.
required: true
content:
application/json:
schema:
required:
- title
- content
- parent
properties:
title:
description: The title of the post created
@ -232,7 +229,6 @@ paths:
$ref: '#/components/responses/Unprocessable'
500:
$ref: '#/components/responses/ServerError'
/post/{id}:
get:
tags:
@ -267,12 +263,11 @@ paths:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/ServerError'
/post/{id}/upvote:
post:
tags:
- Post Endpoints
summary: Upvote a post
summary: Upvote a post.
description: Add an upvote to a specified post. If you have already upvoted a point, it is retracted.
security:
- token: []
@ -296,7 +291,6 @@ paths:
$ref: '#/components/responses/NotFound'
500:
$ref: '#/components/responses/ServerError'
/post/{id}/downvote:
post:
tags:
@ -326,6 +320,53 @@ paths:
500:
$ref: '#/components/responses/ServerError'
/comments/new:
post:
tags:
- Comment Endpoints.
security:
- token: [ ]
summary: Submit a comment.
description: This endpoint will take information that new posts require and then create a new entry that will be submitted to the website.
requestBody:
description: Submit a new post with this endpoint.
required: true
content:
application/json:
schema:
required:
- content
- post_id
properties:
content:
description: The message of the comment
type: string
post_id:
description: The id of the post the comment belongs to.
parent_id:
description: The parent comment. If not provided, interpreted as a top-level comment.
example:
content: No one cares about arch!
post_id: a1b2c3d4
responses:
200:
description: The created post ID
content:
application/json:
schema:
type: object
properties:
id:
type: string
400:
$ref: '#/components/responses/MalformedBody'
401:
$ref: '#/components/responses/InvalidToken'
422:
$ref: '#/components/responses/Unprocessable'
500:
$ref: '#/components/responses/ServerError'
components:
parameters:
AfterParam: