| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-discussions.yaml
- get:
- summary: 列出某个对象上的话题
- tags:
- - discussions
- operationId: get_api_v3_discussions
- description: |-
- 只列话题(不含回复),删除了但还有回复的话题以墓碑出现(deleted_at 有值、内容为空)。
- 未登录看不到不公开的话题(discussion);basic 角色在自己无权管理的对象上只看得到
- 自己发起的不公开话题。各状态的数量与「能发起哪些类型」见 `GET /v3/discussions/summary`。
- 不传 type 时只列评论线程(discussion / qa / help / issue / glossary),批注与评估要显式
- type=note / commentary / assessment。
- 要一段经文(一章、一段段落区间)里的全部话题,用 `GET /v3/tipitaka-discussions/{channel}`。
- 实现:`V3\DiscussionController@index`
- security:
- - { }
- -
- bearerAuth: []
- parameters:
- -
- name: per_page
- in: query
- schema:
- type: integer
- default: 15
- description: '每页数量,最大 200'
- -
- name: target_type
- in: query
- schema:
- type: string
- enum:
- - sentence
- - wbw
- - article
- - term
- - task
- description: 挂靠对象的类型
- required: true
- -
- name: target_id
- in: query
- schema:
- type: string
- description: '挂靠对象的 uuid'
- required: true
- -
- name: type
- in: query
- schema:
- type: string
- enum:
- - discussion
- - qa
- - help
- - issue
- - glossary
- - note
- - commentary
- - assessment
- description: 类型,不传则只列评论线程
- -
- name: status
- in: query
- schema:
- type: string
- enum:
- - active
- - close
- description: 话题状态,不传则两种都要
- -
- name: severity
- in: query
- schema:
- type: string
- description: '严重程度(assessment 为评估方法),逗号分隔多选'
- example: 'error,warning'
- -
- name: sort
- in: query
- schema:
- type: string
- enum:
- - created_at
- - '-created_at'
- - updated_at
- - '-updated_at'
- default: '-created_at'
- description: '排序,前缀 - 表示倒序'
- -
- name: page
- in: query
- schema:
- type: integer
- default: 1
- description: 页码
- responses:
- 200:
- description: 成功
- content:
- application/json:
- schema:
- type: object
- properties:
- data:
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- target_type:
- type: string
- target_id:
- type: string
- parent_id:
- type: string
- nullable: true
- type:
- type: string
- severity:
- type: string
- nullable: true
- score:
- type: integer
- nullable: true
- status:
- type: string
- title:
- type: string
- nullable: true
- content:
- type: string
- nullable: true
- content_type:
- type: string
- body:
- type: array
- items: { $ref: '../../main.yaml#/components/schemas/MarkupNode' }
- description: 仅在部分查询口径下返回。
- summary:
- type: string
- description: 仅在部分查询口径下返回。
- tpl_id:
- type: string
- nullable: true
- pos_start:
- type: integer
- nullable: true
- pos_end:
- type: integer
- nullable: true
- quote_exact:
- type: string
- nullable: true
- quote_prefix:
- type: string
- nullable: true
- quote_suffix:
- type: string
- nullable: true
- reply_count:
- type: integer
- description: 仅在部分查询口径下返回。
- sentence:
- type: object
- properties: { book: { type: integer }, paragraph: { type: integer }, word_start: { type: integer }, word_end: { type: integer } }
- description: 仅在部分查询口径下返回。
- editor:
- type: object
- properties: { id: { type: string }, nickName: { type: string }, userName: { type: string }, realName: { type: string }, sn: { type: integer }, avatar: { type: string }, roles: { type: array, items: { type: string } } }
- nullable: true
- co_editor:
- type: object
- properties: { id: { type: string }, nickName: { type: string }, userName: { type: string }, realName: { type: string }, sn: { type: integer }, avatar: { type: string }, roles: { type: array, items: { type: string } } }
- nullable: true
- abilities:
- type: object
- properties: { update: { type: boolean }, delete: { type: boolean }, close: { type: boolean }, reply: { type: boolean } }
- created_at:
- type: string
- updated_at:
- type: string
- deleted_at:
- type: string
- nullable: true
- meta:
- $ref: '../../main.yaml#/components/schemas/PaginationMeta'
- 422:
- $ref: '../../main.yaml#/components/responses/ProblemValidation'
- post:
- summary: 发起话题、新建批注或评估
- tags:
- - discussions
- operationId: post_api_v3_discussions
- description: |-
- discussion / issue 登录即可发;qa / help 只能发在文章上,且只有文章的编辑者能发。
- severity 的取值随 type:issue 为 error / warning / suggestion,help 为 urgent / normal,
- 其它类型不收。默认会通知对象的作者(站内信 + webhook),`notify=false` 关闭。
- 批注(note / commentary)只能加在句子上,且只有该句所在 channel 的编辑者能加;
- 标题可省、正文必填,commentary 的正文必须是义注句子模板 `{{book-para-start-end}}`
- (可多句并列);可带锚点 pos_* / quote_*;不发通知。
- assessment(译文评估:用某种方法给这句译文打分)只能加在句子上,且只有该句所在 channel 的编辑者能加
- (AI 凭授权代写);score(0–100 的整数)必填,severity 必填、填评估方法(1–16 位字母数字 . _ -),
- 标题可省,理由写 content;不收锚点、不发通知。**一句只留一条**:已有评估时就地覆盖
- (分数、方法、理由、署名都换成这次的,回复保留),返回 200;没有才新建,返回 201。
- glossary(外挂术语:不改译文,给锚点处的译文挂上术语)是评论线程,title 必填、填术语词头;
- 与批注一样只能挂在句子上、只有该句所在 channel 的编辑者能发,对所有人公开可见。
- 锚点只有 note / commentary / issue / glossary 收,其它类型传了 422。
- 实现:`V3\DiscussionController@store`
- security:
- -
- bearerAuth: []
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- properties:
- target_type:
- type: string
- description: 挂靠对象的类型
- enum:
- - sentence
- - wbw
- - article
- - term
- - task
- target_id:
- type: string
- description: '挂靠对象的 uuid'
- type:
- type: string
- description: 类型
- enum:
- - discussion
- - qa
- - help
- - issue
- - glossary
- - note
- - commentary
- - assessment
- default: discussion
- title:
- type: string
- description: '标题,最长 256 字符;评论线程必填(glossary 填术语词头),批注与评估可省'
- content:
- type: string
- description: 正文(markdown);批注必填,评估写打分理由
- severity:
- type: string
- description: '严重程度:issue 为 error / warning / suggestion,help 为 urgent / normal;assessment 必填,填评估方法(1–16 位字母数字 . _ -)'
- example: error
- score:
- type: integer
- description: '评估分数,0–100 的整数(只限且必填于 assessment)'
- example: 85
- pos_start:
- type: integer
- description: '锚点在句子文本中的起始偏移(只限 note / commentary / issue / glossary)'
- pos_end:
- type: integer
- description: '锚点的结束偏移,批注插在这里(只限 note / commentary / issue / glossary)'
- quote_exact:
- type: string
- description: '锚定的原文片段(只限 note / commentary / issue / glossary)'
- quote_prefix:
- type: string
- description: '锚定片段前的上下文,用于重新定位(只限 note / commentary / issue / glossary)'
- quote_suffix:
- type: string
- description: '锚定片段后的上下文,用于重新定位(只限 note / commentary / issue / glossary)'
- tpl_id:
- type: string
- description: '话题模板(文章)的 uuid'
- notify:
- type: boolean
- description: 是否发通知(批注不发)
- default: true
- required:
- - target_type
- - target_id
- responses:
- 200:
- description: '覆盖了该句已有的评估(只限 assessment)'
- content:
- application/json:
- schema:
- type: object
- properties:
- data:
- type: object
- properties:
- id:
- type: string
- target_type:
- type: string
- target_id:
- type: string
- parent_id:
- type: string
- nullable: true
- type:
- type: string
- severity:
- type: string
- nullable: true
- score:
- type: integer
- nullable: true
- status:
- type: string
- title:
- type: string
- nullable: true
- content:
- type: string
- nullable: true
- content_type:
- type: string
- body:
- type: array
- items:
- $ref: '../../main.yaml#/components/schemas/MarkupNode'
- description: 仅在部分查询口径下返回。
- summary:
- type: string
- description: 仅在部分查询口径下返回。
- tpl_id:
- type: string
- nullable: true
- pos_start:
- type: integer
- nullable: true
- pos_end:
- type: integer
- nullable: true
- quote_exact:
- type: string
- nullable: true
- quote_prefix:
- type: string
- nullable: true
- quote_suffix:
- type: string
- nullable: true
- reply_count:
- type: integer
- description: 仅在部分查询口径下返回。
- sentence:
- type: object
- properties:
- book: { type: integer }
- paragraph: { type: integer }
- word_start: { type: integer }
- word_end: { type: integer }
- description: 仅在部分查询口径下返回。
- editor:
- type: object
- properties:
- id: { type: string }
- nickName: { type: string }
- userName: { type: string }
- realName: { type: string }
- sn: { type: integer }
- avatar: { type: string }
- roles: { type: array, items: { type: string } }
- nullable: true
- co_editor:
- type: object
- properties:
- id: { type: string }
- nickName: { type: string }
- userName: { type: string }
- realName: { type: string }
- sn: { type: integer }
- avatar: { type: string }
- roles: { type: array, items: { type: string } }
- nullable: true
- abilities:
- type: object
- properties:
- update: { type: boolean }
- delete: { type: boolean }
- close: { type: boolean }
- reply: { type: boolean }
- created_at:
- type: string
- updated_at:
- type: string
- deleted_at:
- type: string
- nullable: true
- 201:
- description: 创建成功
- content:
- application/json:
- schema:
- type: object
- properties:
- data:
- type: object
- properties:
- id:
- type: string
- target_type:
- type: string
- target_id:
- type: string
- parent_id:
- type: string
- nullable: true
- type:
- type: string
- severity:
- type: string
- nullable: true
- score:
- type: integer
- nullable: true
- status:
- type: string
- title:
- type: string
- nullable: true
- content:
- type: string
- nullable: true
- content_type:
- type: string
- body:
- type: array
- items:
- $ref: '../../main.yaml#/components/schemas/MarkupNode'
- description: 仅在部分查询口径下返回。
- summary:
- type: string
- description: 仅在部分查询口径下返回。
- tpl_id:
- type: string
- nullable: true
- pos_start:
- type: integer
- nullable: true
- pos_end:
- type: integer
- nullable: true
- quote_exact:
- type: string
- nullable: true
- quote_prefix:
- type: string
- nullable: true
- quote_suffix:
- type: string
- nullable: true
- reply_count:
- type: integer
- description: 仅在部分查询口径下返回。
- sentence:
- type: object
- properties:
- book: { type: integer }
- paragraph: { type: integer }
- word_start: { type: integer }
- word_end: { type: integer }
- description: 仅在部分查询口径下返回。
- editor:
- type: object
- properties:
- id: { type: string }
- nickName: { type: string }
- userName: { type: string }
- realName: { type: string }
- sn: { type: integer }
- avatar: { type: string }
- roles: { type: array, items: { type: string } }
- nullable: true
- co_editor:
- type: object
- properties:
- id: { type: string }
- nickName: { type: string }
- userName: { type: string }
- realName: { type: string }
- sn: { type: integer }
- avatar: { type: string }
- roles: { type: array, items: { type: string } }
- nullable: true
- abilities:
- type: object
- properties:
- update: { type: boolean }
- delete: { type: boolean }
- close: { type: boolean }
- reply: { type: boolean }
- created_at:
- type: string
- updated_at:
- type: string
- deleted_at:
- type: string
- nullable: true
- 401:
- $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
- 403:
- description: 当前用户不能在这个对象上发起这种类型的话题
- content:
- application/problem+json:
- schema:
- $ref: '../../main.yaml#/components/schemas/ProblemDetails'
- 422:
- $ref: '../../main.yaml#/components/responses/ProblemValidation'
|