| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-terms-term.yaml
- get:
- summary: 查询单条术语
- tags:
- - terms
- operationId: get_api_v2_terms_term_
- description: |-
- 按 guid(不是自增 id)查找,公开接口,不需要登录。查不到返回错误 '没有查询到数据'。
- 实现:`DhammaTermController@show`
- parameters:
- -
- name: term
- in: path
- required: true
- schema:
- type: string
- -
- name: channel
- in: query
- schema:
- type: string
- description: '渲染 note 时使用的 channel 列表,多个用下划线分隔; 不传则按术语自身的 channel 或对应语言的社区 channel 渲染'
- -
- name: mode
- in: query
- schema:
- type: string
- default: read
- description: 渲染模式
- -
- name: format
- in: query
- schema:
- type: string
- enum:
- - react
- - html
- - text
- default: react
- description: 'note 的渲染输出格式'
- -
- name: community_summary
- in: query
- schema:
- type: boolean
- description: '传入该参数时,没有 note 的术语回落到社区解释作为 summary'
- -
- name: exp
- in: query
- schema:
- type: boolean
- description: 传入该参数时附带编辑者累计经验值(秒)
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- properties:
- id:
- type: integer
- guid:
- type: string
- word:
- type: string
- word_en:
- type: string
- meaning:
- type: string
- other_meaning:
- type: string
- tag:
- type: string
- note:
- type: string
- language:
- type: string
- channel_id:
- type: integer
- channal:
- type: string
- studio:
- type: string
- editor:
- type: string
- created_at:
- type: string
- updated_at:
- type: string
- mode:
- type: string
- format:
- type: string
- studioId:
- type: string
- channel:
- type: string
- html:
- type: string
- summary_is_community:
- type: string
- summary:
- type: string
- role:
- type: string
- exp:
- type: string
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
- put:
- summary: 修改术语
- tags:
- - terms
- operationId: put_api_v2_terms_term_
- description: |-
- 需要登录(未登录 401),按主键 id 查找,不存在返回 '404'。
- 权限:studio 级术语(channal 为空)只有 owner 本人能改,AI 模型一律 403;
- channel 级术语要求对该 channel 有编辑权(owner / 协作者 / access token),否则 403。
- 增量更新——只有请求里出现的字段才会被写入,未提交的字段保持原值;
- 提交 word 时会同步重算 word_en。create_time 不变,只刷新 modify_time。
- 保存后清除该词的 term 缓存并重建 OpenSearch 索引(索引失败只记日志)。
- 实现:`DhammaTermController@update`
- parameters:
- -
- name: term
- in: path
- required: true
- schema:
- type: string
- requestBody:
- required: false
- content:
- application/json:
- schema:
- type: object
- properties:
- access_token:
- type: string
- description: 'channel access token,供非 owner 身份验证 channel 编辑权'
- word:
- type: string
- description: '术语词形,提交时同步重算 word_en'
- meaning:
- type: string
- description: 主要义项
- other_meaning:
- type: string
- description: 其他义项,逗号分隔
- note:
- type: string
- description: 术语解释,Markdown
- tag:
- type: string
- description: 标签
- language:
- type: string
- description: 语言
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- properties:
- id:
- type: integer
- guid:
- type: string
- word:
- type: string
- word_en:
- type: string
- meaning:
- type: string
- other_meaning:
- type: string
- tag:
- type: string
- note:
- type: string
- language:
- type: string
- channel_id:
- type: integer
- channal:
- type: string
- studio:
- type: string
- editor:
- type: string
- created_at:
- type: string
- updated_at:
- type: string
- mode:
- type: string
- format:
- type: string
- studioId:
- type: string
- channel:
- type: string
- html:
- type: string
- summary_is_community:
- type: string
- summary:
- type: string
- role:
- type: string
- exp:
- type: string
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
- patch:
- summary: 修改术语
- tags:
- - terms
- operationId: patch_api_v2_terms_term_
- description: |-
- 需要登录(未登录 401),按主键 id 查找,不存在返回 '404'。
- 权限:studio 级术语(channal 为空)只有 owner 本人能改,AI 模型一律 403;
- channel 级术语要求对该 channel 有编辑权(owner / 协作者 / access token),否则 403。
- 增量更新——只有请求里出现的字段才会被写入,未提交的字段保持原值;
- 提交 word 时会同步重算 word_en。create_time 不变,只刷新 modify_time。
- 保存后清除该词的 term 缓存并重建 OpenSearch 索引(索引失败只记日志)。
- 实现:`DhammaTermController@update`
- parameters:
- -
- name: term
- in: path
- required: true
- schema:
- type: string
- requestBody:
- required: false
- content:
- application/json:
- schema:
- type: object
- properties:
- access_token:
- type: string
- description: 'channel access token,供非 owner 身份验证 channel 编辑权'
- word:
- type: string
- description: '术语词形,提交时同步重算 word_en'
- meaning:
- type: string
- description: 主要义项
- other_meaning:
- type: string
- description: 其他义项,逗号分隔
- note:
- type: string
- description: 术语解释,Markdown
- tag:
- type: string
- description: 标签
- language:
- type: string
- description: 语言
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- properties:
- id:
- type: integer
- guid:
- type: string
- word:
- type: string
- word_en:
- type: string
- meaning:
- type: string
- other_meaning:
- type: string
- tag:
- type: string
- note:
- type: string
- language:
- type: string
- channel_id:
- type: integer
- channal:
- type: string
- studio:
- type: string
- editor:
- type: string
- created_at:
- type: string
- updated_at:
- type: string
- mode:
- type: string
- format:
- type: string
- studioId:
- type: string
- channel:
- type: string
- html:
- type: string
- summary_is_community:
- type: string
- summary:
- type: string
- role:
- type: string
- exp:
- type: string
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
- delete:
- summary: 批量删除术语
- tags:
- - terms
- operationId: delete_api_v2_terms_term_
- description: |-
- 需要登录。一次可以删除多条,返回实际删除的条数;无权限的条目被跳过而不报错。
- 传了 uuid 参数时,id 按数组处理:owner 本人可删,非 owner 且术语属于某个 channel 时
- 需要该 channel 的协作权限达到 20(编辑)才可删,studio 级术语非 owner 一律跳过。
- 未传 uuid 时,id 按 JSON 字符串数组处理,且只能删除 owner 是当前用户的术语。
- 每删一条都会清除该词对应的 term 缓存。
- 实现:`DhammaTermController@destroy`
- parameters:
- -
- name: term
- in: path
- required: true
- schema:
- type: string
- -
- name: uuid
- in: query
- schema:
- type: string
- description: '存在该参数即表示 id 以数组形式提交,并启用 channel 协作者删除权限判定'
- -
- name: id
- in: query
- schema:
- type: array
- description: '要删除的术语 id 列表。带 uuid 时为数组,否则为 JSON 数组字符串'
- required: true
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
|