diff --git a/README.md b/README.md index e69de29..90314d5 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,777 @@ +--- +title: 油二黑子站 +language_tabs: + - shell: Shell + - http: HTTP + - javascript: JavaScript + - ruby: Ruby + - python: Python + - php: PHP + - java: Java + - go: Go +toc_footers: [] +includes: [] +search: true +code_clipboard: true +highlight_theme: darkula +headingLevel: 2 +generator: "@tarslib/widdershins v4.0.23" + +--- + +# 油二黑子站 + +Base URLs: + +* 正式环境: https://ez-api.mei.lv:22333 + +# Authentication + +# public + +## GET 获取表白墙内容和评论 + +GET /public/lovewall + +> 返回示例 + +```json +[ + { + "id": "22", + "author": "Q.", + "avatar": "/placeholder.svg?height=40&width=40", + "content": "高一十二班张惠娜我喜欢你?", + "likes": 0, + "comments": [] + }, + { + "id": "13", + "author": "ฅ՞•ﻌ•՞ฅ", + "avatar": "/placeholder.svg?height=40&width=40", + "content": "2024级11班某女同学(?老鼠)...", + "likes": 3, + "comments": [ + { + "id": "14", + "author": "ฅ՞•ﻌ•՞ฅ", + "content": "有知情人传言说该饼已放了得快有二十多天\r\n其本人说才放了3天,还说自己吃了,但值得考究(本发帖人不信)" + }, + { + "id": "15", + "author": "ฅ՞•ﻌ•՞ฅ", + "content": "受害同学颇多,8班与12班颇多" + }, + { + "id": "16", + "author": "626817", + "content": "???" + } + ] + } +] +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +状态码 **200** + +|名称|类型|必选|约束|中文名|说明| +|---|---|---|---|---|---| +|» id|string|true|none||none| +|» author|string|true|none||none| +|» avatar|string|true|none||none| +|» content|string|true|none||none| +|» likes|integer|true|none||none| +|» comments|[object]|true|none||none| +|»» id|string|true|none||none| +|»» author|string|true|none||none| +|»» content|string|true|none||none| + +## GET 获取首页信息 + +GET /public/homepage + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## GET 获取用户公开信息 + +GET /public/users + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|id|query|string| 否 |ID 编号| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## GET 获取指定文章内容 + +GET /public/article + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|id|query|number| 否 |ID 编号| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## GET 一言 + +GET /public/onesay + +> 返回示例 + +```json +{ + "quote": "编程本身虽然是一种智力活动,但是中国的现实却更像一种体力劳动", + "source": "《未来世界的幸存者》" +} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +状态码 **200** + +|名称|类型|必选|约束|中文名|说明| +|---|---|---|---|---|---| +|» quote|string|true|none||一言| +|» source|string|true|none||来源/作者| + +## GET 点名 + +GET /public/named + +如果你是老师,欢迎使用这个功能:) +放心,数据库里没我名字doge +本功能会计算指定/随机缘分的hash并选取姓名hash与此hash的hash距离最近的一名同学 +随机缘分会请求hitokoto一言,计算返还句子的hash +公平公正:) + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|grade|query|number| 否 |年级| +|class|query|number| 否 |班级| +|named_mode|query|string| 否 |点名模式(随机缘分/指定缘分)| +|fate|query|string| 否 |指定的缘分| + +#### 枚举值 + +|属性|值| +|---|---| +|grade|1| +|grade|2| +|grade|3| +|class|1| +|class|2| +|class|3| +|class|4| +|class|5| +|class|6| +|class|7| +|class|8| +|class|9| +|class|10| +|class|11| +|class|12| +|class|13| +|class|14| +|class|15| +|class|16| +|class|17| +|class|18| +|class|19| +|class|20| +|class|21| +|named_mode|random| +|named_mode|designate| + +> 返回示例 + +> 200 Response + +```json +{ + "student": "string" +} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +状态码 **200** + +|名称|类型|必选|约束|中文名|说明| +|---|---|---|---|---|---| +|» student|string|true|none|学生姓名|none| + +# user + +## GET 获取用户所有数据 + +GET /user/info + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|id|query|number| 否 |ID 编号| +|x-api-key|header|string| 否 |API key| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## PATCH 设置用户数据 + +PATCH /user/info + +> Body 请求参数 + +```yaml +username: "" +avatar_mode: "" +avatar_url: "" +qq_number: "" + +``` + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|x-api-key|header|string| 否 |API key| +|body|body|object| 否 |none| +|» username|body|string| 否 |用户名| +|» avatar_mode|body|string| 否 |头像模式(使用qq头像/自定义链接)| +|» avatar_url|body|string¦null| 否 |头像链接(自定义链接模式)| +|» qq_number|body|string| 否 |QQ号| + +#### 枚举值 + +|属性|值| +|---|---| +|» avatar_mode|qq| +|» avatar_mode|url| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +# lovewall + +## POST 发表表白 + +POST /lovewall/messages + +> Body 请求参数 + +```yaml +content: "" + +``` + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|x-api-key|header|string| 否 |none| +|body|body|object| 否 |none| +|» content|body|string| 否 |内容| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## PATCH 修改表白信息 + +PATCH /lovewall/messages + +> Body 请求参数 + +```yaml +content: "" + +``` + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|x-api-key|header|string| 否 |none| +|body|body|object| 否 |none| +|» content|body|string| 否 |内容| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## DELETE 删除指定表白 + +DELETE /lovewall/messages + +同时会删除该表白下的所有评论 + +> Body 请求参数 + +```yaml +id: "" + +``` + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|x-api-key|header|string| 否 |none| +|body|body|object| 否 |none| +|» id|body|string| 否 |ID 编号| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +# admin + +## GET 获取管理页面所有信息 + +GET /admin/all + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|x-api-key|header|string| 否 |none| + +> 返回示例 + +> 200 Response + +```json +{ + "status": "string" +} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +状态码 **200** + +|名称|类型|必选|约束|中文名|说明| +|---|---|---|---|---|---| +|» status|string|true|none||状态| + +## POST 创建新文章 + +POST /admin/articles + +> Body 请求参数 + +```yaml +title: "" +category: "" +content: "" + +``` + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|x-api-key|header|string| 否 |none| +|body|body|object| 否 |none| +|» title|body|string| 否 |名称| +|» category|body|string| 否 |分组| +|» content|body|string| 否 |内容| + +> 返回示例 + +> 200 Response + +```json +{ + "id": "string" +} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +状态码 **200** + +|名称|类型|必选|约束|中文名|说明| +|---|---|---|---|---|---| +|» id|string|true|none||ID 编号| + +## PATCH 修改指定文章 + +PATCH /admin/articles + +> Body 请求参数 + +```yaml +id: "" +title: "" +content: "" + +``` + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|x-api-key|header|string| 否 |none| +|body|body|object| 否 |none| +|» id|body|string| 否 |ID 编号| +|» title|body|string| 否 |none| +|» content|body|string| 否 |内容| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## DELETE 删除指定文章 + +DELETE /admin/articles + +同时会删除该文章下的所有评论 + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|id|query|string| 否 |ID 编号| +|x-api-key|header|string| 否 |none| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## DELETE 删除指定评论 + +DELETE /admin/comment + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|id|query|string| 否 |ID 编号| +|x-api-key|header|string| 否 |none| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## DELETE 删除指定表白 + +DELETE /admin/lovewall + +同时会删除该表白下的所有评论 + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|id|query|string| 否 |ID 编号| +|x-api-key|header|string| 否 |none| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +# comment + +## POST 创建评论 + +POST /comment/messages + +> Body 请求参数 + +```yaml +category: "" +comment_origin: 2 +content: "" + +``` + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|x-api-key|header|string| 否 |none| +|body|body|object| 否 |none| +|» category|body|string| 否 |表白墙评论/文章评论| +|» comment_origin|body|number| 否 |评论的主体id| +|» content|body|string| 否 |内容| + +#### 枚举值 + +|属性|值| +|---|---| +|» category|lovewall| +|» category|article| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## PATCH 修改指定评论 + +PATCH /comment/messages + +> Body 请求参数 + +```yaml +id: "" +content: "" + +``` + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|x-api-key|header|string| 否 |none| +|body|body|object| 否 |none| +|» id|body|string| 否 |ID 编号| +|» content|body|string| 否 |内容| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +## DELETE 删除指定评论 + +DELETE /comment/messages + +### 请求参数 + +|名称|位置|类型|必选|说明| +|---|---|---|---|---| +|id|query|string| 否 |ID 编号| +|x-api-key|header|string| 否 |none| + +> 返回示例 + +> 200 Response + +```json +{} +``` + +### 返回结果 + +|状态码|状态码含义|说明|数据模型| +|---|---|---|---| +|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| + +### 返回数据结构 + +# 数据模型 +