|
|
|
@ -195,6 +195,8 @@ paths:
|
|
|
|
|
- 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.
|
|
|
|
|
requestBody:
|
|
|
|
|
description: Submit a new post with this endpoint.
|
|
|
|
|
required: true
|
|
|
|
@ -235,6 +237,8 @@ paths:
|
|
|
|
|
get:
|
|
|
|
|
tags:
|
|
|
|
|
- Post Endpoints
|
|
|
|
|
summary: Get information fora post.
|
|
|
|
|
description: Returns the post information and all comments for a particular post.
|
|
|
|
|
parameters:
|
|
|
|
|
- name: id
|
|
|
|
|
in: path
|
|
|
|
@ -259,6 +263,68 @@ paths:
|
|
|
|
|
type: array
|
|
|
|
|
items:
|
|
|
|
|
$ref: '#/components/schemas/Comment'
|
|
|
|
|
404:
|
|
|
|
|
$ref: '#/components/responses/NotFound'
|
|
|
|
|
500:
|
|
|
|
|
$ref: '#/components/responses/ServerError'
|
|
|
|
|
|
|
|
|
|
/post/{id}/upvote:
|
|
|
|
|
post:
|
|
|
|
|
tags:
|
|
|
|
|
- Post Endpoints
|
|
|
|
|
summary: Upvote a post
|
|
|
|
|
description: Add an upvote to a specified post. If you have already upvoted a point, it is retracted.
|
|
|
|
|
security:
|
|
|
|
|
- token: []
|
|
|
|
|
parameters:
|
|
|
|
|
- name: id
|
|
|
|
|
in: path
|
|
|
|
|
required: true
|
|
|
|
|
description: The post ID to upvote.
|
|
|
|
|
schema:
|
|
|
|
|
type: string
|
|
|
|
|
responses:
|
|
|
|
|
200:
|
|
|
|
|
description: Your upvote has successfully been registered.
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
type: object
|
|
|
|
|
401:
|
|
|
|
|
$ref: '#/components/responses/InvalidToken'
|
|
|
|
|
404:
|
|
|
|
|
$ref: '#/components/responses/NotFound'
|
|
|
|
|
500:
|
|
|
|
|
$ref: '#/components/responses/ServerError'
|
|
|
|
|
|
|
|
|
|
/post/{id}/downvote:
|
|
|
|
|
post:
|
|
|
|
|
tags:
|
|
|
|
|
- Post Endpoints
|
|
|
|
|
summary: Downvote a post
|
|
|
|
|
description: Add an downvote to a specified post. If you have already downvoted a point, it is retracted.
|
|
|
|
|
security:
|
|
|
|
|
- token: []
|
|
|
|
|
parameters:
|
|
|
|
|
- name: id
|
|
|
|
|
in: path
|
|
|
|
|
required: true
|
|
|
|
|
description: The post ID to downvote.
|
|
|
|
|
schema:
|
|
|
|
|
type: string
|
|
|
|
|
responses:
|
|
|
|
|
200:
|
|
|
|
|
description: Your downvote has successfully been registered.
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
type: object
|
|
|
|
|
401:
|
|
|
|
|
$ref: '#/components/responses/InvalidToken'
|
|
|
|
|
404:
|
|
|
|
|
$ref: '#/components/responses/NotFound'
|
|
|
|
|
500:
|
|
|
|
|
$ref: '#/components/responses/ServerError'
|
|
|
|
|
|
|
|
|
|
components:
|
|
|
|
|
parameters:
|
|
|
|
@ -341,6 +407,15 @@ components:
|
|
|
|
|
example:
|
|
|
|
|
reason: The token provided is invalid.
|
|
|
|
|
code: 401
|
|
|
|
|
NotFound:
|
|
|
|
|
description: The requested resource was not found.
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
$ref: '#/components/schemas/Error'
|
|
|
|
|
example:
|
|
|
|
|
reason: The specified resource does not exist.
|
|
|
|
|
code: 404
|
|
|
|
|
Unprocessable:
|
|
|
|
|
description: The request was valid, however some of the parameters have an invalid value.
|
|
|
|
|
content:
|
|
|
|
@ -419,6 +494,7 @@ components:
|
|
|
|
|
- title
|
|
|
|
|
- upvotes
|
|
|
|
|
- downvotes
|
|
|
|
|
- comments
|
|
|
|
|
- date_created
|
|
|
|
|
properties:
|
|
|
|
|
id:
|
|
|
|
@ -439,6 +515,9 @@ components:
|
|
|
|
|
downvotes:
|
|
|
|
|
description: The number of downvotes a post has.
|
|
|
|
|
type: integer
|
|
|
|
|
comments:
|
|
|
|
|
description: The number of comments available on a post.
|
|
|
|
|
type: integer
|
|
|
|
|
date_created:
|
|
|
|
|
description: The time at which this post was submitted.
|
|
|
|
|
type: string
|
|
|
|
|