diff --git a/api.yaml b/api.yaml index 73553da..03de011 100644 --- a/api.yaml +++ b/api.yaml @@ -5,8 +5,7 @@ components: large: type: string medium: - examples: - - sai + example: sai type: string small: type: string @@ -16,6 +15,58 @@ components: - large title: Avatar type: object + BaseEpisodeComment: + properties: + content: + type: string + createdAt: + type: integer + creatorID: + type: integer + epID: + type: integer + id: + type: integer + relatedID: + type: integer + state: + type: integer + user: + anyOf: + - properties: + avatar: + properties: + large: + type: string + medium: + type: string + small: + type: string + required: + - small + - medium + - large + type: object + id: + type: integer + nickname: + type: string + required: + - id + - nickname + - avatar + type: object + - type: 'null' + required: + - id + - epID + - creatorID + - relatedID + - createdAt + - content + - state + - user + type: object BasicReply: properties: createdAt: @@ -91,18 +142,77 @@ components: - permission type: object type: object + EpisodeComments: + allOf: + - properties: + content: + type: string + createdAt: + type: integer + creatorID: + type: integer + epID: + type: integer + id: + type: integer + relatedID: + type: integer + state: + type: integer + user: + anyOf: + - properties: + avatar: + properties: + large: + type: string + medium: + type: string + small: + type: string + required: + - small + - medium + - large + type: object + id: + type: integer + nickname: + type: string + required: + - id + - nickname + - avatar + type: object + - type: 'null' + required: + - id + - epID + - creatorID + - relatedID + - createdAt + - content + - state + - user + type: object + - properties: + replies: + items: + $ref: '#/components/schemas/BaseEpisodeComment' + type: array + required: + - replies + type: object + type: object EpisodeWikiInfo: properties: date: description: YYYY-MM-DD - examples: - - '2022-02-02' + example: '2022-02-02' pattern: ^\d{4}-\d{2}-\d{2}$ type: string duration: - examples: - - '24:53' - - 24m52s + example: '24:53' type: string ep: type: number @@ -198,8 +308,7 @@ components: large: type: string medium: - examples: - - sai + example: sai type: string small: type: string @@ -297,10 +406,10 @@ components: - createdAt type: object LoginRequestBody: - examples: - - cf-turnstile-response: 10000000-aaaa-bbbb-cccc-000000000001 - email: treeholechan@gmail.com - password: lovemeplease + example: + cf-turnstile-response: 10000000-aaaa-bbbb-cccc-000000000001 + email: treeholechan@gmail.com + password: lovemeplease properties: cf-turnstile-response: minLength: 1 @@ -332,8 +441,7 @@ components: large: type: string medium: - examples: - - sai + example: sai type: string small: type: string @@ -344,20 +452,17 @@ components: title: Avatar type: object id: - examples: - - 1 + example: 1 type: integer nickname: - examples: - - Sai🖖 + example: Sai🖖 type: string sign: type: string user_group: type: integer username: - examples: - - sai + example: sai type: string required: - id @@ -466,45 +571,80 @@ components: - state - reactions type: object + Subject: + properties: + date: + type: string + id: + type: integer + image: + type: string + infobox: + type: string + locked: + type: boolean + name: + type: string + nsfw: + type: boolean + platform: + type: integer + redirect: + type: integer + summary: + type: string + typeID: + type: integer + required: + - id + - name + - typeID + - infobox + - platform + - summary + - nsfw + - date + - redirect + - locked + - image + type: object SubjectEdit: - examples: - - infobox: |- - {{Infobox animanga/TVAnime - |中文名= 沙盒 - |别名={ - } - |话数= 7 - |放送开始= 0000-10-06 - |放送星期= - |官方网站= - |播放电视台= - |其他电视台= - |播放结束= - |其他= - |Copyright= - |平台={ - [龟壳] - [Xbox Series S] - [Xbox Series X] - [Xbox Series X/S] - [PC] - [Xbox Series X|S] - } - }} - name: 沙盒 - nsfw: false - platform: 0 - summary: |- - 本条目是一个沙盒,可以用于尝试bgm功能。 + example: + infobox: |- + {{Infobox animanga/TVAnime + |中文名= 沙盒 + |别名={ + } + |话数= 7 + |放送开始= 0000-10-06 + |放送星期= + |官方网站= + |播放电视台= + |其他电视台= + |播放结束= + |其他= + |Copyright= + |平台={ + [龟壳] + [Xbox Series S] + [Xbox Series X] + [Xbox Series X/S] + [PC] + [Xbox Series X|S] + } + }} + name: 沙盒 + nsfw: false + platform: 0 + summary: |- + 本条目是一个沙盒,可以用于尝试bgm功能。 - 普通维基人可以随意编辑条目信息以及相关关联查看编辑效果,但是请不要完全删除沙盒说明并且不要关联非沙盒条目/人物/角色。 + 普通维基人可以随意编辑条目信息以及相关关联查看编辑效果,但是请不要完全删除沙盒说明并且不要关联非沙盒条目/人物/角色。 - https://bgm.tv/group/topic/366812#post_1923517 + https://bgm.tv/group/topic/366812#post_1923517 properties: date: - examples: - - '0000-00-00' - - '2007-01-30' + example: '0000-00-00' pattern: ^\d{4}-\d{2}-\d{2}$ type: string infobox: @@ -526,6 +666,56 @@ components: - nsfw - summary type: object + SubjectInterestComment: + properties: + list: + items: + properties: + comment: + type: string + rate: + type: integer + updatedAt: + type: integer + user: + anyOf: + - properties: + avatar: + properties: + large: + type: string + medium: + type: string + small: + type: string + required: + - small + - medium + - large + type: object + id: + type: integer + nickname: + type: string + required: + - id + - nickname + - avatar + type: object + - type: 'null' + required: + - user + - rate + - comment + - updatedAt + type: object + type: array + total: + type: integer + required: + - total + - list + type: object SubjectType: anyOf: - enum: @@ -586,8 +776,7 @@ components: large: type: string medium: - examples: - - sai + example: sai type: string small: type: string @@ -598,20 +787,17 @@ components: title: Avatar type: object id: - examples: - - 1 + example: 1 type: integer nickname: - examples: - - Sai🖖 + example: Sai🖖 type: string sign: type: string user_group: type: integer username: - examples: - - sai + example: sai type: string required: - id @@ -646,9 +832,9 @@ components: title: Topic type: object TopicCreation: - examples: - - content: topic content - title: topic title + example: + content: topic content + title: topic title properties: text: description: bbcode @@ -667,10 +853,12 @@ components: type: integer creator: $ref: '#/components/schemas/User' - group: - $ref: '#/components/schemas/Group' id: type: integer + parent: + anyOf: + - $ref: '#/components/schemas/Group' + - $ref: '#/components/schemas/Subject' reactions: items: $ref: '#/components/schemas/Reaction' @@ -687,7 +875,7 @@ components: type: string required: - id - - group + - parent - creator - title - text @@ -703,8 +891,7 @@ components: large: type: string medium: - examples: - - sai + example: sai type: string small: type: string @@ -715,20 +902,17 @@ components: title: Avatar type: object id: - examples: - - 1 + example: 1 type: integer nickname: - examples: - - Sai🖖 + example: Sai🖖 type: string sign: type: string user_group: type: integer username: - examples: - - sai + example: sai type: string required: - id @@ -757,6 +941,10 @@ components: in: cookie name: chiiNextSessionID type: apiKey + HTTPBearer: + description: 使用 [demo](/demo/login) 登录后创建个人令牌 + scheme: Bearer + type: http info: description: >- 关于订阅通知的 socket.io 相关的文档在 @@ -1603,9 +1791,380 @@ paths: summary: 获取未读通知 tags: - user + /p1/subjects/-/episode/{episodeID}/comments: + get: + operationId: getSubjectEpisodeComments + parameters: + - example: 1075440 + in: path + name: episodeID + required: true + schema: + minimum: 0 + type: integer + responses: + '200': + content: + application/json: + schema: + items: + allOf: + - properties: + content: + type: string + createdAt: + type: integer + creatorID: + type: integer + epID: + type: integer + id: + type: integer + relatedID: + type: integer + state: + type: integer + user: + anyOf: + - properties: + avatar: + properties: + large: + type: string + medium: + type: string + small: + type: string + required: + - small + - medium + - large + type: object + id: + type: integer + nickname: + type: string + required: + - id + - nickname + - avatar + type: object + - type: 'null' + required: + - id + - epID + - creatorID + - relatedID + - createdAt + - content + - state + - user + type: object + - properties: + replies: + items: + $ref: '#/components/schemas/BaseEpisodeComment' + type: array + required: + - replies + type: object + type: object + type: array + description: Default Response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 意料之外的服务器错误 + description: 意料之外的服务器错误 + security: + - CookiesSession: [] + summary: 获取条目的剧集评论 + tags: + - subject + /p1/subjects/-/posts/{postID}: + delete: + operationId: deleteSubjectPost + parameters: + - example: 2092074 + in: path + name: postID + required: true + schema: + type: integer + responses: + '200': + content: + application/json: + schema: + properties: {} + type: object + description: Default Response + '401': + content: + application/json: + examples: + NOT_ALLOWED: + value: + code: NOT_ALLOWED + error: Unauthorized + message: you don't have permission to delete this post + statusCode: 401 + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Default Response + '404': + content: + application/json: + examples: + NOT_FOUND: + value: + code: NOT_FOUND + error: Not Found + message: post not found + statusCode: 404 + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Default Response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 意料之外的服务器错误 + description: 意料之外的服务器错误 + security: + - CookiesSession: [] + summary: 删除自己创建的条目讨论版回复 + tags: + - subject + get: + operationId: getSubjectPost + parameters: + - example: 2092074 + in: path + name: postID + required: true + schema: + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GroupReply' + description: Default Response + '404': + content: + application/json: + examples: + NOT_FOUND: + value: + code: NOT_FOUND + error: Not Found + message: post not found + statusCode: 404 + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Default Response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 意料之外的服务器错误 + description: 意料之外的服务器错误 + security: + - CookiesSession: [] + summary: 获取条目讨论版回复 + tags: + - subject + put: + operationId: editSubjectPost + parameters: + - example: 2092074 + in: path + name: postID + required: true + schema: + type: integer + requestBody: + content: + application/json: + example: + text: new post contents + schema: + properties: + text: + minLength: 1 + type: string + required: + - text + type: object + required: true + responses: + '200': + content: + application/json: + schema: + properties: {} + type: object + description: Default Response + '401': + content: + application/json: + examples: + NOT_ALLOWED: + value: + code: NOT_ALLOWED + error: Unauthorized + message: you don't have permission to edit reply + statusCode: 401 + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Default Response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 意料之外的服务器错误 + description: 意料之外的服务器错误 + security: + - CookiesSession: [] + summary: 编辑自己创建的条目讨论版回复 + tags: + - subject + /p1/subjects/-/topics/{id}: + get: + operationId: getSubjectTopicDetail + parameters: + - example: 1 + in: path + name: id + required: true + schema: + minimum: 0 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TopicDetail' + description: Default Response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 意料之外的服务器错误 + description: 意料之外的服务器错误 + security: + - CookiesSession: [] + summary: 获取帖子列表 + tags: + - subject + /p1/subjects/-/topics/{topicID}: + put: + operationId: editSubjectTopic + parameters: + - example: 371602 + in: path + name: topicID + required: true + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TopicCreation' + responses: + '200': + content: + application/json: + schema: + properties: {} + type: object + description: Default Response + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Default Response + '401': + content: + application/json: + examples: + NOT_ALLOWED: + value: + code: NOT_ALLOWED + error: Unauthorized + message: you don't have permission to edit a topic + statusCode: 401 + schema: + $ref: '#/components/schemas/ErrorResponse' + description: Default Response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 意料之外的服务器错误 + description: 意料之外的服务器错误 + security: + - CookiesSession: [] + summary: 编辑自己创建的条目讨论版 + tags: + - subject + /p1/subjects/{subjectID}/comments: + get: + operationId: subjectComments + parameters: + - in: query + name: limit + required: false + schema: + default: 20 + type: integer + - in: query + name: offset + required: false + schema: + default: 0 + minimum: 0 + type: integer + - example: 8 + in: path + name: subjectID + required: true + schema: + minimum: 0 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SubjectInterestComment' + description: Default Response + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + description: 意料之外的服务器错误 + description: 意料之外的服务器错误 + security: + - CookiesSession: [] + summary: 获取条目的吐槽箱 + tags: + - subject /p1/subjects/{subjectID}/topics: get: - description: 获取帖子列表 operationId: getSubjectTopicsBySubjectId parameters: - in: query @@ -1665,8 +2224,9 @@ paths: $ref: '#/components/schemas/ErrorResponse' description: 意料之外的服务器错误 description: 意料之外的服务器错误 + summary: 获取条目讨论版列表 tags: - - topic + - subject /p1/wiki/ep/{episodeID}: get: operationId: getEpisodeWikiInfo