285 lines
6.8 KiB
YAML
285 lines
6.8 KiB
YAML
openapi: 3.0.3
|
|
info:
|
|
title: Bluewhale
|
|
description: 'This is API specifications for bluewhale site'
|
|
version: 1.0.0
|
|
servers:
|
|
- url: http://127.0.0.1:4010
|
|
paths:
|
|
"/api/v1/me":
|
|
get:
|
|
summary: get current user's profile
|
|
responses:
|
|
'200':
|
|
description: current user
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
$ref: "#/components/schemas/User"
|
|
code:
|
|
type: integer
|
|
"/api/v1/login":
|
|
options:
|
|
summary: get csrf token
|
|
responses:
|
|
'200':
|
|
description: options
|
|
post:
|
|
summary: login
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/LoginForm"
|
|
responses:
|
|
'200':
|
|
description: success login
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
$ref: "#/components/schemas/User"
|
|
code:
|
|
type: integer
|
|
"/api/v1/logout":
|
|
post:
|
|
summary: logout
|
|
responses:
|
|
'200':
|
|
description: success logout
|
|
"/api/v1/send-verification":
|
|
post:
|
|
summary: send verification mail
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/SendVerificationForm"
|
|
responses:
|
|
'200':
|
|
description: success send verification
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
type: integer
|
|
code:
|
|
type: integer
|
|
"/api/v1/verify/{token}":
|
|
get:
|
|
summary: get verified email from token
|
|
parameters:
|
|
- in: path
|
|
name: token
|
|
schema:
|
|
type: string
|
|
required: true
|
|
description: string token
|
|
responses:
|
|
'200':
|
|
description: success get verified token
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
type: string
|
|
format: email
|
|
code:
|
|
type: integer
|
|
"/api/v1/register":
|
|
post:
|
|
summary: register user by token
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
token:
|
|
type: string
|
|
password:
|
|
type: string
|
|
responses:
|
|
'201':
|
|
description: success get verified token
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
$ref: "#/components/schemas/User"
|
|
code:
|
|
type: integer
|
|
"/api/v1/articles":
|
|
get:
|
|
summary: get list of articles
|
|
responses:
|
|
'200':
|
|
description: success get articles
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/Article"
|
|
code:
|
|
type: integer
|
|
post:
|
|
summary: post one article
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Article"
|
|
responses:
|
|
'201':
|
|
description: success post one article
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
$ref: "#/components/schemas/Article"
|
|
code:
|
|
type: integer
|
|
"/api/v1/articles/{pk}":
|
|
summary: fetch/edit/delete one article
|
|
parameters:
|
|
- in: path
|
|
name: pk
|
|
schema:
|
|
type: string
|
|
required: true
|
|
description: primary key
|
|
get:
|
|
summary: fetch one article
|
|
responses:
|
|
'200':
|
|
description: success get one article
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
$ref: "#/components/schemas/Article"
|
|
code:
|
|
type: integer
|
|
put:
|
|
summary: edit one article
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Article"
|
|
responses:
|
|
'200':
|
|
description: success edit one article
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Article"
|
|
delete:
|
|
summary: delete one article
|
|
responses:
|
|
'204':
|
|
description: success delete one article
|
|
components:
|
|
schemas:
|
|
CommonResponse: # common response which has data and code properties
|
|
type: object
|
|
properties:
|
|
data:
|
|
type: object
|
|
code:
|
|
type: integer
|
|
LoginForm:
|
|
type: object
|
|
properties:
|
|
email:
|
|
type: string
|
|
format: email
|
|
password:
|
|
type: string
|
|
format: password
|
|
SendVerificationForm:
|
|
type: object
|
|
properties:
|
|
email:
|
|
type: string
|
|
format: email
|
|
User:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
email:
|
|
type: string
|
|
format: email
|
|
phone:
|
|
type: string
|
|
nickname:
|
|
type: string
|
|
date_joined:
|
|
type: string
|
|
format: date-time
|
|
last_login:
|
|
type: string
|
|
format: date-time
|
|
last_login_ip:
|
|
type: string
|
|
format: ipv4
|
|
description:
|
|
type: string
|
|
groups:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/Group"
|
|
Group:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: integer
|
|
format: int64
|
|
minimum: 1
|
|
name:
|
|
type: string
|
|
Article:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: string
|
|
format: uuid
|
|
author:
|
|
type: string
|
|
format: email
|
|
title:
|
|
type: string
|
|
content:
|
|
type: string
|
|
created_at:
|
|
type: string
|
|
format: date-time
|
|
updated_at:
|
|
type: string
|
|
format: date-time
|
|
status:
|
|
type: integer
|
|
enum: [0,1,2]
|