tss-rocks/api/schemas/paths/categories.yaml
CDN 05ddc1f783
Some checks failed
Build Backend / Build Docker Image (push) Successful in 3m33s
Test Backend / test (push) Failing after 31s
[feature] migrate to monorepo
2025-02-21 00:49:20 +08:00

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'