Explorar el Código

✨ (api-v13): /v3/search 按现行 v3 规范重写

这个端点早于 v2→v3 批次,一直返回 OpenSearch 原始结构,失败时把原始报错连同 500
吐给客户端且不写日志。

- SearchPlusController → V3\SearchController,逻辑进 V3\SearchService
- IndexSearchRequest:q 必填(不再 match_all 全索引),search_mode / resource_type /
  granularity 按索引真实值校验,page_size → per_page(≤100),翻页超过 10000 回 422
- 响应 {success, data:{took, hits…}} → {data:[hit], meta},hit 是扁平字段,不透出 _source
- 分面聚合改为 facets=true 才算(meta.facets);共享的 OpenSearchService::search()
  加 aggregations 开关,默认仍开,Library 与 AITermService 不变
- 搜索集群连不上 / 超时 / 过载 → 503 search-unavailable;{id} 只有文档不存在才 404
- POST 保留,与 GET 共用 FormRequest
- api-test:去掉 search 的 schema 补丁,show 用例改从检索结果取 id;客户端按现行规格重生成
  (顺带补上之前漏生成的 nissaya-cards 等)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda hace 17 horas
padre
commit
d1721403e4
Se han modificado 43 ficheros con 9522 adiciones y 526 borrados
  1. 1 0
      CLAUDE.md
  2. 6 6
      api-test/README.md
  3. 55 8
      api-test/cases/02_search.php
  4. 45 0
      api-test/client/.openapi-generator/FILES
  5. 502 0
      api-test/client/lib/Api/NissayaCardsApi.php
  6. 158 101
      api-test/client/lib/Api/SearchApi.php
  7. 6 6
      api-test/client/lib/Api/SearchSuggestApi.php
  8. 23 23
      api-test/client/lib/Api/StudiosApi.php
  9. 23 23
      api-test/client/lib/Api/TermsApi.php
  10. 6 6
      api-test/client/lib/Api/UpgradeApi.php
  11. 409 0
      api-test/client/lib/Model/GetApiV3NissayaCardsEnding200Response.php
  12. 518 0
      api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseData.php
  13. 607 0
      api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInner.php
  14. 477 0
      api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory.php
  15. 443 0
      api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom.php
  16. 443 0
      api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner.php
  17. 545 0
      api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataTerm.php
  18. 33 33
      api-test/client/lib/Model/GetApiV3Search200Response.php
  19. 975 0
      api-test/client/lib/Model/GetApiV3Search200ResponseDataInner.php
  20. 579 0
      api-test/client/lib/Model/GetApiV3Search200ResponseMeta.php
  21. 449 0
      api-test/client/lib/Model/GetApiV3Search200ResponseMetaFacetsValueInner.php
  22. 3 3
      api-test/client/lib/Model/GetApiV3SearchSearch200Response.php
  23. 443 0
      api-test/client/lib/Model/GetApiV3SearchSuggest200Response.php
  24. 409 0
      api-test/client/lib/Model/GetApiV3Upgrade200Response.php
  25. 443 0
      api-test/client/lib/Model/PostApiV3Search200Response.php
  26. 579 0
      api-test/client/lib/Model/PostApiV3Search200ResponseMeta.php
  27. 165 23
      api-test/client/lib/Model/PostApiV3SearchRequest.php
  28. 1 2
      api-test/fixtures.php
  29. 1 6
      api-test/tools/filter-v3.php
  30. 123 0
      api-v13/app/Http/Controllers/V3/SearchController.php
  31. 0 171
      api-v13/app/Http/Controllers/V3/SearchPlusController.php
  32. 89 0
      api-v13/app/Http/Requests/V3/IndexSearchRequest.php
  33. 38 0
      api-v13/app/Http/Resources/V3/SearchHitResource.php
  34. 7 3
      api-v13/app/Services/OpenSearchService.php
  35. 222 0
      api-v13/app/Services/V3/SearchService.php
  36. 1 0
      api-v13/resources/lang/en/site.php
  37. 1 0
      api-v13/resources/lang/zh-Hans/site.php
  38. 2 2
      api-v13/routes/v3/search.php
  39. 190 0
      api-v13/tests/Feature/SearchV3Test.php
  40. 180 49
      dashboard-v6/src/api/schema.d.ts
  41. 46 0
      openapi/public/assets/protocol/overrides/v3-search.yaml
  42. 58 5
      openapi/public/assets/protocol/resources/auto/v3-search-search.yaml
  43. 218 56
      openapi/public/assets/protocol/resources/auto/v3-search.yaml

+ 1 - 0
CLAUDE.md

@@ -364,6 +364,7 @@ Resource / FormRequest / 测试同理;URL 只换版本前缀
 | `terms-export`(+`/{uuid}`)+ `terms-import` / `TermExportController` | `channels/{channel}/terms`、`studios/{studio}/terms`(`Accept: xlsx`)+ `channels/{channel}/terms/imports`、`studios/{studio}/terms/imports` / `V3\ChannelTermController`、`V3\StudioTermController` + `V3\ChannelTermImportController`、`V3\StudioTermImportController`(逻辑在 `V3\TermExchangeService`) | 2026-11-17。**导出不设端点**:列表接口带 `Accept: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` 直接返回整表 xlsx(过滤同列表、权限同列表;v2 只要登录、不查权限,且先存 Redis 再凭 uuid 下载)。列 `id / word / tag / meaning / other_meaning / summary / note / quality / content_type / redirect / language / channel_id / etag`。**导入**:multipart 上传 xlsx(不再经附件临时区、不再用 GET 写入;≤5MB、≤5000 行),按**列名**读(v2 导出的表也能用);**部分成功**(出错行跳过,`errors[{row,message}]`),有 id 改那条、word / tag 不能改、带 etag 列时校验(导出后被改过就跳过),无 id 按 word + tag 找、有就改没有就建;「有 id、word 为空就删除」去掉;channel 导入的 language / channel_id 列不看;studio 导入按 `channel_id` 落 channel(须属该 studio 且可写),空的是 studio 通用(要 language,新建要团队 owner / manager);不支持 agent;≤50 条改动立即重建搜索索引,更多的等每周 `opensearch:index-term`。生成器为此支持 `@bodyParam x file`(multipart)。v6 `TermImport` / `TermExport` 已切 |
 | `grammar-guide/{词_语言}` / `GrammarGuideController@show` | (无新端点)`glossaries/grammar` + `terms/{term}`,退回 `terms?word=` | 2026-11-17。语法点悬停说明(v6 `components/dict/GrammarPop.tsx`)。v2 在语法术语系统 channel 里按词查一条、返回 `# 释义\n正文` 的 markdown;v6 改为:启动时已加载的 `/v3/glossaries/grammar` 里按词找 id → `GET /v3/terms/{id}`(新渲染器的 body);表里没有就按词查 `GET /v3/terms?word=&with_body=true`,只认 `_System_Grammar_Term_{界面语言}_`、其次 en 那个 channel 的;都没有显示「暂无…的语法说明」。悬停查询失败不弹全局提示(quiet)。`api/Guide.ts` 已删。顺带修了 `terms?with_body=` 与 `studios/{s}/terms?general=` 收不了查询串 `true`/`false` 的 422 |
 | `nissaya-card/{ending}` / `NissayaCardController@show` | `nissaya-cards/{ending}` / `V3\NissayaCardController`(逻辑在 `V3\NissayaCardService`) | 2026-11-17。缅文 nissaya 词尾卡片(v6 `components/nissaya/NissayaCard`),只读、公开。只给结构化数据:去掉 mustache 渲染的 markdown 分支、写死在后端的表头文字、拼好的 dashboard 链接(前端自己拼);术语一次批量查(v2 逐格位 N+1);词尾说明是新渲染器的 `body` 节点树。字段 `row`→`relations`、`case`→`cases[{case,label}]`、`local_relation`→`relation_label`、`local_ending`(分号拼接)→`local_endings`(数组);查不到的词尾回空卡片(200)。语法术语 channel 没有该语言时回退 en,`lang` 是实际用到的语言。v6 已切;mobile、插件不用 |
+| (无对应 v2 端点;早期 v3)`search`(GET / POST / `{id}`)/ `V3\SearchPlusController` | `search`(不变)/ `V3\SearchController`(逻辑在 `V3\SearchService`) | 2026-11-19,按现行 v3 规范重写(v2 的 `SearchController` 是 PostgreSQL 全文检索,另一套,不受影响)。控制器改名 `SearchPlusController`→`SearchController`;入参走 `IndexSearchRequest`:`q` 必填(不再 `match_all` 全索引),`search_mode` / `resource_type`(`tipitaka`/`original_text`/`term`)/ `granularity`(`book`/`chapter`/`session`/`paragraph`)按索引真实值校验,`page_size`→`per_page`(≤100),`page × per_page` > 10000 时 422(原来 OpenSearch 报错变 500)。响应从 OpenSearch 原始结构 `{success, data:{took, hits, aggregations}, query_info}` 改成 `{data:[hit], meta:{current_page, per_page, total, total_relation, last_page}}`,hit 是扁平字段(`related_id`、`title`、`content`、`highlight`、`bold[]`、`score`…),不再透出 `_source`;分面聚合改为 `facets=true` 才算(`meta.facets`)。错误走 Problem Details:搜索集群连不上 / 超时 / 过载 → 503 `search-unavailable`(原来 catch 后把原始报错 + 500 吐给客户端、且不写日志);`{id}` 只有文档不存在才 404(原来任何异常都 404)。共享的 `OpenSearchService::search()` 加了 `aggregations` 开关(默认 true,Library 与 AITermService 不变),顺带修 `channel` 过滤(text 字段用 term 永远不中→`match_phrase`)与数组 `related_id`(term→terms)。POST 保留(用户定)。wikipali-plugins(`phrase` / `find`)、agent-poc 召回评测脚本已切;v6、mobile 不调用。`search-suggest` 未迁 |
 
 **注意**:`tipitaka-reading` **不是** v2 `paragraph-content` / `chapter-content` 的替代品。
 那两个 v2 端点支持多 channel(`channels=a,b,c`)与 edit 模式、返回 sentenceIds 供编辑器用;

+ 6 - 6
api-test/README.md

@@ -169,7 +169,7 @@ bash api-test/tools/regen.sh
 - **新增端点** → 在 `cases/` 加对应 `test()`(参照现有文件按领域放)。
 - **参数变了**(新增 required、改名、枚举增删)→ 改对应用例的入参。
 - **响应字段变了**(Resource 的 `@return` 改了形状)→ 改对应断言。
-- **种子数据失效** → `fixtures.php` 里的 `channel` / `target_id` / `search_doc_id` 换新值。
+- **种子数据失效** → `fixtures.php` 里的 `channel` / `target_id` 换新值。
 
 ### 4. 跑全量验证
 
@@ -187,20 +187,20 @@ php run.php --username=<username> --password=<password> --server=staging
 
 | 端点                     | spec 说                                          | 实际                                                                        | 处理                                                                                   |
 | ------------------------ | ------------------------------------------------ | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
-| `GET/POST /v3/search`    | 200 `{data:数组, meta}` + 非法 `search_mode` 422 | 200 `{success, data:{took,hits}}`;`search_mode` 不校验                     | `filter-v3.php` 把 200 schema 修为 `{success,data:对象}`;用例只断言状态码 + `data` 键 |
 | `GET /v3/search-suggest` | 200 `{data:数组, meta}`;空 q 422                | 200 `{success, data:{query,suggestions}}`;空 q 400 `{success:false,error}` | 同上修 schema;空 q 用例按实际 400 断言                                                |
 | `GET /v3/upgrade`        | 200 `{data:数组, meta}`                          | 200 `{data:{status:"ok"}}`                                                  | 修 schema 为 `{data:对象}`                                                             |
 
-根因是这三个控制器还没迁到 v3 的 Resource 信封(`{data}` 原生形状、错误体 RFC 9457
+根因是这两个控制器还没迁到 v3 的 Resource 信封(`{data}` 原生形状、错误体 RFC 9457
 Problem Details、成败只看状态码)。正确的长期修法在 api-v13 侧,这里只让测试客户端能用、
-把漂移显式记录。`filter-v3.php` 里的 `applyDriftPatches()` 就是这三处补丁,改对齐后可删。
+把漂移显式记录。`filter-v3.php` 里的 `applyDriftPatches()` 就是这两处补丁,改对齐后可删。(`/v3/search` 已于 2026-11-19 对齐,补丁已删。)
 
 ## 环境注意
 
 - **pspell / xdebug 启动警告**:本机 PHP CLI 的 pspell 扩展与 PHP 版本不匹配,每次 `php`
   都会在 stderr 打警告,与测试无关,可忽略。
-- **staging 的 OpenSearch**:`/v3/search`、`/v3/search-suggest` 在 staging 会 500
-  (索引 mapping 与代码不一致:`resource_type` 缺 fielddata、`content.suggest.pali` 没映射)。
+- **staging 的 OpenSearch**:`/v3/search?facets=true`、`/v3/search-suggest` 在 staging 会 500
+  (索引 mapping 与代码不一致:`resource_type` 是 text 不能聚合、`content.suggest.pali` 不是 completion)。
+  `/v3/search` 默认不再算聚合,不带 facets 时不受影响。
   这是 staging 环境问题,本地跑这几条是绿的。
 - **`registered_email` 种子**:`email-certifications` 的「已注册邮箱 → 422」用例需要一个
   真实存在的账号邮箱,从环境变量 `API_TEST_REGISTERED_EMAIL` 读,没给就 SKIP。它只走

+ 55 - 8
api-test/cases/02_search.php

@@ -4,25 +4,72 @@ use \WikipaliApi\Api\SearchApi;
 use \WikipaliApi\Api\SearchSuggestApi;
 use \WikipaliApi\Model\PostApiV3SearchRequest;
 
-test('GET /v3/search?q=dukkha → 200', function () {
-    $res = request(fn () => api(SearchApi::class)->getApiV3SearchWithHttpInfo(fixtures()['search_q']));
+/** 一条命中必须有的字段(v3 归一化后的形状,不再透出 OpenSearch 的 _source) */
+const SEARCH_HIT_KEYS = ['id', 'resource_type', 'resource_id', 'granularity', 'language', 'related_id',
+    'score', 'title', 'content', 'highlight', 'bold', 'path', 'category', 'tags', 'updated_at'];
+
+function assert_search_page(array $res, string $what): void
+{
+    assert_has_key('data', $res['body'], $what);
+    assert_has_key('meta', $res['body'], $what);
+    foreach (['current_page', 'per_page', 'total', 'total_relation', 'last_page'] as $key) {
+        assert_has_key($key, $res['body']['meta'], "{$what} meta");
+    }
+    if (! is_array($res['body']['data']) || $res['body']['data'] === []) {
+        fail("{$what}:data 应是非空列表");
+    }
+    foreach (SEARCH_HIT_KEYS as $key) {
+        assert_has_key($key, $res['body']['data'][0], "{$what} data[0]");
+    }
+    if (array_key_exists('_source', $res['body']['data'][0])) {
+        fail("{$what}:不应再透出 _source");
+    }
+}
+
+test('GET /v3/search?q=dukkha → 200 {data, meta}', function () {
+    $res = request(fn () => api(SearchApi::class)->getApiV3SearchWithHttpInfo(
+        fixtures()['search_q'], 'fuzzy', 'tipitaka', null, 'paragraph', null, null, null, null, null, null, null, false, 1, 5));
     assert_status(200, $res, 'search GET');
-    // spec 说 data 是数组,实际是 {success,data:{took,hits}}(漂移,见 README)
-    assert_has_key('data', $res['body'], 'search GET');
+    assert_search_page($res, 'search GET');
+    assert_eq(5, $res['body']['meta']['per_page'], 'search GET per_page');
+    if (array_key_exists('facets', $res['body']['meta'])) {
+        fail('search GET:没要 facets 就不应返回');
+    }
+});
+
+test('GET /v3/search?facets=true → meta.facets 分面计数', function () {
+    $res = raw('GET', '/v3/search', ['q' => fixtures()['search_q'], 'per_page' => 1, 'facets' => 'true']);
+    assert_status(200, $res, 'search facets');
+    assert_has_key('facets', $res['body']['meta'], 'search facets');
+    assert_has_key('resource_type', $res['body']['meta']['facets'], 'search facets');
 });
 
 test('POST /v3/search → 200(与 GET 等价,参数在 body)', function () {
     $body = new PostApiV3SearchRequest();
     $body->setQ(fixtures()['search_q']);
+    $body->setPerPage(3);
     $res = request(fn () => api(SearchApi::class)->postApiV3SearchWithHttpInfo($body));
     assert_status(200, $res, 'search POST');
-    assert_has_key('data', $res['body'], 'search POST');
+    assert_search_page($res, 'search POST');
+});
+
+test('GET /v3/search(缺 q / 非法模式 / 翻页过深)→ 422', function () {
+    assert_field_error('q', raw('GET', '/v3/search'), 'search 缺 q');
+    assert_field_error('search_mode', raw('GET', '/v3/search', ['q' => 'x', 'search_mode' => 'bogus']), 'search 非法模式');
+    assert_field_error('page', raw('GET', '/v3/search', ['q' => 'x', 'per_page' => 100, 'page' => 101]), 'search 翻页过深');
 });
 
-test('GET /v3/search/{id} → 200(真实文档 id)', function () {
-    $res = request(fn () => api(SearchApi::class)->getApiV3SearchSearchWithHttpInfo(fixtures()['search_doc_id']));
+test('GET /v3/search/{id} → 200(取检索结果里的第一条)', function () {
+    // 文档 id 从检索结果里拿,不依赖各环境的种子数据
+    $hits = raw('GET', '/v3/search', ['q' => fixtures()['search_q'], 'per_page' => 1]);
+    assert_status(200, $hits, 'search show 前置检索');
+    $id = $hits['body']['data'][0]['id'] ?? null;
+    if (! is_string($id)) {
+        fail('search show:检索结果为空,拿不到文档 id');
+    }
+    $res = request(fn () => api(SearchApi::class)->getApiV3SearchSearchWithHttpInfo($id));
     assert_status(200, $res, 'search show');
-    assert_has_key('data', $res['body'], 'search show');
+    assert_eq($id, $res['body']['data']['id'] ?? null, 'search show id');
 });
 
 test('GET /v3/search/{id} → 404(不存在的文档)', function () {

+ 45 - 0
api-test/client/.openapi-generator/FILES

@@ -21,6 +21,7 @@ docs/Api/GroupsApi.md
 docs/Api/HeartbeatApi.md
 docs/Api/InvitesApi.md
 docs/Api/MeApi.md
+docs/Api/NissayaCardsApi.md
 docs/Api/PasswordResetsApi.md
 docs/Api/ProgressApi.md
 docs/Api/ReactionsApi.md
@@ -118,6 +119,13 @@ docs/Model/GetApiV3MeGroups200Response.md
 docs/Model/GetApiV3MeGroups200ResponseDataInner.md
 docs/Model/GetApiV3MeReactions200Response.md
 docs/Model/GetApiV3MeReactions200ResponseDataInner.md
+docs/Model/GetApiV3NissayaCardsEnding200Response.md
+docs/Model/GetApiV3NissayaCardsEnding200ResponseData.md
+docs/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInner.md
+docs/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory.md
+docs/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom.md
+docs/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner.md
+docs/Model/GetApiV3NissayaCardsEnding200ResponseDataTerm.md
 docs/Model/GetApiV3PasswordResetsToken200Response.md
 docs/Model/GetApiV3PasswordResetsToken200ResponseData.md
 docs/Model/GetApiV3Progress200Response.md
@@ -125,7 +133,11 @@ docs/Model/GetApiV3Progress200ResponseDataInner.md
 docs/Model/GetApiV3ReactionsTally200Response.md
 docs/Model/GetApiV3ReactionsTally200ResponseDataInner.md
 docs/Model/GetApiV3Search200Response.md
+docs/Model/GetApiV3Search200ResponseDataInner.md
+docs/Model/GetApiV3Search200ResponseMeta.md
+docs/Model/GetApiV3Search200ResponseMetaFacetsValueInner.md
 docs/Model/GetApiV3SearchSearch200Response.md
+docs/Model/GetApiV3SearchSuggest200Response.md
 docs/Model/GetApiV3TipitakaChannels200Response.md
 docs/Model/GetApiV3TipitakaChannels200ResponseDataInner.md
 docs/Model/GetApiV3TipitakaChapterChannelsBookPara200Response.md
@@ -147,6 +159,7 @@ docs/Model/GetApiV3TipitakaRelatedParagraphsAggregate200Response.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseDataInner.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200Response.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.md
+docs/Model/GetApiV3Upgrade200Response.md
 docs/Model/MarkupElement.md
 docs/Model/MarkupNode.md
 docs/Model/MarkupTemplate.md
@@ -204,6 +217,8 @@ docs/Model/PostApiV3MeReadingTime200Response.md
 docs/Model/PostApiV3MeReadingTime200ResponseData.md
 docs/Model/PostApiV3MeReadingTimeRequest.md
 docs/Model/PostApiV3PasswordResetsRequest.md
+docs/Model/PostApiV3Search200Response.md
+docs/Model/PostApiV3Search200ResponseMeta.md
 docs/Model/PostApiV3SearchRequest.md
 docs/Model/PostApiV3Sessions200Response.md
 docs/Model/PostApiV3Sessions200ResponseData.md
@@ -232,6 +247,7 @@ lib/Api/GroupsApi.php
 lib/Api/HeartbeatApi.php
 lib/Api/InvitesApi.php
 lib/Api/MeApi.php
+lib/Api/NissayaCardsApi.php
 lib/Api/PasswordResetsApi.php
 lib/Api/ProgressApi.php
 lib/Api/ReactionsApi.php
@@ -333,6 +349,13 @@ lib/Model/GetApiV3MeGroups200Response.php
 lib/Model/GetApiV3MeGroups200ResponseDataInner.php
 lib/Model/GetApiV3MeReactions200Response.php
 lib/Model/GetApiV3MeReactions200ResponseDataInner.php
+lib/Model/GetApiV3NissayaCardsEnding200Response.php
+lib/Model/GetApiV3NissayaCardsEnding200ResponseData.php
+lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInner.php
+lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory.php
+lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom.php
+lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner.php
+lib/Model/GetApiV3NissayaCardsEnding200ResponseDataTerm.php
 lib/Model/GetApiV3PasswordResetsToken200Response.php
 lib/Model/GetApiV3PasswordResetsToken200ResponseData.php
 lib/Model/GetApiV3Progress200Response.php
@@ -340,7 +363,11 @@ lib/Model/GetApiV3Progress200ResponseDataInner.php
 lib/Model/GetApiV3ReactionsTally200Response.php
 lib/Model/GetApiV3ReactionsTally200ResponseDataInner.php
 lib/Model/GetApiV3Search200Response.php
+lib/Model/GetApiV3Search200ResponseDataInner.php
+lib/Model/GetApiV3Search200ResponseMeta.php
+lib/Model/GetApiV3Search200ResponseMetaFacetsValueInner.php
 lib/Model/GetApiV3SearchSearch200Response.php
+lib/Model/GetApiV3SearchSuggest200Response.php
 lib/Model/GetApiV3TipitakaChannels200Response.php
 lib/Model/GetApiV3TipitakaChannels200ResponseDataInner.php
 lib/Model/GetApiV3TipitakaChapterChannelsBookPara200Response.php
@@ -362,6 +389,7 @@ lib/Model/GetApiV3TipitakaRelatedParagraphsAggregate200Response.php
 lib/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseDataInner.php
 lib/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200Response.php
 lib/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.php
+lib/Model/GetApiV3Upgrade200Response.php
 lib/Model/MarkupElement.php
 lib/Model/MarkupNode.php
 lib/Model/MarkupTemplate.php
@@ -420,6 +448,8 @@ lib/Model/PostApiV3MeReadingTime200Response.php
 lib/Model/PostApiV3MeReadingTime200ResponseData.php
 lib/Model/PostApiV3MeReadingTimeRequest.php
 lib/Model/PostApiV3PasswordResetsRequest.php
+lib/Model/PostApiV3Search200Response.php
+lib/Model/PostApiV3Search200ResponseMeta.php
 lib/Model/PostApiV3SearchRequest.php
 lib/Model/PostApiV3Sessions200Response.php
 lib/Model/PostApiV3Sessions200ResponseData.php
@@ -449,6 +479,7 @@ test/Api/GroupsApiTest.php
 test/Api/HeartbeatApiTest.php
 test/Api/InvitesApiTest.php
 test/Api/MeApiTest.php
+test/Api/NissayaCardsApiTest.php
 test/Api/PasswordResetsApiTest.php
 test/Api/ProgressApiTest.php
 test/Api/ReactionsApiTest.php
@@ -546,14 +577,25 @@ test/Model/GetApiV3MeGroups200ResponseDataInnerTest.php
 test/Model/GetApiV3MeGroups200ResponseTest.php
 test/Model/GetApiV3MeReactions200ResponseDataInnerTest.php
 test/Model/GetApiV3MeReactions200ResponseTest.php
+test/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategoryTest.php
+test/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInnerTest.php
+test/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromTest.php
+test/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerTest.php
+test/Model/GetApiV3NissayaCardsEnding200ResponseDataTermTest.php
+test/Model/GetApiV3NissayaCardsEnding200ResponseDataTest.php
+test/Model/GetApiV3NissayaCardsEnding200ResponseTest.php
 test/Model/GetApiV3PasswordResetsToken200ResponseDataTest.php
 test/Model/GetApiV3PasswordResetsToken200ResponseTest.php
 test/Model/GetApiV3Progress200ResponseDataInnerTest.php
 test/Model/GetApiV3Progress200ResponseTest.php
 test/Model/GetApiV3ReactionsTally200ResponseDataInnerTest.php
 test/Model/GetApiV3ReactionsTally200ResponseTest.php
+test/Model/GetApiV3Search200ResponseDataInnerTest.php
+test/Model/GetApiV3Search200ResponseMetaFacetsValueInnerTest.php
+test/Model/GetApiV3Search200ResponseMetaTest.php
 test/Model/GetApiV3Search200ResponseTest.php
 test/Model/GetApiV3SearchSearch200ResponseTest.php
+test/Model/GetApiV3SearchSuggest200ResponseTest.php
 test/Model/GetApiV3TipitakaChannels200ResponseDataInnerTest.php
 test/Model/GetApiV3TipitakaChannels200ResponseTest.php
 test/Model/GetApiV3TipitakaChapterChannelsBookPara200ResponseDataInnerChannelTest.php
@@ -575,6 +617,7 @@ test/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseDataInnerTest.ph
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInnerTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseTest.php
+test/Model/GetApiV3Upgrade200ResponseTest.php
 test/Model/MarkupElementTest.php
 test/Model/MarkupNodeTest.php
 test/Model/MarkupTemplateTest.php
@@ -632,6 +675,8 @@ test/Model/PostApiV3MeReadingTime200ResponseDataTest.php
 test/Model/PostApiV3MeReadingTime200ResponseTest.php
 test/Model/PostApiV3MeReadingTimeRequestTest.php
 test/Model/PostApiV3PasswordResetsRequestTest.php
+test/Model/PostApiV3Search200ResponseMetaTest.php
+test/Model/PostApiV3Search200ResponseTest.php
 test/Model/PostApiV3SearchRequestTest.php
 test/Model/PostApiV3Sessions200ResponseDataTest.php
 test/Model/PostApiV3Sessions200ResponseTest.php

+ 502 - 0
api-test/client/lib/Api/NissayaCardsApi.php

@@ -0,0 +1,502 @@
+<?php
+/**
+ * NissayaCardsApi
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Api;
+
+use GuzzleHttp\Client;
+use GuzzleHttp\ClientInterface;
+use GuzzleHttp\Exception\ConnectException;
+use GuzzleHttp\Exception\RequestException;
+use GuzzleHttp\Psr7\MultipartStream;
+use GuzzleHttp\Psr7\Request;
+use GuzzleHttp\RequestOptions;
+use Psr\Http\Message\RequestInterface;
+use Psr\Http\Message\ResponseInterface;
+use WikipaliApi\ApiException;
+use WikipaliApi\Configuration;
+use WikipaliApi\FormDataProcessor;
+use WikipaliApi\HeaderSelector;
+use WikipaliApi\ObjectSerializer;
+
+/**
+ * NissayaCardsApi Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+class NissayaCardsApi
+{
+    /**
+     * @var ClientInterface
+     */
+    protected $client;
+
+    /**
+     * @var Configuration
+     */
+    protected $config;
+
+    /**
+     * @var HeaderSelector
+     */
+    protected $headerSelector;
+
+    /**
+     * @var int Host index
+     */
+    protected $hostIndex;
+
+    /** @var string[] $contentTypes **/
+    public const contentTypes = [
+        'getApiV3NissayaCardsEnding' => [
+            'application/json',
+        ],
+    ];
+
+    /**
+     * @param ClientInterface $client
+     * @param Configuration   $config
+     * @param HeaderSelector  $selector
+     * @param int             $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+     */
+    public function __construct(
+        ?ClientInterface $client = null,
+        ?Configuration $config = null,
+        ?HeaderSelector $selector = null,
+        int $hostIndex = 0
+    ) {
+        $this->client = $client ?: new Client();
+        $this->config = $config ?: Configuration::getDefaultConfiguration();
+        $this->headerSelector = $selector ?: new HeaderSelector();
+        $this->hostIndex = $hostIndex;
+    }
+
+    /**
+     * Set the host index
+     *
+     * @param int $hostIndex Host index (required)
+     */
+    public function setHostIndex($hostIndex): void
+    {
+        $this->hostIndex = $hostIndex;
+    }
+
+    /**
+     * Get the host index
+     *
+     * @return int Host index
+     */
+    public function getHostIndex()
+    {
+        return $this->hostIndex;
+    }
+
+    /**
+     * @return Configuration
+     */
+    public function getConfig()
+    {
+        return $this->config;
+    }
+
+    /**
+     * Operation getApiV3NissayaCardsEnding
+     *
+     * 缅文词尾卡片
+     *
+     * @param  string $ending 缅文词尾,如 သည် (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3NissayaCardsEnding'] to see the possible values for this operation
+     *
+     * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
+     * @throws \InvalidArgumentException
+     * @return \WikipaliApi\Model\GetApiV3NissayaCardsEnding200Response|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3NissayaCardsEnding($ending, $lang = null, string $contentType = self::contentTypes['getApiV3NissayaCardsEnding'][0])
+    {
+        list($response) = $this->getApiV3NissayaCardsEndingWithHttpInfo($ending, $lang, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3NissayaCardsEndingWithHttpInfo
+     *
+     * 缅文词尾卡片
+     *
+     * @param  string $ending 缅文词尾,如 သည် (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3NissayaCardsEnding'] to see the possible values for this operation
+     *
+     * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
+     * @throws \InvalidArgumentException
+     * @return array of \WikipaliApi\Model\GetApiV3NissayaCardsEnding200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3NissayaCardsEndingWithHttpInfo($ending, $lang = null, string $contentType = self::contentTypes['getApiV3NissayaCardsEnding'][0])
+    {
+        $request = $this->getApiV3NissayaCardsEndingRequest($ending, $lang, $contentType);
+
+        try {
+            $options = $this->createHttpClientOption();
+            try {
+                $response = $this->client->send($request, $options);
+            } catch (RequestException $e) {
+                throw new ApiException(
+                    "[{$e->getCode()}] {$e->getMessage()}",
+                    (int) $e->getCode(),
+                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+                );
+            } catch (ConnectException $e) {
+                throw new ApiException(
+                    "[{$e->getCode()}] {$e->getMessage()}",
+                    (int) $e->getCode(),
+                    null,
+                    null
+                );
+            }
+
+            $statusCode = $response->getStatusCode();
+
+
+            switch($statusCode) {
+                case 200:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200Response',
+                        $request,
+                        $response,
+                    );
+                case 422:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+            }
+
+            
+
+            if ($statusCode < 200 || $statusCode > 299) {
+                throw new ApiException(
+                    sprintf(
+                        '[%d] Error connecting to the API (%s)',
+                        $statusCode,
+                        (string) $request->getUri()
+                    ),
+                    $statusCode,
+                    $response->getHeaders(),
+                    (string) $response->getBody()
+                );
+            }
+
+            return $this->handleResponseWithDataType(
+                '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 422:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+            }
+        
+
+            throw $e;
+        }
+    }
+
+    /**
+     * Operation getApiV3NissayaCardsEndingAsync
+     *
+     * 缅文词尾卡片
+     *
+     * @param  string $ending 缅文词尾,如 သည် (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3NissayaCardsEnding'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3NissayaCardsEndingAsync($ending, $lang = null, string $contentType = self::contentTypes['getApiV3NissayaCardsEnding'][0])
+    {
+        return $this->getApiV3NissayaCardsEndingAsyncWithHttpInfo($ending, $lang, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3NissayaCardsEndingAsyncWithHttpInfo
+     *
+     * 缅文词尾卡片
+     *
+     * @param  string $ending 缅文词尾,如 သည် (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3NissayaCardsEnding'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3NissayaCardsEndingAsyncWithHttpInfo($ending, $lang = null, string $contentType = self::contentTypes['getApiV3NissayaCardsEnding'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200Response';
+        $request = $this->getApiV3NissayaCardsEndingRequest($ending, $lang, $contentType);
+
+        return $this->client
+            ->sendAsync($request, $this->createHttpClientOption())
+            ->then(
+                function ($response) use ($returnType) {
+                    if ($returnType === '\SplFileObject') {
+                        $content = $response->getBody(); //stream goes to serializer
+                    } else {
+                        $content = (string) $response->getBody();
+                        if ($returnType !== 'string') {
+                            $content = json_decode($content);
+                        }
+                    }
+
+                    return [
+                        ObjectSerializer::deserialize($content, $returnType, []),
+                        $response->getStatusCode(),
+                        $response->getHeaders()
+                    ];
+                },
+                function ($exception) {
+                    $response = $exception->getResponse();
+                    $statusCode = $response->getStatusCode();
+                    throw new ApiException(
+                        sprintf(
+                            '[%d] Error connecting to the API (%s)',
+                            $statusCode,
+                            $exception->getRequest()->getUri()
+                        ),
+                        $statusCode,
+                        $response->getHeaders(),
+                        (string) $response->getBody()
+                    );
+                }
+            );
+    }
+
+    /**
+     * Create request for operation 'getApiV3NissayaCardsEnding'
+     *
+     * @param  string $ending 缅文词尾,如 သည် (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3NissayaCardsEnding'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3NissayaCardsEndingRequest($ending, $lang = null, string $contentType = self::contentTypes['getApiV3NissayaCardsEnding'][0])
+    {
+
+        // verify the required parameter 'ending' is set
+        if ($ending === null || (is_array($ending) && count($ending) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $ending when calling getApiV3NissayaCardsEnding'
+            );
+        }
+
+
+
+        $resourcePath = '/v3/nissaya-cards/{ending}';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $lang,
+            'lang', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+
+
+        // path params
+        if ($ending !== null) {
+            $resourcePath = str_replace(
+                '{ending}',
+                ObjectSerializer::toPathValue($ending),
+                $resourcePath
+            );
+        }
+
+
+        $headers = $this->headerSelector->selectHeaders(
+            ['application/json', 'application/problem+json', ],
+            $contentType,
+            $multipart
+        );
+
+        // for model (json/xml)
+        if (count($formParams) > 0) {
+            if ($multipart) {
+                $multipartContents = [];
+                foreach ($formParams as $formParamName => $formParamValue) {
+                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+                    foreach ($formParamValueItems as $formParamValueItem) {
+                        $multipartContents[] = [
+                            'name' => $formParamName,
+                            'contents' => $formParamValueItem
+                        ];
+                    }
+                }
+                // for HTTP post (form)
+                $httpBody = new MultipartStream($multipartContents);
+
+            } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+                # if Content-Type contains "application/json", json_encode the form parameters
+                try {
+                    $httpBody = json_encode($formParams, JSON_THROW_ON_ERROR);
+                } catch (\JsonException $e) {
+                    throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
+                }
+            } else {
+                // for HTTP post (form)
+                $httpBody = ObjectSerializer::buildQuery($formParams);
+            }
+        }
+
+        // this endpoint requires Bearer authentication (access token)
+        if (!empty($this->config->getAccessToken())) {
+            $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
+        }
+
+        $defaultHeaders = [];
+        if ($this->config->getUserAgent()) {
+            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+        }
+
+        $headers = array_merge(
+            $defaultHeaders,
+            $headerParams,
+            $headers
+        );
+
+        $operationHost = $this->config->getHost();
+        $query = ObjectSerializer::buildQuery($queryParams);
+        return new Request(
+            'GET',
+            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
+    /**
+     * Create http client option
+     *
+     * @throws \RuntimeException on file opening failure
+     * @return array of http client options
+     */
+    protected function createHttpClientOption()
+    {
+        $options = [];
+        if ($this->config->getDebug()) {
+            $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+            if (!$options[RequestOptions::DEBUG]) {
+                throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+            }
+        }
+
+        if ($this->config->getCertFile()) {
+            $options[RequestOptions::CERT] = $this->config->getCertFile();
+        }
+
+        if ($this->config->getKeyFile()) {
+            $options[RequestOptions::SSL_KEY] = $this->config->getKeyFile();
+        }
+
+        return $options;
+    }
+
+    private function handleResponseWithDataType(
+        string $dataType,
+        RequestInterface $request,
+        ResponseInterface $response
+    ): array {
+        if ($dataType === '\SplFileObject') {
+            $content = $response->getBody(); //stream goes to serializer
+        } else {
+            $content = (string) $response->getBody();
+            if ($dataType !== 'string') {
+                try {
+                    $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR);
+                } catch (\JsonException $exception) {
+                    throw new ApiException(
+                        sprintf(
+                            'Error JSON decoding server response (%s)',
+                            $request->getUri()
+                        ),
+                        $response->getStatusCode(),
+                        $response->getHeaders(),
+                        $content
+                    );
+                }
+            }
+        }
+
+        return [
+            ObjectSerializer::deserialize($content, $dataType, []),
+            $response->getStatusCode(),
+            $response->getHeaders()
+        ];
+    }
+
+    private function responseWithinRangeCode(
+        string $rangeCode,
+        int $statusCode
+    ): bool {
+        $left = (int) ($rangeCode[0].'00');
+        $right = (int) ($rangeCode[0].'99');
+
+        return $statusCode >= $left && $statusCode <= $right;
+    }
+}

+ 158 - 101
api-test/client/lib/Api/SearchApi.php

@@ -136,29 +136,30 @@ class SearchApi
      *
      * 全文检索
      *
-     * @param  string $q 搜索关键词 (required)
-     * @param  int|null $page 页码 (optional, default to 1)
-     * @param  int|null $page_size 每页数量,上限 100 (optional, default to 20)
-     * @param  string|null $search_mode 检索模式 (optional, default to 'fuzzy')
-     * @param  string|null $resource_type 资源类型 (optional)
+     * @param  string $q 检索词 (required)
+     * @param  string|null $search_mode 检索模式:fuzzy 多词模糊(默认)、exact 词形精确、semantic 语义向量、hybrid 模糊 + 语义、definition 黑体定义优先 (optional, default to 'fuzzy')
+     * @param  string|null $resource_type 资源类型:tipitaka 三藏(段落与整章)、original_text 原文分段、term 术语 (optional)
      * @param  string|null $resource_id 限定某个资源 id (optional)
      * @param  string|null $granularity 文档颗粒度 (optional)
-     * @param  string|null $language 语言 (optional)
-     * @param  string|null $category 文档分类,逗号分隔 (optional)
-     * @param  string|null $tags 标签过滤,逗号分隔 (optional)
-     * @param  string[]|null $page_refs 页码标记 (optional)
-     * @param  string[]|null $related_id 关联 id (optional)
-     * @param  string|null $author 按作者或译者过滤 (optional)
-     * @param  string|null $channel 按来源 channel 过滤 (optional)
+     * @param  string|null $language 文档语言,如 pi、zh、en (optional)
+     * @param  string|null $category 分类,逗号分隔,须全部命中 (optional)
+     * @param  string|null $tags 标签,逗号分隔,命中任一 (optional)
+     * @param  string[]|null $page_refs 页码标记,命中任一 (optional)
+     * @param  string[]|null $related_id 关联 id(经文段落是 &#x60;{book}-{para}&#x60;),命中任一 (optional)
+     * @param  string|null $author 作者或译者 (optional)
+     * @param  string|null $channel 来源 channel 的 uuid (optional)
+     * @param  bool|null $facets 是否在 &#x60;meta.facets&#x60; 里返回按 resource_type / language / category / granularity 的分面计数 (optional, default to false)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  int|null $per_page 每页条数,上限 100 (optional, default to 20)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Search'] to see the possible values for this operation
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return \WikipaliApi\Model\GetApiV3Search200Response|\WikipaliApi\Model\ProblemDetails
+     * @return \WikipaliApi\Model\GetApiV3Search200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
      */
-    public function getApiV3Search($q, $page = 1, $page_size = 20, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, string $contentType = self::contentTypes['getApiV3Search'][0])
+    public function getApiV3Search($q, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, $facets = false, $page = 1, $per_page = 20, string $contentType = self::contentTypes['getApiV3Search'][0])
     {
-        list($response) = $this->getApiV3SearchWithHttpInfo($q, $page, $page_size, $search_mode, $resource_type, $resource_id, $granularity, $language, $category, $tags, $page_refs, $related_id, $author, $channel, $contentType);
+        list($response) = $this->getApiV3SearchWithHttpInfo($q, $search_mode, $resource_type, $resource_id, $granularity, $language, $category, $tags, $page_refs, $related_id, $author, $channel, $facets, $page, $per_page, $contentType);
         return $response;
     }
 
@@ -167,29 +168,30 @@ class SearchApi
      *
      * 全文检索
      *
-     * @param  string $q 搜索关键词 (required)
-     * @param  int|null $page 页码 (optional, default to 1)
-     * @param  int|null $page_size 每页数量,上限 100 (optional, default to 20)
-     * @param  string|null $search_mode 检索模式 (optional, default to 'fuzzy')
-     * @param  string|null $resource_type 资源类型 (optional)
+     * @param  string $q 检索词 (required)
+     * @param  string|null $search_mode 检索模式:fuzzy 多词模糊(默认)、exact 词形精确、semantic 语义向量、hybrid 模糊 + 语义、definition 黑体定义优先 (optional, default to 'fuzzy')
+     * @param  string|null $resource_type 资源类型:tipitaka 三藏(段落与整章)、original_text 原文分段、term 术语 (optional)
      * @param  string|null $resource_id 限定某个资源 id (optional)
      * @param  string|null $granularity 文档颗粒度 (optional)
-     * @param  string|null $language 语言 (optional)
-     * @param  string|null $category 文档分类,逗号分隔 (optional)
-     * @param  string|null $tags 标签过滤,逗号分隔 (optional)
-     * @param  string[]|null $page_refs 页码标记 (optional)
-     * @param  string[]|null $related_id 关联 id (optional)
-     * @param  string|null $author 按作者或译者过滤 (optional)
-     * @param  string|null $channel 按来源 channel 过滤 (optional)
+     * @param  string|null $language 文档语言,如 pi、zh、en (optional)
+     * @param  string|null $category 分类,逗号分隔,须全部命中 (optional)
+     * @param  string|null $tags 标签,逗号分隔,命中任一 (optional)
+     * @param  string[]|null $page_refs 页码标记,命中任一 (optional)
+     * @param  string[]|null $related_id 关联 id(经文段落是 &#x60;{book}-{para}&#x60;),命中任一 (optional)
+     * @param  string|null $author 作者或译者 (optional)
+     * @param  string|null $channel 来源 channel 的 uuid (optional)
+     * @param  bool|null $facets 是否在 &#x60;meta.facets&#x60; 里返回按 resource_type / language / category / granularity 的分面计数 (optional, default to false)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  int|null $per_page 每页条数,上限 100 (optional, default to 20)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Search'] to see the possible values for this operation
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return array of \WikipaliApi\Model\GetApiV3Search200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     * @return array of \WikipaliApi\Model\GetApiV3Search200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
      */
-    public function getApiV3SearchWithHttpInfo($q, $page = 1, $page_size = 20, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, string $contentType = self::contentTypes['getApiV3Search'][0])
+    public function getApiV3SearchWithHttpInfo($q, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, $facets = false, $page = 1, $per_page = 20, string $contentType = self::contentTypes['getApiV3Search'][0])
     {
-        $request = $this->getApiV3SearchRequest($q, $page, $page_size, $search_mode, $resource_type, $resource_id, $granularity, $language, $category, $tags, $page_refs, $related_id, $author, $channel, $contentType);
+        $request = $this->getApiV3SearchRequest($q, $search_mode, $resource_type, $resource_id, $granularity, $language, $category, $tags, $page_refs, $related_id, $author, $channel, $facets, $page, $per_page, $contentType);
 
         try {
             $options = $this->createHttpClientOption();
@@ -227,6 +229,12 @@ class SearchApi
                         $request,
                         $response,
                     );
+                case 503:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
             }
 
             
@@ -267,6 +275,14 @@ class SearchApi
                     );
                     $e->setResponseObject($data);
                     throw $e;
+                case 503:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
             }
         
 
@@ -279,28 +295,29 @@ class SearchApi
      *
      * 全文检索
      *
-     * @param  string $q 搜索关键词 (required)
-     * @param  int|null $page 页码 (optional, default to 1)
-     * @param  int|null $page_size 每页数量,上限 100 (optional, default to 20)
-     * @param  string|null $search_mode 检索模式 (optional, default to 'fuzzy')
-     * @param  string|null $resource_type 资源类型 (optional)
+     * @param  string $q 检索词 (required)
+     * @param  string|null $search_mode 检索模式:fuzzy 多词模糊(默认)、exact 词形精确、semantic 语义向量、hybrid 模糊 + 语义、definition 黑体定义优先 (optional, default to 'fuzzy')
+     * @param  string|null $resource_type 资源类型:tipitaka 三藏(段落与整章)、original_text 原文分段、term 术语 (optional)
      * @param  string|null $resource_id 限定某个资源 id (optional)
      * @param  string|null $granularity 文档颗粒度 (optional)
-     * @param  string|null $language 语言 (optional)
-     * @param  string|null $category 文档分类,逗号分隔 (optional)
-     * @param  string|null $tags 标签过滤,逗号分隔 (optional)
-     * @param  string[]|null $page_refs 页码标记 (optional)
-     * @param  string[]|null $related_id 关联 id (optional)
-     * @param  string|null $author 按作者或译者过滤 (optional)
-     * @param  string|null $channel 按来源 channel 过滤 (optional)
+     * @param  string|null $language 文档语言,如 pi、zh、en (optional)
+     * @param  string|null $category 分类,逗号分隔,须全部命中 (optional)
+     * @param  string|null $tags 标签,逗号分隔,命中任一 (optional)
+     * @param  string[]|null $page_refs 页码标记,命中任一 (optional)
+     * @param  string[]|null $related_id 关联 id(经文段落是 &#x60;{book}-{para}&#x60;),命中任一 (optional)
+     * @param  string|null $author 作者或译者 (optional)
+     * @param  string|null $channel 来源 channel 的 uuid (optional)
+     * @param  bool|null $facets 是否在 &#x60;meta.facets&#x60; 里返回按 resource_type / language / category / granularity 的分面计数 (optional, default to false)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  int|null $per_page 每页条数,上限 100 (optional, default to 20)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Search'] to see the possible values for this operation
      *
      * @throws \InvalidArgumentException
      * @return \GuzzleHttp\Promise\PromiseInterface
      */
-    public function getApiV3SearchAsync($q, $page = 1, $page_size = 20, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, string $contentType = self::contentTypes['getApiV3Search'][0])
+    public function getApiV3SearchAsync($q, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, $facets = false, $page = 1, $per_page = 20, string $contentType = self::contentTypes['getApiV3Search'][0])
     {
-        return $this->getApiV3SearchAsyncWithHttpInfo($q, $page, $page_size, $search_mode, $resource_type, $resource_id, $granularity, $language, $category, $tags, $page_refs, $related_id, $author, $channel, $contentType)
+        return $this->getApiV3SearchAsyncWithHttpInfo($q, $search_mode, $resource_type, $resource_id, $granularity, $language, $category, $tags, $page_refs, $related_id, $author, $channel, $facets, $page, $per_page, $contentType)
             ->then(
                 function ($response) {
                     return $response[0];
@@ -313,29 +330,30 @@ class SearchApi
      *
      * 全文检索
      *
-     * @param  string $q 搜索关键词 (required)
-     * @param  int|null $page 页码 (optional, default to 1)
-     * @param  int|null $page_size 每页数量,上限 100 (optional, default to 20)
-     * @param  string|null $search_mode 检索模式 (optional, default to 'fuzzy')
-     * @param  string|null $resource_type 资源类型 (optional)
+     * @param  string $q 检索词 (required)
+     * @param  string|null $search_mode 检索模式:fuzzy 多词模糊(默认)、exact 词形精确、semantic 语义向量、hybrid 模糊 + 语义、definition 黑体定义优先 (optional, default to 'fuzzy')
+     * @param  string|null $resource_type 资源类型:tipitaka 三藏(段落与整章)、original_text 原文分段、term 术语 (optional)
      * @param  string|null $resource_id 限定某个资源 id (optional)
      * @param  string|null $granularity 文档颗粒度 (optional)
-     * @param  string|null $language 语言 (optional)
-     * @param  string|null $category 文档分类,逗号分隔 (optional)
-     * @param  string|null $tags 标签过滤,逗号分隔 (optional)
-     * @param  string[]|null $page_refs 页码标记 (optional)
-     * @param  string[]|null $related_id 关联 id (optional)
-     * @param  string|null $author 按作者或译者过滤 (optional)
-     * @param  string|null $channel 按来源 channel 过滤 (optional)
+     * @param  string|null $language 文档语言,如 pi、zh、en (optional)
+     * @param  string|null $category 分类,逗号分隔,须全部命中 (optional)
+     * @param  string|null $tags 标签,逗号分隔,命中任一 (optional)
+     * @param  string[]|null $page_refs 页码标记,命中任一 (optional)
+     * @param  string[]|null $related_id 关联 id(经文段落是 &#x60;{book}-{para}&#x60;),命中任一 (optional)
+     * @param  string|null $author 作者或译者 (optional)
+     * @param  string|null $channel 来源 channel 的 uuid (optional)
+     * @param  bool|null $facets 是否在 &#x60;meta.facets&#x60; 里返回按 resource_type / language / category / granularity 的分面计数 (optional, default to false)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  int|null $per_page 每页条数,上限 100 (optional, default to 20)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Search'] to see the possible values for this operation
      *
      * @throws \InvalidArgumentException
      * @return \GuzzleHttp\Promise\PromiseInterface
      */
-    public function getApiV3SearchAsyncWithHttpInfo($q, $page = 1, $page_size = 20, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, string $contentType = self::contentTypes['getApiV3Search'][0])
+    public function getApiV3SearchAsyncWithHttpInfo($q, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, $facets = false, $page = 1, $per_page = 20, string $contentType = self::contentTypes['getApiV3Search'][0])
     {
         $returnType = '\WikipaliApi\Model\GetApiV3Search200Response';
-        $request = $this->getApiV3SearchRequest($q, $page, $page_size, $search_mode, $resource_type, $resource_id, $granularity, $language, $category, $tags, $page_refs, $related_id, $author, $channel, $contentType);
+        $request = $this->getApiV3SearchRequest($q, $search_mode, $resource_type, $resource_id, $granularity, $language, $category, $tags, $page_refs, $related_id, $author, $channel, $facets, $page, $per_page, $contentType);
 
         return $this->client
             ->sendAsync($request, $this->createHttpClientOption())
@@ -376,26 +394,27 @@ class SearchApi
     /**
      * Create request for operation 'getApiV3Search'
      *
-     * @param  string $q 搜索关键词 (required)
-     * @param  int|null $page 页码 (optional, default to 1)
-     * @param  int|null $page_size 每页数量,上限 100 (optional, default to 20)
-     * @param  string|null $search_mode 检索模式 (optional, default to 'fuzzy')
-     * @param  string|null $resource_type 资源类型 (optional)
+     * @param  string $q 检索词 (required)
+     * @param  string|null $search_mode 检索模式:fuzzy 多词模糊(默认)、exact 词形精确、semantic 语义向量、hybrid 模糊 + 语义、definition 黑体定义优先 (optional, default to 'fuzzy')
+     * @param  string|null $resource_type 资源类型:tipitaka 三藏(段落与整章)、original_text 原文分段、term 术语 (optional)
      * @param  string|null $resource_id 限定某个资源 id (optional)
      * @param  string|null $granularity 文档颗粒度 (optional)
-     * @param  string|null $language 语言 (optional)
-     * @param  string|null $category 文档分类,逗号分隔 (optional)
-     * @param  string|null $tags 标签过滤,逗号分隔 (optional)
-     * @param  string[]|null $page_refs 页码标记 (optional)
-     * @param  string[]|null $related_id 关联 id (optional)
-     * @param  string|null $author 按作者或译者过滤 (optional)
-     * @param  string|null $channel 按来源 channel 过滤 (optional)
+     * @param  string|null $language 文档语言,如 pi、zh、en (optional)
+     * @param  string|null $category 分类,逗号分隔,须全部命中 (optional)
+     * @param  string|null $tags 标签,逗号分隔,命中任一 (optional)
+     * @param  string[]|null $page_refs 页码标记,命中任一 (optional)
+     * @param  string[]|null $related_id 关联 id(经文段落是 &#x60;{book}-{para}&#x60;),命中任一 (optional)
+     * @param  string|null $author 作者或译者 (optional)
+     * @param  string|null $channel 来源 channel 的 uuid (optional)
+     * @param  bool|null $facets 是否在 &#x60;meta.facets&#x60; 里返回按 resource_type / language / category / granularity 的分面计数 (optional, default to false)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  int|null $per_page 每页条数,上限 100 (optional, default to 20)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Search'] to see the possible values for this operation
      *
      * @throws \InvalidArgumentException
      * @return \GuzzleHttp\Psr7\Request
      */
-    public function getApiV3SearchRequest($q, $page = 1, $page_size = 20, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, string $contentType = self::contentTypes['getApiV3Search'][0])
+    public function getApiV3SearchRequest($q, $search_mode = 'fuzzy', $resource_type = null, $resource_id = null, $granularity = null, $language = null, $category = null, $tags = null, $page_refs = null, $related_id = null, $author = null, $channel = null, $facets = false, $page = 1, $per_page = 20, string $contentType = self::contentTypes['getApiV3Search'][0])
     {
 
         // verify the required parameter 'q' is set
@@ -419,6 +438,7 @@ class SearchApi
 
 
 
+
         $resourcePath = '/v3/search';
         $formParams = [];
         $queryParams = [];
@@ -436,24 +456,6 @@ class SearchApi
             true // required
         ) ?? []);
         // query params
-        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
-            $page,
-            'page', // param base name
-            'integer', // openApiType
-            'form', // style
-            true, // explode
-            false // required
-        ) ?? []);
-        // query params
-        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
-            $page_size,
-            'page_size', // param base name
-            'integer', // openApiType
-            'form', // style
-            true, // explode
-            false // required
-        ) ?? []);
-        // query params
         $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
             $search_mode,
             'search_mode', // param base name
@@ -552,6 +554,33 @@ class SearchApi
             true, // explode
             false // required
         ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $facets,
+            'facets', // param base name
+            'boolean', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $page,
+            'page', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $per_page,
+            'per_page', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
 
 
 
@@ -620,14 +649,14 @@ class SearchApi
     /**
      * Operation getApiV3SearchSearch
      *
-     * 按 id 取单条检索结果
+     * 按 id 取单条检索文档
      *
      * @param  string $search OpenSearch 文档 id (required)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3SearchSearch'] to see the possible values for this operation
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return \WikipaliApi\Model\GetApiV3SearchSearch200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     * @return \WikipaliApi\Model\GetApiV3SearchSearch200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
      */
     public function getApiV3SearchSearch($search, string $contentType = self::contentTypes['getApiV3SearchSearch'][0])
     {
@@ -638,14 +667,14 @@ class SearchApi
     /**
      * Operation getApiV3SearchSearchWithHttpInfo
      *
-     * 按 id 取单条检索结果
+     * 按 id 取单条检索文档
      *
      * @param  string $search OpenSearch 文档 id (required)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3SearchSearch'] to see the possible values for this operation
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return array of \WikipaliApi\Model\GetApiV3SearchSearch200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     * @return array of \WikipaliApi\Model\GetApiV3SearchSearch200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
      */
     public function getApiV3SearchSearchWithHttpInfo($search, string $contentType = self::contentTypes['getApiV3SearchSearch'][0])
     {
@@ -693,6 +722,12 @@ class SearchApi
                         $request,
                         $response,
                     );
+                case 503:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
             }
 
             
@@ -741,6 +776,14 @@ class SearchApi
                     );
                     $e->setResponseObject($data);
                     throw $e;
+                case 503:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
             }
         
 
@@ -751,7 +794,7 @@ class SearchApi
     /**
      * Operation getApiV3SearchSearchAsync
      *
-     * 按 id 取单条检索结果
+     * 按 id 取单条检索文档
      *
      * @param  string $search OpenSearch 文档 id (required)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3SearchSearch'] to see the possible values for this operation
@@ -772,7 +815,7 @@ class SearchApi
     /**
      * Operation getApiV3SearchSearchAsyncWithHttpInfo
      *
-     * 按 id 取单条检索结果
+     * 按 id 取单条检索文档
      *
      * @param  string $search OpenSearch 文档 id (required)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3SearchSearch'] to see the possible values for this operation
@@ -931,7 +974,7 @@ class SearchApi
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return \WikipaliApi\Model\GetApiV3Search200Response|\WikipaliApi\Model\ProblemDetails
+     * @return \WikipaliApi\Model\PostApiV3Search200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
      */
     public function postApiV3Search($post_api_v3_search_request, string $contentType = self::contentTypes['postApiV3Search'][0])
     {
@@ -949,7 +992,7 @@ class SearchApi
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return array of \WikipaliApi\Model\GetApiV3Search200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     * @return array of \WikipaliApi\Model\PostApiV3Search200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
      */
     public function postApiV3SearchWithHttpInfo($post_api_v3_search_request, string $contentType = self::contentTypes['postApiV3Search'][0])
     {
@@ -981,7 +1024,7 @@ class SearchApi
             switch($statusCode) {
                 case 200:
                     return $this->handleResponseWithDataType(
-                        '\WikipaliApi\Model\GetApiV3Search200Response',
+                        '\WikipaliApi\Model\PostApiV3Search200Response',
                         $request,
                         $response,
                     );
@@ -991,6 +1034,12 @@ class SearchApi
                         $request,
                         $response,
                     );
+                case 503:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
             }
 
             
@@ -1009,7 +1058,7 @@ class SearchApi
             }
 
             return $this->handleResponseWithDataType(
-                '\WikipaliApi\Model\GetApiV3Search200Response',
+                '\WikipaliApi\Model\PostApiV3Search200Response',
                 $request,
                 $response,
             );
@@ -1018,7 +1067,7 @@ class SearchApi
                 case 200:
                     $data = ObjectSerializer::deserialize(
                         $e->getResponseBody(),
-                        '\WikipaliApi\Model\GetApiV3Search200Response',
+                        '\WikipaliApi\Model\PostApiV3Search200Response',
                         $e->getResponseHeaders()
                     );
                     $e->setResponseObject($data);
@@ -1031,6 +1080,14 @@ class SearchApi
                     );
                     $e->setResponseObject($data);
                     throw $e;
+                case 503:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
             }
         
 
@@ -1072,7 +1129,7 @@ class SearchApi
      */
     public function postApiV3SearchAsyncWithHttpInfo($post_api_v3_search_request, string $contentType = self::contentTypes['postApiV3Search'][0])
     {
-        $returnType = '\WikipaliApi\Model\GetApiV3Search200Response';
+        $returnType = '\WikipaliApi\Model\PostApiV3Search200Response';
         $request = $this->postApiV3SearchRequest($post_api_v3_search_request, $contentType);
 
         return $this->client

+ 6 - 6
api-test/client/lib/Api/SearchSuggestApi.php

@@ -138,7 +138,7 @@ class SearchSuggestApi
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return \WikipaliApi\Model\GetApiV3Search200Response|\WikipaliApi\Model\ProblemDetails
+     * @return \WikipaliApi\Model\GetApiV3SearchSuggest200Response|\WikipaliApi\Model\ProblemDetails
      */
     public function getApiV3SearchSuggest($q, $fields = null, $language = null, $limit = 10, string $contentType = self::contentTypes['getApiV3SearchSuggest'][0])
     {
@@ -159,7 +159,7 @@ class SearchSuggestApi
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return array of \WikipaliApi\Model\GetApiV3Search200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     * @return array of \WikipaliApi\Model\GetApiV3SearchSuggest200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
      */
     public function getApiV3SearchSuggestWithHttpInfo($q, $fields = null, $language = null, $limit = 10, string $contentType = self::contentTypes['getApiV3SearchSuggest'][0])
     {
@@ -191,7 +191,7 @@ class SearchSuggestApi
             switch($statusCode) {
                 case 200:
                     return $this->handleResponseWithDataType(
-                        '\WikipaliApi\Model\GetApiV3Search200Response',
+                        '\WikipaliApi\Model\GetApiV3SearchSuggest200Response',
                         $request,
                         $response,
                     );
@@ -219,7 +219,7 @@ class SearchSuggestApi
             }
 
             return $this->handleResponseWithDataType(
-                '\WikipaliApi\Model\GetApiV3Search200Response',
+                '\WikipaliApi\Model\GetApiV3SearchSuggest200Response',
                 $request,
                 $response,
             );
@@ -228,7 +228,7 @@ class SearchSuggestApi
                 case 200:
                     $data = ObjectSerializer::deserialize(
                         $e->getResponseBody(),
-                        '\WikipaliApi\Model\GetApiV3Search200Response',
+                        '\WikipaliApi\Model\GetApiV3SearchSuggest200Response',
                         $e->getResponseHeaders()
                     );
                     $e->setResponseObject($data);
@@ -288,7 +288,7 @@ class SearchSuggestApi
      */
     public function getApiV3SearchSuggestAsyncWithHttpInfo($q, $fields = null, $language = null, $limit = 10, string $contentType = self::contentTypes['getApiV3SearchSuggest'][0])
     {
-        $returnType = '\WikipaliApi\Model\GetApiV3Search200Response';
+        $returnType = '\WikipaliApi\Model\GetApiV3SearchSuggest200Response';
         $request = $this->getApiV3SearchSuggestRequest($q, $fields, $language, $limit, $contentType);
 
         return $this->client

+ 23 - 23
api-test/client/lib/Api/StudiosApi.php

@@ -626,11 +626,11 @@ class StudiosApi
      * studio 的术语列表
      *
      * @param  string $studio 用户或团队的 uuid (required)
+     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $search 按词、释义搜索 (optional)
      * @param  string|null $quality 质量;pending 含未评级的 (optional)
      * @param  string|null $category 百科分类 (optional)
-     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  string|null $order 排序字段 (optional, default to 'updated_at')
      * @param  string|null $dir 排序方向 (optional)
      * @param  int|null $page 页码 (optional)
@@ -640,9 +640,9 @@ class StudiosApi
      * @throws \InvalidArgumentException
      * @return \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
      */
-    public function getApiV3StudiosStudioTerms($studio, $per_page = 20, $search = null, $quality = null, $category = null, $general = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
+    public function getApiV3StudiosStudioTerms($studio, $general = null, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
     {
-        list($response) = $this->getApiV3StudiosStudioTermsWithHttpInfo($studio, $per_page, $search, $quality, $category, $general, $order, $dir, $page, $contentType);
+        list($response) = $this->getApiV3StudiosStudioTermsWithHttpInfo($studio, $general, $per_page, $search, $quality, $category, $order, $dir, $page, $contentType);
         return $response;
     }
 
@@ -652,11 +652,11 @@ class StudiosApi
      * studio 的术语列表
      *
      * @param  string $studio 用户或团队的 uuid (required)
+     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $search 按词、释义搜索 (optional)
      * @param  string|null $quality 质量;pending 含未评级的 (optional)
      * @param  string|null $category 百科分类 (optional)
-     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  string|null $order 排序字段 (optional, default to 'updated_at')
      * @param  string|null $dir 排序方向 (optional)
      * @param  int|null $page 页码 (optional)
@@ -666,9 +666,9 @@ class StudiosApi
      * @throws \InvalidArgumentException
      * @return array of \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
      */
-    public function getApiV3StudiosStudioTermsWithHttpInfo($studio, $per_page = 20, $search = null, $quality = null, $category = null, $general = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
+    public function getApiV3StudiosStudioTermsWithHttpInfo($studio, $general = null, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
     {
-        $request = $this->getApiV3StudiosStudioTermsRequest($studio, $per_page, $search, $quality, $category, $general, $order, $dir, $page, $contentType);
+        $request = $this->getApiV3StudiosStudioTermsRequest($studio, $general, $per_page, $search, $quality, $category, $order, $dir, $page, $contentType);
 
         try {
             $options = $this->createHttpClientOption();
@@ -787,11 +787,11 @@ class StudiosApi
      * studio 的术语列表
      *
      * @param  string $studio 用户或团队的 uuid (required)
+     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $search 按词、释义搜索 (optional)
      * @param  string|null $quality 质量;pending 含未评级的 (optional)
      * @param  string|null $category 百科分类 (optional)
-     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  string|null $order 排序字段 (optional, default to 'updated_at')
      * @param  string|null $dir 排序方向 (optional)
      * @param  int|null $page 页码 (optional)
@@ -800,9 +800,9 @@ class StudiosApi
      * @throws \InvalidArgumentException
      * @return \GuzzleHttp\Promise\PromiseInterface
      */
-    public function getApiV3StudiosStudioTermsAsync($studio, $per_page = 20, $search = null, $quality = null, $category = null, $general = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
+    public function getApiV3StudiosStudioTermsAsync($studio, $general = null, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
     {
-        return $this->getApiV3StudiosStudioTermsAsyncWithHttpInfo($studio, $per_page, $search, $quality, $category, $general, $order, $dir, $page, $contentType)
+        return $this->getApiV3StudiosStudioTermsAsyncWithHttpInfo($studio, $general, $per_page, $search, $quality, $category, $order, $dir, $page, $contentType)
             ->then(
                 function ($response) {
                     return $response[0];
@@ -816,11 +816,11 @@ class StudiosApi
      * studio 的术语列表
      *
      * @param  string $studio 用户或团队的 uuid (required)
+     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $search 按词、释义搜索 (optional)
      * @param  string|null $quality 质量;pending 含未评级的 (optional)
      * @param  string|null $category 百科分类 (optional)
-     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  string|null $order 排序字段 (optional, default to 'updated_at')
      * @param  string|null $dir 排序方向 (optional)
      * @param  int|null $page 页码 (optional)
@@ -829,10 +829,10 @@ class StudiosApi
      * @throws \InvalidArgumentException
      * @return \GuzzleHttp\Promise\PromiseInterface
      */
-    public function getApiV3StudiosStudioTermsAsyncWithHttpInfo($studio, $per_page = 20, $search = null, $quality = null, $category = null, $general = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
+    public function getApiV3StudiosStudioTermsAsyncWithHttpInfo($studio, $general = null, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
     {
         $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response';
-        $request = $this->getApiV3StudiosStudioTermsRequest($studio, $per_page, $search, $quality, $category, $general, $order, $dir, $page, $contentType);
+        $request = $this->getApiV3StudiosStudioTermsRequest($studio, $general, $per_page, $search, $quality, $category, $order, $dir, $page, $contentType);
 
         return $this->client
             ->sendAsync($request, $this->createHttpClientOption())
@@ -874,11 +874,11 @@ class StudiosApi
      * Create request for operation 'getApiV3StudiosStudioTerms'
      *
      * @param  string $studio 用户或团队的 uuid (required)
+     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $search 按词、释义搜索 (optional)
      * @param  string|null $quality 质量;pending 含未评级的 (optional)
      * @param  string|null $category 百科分类 (optional)
-     * @param  bool|null $general 只要 studio 级术语(不属于任何 channel) (optional)
      * @param  string|null $order 排序字段 (optional, default to 'updated_at')
      * @param  string|null $dir 排序方向 (optional)
      * @param  int|null $page 页码 (optional)
@@ -887,7 +887,7 @@ class StudiosApi
      * @throws \InvalidArgumentException
      * @return \GuzzleHttp\Psr7\Request
      */
-    public function getApiV3StudiosStudioTermsRequest($studio, $per_page = 20, $search = null, $quality = null, $category = null, $general = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
+    public function getApiV3StudiosStudioTermsRequest($studio, $general = null, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3StudiosStudioTerms'][0])
     {
 
         // verify the required parameter 'studio' is set
@@ -913,6 +913,15 @@ class StudiosApi
         $httpBody = '';
         $multipart = false;
 
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $general,
+            'general', // param base name
+            'boolean', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
         // query params
         $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
             $per_page,
@@ -950,15 +959,6 @@ class StudiosApi
             false // required
         ) ?? []);
         // query params
-        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
-            $general,
-            'general', // param base name
-            'boolean', // openApiType
-            'form', // style
-            true, // explode
-            false // required
-        ) ?? []);
-        // query params
         $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
             $order,
             'order', // param base name

+ 23 - 23
api-test/client/lib/Api/TermsApi.php

@@ -458,11 +458,11 @@ class TermsApi
      * 按词查术语
      *
      * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $tag 义项;传空串只要没有义项的 (optional)
      * @param  string|null $channel 只要这个 channel 的 (optional)
      * @param  string|null $language 只要这个语言的 (optional)
-     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $page 页码 (optional)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Terms'] to see the possible values for this operation
      *
@@ -470,9 +470,9 @@ class TermsApi
      * @throws \InvalidArgumentException
      * @return \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails
      */
-    public function getApiV3Terms($word, $per_page = 20, $tag = null, $channel = null, $language = null, $with_body = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
+    public function getApiV3Terms($word, $with_body = null, $per_page = 20, $tag = null, $channel = null, $language = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
     {
-        list($response) = $this->getApiV3TermsWithHttpInfo($word, $per_page, $tag, $channel, $language, $with_body, $page, $contentType);
+        list($response) = $this->getApiV3TermsWithHttpInfo($word, $with_body, $per_page, $tag, $channel, $language, $page, $contentType);
         return $response;
     }
 
@@ -482,11 +482,11 @@ class TermsApi
      * 按词查术语
      *
      * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $tag 义项;传空串只要没有义项的 (optional)
      * @param  string|null $channel 只要这个 channel 的 (optional)
      * @param  string|null $language 只要这个语言的 (optional)
-     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $page 页码 (optional)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Terms'] to see the possible values for this operation
      *
@@ -494,9 +494,9 @@ class TermsApi
      * @throws \InvalidArgumentException
      * @return array of \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
      */
-    public function getApiV3TermsWithHttpInfo($word, $per_page = 20, $tag = null, $channel = null, $language = null, $with_body = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
+    public function getApiV3TermsWithHttpInfo($word, $with_body = null, $per_page = 20, $tag = null, $channel = null, $language = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
     {
-        $request = $this->getApiV3TermsRequest($word, $per_page, $tag, $channel, $language, $with_body, $page, $contentType);
+        $request = $this->getApiV3TermsRequest($word, $with_body, $per_page, $tag, $channel, $language, $page, $contentType);
 
         try {
             $options = $this->createHttpClientOption();
@@ -587,20 +587,20 @@ class TermsApi
      * 按词查术语
      *
      * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $tag 义项;传空串只要没有义项的 (optional)
      * @param  string|null $channel 只要这个 channel 的 (optional)
      * @param  string|null $language 只要这个语言的 (optional)
-     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $page 页码 (optional)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Terms'] to see the possible values for this operation
      *
      * @throws \InvalidArgumentException
      * @return \GuzzleHttp\Promise\PromiseInterface
      */
-    public function getApiV3TermsAsync($word, $per_page = 20, $tag = null, $channel = null, $language = null, $with_body = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
+    public function getApiV3TermsAsync($word, $with_body = null, $per_page = 20, $tag = null, $channel = null, $language = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
     {
-        return $this->getApiV3TermsAsyncWithHttpInfo($word, $per_page, $tag, $channel, $language, $with_body, $page, $contentType)
+        return $this->getApiV3TermsAsyncWithHttpInfo($word, $with_body, $per_page, $tag, $channel, $language, $page, $contentType)
             ->then(
                 function ($response) {
                     return $response[0];
@@ -614,21 +614,21 @@ class TermsApi
      * 按词查术语
      *
      * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $tag 义项;传空串只要没有义项的 (optional)
      * @param  string|null $channel 只要这个 channel 的 (optional)
      * @param  string|null $language 只要这个语言的 (optional)
-     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $page 页码 (optional)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Terms'] to see the possible values for this operation
      *
      * @throws \InvalidArgumentException
      * @return \GuzzleHttp\Promise\PromiseInterface
      */
-    public function getApiV3TermsAsyncWithHttpInfo($word, $per_page = 20, $tag = null, $channel = null, $language = null, $with_body = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
+    public function getApiV3TermsAsyncWithHttpInfo($word, $with_body = null, $per_page = 20, $tag = null, $channel = null, $language = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
     {
         $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response';
-        $request = $this->getApiV3TermsRequest($word, $per_page, $tag, $channel, $language, $with_body, $page, $contentType);
+        $request = $this->getApiV3TermsRequest($word, $with_body, $per_page, $tag, $channel, $language, $page, $contentType);
 
         return $this->client
             ->sendAsync($request, $this->createHttpClientOption())
@@ -670,18 +670,18 @@ class TermsApi
      * Create request for operation 'getApiV3Terms'
      *
      * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $per_page 每页条数,最大 200 (optional, default to 20)
      * @param  string|null $tag 义项;传空串只要没有义项的 (optional)
      * @param  string|null $channel 只要这个 channel 的 (optional)
      * @param  string|null $language 只要这个语言的 (optional)
-     * @param  bool|null $with_body 每条都带渲染后的正文 &#x60;body&#x60; (optional)
      * @param  int|null $page 页码 (optional)
      * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Terms'] to see the possible values for this operation
      *
      * @throws \InvalidArgumentException
      * @return \GuzzleHttp\Psr7\Request
      */
-    public function getApiV3TermsRequest($word, $per_page = 20, $tag = null, $channel = null, $language = null, $with_body = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
+    public function getApiV3TermsRequest($word, $with_body = null, $per_page = 20, $tag = null, $channel = null, $language = null, $page = null, string $contentType = self::contentTypes['getApiV3Terms'][0])
     {
 
         // verify the required parameter 'word' is set
@@ -705,6 +705,15 @@ class TermsApi
         $httpBody = '';
         $multipart = false;
 
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $with_body,
+            'with_body', // param base name
+            'boolean', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
         // query params
         $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
             $per_page,
@@ -751,15 +760,6 @@ class TermsApi
             false // required
         ) ?? []);
         // query params
-        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
-            $with_body,
-            'with_body', // param base name
-            'boolean', // openApiType
-            'form', // style
-            true, // explode
-            false // required
-        ) ?? []);
-        // query params
         $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
             $page,
             'page', // param base name

+ 6 - 6
api-test/client/lib/Api/UpgradeApi.php

@@ -134,7 +134,7 @@ class UpgradeApi
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return \WikipaliApi\Model\GetApiV3SearchSearch200Response
+     * @return \WikipaliApi\Model\GetApiV3Upgrade200Response
      */
     public function getApiV3Upgrade(string $contentType = self::contentTypes['getApiV3Upgrade'][0])
     {
@@ -151,7 +151,7 @@ class UpgradeApi
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return array of \WikipaliApi\Model\GetApiV3SearchSearch200Response, HTTP status code, HTTP response headers (array of strings)
+     * @return array of \WikipaliApi\Model\GetApiV3Upgrade200Response, HTTP status code, HTTP response headers (array of strings)
      */
     public function getApiV3UpgradeWithHttpInfo(string $contentType = self::contentTypes['getApiV3Upgrade'][0])
     {
@@ -183,7 +183,7 @@ class UpgradeApi
             switch($statusCode) {
                 case 200:
                     return $this->handleResponseWithDataType(
-                        '\WikipaliApi\Model\GetApiV3SearchSearch200Response',
+                        '\WikipaliApi\Model\GetApiV3Upgrade200Response',
                         $request,
                         $response,
                     );
@@ -205,7 +205,7 @@ class UpgradeApi
             }
 
             return $this->handleResponseWithDataType(
-                '\WikipaliApi\Model\GetApiV3SearchSearch200Response',
+                '\WikipaliApi\Model\GetApiV3Upgrade200Response',
                 $request,
                 $response,
             );
@@ -214,7 +214,7 @@ class UpgradeApi
                 case 200:
                     $data = ObjectSerializer::deserialize(
                         $e->getResponseBody(),
-                        '\WikipaliApi\Model\GetApiV3SearchSearch200Response',
+                        '\WikipaliApi\Model\GetApiV3Upgrade200Response',
                         $e->getResponseHeaders()
                     );
                     $e->setResponseObject($data);
@@ -258,7 +258,7 @@ class UpgradeApi
      */
     public function getApiV3UpgradeAsyncWithHttpInfo(string $contentType = self::contentTypes['getApiV3Upgrade'][0])
     {
-        $returnType = '\WikipaliApi\Model\GetApiV3SearchSearch200Response';
+        $returnType = '\WikipaliApi\Model\GetApiV3Upgrade200Response';
         $request = $this->getApiV3UpgradeRequest($contentType);
 
         return $this->client

+ 409 - 0
api-test/client/lib/Model/GetApiV3NissayaCardsEnding200Response.php

@@ -0,0 +1,409 @@
+<?php
+/**
+ * GetApiV3NissayaCardsEnding200Response
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3NissayaCardsEnding200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3NissayaCardsEnding200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_nissaya_cards_ending__200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseData'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'data' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'data' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'data' => 'data'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'data' => 'setData'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'data' => 'getData'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('data', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets data
+     *
+     * @return \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseData|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseData|null $data data
+     *
+     * @return self
+     */
+    public function setData($data)
+    {
+        if (is_null($data)) {
+            throw new \InvalidArgumentException('non-nullable data cannot be null');
+        }
+        $this->container['data'] = $data;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 518 - 0
api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseData.php

@@ -0,0 +1,518 @@
+<?php
+/**
+ * GetApiV3NissayaCardsEnding200ResponseData
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3NissayaCardsEnding200ResponseData Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3NissayaCardsEnding200ResponseData implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_nissaya_cards_ending__200_response_data';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'ending' => 'string',
+        'lang' => 'string',
+        'term' => '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataTerm',
+        'relations' => '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInner[]'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'ending' => null,
+        'lang' => null,
+        'term' => null,
+        'relations' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'ending' => false,
+        'lang' => false,
+        'term' => true,
+        'relations' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'ending' => 'ending',
+        'lang' => 'lang',
+        'term' => 'term',
+        'relations' => 'relations'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'ending' => 'setEnding',
+        'lang' => 'setLang',
+        'term' => 'setTerm',
+        'relations' => 'setRelations'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'ending' => 'getEnding',
+        'lang' => 'getLang',
+        'term' => 'getTerm',
+        'relations' => 'getRelations'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('ending', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('term', $data ?? [], null);
+        $this->setIfExists('relations', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets ending
+     *
+     * @return string|null
+     */
+    public function getEnding()
+    {
+        return $this->container['ending'];
+    }
+
+    /**
+     * Sets ending
+     *
+     * @param string|null $ending ending
+     *
+     * @return self
+     */
+    public function setEnding($ending)
+    {
+        if (is_null($ending)) {
+            throw new \InvalidArgumentException('non-nullable ending cannot be null');
+        }
+        $this->container['ending'] = $ending;
+
+        return $this;
+    }
+
+    /**
+     * Gets lang
+     *
+     * @return string|null
+     */
+    public function getLang()
+    {
+        return $this->container['lang'];
+    }
+
+    /**
+     * Sets lang
+     *
+     * @param string|null $lang lang
+     *
+     * @return self
+     */
+    public function setLang($lang)
+    {
+        if (is_null($lang)) {
+            throw new \InvalidArgumentException('non-nullable lang cannot be null');
+        }
+        $this->container['lang'] = $lang;
+
+        return $this;
+    }
+
+    /**
+     * Gets term
+     *
+     * @return \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataTerm|null
+     */
+    public function getTerm()
+    {
+        return $this->container['term'];
+    }
+
+    /**
+     * Sets term
+     *
+     * @param \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataTerm|null $term term
+     *
+     * @return self
+     */
+    public function setTerm($term)
+    {
+        if (is_null($term)) {
+            array_push($this->openAPINullablesSetToNull, 'term');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('term', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['term'] = $term;
+
+        return $this;
+    }
+
+    /**
+     * Gets relations
+     *
+     * @return \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInner[]|null
+     */
+    public function getRelations()
+    {
+        return $this->container['relations'];
+    }
+
+    /**
+     * Sets relations
+     *
+     * @param \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInner[]|null $relations relations
+     *
+     * @return self
+     */
+    public function setRelations($relations)
+    {
+        if (is_null($relations)) {
+            throw new \InvalidArgumentException('non-nullable relations cannot be null');
+        }
+        $this->container['relations'] = $relations;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 607 - 0
api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInner.php

@@ -0,0 +1,607 @@
+<?php
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataRelationsInner
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataRelationsInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3NissayaCardsEnding200ResponseDataRelationsInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_nissaya_cards_ending__200_response_data_relations_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'relation' => 'string',
+        'relation_label' => 'string',
+        'from' => '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom',
+        'to' => '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom',
+        'category' => '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory',
+        'local_endings' => 'string[]'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'relation' => null,
+        'relation_label' => null,
+        'from' => null,
+        'to' => null,
+        'category' => null,
+        'local_endings' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'relation' => false,
+        'relation_label' => true,
+        'from' => true,
+        'to' => true,
+        'category' => true,
+        'local_endings' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'relation' => 'relation',
+        'relation_label' => 'relation_label',
+        'from' => 'from',
+        'to' => 'to',
+        'category' => 'category',
+        'local_endings' => 'local_endings'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'relation' => 'setRelation',
+        'relation_label' => 'setRelationLabel',
+        'from' => 'setFrom',
+        'to' => 'setTo',
+        'category' => 'setCategory',
+        'local_endings' => 'setLocalEndings'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'relation' => 'getRelation',
+        'relation_label' => 'getRelationLabel',
+        'from' => 'getFrom',
+        'to' => 'getTo',
+        'category' => 'getCategory',
+        'local_endings' => 'getLocalEndings'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('relation', $data ?? [], null);
+        $this->setIfExists('relation_label', $data ?? [], null);
+        $this->setIfExists('from', $data ?? [], null);
+        $this->setIfExists('to', $data ?? [], null);
+        $this->setIfExists('category', $data ?? [], null);
+        $this->setIfExists('local_endings', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets relation
+     *
+     * @return string|null
+     */
+    public function getRelation()
+    {
+        return $this->container['relation'];
+    }
+
+    /**
+     * Sets relation
+     *
+     * @param string|null $relation relation
+     *
+     * @return self
+     */
+    public function setRelation($relation)
+    {
+        if (is_null($relation)) {
+            throw new \InvalidArgumentException('non-nullable relation cannot be null');
+        }
+        $this->container['relation'] = $relation;
+
+        return $this;
+    }
+
+    /**
+     * Gets relation_label
+     *
+     * @return string|null
+     */
+    public function getRelationLabel()
+    {
+        return $this->container['relation_label'];
+    }
+
+    /**
+     * Sets relation_label
+     *
+     * @param string|null $relation_label relation_label
+     *
+     * @return self
+     */
+    public function setRelationLabel($relation_label)
+    {
+        if (is_null($relation_label)) {
+            array_push($this->openAPINullablesSetToNull, 'relation_label');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('relation_label', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['relation_label'] = $relation_label;
+
+        return $this;
+    }
+
+    /**
+     * Gets from
+     *
+     * @return \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom|null
+     */
+    public function getFrom()
+    {
+        return $this->container['from'];
+    }
+
+    /**
+     * Sets from
+     *
+     * @param \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom|null $from from
+     *
+     * @return self
+     */
+    public function setFrom($from)
+    {
+        if (is_null($from)) {
+            array_push($this->openAPINullablesSetToNull, 'from');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('from', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['from'] = $from;
+
+        return $this;
+    }
+
+    /**
+     * Gets to
+     *
+     * @return \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom|null
+     */
+    public function getTo()
+    {
+        return $this->container['to'];
+    }
+
+    /**
+     * Sets to
+     *
+     * @param \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom|null $to to
+     *
+     * @return self
+     */
+    public function setTo($to)
+    {
+        if (is_null($to)) {
+            array_push($this->openAPINullablesSetToNull, 'to');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('to', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['to'] = $to;
+
+        return $this;
+    }
+
+    /**
+     * Gets category
+     *
+     * @return \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory|null
+     */
+    public function getCategory()
+    {
+        return $this->container['category'];
+    }
+
+    /**
+     * Sets category
+     *
+     * @param \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory|null $category category
+     *
+     * @return self
+     */
+    public function setCategory($category)
+    {
+        if (is_null($category)) {
+            array_push($this->openAPINullablesSetToNull, 'category');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('category', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['category'] = $category;
+
+        return $this;
+    }
+
+    /**
+     * Gets local_endings
+     *
+     * @return string[]|null
+     */
+    public function getLocalEndings()
+    {
+        return $this->container['local_endings'];
+    }
+
+    /**
+     * Sets local_endings
+     *
+     * @param string[]|null $local_endings local_endings
+     *
+     * @return self
+     */
+    public function setLocalEndings($local_endings)
+    {
+        if (is_null($local_endings)) {
+            throw new \InvalidArgumentException('non-nullable local_endings cannot be null');
+        }
+        $this->container['local_endings'] = $local_endings;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 477 - 0
api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory.php

@@ -0,0 +1,477 @@
+<?php
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerCategory implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_nissaya_cards_ending__200_response_data_relations_inner_category';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'name' => 'string',
+        'meaning' => 'string',
+        'note' => 'string'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'name' => null,
+        'meaning' => null,
+        'note' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'name' => false,
+        'meaning' => false,
+        'note' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'name' => 'name',
+        'meaning' => 'meaning',
+        'note' => 'note'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'name' => 'setName',
+        'meaning' => 'setMeaning',
+        'note' => 'setNote'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'name' => 'getName',
+        'meaning' => 'getMeaning',
+        'note' => 'getNote'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('name', $data ?? [], null);
+        $this->setIfExists('meaning', $data ?? [], null);
+        $this->setIfExists('note', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets name
+     *
+     * @return string|null
+     */
+    public function getName()
+    {
+        return $this->container['name'];
+    }
+
+    /**
+     * Sets name
+     *
+     * @param string|null $name name
+     *
+     * @return self
+     */
+    public function setName($name)
+    {
+        if (is_null($name)) {
+            throw new \InvalidArgumentException('non-nullable name cannot be null');
+        }
+        $this->container['name'] = $name;
+
+        return $this;
+    }
+
+    /**
+     * Gets meaning
+     *
+     * @return string|null
+     */
+    public function getMeaning()
+    {
+        return $this->container['meaning'];
+    }
+
+    /**
+     * Sets meaning
+     *
+     * @param string|null $meaning meaning
+     *
+     * @return self
+     */
+    public function setMeaning($meaning)
+    {
+        if (is_null($meaning)) {
+            throw new \InvalidArgumentException('non-nullable meaning cannot be null');
+        }
+        $this->container['meaning'] = $meaning;
+
+        return $this;
+    }
+
+    /**
+     * Gets note
+     *
+     * @return string|null
+     */
+    public function getNote()
+    {
+        return $this->container['note'];
+    }
+
+    /**
+     * Sets note
+     *
+     * @param string|null $note note
+     *
+     * @return self
+     */
+    public function setNote($note)
+    {
+        if (is_null($note)) {
+            throw new \InvalidArgumentException('non-nullable note cannot be null');
+        }
+        $this->container['note'] = $note;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 443 - 0
api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFrom implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_nissaya_cards_ending__200_response_data_relations_inner_from';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'cases' => '\WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner[]',
+        'spell' => 'string'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'cases' => null,
+        'spell' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'cases' => false,
+        'spell' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'cases' => 'cases',
+        'spell' => 'spell'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'cases' => 'setCases',
+        'spell' => 'setSpell'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'cases' => 'getCases',
+        'spell' => 'getSpell'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('cases', $data ?? [], null);
+        $this->setIfExists('spell', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets cases
+     *
+     * @return \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner[]|null
+     */
+    public function getCases()
+    {
+        return $this->container['cases'];
+    }
+
+    /**
+     * Sets cases
+     *
+     * @param \WikipaliApi\Model\GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner[]|null $cases cases
+     *
+     * @return self
+     */
+    public function setCases($cases)
+    {
+        if (is_null($cases)) {
+            throw new \InvalidArgumentException('non-nullable cases cannot be null');
+        }
+        $this->container['cases'] = $cases;
+
+        return $this;
+    }
+
+    /**
+     * Gets spell
+     *
+     * @return string|null
+     */
+    public function getSpell()
+    {
+        return $this->container['spell'];
+    }
+
+    /**
+     * Sets spell
+     *
+     * @param string|null $spell spell
+     *
+     * @return self
+     */
+    public function setSpell($spell)
+    {
+        if (is_null($spell)) {
+            throw new \InvalidArgumentException('non-nullable spell cannot be null');
+        }
+        $this->container['spell'] = $spell;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 443 - 0
api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3NissayaCardsEnding200ResponseDataRelationsInnerFromCasesInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_nissaya_cards_ending__200_response_data_relations_inner_from_cases_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'case' => 'string',
+        'label' => 'string'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'case' => null,
+        'label' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'case' => false,
+        'label' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'case' => 'case',
+        'label' => 'label'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'case' => 'setCase',
+        'label' => 'setLabel'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'case' => 'getCase',
+        'label' => 'getLabel'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('case', $data ?? [], null);
+        $this->setIfExists('label', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets case
+     *
+     * @return string|null
+     */
+    public function getCase()
+    {
+        return $this->container['case'];
+    }
+
+    /**
+     * Sets case
+     *
+     * @param string|null $case case
+     *
+     * @return self
+     */
+    public function setCase($case)
+    {
+        if (is_null($case)) {
+            throw new \InvalidArgumentException('non-nullable case cannot be null');
+        }
+        $this->container['case'] = $case;
+
+        return $this;
+    }
+
+    /**
+     * Gets label
+     *
+     * @return string|null
+     */
+    public function getLabel()
+    {
+        return $this->container['label'];
+    }
+
+    /**
+     * Sets label
+     *
+     * @param string|null $label label
+     *
+     * @return self
+     */
+    public function setLabel($label)
+    {
+        if (is_null($label)) {
+            throw new \InvalidArgumentException('non-nullable label cannot be null');
+        }
+        $this->container['label'] = $label;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 545 - 0
api-test/client/lib/Model/GetApiV3NissayaCardsEnding200ResponseDataTerm.php

@@ -0,0 +1,545 @@
+<?php
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataTerm
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3NissayaCardsEnding200ResponseDataTerm Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3NissayaCardsEnding200ResponseDataTerm implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_nissaya_cards_ending__200_response_data_term';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'word' => 'string',
+        'tag' => 'string',
+        'meaning' => 'string',
+        'body' => '\WikipaliApi\Model\MarkupNode[]'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'id' => null,
+        'word' => null,
+        'tag' => null,
+        'meaning' => null,
+        'body' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'word' => false,
+        'tag' => false,
+        'meaning' => false,
+        'body' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'id' => 'id',
+        'word' => 'word',
+        'tag' => 'tag',
+        'meaning' => 'meaning',
+        'body' => 'body'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'word' => 'setWord',
+        'tag' => 'setTag',
+        'meaning' => 'setMeaning',
+        'body' => 'setBody'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'word' => 'getWord',
+        'tag' => 'getTag',
+        'meaning' => 'getMeaning',
+        'body' => 'getBody'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('id', $data ?? [], null);
+        $this->setIfExists('word', $data ?? [], null);
+        $this->setIfExists('tag', $data ?? [], null);
+        $this->setIfExists('meaning', $data ?? [], null);
+        $this->setIfExists('body', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets id
+     *
+     * @return string|null
+     */
+    public function getId()
+    {
+        return $this->container['id'];
+    }
+
+    /**
+     * Sets id
+     *
+     * @param string|null $id id
+     *
+     * @return self
+     */
+    public function setId($id)
+    {
+        if (is_null($id)) {
+            throw new \InvalidArgumentException('non-nullable id cannot be null');
+        }
+        $this->container['id'] = $id;
+
+        return $this;
+    }
+
+    /**
+     * Gets word
+     *
+     * @return string|null
+     */
+    public function getWord()
+    {
+        return $this->container['word'];
+    }
+
+    /**
+     * Sets word
+     *
+     * @param string|null $word word
+     *
+     * @return self
+     */
+    public function setWord($word)
+    {
+        if (is_null($word)) {
+            throw new \InvalidArgumentException('non-nullable word cannot be null');
+        }
+        $this->container['word'] = $word;
+
+        return $this;
+    }
+
+    /**
+     * Gets tag
+     *
+     * @return string|null
+     */
+    public function getTag()
+    {
+        return $this->container['tag'];
+    }
+
+    /**
+     * Sets tag
+     *
+     * @param string|null $tag tag
+     *
+     * @return self
+     */
+    public function setTag($tag)
+    {
+        if (is_null($tag)) {
+            throw new \InvalidArgumentException('non-nullable tag cannot be null');
+        }
+        $this->container['tag'] = $tag;
+
+        return $this;
+    }
+
+    /**
+     * Gets meaning
+     *
+     * @return string|null
+     */
+    public function getMeaning()
+    {
+        return $this->container['meaning'];
+    }
+
+    /**
+     * Sets meaning
+     *
+     * @param string|null $meaning meaning
+     *
+     * @return self
+     */
+    public function setMeaning($meaning)
+    {
+        if (is_null($meaning)) {
+            throw new \InvalidArgumentException('non-nullable meaning cannot be null');
+        }
+        $this->container['meaning'] = $meaning;
+
+        return $this;
+    }
+
+    /**
+     * Gets body
+     *
+     * @return \WikipaliApi\Model\MarkupNode[]|null
+     */
+    public function getBody()
+    {
+        return $this->container['body'];
+    }
+
+    /**
+     * Sets body
+     *
+     * @param \WikipaliApi\Model\MarkupNode[]|null $body body
+     *
+     * @return self
+     */
+    public function setBody($body)
+    {
+        if (is_null($body)) {
+            throw new \InvalidArgumentException('non-nullable body cannot be null');
+        }
+        $this->container['body'] = $body;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 33 - 33
api-test/client/lib/Model/GetApiV3Search200Response.php

@@ -57,8 +57,8 @@ class GetApiV3Search200Response implements ModelInterface, ArrayAccess, \JsonSer
      * @var string[]
      */
     protected static $openAPITypes = [
-        'success' => 'bool',
-        'data' => 'object'
+        'data' => '\WikipaliApi\Model\GetApiV3Search200ResponseDataInner[]',
+        'meta' => '\WikipaliApi\Model\GetApiV3Search200ResponseMeta'
     ];
 
     /**
@@ -69,8 +69,8 @@ class GetApiV3Search200Response implements ModelInterface, ArrayAccess, \JsonSer
      * @psalm-var array<string, string|null>
      */
     protected static $openAPIFormats = [
-        'success' => null,
-        'data' => null
+        'data' => null,
+        'meta' => null
     ];
 
     /**
@@ -79,8 +79,8 @@ class GetApiV3Search200Response implements ModelInterface, ArrayAccess, \JsonSer
      * @var boolean[]
      */
     protected static array $openAPINullables = [
-        'success' => false,
-        'data' => false
+        'data' => false,
+        'meta' => false
     ];
 
     /**
@@ -169,8 +169,8 @@ class GetApiV3Search200Response implements ModelInterface, ArrayAccess, \JsonSer
      * @var string[]
      */
     protected static $attributeMap = [
-        'success' => 'success',
-        'data' => 'data'
+        'data' => 'data',
+        'meta' => 'meta'
     ];
 
     /**
@@ -179,8 +179,8 @@ class GetApiV3Search200Response implements ModelInterface, ArrayAccess, \JsonSer
      * @var string[]
      */
     protected static $setters = [
-        'success' => 'setSuccess',
-        'data' => 'setData'
+        'data' => 'setData',
+        'meta' => 'setMeta'
     ];
 
     /**
@@ -189,8 +189,8 @@ class GetApiV3Search200Response implements ModelInterface, ArrayAccess, \JsonSer
      * @var string[]
      */
     protected static $getters = [
-        'success' => 'getSuccess',
-        'data' => 'getData'
+        'data' => 'getData',
+        'meta' => 'getMeta'
     ];
 
     /**
@@ -250,8 +250,8 @@ class GetApiV3Search200Response implements ModelInterface, ArrayAccess, \JsonSer
      */
     public function __construct(?array $data = null)
     {
-        $this->setIfExists('success', $data ?? [], null);
         $this->setIfExists('data', $data ?? [], null);
+        $this->setIfExists('meta', $data ?? [], null);
     }
 
     /**
@@ -297,55 +297,55 @@ class GetApiV3Search200Response implements ModelInterface, ArrayAccess, \JsonSer
 
 
     /**
-     * Gets success
+     * Gets data
      *
-     * @return bool|null
+     * @return \WikipaliApi\Model\GetApiV3Search200ResponseDataInner[]|null
      */
-    public function getSuccess()
+    public function getData()
     {
-        return $this->container['success'];
+        return $this->container['data'];
     }
 
     /**
-     * Sets success
+     * Sets data
      *
-     * @param bool|null $success success
+     * @param \WikipaliApi\Model\GetApiV3Search200ResponseDataInner[]|null $data data
      *
      * @return self
      */
-    public function setSuccess($success)
+    public function setData($data)
     {
-        if (is_null($success)) {
-            throw new \InvalidArgumentException('non-nullable success cannot be null');
+        if (is_null($data)) {
+            throw new \InvalidArgumentException('non-nullable data cannot be null');
         }
-        $this->container['success'] = $success;
+        $this->container['data'] = $data;
 
         return $this;
     }
 
     /**
-     * Gets data
+     * Gets meta
      *
-     * @return object|null
+     * @return \WikipaliApi\Model\GetApiV3Search200ResponseMeta|null
      */
-    public function getData()
+    public function getMeta()
     {
-        return $this->container['data'];
+        return $this->container['meta'];
     }
 
     /**
-     * Sets data
+     * Sets meta
      *
-     * @param object|null $data data
+     * @param \WikipaliApi\Model\GetApiV3Search200ResponseMeta|null $meta meta
      *
      * @return self
      */
-    public function setData($data)
+    public function setMeta($meta)
     {
-        if (is_null($data)) {
-            throw new \InvalidArgumentException('non-nullable data cannot be null');
+        if (is_null($meta)) {
+            throw new \InvalidArgumentException('non-nullable meta cannot be null');
         }
-        $this->container['data'] = $data;
+        $this->container['meta'] = $meta;
 
         return $this;
     }

+ 975 - 0
api-test/client/lib/Model/GetApiV3Search200ResponseDataInner.php

@@ -0,0 +1,975 @@
+<?php
+/**
+ * GetApiV3Search200ResponseDataInner
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3Search200ResponseDataInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3Search200ResponseDataInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_search_200_response_data_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'resource_type' => 'string',
+        'resource_id' => 'string',
+        'granularity' => 'string',
+        'language' => 'string',
+        'related_id' => 'string',
+        'score' => 'float',
+        'title' => 'string',
+        'content' => 'string',
+        'highlight' => 'string',
+        'bold' => 'string[]',
+        'path' => 'string',
+        'category' => 'string[]',
+        'tags' => 'string[]',
+        'updated_at' => 'string',
+        'display' => 'string'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'id' => null,
+        'resource_type' => null,
+        'resource_id' => null,
+        'granularity' => null,
+        'language' => null,
+        'related_id' => null,
+        'score' => null,
+        'title' => null,
+        'content' => null,
+        'highlight' => null,
+        'bold' => null,
+        'path' => null,
+        'category' => null,
+        'tags' => null,
+        'updated_at' => null,
+        'display' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'resource_type' => false,
+        'resource_id' => true,
+        'granularity' => true,
+        'language' => true,
+        'related_id' => true,
+        'score' => true,
+        'title' => false,
+        'content' => false,
+        'highlight' => true,
+        'bold' => false,
+        'path' => true,
+        'category' => false,
+        'tags' => false,
+        'updated_at' => true,
+        'display' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'id' => 'id',
+        'resource_type' => 'resource_type',
+        'resource_id' => 'resource_id',
+        'granularity' => 'granularity',
+        'language' => 'language',
+        'related_id' => 'related_id',
+        'score' => 'score',
+        'title' => 'title',
+        'content' => 'content',
+        'highlight' => 'highlight',
+        'bold' => 'bold',
+        'path' => 'path',
+        'category' => 'category',
+        'tags' => 'tags',
+        'updated_at' => 'updated_at',
+        'display' => 'display'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'resource_type' => 'setResourceType',
+        'resource_id' => 'setResourceId',
+        'granularity' => 'setGranularity',
+        'language' => 'setLanguage',
+        'related_id' => 'setRelatedId',
+        'score' => 'setScore',
+        'title' => 'setTitle',
+        'content' => 'setContent',
+        'highlight' => 'setHighlight',
+        'bold' => 'setBold',
+        'path' => 'setPath',
+        'category' => 'setCategory',
+        'tags' => 'setTags',
+        'updated_at' => 'setUpdatedAt',
+        'display' => 'setDisplay'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'resource_type' => 'getResourceType',
+        'resource_id' => 'getResourceId',
+        'granularity' => 'getGranularity',
+        'language' => 'getLanguage',
+        'related_id' => 'getRelatedId',
+        'score' => 'getScore',
+        'title' => 'getTitle',
+        'content' => 'getContent',
+        'highlight' => 'getHighlight',
+        'bold' => 'getBold',
+        'path' => 'getPath',
+        'category' => 'getCategory',
+        'tags' => 'getTags',
+        'updated_at' => 'getUpdatedAt',
+        'display' => 'getDisplay'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('id', $data ?? [], null);
+        $this->setIfExists('resource_type', $data ?? [], null);
+        $this->setIfExists('resource_id', $data ?? [], null);
+        $this->setIfExists('granularity', $data ?? [], null);
+        $this->setIfExists('language', $data ?? [], null);
+        $this->setIfExists('related_id', $data ?? [], null);
+        $this->setIfExists('score', $data ?? [], null);
+        $this->setIfExists('title', $data ?? [], null);
+        $this->setIfExists('content', $data ?? [], null);
+        $this->setIfExists('highlight', $data ?? [], null);
+        $this->setIfExists('bold', $data ?? [], null);
+        $this->setIfExists('path', $data ?? [], null);
+        $this->setIfExists('category', $data ?? [], null);
+        $this->setIfExists('tags', $data ?? [], null);
+        $this->setIfExists('updated_at', $data ?? [], null);
+        $this->setIfExists('display', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets id
+     *
+     * @return string|null
+     */
+    public function getId()
+    {
+        return $this->container['id'];
+    }
+
+    /**
+     * Sets id
+     *
+     * @param string|null $id id
+     *
+     * @return self
+     */
+    public function setId($id)
+    {
+        if (is_null($id)) {
+            throw new \InvalidArgumentException('non-nullable id cannot be null');
+        }
+        $this->container['id'] = $id;
+
+        return $this;
+    }
+
+    /**
+     * Gets resource_type
+     *
+     * @return string|null
+     */
+    public function getResourceType()
+    {
+        return $this->container['resource_type'];
+    }
+
+    /**
+     * Sets resource_type
+     *
+     * @param string|null $resource_type resource_type
+     *
+     * @return self
+     */
+    public function setResourceType($resource_type)
+    {
+        if (is_null($resource_type)) {
+            throw new \InvalidArgumentException('non-nullable resource_type cannot be null');
+        }
+        $this->container['resource_type'] = $resource_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets resource_id
+     *
+     * @return string|null
+     */
+    public function getResourceId()
+    {
+        return $this->container['resource_id'];
+    }
+
+    /**
+     * Sets resource_id
+     *
+     * @param string|null $resource_id resource_id
+     *
+     * @return self
+     */
+    public function setResourceId($resource_id)
+    {
+        if (is_null($resource_id)) {
+            array_push($this->openAPINullablesSetToNull, 'resource_id');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('resource_id', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['resource_id'] = $resource_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets granularity
+     *
+     * @return string|null
+     */
+    public function getGranularity()
+    {
+        return $this->container['granularity'];
+    }
+
+    /**
+     * Sets granularity
+     *
+     * @param string|null $granularity granularity
+     *
+     * @return self
+     */
+    public function setGranularity($granularity)
+    {
+        if (is_null($granularity)) {
+            array_push($this->openAPINullablesSetToNull, 'granularity');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('granularity', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['granularity'] = $granularity;
+
+        return $this;
+    }
+
+    /**
+     * Gets language
+     *
+     * @return string|null
+     */
+    public function getLanguage()
+    {
+        return $this->container['language'];
+    }
+
+    /**
+     * Sets language
+     *
+     * @param string|null $language language
+     *
+     * @return self
+     */
+    public function setLanguage($language)
+    {
+        if (is_null($language)) {
+            array_push($this->openAPINullablesSetToNull, 'language');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('language', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['language'] = $language;
+
+        return $this;
+    }
+
+    /**
+     * Gets related_id
+     *
+     * @return string|null
+     */
+    public function getRelatedId()
+    {
+        return $this->container['related_id'];
+    }
+
+    /**
+     * Sets related_id
+     *
+     * @param string|null $related_id related_id
+     *
+     * @return self
+     */
+    public function setRelatedId($related_id)
+    {
+        if (is_null($related_id)) {
+            array_push($this->openAPINullablesSetToNull, 'related_id');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('related_id', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['related_id'] = $related_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets score
+     *
+     * @return float|null
+     */
+    public function getScore()
+    {
+        return $this->container['score'];
+    }
+
+    /**
+     * Sets score
+     *
+     * @param float|null $score score
+     *
+     * @return self
+     */
+    public function setScore($score)
+    {
+        if (is_null($score)) {
+            array_push($this->openAPINullablesSetToNull, 'score');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('score', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['score'] = $score;
+
+        return $this;
+    }
+
+    /**
+     * Gets title
+     *
+     * @return string|null
+     */
+    public function getTitle()
+    {
+        return $this->container['title'];
+    }
+
+    /**
+     * Sets title
+     *
+     * @param string|null $title title
+     *
+     * @return self
+     */
+    public function setTitle($title)
+    {
+        if (is_null($title)) {
+            throw new \InvalidArgumentException('non-nullable title cannot be null');
+        }
+        $this->container['title'] = $title;
+
+        return $this;
+    }
+
+    /**
+     * Gets content
+     *
+     * @return string|null
+     */
+    public function getContent()
+    {
+        return $this->container['content'];
+    }
+
+    /**
+     * Sets content
+     *
+     * @param string|null $content content
+     *
+     * @return self
+     */
+    public function setContent($content)
+    {
+        if (is_null($content)) {
+            throw new \InvalidArgumentException('non-nullable content cannot be null');
+        }
+        $this->container['content'] = $content;
+
+        return $this;
+    }
+
+    /**
+     * Gets highlight
+     *
+     * @return string|null
+     */
+    public function getHighlight()
+    {
+        return $this->container['highlight'];
+    }
+
+    /**
+     * Sets highlight
+     *
+     * @param string|null $highlight highlight
+     *
+     * @return self
+     */
+    public function setHighlight($highlight)
+    {
+        if (is_null($highlight)) {
+            array_push($this->openAPINullablesSetToNull, 'highlight');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('highlight', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['highlight'] = $highlight;
+
+        return $this;
+    }
+
+    /**
+     * Gets bold
+     *
+     * @return string[]|null
+     */
+    public function getBold()
+    {
+        return $this->container['bold'];
+    }
+
+    /**
+     * Sets bold
+     *
+     * @param string[]|null $bold bold
+     *
+     * @return self
+     */
+    public function setBold($bold)
+    {
+        if (is_null($bold)) {
+            throw new \InvalidArgumentException('non-nullable bold cannot be null');
+        }
+        $this->container['bold'] = $bold;
+
+        return $this;
+    }
+
+    /**
+     * Gets path
+     *
+     * @return string|null
+     */
+    public function getPath()
+    {
+        return $this->container['path'];
+    }
+
+    /**
+     * Sets path
+     *
+     * @param string|null $path path
+     *
+     * @return self
+     */
+    public function setPath($path)
+    {
+        if (is_null($path)) {
+            array_push($this->openAPINullablesSetToNull, 'path');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('path', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['path'] = $path;
+
+        return $this;
+    }
+
+    /**
+     * Gets category
+     *
+     * @return string[]|null
+     */
+    public function getCategory()
+    {
+        return $this->container['category'];
+    }
+
+    /**
+     * Sets category
+     *
+     * @param string[]|null $category category
+     *
+     * @return self
+     */
+    public function setCategory($category)
+    {
+        if (is_null($category)) {
+            throw new \InvalidArgumentException('non-nullable category cannot be null');
+        }
+        $this->container['category'] = $category;
+
+        return $this;
+    }
+
+    /**
+     * Gets tags
+     *
+     * @return string[]|null
+     */
+    public function getTags()
+    {
+        return $this->container['tags'];
+    }
+
+    /**
+     * Sets tags
+     *
+     * @param string[]|null $tags tags
+     *
+     * @return self
+     */
+    public function setTags($tags)
+    {
+        if (is_null($tags)) {
+            throw new \InvalidArgumentException('non-nullable tags cannot be null');
+        }
+        $this->container['tags'] = $tags;
+
+        return $this;
+    }
+
+    /**
+     * Gets updated_at
+     *
+     * @return string|null
+     */
+    public function getUpdatedAt()
+    {
+        return $this->container['updated_at'];
+    }
+
+    /**
+     * Sets updated_at
+     *
+     * @param string|null $updated_at updated_at
+     *
+     * @return self
+     */
+    public function setUpdatedAt($updated_at)
+    {
+        if (is_null($updated_at)) {
+            array_push($this->openAPINullablesSetToNull, 'updated_at');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('updated_at', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['updated_at'] = $updated_at;
+
+        return $this;
+    }
+
+    /**
+     * Gets display
+     *
+     * @return string|null
+     */
+    public function getDisplay()
+    {
+        return $this->container['display'];
+    }
+
+    /**
+     * Sets display
+     *
+     * @param string|null $display 仅在部分查询口径下返回。
+     *
+     * @return self
+     */
+    public function setDisplay($display)
+    {
+        if (is_null($display)) {
+            throw new \InvalidArgumentException('non-nullable display cannot be null');
+        }
+        $this->container['display'] = $display;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 579 - 0
api-test/client/lib/Model/GetApiV3Search200ResponseMeta.php

@@ -0,0 +1,579 @@
+<?php
+/**
+ * GetApiV3Search200ResponseMeta
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3Search200ResponseMeta Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3Search200ResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_search_200_response_meta';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'current_page' => 'int',
+        'per_page' => 'int',
+        'total' => 'int',
+        'total_relation' => 'string',
+        'last_page' => 'int',
+        'facets' => 'array<string,\WikipaliApi\Model\GetApiV3Search200ResponseMetaFacetsValueInner[]>'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'current_page' => null,
+        'per_page' => null,
+        'total' => null,
+        'total_relation' => null,
+        'last_page' => null,
+        'facets' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'current_page' => false,
+        'per_page' => false,
+        'total' => false,
+        'total_relation' => false,
+        'last_page' => false,
+        'facets' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'current_page' => 'current_page',
+        'per_page' => 'per_page',
+        'total' => 'total',
+        'total_relation' => 'total_relation',
+        'last_page' => 'last_page',
+        'facets' => 'facets'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'current_page' => 'setCurrentPage',
+        'per_page' => 'setPerPage',
+        'total' => 'setTotal',
+        'total_relation' => 'setTotalRelation',
+        'last_page' => 'setLastPage',
+        'facets' => 'setFacets'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'current_page' => 'getCurrentPage',
+        'per_page' => 'getPerPage',
+        'total' => 'getTotal',
+        'total_relation' => 'getTotalRelation',
+        'last_page' => 'getLastPage',
+        'facets' => 'getFacets'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('current_page', $data ?? [], null);
+        $this->setIfExists('per_page', $data ?? [], null);
+        $this->setIfExists('total', $data ?? [], null);
+        $this->setIfExists('total_relation', $data ?? [], null);
+        $this->setIfExists('last_page', $data ?? [], null);
+        $this->setIfExists('facets', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets current_page
+     *
+     * @return int|null
+     */
+    public function getCurrentPage()
+    {
+        return $this->container['current_page'];
+    }
+
+    /**
+     * Sets current_page
+     *
+     * @param int|null $current_page 当前页
+     *
+     * @return self
+     */
+    public function setCurrentPage($current_page)
+    {
+        if (is_null($current_page)) {
+            throw new \InvalidArgumentException('non-nullable current_page cannot be null');
+        }
+        $this->container['current_page'] = $current_page;
+
+        return $this;
+    }
+
+    /**
+     * Gets per_page
+     *
+     * @return int|null
+     */
+    public function getPerPage()
+    {
+        return $this->container['per_page'];
+    }
+
+    /**
+     * Sets per_page
+     *
+     * @param int|null $per_page 每页条数
+     *
+     * @return self
+     */
+    public function setPerPage($per_page)
+    {
+        if (is_null($per_page)) {
+            throw new \InvalidArgumentException('non-nullable per_page cannot be null');
+        }
+        $this->container['per_page'] = $per_page;
+
+        return $this;
+    }
+
+    /**
+     * Gets total
+     *
+     * @return int|null
+     */
+    public function getTotal()
+    {
+        return $this->container['total'];
+    }
+
+    /**
+     * Sets total
+     *
+     * @param int|null $total 命中总数(total_relation 为 gte 时是下限)
+     *
+     * @return self
+     */
+    public function setTotal($total)
+    {
+        if (is_null($total)) {
+            throw new \InvalidArgumentException('non-nullable total cannot be null');
+        }
+        $this->container['total'] = $total;
+
+        return $this;
+    }
+
+    /**
+     * Gets total_relation
+     *
+     * @return string|null
+     */
+    public function getTotalRelation()
+    {
+        return $this->container['total_relation'];
+    }
+
+    /**
+     * Sets total_relation
+     *
+     * @param string|null $total_relation eq 精确,gte 表示「至少这么多」(OpenSearch 只精确计数到 10000)
+     *
+     * @return self
+     */
+    public function setTotalRelation($total_relation)
+    {
+        if (is_null($total_relation)) {
+            throw new \InvalidArgumentException('non-nullable total_relation cannot be null');
+        }
+        $this->container['total_relation'] = $total_relation;
+
+        return $this;
+    }
+
+    /**
+     * Gets last_page
+     *
+     * @return int|null
+     */
+    public function getLastPage()
+    {
+        return $this->container['last_page'];
+    }
+
+    /**
+     * Sets last_page
+     *
+     * @param int|null $last_page 最后一页(受翻页深度限制)
+     *
+     * @return self
+     */
+    public function setLastPage($last_page)
+    {
+        if (is_null($last_page)) {
+            throw new \InvalidArgumentException('non-nullable last_page cannot be null');
+        }
+        $this->container['last_page'] = $last_page;
+
+        return $this;
+    }
+
+    /**
+     * Gets facets
+     *
+     * @return array<string,\WikipaliApi\Model\GetApiV3Search200ResponseMetaFacetsValueInner[]>|null
+     */
+    public function getFacets()
+    {
+        return $this->container['facets'];
+    }
+
+    /**
+     * Sets facets
+     *
+     * @param array<string,\WikipaliApi\Model\GetApiV3Search200ResponseMetaFacetsValueInner[]>|null $facets 分面计数,只在 facets=true 时出现。键是 resource_type / language / category / granularity
+     *
+     * @return self
+     */
+    public function setFacets($facets)
+    {
+        if (is_null($facets)) {
+            throw new \InvalidArgumentException('non-nullable facets cannot be null');
+        }
+        $this->container['facets'] = $facets;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 449 - 0
api-test/client/lib/Model/GetApiV3Search200ResponseMetaFacetsValueInner.php

@@ -0,0 +1,449 @@
+<?php
+/**
+ * GetApiV3Search200ResponseMetaFacetsValueInner
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3Search200ResponseMetaFacetsValueInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3Search200ResponseMetaFacetsValueInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_search_200_response_meta_facets_value_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'key' => 'string',
+        'count' => 'int'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'key' => null,
+        'count' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'key' => false,
+        'count' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'key' => 'key',
+        'count' => 'count'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'key' => 'setKey',
+        'count' => 'setCount'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'key' => 'getKey',
+        'count' => 'getCount'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('key', $data ?? [], null);
+        $this->setIfExists('count', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        if ($this->container['key'] === null) {
+            $invalidProperties[] = "'key' can't be null";
+        }
+        if ($this->container['count'] === null) {
+            $invalidProperties[] = "'count' can't be null";
+        }
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets key
+     *
+     * @return string
+     */
+    public function getKey()
+    {
+        return $this->container['key'];
+    }
+
+    /**
+     * Sets key
+     *
+     * @param string $key key
+     *
+     * @return self
+     */
+    public function setKey($key)
+    {
+        if (is_null($key)) {
+            throw new \InvalidArgumentException('non-nullable key cannot be null');
+        }
+        $this->container['key'] = $key;
+
+        return $this;
+    }
+
+    /**
+     * Gets count
+     *
+     * @return int
+     */
+    public function getCount()
+    {
+        return $this->container['count'];
+    }
+
+    /**
+     * Sets count
+     *
+     * @param int $count count
+     *
+     * @return self
+     */
+    public function setCount($count)
+    {
+        if (is_null($count)) {
+            throw new \InvalidArgumentException('non-nullable count cannot be null');
+        }
+        $this->container['count'] = $count;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 3 - 3
api-test/client/lib/Model/GetApiV3SearchSearch200Response.php

@@ -57,7 +57,7 @@ class GetApiV3SearchSearch200Response implements ModelInterface, ArrayAccess, \J
      * @var string[]
      */
     protected static $openAPITypes = [
-        'data' => 'object'
+        'data' => '\WikipaliApi\Model\GetApiV3Search200ResponseDataInner'
     ];
 
     /**
@@ -292,7 +292,7 @@ class GetApiV3SearchSearch200Response implements ModelInterface, ArrayAccess, \J
     /**
      * Gets data
      *
-     * @return object|null
+     * @return \WikipaliApi\Model\GetApiV3Search200ResponseDataInner|null
      */
     public function getData()
     {
@@ -302,7 +302,7 @@ class GetApiV3SearchSearch200Response implements ModelInterface, ArrayAccess, \J
     /**
      * Sets data
      *
-     * @param object|null $data data
+     * @param \WikipaliApi\Model\GetApiV3Search200ResponseDataInner|null $data data
      *
      * @return self
      */

+ 443 - 0
api-test/client/lib/Model/GetApiV3SearchSuggest200Response.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * GetApiV3SearchSuggest200Response
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3SearchSuggest200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3SearchSuggest200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_search_suggest_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'success' => 'bool',
+        'data' => 'object'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'success' => null,
+        'data' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'success' => false,
+        'data' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'success' => 'success',
+        'data' => 'data'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'success' => 'setSuccess',
+        'data' => 'setData'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'success' => 'getSuccess',
+        'data' => 'getData'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('success', $data ?? [], null);
+        $this->setIfExists('data', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets success
+     *
+     * @return bool|null
+     */
+    public function getSuccess()
+    {
+        return $this->container['success'];
+    }
+
+    /**
+     * Sets success
+     *
+     * @param bool|null $success success
+     *
+     * @return self
+     */
+    public function setSuccess($success)
+    {
+        if (is_null($success)) {
+            throw new \InvalidArgumentException('non-nullable success cannot be null');
+        }
+        $this->container['success'] = $success;
+
+        return $this;
+    }
+
+    /**
+     * Gets data
+     *
+     * @return object|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param object|null $data data
+     *
+     * @return self
+     */
+    public function setData($data)
+    {
+        if (is_null($data)) {
+            throw new \InvalidArgumentException('non-nullable data cannot be null');
+        }
+        $this->container['data'] = $data;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 409 - 0
api-test/client/lib/Model/GetApiV3Upgrade200Response.php

@@ -0,0 +1,409 @@
+<?php
+/**
+ * GetApiV3Upgrade200Response
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3Upgrade200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3Upgrade200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_upgrade_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => 'object'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'data' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'data' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'data' => 'data'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'data' => 'setData'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'data' => 'getData'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('data', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets data
+     *
+     * @return object|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param object|null $data data
+     *
+     * @return self
+     */
+    public function setData($data)
+    {
+        if (is_null($data)) {
+            throw new \InvalidArgumentException('non-nullable data cannot be null');
+        }
+        $this->container['data'] = $data;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 443 - 0
api-test/client/lib/Model/PostApiV3Search200Response.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * PostApiV3Search200Response
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * PostApiV3Search200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3Search200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_search_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3Search200ResponseDataInner[]',
+        'meta' => '\WikipaliApi\Model\PostApiV3Search200ResponseMeta'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'data' => null,
+        'meta' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'data' => false,
+        'meta' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'data' => 'data',
+        'meta' => 'meta'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'data' => 'setData',
+        'meta' => 'setMeta'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'data' => 'getData',
+        'meta' => 'getMeta'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('data', $data ?? [], null);
+        $this->setIfExists('meta', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets data
+     *
+     * @return \WikipaliApi\Model\GetApiV3Search200ResponseDataInner[]|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3Search200ResponseDataInner[]|null $data data
+     *
+     * @return self
+     */
+    public function setData($data)
+    {
+        if (is_null($data)) {
+            throw new \InvalidArgumentException('non-nullable data cannot be null');
+        }
+        $this->container['data'] = $data;
+
+        return $this;
+    }
+
+    /**
+     * Gets meta
+     *
+     * @return \WikipaliApi\Model\PostApiV3Search200ResponseMeta|null
+     */
+    public function getMeta()
+    {
+        return $this->container['meta'];
+    }
+
+    /**
+     * Sets meta
+     *
+     * @param \WikipaliApi\Model\PostApiV3Search200ResponseMeta|null $meta meta
+     *
+     * @return self
+     */
+    public function setMeta($meta)
+    {
+        if (is_null($meta)) {
+            throw new \InvalidArgumentException('non-nullable meta cannot be null');
+        }
+        $this->container['meta'] = $meta;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 579 - 0
api-test/client/lib/Model/PostApiV3Search200ResponseMeta.php

@@ -0,0 +1,579 @@
+<?php
+/**
+ * PostApiV3Search200ResponseMeta
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * PostApiV3Search200ResponseMeta Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3Search200ResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_search_200_response_meta';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'current_page' => 'int',
+        'per_page' => 'int',
+        'total' => 'int',
+        'total_relation' => 'string',
+        'last_page' => 'int',
+        'facets' => 'array<string,\WikipaliApi\Model\GetApiV3Search200ResponseMetaFacetsValueInner[]>'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'current_page' => null,
+        'per_page' => null,
+        'total' => null,
+        'total_relation' => null,
+        'last_page' => null,
+        'facets' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'current_page' => false,
+        'per_page' => false,
+        'total' => false,
+        'total_relation' => false,
+        'last_page' => false,
+        'facets' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'current_page' => 'current_page',
+        'per_page' => 'per_page',
+        'total' => 'total',
+        'total_relation' => 'total_relation',
+        'last_page' => 'last_page',
+        'facets' => 'facets'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'current_page' => 'setCurrentPage',
+        'per_page' => 'setPerPage',
+        'total' => 'setTotal',
+        'total_relation' => 'setTotalRelation',
+        'last_page' => 'setLastPage',
+        'facets' => 'setFacets'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'current_page' => 'getCurrentPage',
+        'per_page' => 'getPerPage',
+        'total' => 'getTotal',
+        'total_relation' => 'getTotalRelation',
+        'last_page' => 'getLastPage',
+        'facets' => 'getFacets'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('current_page', $data ?? [], null);
+        $this->setIfExists('per_page', $data ?? [], null);
+        $this->setIfExists('total', $data ?? [], null);
+        $this->setIfExists('total_relation', $data ?? [], null);
+        $this->setIfExists('last_page', $data ?? [], null);
+        $this->setIfExists('facets', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets current_page
+     *
+     * @return int|null
+     */
+    public function getCurrentPage()
+    {
+        return $this->container['current_page'];
+    }
+
+    /**
+     * Sets current_page
+     *
+     * @param int|null $current_page 当前页
+     *
+     * @return self
+     */
+    public function setCurrentPage($current_page)
+    {
+        if (is_null($current_page)) {
+            throw new \InvalidArgumentException('non-nullable current_page cannot be null');
+        }
+        $this->container['current_page'] = $current_page;
+
+        return $this;
+    }
+
+    /**
+     * Gets per_page
+     *
+     * @return int|null
+     */
+    public function getPerPage()
+    {
+        return $this->container['per_page'];
+    }
+
+    /**
+     * Sets per_page
+     *
+     * @param int|null $per_page 每页条数
+     *
+     * @return self
+     */
+    public function setPerPage($per_page)
+    {
+        if (is_null($per_page)) {
+            throw new \InvalidArgumentException('non-nullable per_page cannot be null');
+        }
+        $this->container['per_page'] = $per_page;
+
+        return $this;
+    }
+
+    /**
+     * Gets total
+     *
+     * @return int|null
+     */
+    public function getTotal()
+    {
+        return $this->container['total'];
+    }
+
+    /**
+     * Sets total
+     *
+     * @param int|null $total 命中总数(total_relation 为 gte 时是下限)
+     *
+     * @return self
+     */
+    public function setTotal($total)
+    {
+        if (is_null($total)) {
+            throw new \InvalidArgumentException('non-nullable total cannot be null');
+        }
+        $this->container['total'] = $total;
+
+        return $this;
+    }
+
+    /**
+     * Gets total_relation
+     *
+     * @return string|null
+     */
+    public function getTotalRelation()
+    {
+        return $this->container['total_relation'];
+    }
+
+    /**
+     * Sets total_relation
+     *
+     * @param string|null $total_relation eq 精确,gte 表示「至少这么多」
+     *
+     * @return self
+     */
+    public function setTotalRelation($total_relation)
+    {
+        if (is_null($total_relation)) {
+            throw new \InvalidArgumentException('non-nullable total_relation cannot be null');
+        }
+        $this->container['total_relation'] = $total_relation;
+
+        return $this;
+    }
+
+    /**
+     * Gets last_page
+     *
+     * @return int|null
+     */
+    public function getLastPage()
+    {
+        return $this->container['last_page'];
+    }
+
+    /**
+     * Sets last_page
+     *
+     * @param int|null $last_page 最后一页(受翻页深度限制)
+     *
+     * @return self
+     */
+    public function setLastPage($last_page)
+    {
+        if (is_null($last_page)) {
+            throw new \InvalidArgumentException('non-nullable last_page cannot be null');
+        }
+        $this->container['last_page'] = $last_page;
+
+        return $this;
+    }
+
+    /**
+     * Gets facets
+     *
+     * @return array<string,\WikipaliApi\Model\GetApiV3Search200ResponseMetaFacetsValueInner[]>|null
+     */
+    public function getFacets()
+    {
+        return $this->container['facets'];
+    }
+
+    /**
+     * Sets facets
+     *
+     * @param array<string,\WikipaliApi\Model\GetApiV3Search200ResponseMetaFacetsValueInner[]>|null $facets 分面计数,只在 facets=true 时出现。键是 resource_type / language / category / granularity
+     *
+     * @return self
+     */
+    public function setFacets($facets)
+    {
+        if (is_null($facets)) {
+            throw new \InvalidArgumentException('non-nullable facets cannot be null');
+        }
+        $this->container['facets'] = $facets;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 165 - 23
api-test/client/lib/Model/PostApiV3SearchRequest.php

@@ -60,6 +60,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'q' => 'string',
         'search_mode' => 'string',
         'resource_type' => 'string',
+        'resource_id' => 'string',
         'granularity' => 'string',
         'language' => 'string',
         'category' => 'string',
@@ -68,8 +69,9 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'related_id' => 'string[]',
         'author' => 'string',
         'channel' => 'string',
+        'facets' => 'bool',
         'page' => 'int',
-        'page_size' => 'int'
+        'per_page' => 'int'
     ];
 
     /**
@@ -83,6 +85,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'q' => null,
         'search_mode' => null,
         'resource_type' => null,
+        'resource_id' => null,
         'granularity' => null,
         'language' => null,
         'category' => null,
@@ -91,8 +94,9 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'related_id' => null,
         'author' => null,
         'channel' => null,
+        'facets' => null,
         'page' => null,
-        'page_size' => null
+        'per_page' => null
     ];
 
     /**
@@ -104,6 +108,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'q' => false,
         'search_mode' => false,
         'resource_type' => false,
+        'resource_id' => false,
         'granularity' => false,
         'language' => false,
         'category' => false,
@@ -112,8 +117,9 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'related_id' => false,
         'author' => false,
         'channel' => false,
+        'facets' => false,
         'page' => false,
-        'page_size' => false
+        'per_page' => false
     ];
 
     /**
@@ -205,6 +211,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'q' => 'q',
         'search_mode' => 'search_mode',
         'resource_type' => 'resource_type',
+        'resource_id' => 'resource_id',
         'granularity' => 'granularity',
         'language' => 'language',
         'category' => 'category',
@@ -213,8 +220,9 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'related_id' => 'related_id',
         'author' => 'author',
         'channel' => 'channel',
+        'facets' => 'facets',
         'page' => 'page',
-        'page_size' => 'page_size'
+        'per_page' => 'per_page'
     ];
 
     /**
@@ -226,6 +234,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'q' => 'setQ',
         'search_mode' => 'setSearchMode',
         'resource_type' => 'setResourceType',
+        'resource_id' => 'setResourceId',
         'granularity' => 'setGranularity',
         'language' => 'setLanguage',
         'category' => 'setCategory',
@@ -234,8 +243,9 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'related_id' => 'setRelatedId',
         'author' => 'setAuthor',
         'channel' => 'setChannel',
+        'facets' => 'setFacets',
         'page' => 'setPage',
-        'page_size' => 'setPageSize'
+        'per_page' => 'setPerPage'
     ];
 
     /**
@@ -247,6 +257,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'q' => 'getQ',
         'search_mode' => 'getSearchMode',
         'resource_type' => 'getResourceType',
+        'resource_id' => 'getResourceId',
         'granularity' => 'getGranularity',
         'language' => 'getLanguage',
         'category' => 'getCategory',
@@ -255,8 +266,9 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         'related_id' => 'getRelatedId',
         'author' => 'getAuthor',
         'channel' => 'getChannel',
+        'facets' => 'getFacets',
         'page' => 'getPage',
-        'page_size' => 'getPageSize'
+        'per_page' => 'getPerPage'
     ];
 
     /**
@@ -305,6 +317,13 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
     public const SEARCH_MODE_SEMANTIC = 'semantic';
     public const SEARCH_MODE_HYBRID = 'hybrid';
     public const SEARCH_MODE_DEFINITION = 'definition';
+    public const RESOURCE_TYPE_TIPITAKA = 'tipitaka';
+    public const RESOURCE_TYPE_ORIGINAL_TEXT = 'original_text';
+    public const RESOURCE_TYPE_TERM = 'term';
+    public const GRANULARITY_BOOK = 'book';
+    public const GRANULARITY_CHAPTER = 'chapter';
+    public const GRANULARITY_SESSION = 'session';
+    public const GRANULARITY_PARAGRAPH = 'paragraph';
 
     /**
      * Gets allowable values of the enum
@@ -322,6 +341,35 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         ];
     }
 
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getResourceTypeAllowableValues()
+    {
+        return [
+            self::RESOURCE_TYPE_TIPITAKA,
+            self::RESOURCE_TYPE_ORIGINAL_TEXT,
+            self::RESOURCE_TYPE_TERM,
+        ];
+    }
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getGranularityAllowableValues()
+    {
+        return [
+            self::GRANULARITY_BOOK,
+            self::GRANULARITY_CHAPTER,
+            self::GRANULARITY_SESSION,
+            self::GRANULARITY_PARAGRAPH,
+        ];
+    }
+
     /**
      * Associative array for storing property values
      *
@@ -340,6 +388,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         $this->setIfExists('q', $data ?? [], null);
         $this->setIfExists('search_mode', $data ?? [], 'fuzzy');
         $this->setIfExists('resource_type', $data ?? [], null);
+        $this->setIfExists('resource_id', $data ?? [], null);
         $this->setIfExists('granularity', $data ?? [], null);
         $this->setIfExists('language', $data ?? [], null);
         $this->setIfExists('category', $data ?? [], null);
@@ -348,8 +397,9 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         $this->setIfExists('related_id', $data ?? [], null);
         $this->setIfExists('author', $data ?? [], null);
         $this->setIfExists('channel', $data ?? [], null);
+        $this->setIfExists('facets', $data ?? [], false);
         $this->setIfExists('page', $data ?? [], 1);
-        $this->setIfExists('page_size', $data ?? [], 20);
+        $this->setIfExists('per_page', $data ?? [], 20);
     }
 
     /**
@@ -391,6 +441,24 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
             );
         }
 
+        $allowedValues = $this->getResourceTypeAllowableValues();
+        if (!is_null($this->container['resource_type']) && !in_array($this->container['resource_type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'resource_type', must be one of '%s'",
+                $this->container['resource_type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        $allowedValues = $this->getGranularityAllowableValues();
+        if (!is_null($this->container['granularity']) && !in_array($this->container['granularity'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'granularity', must be one of '%s'",
+                $this->container['granularity'],
+                implode("', '", $allowedValues)
+            );
+        }
+
         return $invalidProperties;
     }
 
@@ -419,7 +487,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
     /**
      * Sets q
      *
-     * @param string $q 搜索关键词
+     * @param string $q 检索词
      *
      * @return self
      */
@@ -492,11 +560,48 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         if (is_null($resource_type)) {
             throw new \InvalidArgumentException('non-nullable resource_type cannot be null');
         }
+        $allowedValues = $this->getResourceTypeAllowableValues();
+        if (!in_array($resource_type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'resource_type', must be one of '%s'",
+                    $resource_type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
         $this->container['resource_type'] = $resource_type;
 
         return $this;
     }
 
+    /**
+     * Gets resource_id
+     *
+     * @return string|null
+     */
+    public function getResourceId()
+    {
+        return $this->container['resource_id'];
+    }
+
+    /**
+     * Sets resource_id
+     *
+     * @param string|null $resource_id 限定某个资源 id
+     *
+     * @return self
+     */
+    public function setResourceId($resource_id)
+    {
+        if (is_null($resource_id)) {
+            throw new \InvalidArgumentException('non-nullable resource_id cannot be null');
+        }
+        $this->container['resource_id'] = $resource_id;
+
+        return $this;
+    }
+
     /**
      * Gets granularity
      *
@@ -519,6 +624,16 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         if (is_null($granularity)) {
             throw new \InvalidArgumentException('non-nullable granularity cannot be null');
         }
+        $allowedValues = $this->getGranularityAllowableValues();
+        if (!in_array($granularity, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'granularity', must be one of '%s'",
+                    $granularity,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
         $this->container['granularity'] = $granularity;
 
         return $this;
@@ -537,7 +652,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
     /**
      * Sets language
      *
-     * @param string|null $language 语言
+     * @param string|null $language 文档语言
      *
      * @return self
      */
@@ -564,7 +679,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
     /**
      * Sets category
      *
-     * @param string|null $category 文档分类,逗号分隔
+     * @param string|null $category 分类,逗号分隔,须全部命中
      *
      * @return self
      */
@@ -591,7 +706,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
     /**
      * Sets tags
      *
-     * @param string|null $tags 标签,逗号分隔
+     * @param string|null $tags 标签,逗号分隔,命中任一
      *
      * @return self
      */
@@ -618,7 +733,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
     /**
      * Sets page_refs
      *
-     * @param string[]|null $page_refs 页码标记
+     * @param string[]|null $page_refs 页码标记,命中任一
      *
      * @return self
      */
@@ -645,7 +760,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
     /**
      * Sets related_id
      *
-     * @param string[]|null $related_id 关联 id
+     * @param string[]|null $related_id 关联 id,命中任一
      *
      * @return self
      */
@@ -699,7 +814,7 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
     /**
      * Sets channel
      *
-     * @param string|null $channel 来源 channel
+     * @param string|null $channel 来源 channel 的 uuid
      *
      * @return self
      */
@@ -713,6 +828,33 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
         return $this;
     }
 
+    /**
+     * Gets facets
+     *
+     * @return bool|null
+     */
+    public function getFacets()
+    {
+        return $this->container['facets'];
+    }
+
+    /**
+     * Sets facets
+     *
+     * @param bool|null $facets 是否返回分面计数
+     *
+     * @return self
+     */
+    public function setFacets($facets)
+    {
+        if (is_null($facets)) {
+            throw new \InvalidArgumentException('non-nullable facets cannot be null');
+        }
+        $this->container['facets'] = $facets;
+
+        return $this;
+    }
+
     /**
      * Gets page
      *
@@ -741,28 +883,28 @@ class PostApiV3SearchRequest implements ModelInterface, ArrayAccess, \JsonSerial
     }
 
     /**
-     * Gets page_size
+     * Gets per_page
      *
      * @return int|null
      */
-    public function getPageSize()
+    public function getPerPage()
     {
-        return $this->container['page_size'];
+        return $this->container['per_page'];
     }
 
     /**
-     * Sets page_size
+     * Sets per_page
      *
-     * @param int|null $page_size 每页数量,上限 100
+     * @param int|null $per_page 每页条数,上限 100
      *
      * @return self
      */
-    public function setPageSize($page_size)
+    public function setPerPage($per_page)
     {
-        if (is_null($page_size)) {
-            throw new \InvalidArgumentException('non-nullable page_size cannot be null');
+        if (is_null($per_page)) {
+            throw new \InvalidArgumentException('non-nullable per_page cannot be null');
         }
-        $this->container['page_size'] = $page_size;
+        $this->container['per_page'] = $per_page;
 
         return $this;
     }

+ 1 - 2
api-test/fixtures.php

@@ -25,9 +25,8 @@ return [
     'book_name' => 'dn1',
     'cs_para'   => 4,
 
-    // 搜索关键词 + 一条真实 OpenSearch 文档 id(search/{id} 的 200 用例)
+    // 搜索关键词(search/{id} 的 200 用例从它的检索结果里取文档 id)
     'search_q'       => 'dukkha',
-    'search_doc_id'  => 'term_f8afdcaa-ad68-4795-b3d8-d5f12bdb3a5f',
 
     // discussions 写用例挂的句子:放在测试账号自己的 channel 里、由测试账号编辑,
     // 这样即便有通知也只发给自己(用例本身还会带 notify=false)。换环境时按需覆盖。

+ 1 - 6
api-test/tools/filter-v3.php

@@ -137,18 +137,13 @@ function normalizeArraySchemas(mixed &$node): void
     unset($value);
 }
 
-/** 修正 search / search-suggest / upgrade 的 200 响应 schema,使其与实现一致 */
+/** 修正 search-suggest / upgrade 的 200 响应 schema,使其与实现一致(/v3/search 已于 2026-11-19 对齐,不再打补丁) */
 function applyDriftPatches(array &$spec): void
 {
     $object = ['type' => 'object'];
     $dataObject = ['type' => 'object', 'properties' => ['data' => $object]];
     $successData = ['type' => 'object', 'properties' => ['success' => ['type' => 'boolean'], 'data' => $object]];
 
-    foreach (['get', 'post'] as $method) {
-        if (isset($spec['paths']['/v3/search'][$method]['responses']['200']['content']['application/json']['schema'])) {
-            $spec['paths']['/v3/search'][$method]['responses']['200']['content']['application/json']['schema'] = $successData;
-        }
-    }
     if (isset($spec['paths']['/v3/search-suggest']['get']['responses']['200']['content']['application/json']['schema'])) {
         $spec['paths']['/v3/search-suggest']['get']['responses']['200']['content']['application/json']['schema'] = $successData;
     }

+ 123 - 0
api-v13/app/Http/Controllers/V3/SearchController.php

@@ -0,0 +1,123 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\IndexSearchRequest;
+use App\Http\Resources\V3\SearchHitResource;
+use App\Services\V3\SearchService;
+use Illuminate\Http\Request;
+
+/**
+ * 全文检索(OpenSearch)
+ *
+ * 曾叫 `SearchPlusController`,2026-11-19 按 v3 规范重写:FormRequest 校验入参、
+ * 响应改成 `{data, meta}`(不再透出 OpenSearch 原始响应)、失败走 Problem Details。
+ * 与 v2 的 `SearchController`(`/v2/search`,PostgreSQL 全文检索)是两套实现,互不替代。
+ */
+class SearchController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly SearchService $search) {}
+
+    /**
+     * 全文检索
+     *
+     * 底层走 OpenSearch。同样的参数也可以用 `POST /v3/search` 放在请求体里提交。
+     * 翻页深度受 OpenSearch 限制:`page × per_page` 不能超过 10000,超出 422。
+     * 搜索服务连不上或超时回 503(`search-unavailable`)。
+     *
+     * @unauthenticated
+     *
+     * @queryParam q string required 检索词
+     * @queryParam search_mode string 检索模式:fuzzy 多词模糊(默认)、exact 词形精确、semantic 语义向量、hybrid 模糊 + 语义、definition 黑体定义优先。Enum: fuzzy,exact,semantic,hybrid,definition Default: fuzzy
+     * @queryParam resource_type string 资源类型:tipitaka 三藏(段落与整章)、original_text 原文分段、term 术语。Enum: tipitaka,original_text,term
+     * @queryParam resource_id string 限定某个资源 id
+     * @queryParam granularity string 文档颗粒度。Enum: book,chapter,session,paragraph
+     * @queryParam language string 文档语言,如 pi、zh、en
+     * @queryParam category string 分类,逗号分隔,须全部命中。Example: sutta,mūla
+     * @queryParam tags string 标签,逗号分隔,命中任一
+     * @queryParam page_refs array 页码标记,命中任一。Example: ["V3.81","M3.58"]
+     * @queryParam related_id array 关联 id(经文段落是 `{book}-{para}`),命中任一。Example: ["93-5"]
+     * @queryParam author string 作者或译者
+     * @queryParam channel string 来源 channel 的 uuid
+     * @queryParam facets boolean 是否在 `meta.facets` 里返回按 resource_type / language / category / granularity 的分面计数。Default: false
+     * @queryParam page integer 页码。Default: 1
+     * @queryParam per_page integer 每页条数,上限 100。Default: 20
+     *
+     * @responseStatus 503 搜索服务暂不可用
+     *
+     * @meta current_page integer 当前页
+     * @meta per_page integer 每页条数
+     * @meta total integer 命中总数(total_relation 为 gte 时是下限)
+     * @meta total_relation string eq 精确,gte 表示「至少这么多」(OpenSearch 只精确计数到 10000)
+     * @meta last_page integer 最后一页(受翻页深度限制)
+     * @meta facets object 分面计数,只在 facets=true 时出现
+     */
+    public function index(IndexSearchRequest $request)
+    {
+        $result = $this->search->search($request->validated());
+
+        return SearchHitResource::collection($result['items'])->additional(['meta' => $result['meta']]);
+    }
+
+    /**
+     * 全文检索(POST)
+     *
+     * 与 `GET /v3/search` 完全等价,参数放在 JSON 请求体里(数组参数多、URL 放不下时用)。
+     *
+     * @unauthenticated
+     *
+     * @bodyParam q string required 检索词
+     * @bodyParam search_mode string 检索模式。Enum: fuzzy,exact,semantic,hybrid,definition Default: fuzzy
+     * @bodyParam resource_type string 资源类型。Enum: tipitaka,original_text,term
+     * @bodyParam resource_id string 限定某个资源 id
+     * @bodyParam granularity string 文档颗粒度。Enum: book,chapter,session,paragraph
+     * @bodyParam language string 文档语言
+     * @bodyParam category string 分类,逗号分隔,须全部命中
+     * @bodyParam tags string 标签,逗号分隔,命中任一
+     * @bodyParam page_refs array 页码标记,命中任一
+     * @bodyParam related_id array 关联 id,命中任一
+     * @bodyParam author string 作者或译者
+     * @bodyParam channel string 来源 channel 的 uuid
+     * @bodyParam facets boolean 是否返回分面计数。Default: false
+     * @bodyParam page integer 页码。Default: 1
+     * @bodyParam per_page integer 每页条数,上限 100。Default: 20
+     *
+     * @responseStatus 503 搜索服务暂不可用
+     *
+     * @meta current_page integer 当前页
+     * @meta per_page integer 每页条数
+     * @meta total integer 命中总数(total_relation 为 gte 时是下限)
+     * @meta total_relation string eq 精确,gte 表示「至少这么多」
+     * @meta last_page integer 最后一页(受翻页深度限制)
+     * @meta facets object 分面计数,只在 facets=true 时出现
+     */
+    public function store(IndexSearchRequest $request)
+    {
+        $result = $this->search->search($request->validated());
+
+        return SearchHitResource::collection($result['items'])->additional(['meta' => $result['meta']]);
+    }
+
+    /**
+     * 按 id 取单条检索文档
+     *
+     * 直接从 OpenSearch 按文档 id 取回,带阅读用的 `display` HTML。
+     * 整章正文文档(`tipitaka_chapter_{book}-{para}_{channel}`)按它所属 channel 判权限:
+     * 私有 channel 只有拥有者、团队成员、被共享的人能读(要带 token)。
+     *
+     * @unauthenticated
+     *
+     * @urlParam search string required OpenSearch 文档 id
+     *
+     * @responseStatus 403 整章正文所属的 channel 是私有的,且当前身份看不见
+     * @responseStatus 503 搜索服务暂不可用
+     */
+    public function show(Request $request, string $search): SearchHitResource
+    {
+        return SearchHitResource::make($this->search->find($search, $this->currentUserUid($request)));
+    }
+}

+ 0 - 171
api-v13/app/Http/Controllers/V3/SearchPlusController.php

@@ -1,171 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\V3;
-
-use App\DTO\Search\HitItemDTO;
-use App\Http\Controllers\Concerns\ResolvesCurrentUser;
-use App\Http\Controllers\Controller;
-use App\Http\Resources\V3\BaseResource;
-use App\Services\OpenSearchService;
-use App\Services\V3\ChannelAbilityService;
-use Illuminate\Http\Request;
-
-class SearchPlusController extends Controller
-{
-    /**
-     * 构造函数,注入 OpenSearchService
-     */
-    use ResolvesCurrentUser;
-
-    /** 整章正文文档的 id:tipitaka_chapter_{book}-{para}_{channel uuid},见 IndexTipitaka */
-    private const CHAPTER_DOC = '/^tipitaka_chapter_\d+-\d+_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i';
-
-    public function __construct(
-        protected OpenSearchService $searchService,
-        private readonly ChannelAbilityService $abilities,
-    ) {}
-
-    /**
-     * 全文检索
-     *
-     * 支持 fuzzy / exact / semantic / hybrid 四种检索模式,底层走 OpenSearch。
-     * 同样的参数也可以用 POST /v3/search 提交(参数多、URL 放不下时用)。
-     *
-     * @unauthenticated
-     *
-     * @queryParam q string required 搜索关键词
-     * @queryParam search_mode string 检索模式。Enum: fuzzy,exact,semantic,hybrid,definition Default: fuzzy
-     * @queryParam resource_type string 资源类型。
-     *             Enum: article,term,dictionary,translation,origin_text,nissaya
-     * @queryParam resource_id string 限定某个资源 id
-     * @queryParam granularity string 文档颗粒度。
-     *             Enum: book,chapter,sutta,section,paragraph,sentence
-     * @queryParam language string 语言。Example: zh-Hans
-     * @queryParam category string 文档分类,逗号分隔。Enum: pali,commentary,subcommentary
-     * @queryParam tags string 标签过滤,逗号分隔
-     * @queryParam page_refs array 页码标记。Example: ["V3.81","M3.58"]
-     * @queryParam related_id array 关联 id。Example: ["chapter_93-5","m.n. 38"]
-     * @queryParam author string 按作者或译者过滤
-     * @queryParam channel string 按来源 channel 过滤
-     * @queryParam page integer 页码。Default: 1
-     * @queryParam page_size integer 每页数量,上限 100。Default: 20
-     */
-    public function index(Request $request)
-    {
-        // 获取所有输入参数(自动兼容 GET 和 POST)
-        $input = $request->all();
-
-        // 基础参数 - 使用 $input 或直接用 $request->input() (已兼容 GET/POST)
-        $query = $request->input('q', '');
-        $page = max(1, (int) $request->input('page', 1));
-        $pageSize = min(100, (int) $request->input('page_size', 20));
-        $searchMode = $request->input('search_mode', 'fuzzy');
-        $resourceType = $request->input('resource_type'); // 资源类型
-        $resourceId = $request->input('resource_id'); // 资源类型
-        $granularity = $request->input('granularity');   // 文档颗粒度
-        $language = $request->input('language');      // 语言
-        $category = $request->has('category') ? explode(',', $request->input('category')) : null;      // 分类
-        $tags = $request->has('tags') ? explode(',', $request->input('tags')) : [];      // 标签
-        $pageRefs = $request->input('page_refs', []); // 页码标记
-        $relatedId = $request->input('related_id'); // 关联 ID
-        $author = $request->input('author');        // 作者/译者 (metadata.author)
-        $channel = $request->input('channel');       // 来源渠道 (metadata.channel)
-
-        // 确保数组类型参数正确解析(POST 时可能是 JSON 字符串)
-        $tags = is_array($tags) ? $tags : (is_string($tags) ? json_decode($tags, true) ?? [] : []);
-        $pageRefs = is_array($pageRefs) ? $pageRefs : (is_string($pageRefs) ? json_decode($pageRefs, true) ?? [] : []);
-
-        // 组装搜索参数
-        $params = [
-            'query' => $query,
-            'page' => $page,
-            'pageSize' => $pageSize,
-            'searchMode' => $searchMode,
-            'resourceType' => $resourceType,
-            'resourceId' => $resourceId,
-            'granularity' => $granularity,
-            'language' => $language,
-            'category' => $category,
-            'tags' => $tags,
-            'pageRefs' => $pageRefs,
-            'relatedId' => $relatedId,
-            'author' => $author,
-            'channel' => $channel,
-        ];
-
-        try {
-            // 调用 OpenSearchService 执行搜索
-            $result = $this->searchService->search($params);
-
-            return response()->json([
-                'success' => true,
-                'data' => $result,
-                'query_info' => [
-                    'original_query' => $query,
-                    'search_mode' => $searchMode,
-                    'request_method' => $request->method(), // 可选:返回请求方法
-                ],
-            ]);
-        } catch (\Exception $e) {
-            return response()->json([
-                'success' => false,
-                'error' => $e->getMessage(),
-            ], 500);
-        }
-    }
-
-    /**
-     * 全文检索(POST)
-     *
-     * 与 `GET /v3/search` 完全等价,只是把参数放在请求体里——参数多、
-     * 尤其是 page_refs / related_id 这类数组时,URL 放不下。
-     *
-     * @unauthenticated
-     *
-     * @bodyParam q string required 搜索关键词
-     * @bodyParam search_mode string 检索模式。Enum: fuzzy,exact,semantic,hybrid,definition Default: fuzzy
-     * @bodyParam resource_type string 资源类型
-     * @bodyParam granularity string 文档颗粒度
-     * @bodyParam language string 语言
-     * @bodyParam category string 文档分类,逗号分隔
-     * @bodyParam tags string 标签,逗号分隔
-     * @bodyParam page_refs array 页码标记
-     * @bodyParam related_id array 关联 id
-     * @bodyParam author string 作者或译者
-     * @bodyParam channel string 来源 channel
-     * @bodyParam page integer 页码。Default: 1
-     * @bodyParam page_size integer 每页数量,上限 100。Default: 20
-     */
-    public function store(Request $request)
-    {
-        // 直接调用 index 方法,复用搜索逻辑
-        return $this->index($request);
-    }
-
-    /**
-     * 按 id 取单条检索结果
-     *
-     * 直接从 OpenSearch 按文档 id 取回,不走检索。取不到返回 404。
-     *
-     * 整章正文文档(`tipitaka_chapter_{book}-{para}_{channel}`)按它所属 channel 判权限:
-     * 私有 channel 只有拥有者、团队成员、被共享的人能读(要带 token)。索引里收了所有 channel,
-     * 不在这里挡的话拼出 id 就能读到私有正文。
-     *
-     * @unauthenticated
-     *
-     * @urlParam search string required OpenSearch 文档 id
-     *
-     * @responseStatus 403 整章正文所属的 channel 是私有的,且当前身份看不见
-     */
-    public function show(Request $request, $id)
-    {
-        if (preg_match(self::CHAPTER_DOC, (string) $id, $m)) {
-            $this->abilities->assertReadable($m[1], $this->currentUserUid($request));
-        }
-        try {
-            return BaseResource::make(HitItemDTO::fromArray($this->searchService->get($id)));
-        } catch (\Throwable $th) {
-            abort(404, __('site.not_found'));
-        }
-    }
-}

+ 89 - 0
api-v13/app/Http/Requests/V3/IndexSearchRequest.php

@@ -0,0 +1,89 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Validator;
+
+/**
+ * `GET /v3/search` 与 `POST /v3/search`(两者等价,POST 把同样的参数放进请求体)。
+ *
+ * 枚举取的是索引里真实存在的值(IndexTipitaka / TermIndexService 写入的),
+ * 不是旧文档里那套对不上号的名字。
+ */
+class IndexSearchRequest extends FormRequest
+{
+    public const MODES = ['fuzzy', 'exact', 'semantic', 'hybrid', 'definition'];
+
+    public const RESOURCE_TYPES = ['tipitaka', 'original_text', 'term'];
+
+    public const GRANULARITIES = ['book', 'chapter', 'session', 'paragraph'];
+
+    /** OpenSearch 的 index.max_result_window:from + size 超过它直接报错 */
+    public const MAX_WINDOW = 10000;
+
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * JSON 请求体里的 true / false 是布尔值,查询串里是字符串,统一成字符串再校验。
+     */
+    protected function prepareForValidation(): void
+    {
+        if (is_bool($this->input('facets'))) {
+            $this->merge(['facets' => $this->input('facets') ? 'true' : 'false']);
+        }
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'q' => ['required', 'string', 'max:500'],
+            'search_mode' => ['sometimes', 'string', 'in:'.implode(',', self::MODES)],
+            'resource_type' => ['sometimes', 'string', 'in:'.implode(',', self::RESOURCE_TYPES)],
+            'resource_id' => ['sometimes', 'string', 'max:255'],
+            'granularity' => ['sometimes', 'string', 'in:'.implode(',', self::GRANULARITIES)],
+            'language' => ['sometimes', 'string', 'max:16'],
+            'category' => ['sometimes', 'string', 'max:500'],
+            'tags' => ['sometimes', 'string', 'max:500'],
+            'page_refs' => ['sometimes', 'array', 'max:50'],
+            'page_refs.*' => ['string', 'max:64'],
+            'related_id' => ['sometimes', 'array', 'max:50'],
+            'related_id.*' => ['string', 'max:255'],
+            'author' => ['sometimes', 'string', 'max:255'],
+            'channel' => ['sometimes', 'uuid'],
+            'facets' => ['sometimes', 'in:true,false,1,0'],
+            'page' => ['sometimes', 'integer', 'min:1'],
+            'per_page' => ['sometimes', 'integer', 'min:1', 'max:100'],
+        ];
+    }
+
+    /**
+     * 翻页深度受 OpenSearch 限制:超出时在这里给 422,而不是让 OpenSearch 报错变成 500。
+     *
+     * @return array<int, callable>
+     */
+    public function after(): array
+    {
+        return [
+            function (Validator $validator): void {
+                if ($validator->errors()->isNotEmpty()) {
+                    return;
+                }
+                $page = (int) $this->input('page', 1);
+                $perPage = (int) $this->input('per_page', 20);
+                if ($page * $perPage > self::MAX_WINDOW) {
+                    $validator->errors()->add('page', __('validation.max.numeric', [
+                        'attribute' => 'page',
+                        'max' => intdiv(self::MAX_WINDOW, $perPage),
+                    ]));
+                }
+            },
+        ];
+    }
+}

+ 38 - 0
api-v13/app/Http/Resources/V3/SearchHitResource.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace App\Http\Resources\V3;
+
+use Illuminate\Http\Request;
+
+/**
+ * 一条检索命中(OpenSearch 文档归一化后的结构,见 `App\Services\V3\SearchService::hit()`)。
+ *
+ * `related_id` 对经文段落是 `{book}-{para}` 坐标;`display` 只在按 id 取单条时才有(阅读用的 HTML)。
+ */
+class SearchHitResource extends BaseResource
+{
+    /**
+     * @return array{
+     *     id: string,
+     *     resource_type: string,
+     *     resource_id: string|null,
+     *     granularity: string|null,
+     *     language: string|null,
+     *     related_id: string|null,
+     *     score: float|null,
+     *     title: string,
+     *     content: string,
+     *     highlight: string|null,
+     *     bold: list<string>,
+     *     path: string|null,
+     *     category: list<string>,
+     *     tags: list<string>,
+     *     updated_at: string|null,
+     *     display?: string
+     * }
+     */
+    public function toArray(Request $request): array
+    {
+        return $this->resource;
+    }
+}

+ 7 - 3
api-v13/app/Services/OpenSearchService.php

@@ -434,6 +434,7 @@ class OpenSearchService
      * @type string|array $relatedId    按关联 ID 过滤(数组时命中任一)
      * @type string $author             按作者过滤
      * @type string $channel            按频道过滤(channel uuid)
+     * @type bool $aggregations       是否计算分面聚合,默认 true
      * @type array $highlight_pre_tags 高亮前置标签,默认 ['<mark>']
      * @type array $highlight_post_tags 高亮后置标签,默认 ['</mark>']
      *             }
@@ -564,7 +565,10 @@ class OpenSearchService
                     ],
                 ]
                 : $query,
-            'aggs' => [
+        ];
+
+        if ($params['aggregations'] ?? true) {
+            $dsl['aggs'] = [
                 'resource_type' => [
                     'terms' => ['field' => 'resource_type'],
                 ],
@@ -577,8 +581,8 @@ class OpenSearchService
                 'granularity' => [
                     'terms' => ['field' => 'granularity'],
                 ],
-            ],
-        ];
+            ];
+        }
 
         // 只有有搜索词时才开启高亮;字段按语种路由,避免把巴利文喂给中文分词器
         if ($queryText !== '') {

+ 222 - 0
api-v13/app/Services/V3/SearchService.php

@@ -0,0 +1,222 @@
+<?php
+
+namespace App\Services\V3;
+
+use App\Exceptions\BusinessException;
+use App\Http\Requests\V3\IndexSearchRequest;
+use App\Services\OpenSearchService;
+use Closure;
+use OpenSearch\Exception\NotFoundHttpException;
+use OpenSearch\Exception\RequestTimeoutHttpException;
+use OpenSearch\Exception\ServiceUnavailableHttpException;
+use OpenSearch\Exception\TooManyRequestsHttpException;
+use Psr\Http\Client\ClientExceptionInterface;
+
+/**
+ * v3 全文检索:把 OpenSearch 的原始命中归一化成对外的扁平结构。
+ *
+ * 查询 DSL 仍由共享的 OpenSearchService 构造(Library 检索页与 AITermService 也在用),
+ * 这里只负责入参映射、异常分类和输出形状——不暴露 `_source` / `hits.hits` 这类 OpenSearch 内部结构。
+ *
+ * 异常分两类:
+ * - 搜索服务不可用(连不上、超时、集群过载)→ 503 `search-unavailable`,文案送达客户端,原异常写日志;
+ * - 其余(索引映射不对、DSL 写错)是真正的 bug → 原样抛出,兜底处理器回 500 并记日志。
+ */
+class SearchService
+{
+    /** 整章正文文档的 id:tipitaka_chapter_{book}-{para}_{channel uuid},见 IndexTipitaka */
+    private const CHAPTER_DOC = '/^tipitaka_chapter_\d+-\d+_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i';
+
+    public function __construct(
+        private readonly OpenSearchService $search,
+        private readonly ChannelAbilityService $abilities,
+    ) {}
+
+    /**
+     * @param  array<string, mixed>  $input  IndexSearchRequest::validated()
+     * @return array{
+     *     items: list<array<string, mixed>>,
+     *     meta: array{current_page: int, per_page: int, total: int, total_relation: string, last_page: int, facets?: array<string, list<array{key: string, count: int}>>}
+     * }
+     */
+    public function search(array $input): array
+    {
+        $page = (int) ($input['page'] ?? 1);
+        $perPage = (int) ($input['per_page'] ?? 20);
+        $withFacets = in_array($input['facets'] ?? 'false', ['true', '1'], true);
+
+        $raw = $this->call(fn () => $this->search->search([
+            'query' => $input['q'],
+            'searchMode' => $input['search_mode'] ?? 'fuzzy',
+            'page' => $page,
+            'pageSize' => $perPage,
+            'resourceType' => $input['resource_type'] ?? null,
+            'resourceId' => $input['resource_id'] ?? null,
+            'granularity' => $input['granularity'] ?? null,
+            'language' => $input['language'] ?? null,
+            'category' => self::splitList($input['category'] ?? null) ?: null,
+            'tags' => self::splitList($input['tags'] ?? null),
+            'pageRefs' => array_values($input['page_refs'] ?? []),
+            'relatedId' => array_values($input['related_id'] ?? []) ?: null,
+            'author' => $input['author'] ?? null,
+            'channel' => $input['channel'] ?? null,
+            'aggregations' => $withFacets,
+        ]));
+
+        $total = (int) ($raw['hits']['total']['value'] ?? 0);
+        $meta = [
+            'current_page' => $page,
+            'per_page' => $perPage,
+            'total' => $total,
+            // OpenSearch 默认只精确计数到 10000,gte 表示「至少这么多」
+            'total_relation' => (string) ($raw['hits']['total']['relation'] ?? 'eq'),
+            'last_page' => max(1, min(
+                (int) ceil($total / $perPage),
+                intdiv(IndexSearchRequest::MAX_WINDOW, $perPage),
+            )),
+        ];
+        if ($withFacets) {
+            $meta['facets'] = self::facets($raw['aggregations'] ?? []);
+        }
+
+        return [
+            'items' => array_map(self::hit(...), $raw['hits']['hits'] ?? []),
+            'meta' => $meta,
+        ];
+    }
+
+    /**
+     * 按文档 id 取一条(带阅读用的 display HTML)。文档不存在 → 404。
+     *
+     * 整章正文文档按它所属 channel 判权限:索引里收了所有 channel,不在这里挡的话
+     * 拼出 id 就能读到私有正文。私有 channel 看不见 → 403。
+     *
+     * @return array<string, mixed>
+     */
+    public function find(string $id, ?string $viewerUid): array
+    {
+        if (preg_match(self::CHAPTER_DOC, $id, $m)) {
+            $this->abilities->assertReadable($m[1], $viewerUid);
+        }
+
+        try {
+            $raw = $this->call(fn () => $this->search->get($id));
+        } catch (NotFoundHttpException) {
+            abort(404, __('site.not_found'));
+        }
+
+        return self::hit($raw);
+    }
+
+    /**
+     * 调 OpenSearch,把「服务不可用」类异常转成 503。
+     *
+     * @template T
+     *
+     * @param  Closure(): T  $callback
+     * @return T
+     */
+    private function call(Closure $callback): mixed
+    {
+        try {
+            return $callback();
+        } catch (ClientExceptionInterface|ServiceUnavailableHttpException|RequestTimeoutHttpException|TooManyRequestsHttpException $e) {
+            report($e);
+
+            throw new BusinessException(__('site.search_unavailable'), 503, 'search-unavailable');
+        }
+    }
+
+    /**
+     * 一条 OpenSearch 命中(search 的 hit 或 get 的文档)→ 对外结构。
+     *
+     * 一条文档通常只有一种语言有值,title / content 把 text.* 下的非空值拼起来即可。
+     * 高亮优先取正文片段,没有再取标题。
+     *
+     * @param  array<string, mixed>  $hit
+     * @return array<string, mixed>
+     */
+    private static function hit(array $hit): array
+    {
+        $source = $hit['_source'] ?? [];
+        $highlight = $hit['highlight'] ?? [];
+        $fragment = null;
+        foreach (['content.text.pali', 'content.text.zh', 'summary.text', 'title.text.pali', 'title.text.zh'] as $field) {
+            if (! empty($highlight[$field][0])) {
+                $fragment = (string) $highlight[$field][0];
+                break;
+            }
+        }
+
+        $bold = $source['bold_single'] ?? [];
+        $bold = is_array($bold)
+            ? array_values(array_filter(array_map('strval', $bold), fn (string $v) => trim($v) !== ''))
+            : preg_split('/\s+/u', trim((string) $bold), -1, PREG_SPLIT_NO_EMPTY);
+
+        $item = [
+            'id' => (string) ($source['id'] ?? $hit['_id'] ?? ''),
+            'resource_type' => (string) ($source['resource_type'] ?? ''),
+            'resource_id' => isset($source['resource_id']) ? (string) $source['resource_id'] : null,
+            'granularity' => isset($source['granularity']) ? (string) $source['granularity'] : null,
+            'language' => isset($source['language']) ? (string) $source['language'] : null,
+            'related_id' => isset($source['related_id']) ? (string) $source['related_id'] : null,
+            'score' => isset($hit['_score']) ? (float) $hit['_score'] : null,
+            'title' => self::joinText($source['title']['text'] ?? []),
+            'content' => self::joinText($source['content']['text'] ?? []),
+            'highlight' => $fragment,
+            'bold' => $bold,
+            'path' => isset($source['path']) && $source['path'] !== '' ? (string) $source['path'] : null,
+            'category' => array_values((array) ($source['category'] ?? [])),
+            'tags' => array_values((array) ($source['tags'] ?? [])),
+            'updated_at' => isset($source['updated_at']) ? (string) $source['updated_at'] : null,
+        ];
+
+        if (isset($source['content']['display'])) {
+            $item['display'] = (string) $source['content']['display'];
+        }
+
+        return $item;
+    }
+
+    /**
+     * @param  mixed  $text  title.text / content.text(按语言分的对象)
+     */
+    private static function joinText(mixed $text): string
+    {
+        return implode('', array_filter(
+            is_array($text) ? array_values($text) : [],
+            fn ($v) => is_string($v) && $v !== '',
+        ));
+    }
+
+    /**
+     * @param  array<string, mixed>  $aggregations
+     * @return array<string, list<array{key: string, count: int}>>
+     */
+    private static function facets(array $aggregations): array
+    {
+        $facets = [];
+        foreach ($aggregations as $name => $agg) {
+            $facets[$name] = array_map(fn (array $bucket) => [
+                'key' => (string) $bucket['key'],
+                'count' => (int) $bucket['doc_count'],
+            ], $agg['buckets'] ?? []);
+        }
+
+        return $facets;
+    }
+
+    /**
+     * 逗号分隔的列表(category / tags),去空白、去空项。
+     *
+     * @return list<string>
+     */
+    private static function splitList(?string $value): array
+    {
+        if ($value === null) {
+            return [];
+        }
+
+        return array_values(array_filter(array_map('trim', explode(',', $value)), fn (string $v) => $v !== ''));
+    }
+}

+ 1 - 0
api-v13/resources/lang/en/site.php

@@ -20,6 +20,7 @@ return [
     // 停机维护开关(.stop 文件)触发时,API 的 RFC 9457 detail 文案
     'maintenance' => 'The service is under scheduled maintenance.',
     'not_found' => 'The requested resource does not exist.',
+    'search_unavailable' => 'The search service is temporarily unavailable. Please try again later.',
     'forbidden' => 'You are not allowed to perform this action.',
     'invalid_parameter' => 'Invalid parameter.',
     'author.name' => 'iapt',

+ 1 - 0
api-v13/resources/lang/zh-Hans/site.php

@@ -20,6 +20,7 @@ return [
     // 停机维护开关(.stop 文件)触发时,API 的 RFC 9457 detail 文案
     'maintenance' => '服务已进入停机维护状态',
     'not_found' => '请求的资源不存在',
+    'search_unavailable' => '搜索服务暂时不可用,请稍后再试',
     'forbidden' => '你没有执行该操作的权限',
     'invalid_parameter' => '参数不合法',
     'author.name' => 'iapt',

+ 2 - 2
api-v13/routes/v3/search.php

@@ -9,10 +9,10 @@
 |
 */
 
-use App\Http\Controllers\V3\SearchPlusController;
+use App\Http\Controllers\V3\SearchController;
 use App\Http\Controllers\V3\SearchSuggestController;
 use Illuminate\Support\Facades\Route;
 
 // 只注册真正实现了的动作——空方法会在 OpenAPI 里变成幽灵端点
-Route::apiResource('search', SearchPlusController::class)->only(['index', 'store', 'show']);
+Route::apiResource('search', SearchController::class)->only(['index', 'store', 'show']);
 Route::apiResource('search-suggest', SearchSuggestController::class)->only(['index']);

+ 190 - 0
api-v13/tests/Feature/SearchV3Test.php

@@ -0,0 +1,190 @@
+<?php
+
+use App\Services\OpenSearchService;
+use GuzzleHttp\Exception\ConnectException;
+use GuzzleHttp\Psr7\Request as PsrRequest;
+use OpenSearch\Exception\BadRequestHttpException;
+use OpenSearch\Exception\NotFoundHttpException;
+
+/*
+ * /v3/search 与 /v3/search/{id}(OpenSearch 全文检索)。
+ *
+ * 这里断言的是形状而非契约(spectator 未安装,见 v3-resource skill 第 3 步)。
+ * OpenSearch 一律 mock,不连真实集群;整章文档的 channel 权限见 ChannelContentAccessV3Test。
+ */
+
+/** 一条 OpenSearch 原始命中 */
+function rawSearchHit(array $source = [], array $highlight = []): array
+{
+    return [
+        '_id' => $source['id'] ?? 'tipitaka_paragraph_pi_26-392',
+        '_score' => 12.5,
+        '_source' => $source + [
+            'id' => 'tipitaka_paragraph_pi_26-392',
+            'resource_id' => '3bfe314f-da34-11ec-9f5a-076a934e828a',
+            'resource_type' => 'tipitaka',
+            'granularity' => 'paragraph',
+            'language' => 'pi',
+            'related_id' => '26-392',
+            'title' => ['text' => ['pali' => '95.']],
+            'content' => ['text' => ['pali' => 'Dukkhāti dukkha saṃkiṇṇo']],
+            'bold_single' => 'dukkha  saṃkiṇṇo',
+            'path' => 'a/b/c',
+            'category' => ['añña', 'dīpanī'],
+            'updated_at' => '2026-11-16T07:39:25+00:00',
+        ],
+        'highlight' => $highlight,
+    ];
+}
+
+/** 让 OpenSearchService::search 返回给定命中,并把收到的参数记进 $captured */
+function fakeSearchResult(array $hits, int $total, ?array &$captured = null, array $aggregations = []): void
+{
+    test()->mock(OpenSearchService::class)
+        ->shouldReceive('search')
+        ->andReturnUsing(function (array $params) use ($hits, $total, &$captured, $aggregations) {
+            $captured = $params;
+
+            return [
+                'hits' => ['total' => ['value' => $total, 'relation' => 'eq'], 'hits' => $hits],
+                'aggregations' => $aggregations,
+            ];
+        });
+}
+
+it('returns normalized hits with pagination meta', function () {
+    fakeSearchResult([rawSearchHit([], [
+        'title.text.pali' => ['<mark>95</mark>.'],
+        'content.text.pali' => ['<mark>Dukkhāti</mark> dukkha'],
+    ])], 45);
+
+    $res = $this->getJson('/api/v3/search?q=dukkha&per_page=20&page=2')->assertSuccessful();
+
+    $hit = $res->json('data.0');
+    expect($hit)->toHaveKeys(['id', 'resource_type', 'resource_id', 'granularity', 'language', 'related_id',
+        'score', 'title', 'content', 'highlight', 'bold', 'path', 'category', 'tags', 'updated_at'])
+        ->and($hit)->not->toHaveKeys(['_source', 'display'])
+        ->and($hit['related_id'])->toBe('26-392')
+        ->and($hit['highlight'])->toBe('<mark>Dukkhāti</mark> dukkha')   // 正文片段优先于标题
+        ->and($hit['bold'])->toBe(['dukkha', 'saṃkiṇṇo']);
+    expect($res->json('meta'))->toMatchArray([
+        'current_page' => 2, 'per_page' => 20, 'total' => 45, 'total_relation' => 'eq', 'last_page' => 3,
+    ])->not->toHaveKey('facets');
+});
+
+it('maps filters onto the search service and skips aggregations by default', function () {
+    $captured = null;
+    fakeSearchResult([], 0, $captured);
+
+    $this->getJson('/api/v3/search?'.http_build_query([
+        'q' => 'dukkha', 'search_mode' => 'definition', 'resource_type' => 'tipitaka',
+        'granularity' => 'paragraph', 'category' => 'sutta, mūla', 'tags' => 'a,b',
+        'related_id' => ['93-5', '93-6'], 'page_refs' => ['V3.81'],
+        'channel' => '9d389085-197a-47b7-87bd-d214994c2784',
+    ]))->assertSuccessful();
+
+    expect($captured)->toMatchArray([
+        'query' => 'dukkha', 'searchMode' => 'definition', 'resourceType' => 'tipitaka',
+        'granularity' => 'paragraph', 'category' => ['sutta', 'mūla'], 'tags' => ['a', 'b'],
+        'relatedId' => ['93-5', '93-6'], 'pageRefs' => ['V3.81'],
+        'channel' => '9d389085-197a-47b7-87bd-d214994c2784', 'aggregations' => false,
+        'page' => 1, 'pageSize' => 20,
+    ]);
+});
+
+it('returns facets only when asked', function () {
+    $captured = null;
+    fakeSearchResult([], 0, $captured, [
+        'language' => ['buckets' => [['key' => 'pi', 'doc_count' => 7]]],
+    ]);
+
+    $this->getJson('/api/v3/search?q=dukkha&facets=true')
+        ->assertSuccessful()
+        ->assertJsonPath('meta.facets.language.0', ['key' => 'pi', 'count' => 7]);
+    expect($captured['aggregations'])->toBeTrue();
+});
+
+it('accepts the same parameters in a POST body', function () {
+    $captured = null;
+    fakeSearchResult([rawSearchHit()], 1, $captured);
+
+    $this->postJson('/api/v3/search', ['q' => 'dukkha', 'facets' => true, 'related_id' => ['26-392']])
+        ->assertSuccessful()
+        ->assertJsonPath('data.0.related_id', '26-392');
+    expect($captured['relatedId'])->toBe(['26-392'])
+        ->and($captured['aggregations'])->toBeTrue();
+});
+
+it('rejects invalid parameters', function (array $query, string $field) {
+    $this->getJson('/api/v3/search?'.http_build_query($query))
+        ->assertUnprocessable()
+        ->assertJsonValidationErrors($field)
+        ->assertHeader('Content-Type', 'application/problem+json');
+})->with([
+    'missing q' => [[], 'q'],
+    'unknown mode' => [['q' => 'x', 'search_mode' => 'bogus'], 'search_mode'],
+    'unknown resource type' => [['q' => 'x', 'resource_type' => 'article'], 'resource_type'],
+    'per_page too large' => [['q' => 'x', 'per_page' => 101], 'per_page'],
+    'too deep' => [['q' => 'x', 'per_page' => 100, 'page' => 101], 'page'],
+    'channel not uuid' => [['q' => 'x', 'channel' => 'abc'], 'channel'],
+]);
+
+it('answers 503 with a readable detail when the search cluster is unreachable', function () {
+    test()->mock(OpenSearchService::class)
+        ->shouldReceive('search')
+        ->andThrow(new ConnectException('Connection refused', new PsrRequest('POST', 'http://opensearch')));
+
+    $res = $this->getJson('/api/v3/search?q=dukkha', ['Accept-Language' => 'zh-Hans'])
+        ->assertServiceUnavailable()
+        ->assertJsonPath('type', 'urn:problem:search-unavailable');
+    expect($res->json('detail'))->not->toBe('site.search_unavailable')
+        ->and($res->getContent())->not->toContain('Connection refused');
+});
+
+it('does not leak OpenSearch errors that are real bugs', function () {
+    test()->mock(OpenSearchService::class)
+        ->shouldReceive('search')
+        ->andThrow(new BadRequestHttpException('illegal_argument_exception: Text fields are not optimised'));
+    config(['app.debug' => false]);
+
+    $res = $this->getJson('/api/v3/search?q=dukkha')->assertInternalServerError();
+    expect($res->getContent())->not->toContain('illegal_argument_exception');
+});
+
+it('shows one document with its display html', function () {
+    test()->mock(OpenSearchService::class)
+        ->shouldReceive('get')
+        ->with('term_x')
+        ->andReturn(rawSearchHit([
+            'id' => 'term_x', 'resource_type' => 'term', 'related_id' => null,
+            'bold_single' => ['苦', 'dukkha'],
+            'content' => ['text' => ['zh' => '苦'], 'display' => '<p>苦</p>'],
+        ]));
+
+    $this->getJson('/api/v3/search/term_x')
+        ->assertSuccessful()
+        ->assertJsonPath('data.id', 'term_x')
+        ->assertJsonPath('data.display', '<p>苦</p>')
+        ->assertJsonPath('data.bold', ['苦', 'dukkha'])
+        ->assertJsonPath('data.related_id', null);
+});
+
+it('answers 404 only when the document does not exist', function () {
+    test()->mock(OpenSearchService::class)
+        ->shouldReceive('get')
+        ->andThrow(new NotFoundHttpException('not found'));
+
+    $this->getJson('/api/v3/search/term_missing')->assertNotFound();
+});
+
+it('answers 503 instead of 404 when the cluster is down while showing', function () {
+    test()->mock(OpenSearchService::class)
+        ->shouldReceive('get')
+        ->andThrow(new ConnectException('Connection refused', new PsrRequest('GET', 'http://opensearch')));
+
+    $this->getJson('/api/v3/search/term_x')->assertServiceUnavailable();
+});
+
+it('only registers GET and POST on the collection', function () {
+    $this->putJson('/api/v3/search/term_x', [])->assertMethodNotAllowed();
+});

+ 180 - 49
dashboard-v6/src/api/schema.d.ts

@@ -9044,19 +9044,19 @@ export interface paths {
         };
         /**
          * 全文检索
-         * @description 支持 fuzzy / exact / semantic / hybrid 四种检索模式,底层走 OpenSearch。
-         *     同样的参数也可以用 POST /v3/search 提交(参数多、URL 放不下时用)。
+         * @description 底层走 OpenSearch。同样的参数也可以用 `POST /v3/search` 放在请求体里提交。
+         *     翻页深度受 OpenSearch 限制:`page × per_page` 不能超过 10000,超出 422。
+         *     搜索服务连不上或超时回 503(`search-unavailable`)。
          *
-         *     实现:`V3\SearchPlusController@index`
+         *     实现:`V3\SearchController@index`
          */
         get: operations["get_api_v3_search"];
         put?: never;
         /**
          * 全文检索(POST)
-         * @description 与 `GET /v3/search` 完全等价,只是把参数放在请求体里——参数多、
-         *     尤其是 page_refs / related_id 这类数组时,URL 放不下。
+         * @description 与 `GET /v3/search` 完全等价,参数放在 JSON 请求体里(数组参数多、URL 放不下时用)。
          *
-         *     实现:`V3\SearchPlusController@store`
+         *     实现:`V3\SearchController@store`
          */
         post: operations["post_api_v3_search"];
         delete?: never;
@@ -9096,13 +9096,12 @@ export interface paths {
             cookie?: never;
         };
         /**
-         * 按 id 取单条检索结果
-         * @description 直接从 OpenSearch 按文档 id 取回,不走检索。取不到返回 404。
+         * 按 id 取单条检索文档
+         * @description 直接从 OpenSearch 按文档 id 取回,带阅读用的 `display` HTML。
          *     整章正文文档(`tipitaka_chapter_{book}-{para}_{channel}`)按它所属 channel 判权限:
-         *     私有 channel 只有拥有者、团队成员、被共享的人能读(要带 token)。索引里收了所有 channel,
-         *     不在这里挡的话拼出 id 就能读到私有正文。
+         *     私有 channel 只有拥有者、团队成员、被共享的人能读(要带 token)。
          *
-         *     实现:`V3\SearchPlusController@show`
+         *     实现:`V3\SearchController@show`
          */
         get: operations["get_api_v3_search_search_"];
         put?: never;
@@ -40243,31 +40242,27 @@ export interface operations {
     get_api_v3_search: {
         parameters: {
             query: {
-                /** @description 搜索关键词 */
+                /** @description 检索词 */
                 q: string;
-                /** @description 页码 */
-                page?: number;
-                /** @description 每页数量,上限 100 */
-                page_size?: number;
-                /** @description 检索模式 */
+                /** @description 检索模式:fuzzy 多词模糊(默认)、exact 词形精确、semantic 语义向量、hybrid 模糊 + 语义、definition 黑体定义优先 */
                 search_mode?: "fuzzy" | "exact" | "semantic" | "hybrid" | "definition";
-                /** @description 资源类型 */
-                resource_type?: "article" | "term" | "dictionary" | "translation" | "origin_text" | "nissaya";
+                /** @description 资源类型:tipitaka 三藏(段落与整章)、original_text 原文分段、term 术语 */
+                resource_type?: "tipitaka" | "original_text" | "term";
                 /** @description 限定某个资源 id */
                 resource_id?: string;
                 /** @description 文档颗粒度 */
-                granularity?: "book" | "chapter" | "sutta" | "section" | "paragraph" | "sentence";
+                granularity?: "book" | "chapter" | "session" | "paragraph";
+                /** @description 文档语言,如 pi、zh、en */
+                language?: string;
                 /**
-                 * @description 语言
-                 * @example zh-Hans
+                 * @description 分类,逗号分隔,须全部命中
+                 * @example sutta,mūla
                  */
-                language?: string;
-                /** @description 文档分类,逗号分隔 */
-                category?: "pali" | "commentary" | "subcommentary";
-                /** @description 标签过滤,逗号分隔 */
+                category?: string;
+                /** @description 标签,逗号分隔,命中任一 */
                 tags?: string;
                 /**
-                 * @description 页码标记
+                 * @description 页码标记,命中任一
                  * @example [
                  *       "V3.81",
                  *       "M3.58"
@@ -40275,17 +40270,22 @@ export interface operations {
                  */
                 page_refs?: unknown[];
                 /**
-                 * @description 关联 id
+                 * @description 关联 id(经文段落是 `{book}-{para}`),命中任一
                  * @example [
-                 *       "chapter_93-5",
-                 *       "m.n. 38"
+                 *       "93-5"
                  *     ]
                  */
                 related_id?: unknown[];
-                /** @description 按作者或译者过滤 */
+                /** @description 作者或译者 */
                 author?: string;
-                /** @description 按来源 channel 过滤 */
+                /** @description 来源 channel 的 uuid */
                 channel?: string;
+                /** @description 是否在 `meta.facets` 里返回按 resource_type / language / category / granularity 的分面计数 */
+                facets?: boolean;
+                /** @description 页码 */
+                page?: number;
+                /** @description 每页条数,上限 100 */
+                per_page?: number;
             };
             header?: never;
             path?: never;
@@ -40300,12 +40300,57 @@ export interface operations {
                 };
                 content: {
                     "application/json": {
-                        data?: Record<string, never>[];
-                        meta?: components["schemas"]["PaginationMeta"];
+                        data?: {
+                            id?: string;
+                            resource_type?: string;
+                            resource_id?: string | null;
+                            granularity?: string | null;
+                            language?: string | null;
+                            related_id?: string | null;
+                            score?: number | null;
+                            title?: string;
+                            content?: string;
+                            highlight?: string | null;
+                            bold?: string[];
+                            path?: string | null;
+                            category?: string[];
+                            tags?: string[];
+                            updated_at?: string | null;
+                            /** @description 仅在部分查询口径下返回。 */
+                            display?: string;
+                        }[];
+                        meta?: {
+                            /** @description 当前页 */
+                            current_page?: number;
+                            /** @description 每页条数 */
+                            per_page?: number;
+                            /** @description 命中总数(total_relation 为 gte 时是下限) */
+                            total?: number;
+                            /** @description eq 精确,gte 表示「至少这么多」(OpenSearch 只精确计数到 10000) */
+                            total_relation?: string;
+                            /** @description 最后一页(受翻页深度限制) */
+                            last_page?: number;
+                            /** @description 分面计数,只在 facets=true 时出现。键是 resource_type / language / category / granularity */
+                            facets?: {
+                                [key: string]: {
+                                    key: string;
+                                    count: number;
+                                }[];
+                            };
+                        };
                     };
                 };
             };
             422: components["responses"]["ProblemValidation"];
+            /** @description 搜索服务暂不可用 */
+            503: {
+                headers: {
+                    [name: string]: unknown;
+                };
+                content: {
+                    "application/problem+json": components["schemas"]["ProblemDetails"];
+                };
+            };
         };
     };
     post_api_v3_search: {
@@ -40318,7 +40363,7 @@ export interface operations {
         requestBody: {
             content: {
                 "application/json": {
-                    /** @description 搜索关键词 */
+                    /** @description 检索词 */
                     q: string;
                     /**
                      * @description 检索模式
@@ -40326,34 +40371,47 @@ export interface operations {
                      * @enum {string}
                      */
                     search_mode?: "fuzzy" | "exact" | "semantic" | "hybrid" | "definition";
-                    /** @description 资源类型 */
-                    resource_type?: string;
-                    /** @description 文档颗粒度 */
-                    granularity?: string;
-                    /** @description 语言 */
+                    /**
+                     * @description 资源类型
+                     * @enum {string}
+                     */
+                    resource_type?: "tipitaka" | "original_text" | "term";
+                    /** @description 限定某个资源 id */
+                    resource_id?: string;
+                    /**
+                     * @description 文档颗粒度
+                     * @enum {string}
+                     */
+                    granularity?: "book" | "chapter" | "session" | "paragraph";
+                    /** @description 文档语言 */
                     language?: string;
-                    /** @description 文档分类,逗号分隔 */
+                    /** @description 分类,逗号分隔,须全部命中 */
                     category?: string;
-                    /** @description 标签,逗号分隔 */
+                    /** @description 标签,逗号分隔,命中任一 */
                     tags?: string;
-                    /** @description 页码标记 */
+                    /** @description 页码标记,命中任一 */
                     page_refs?: unknown[];
-                    /** @description 关联 id */
+                    /** @description 关联 id,命中任一 */
                     related_id?: unknown[];
                     /** @description 作者或译者 */
                     author?: string;
-                    /** @description 来源 channel */
+                    /** @description 来源 channel 的 uuid */
                     channel?: string;
+                    /**
+                     * @description 是否返回分面计数
+                     * @default false
+                     */
+                    facets?: boolean;
                     /**
                      * @description 页码
                      * @default 1
                      */
                     page?: number;
                     /**
-                     * @description 每页数量,上限 100
+                     * @description 每页条数,上限 100
                      * @default 20
                      */
-                    page_size?: number;
+                    per_page?: number;
                 };
             };
         };
@@ -40365,11 +40423,57 @@ export interface operations {
                 };
                 content: {
                     "application/json": {
-                        data?: Record<string, never>;
+                        data?: {
+                            id?: string;
+                            resource_type?: string;
+                            resource_id?: string | null;
+                            granularity?: string | null;
+                            language?: string | null;
+                            related_id?: string | null;
+                            score?: number | null;
+                            title?: string;
+                            content?: string;
+                            highlight?: string | null;
+                            bold?: string[];
+                            path?: string | null;
+                            category?: string[];
+                            tags?: string[];
+                            updated_at?: string | null;
+                            /** @description 仅在部分查询口径下返回。 */
+                            display?: string;
+                        }[];
+                        meta?: {
+                            /** @description 当前页 */
+                            current_page?: number;
+                            /** @description 每页条数 */
+                            per_page?: number;
+                            /** @description 命中总数(total_relation 为 gte 时是下限) */
+                            total?: number;
+                            /** @description eq 精确,gte 表示「至少这么多」 */
+                            total_relation?: string;
+                            /** @description 最后一页(受翻页深度限制) */
+                            last_page?: number;
+                            /** @description 分面计数,只在 facets=true 时出现。键是 resource_type / language / category / granularity */
+                            facets?: {
+                                [key: string]: {
+                                    key: string;
+                                    count: number;
+                                }[];
+                            };
+                        };
                     };
                 };
             };
             422: components["responses"]["ProblemValidation"];
+            /** @description 搜索服务暂不可用 */
+            503: {
+                headers: {
+                    [name: string]: unknown;
+                };
+                content: {
+                    "application/problem+json": components["schemas"]["ProblemDetails"];
+                };
+            };
         };
     };
     get_api_v3_search_suggest: {
@@ -40427,7 +40531,25 @@ export interface operations {
                 };
                 content: {
                     "application/json": {
-                        data?: Record<string, never>;
+                        data?: {
+                            id?: string;
+                            resource_type?: string;
+                            resource_id?: string | null;
+                            granularity?: string | null;
+                            language?: string | null;
+                            related_id?: string | null;
+                            score?: number | null;
+                            title?: string;
+                            content?: string;
+                            highlight?: string | null;
+                            bold?: string[];
+                            path?: string | null;
+                            category?: string[];
+                            tags?: string[];
+                            updated_at?: string | null;
+                            /** @description 仅在部分查询口径下返回。 */
+                            display?: string;
+                        };
                     };
                 };
             };
@@ -40441,6 +40563,15 @@ export interface operations {
                 };
             };
             422: components["responses"]["ProblemValidation"];
+            /** @description 搜索服务暂不可用 */
+            503: {
+                headers: {
+                    [name: string]: unknown;
+                };
+                content: {
+                    "application/problem+json": components["schemas"]["ProblemDetails"];
+                };
+            };
         };
     };
     post_api_v3_sessions: {

+ 46 - 0
openapi/public/assets/protocol/overrides/v3-search.yaml

@@ -0,0 +1,46 @@
+# 手写补充:/v3/search 的 meta.facets 结构。
+# meta 其余字段由控制器 @meta 注解生成;@meta 只能声明到 object,桶的形状在这里补。
+get:
+  responses:
+    200:
+      content:
+        application/json:
+          schema:
+            properties:
+              meta:
+                properties:
+                  facets:
+                    type: object
+                    description: 分面计数,只在 facets=true 时出现。键是 resource_type / language / category / granularity
+                    additionalProperties:
+                      type: array
+                      items:
+                        type: object
+                        required: [key, count]
+                        properties:
+                          key:
+                            type: string
+                          count:
+                            type: integer
+post:
+  responses:
+    200:
+      content:
+        application/json:
+          schema:
+            properties:
+              meta:
+                properties:
+                  facets:
+                    type: object
+                    description: 分面计数,只在 facets=true 时出现。键是 resource_type / language / category / granularity
+                    additionalProperties:
+                      type: array
+                      items:
+                        type: object
+                        required: [key, count]
+                        properties:
+                          key:
+                            type: string
+                          count:
+                            type: integer

+ 58 - 5
openapi/public/assets/protocol/resources/auto/v3-search-search.yaml

@@ -1,16 +1,15 @@
 # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-search-search.yaml
 get:
-  summary: '按 id 取单条检索结果'
+  summary: '按 id 取单条检索文档'
   tags:
     - search
   operationId: get_api_v3_search_search_
   description: |-
-    直接从 OpenSearch 按文档 id 取回,不走检索。取不到返回 404。
+    直接从 OpenSearch 按文档 id 取回,带阅读用的 `display` HTML。
     整章正文文档(`tipitaka_chapter_{book}-{para}_{channel}`)按它所属 channel 判权限:
-    私有 channel 只有拥有者、团队成员、被共享的人能读(要带 token)。索引里收了所有 channel,
-    不在这里挡的话拼出 id 就能读到私有正文。
+    私有 channel 只有拥有者、团队成员、被共享的人能读(要带 token)。
 
-    实现:`V3\SearchPlusController@show`
+    实现:`V3\SearchController@show`
   security:
     - {  }
     -
@@ -33,6 +32,54 @@ get:
             properties:
               data:
                 type: object
+                properties:
+                  id:
+                    type: string
+                  resource_type:
+                    type: string
+                  resource_id:
+                    type: string
+                    nullable: true
+                  granularity:
+                    type: string
+                    nullable: true
+                  language:
+                    type: string
+                    nullable: true
+                  related_id:
+                    type: string
+                    nullable: true
+                  score:
+                    type: number
+                    nullable: true
+                  title:
+                    type: string
+                  content:
+                    type: string
+                  highlight:
+                    type: string
+                    nullable: true
+                  bold:
+                    type: array
+                    items:
+                      type: string
+                  path:
+                    type: string
+                    nullable: true
+                  category:
+                    type: array
+                    items:
+                      type: string
+                  tags:
+                    type: array
+                    items:
+                      type: string
+                  updated_at:
+                    type: string
+                    nullable: true
+                  display:
+                    type: string
+                    description: 仅在部分查询口径下返回。
     403:
       description: '整章正文所属的 channel 是私有的,且当前身份看不见'
       content:
@@ -41,3 +88,9 @@ get:
             $ref: '../../main.yaml#/components/schemas/ProblemDetails'
     422:
       $ref: '../../main.yaml#/components/responses/ProblemValidation'
+    503:
+      description: 搜索服务暂不可用
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'

+ 218 - 56
openapi/public/assets/protocol/resources/auto/v3-search.yaml

@@ -5,10 +5,11 @@ get:
     - search
   operationId: get_api_v3_search
   description: |-
-    支持 fuzzy / exact / semantic / hybrid 四种检索模式,底层走 OpenSearch。
-    同样的参数也可以用 POST /v3/search 提交(参数多、URL 放不下时用)。
+    底层走 OpenSearch。同样的参数也可以用 `POST /v3/search` 放在请求体里提交。
+    翻页深度受 OpenSearch 限制:`page × per_page` 不能超过 10000,超出 422。
+    搜索服务连不上或超时回 503(`search-unavailable`)。
 
-    实现:`V3\SearchPlusController@index`
+    实现:`V3\SearchController@index`
   security:
     - {  }
     -
@@ -19,23 +20,8 @@ get:
       in: query
       schema:
         type: string
-        default: ''
-      description: 搜索关键词
+      description: 检索词
       required: true
-    -
-      name: page
-      in: query
-      schema:
-        type: integer
-        default: 1
-      description: 页码
-    -
-      name: page_size
-      in: query
-      schema:
-        type: integer
-        default: 20
-      description: '每页数量,上限 100'
     -
       name: search_mode
       in: query
@@ -48,20 +34,17 @@ get:
           - hybrid
           - definition
         default: fuzzy
-      description: 检索模式
+      description: '检索模式:fuzzy 多词模糊(默认)、exact 词形精确、semantic 语义向量、hybrid 模糊 + 语义、definition 黑体定义优先'
     -
       name: resource_type
       in: query
       schema:
         type: string
         enum:
-          - article
+          - tipitaka
+          - original_text
           - term
-          - dictionary
-          - translation
-          - origin_text
-          - nissaya
-      description: 资源类型
+      description: '资源类型:tipitaka 三藏(段落与整章)、original_text 原文分段、term 术语'
     -
       name: resource_id
       in: query
@@ -76,40 +59,34 @@ get:
         enum:
           - book
           - chapter
-          - sutta
-          - section
+          - session
           - paragraph
-          - sentence
       description: 文档颗粒度
     -
       name: language
       in: query
       schema:
         type: string
-      description: 语言
-      example: zh-Hans
+      description: '文档语言,如 pi、zh、en'
     -
       name: category
       in: query
       schema:
         type: string
-        enum:
-          - pali
-          - commentary
-          - subcommentary
-      description: 文档分类,逗号分隔
+      description: 分类,逗号分隔,须全部命中
+      example: 'sutta,mūla'
     -
       name: tags
       in: query
       schema:
         type: string
-      description: 标签过滤,逗号分隔
+      description: 标签,逗号分隔,命中任一
     -
       name: page_refs
       in: query
       schema:
         type: array
-      description: 页码标记
+      description: 页码标记,命中任一
       example:
         - V3.81
         - M3.58
@@ -118,22 +95,42 @@ get:
       in: query
       schema:
         type: array
-      description: '关联 id'
+      description: '关联 id(经文段落是 `{book}-{para}`),命中任一'
       example:
-        - chapter_93-5
-        - 'm.n. 38'
+        - 93-5
     -
       name: author
       in: query
       schema:
         type: string
-      description: 按作者或译者过滤
+      description: 作者或译者
     -
       name: channel
       in: query
       schema:
         type: string
-      description: '按来源 channel 过滤'
+      description: '来源 channel 的 uuid'
+    -
+      name: facets
+      in: query
+      schema:
+        type: boolean
+        default: false
+      description: '是否在 `meta.facets` 里返回按 resource_type / language / category / granularity 的分面计数'
+    -
+      name: page
+      in: query
+      schema:
+        type: integer
+        default: 1
+      description: 页码
+    -
+      name: per_page
+      in: query
+      schema:
+        type: integer
+        default: 20
+      description: '每页条数,上限 100'
   responses:
     200:
       description: 成功
@@ -146,20 +143,92 @@ get:
                 type: array
                 items:
                   type: object
+                  properties:
+                    id:
+                      type: string
+                    resource_type:
+                      type: string
+                    resource_id:
+                      type: string
+                      nullable: true
+                    granularity:
+                      type: string
+                      nullable: true
+                    language:
+                      type: string
+                      nullable: true
+                    related_id:
+                      type: string
+                      nullable: true
+                    score:
+                      type: number
+                      nullable: true
+                    title:
+                      type: string
+                    content:
+                      type: string
+                    highlight:
+                      type: string
+                      nullable: true
+                    bold:
+                      type: array
+                      items: { type: string }
+                    path:
+                      type: string
+                      nullable: true
+                    category:
+                      type: array
+                      items: { type: string }
+                    tags:
+                      type: array
+                      items: { type: string }
+                    updated_at:
+                      type: string
+                      nullable: true
+                    display:
+                      type: string
+                      description: 仅在部分查询口径下返回。
               meta:
-                $ref: '../../main.yaml#/components/schemas/PaginationMeta'
+                type: object
+                properties:
+                  current_page:
+                    type: integer
+                    description: 当前页
+                  per_page:
+                    type: integer
+                    description: 每页条数
+                  total:
+                    type: integer
+                    description: '命中总数(total_relation 为 gte 时是下限)'
+                  total_relation:
+                    type: string
+                    description: 'eq 精确,gte 表示「至少这么多」(OpenSearch 只精确计数到 10000)'
+                  last_page:
+                    type: integer
+                    description: 最后一页(受翻页深度限制)
+                  facets:
+                    type: object
+                    description: '分面计数,只在 facets=true 时出现。键是 resource_type / language / category / granularity'
+                    additionalProperties:
+                      type: array
+                      items: { type: object, required: [key, count], properties: { key: { type: string }, count: { type: integer } } }
     422:
       $ref: '../../main.yaml#/components/responses/ProblemValidation'
+    503:
+      description: 搜索服务暂不可用
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
 post:
   summary: 全文检索(POST)
   tags:
     - search
   operationId: post_api_v3_search
   description: |-
-    与 `GET /v3/search` 完全等价,只是把参数放在请求体里——参数多、
-    尤其是 page_refs / related_id 这类数组时,URL 放不下。
+    与 `GET /v3/search` 完全等价,参数放在 JSON 请求体里(数组参数多、URL 放不下时用)。
 
-    实现:`V3\SearchPlusController@store`
+    实现:`V3\SearchController@store`
   security:
     - {  }
     -
@@ -173,7 +242,7 @@ post:
           properties:
             q:
               type: string
-              description: 搜索关键词
+              description: 检索词
             search_mode:
               type: string
               description: 检索模式
@@ -187,37 +256,53 @@ post:
             resource_type:
               type: string
               description: 资源类型
+              enum:
+                - tipitaka
+                - original_text
+                - term
+            resource_id:
+              type: string
+              description: '限定某个资源 id'
             granularity:
               type: string
               description: 文档颗粒度
+              enum:
+                - book
+                - chapter
+                - session
+                - paragraph
             language:
               type: string
-              description: 语言
+              description: 文档语言
             category:
               type: string
-              description: 文档分类,逗号分隔
+              description: 分类,逗号分隔,须全部命中
             tags:
               type: string
-              description: 标签,逗号分隔
+              description: 标签,逗号分隔,命中任一
             page_refs:
               type: array
-              description: 页码标记
+              description: 页码标记,命中任一
             related_id:
               type: array
-              description: '关联 id'
+              description: '关联 id,命中任一'
             author:
               type: string
               description: 作者或译者
             channel:
               type: string
-              description: '来源 channel'
+              description: '来源 channel 的 uuid'
+            facets:
+              type: boolean
+              description: 是否返回分面计数
+              default: false
             page:
               type: integer
               description: 页码
               default: 1
-            page_size:
+            per_page:
               type: integer
-              description: '每页数量,上限 100'
+              description: '每页条数,上限 100'
               default: 20
           required:
             - q
@@ -230,6 +315,83 @@ post:
             type: object
             properties:
               data:
+                type: array
+                items:
+                  type: object
+                  properties:
+                    id:
+                      type: string
+                    resource_type:
+                      type: string
+                    resource_id:
+                      type: string
+                      nullable: true
+                    granularity:
+                      type: string
+                      nullable: true
+                    language:
+                      type: string
+                      nullable: true
+                    related_id:
+                      type: string
+                      nullable: true
+                    score:
+                      type: number
+                      nullable: true
+                    title:
+                      type: string
+                    content:
+                      type: string
+                    highlight:
+                      type: string
+                      nullable: true
+                    bold:
+                      type: array
+                      items: { type: string }
+                    path:
+                      type: string
+                      nullable: true
+                    category:
+                      type: array
+                      items: { type: string }
+                    tags:
+                      type: array
+                      items: { type: string }
+                    updated_at:
+                      type: string
+                      nullable: true
+                    display:
+                      type: string
+                      description: 仅在部分查询口径下返回。
+              meta:
                 type: object
+                properties:
+                  current_page:
+                    type: integer
+                    description: 当前页
+                  per_page:
+                    type: integer
+                    description: 每页条数
+                  total:
+                    type: integer
+                    description: '命中总数(total_relation 为 gte 时是下限)'
+                  total_relation:
+                    type: string
+                    description: 'eq 精确,gte 表示「至少这么多」'
+                  last_page:
+                    type: integer
+                    description: 最后一页(受翻页深度限制)
+                  facets:
+                    type: object
+                    description: '分面计数,只在 facets=true 时出现。键是 resource_type / language / category / granularity'
+                    additionalProperties:
+                      type: array
+                      items: { type: object, required: [key, count], properties: { key: { type: string }, count: { type: integer } } }
     422:
       $ref: '../../main.yaml#/components/responses/ProblemValidation'
+    503:
+      description: 搜索服务暂不可用
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'