165 lines
4.6 KiB
YAML
165 lines
4.6 KiB
YAML
categories:
|
|
get:
|
|
tags:
|
|
- categories
|
|
summary: 获取分类列表
|
|
operationId: listCategories
|
|
parameters:
|
|
- $ref: '../components/parameters.yaml#/Page'
|
|
- $ref: '../components/parameters.yaml#/PerPage'
|
|
- $ref: '../components/parameters.yaml#/Language'
|
|
- $ref: '../components/parameters.yaml#/Sort'
|
|
responses:
|
|
'200':
|
|
description: 成功获取分类列表
|
|
content:
|
|
application/json:
|
|
schema:
|
|
allOf:
|
|
- $ref: '../components/schemas.yaml#/Response'
|
|
- type: object
|
|
properties:
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '../components/schemas.yaml#/Category'
|
|
post:
|
|
tags:
|
|
- categories
|
|
summary: 创建新分类
|
|
operationId: createCategory
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- contents
|
|
properties:
|
|
contents:
|
|
type: array
|
|
items:
|
|
$ref: '../components/schemas.yaml#/CategoryContent'
|
|
responses:
|
|
'201':
|
|
description: 分类创建成功
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
$ref: '../components/schemas.yaml#/Category'
|
|
'401':
|
|
$ref: '../components/responses.yaml#/Unauthorized'
|
|
'403':
|
|
$ref: '../components/responses.yaml#/Forbidden'
|
|
'422':
|
|
$ref: '../components/responses.yaml#/ValidationError'
|
|
|
|
category_slug:
|
|
parameters:
|
|
- $ref: '../components/parameters.yaml#/Slug'
|
|
get:
|
|
tags:
|
|
- categories
|
|
summary: 获取分类详情
|
|
operationId: getCategory
|
|
parameters:
|
|
- $ref: '../components/parameters.yaml#/Language'
|
|
responses:
|
|
'200':
|
|
description: 成功获取分类详情
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
$ref: '../components/schemas.yaml#/Category'
|
|
'404':
|
|
$ref: '../components/responses.yaml#/NotFound'
|
|
put:
|
|
tags:
|
|
- categories
|
|
summary: 更新分类
|
|
operationId: updateCategory
|
|
parameters:
|
|
- $ref: '../components/parameters.yaml#/Slug'
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
contents:
|
|
type: array
|
|
items:
|
|
$ref: '../components/schemas.yaml#/CategoryContent'
|
|
responses:
|
|
'200':
|
|
description: 分类更新成功
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
data:
|
|
$ref: '../components/schemas.yaml#/Category'
|
|
'401':
|
|
$ref: '../components/responses.yaml#/Unauthorized'
|
|
'403':
|
|
$ref: '../components/responses.yaml#/Forbidden'
|
|
'404':
|
|
$ref: '../components/responses.yaml#/NotFound'
|
|
'422':
|
|
$ref: '../components/responses.yaml#/ValidationError'
|
|
delete:
|
|
tags:
|
|
- categories
|
|
summary: 删除分类
|
|
operationId: deleteCategory
|
|
parameters:
|
|
- $ref: '../components/parameters.yaml#/Slug'
|
|
responses:
|
|
'204':
|
|
description: 分类删除成功
|
|
'401':
|
|
$ref: '../components/responses.yaml#/Unauthorized'
|
|
'403':
|
|
$ref: '../components/responses.yaml#/Forbidden'
|
|
'404':
|
|
$ref: '../components/responses.yaml#/NotFound'
|
|
|
|
category_posts:
|
|
parameters:
|
|
- $ref: '../components/parameters.yaml#/Slug'
|
|
get:
|
|
tags:
|
|
- categories
|
|
summary: 获取分类下的文章列表
|
|
operationId: getCategoryPosts
|
|
parameters:
|
|
- $ref: '../components/parameters.yaml#/Page'
|
|
- $ref: '../components/parameters.yaml#/PerPage'
|
|
- $ref: '../components/parameters.yaml#/Language'
|
|
- $ref: '../components/parameters.yaml#/Sort'
|
|
- $ref: '../components/parameters.yaml#/Status'
|
|
responses:
|
|
'200':
|
|
description: 成功获取文章列表
|
|
content:
|
|
application/json:
|
|
schema:
|
|
allOf:
|
|
- $ref: '../components/schemas.yaml#/Response'
|
|
- type: object
|
|
properties:
|
|
data:
|
|
type: array
|
|
items:
|
|
$ref: '../components/schemas.yaml#/Post'
|
|
'404':
|
|
$ref: '../components/responses.yaml#/NotFound'
|