swagger: add new post endpoint.

master
ALI Hamza 2020-09-10 07:31:34 +07:00
parent c098bccd16
commit 19795153de
Signed by: hamza
GPG Key ID: 22473A32291F8CB6
1 changed files with 49 additions and 4 deletions

@ -75,10 +75,10 @@ paths:
$ref: '#/components/responses/ServerError' $ref: '#/components/responses/ServerError'
/users/{username}: /users/{username}:
get: post:
tags: tags:
- User Endpoints - User Endpoints
summary: Get the information for a user summary: Get the information for a user.
parameters: parameters:
- name: username - name: username
required: true required: true
@ -97,7 +97,7 @@ paths:
post: post:
tags: tags:
- User Endpoints - User Endpoints
- Posts Endpoints - Post Endpoints
parameters: parameters:
- name: username - name: username
required: true required: true
@ -153,6 +153,50 @@ paths:
500: 500:
$ref: '#/components/responses/ServerError' $ref: '#/components/responses/ServerError'
/posts/new:
post:
tags:
- Post Endpoints
requestBody:
description: Submit a new post with this endpoint.
required: true
content:
application/json:
schema:
required:
- token
- title
properties:
token:
description: The access token.
title:
description: The title of the post created
type: string
description:
description: The body text of a post, optional.
example:
token: abcdef12345678901234
title: I use arch BTW.
description: Ladies, I'm waiting.
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: components:
requestBodies: requestBodies:
AuthCredentials: AuthCredentials:
@ -174,6 +218,7 @@ components:
type: string type: string
TokenRequest: TokenRequest:
description: The access token to identify a user. description: The access token to identify a user.
required: true
content: content:
application/json: application/json:
schema: schema:
@ -348,7 +393,7 @@ components:
type: object type: object
properties: properties:
reason: reason:
description: The cause of the error message description: The cause of the error message.
type: string type: string
code: code:
description: The HTTP error code value accompanying the error. description: The HTTP error code value accompanying the error.