Browse Source

Merge pull request #2499 from visuddhinanda/development

Development
visuddhinanda 1 week ago
parent
commit
bbf470bea9
100 changed files with 32621 additions and 319 deletions
  1. 0 0
      CLAUDE.md
  2. 18 0
      api-test/cases/05_tipitaka.php
  3. 8 0
      api-test/cases/07_discussions.php
  4. 165 0
      api-test/cases/14_channels.php
  5. 82 0
      api-test/cases/15_channel_links.php
  6. 85 0
      api-test/cases/16_terms.php
  7. 35 0
      api-test/cases/17_glossaries.php
  8. 65 0
      api-test/cases/18_term_exchange.php
  9. 27 0
      api-test/cases/19_nissaya_cards.php
  10. 123 0
      api-test/client/.openapi-generator/FILES
  11. 4101 0
      api-test/client/lib/Api/ChannelsApi.php
  12. 502 0
      api-test/client/lib/Api/GlossariesApi.php
  13. 16 2
      api-test/client/lib/Api/SearchApi.php
  14. 2194 0
      api-test/client/lib/Api/StudiosApi.php
  15. 1617 0
      api-test/client/lib/Api/TermsApi.php
  16. 542 0
      api-test/client/lib/Api/TipitakaChannelsApi.php
  17. 537 0
      api-test/client/lib/Api/TipitakaParagraphChannelsApi.php
  18. 16 2
      api-test/client/lib/Api/TipitakaReadingApi.php
  19. 443 0
      api-test/client/lib/Model/GetApiV3Channels200Response.php
  20. 872 0
      api-test/client/lib/Model/GetApiV3Channels200ResponseDataInner.php
  21. 511 0
      api-test/client/lib/Model/GetApiV3Channels200ResponseDataInnerAbilities.php
  22. 552 0
      api-test/client/lib/Model/GetApiV3Channels200ResponseDataInnerOwner.php
  23. 409 0
      api-test/client/lib/Model/GetApiV3ChannelsChannel200Response.php
  24. 409 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200Response.php
  25. 593 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseData.php
  26. 545 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom.php
  27. 545 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner.php
  28. 443 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelTerms200Response.php
  29. 1302 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelTerms200ResponseDataInner.php
  30. 443 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities.php
  31. 443 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel.php
  32. 17 17
      api-test/client/lib/Model/GetApiV3Discussions200ResponseDataInner.php
  33. 443 0
      api-test/client/lib/Model/GetApiV3GlossariesKind200Response.php
  34. 559 0
      api-test/client/lib/Model/GetApiV3GlossariesKind200ResponseDataInner.php
  35. 477 0
      api-test/client/lib/Model/GetApiV3GlossariesKind200ResponseMeta.php
  36. 443 0
      api-test/client/lib/Model/GetApiV3TipitakaChannels200Response.php
  37. 865 0
      api-test/client/lib/Model/GetApiV3TipitakaChannels200ResponseDataInner.php
  38. 552 0
      api-test/client/lib/Model/MarkupElement.php
  39. 668 0
      api-test/client/lib/Model/MarkupNode.php
  40. 555 0
      api-test/client/lib/Model/MarkupTemplate.php
  41. 481 0
      api-test/client/lib/Model/MarkupText.php
  42. 525 0
      api-test/client/lib/Model/PatchApiV3ChannelsChannelLinksRequest.php
  43. 725 0
      api-test/client/lib/Model/PatchApiV3ChannelsChannelRequest.php
  44. 754 0
      api-test/client/lib/Model/PatchApiV3TermsTermRequest.php
  45. 443 0
      api-test/client/lib/Model/PostApiV3ChannelsBatchProgress200Response.php
  46. 954 0
      api-test/client/lib/Model/PostApiV3ChannelsBatchProgress200ResponseDataInner.php
  47. 446 0
      api-test/client/lib/Model/PostApiV3ChannelsBatchProgressRequest.php
  48. 409 0
      api-test/client/lib/Model/PostApiV3ChannelsChannelTerms200Response.php
  49. 409 0
      api-test/client/lib/Model/PostApiV3ChannelsChannelTermsImports200Response.php
  50. 545 0
      api-test/client/lib/Model/PostApiV3ChannelsChannelTermsImports200ResponseData.php
  51. 443 0
      api-test/client/lib/Model/PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner.php
  52. 801 0
      api-test/client/lib/Model/PostApiV3ChannelsChannelTermsRequest.php
  53. 700 0
      api-test/client/lib/Model/PostApiV3StudiosStudioChannelsRequest.php
  54. 838 0
      api-test/client/lib/Model/PostApiV3StudiosStudioTermsRequest.php
  55. 0 28
      api-v13/app/Console/Commands/TestMdRender.php
  56. 35 80
      api-v13/app/Http/Api/ChannelApi.php
  57. 3 2
      api-v13/app/Http/Api/TemplateRender.php
  58. 38 177
      api-v13/app/Http/Controllers/Library/WikiController.php
  59. 44 0
      api-v13/app/Http/Controllers/V3/ChannelBatchProgressController.php
  60. 123 0
      api-v13/app/Http/Controllers/V3/ChannelController.php
  61. 68 0
      api-v13/app/Http/Controllers/V3/ChannelLinkController.php
  62. 102 0
      api-v13/app/Http/Controllers/V3/ChannelTermController.php
  63. 45 0
      api-v13/app/Http/Controllers/V3/ChannelTermImportController.php
  64. 45 0
      api-v13/app/Http/Controllers/V3/EditableChannelController.php
  65. 46 0
      api-v13/app/Http/Controllers/V3/GlossaryController.php
  66. 4 0
      api-v13/app/Http/Controllers/V3/GroupMemberController.php
  67. 3 0
      api-v13/app/Http/Controllers/V3/GroupShareController.php
  68. 36 0
      api-v13/app/Http/Controllers/V3/NissayaCardController.php
  69. 21 3
      api-v13/app/Http/Controllers/V3/SearchPlusController.php
  70. 86 0
      api-v13/app/Http/Controllers/V3/StudioChannelController.php
  71. 100 0
      api-v13/app/Http/Controllers/V3/StudioTermController.php
  72. 43 0
      api-v13/app/Http/Controllers/V3/StudioTermImportController.php
  73. 127 0
      api-v13/app/Http/Controllers/V3/TermController.php
  74. 44 0
      api-v13/app/Http/Controllers/V3/TipitakaChannelController.php
  75. 46 0
      api-v13/app/Http/Controllers/V3/TipitakaParagraphChannelController.php
  76. 14 3
      api-v13/app/Http/Controllers/V3/TipitakaReadingController.php
  77. 32 0
      api-v13/app/Http/Requests/V3/ChannelBatchProgressRequest.php
  78. 26 0
      api-v13/app/Http/Requests/V3/ImportTermsRequest.php
  79. 45 0
      api-v13/app/Http/Requests/V3/IndexChannelRequest.php
  80. 41 0
      api-v13/app/Http/Requests/V3/IndexEditableChannelRequest.php
  81. 26 0
      api-v13/app/Http/Requests/V3/IndexGlossaryRequest.php
  82. 43 0
      api-v13/app/Http/Requests/V3/IndexStudioChannelRequest.php
  83. 37 0
      api-v13/app/Http/Requests/V3/IndexTermRequest.php
  84. 31 0
      api-v13/app/Http/Requests/V3/IndexTipitakaChannelRequest.php
  85. 27 0
      api-v13/app/Http/Requests/V3/IndexTipitakaParagraphChannelRequest.php
  86. 37 0
      api-v13/app/Http/Requests/V3/LookupTermRequest.php
  87. 26 0
      api-v13/app/Http/Requests/V3/ShowNissayaCardRequest.php
  88. 41 0
      api-v13/app/Http/Requests/V3/ShowTermRequest.php
  89. 38 0
      api-v13/app/Http/Requests/V3/StoreChannelRequest.php
  90. 1 1
      api-v13/app/Http/Requests/V3/StoreDiscussionRequest.php
  91. 41 0
      api-v13/app/Http/Requests/V3/StoreTermRequest.php
  92. 1 1
      api-v13/app/Http/Requests/V3/TipitakaReadingRequest.php
  93. 36 0
      api-v13/app/Http/Requests/V3/UpdateChannelLinksRequest.php
  94. 39 0
      api-v13/app/Http/Requests/V3/UpdateChannelRequest.php
  95. 49 0
      api-v13/app/Http/Requests/V3/UpdateTermRequest.php
  96. 49 0
      api-v13/app/Http/Resources/V3/ChannelLinksResource.php
  97. 47 0
      api-v13/app/Http/Resources/V3/ChannelProgressResource.php
  98. 90 0
      api-v13/app/Http/Resources/V3/ChannelResource.php
  99. 13 3
      api-v13/app/Http/Resources/V3/DiscussionResource.php
  100. 37 0
      api-v13/app/Http/Resources/V3/GlossaryEntryResource.php

File diff suppressed because it is too large
+ 0 - 0
CLAUDE.md


+ 18 - 0
api-test/cases/05_tipitaka.php

@@ -18,6 +18,24 @@ test('GET /v3/tipitaka-reading/{channel}?book=… → 200(带 total)', funct
     assert_has_key('total', $res['body']['meta'] ?? [], 'tipitaka-reading.meta.total');
 });
 
+test('GET /v3/tipitaka-reading/{channel}?format=react → 422(v2 的 react 格式不再提供)', function () {
+    $res = raw('GET', '/v3/tipitaka-reading/' . fixtures()['channel'], ['format' => 'react']);
+    assert_status(422, $res, 'tipitaka-reading format=react');
+    assert_field_error('format', $res, 'tipitaka-reading format=react');
+});
+
+test('GET /v3/tipitaka-reading/{channel}?book=…&format=text&include=sentences → 200,逐句纯文本不含 HTML', function () {
+    $res = raw('GET', '/v3/tipitaka-reading/' . fixtures()['channel'], ['book' => 65, 'page_size' => 2, 'format' => 'text', 'include' => 'sentences']);
+    assert_status(200, $res, 'tipitaka-reading text');
+    foreach ($res['body']['data'] ?? [] as $paragraph) {
+        foreach ($paragraph['sentences'] ?? [] as $sentence) {
+            if (preg_match('/<[a-z][^>]*>/i', (string) ($sentence['html'] ?? ''))) {
+                fail('tipitaka-reading text:句子里不应有 HTML 标签,html=' . $sentence['html']);
+            }
+        }
+    }
+});
+
 test('GET /v3/tipitaka-reading/{非 uuid} → 404', function () {
     $res = raw('GET', '/v3/tipitaka-reading/not-a-uuid');
     assert_status(404, $res, 'tipitaka-reading 非 uuid');

+ 8 - 0
api-test/cases/07_discussions.php

@@ -160,6 +160,14 @@ test('discussions 一轮:建话题 → 回复 → 关闭后回复 409 → 重
         assert_eq($id, $r['body']['data']['parent_id'] ?? null, '回复 parent_id');
         assert_eq('issue', $r['body']['data']['type'] ?? null, '回复类型跟话题');
 
+        // 正文渲染:挂在句子上的给节点树 body 与纯文本 summary(App\Services\Markup;不再有 html)
+        $rendered = raw('GET', "/v3/discussions/{$replyId}", null, null, $token);
+        assert_eq([['type' => 'text', 'value' => 'api-test 回复']], $rendered['body']['data']['body'] ?? null, '回复 body');
+        assert_eq('api-test 回复', $rendered['body']['data']['summary'] ?? null, '回复 summary');
+        if (array_key_exists('html', $rendered['body']['data'] ?? [])) {
+            fail('回复:不应再有 html 字段');
+        }
+
         // 回复上改话题专属字段(标题、状态、类型)→ 422
         $topicOnly = raw('PATCH', "/v3/discussions/{$replyId}", null, ['title' => 'x'], $token);
         assert_field_error('title', $topicOnly, 'PATCH 回复的 title');

+ 165 - 0
api-test/cases/14_channels.php

@@ -0,0 +1,165 @@
+<?php
+
+use \WikipaliApi\Api\ChannelsApi;
+use \WikipaliApi\Api\StudiosApi;
+use \WikipaliApi\Api\TipitakaChannelsApi;
+use \WikipaliApi\Api\TipitakaParagraphChannelsApi;
+use \WikipaliApi\Model\PatchApiV3ChannelsChannelRequest;
+use \WikipaliApi\Model\PostApiV3ChannelsBatchProgressRequest;
+use \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest;
+
+/*
+ * v3 channel:公开目录、详情、我能写的、studio 列表、建 → 改 → 删、阅读领域的两个查询、batch-progress。
+ * 「建 → 改 → 删」用临时 channel(e2e-tmp-*),删是软删除。
+ */
+
+/** 测试账号自己的 uuid */
+function my_uid(string $token): string
+{
+    $me = raw('GET', '/v3/me', null, null, $token);
+    assert_status(200, $me, 'me');
+
+    return $me['body']['data']['id'];
+}
+
+/* ---- 公开读 ---- */
+
+test('GET /v3/channels → 200,只有公开的', function () {
+    $res = request(fn () => api(ChannelsApi::class)->getApiV3ChannelsWithHttpInfo());
+    assert_status(200, $res, 'channels');
+    assert_has_key('meta', $res['body'], 'channels');
+    foreach ($res['body']['data'] as $channel) {
+        assert_eq(30, $channel['status'], 'channels 只列公开的');
+        assert_has_key('abilities', $channel, 'channels.data[]');
+    }
+});
+
+test('GET /v3/channels?system=true → 200,都是系统 channel', function () {
+    $res = request(fn () => api(ChannelsApi::class)->getApiV3ChannelsWithHttpInfo(system: true, per_page: 50));
+    assert_status(200, $res, 'channels system');
+    foreach ($res['body']['data'] as $channel) {
+        assert_eq(true, $channel['is_system'], 'system=true 只列系统 channel');
+    }
+});
+
+test('GET /v3/channels?para=(缺 book)→ 422', function () {
+    $res = raw('GET', '/v3/channels', ['para' => 1]);
+    assert_status(422, $res, 'channels 缺 book');
+    assert_field_error('book', $res, 'channels 缺 book');
+});
+
+test('GET /v3/channels/{channel} → 200;不存在 → 404', function () {
+    $res = request(fn () => api(ChannelsApi::class)->getApiV3ChannelsChannelWithHttpInfo(fixtures()['channel']));
+    assert_status(200, $res, 'channel 详情');
+    assert_has_key('owner', $res['body']['data'], 'channel 详情');
+
+    $missing = request(fn () => api(ChannelsApi::class)->getApiV3ChannelsChannelWithHttpInfo('11111111-1111-4111-8111-111111111111'));
+    assert_status(404, $missing, 'channel 不存在');
+});
+
+test('GET /v3/tipitaka-channels?lang=zh → 200,带 chapter_count', function () {
+    $res = request(fn () => api(TipitakaChannelsApi::class)->getApiV3TipitakaChannelsWithHttpInfo(lang: 'zh', type: 'translation'));
+    assert_status(200, $res, 'tipitaka-channels');
+    $first = $res['body']['data'][0] ?? null;
+    if ($first) {
+        assert_has_key('chapter_count', $first, 'tipitaka-channels.data[0]');
+    }
+});
+
+test('GET /v3/tipitaka-paragraph-channels/{book}/{para} → 200', function () {
+    $res = request(fn () => api(TipitakaParagraphChannelsApi::class)->getApiV3TipitakaParagraphChannelsBookParaWithHttpInfo(fixtures()['book'], fixtures()['para']));
+    assert_status(200, $res, 'tipitaka-paragraph-channels');
+    assert_has_key('meta', $res['body'], 'tipitaka-paragraph-channels');
+});
+
+test('POST /v3/channels/batch-progress → 200;格式不对 → 422', function () {
+    $body = new PostApiV3ChannelsBatchProgressRequest();
+    $body->setSentences(['1-2-1-10']);
+    $res = request(fn () => api(ChannelsApi::class)->postApiV3ChannelsBatchProgressWithHttpInfo($body));
+    assert_status(200, $res, 'batch-progress');
+
+    $bad = raw('POST', '/v3/channels/batch-progress', null, ['sentences' => ['1-2']]);
+    assert_status(422, $bad, 'batch-progress 格式不对');
+});
+
+/* ---- 要登录 ---- */
+
+test('GET /v3/channels/editable(无 token)→ 401;带 token → 200', function () {
+    $anon = request(fn () => api(ChannelsApi::class)->getApiV3ChannelsEditableWithHttpInfo());
+    assert_status(401, $anon, 'editable 无 token');
+    assert_problem($anon, 'editable 无 token');
+
+    $res = request(fn () => api(ChannelsApi::class, required_token())->getApiV3ChannelsEditableWithHttpInfo(per_page: 5));
+    assert_status(200, $res, 'editable');
+    foreach ($res['body']['data'] as $channel) {
+        assert_eq(true, $channel['abilities']['write'], 'editable 里的都能写');
+    }
+});
+
+test('GET /v3/studios/{studio}/channels:本人 200,无 token 401', function () {
+    $token = required_token();
+    $me = my_uid($token);
+    $res = request(fn () => api(StudiosApi::class, $token)->getApiV3StudiosStudioChannelsWithHttpInfo($me, relation: 'own', per_page: 5));
+    assert_status(200, $res, 'studio channels');
+    assert_has_key('meta', $res['body'], 'studio channels');
+
+    $anon = request(fn () => api(StudiosApi::class)->getApiV3StudiosStudioChannelsWithHttpInfo($me));
+    assert_status(401, $anon, 'studio channels 无 token');
+});
+
+test('POST /v3/studios/{studio}/channels(缺 name)→ 422', function () {
+    $token = required_token();
+    $res = raw('POST', '/v3/studios/'.my_uid($token).'/channels', null, ['type' => 'translation', 'lang' => 'zh'], $token);
+    assert_status(422, $res, 'channels 缺 name');
+    assert_field_error('name', $res, 'channels 缺 name');
+});
+
+test('channels 一轮:建 201 → 改 200(只改传了的)→ 删 200(软删)→ 再看 404', function () {
+    $token = required_token();
+    $me = my_uid($token);
+
+    $body = new PostApiV3StudiosStudioChannelsRequest();
+    $body->setName('e2e-tmp-'.time());
+    $body->setType('translation');
+    $body->setLang('zh-Hans');
+    $body->setSummary('api-test');
+    $create = request(fn () => api(StudiosApi::class, $token)->postApiV3StudiosStudioChannelsWithHttpInfo($me, $body));
+    assert_status(201, $create, '建 channel');
+    assert_eq(10, $create['body']['data']['status'] ?? null, '新建默认私有');
+    $channel = $create['body']['data']['id'];
+
+    $patch = new PatchApiV3ChannelsChannelRequest();
+    $patch->setStatus(30);
+    $update = request(fn () => api(ChannelsApi::class, $token)->patchApiV3ChannelsChannelWithHttpInfo($channel, $patch));
+    assert_status(200, $update, '改 channel');
+    assert_eq(30, $update['body']['data']['status'] ?? null, '改后的状态');
+    assert_eq('api-test', $update['body']['data']['summary'] ?? null, '没传的字段不变');
+
+    $delete = request(fn () => api(ChannelsApi::class, $token)->deleteApiV3ChannelsChannelWithHttpInfo($channel));
+    assert_status(200, $delete, '删 channel');
+
+    $gone = request(fn () => api(ChannelsApi::class, $token)->getApiV3ChannelsChannelWithHttpInfo($channel));
+    assert_status(404, $gone, '删后再看');
+});
+
+test('tipitaka-reading 私有 channel:无 token 403,拥有者 200', function () {
+    $token = required_token();
+    $body = new PostApiV3StudiosStudioChannelsRequest();
+    $body->setName('e2e-tmp-private-'.time());
+    $body->setType('translation');
+    $body->setLang('zh-Hans');
+    $create = request(fn () => api(StudiosApi::class, $token)->postApiV3StudiosStudioChannelsWithHttpInfo(my_uid($token), $body));
+    assert_status(201, $create, '建私有 channel');
+    $channel = $create['body']['data']['id'];
+
+    $anon = raw('GET', "/v3/tipitaka-reading/{$channel}");
+    assert_status(403, $anon, '无 token 读私有正文');
+    assert_problem($anon, '无 token 读私有正文');
+    $mine = raw('GET', "/v3/tipitaka-reading/{$channel}", null, null, $token);
+    assert_status(200, $mine, '拥有者读私有正文');
+
+    $chapter = raw('GET', "/v3/search/tipitaka_chapter_1-1_{$channel}");
+    assert_status(403, $chapter, '无 token 取私有 channel 的整章文档');
+
+    request(fn () => api(ChannelsApi::class, $token)->deleteApiV3ChannelsChannelWithHttpInfo($channel));
+});

+ 82 - 0
api-test/cases/15_channel_links.php

@@ -0,0 +1,82 @@
+<?php
+
+use \WikipaliApi\Api\ChannelsApi;
+use \WikipaliApi\Api\StudiosApi;
+use \WikipaliApi\Model\PatchApiV3ChannelsChannelLinksRequest;
+use \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest;
+
+/*
+ * channel 之间的关系设置:GET / PATCH /v3/channels/{channel}/links
+ *
+ * 写操作用两个临时 channel(e2e-tmp-links-*),测完清空关系并删掉(软删)。
+ * 权限矩阵(团队角色、AI 模型)、目标可见性、N+1 由 api-v13 的 ChannelLinkV3Test 覆盖。
+ */
+
+/** 在本人名下建一个临时 channel,返回 uid */
+function links_tmp_channel(string $token, string $suffix): string
+{
+    $me = raw('GET', '/v3/me', null, null, $token);
+    assert_status(200, $me, 'me');
+    $body = new PostApiV3StudiosStudioChannelsRequest();
+    $body->setName("e2e-tmp-links-{$suffix}-".time());
+    $body->setType('translation');
+    $body->setLang('en');
+    $res = request(fn () => api(StudiosApi::class, $token)->postApiV3StudiosStudioChannelsWithHttpInfo($me['body']['data']['id'], $body));
+    assert_status(201, $res, "建临时 channel {$suffix}");
+
+    return $res['body']['data']['id'];
+}
+
+test('GET /v3/channels/{channel}/links → 200,四种关系都在', function () {
+    $res = request(fn () => api(ChannelsApi::class)->getApiV3ChannelsChannelLinksWithHttpInfo(fixtures()['channel']));
+    assert_status(200, $res, 'links');
+    foreach (['channel_id', 'derived_from', 'wbw', 'fallback', 'term_source', 'can_update'] as $key) {
+        assert_has_key($key, $res['body']['data'], 'links');
+    }
+    assert_eq(false, $res['body']['data']['can_update'], '匿名不能改');
+});
+
+test('GET /v3/channels/{不存在}/links → 404', function () {
+    assert_status(404, raw('GET', '/v3/channels/11111111-1111-4111-8111-111111111111/links'), '不存在的 channel');
+});
+
+test('PATCH /v3/channels/{channel}/links(无 token)→ 401', function () {
+    $res = raw('PATCH', '/v3/channels/'.fixtures()['channel'].'/links', null, ['fallback' => []]);
+    assert_status(401, $res, 'links 无 token');
+    assert_problem($res, 'links 无 token');
+});
+
+test('channel links 一轮:设置 200 → 读回 → 指向自己 422 → 清空 200', function () {
+    $token = required_token();
+    $a = links_tmp_channel($token, 'a');
+    $b = links_tmp_channel($token, 'b');
+
+    $body = new PatchApiV3ChannelsChannelLinksRequest();
+    $body->setDerivedFrom($b);
+    $body->setFallback([$b]);
+    $body->setTermSource([$b]);
+    $set = request(fn () => api(ChannelsApi::class, $token)->patchApiV3ChannelsChannelLinksWithHttpInfo($a, $body));
+    assert_status(200, $set, '设置关系');
+    assert_eq($b, $set['body']['data']['derived_from']['id'] ?? null, 'derived_from');
+    assert_eq(true, $set['body']['data']['can_update'], '拥有者能改');
+
+    $read = request(fn () => api(ChannelsApi::class, $token)->getApiV3ChannelsChannelLinksWithHttpInfo($a));
+    assert_status(200, $read, '读回');
+    assert_eq([$b], array_column($read['body']['data']['fallback'], 'id'), 'fallback 读回');
+
+    $self = raw('PATCH', "/v3/channels/{$a}/links", null, ['derived_from' => $a], $token);
+    assert_status(422, $self, '指向自己');
+    assert_field_error('derived_from', $self, '指向自己');
+
+    $bad = raw('PATCH', "/v3/channels/{$a}/links", null, ['wbw' => $b], $token);
+    assert_status(422, $bad, '逐词目标不是 wbw');
+    assert_field_error('wbw', $bad, '逐词目标不是 wbw');
+
+    $clear = raw('PATCH', "/v3/channels/{$a}/links", null, ['derived_from' => null, 'fallback' => [], 'term_source' => []], $token);
+    assert_status(200, $clear, '清空');
+    assert_eq(null, $clear['body']['data']['derived_from'], '清空后 derived_from');
+
+    foreach ([$a, $b] as $uid) {
+        assert_status(200, request(fn () => api(ChannelsApi::class, $token)->deleteApiV3ChannelsChannelWithHttpInfo($uid)), '删临时 channel');
+    }
+});

+ 85 - 0
api-test/cases/16_terms.php

@@ -0,0 +1,85 @@
+<?php
+
+use \WikipaliApi\Api\ChannelsApi;
+use \WikipaliApi\Api\StudiosApi;
+use \WikipaliApi\Api\TermsApi;
+use \WikipaliApi\Model\PostApiV3ChannelsChannelTermsRequest;
+use \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest;
+
+/*
+ * v3 术语:/v3/terms、/v3/channels/{c}/terms、/v3/studios/{s}/terms。
+ * 写操作用临时 channel(e2e-tmp-terms-*):建 → 读(ETag)→ 改(If-Match,412 / 428)→ 删(软删),最后删掉 channel。
+ * 权限矩阵(团队角色、AI 代写)、分类抽取、N+1 由 api-v13 的 TermV3Test 覆盖。
+ */
+
+test('GET /v3/terms?word= → 200;缺 word → 422', function () {
+    $res = request(fn () => api(TermsApi::class)->getApiV3TermsWithHttpInfo('dhamma', 5));
+    assert_status(200, $res, 'terms lookup');
+    assert_has_key('meta', $res['body'], 'terms lookup');
+
+    $bad = raw('GET', '/v3/terms');
+    assert_status(422, $bad, 'terms 缺 word');
+    assert_field_error('word', $bad, 'terms 缺 word');
+});
+
+test('GET /v3/channels/{channel}/terms → 200;GET /v3/terms/{不存在} → 404', function () {
+    $res = request(fn () => api(ChannelsApi::class)->getApiV3ChannelsChannelTermsWithHttpInfo(fixtures()['channel'], 5));
+    assert_status(200, $res, 'channel terms');
+    assert_has_key('meta', $res['body'], 'channel terms');
+
+    assert_status(404, raw('GET', '/v3/terms/11111111-1111-4111-8111-111111111111'), '术语不存在');
+});
+
+test('写术语(无 token)→ 401', function () {
+    $res = raw('POST', '/v3/channels/'.fixtures()['channel'].'/terms', null, ['word' => 'x', 'meaning' => 'y']);
+    assert_status(401, $res, 'terms 无 token');
+    assert_problem($res, 'terms 无 token');
+});
+
+test('terms 一轮:建 201 → 读带 ETag → 不带 If-Match 428 → 旧 etag 412 → 改 200 → 删 200(软删)→ 再看 404', function () {
+    $token = required_token();
+    $me = raw('GET', '/v3/me', null, null, $token);
+    assert_status(200, $me, 'me');
+    $body = new PostApiV3StudiosStudioChannelsRequest();
+    $body->setName('e2e-tmp-terms-'.time());
+    $body->setType('translation');
+    $body->setLang('zh-Hans');
+    $channel = request(fn () => api(StudiosApi::class, $token)->postApiV3StudiosStudioChannelsWithHttpInfo($me['body']['data']['id'], $body));
+    assert_status(201, $channel, '建临时 channel');
+    $channelId = $channel['body']['data']['id'];
+
+    $termBody = new PostApiV3ChannelsChannelTermsRequest();
+    $termBody->setWord('apitest');
+    $termBody->setMeaning('接口测试');
+    $termBody->setNote("第一段。\n\n{{category|api-test}}");
+    $termBody->setQuality('draft');
+    $create = request(fn () => api(ChannelsApi::class, $token)->postApiV3ChannelsChannelTermsWithHttpInfo($channelId, $termBody));
+    assert_status(201, $create, '建术语');
+    $term = $create['body']['data'];
+    assert_eq('markdown-e2', $term['content_type'] ?? null, '新建默认 markdown-e2');
+    assert_eq(['api-test'], $term['categories'] ?? null, '分类从正文抽出');
+
+    $dup = raw('POST', "/v3/channels/{$channelId}/terms", null, ['word' => 'apitest', 'meaning' => '重复'], $token);
+    assert_status(409, $dup, '同一 word@tag 重复');
+
+    $show = raw('GET', "/v3/terms/{$term['id']}", null, null, $token);
+    assert_status(200, $show, '读术语');
+    assert_eq($term['etag'], $show['headers']['etag'][0] ?? null, 'ETag 头与 etag 字段一致');
+    assert_has_key('body', $show['body']['data'], '单条带渲染后的正文');
+
+    assert_status(428, raw('PATCH', "/v3/terms/{$term['id']}", null, ['meaning' => '改'], $token), '不带 If-Match');
+    assert_status(412, raw('PATCH', "/v3/terms/{$term['id']}", null, ['meaning' => '改'], $token, ['If-Match' => '"0.0"']), '旧 etag');
+    $word = raw('PATCH', "/v3/terms/{$term['id']}", null, ['word' => 'other'], $token, ['If-Match' => $term['etag']]);
+    assert_status(422, $word, '词头不能改');
+    assert_field_error('word', $word, '词头不能改');
+
+    $update = raw('PATCH', "/v3/terms/{$term['id']}", null, ['meaning' => '改过的'], $token, ['If-Match' => $term['etag']]);
+    assert_status(200, $update, '改术语');
+    assert_eq('改过的', $update['body']['data']['meaning'] ?? null, '改后的释义');
+
+    $delete = request(fn () => api(TermsApi::class, $token)->deleteApiV3TermsTermWithHttpInfo($term['id']));
+    assert_status(200, $delete, '删术语');
+    assert_status(404, raw('GET', "/v3/terms/{$term['id']}", null, null, $token), '删后再看');
+
+    assert_status(200, request(fn () => api(ChannelsApi::class, $token)->deleteApiV3ChannelsChannelWithHttpInfo($channelId)), '删临时 channel');
+});

+ 35 - 0
api-test/cases/17_glossaries.php

@@ -0,0 +1,35 @@
+<?php
+
+use \WikipaliApi\Api\GlossariesApi;
+
+/*
+ * 术语词汇表:GET /v3/glossaries/{grammar|community}(取代 v2 term-vocabulary)。只读、整表、公开。
+ * 各服务器的数据量不同,只核对形状与回退规则;排序、已删条目、不暴露自增 id 由 api-v13 的 GlossaryV3Test 覆盖。
+ */
+
+test('GET /v3/glossaries/community?lang=zh-Hans → 200,整表带 meta', function () {
+    $res = request(fn () => api(GlossariesApi::class)->getApiV3GlossariesKindWithHttpInfo('community', 'zh-Hans'));
+    assert_status(200, $res, 'community glossary');
+    foreach (['kind', 'lang', 'total'] as $key) {
+        assert_has_key($key, $res['body']['meta'], 'glossary meta');
+    }
+    assert_eq('community', $res['body']['meta']['kind'], 'meta.kind');
+    assert_eq(count($res['body']['data']), $res['body']['meta']['total'], '整表不分页:total 与条数相等');
+    $first = $res['body']['data'][0] ?? null;
+    if ($first) {
+        assert_eq(['id', 'word', 'tag', 'meaning', 'other_meaning'], array_keys($first), '条目字段');
+    }
+});
+
+test('GET /v3/glossaries/grammar?lang=xx(没有这种语言的表)→ 200,回退到 en', function () {
+    $res = raw('GET', '/v3/glossaries/grammar', ['lang' => 'xx']);
+    assert_status(200, $res, 'grammar glossary 回退');
+    assert_eq('en', $res['body']['meta']['lang'] ?? null, '回退语言');
+});
+
+test('GET /v3/glossaries/{非法 kind} → 404;lang 格式不对 → 422', function () {
+    assert_status(404, raw('GET', '/v3/glossaries/other'), '非法 kind');
+    $bad = raw('GET', '/v3/glossaries/community', ['lang' => '../x']);
+    assert_status(422, $bad, 'lang 格式不对');
+    assert_field_error('lang', $bad, 'lang 格式不对');
+});

+ 65 - 0
api-test/cases/18_term_exchange.php

@@ -0,0 +1,65 @@
+<?php
+
+use \WikipaliApi\Api\ChannelsApi;
+use \WikipaliApi\Api\StudiosApi;
+use \WikipaliApi\Model\PostApiV3ChannelsChannelTermsRequest;
+use \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest;
+use GuzzleHttp\Client;
+
+/*
+ * 术语导入 / 导出(xlsx,取代 v2 terms-export / terms-import):
+ * 导出 = 列表接口带 Accept: xlsx;导入 = POST /v3/channels/{c}/terms/imports(multipart,部分成功)。
+ * 用临时 channel(e2e-tmp-exchange-*):建一条术语 → 导出 → 原样导入(全部「未变」)→ 删 channel。
+ * 逐行规则(etag、word 不可改、studio 的 channel_id / language)由 api-v13 的 TermExchangeV3Test 覆盖。
+ */
+
+const TERM_XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
+
+test('POST /v3/channels/{channel}/terms/imports(无 token)→ 401', function () {
+    $res = raw('POST', '/v3/channels/'.fixtures()['channel'].'/terms/imports', null, []);
+    assert_status(401, $res, 'imports 无 token');
+});
+
+test('术语导出 → 原样导入一轮:xlsx 200 → 导入 200(未变 1)→ 坏文件 422', function () {
+    $token = required_token();
+    $me = raw('GET', '/v3/me', null, null, $token);
+    $body = new PostApiV3StudiosStudioChannelsRequest();
+    $body->setName('e2e-tmp-exchange-'.time());
+    $body->setType('translation');
+    $body->setLang('zh-Hans');
+    $channel = request(fn () => api(StudiosApi::class, $token)->postApiV3StudiosStudioChannelsWithHttpInfo($me['body']['data']['id'], $body));
+    assert_status(201, $channel, '建临时 channel');
+    $channelId = $channel['body']['data']['id'];
+
+    $term = new PostApiV3ChannelsChannelTermsRequest();
+    $term->setWord('apiexchange');
+    $term->setMeaning('导入导出测试');
+    $created = request(fn () => api(ChannelsApi::class, $token)->postApiV3ChannelsChannelTermsWithHttpInfo($channelId, $term));
+    assert_status(201, $created, '建术语');
+
+    // 导出:生成客户端只认 JSON,这里直接拿二进制
+    $http = new Client(['timeout' => config()['timeout'], 'http_errors' => false]);
+    $export = $http->get(config()['base_url']."/v3/channels/{$channelId}/terms", [
+        'headers' => ['Accept' => TERM_XLSX, 'Authorization' => "Bearer {$token}"],
+    ]);
+    assert_eq(200, $export->getStatusCode(), '导出状态码');
+    assert_eq(TERM_XLSX, $export->getHeaderLine('Content-Type'), '导出的 Content-Type');
+    $content = (string) $export->getBody();
+    assert_eq('PK', substr($content, 0, 2), '导出的是 xlsx(zip)');
+
+    $path = sys_get_temp_dir().'/api-test-terms-'.time().'.xlsx';
+    file_put_contents($path, $content);
+    $import = request(fn () => api(ChannelsApi::class, $token)->postApiV3ChannelsChannelTermsImportsWithHttpInfo($channelId, new \SplFileObject($path)));
+    assert_status(200, $import, '原样导入');
+    assert_eq(['created' => 0, 'updated' => 0, 'unchanged' => 1], array_intersect_key($import['body']['data'], ['created' => 0, 'updated' => 0, 'unchanged' => 0]), '原样导入全部未变');
+    assert_eq([], $import['body']['data']['errors'], '没有跳过的行');
+
+    file_put_contents($path, 'not a spreadsheet');
+    $bad = request(fn () => api(ChannelsApi::class, $token)->postApiV3ChannelsChannelTermsImportsWithHttpInfo($channelId, new \SplFileObject($path)));
+    assert_status(422, $bad, '坏文件');
+    unlink($path);
+
+    // channel 里有术语不能删:先删术语
+    assert_status(200, raw('DELETE', '/v3/terms/'.$created['body']['data']['id'], null, null, $token), '删术语');
+    assert_status(200, request(fn () => api(ChannelsApi::class, $token)->deleteApiV3ChannelsChannelWithHttpInfo($channelId)), '删临时 channel');
+});

+ 27 - 0
api-test/cases/19_nissaya_cards.php

@@ -0,0 +1,27 @@
+<?php
+
+/*
+ * 缅文词尾卡片:GET /v3/nissaya-cards/{ending}(取代 v2 nissaya-card)。只读、公开。
+ * 各服务器数据不同,只核对形状;关系的格位译名、翻译建议过滤、回退 en、N+1 由 api-v13 的 NissayaCardV3Test 覆盖。
+ */
+
+test('GET /v3/nissaya-cards/{ending} → 200,结构完整', function () {
+    $res = raw('GET', '/v3/nissaya-cards/'.rawurlencode('သည်'), ['lang' => 'zh-Hans']);
+    assert_status(200, $res, 'nissaya card');
+    foreach (['ending', 'lang', 'term', 'relations'] as $key) {
+        assert_has_key($key, $res['body']['data'], 'nissaya card');
+    }
+    $row = $res['body']['data']['relations'][0] ?? null;
+    if ($row) {
+        assert_eq(['relation', 'relation_label', 'from', 'to', 'category', 'local_endings'], array_keys($row), '关系字段');
+    }
+});
+
+test('GET /v3/nissaya-cards/{查不到的词尾} → 200 空卡片;lang 格式不对 → 422', function () {
+    $res = raw('GET', '/v3/nissaya-cards/no-such-ending', ['lang' => 'zh-Hans']);
+    assert_status(200, $res, '空卡片');
+    assert_eq(null, $res['body']['data']['term'], '没有术语');
+    assert_eq([], $res['body']['data']['relations'], '没有关系');
+    $bad = raw('GET', '/v3/nissaya-cards/x', ['lang' => '../x']);
+    assert_status(422, $bad, 'lang 格式不对');
+});

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

@@ -12,9 +12,11 @@ docs/Api/AgentGrantsApi.md
 docs/Api/AgentQuotaApi.md
 docs/Api/AgentThreadsApi.md
 docs/Api/AgentTracesApi.md
+docs/Api/ChannelsApi.md
 docs/Api/CreditPolicyApi.md
 docs/Api/DiscussionsApi.md
 docs/Api/EmailCertificationsApi.md
+docs/Api/GlossariesApi.md
 docs/Api/GroupsApi.md
 docs/Api/HeartbeatApi.md
 docs/Api/InvitesApi.md
@@ -26,9 +28,13 @@ docs/Api/ReadingTimeApi.md
 docs/Api/SearchApi.md
 docs/Api/SearchSuggestApi.md
 docs/Api/SessionsApi.md
+docs/Api/StudiosApi.md
+docs/Api/TermsApi.md
+docs/Api/TipitakaChannelsApi.md
 docs/Api/TipitakaChapterChannelsApi.md
 docs/Api/TipitakaChaptersApi.md
 docs/Api/TipitakaDiscussionsApi.md
+docs/Api/TipitakaParagraphChannelsApi.md
 docs/Api/TipitakaReadingApi.md
 docs/Api/TipitakaRelatedParagraphsApi.md
 docs/Api/UpgradeApi.md
@@ -65,6 +71,19 @@ docs/Model/GetApiV3AgentQuota200Response.md
 docs/Model/GetApiV3AgentQuota200ResponseData.md
 docs/Model/GetApiV3AgentQuota200ResponseDataCost.md
 docs/Model/GetApiV3AgentQuota200ResponseDataEarnedToday.md
+docs/Model/GetApiV3Channels200Response.md
+docs/Model/GetApiV3Channels200ResponseDataInner.md
+docs/Model/GetApiV3Channels200ResponseDataInnerAbilities.md
+docs/Model/GetApiV3Channels200ResponseDataInnerOwner.md
+docs/Model/GetApiV3ChannelsChannel200Response.md
+docs/Model/GetApiV3ChannelsChannelLinks200Response.md
+docs/Model/GetApiV3ChannelsChannelLinks200ResponseData.md
+docs/Model/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom.md
+docs/Model/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner.md
+docs/Model/GetApiV3ChannelsChannelTerms200Response.md
+docs/Model/GetApiV3ChannelsChannelTerms200ResponseDataInner.md
+docs/Model/GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities.md
+docs/Model/GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel.md
 docs/Model/GetApiV3CreditPolicy200Response.md
 docs/Model/GetApiV3CreditPolicy200ResponseData.md
 docs/Model/GetApiV3CreditPolicy200ResponseDataDailyFree.md
@@ -77,6 +96,9 @@ docs/Model/GetApiV3Discussions200ResponseDataInnerSentence.md
 docs/Model/GetApiV3DiscussionsSummary200Response.md
 docs/Model/GetApiV3DiscussionsSummary200ResponseData.md
 docs/Model/GetApiV3DiscussionsSummary200ResponseDataStatusCounts.md
+docs/Model/GetApiV3GlossariesKind200Response.md
+docs/Model/GetApiV3GlossariesKind200ResponseDataInner.md
+docs/Model/GetApiV3GlossariesKind200ResponseMeta.md
 docs/Model/GetApiV3Groups200Response.md
 docs/Model/GetApiV3Groups200ResponseDataInner.md
 docs/Model/GetApiV3GroupsGroupMembers200Response.md
@@ -104,6 +126,8 @@ docs/Model/GetApiV3ReactionsTally200Response.md
 docs/Model/GetApiV3ReactionsTally200ResponseDataInner.md
 docs/Model/GetApiV3Search200Response.md
 docs/Model/GetApiV3SearchSearch200Response.md
+docs/Model/GetApiV3TipitakaChannels200Response.md
+docs/Model/GetApiV3TipitakaChannels200ResponseDataInner.md
 docs/Model/GetApiV3TipitakaChapterChannelsBookPara200Response.md
 docs/Model/GetApiV3TipitakaChapterChannelsBookPara200ResponseDataInner.md
 docs/Model/GetApiV3TipitakaChapterChannelsBookPara200ResponseDataInnerChannel.md
@@ -123,12 +147,19 @@ docs/Model/GetApiV3TipitakaRelatedParagraphsAggregate200Response.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseDataInner.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200Response.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.md
+docs/Model/MarkupElement.md
+docs/Model/MarkupNode.md
+docs/Model/MarkupTemplate.md
+docs/Model/MarkupText.md
 docs/Model/PaginationMeta.md
+docs/Model/PatchApiV3ChannelsChannelLinksRequest.md
+docs/Model/PatchApiV3ChannelsChannelRequest.md
 docs/Model/PatchApiV3DiscussionsDiscussionRequest.md
 docs/Model/PatchApiV3GroupsGroupMembersMemberRequest.md
 docs/Model/PatchApiV3GroupsGroupRequest.md
 docs/Model/PatchApiV3MeAgentThreadsThreadRequest.md
 docs/Model/PatchApiV3PasswordResetsTokenRequest.md
+docs/Model/PatchApiV3TermsTermRequest.md
 docs/Model/PostApiV3AgentCharges200Response.md
 docs/Model/PostApiV3AgentCharges200ResponseData.md
 docs/Model/PostApiV3AgentChargesRequest.md
@@ -144,6 +175,14 @@ docs/Model/PostApiV3AgentGrantsRequest.md
 docs/Model/PostApiV3AgentTraces200Response.md
 docs/Model/PostApiV3AgentTraces200ResponseData.md
 docs/Model/PostApiV3AgentTracesRequest.md
+docs/Model/PostApiV3ChannelsBatchProgress200Response.md
+docs/Model/PostApiV3ChannelsBatchProgress200ResponseDataInner.md
+docs/Model/PostApiV3ChannelsBatchProgressRequest.md
+docs/Model/PostApiV3ChannelsChannelTerms200Response.md
+docs/Model/PostApiV3ChannelsChannelTermsImports200Response.md
+docs/Model/PostApiV3ChannelsChannelTermsImports200ResponseData.md
+docs/Model/PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner.md
+docs/Model/PostApiV3ChannelsChannelTermsRequest.md
 docs/Model/PostApiV3Discussions200Response.md
 docs/Model/PostApiV3DiscussionsBatchCount200Response.md
 docs/Model/PostApiV3DiscussionsBatchCount200ResponseDataInner.md
@@ -169,6 +208,8 @@ docs/Model/PostApiV3SearchRequest.md
 docs/Model/PostApiV3Sessions200Response.md
 docs/Model/PostApiV3Sessions200ResponseData.md
 docs/Model/PostApiV3SessionsRequest.md
+docs/Model/PostApiV3StudiosStudioChannelsRequest.md
+docs/Model/PostApiV3StudiosStudioTermsRequest.md
 docs/Model/PostApiV3Users200Response.md
 docs/Model/PostApiV3Users200ResponseData.md
 docs/Model/PostApiV3UsersRequest.md
@@ -182,9 +223,11 @@ lib/Api/AgentGrantsApi.php
 lib/Api/AgentQuotaApi.php
 lib/Api/AgentThreadsApi.php
 lib/Api/AgentTracesApi.php
+lib/Api/ChannelsApi.php
 lib/Api/CreditPolicyApi.php
 lib/Api/DiscussionsApi.php
 lib/Api/EmailCertificationsApi.php
+lib/Api/GlossariesApi.php
 lib/Api/GroupsApi.php
 lib/Api/HeartbeatApi.php
 lib/Api/InvitesApi.php
@@ -196,9 +239,13 @@ lib/Api/ReadingTimeApi.php
 lib/Api/SearchApi.php
 lib/Api/SearchSuggestApi.php
 lib/Api/SessionsApi.php
+lib/Api/StudiosApi.php
+lib/Api/TermsApi.php
+lib/Api/TipitakaChannelsApi.php
 lib/Api/TipitakaChapterChannelsApi.php
 lib/Api/TipitakaChaptersApi.php
 lib/Api/TipitakaDiscussionsApi.php
+lib/Api/TipitakaParagraphChannelsApi.php
 lib/Api/TipitakaReadingApi.php
 lib/Api/TipitakaRelatedParagraphsApi.php
 lib/Api/UpgradeApi.php
@@ -239,6 +286,19 @@ lib/Model/GetApiV3AgentQuota200Response.php
 lib/Model/GetApiV3AgentQuota200ResponseData.php
 lib/Model/GetApiV3AgentQuota200ResponseDataCost.php
 lib/Model/GetApiV3AgentQuota200ResponseDataEarnedToday.php
+lib/Model/GetApiV3Channels200Response.php
+lib/Model/GetApiV3Channels200ResponseDataInner.php
+lib/Model/GetApiV3Channels200ResponseDataInnerAbilities.php
+lib/Model/GetApiV3Channels200ResponseDataInnerOwner.php
+lib/Model/GetApiV3ChannelsChannel200Response.php
+lib/Model/GetApiV3ChannelsChannelLinks200Response.php
+lib/Model/GetApiV3ChannelsChannelLinks200ResponseData.php
+lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom.php
+lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner.php
+lib/Model/GetApiV3ChannelsChannelTerms200Response.php
+lib/Model/GetApiV3ChannelsChannelTerms200ResponseDataInner.php
+lib/Model/GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities.php
+lib/Model/GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel.php
 lib/Model/GetApiV3CreditPolicy200Response.php
 lib/Model/GetApiV3CreditPolicy200ResponseData.php
 lib/Model/GetApiV3CreditPolicy200ResponseDataDailyFree.php
@@ -251,6 +311,9 @@ lib/Model/GetApiV3Discussions200ResponseDataInnerSentence.php
 lib/Model/GetApiV3DiscussionsSummary200Response.php
 lib/Model/GetApiV3DiscussionsSummary200ResponseData.php
 lib/Model/GetApiV3DiscussionsSummary200ResponseDataStatusCounts.php
+lib/Model/GetApiV3GlossariesKind200Response.php
+lib/Model/GetApiV3GlossariesKind200ResponseDataInner.php
+lib/Model/GetApiV3GlossariesKind200ResponseMeta.php
 lib/Model/GetApiV3Groups200Response.php
 lib/Model/GetApiV3Groups200ResponseDataInner.php
 lib/Model/GetApiV3GroupsGroupMembers200Response.php
@@ -278,6 +341,8 @@ lib/Model/GetApiV3ReactionsTally200Response.php
 lib/Model/GetApiV3ReactionsTally200ResponseDataInner.php
 lib/Model/GetApiV3Search200Response.php
 lib/Model/GetApiV3SearchSearch200Response.php
+lib/Model/GetApiV3TipitakaChannels200Response.php
+lib/Model/GetApiV3TipitakaChannels200ResponseDataInner.php
 lib/Model/GetApiV3TipitakaChapterChannelsBookPara200Response.php
 lib/Model/GetApiV3TipitakaChapterChannelsBookPara200ResponseDataInner.php
 lib/Model/GetApiV3TipitakaChapterChannelsBookPara200ResponseDataInnerChannel.php
@@ -297,13 +362,20 @@ lib/Model/GetApiV3TipitakaRelatedParagraphsAggregate200Response.php
 lib/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseDataInner.php
 lib/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200Response.php
 lib/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.php
+lib/Model/MarkupElement.php
+lib/Model/MarkupNode.php
+lib/Model/MarkupTemplate.php
+lib/Model/MarkupText.php
 lib/Model/ModelInterface.php
 lib/Model/PaginationMeta.php
+lib/Model/PatchApiV3ChannelsChannelLinksRequest.php
+lib/Model/PatchApiV3ChannelsChannelRequest.php
 lib/Model/PatchApiV3DiscussionsDiscussionRequest.php
 lib/Model/PatchApiV3GroupsGroupMembersMemberRequest.php
 lib/Model/PatchApiV3GroupsGroupRequest.php
 lib/Model/PatchApiV3MeAgentThreadsThreadRequest.php
 lib/Model/PatchApiV3PasswordResetsTokenRequest.php
+lib/Model/PatchApiV3TermsTermRequest.php
 lib/Model/PostApiV3AgentCharges200Response.php
 lib/Model/PostApiV3AgentCharges200ResponseData.php
 lib/Model/PostApiV3AgentChargesRequest.php
@@ -319,6 +391,14 @@ lib/Model/PostApiV3AgentGrantsRequest.php
 lib/Model/PostApiV3AgentTraces200Response.php
 lib/Model/PostApiV3AgentTraces200ResponseData.php
 lib/Model/PostApiV3AgentTracesRequest.php
+lib/Model/PostApiV3ChannelsBatchProgress200Response.php
+lib/Model/PostApiV3ChannelsBatchProgress200ResponseDataInner.php
+lib/Model/PostApiV3ChannelsBatchProgressRequest.php
+lib/Model/PostApiV3ChannelsChannelTerms200Response.php
+lib/Model/PostApiV3ChannelsChannelTermsImports200Response.php
+lib/Model/PostApiV3ChannelsChannelTermsImports200ResponseData.php
+lib/Model/PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner.php
+lib/Model/PostApiV3ChannelsChannelTermsRequest.php
 lib/Model/PostApiV3Discussions200Response.php
 lib/Model/PostApiV3DiscussionsBatchCount200Response.php
 lib/Model/PostApiV3DiscussionsBatchCount200ResponseDataInner.php
@@ -344,6 +424,8 @@ lib/Model/PostApiV3SearchRequest.php
 lib/Model/PostApiV3Sessions200Response.php
 lib/Model/PostApiV3Sessions200ResponseData.php
 lib/Model/PostApiV3SessionsRequest.php
+lib/Model/PostApiV3StudiosStudioChannelsRequest.php
+lib/Model/PostApiV3StudiosStudioTermsRequest.php
 lib/Model/PostApiV3Users200Response.php
 lib/Model/PostApiV3Users200ResponseData.php
 lib/Model/PostApiV3UsersRequest.php
@@ -358,9 +440,11 @@ test/Api/AgentGrantsApiTest.php
 test/Api/AgentQuotaApiTest.php
 test/Api/AgentThreadsApiTest.php
 test/Api/AgentTracesApiTest.php
+test/Api/ChannelsApiTest.php
 test/Api/CreditPolicyApiTest.php
 test/Api/DiscussionsApiTest.php
 test/Api/EmailCertificationsApiTest.php
+test/Api/GlossariesApiTest.php
 test/Api/GroupsApiTest.php
 test/Api/HeartbeatApiTest.php
 test/Api/InvitesApiTest.php
@@ -372,9 +456,13 @@ test/Api/ReadingTimeApiTest.php
 test/Api/SearchApiTest.php
 test/Api/SearchSuggestApiTest.php
 test/Api/SessionsApiTest.php
+test/Api/StudiosApiTest.php
+test/Api/TermsApiTest.php
+test/Api/TipitakaChannelsApiTest.php
 test/Api/TipitakaChapterChannelsApiTest.php
 test/Api/TipitakaChaptersApiTest.php
 test/Api/TipitakaDiscussionsApiTest.php
+test/Api/TipitakaParagraphChannelsApiTest.php
 test/Api/TipitakaReadingApiTest.php
 test/Api/TipitakaRelatedParagraphsApiTest.php
 test/Api/UpgradeApiTest.php
@@ -411,6 +499,19 @@ test/Model/GetApiV3AgentQuota200ResponseDataCostTest.php
 test/Model/GetApiV3AgentQuota200ResponseDataEarnedTodayTest.php
 test/Model/GetApiV3AgentQuota200ResponseDataTest.php
 test/Model/GetApiV3AgentQuota200ResponseTest.php
+test/Model/GetApiV3Channels200ResponseDataInnerAbilitiesTest.php
+test/Model/GetApiV3Channels200ResponseDataInnerOwnerTest.php
+test/Model/GetApiV3Channels200ResponseDataInnerTest.php
+test/Model/GetApiV3Channels200ResponseTest.php
+test/Model/GetApiV3ChannelsChannel200ResponseTest.php
+test/Model/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFromTest.php
+test/Model/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInnerTest.php
+test/Model/GetApiV3ChannelsChannelLinks200ResponseDataTest.php
+test/Model/GetApiV3ChannelsChannelLinks200ResponseTest.php
+test/Model/GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilitiesTest.php
+test/Model/GetApiV3ChannelsChannelTerms200ResponseDataInnerChannelTest.php
+test/Model/GetApiV3ChannelsChannelTerms200ResponseDataInnerTest.php
+test/Model/GetApiV3ChannelsChannelTerms200ResponseTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataDailyFreeTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataEarnReadingTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataEarnTest.php
@@ -423,6 +524,9 @@ test/Model/GetApiV3Discussions200ResponseTest.php
 test/Model/GetApiV3DiscussionsSummary200ResponseDataStatusCountsTest.php
 test/Model/GetApiV3DiscussionsSummary200ResponseDataTest.php
 test/Model/GetApiV3DiscussionsSummary200ResponseTest.php
+test/Model/GetApiV3GlossariesKind200ResponseDataInnerTest.php
+test/Model/GetApiV3GlossariesKind200ResponseMetaTest.php
+test/Model/GetApiV3GlossariesKind200ResponseTest.php
 test/Model/GetApiV3Groups200ResponseDataInnerTest.php
 test/Model/GetApiV3Groups200ResponseTest.php
 test/Model/GetApiV3GroupsGroupMembers200ResponseDataInnerTest.php
@@ -450,6 +554,8 @@ test/Model/GetApiV3ReactionsTally200ResponseDataInnerTest.php
 test/Model/GetApiV3ReactionsTally200ResponseTest.php
 test/Model/GetApiV3Search200ResponseTest.php
 test/Model/GetApiV3SearchSearch200ResponseTest.php
+test/Model/GetApiV3TipitakaChannels200ResponseDataInnerTest.php
+test/Model/GetApiV3TipitakaChannels200ResponseTest.php
 test/Model/GetApiV3TipitakaChapterChannelsBookPara200ResponseDataInnerChannelTest.php
 test/Model/GetApiV3TipitakaChapterChannelsBookPara200ResponseDataInnerStudioTest.php
 test/Model/GetApiV3TipitakaChapterChannelsBookPara200ResponseDataInnerTest.php
@@ -469,12 +575,19 @@ test/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseDataInnerTest.ph
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInnerTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseTest.php
+test/Model/MarkupElementTest.php
+test/Model/MarkupNodeTest.php
+test/Model/MarkupTemplateTest.php
+test/Model/MarkupTextTest.php
 test/Model/PaginationMetaTest.php
+test/Model/PatchApiV3ChannelsChannelLinksRequestTest.php
+test/Model/PatchApiV3ChannelsChannelRequestTest.php
 test/Model/PatchApiV3DiscussionsDiscussionRequestTest.php
 test/Model/PatchApiV3GroupsGroupMembersMemberRequestTest.php
 test/Model/PatchApiV3GroupsGroupRequestTest.php
 test/Model/PatchApiV3MeAgentThreadsThreadRequestTest.php
 test/Model/PatchApiV3PasswordResetsTokenRequestTest.php
+test/Model/PatchApiV3TermsTermRequestTest.php
 test/Model/PostApiV3AgentCharges200ResponseDataTest.php
 test/Model/PostApiV3AgentCharges200ResponseTest.php
 test/Model/PostApiV3AgentChargesRequestTest.php
@@ -490,6 +603,14 @@ test/Model/PostApiV3AgentGrantsRequestTest.php
 test/Model/PostApiV3AgentTraces200ResponseDataTest.php
 test/Model/PostApiV3AgentTraces200ResponseTest.php
 test/Model/PostApiV3AgentTracesRequestTest.php
+test/Model/PostApiV3ChannelsBatchProgress200ResponseDataInnerTest.php
+test/Model/PostApiV3ChannelsBatchProgress200ResponseTest.php
+test/Model/PostApiV3ChannelsBatchProgressRequestTest.php
+test/Model/PostApiV3ChannelsChannelTerms200ResponseTest.php
+test/Model/PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInnerTest.php
+test/Model/PostApiV3ChannelsChannelTermsImports200ResponseDataTest.php
+test/Model/PostApiV3ChannelsChannelTermsImports200ResponseTest.php
+test/Model/PostApiV3ChannelsChannelTermsRequestTest.php
 test/Model/PostApiV3Discussions200ResponseTest.php
 test/Model/PostApiV3DiscussionsBatchCount200ResponseDataInnerTest.php
 test/Model/PostApiV3DiscussionsBatchCount200ResponseTest.php
@@ -515,6 +636,8 @@ test/Model/PostApiV3SearchRequestTest.php
 test/Model/PostApiV3Sessions200ResponseDataTest.php
 test/Model/PostApiV3Sessions200ResponseTest.php
 test/Model/PostApiV3SessionsRequestTest.php
+test/Model/PostApiV3StudiosStudioChannelsRequestTest.php
+test/Model/PostApiV3StudiosStudioTermsRequestTest.php
 test/Model/PostApiV3Users200ResponseDataTest.php
 test/Model/PostApiV3Users200ResponseTest.php
 test/Model/PostApiV3UsersRequestTest.php

+ 4101 - 0
api-test/client/lib/Api/ChannelsApi.php

@@ -0,0 +1,4101 @@
+<?php
+/**
+ * ChannelsApi
+ * 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;
+
+/**
+ * ChannelsApi Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+class ChannelsApi
+{
+    /**
+     * @var ClientInterface
+     */
+    protected $client;
+
+    /**
+     * @var Configuration
+     */
+    protected $config;
+
+    /**
+     * @var HeaderSelector
+     */
+    protected $headerSelector;
+
+    /**
+     * @var int Host index
+     */
+    protected $hostIndex;
+
+    /** @var string[] $contentTypes **/
+    public const contentTypes = [
+        'deleteApiV3ChannelsChannel' => [
+            'application/json',
+        ],
+        'getApiV3Channels' => [
+            'application/json',
+        ],
+        'getApiV3ChannelsChannel' => [
+            'application/json',
+        ],
+        'getApiV3ChannelsChannelLinks' => [
+            'application/json',
+        ],
+        'getApiV3ChannelsChannelTerms' => [
+            'application/json',
+        ],
+        'getApiV3ChannelsEditable' => [
+            'application/json',
+        ],
+        'patchApiV3ChannelsChannel' => [
+            'application/json',
+        ],
+        'patchApiV3ChannelsChannelLinks' => [
+            'application/json',
+        ],
+        'postApiV3ChannelsBatchProgress' => [
+            'application/json',
+        ],
+        'postApiV3ChannelsChannelTerms' => [
+            'application/json',
+        ],
+        'postApiV3ChannelsChannelTermsImports' => [
+            'multipart/form-data',
+        ],
+    ];
+
+    /**
+     * @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 deleteApiV3ChannelsChannel
+     *
+     * 删除 channel
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3ChannelsChannel'] 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\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function deleteApiV3ChannelsChannel($channel, string $contentType = self::contentTypes['deleteApiV3ChannelsChannel'][0])
+    {
+        list($response) = $this->deleteApiV3ChannelsChannelWithHttpInfo($channel, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation deleteApiV3ChannelsChannelWithHttpInfo
+     *
+     * 删除 channel
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3ChannelsChannel'] 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\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function deleteApiV3ChannelsChannelWithHttpInfo($channel, string $contentType = self::contentTypes['deleteApiV3ChannelsChannel'][0])
+    {
+        $request = $this->deleteApiV3ChannelsChannelRequest($channel, $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\GetApiV3ChannelsChannel200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 409:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3ChannelsChannel200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 409:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 deleteApiV3ChannelsChannelAsync
+     *
+     * 删除 channel
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3ChannelsChannel'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function deleteApiV3ChannelsChannelAsync($channel, string $contentType = self::contentTypes['deleteApiV3ChannelsChannel'][0])
+    {
+        return $this->deleteApiV3ChannelsChannelAsyncWithHttpInfo($channel, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation deleteApiV3ChannelsChannelAsyncWithHttpInfo
+     *
+     * 删除 channel
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3ChannelsChannel'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function deleteApiV3ChannelsChannelAsyncWithHttpInfo($channel, string $contentType = self::contentTypes['deleteApiV3ChannelsChannel'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response';
+        $request = $this->deleteApiV3ChannelsChannelRequest($channel, $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 'deleteApiV3ChannelsChannel'
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3ChannelsChannel'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function deleteApiV3ChannelsChannelRequest($channel, string $contentType = self::contentTypes['deleteApiV3ChannelsChannel'][0])
+    {
+
+        // verify the required parameter 'channel' is set
+        if ($channel === null || (is_array($channel) && count($channel) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $channel when calling deleteApiV3ChannelsChannel'
+            );
+        }
+
+
+        $resourcePath = '/v3/channels/{channel}';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($channel !== null) {
+            $resourcePath = str_replace(
+                '{channel}',
+                ObjectSerializer::toPathValue($channel),
+                $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(
+            'DELETE',
+            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
+    /**
+     * Operation getApiV3Channels
+     *
+     * 公开 channel 目录
+     *
+     * @param  bool|null $system 只列系统 channel (optional)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Channels'] 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\GetApiV3Channels200Response|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3Channels($system = null, $per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3Channels'][0])
+    {
+        list($response) = $this->getApiV3ChannelsWithHttpInfo($system, $per_page, $search, $type, $lang, $book, $para, $order, $dir, $page, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3ChannelsWithHttpInfo
+     *
+     * 公开 channel 目录
+     *
+     * @param  bool|null $system 只列系统 channel (optional)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Channels'] 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\GetApiV3Channels200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3ChannelsWithHttpInfo($system = null, $per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3Channels'][0])
+    {
+        $request = $this->getApiV3ChannelsRequest($system, $per_page, $search, $type, $lang, $book, $para, $order, $dir, $page, $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\GetApiV3Channels200Response',
+                        $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\GetApiV3Channels200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3Channels200Response',
+                        $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 getApiV3ChannelsAsync
+     *
+     * 公开 channel 目录
+     *
+     * @param  bool|null $system 只列系统 channel (optional)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Channels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsAsync($system = null, $per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3Channels'][0])
+    {
+        return $this->getApiV3ChannelsAsyncWithHttpInfo($system, $per_page, $search, $type, $lang, $book, $para, $order, $dir, $page, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3ChannelsAsyncWithHttpInfo
+     *
+     * 公开 channel 目录
+     *
+     * @param  bool|null $system 只列系统 channel (optional)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Channels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsAsyncWithHttpInfo($system = null, $per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3Channels'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3Channels200Response';
+        $request = $this->getApiV3ChannelsRequest($system, $per_page, $search, $type, $lang, $book, $para, $order, $dir, $page, $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 'getApiV3Channels'
+     *
+     * @param  bool|null $system 只列系统 channel (optional)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3Channels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3ChannelsRequest($system = null, $per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3Channels'][0])
+    {
+
+
+
+
+
+
+
+
+
+
+
+
+        $resourcePath = '/v3/channels';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $system,
+            'system', // param base name
+            'boolean', // 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
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $search,
+            'search', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $type,
+            'type', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $lang,
+            'lang', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $book,
+            'book', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $para,
+            'para', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $order,
+            'order', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $dir,
+            'dir', // param base name
+            'string', // 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
+        ) ?? []);
+
+
+
+
+        $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
+        );
+    }
+
+    /**
+     * Operation getApiV3ChannelsChannel
+     *
+     * channel 详情
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannel'] 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\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3ChannelsChannel($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannel'][0])
+    {
+        list($response) = $this->getApiV3ChannelsChannelWithHttpInfo($channel, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3ChannelsChannelWithHttpInfo
+     *
+     * channel 详情
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannel'] 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\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3ChannelsChannelWithHttpInfo($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannel'][0])
+    {
+        $request = $this->getApiV3ChannelsChannelRequest($channel, $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\GetApiV3ChannelsChannel200Response',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3ChannelsChannel200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 getApiV3ChannelsChannelAsync
+     *
+     * channel 详情
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannel'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsChannelAsync($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannel'][0])
+    {
+        return $this->getApiV3ChannelsChannelAsyncWithHttpInfo($channel, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3ChannelsChannelAsyncWithHttpInfo
+     *
+     * channel 详情
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannel'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsChannelAsyncWithHttpInfo($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannel'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response';
+        $request = $this->getApiV3ChannelsChannelRequest($channel, $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 'getApiV3ChannelsChannel'
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannel'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3ChannelsChannelRequest($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannel'][0])
+    {
+
+        // verify the required parameter 'channel' is set
+        if ($channel === null || (is_array($channel) && count($channel) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $channel when calling getApiV3ChannelsChannel'
+            );
+        }
+
+
+        $resourcePath = '/v3/channels/{channel}';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($channel !== null) {
+            $resourcePath = str_replace(
+                '{channel}',
+                ObjectSerializer::toPathValue($channel),
+                $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
+        );
+    }
+
+    /**
+     * Operation getApiV3ChannelsChannelLinks
+     *
+     * channel 的关系设置
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelLinks'] 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\GetApiV3ChannelsChannelLinks200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3ChannelsChannelLinks($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannelLinks'][0])
+    {
+        list($response) = $this->getApiV3ChannelsChannelLinksWithHttpInfo($channel, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3ChannelsChannelLinksWithHttpInfo
+     *
+     * channel 的关系设置
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelLinks'] 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\GetApiV3ChannelsChannelLinks200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3ChannelsChannelLinksWithHttpInfo($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannelLinks'][0])
+    {
+        $request = $this->getApiV3ChannelsChannelLinksRequest($channel, $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\GetApiV3ChannelsChannelLinks200Response',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3ChannelsChannelLinks200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 getApiV3ChannelsChannelLinksAsync
+     *
+     * channel 的关系设置
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelLinks'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsChannelLinksAsync($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannelLinks'][0])
+    {
+        return $this->getApiV3ChannelsChannelLinksAsyncWithHttpInfo($channel, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3ChannelsChannelLinksAsyncWithHttpInfo
+     *
+     * channel 的关系设置
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelLinks'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsChannelLinksAsyncWithHttpInfo($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannelLinks'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200Response';
+        $request = $this->getApiV3ChannelsChannelLinksRequest($channel, $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 'getApiV3ChannelsChannelLinks'
+     *
+     * @param  string $channel channel uid (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelLinks'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3ChannelsChannelLinksRequest($channel, string $contentType = self::contentTypes['getApiV3ChannelsChannelLinks'][0])
+    {
+
+        // verify the required parameter 'channel' is set
+        if ($channel === null || (is_array($channel) && count($channel) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $channel when calling getApiV3ChannelsChannelLinks'
+            );
+        }
+
+
+        $resourcePath = '/v3/channels/{channel}/links';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($channel !== null) {
+            $resourcePath = str_replace(
+                '{channel}',
+                ObjectSerializer::toPathValue($channel),
+                $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
+        );
+    }
+
+    /**
+     * Operation getApiV3ChannelsChannelTerms
+     *
+     * channel 的术语列表
+     *
+     * @param  string $channel channel uid (required)
+     * @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  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional)
+     * @param  int|null $page 页码 (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelTerms'] 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\GetApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3ChannelsChannelTerms($channel, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3ChannelsChannelTerms'][0])
+    {
+        list($response) = $this->getApiV3ChannelsChannelTermsWithHttpInfo($channel, $per_page, $search, $quality, $category, $order, $dir, $page, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3ChannelsChannelTermsWithHttpInfo
+     *
+     * channel 的术语列表
+     *
+     * @param  string $channel channel uid (required)
+     * @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  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional)
+     * @param  int|null $page 页码 (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelTerms'] 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\GetApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3ChannelsChannelTermsWithHttpInfo($channel, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3ChannelsChannelTerms'][0])
+    {
+        $request = $this->getApiV3ChannelsChannelTermsRequest($channel, $per_page, $search, $quality, $category, $order, $dir, $page, $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\GetApiV3ChannelsChannelTerms200Response',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3ChannelsChannelTerms200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 getApiV3ChannelsChannelTermsAsync
+     *
+     * channel 的术语列表
+     *
+     * @param  string $channel channel uid (required)
+     * @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  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional)
+     * @param  int|null $page 页码 (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelTerms'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsChannelTermsAsync($channel, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3ChannelsChannelTerms'][0])
+    {
+        return $this->getApiV3ChannelsChannelTermsAsyncWithHttpInfo($channel, $per_page, $search, $quality, $category, $order, $dir, $page, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3ChannelsChannelTermsAsyncWithHttpInfo
+     *
+     * channel 的术语列表
+     *
+     * @param  string $channel channel uid (required)
+     * @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  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional)
+     * @param  int|null $page 页码 (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelTerms'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsChannelTermsAsyncWithHttpInfo($channel, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3ChannelsChannelTerms'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response';
+        $request = $this->getApiV3ChannelsChannelTermsRequest($channel, $per_page, $search, $quality, $category, $order, $dir, $page, $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 'getApiV3ChannelsChannelTerms'
+     *
+     * @param  string $channel channel uid (required)
+     * @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  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional)
+     * @param  int|null $page 页码 (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsChannelTerms'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3ChannelsChannelTermsRequest($channel, $per_page = 20, $search = null, $quality = null, $category = null, $order = 'updated_at', $dir = null, $page = null, string $contentType = self::contentTypes['getApiV3ChannelsChannelTerms'][0])
+    {
+
+        // verify the required parameter 'channel' is set
+        if ($channel === null || (is_array($channel) && count($channel) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $channel when calling getApiV3ChannelsChannelTerms'
+            );
+        }
+
+
+
+
+
+
+
+
+
+        $resourcePath = '/v3/channels/{channel}/terms';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $per_page,
+            'per_page', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $search,
+            'search', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $quality,
+            'quality', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $category,
+            'category', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $order,
+            'order', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $dir,
+            'dir', // param base name
+            'string', // 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
+        ) ?? []);
+
+
+        // path params
+        if ($channel !== null) {
+            $resourcePath = str_replace(
+                '{channel}',
+                ObjectSerializer::toPathValue($channel),
+                $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
+        );
+    }
+
+    /**
+     * Operation getApiV3ChannelsEditable
+     *
+     * 列出我能写的 channel
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsEditable'] 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\GetApiV3Channels200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3ChannelsEditable($per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3ChannelsEditable'][0])
+    {
+        list($response) = $this->getApiV3ChannelsEditableWithHttpInfo($per_page, $search, $type, $lang, $book, $para, $order, $dir, $page, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3ChannelsEditableWithHttpInfo
+     *
+     * 列出我能写的 channel
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsEditable'] 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\GetApiV3Channels200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3ChannelsEditableWithHttpInfo($per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3ChannelsEditable'][0])
+    {
+        $request = $this->getApiV3ChannelsEditableRequest($per_page, $search, $type, $lang, $book, $para, $order, $dir, $page, $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\GetApiV3Channels200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3Channels200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3Channels200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 getApiV3ChannelsEditableAsync
+     *
+     * 列出我能写的 channel
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsEditable'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsEditableAsync($per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3ChannelsEditable'][0])
+    {
+        return $this->getApiV3ChannelsEditableAsyncWithHttpInfo($per_page, $search, $type, $lang, $book, $para, $order, $dir, $page, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3ChannelsEditableAsyncWithHttpInfo
+     *
+     * 列出我能写的 channel
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsEditable'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3ChannelsEditableAsyncWithHttpInfo($per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3ChannelsEditable'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3Channels200Response';
+        $request = $this->getApiV3ChannelsEditableRequest($per_page, $search, $type, $lang, $book, $para, $order, $dir, $page, $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 'getApiV3ChannelsEditable'
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3ChannelsEditable'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3ChannelsEditableRequest($per_page = 20, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3ChannelsEditable'][0])
+    {
+
+
+
+
+
+
+
+
+
+
+
+        $resourcePath = '/v3/channels/editable';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $per_page,
+            'per_page', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $search,
+            'search', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $type,
+            'type', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $lang,
+            'lang', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $book,
+            'book', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $para,
+            'para', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $order,
+            'order', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $dir,
+            'dir', // param base name
+            'string', // 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
+        ) ?? []);
+
+
+
+
+        $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
+        );
+    }
+
+    /**
+     * Operation patchApiV3ChannelsChannel
+     *
+     * 改 channel 信息
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelRequest|null $patch_api_v3_channels_channel_request patch_api_v3_channels_channel_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannel'] 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\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function patchApiV3ChannelsChannel($channel, $patch_api_v3_channels_channel_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannel'][0])
+    {
+        list($response) = $this->patchApiV3ChannelsChannelWithHttpInfo($channel, $patch_api_v3_channels_channel_request, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation patchApiV3ChannelsChannelWithHttpInfo
+     *
+     * 改 channel 信息
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelRequest|null $patch_api_v3_channels_channel_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannel'] 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\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function patchApiV3ChannelsChannelWithHttpInfo($channel, $patch_api_v3_channels_channel_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannel'][0])
+    {
+        $request = $this->patchApiV3ChannelsChannelRequest($channel, $patch_api_v3_channels_channel_request, $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\GetApiV3ChannelsChannel200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3ChannelsChannel200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 patchApiV3ChannelsChannelAsync
+     *
+     * 改 channel 信息
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelRequest|null $patch_api_v3_channels_channel_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannel'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function patchApiV3ChannelsChannelAsync($channel, $patch_api_v3_channels_channel_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannel'][0])
+    {
+        return $this->patchApiV3ChannelsChannelAsyncWithHttpInfo($channel, $patch_api_v3_channels_channel_request, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation patchApiV3ChannelsChannelAsyncWithHttpInfo
+     *
+     * 改 channel 信息
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelRequest|null $patch_api_v3_channels_channel_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannel'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function patchApiV3ChannelsChannelAsyncWithHttpInfo($channel, $patch_api_v3_channels_channel_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannel'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response';
+        $request = $this->patchApiV3ChannelsChannelRequest($channel, $patch_api_v3_channels_channel_request, $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 'patchApiV3ChannelsChannel'
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelRequest|null $patch_api_v3_channels_channel_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannel'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function patchApiV3ChannelsChannelRequest($channel, $patch_api_v3_channels_channel_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannel'][0])
+    {
+
+        // verify the required parameter 'channel' is set
+        if ($channel === null || (is_array($channel) && count($channel) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $channel when calling patchApiV3ChannelsChannel'
+            );
+        }
+
+
+
+        $resourcePath = '/v3/channels/{channel}';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($channel !== null) {
+            $resourcePath = str_replace(
+                '{channel}',
+                ObjectSerializer::toPathValue($channel),
+                $resourcePath
+            );
+        }
+
+
+        $headers = $this->headerSelector->selectHeaders(
+            ['application/json', 'application/problem+json', ],
+            $contentType,
+            $multipart
+        );
+
+        // for model (json/xml)
+        if (isset($patch_api_v3_channels_channel_request)) {
+            if (stripos($headers['Content-Type'], 'application/json') !== false) {
+                # if Content-Type contains "application/json", json_encode the body
+                try {
+                    $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($patch_api_v3_channels_channel_request), JSON_THROW_ON_ERROR);
+                } catch (\JsonException $e) {
+                    throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
+                }
+            } else {
+                $httpBody = $patch_api_v3_channels_channel_request;
+            }
+        } elseif (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(
+            'PATCH',
+            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
+    /**
+     * Operation patchApiV3ChannelsChannelLinks
+     *
+     * 改 channel 的关系设置
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelLinksRequest|null $patch_api_v3_channels_channel_links_request patch_api_v3_channels_channel_links_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannelLinks'] 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\GetApiV3ChannelsChannelLinks200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function patchApiV3ChannelsChannelLinks($channel, $patch_api_v3_channels_channel_links_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannelLinks'][0])
+    {
+        list($response) = $this->patchApiV3ChannelsChannelLinksWithHttpInfo($channel, $patch_api_v3_channels_channel_links_request, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation patchApiV3ChannelsChannelLinksWithHttpInfo
+     *
+     * 改 channel 的关系设置
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelLinksRequest|null $patch_api_v3_channels_channel_links_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannelLinks'] 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\GetApiV3ChannelsChannelLinks200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function patchApiV3ChannelsChannelLinksWithHttpInfo($channel, $patch_api_v3_channels_channel_links_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannelLinks'][0])
+    {
+        $request = $this->patchApiV3ChannelsChannelLinksRequest($channel, $patch_api_v3_channels_channel_links_request, $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\GetApiV3ChannelsChannelLinks200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3ChannelsChannelLinks200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 patchApiV3ChannelsChannelLinksAsync
+     *
+     * 改 channel 的关系设置
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelLinksRequest|null $patch_api_v3_channels_channel_links_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannelLinks'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function patchApiV3ChannelsChannelLinksAsync($channel, $patch_api_v3_channels_channel_links_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannelLinks'][0])
+    {
+        return $this->patchApiV3ChannelsChannelLinksAsyncWithHttpInfo($channel, $patch_api_v3_channels_channel_links_request, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation patchApiV3ChannelsChannelLinksAsyncWithHttpInfo
+     *
+     * 改 channel 的关系设置
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelLinksRequest|null $patch_api_v3_channels_channel_links_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannelLinks'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function patchApiV3ChannelsChannelLinksAsyncWithHttpInfo($channel, $patch_api_v3_channels_channel_links_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannelLinks'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200Response';
+        $request = $this->patchApiV3ChannelsChannelLinksRequest($channel, $patch_api_v3_channels_channel_links_request, $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 'patchApiV3ChannelsChannelLinks'
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PatchApiV3ChannelsChannelLinksRequest|null $patch_api_v3_channels_channel_links_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3ChannelsChannelLinks'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function patchApiV3ChannelsChannelLinksRequest($channel, $patch_api_v3_channels_channel_links_request = null, string $contentType = self::contentTypes['patchApiV3ChannelsChannelLinks'][0])
+    {
+
+        // verify the required parameter 'channel' is set
+        if ($channel === null || (is_array($channel) && count($channel) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $channel when calling patchApiV3ChannelsChannelLinks'
+            );
+        }
+
+
+
+        $resourcePath = '/v3/channels/{channel}/links';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($channel !== null) {
+            $resourcePath = str_replace(
+                '{channel}',
+                ObjectSerializer::toPathValue($channel),
+                $resourcePath
+            );
+        }
+
+
+        $headers = $this->headerSelector->selectHeaders(
+            ['application/json', 'application/problem+json', ],
+            $contentType,
+            $multipart
+        );
+
+        // for model (json/xml)
+        if (isset($patch_api_v3_channels_channel_links_request)) {
+            if (stripos($headers['Content-Type'], 'application/json') !== false) {
+                # if Content-Type contains "application/json", json_encode the body
+                try {
+                    $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($patch_api_v3_channels_channel_links_request), JSON_THROW_ON_ERROR);
+                } catch (\JsonException $e) {
+                    throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
+                }
+            } else {
+                $httpBody = $patch_api_v3_channels_channel_links_request;
+            }
+        } elseif (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(
+            'PATCH',
+            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
+    /**
+     * Operation postApiV3ChannelsBatchProgress
+     *
+     * 查一批句子在各 channel 的完成度
+     *
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsBatchProgressRequest $post_api_v3_channels_batch_progress_request post_api_v3_channels_batch_progress_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsBatchProgress'] 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\PostApiV3ChannelsBatchProgress200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function postApiV3ChannelsBatchProgress($post_api_v3_channels_batch_progress_request, string $contentType = self::contentTypes['postApiV3ChannelsBatchProgress'][0])
+    {
+        list($response) = $this->postApiV3ChannelsBatchProgressWithHttpInfo($post_api_v3_channels_batch_progress_request, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation postApiV3ChannelsBatchProgressWithHttpInfo
+     *
+     * 查一批句子在各 channel 的完成度
+     *
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsBatchProgressRequest $post_api_v3_channels_batch_progress_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsBatchProgress'] 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\PostApiV3ChannelsBatchProgress200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function postApiV3ChannelsBatchProgressWithHttpInfo($post_api_v3_channels_batch_progress_request, string $contentType = self::contentTypes['postApiV3ChannelsBatchProgress'][0])
+    {
+        $request = $this->postApiV3ChannelsBatchProgressRequest($post_api_v3_channels_batch_progress_request, $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\PostApiV3ChannelsBatchProgress200Response',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\PostApiV3ChannelsBatchProgress200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsBatchProgress200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 postApiV3ChannelsBatchProgressAsync
+     *
+     * 查一批句子在各 channel 的完成度
+     *
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsBatchProgressRequest $post_api_v3_channels_batch_progress_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsBatchProgress'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3ChannelsBatchProgressAsync($post_api_v3_channels_batch_progress_request, string $contentType = self::contentTypes['postApiV3ChannelsBatchProgress'][0])
+    {
+        return $this->postApiV3ChannelsBatchProgressAsyncWithHttpInfo($post_api_v3_channels_batch_progress_request, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation postApiV3ChannelsBatchProgressAsyncWithHttpInfo
+     *
+     * 查一批句子在各 channel 的完成度
+     *
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsBatchProgressRequest $post_api_v3_channels_batch_progress_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsBatchProgress'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3ChannelsBatchProgressAsyncWithHttpInfo($post_api_v3_channels_batch_progress_request, string $contentType = self::contentTypes['postApiV3ChannelsBatchProgress'][0])
+    {
+        $returnType = '\WikipaliApi\Model\PostApiV3ChannelsBatchProgress200Response';
+        $request = $this->postApiV3ChannelsBatchProgressRequest($post_api_v3_channels_batch_progress_request, $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 'postApiV3ChannelsBatchProgress'
+     *
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsBatchProgressRequest $post_api_v3_channels_batch_progress_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsBatchProgress'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function postApiV3ChannelsBatchProgressRequest($post_api_v3_channels_batch_progress_request, string $contentType = self::contentTypes['postApiV3ChannelsBatchProgress'][0])
+    {
+
+        // verify the required parameter 'post_api_v3_channels_batch_progress_request' is set
+        if ($post_api_v3_channels_batch_progress_request === null || (is_array($post_api_v3_channels_batch_progress_request) && count($post_api_v3_channels_batch_progress_request) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $post_api_v3_channels_batch_progress_request when calling postApiV3ChannelsBatchProgress'
+            );
+        }
+
+
+        $resourcePath = '/v3/channels/batch-progress';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+
+
+        $headers = $this->headerSelector->selectHeaders(
+            ['application/json', 'application/problem+json', ],
+            $contentType,
+            $multipart
+        );
+
+        // for model (json/xml)
+        if (isset($post_api_v3_channels_batch_progress_request)) {
+            if (stripos($headers['Content-Type'], 'application/json') !== false) {
+                # if Content-Type contains "application/json", json_encode the body
+                try {
+                    $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($post_api_v3_channels_batch_progress_request), JSON_THROW_ON_ERROR);
+                } catch (\JsonException $e) {
+                    throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
+                }
+            } else {
+                $httpBody = $post_api_v3_channels_batch_progress_request;
+            }
+        } elseif (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(
+            'POST',
+            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
+    /**
+     * Operation postApiV3ChannelsChannelTerms
+     *
+     * 在 channel 里新建术语
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsChannelTermsRequest $post_api_v3_channels_channel_terms_request post_api_v3_channels_channel_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTerms'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function postApiV3ChannelsChannelTerms($channel, $post_api_v3_channels_channel_terms_request, string $contentType = self::contentTypes['postApiV3ChannelsChannelTerms'][0])
+    {
+        list($response) = $this->postApiV3ChannelsChannelTermsWithHttpInfo($channel, $post_api_v3_channels_channel_terms_request, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation postApiV3ChannelsChannelTermsWithHttpInfo
+     *
+     * 在 channel 里新建术语
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsChannelTermsRequest $post_api_v3_channels_channel_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTerms'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function postApiV3ChannelsChannelTermsWithHttpInfo($channel, $post_api_v3_channels_channel_terms_request, string $contentType = self::contentTypes['postApiV3ChannelsChannelTerms'][0])
+    {
+        $request = $this->postApiV3ChannelsChannelTermsRequest($channel, $post_api_v3_channels_channel_terms_request, $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\PostApiV3ChannelsChannelTerms200Response',
+                        $request,
+                        $response,
+                    );
+                case 201:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 409:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\PostApiV3ChannelsChannelTerms200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 201:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 409:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 postApiV3ChannelsChannelTermsAsync
+     *
+     * 在 channel 里新建术语
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsChannelTermsRequest $post_api_v3_channels_channel_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTerms'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3ChannelsChannelTermsAsync($channel, $post_api_v3_channels_channel_terms_request, string $contentType = self::contentTypes['postApiV3ChannelsChannelTerms'][0])
+    {
+        return $this->postApiV3ChannelsChannelTermsAsyncWithHttpInfo($channel, $post_api_v3_channels_channel_terms_request, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation postApiV3ChannelsChannelTermsAsyncWithHttpInfo
+     *
+     * 在 channel 里新建术语
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsChannelTermsRequest $post_api_v3_channels_channel_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTerms'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3ChannelsChannelTermsAsyncWithHttpInfo($channel, $post_api_v3_channels_channel_terms_request, string $contentType = self::contentTypes['postApiV3ChannelsChannelTerms'][0])
+    {
+        $returnType = '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response';
+        $request = $this->postApiV3ChannelsChannelTermsRequest($channel, $post_api_v3_channels_channel_terms_request, $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 'postApiV3ChannelsChannelTerms'
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \WikipaliApi\Model\PostApiV3ChannelsChannelTermsRequest $post_api_v3_channels_channel_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTerms'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function postApiV3ChannelsChannelTermsRequest($channel, $post_api_v3_channels_channel_terms_request, string $contentType = self::contentTypes['postApiV3ChannelsChannelTerms'][0])
+    {
+
+        // verify the required parameter 'channel' is set
+        if ($channel === null || (is_array($channel) && count($channel) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $channel when calling postApiV3ChannelsChannelTerms'
+            );
+        }
+
+        // verify the required parameter 'post_api_v3_channels_channel_terms_request' is set
+        if ($post_api_v3_channels_channel_terms_request === null || (is_array($post_api_v3_channels_channel_terms_request) && count($post_api_v3_channels_channel_terms_request) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $post_api_v3_channels_channel_terms_request when calling postApiV3ChannelsChannelTerms'
+            );
+        }
+
+
+        $resourcePath = '/v3/channels/{channel}/terms';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($channel !== null) {
+            $resourcePath = str_replace(
+                '{channel}',
+                ObjectSerializer::toPathValue($channel),
+                $resourcePath
+            );
+        }
+
+
+        $headers = $this->headerSelector->selectHeaders(
+            ['application/json', 'application/problem+json', ],
+            $contentType,
+            $multipart
+        );
+
+        // for model (json/xml)
+        if (isset($post_api_v3_channels_channel_terms_request)) {
+            if (stripos($headers['Content-Type'], 'application/json') !== false) {
+                # if Content-Type contains "application/json", json_encode the body
+                try {
+                    $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($post_api_v3_channels_channel_terms_request), JSON_THROW_ON_ERROR);
+                } catch (\JsonException $e) {
+                    throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
+                }
+            } else {
+                $httpBody = $post_api_v3_channels_channel_terms_request;
+            }
+        } elseif (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(
+            'POST',
+            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
+    /**
+     * Operation postApiV3ChannelsChannelTermsImports
+     *
+     * 向 channel 导入术语
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTermsImports'] 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\PostApiV3ChannelsChannelTermsImports200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function postApiV3ChannelsChannelTermsImports($channel, $file, string $contentType = self::contentTypes['postApiV3ChannelsChannelTermsImports'][0])
+    {
+        list($response) = $this->postApiV3ChannelsChannelTermsImportsWithHttpInfo($channel, $file, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation postApiV3ChannelsChannelTermsImportsWithHttpInfo
+     *
+     * 向 channel 导入术语
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTermsImports'] 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\PostApiV3ChannelsChannelTermsImports200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function postApiV3ChannelsChannelTermsImportsWithHttpInfo($channel, $file, string $contentType = self::contentTypes['postApiV3ChannelsChannelTermsImports'][0])
+    {
+        $request = $this->postApiV3ChannelsChannelTermsImportsRequest($channel, $file, $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\PostApiV3ChannelsChannelTermsImports200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\PostApiV3ChannelsChannelTermsImports200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTermsImports200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 postApiV3ChannelsChannelTermsImportsAsync
+     *
+     * 向 channel 导入术语
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTermsImports'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3ChannelsChannelTermsImportsAsync($channel, $file, string $contentType = self::contentTypes['postApiV3ChannelsChannelTermsImports'][0])
+    {
+        return $this->postApiV3ChannelsChannelTermsImportsAsyncWithHttpInfo($channel, $file, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation postApiV3ChannelsChannelTermsImportsAsyncWithHttpInfo
+     *
+     * 向 channel 导入术语
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTermsImports'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3ChannelsChannelTermsImportsAsyncWithHttpInfo($channel, $file, string $contentType = self::contentTypes['postApiV3ChannelsChannelTermsImports'][0])
+    {
+        $returnType = '\WikipaliApi\Model\PostApiV3ChannelsChannelTermsImports200Response';
+        $request = $this->postApiV3ChannelsChannelTermsImportsRequest($channel, $file, $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 'postApiV3ChannelsChannelTermsImports'
+     *
+     * @param  string $channel channel uid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3ChannelsChannelTermsImports'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function postApiV3ChannelsChannelTermsImportsRequest($channel, $file, string $contentType = self::contentTypes['postApiV3ChannelsChannelTermsImports'][0])
+    {
+
+        // verify the required parameter 'channel' is set
+        if ($channel === null || (is_array($channel) && count($channel) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $channel when calling postApiV3ChannelsChannelTermsImports'
+            );
+        }
+
+        // verify the required parameter 'file' is set
+        if ($file === null || (is_array($file) && count($file) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $file when calling postApiV3ChannelsChannelTermsImports'
+            );
+        }
+
+
+        $resourcePath = '/v3/channels/{channel}/terms/imports';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($channel !== null) {
+            $resourcePath = str_replace(
+                '{channel}',
+                ObjectSerializer::toPathValue($channel),
+                $resourcePath
+            );
+        }
+
+        // form params
+        $formDataProcessor = new FormDataProcessor();
+
+        $formData = $formDataProcessor->prepare([
+            'file' => $file,
+        ]);
+
+        $formParams = $formDataProcessor->flatten($formData);
+        $multipart = $formDataProcessor->has_file;
+
+        $multipart = true;
+        $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(
+            'POST',
+            $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;
+    }
+}

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

@@ -0,0 +1,502 @@
+<?php
+/**
+ * GlossariesApi
+ * 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;
+
+/**
+ * GlossariesApi Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+class GlossariesApi
+{
+    /**
+     * @var ClientInterface
+     */
+    protected $client;
+
+    /**
+     * @var Configuration
+     */
+    protected $config;
+
+    /**
+     * @var HeaderSelector
+     */
+    protected $headerSelector;
+
+    /**
+     * @var int Host index
+     */
+    protected $hostIndex;
+
+    /** @var string[] $contentTypes **/
+    public const contentTypes = [
+        'getApiV3GlossariesKind' => [
+            '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 getApiV3GlossariesKind
+     *
+     * 术语词汇表
+     *
+     * @param  string $kind 哪张表:grammar 语法术语,community 社区译名 (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GlossariesKind'] 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\GetApiV3GlossariesKind200Response|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3GlossariesKind($kind, $lang = null, string $contentType = self::contentTypes['getApiV3GlossariesKind'][0])
+    {
+        list($response) = $this->getApiV3GlossariesKindWithHttpInfo($kind, $lang, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3GlossariesKindWithHttpInfo
+     *
+     * 术语词汇表
+     *
+     * @param  string $kind 哪张表:grammar 语法术语,community 社区译名 (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GlossariesKind'] 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\GetApiV3GlossariesKind200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3GlossariesKindWithHttpInfo($kind, $lang = null, string $contentType = self::contentTypes['getApiV3GlossariesKind'][0])
+    {
+        $request = $this->getApiV3GlossariesKindRequest($kind, $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\GetApiV3GlossariesKind200Response',
+                        $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\GetApiV3GlossariesKind200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3GlossariesKind200Response',
+                        $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 getApiV3GlossariesKindAsync
+     *
+     * 术语词汇表
+     *
+     * @param  string $kind 哪张表:grammar 语法术语,community 社区译名 (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GlossariesKind'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3GlossariesKindAsync($kind, $lang = null, string $contentType = self::contentTypes['getApiV3GlossariesKind'][0])
+    {
+        return $this->getApiV3GlossariesKindAsyncWithHttpInfo($kind, $lang, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3GlossariesKindAsyncWithHttpInfo
+     *
+     * 术语词汇表
+     *
+     * @param  string $kind 哪张表:grammar 语法术语,community 社区译名 (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GlossariesKind'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3GlossariesKindAsyncWithHttpInfo($kind, $lang = null, string $contentType = self::contentTypes['getApiV3GlossariesKind'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3GlossariesKind200Response';
+        $request = $this->getApiV3GlossariesKindRequest($kind, $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 'getApiV3GlossariesKind'
+     *
+     * @param  string $kind 哪张表:grammar 语法术语,community 社区译名 (required)
+     * @param  string|null $lang 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果) (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3GlossariesKind'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3GlossariesKindRequest($kind, $lang = null, string $contentType = self::contentTypes['getApiV3GlossariesKind'][0])
+    {
+
+        // verify the required parameter 'kind' is set
+        if ($kind === null || (is_array($kind) && count($kind) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $kind when calling getApiV3GlossariesKind'
+            );
+        }
+
+
+
+        $resourcePath = '/v3/glossaries/{kind}';
+        $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 ($kind !== null) {
+            $resourcePath = str_replace(
+                '{kind}',
+                ObjectSerializer::toPathValue($kind),
+                $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;
+    }
+}

+ 16 - 2
api-test/client/lib/Api/SearchApi.php

@@ -627,7 +627,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\GetApiV3SearchSearch200Response|\WikipaliApi\Model\ProblemDetails
+     * @return \WikipaliApi\Model\GetApiV3SearchSearch200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
      */
     public function getApiV3SearchSearch($search, string $contentType = self::contentTypes['getApiV3SearchSearch'][0])
     {
@@ -645,7 +645,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\GetApiV3SearchSearch200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     * @return array of \WikipaliApi\Model\GetApiV3SearchSearch200Response|\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])
     {
@@ -681,6 +681,12 @@ class SearchApi
                         $request,
                         $response,
                     );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
                 case 422:
                     return $this->handleResponseWithDataType(
                         '\WikipaliApi\Model\ProblemDetails',
@@ -719,6 +725,14 @@ class SearchApi
                     );
                     $e->setResponseObject($data);
                     throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
                 case 422:
                     $data = ObjectSerializer::deserialize(
                         $e->getResponseBody(),

+ 2194 - 0
api-test/client/lib/Api/StudiosApi.php

@@ -0,0 +1,2194 @@
+<?php
+/**
+ * StudiosApi
+ * 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;
+
+/**
+ * StudiosApi Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+class StudiosApi
+{
+    /**
+     * @var ClientInterface
+     */
+    protected $client;
+
+    /**
+     * @var Configuration
+     */
+    protected $config;
+
+    /**
+     * @var HeaderSelector
+     */
+    protected $headerSelector;
+
+    /**
+     * @var int Host index
+     */
+    protected $hostIndex;
+
+    /** @var string[] $contentTypes **/
+    public const contentTypes = [
+        'getApiV3StudiosStudioChannels' => [
+            'application/json',
+        ],
+        'getApiV3StudiosStudioTerms' => [
+            'application/json',
+        ],
+        'postApiV3StudiosStudioChannels' => [
+            'application/json',
+        ],
+        'postApiV3StudiosStudioTerms' => [
+            'application/json',
+        ],
+        'postApiV3StudiosStudioTermsImports' => [
+            'multipart/form-data',
+        ],
+    ];
+
+    /**
+     * @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 getApiV3StudiosStudioChannels
+     *
+     * 列出 studio 的 channel
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $relation 关系 (optional, default to 'own')
+     * @param  string|null $collaborator 只看这个拥有者共享过来的(uuid) (optional)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioChannels'] 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\GetApiV3Channels200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3StudiosStudioChannels($studio, $per_page = 20, $relation = 'own', $collaborator = null, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3StudiosStudioChannels'][0])
+    {
+        list($response) = $this->getApiV3StudiosStudioChannelsWithHttpInfo($studio, $per_page, $relation, $collaborator, $search, $type, $lang, $book, $para, $order, $dir, $page, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3StudiosStudioChannelsWithHttpInfo
+     *
+     * 列出 studio 的 channel
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $relation 关系 (optional, default to 'own')
+     * @param  string|null $collaborator 只看这个拥有者共享过来的(uuid) (optional)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioChannels'] 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\GetApiV3Channels200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3StudiosStudioChannelsWithHttpInfo($studio, $per_page = 20, $relation = 'own', $collaborator = null, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3StudiosStudioChannels'][0])
+    {
+        $request = $this->getApiV3StudiosStudioChannelsRequest($studio, $per_page, $relation, $collaborator, $search, $type, $lang, $book, $para, $order, $dir, $page, $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\GetApiV3Channels200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3Channels200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3Channels200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 getApiV3StudiosStudioChannelsAsync
+     *
+     * 列出 studio 的 channel
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $relation 关系 (optional, default to 'own')
+     * @param  string|null $collaborator 只看这个拥有者共享过来的(uuid) (optional)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioChannels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3StudiosStudioChannelsAsync($studio, $per_page = 20, $relation = 'own', $collaborator = null, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3StudiosStudioChannels'][0])
+    {
+        return $this->getApiV3StudiosStudioChannelsAsyncWithHttpInfo($studio, $per_page, $relation, $collaborator, $search, $type, $lang, $book, $para, $order, $dir, $page, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3StudiosStudioChannelsAsyncWithHttpInfo
+     *
+     * 列出 studio 的 channel
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $relation 关系 (optional, default to 'own')
+     * @param  string|null $collaborator 只看这个拥有者共享过来的(uuid) (optional)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioChannels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3StudiosStudioChannelsAsyncWithHttpInfo($studio, $per_page = 20, $relation = 'own', $collaborator = null, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3StudiosStudioChannels'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3Channels200Response';
+        $request = $this->getApiV3StudiosStudioChannelsRequest($studio, $per_page, $relation, $collaborator, $search, $type, $lang, $book, $para, $order, $dir, $page, $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 'getApiV3StudiosStudioChannels'
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $relation 关系 (optional, default to 'own')
+     * @param  string|null $collaborator 只看这个拥有者共享过来的(uuid) (optional)
+     * @param  string|null $search 按名字模糊匹配 (optional)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 语言 (optional)
+     * @param  int|null $book 章节所在的书(与 para 同时给) (optional)
+     * @param  int|null $para 章节起始段(与 book 同时给) (optional)
+     * @param  string|null $order 排序字段 (optional, default to 'updated_at')
+     * @param  string|null $dir 排序方向 (optional, default to 'desc')
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioChannels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3StudiosStudioChannelsRequest($studio, $per_page = 20, $relation = 'own', $collaborator = null, $search = null, $type = null, $lang = null, $book = null, $para = null, $order = 'updated_at', $dir = 'desc', $page = 1, string $contentType = self::contentTypes['getApiV3StudiosStudioChannels'][0])
+    {
+
+        // verify the required parameter 'studio' is set
+        if ($studio === null || (is_array($studio) && count($studio) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $studio when calling getApiV3StudiosStudioChannels'
+            );
+        }
+
+
+
+
+
+
+
+
+
+
+
+
+
+        $resourcePath = '/v3/studios/{studio}/channels';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $per_page,
+            'per_page', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $relation,
+            'relation', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $collaborator,
+            'collaborator', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $search,
+            'search', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $type,
+            'type', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $lang,
+            'lang', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $book,
+            'book', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $para,
+            'para', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $order,
+            'order', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $dir,
+            'dir', // param base name
+            'string', // 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
+        ) ?? []);
+
+
+        // path params
+        if ($studio !== null) {
+            $resourcePath = str_replace(
+                '{studio}',
+                ObjectSerializer::toPathValue($studio),
+                $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
+        );
+    }
+
+    /**
+     * Operation getApiV3StudiosStudioTerms
+     *
+     * studio 的术语列表
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @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)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioTerms'] 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\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])
+    {
+        list($response) = $this->getApiV3StudiosStudioTermsWithHttpInfo($studio, $per_page, $search, $quality, $category, $general, $order, $dir, $page, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3StudiosStudioTermsWithHttpInfo
+     *
+     * studio 的术语列表
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @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)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioTerms'] 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\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])
+    {
+        $request = $this->getApiV3StudiosStudioTermsRequest($studio, $per_page, $search, $quality, $category, $general, $order, $dir, $page, $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\GetApiV3ChannelsChannelTerms200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3ChannelsChannelTerms200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 getApiV3StudiosStudioTermsAsync
+     *
+     * studio 的术语列表
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @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)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioTerms'] to see the possible values for this operation
+     *
+     * @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])
+    {
+        return $this->getApiV3StudiosStudioTermsAsyncWithHttpInfo($studio, $per_page, $search, $quality, $category, $general, $order, $dir, $page, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3StudiosStudioTermsAsyncWithHttpInfo
+     *
+     * studio 的术语列表
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @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)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioTerms'] to see the possible values for this operation
+     *
+     * @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])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response';
+        $request = $this->getApiV3StudiosStudioTermsRequest($studio, $per_page, $search, $quality, $category, $general, $order, $dir, $page, $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 'getApiV3StudiosStudioTerms'
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @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)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3StudiosStudioTerms'] to see the possible values for this operation
+     *
+     * @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])
+    {
+
+        // verify the required parameter 'studio' is set
+        if ($studio === null || (is_array($studio) && count($studio) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $studio when calling getApiV3StudiosStudioTerms'
+            );
+        }
+
+
+
+
+
+
+
+
+
+
+        $resourcePath = '/v3/studios/{studio}/terms';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $per_page,
+            'per_page', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $search,
+            'search', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $quality,
+            'quality', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $category,
+            'category', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            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
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $dir,
+            'dir', // param base name
+            'string', // 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
+        ) ?? []);
+
+
+        // path params
+        if ($studio !== null) {
+            $resourcePath = str_replace(
+                '{studio}',
+                ObjectSerializer::toPathValue($studio),
+                $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
+        );
+    }
+
+    /**
+     * Operation postApiV3StudiosStudioChannels
+     *
+     * 在 studio 名下建 channel
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest $post_api_v3_studios_studio_channels_request post_api_v3_studios_studio_channels_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioChannels'] 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\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function postApiV3StudiosStudioChannels($studio, $post_api_v3_studios_studio_channels_request, string $contentType = self::contentTypes['postApiV3StudiosStudioChannels'][0])
+    {
+        list($response) = $this->postApiV3StudiosStudioChannelsWithHttpInfo($studio, $post_api_v3_studios_studio_channels_request, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation postApiV3StudiosStudioChannelsWithHttpInfo
+     *
+     * 在 studio 名下建 channel
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest $post_api_v3_studios_studio_channels_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioChannels'] 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\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\GetApiV3ChannelsChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function postApiV3StudiosStudioChannelsWithHttpInfo($studio, $post_api_v3_studios_studio_channels_request, string $contentType = self::contentTypes['postApiV3StudiosStudioChannels'][0])
+    {
+        $request = $this->postApiV3StudiosStudioChannelsRequest($studio, $post_api_v3_studios_studio_channels_request, $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\GetApiV3ChannelsChannel200Response',
+                        $request,
+                        $response,
+                    );
+                case 201:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\GetApiV3ChannelsChannel200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 201:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 postApiV3StudiosStudioChannelsAsync
+     *
+     * 在 studio 名下建 channel
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest $post_api_v3_studios_studio_channels_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioChannels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3StudiosStudioChannelsAsync($studio, $post_api_v3_studios_studio_channels_request, string $contentType = self::contentTypes['postApiV3StudiosStudioChannels'][0])
+    {
+        return $this->postApiV3StudiosStudioChannelsAsyncWithHttpInfo($studio, $post_api_v3_studios_studio_channels_request, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation postApiV3StudiosStudioChannelsAsyncWithHttpInfo
+     *
+     * 在 studio 名下建 channel
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest $post_api_v3_studios_studio_channels_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioChannels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3StudiosStudioChannelsAsyncWithHttpInfo($studio, $post_api_v3_studios_studio_channels_request, string $contentType = self::contentTypes['postApiV3StudiosStudioChannels'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannel200Response';
+        $request = $this->postApiV3StudiosStudioChannelsRequest($studio, $post_api_v3_studios_studio_channels_request, $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 'postApiV3StudiosStudioChannels'
+     *
+     * @param  string $studio 用户 uuid 或团队 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest $post_api_v3_studios_studio_channels_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioChannels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function postApiV3StudiosStudioChannelsRequest($studio, $post_api_v3_studios_studio_channels_request, string $contentType = self::contentTypes['postApiV3StudiosStudioChannels'][0])
+    {
+
+        // verify the required parameter 'studio' is set
+        if ($studio === null || (is_array($studio) && count($studio) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $studio when calling postApiV3StudiosStudioChannels'
+            );
+        }
+
+        // verify the required parameter 'post_api_v3_studios_studio_channels_request' is set
+        if ($post_api_v3_studios_studio_channels_request === null || (is_array($post_api_v3_studios_studio_channels_request) && count($post_api_v3_studios_studio_channels_request) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $post_api_v3_studios_studio_channels_request when calling postApiV3StudiosStudioChannels'
+            );
+        }
+
+
+        $resourcePath = '/v3/studios/{studio}/channels';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($studio !== null) {
+            $resourcePath = str_replace(
+                '{studio}',
+                ObjectSerializer::toPathValue($studio),
+                $resourcePath
+            );
+        }
+
+
+        $headers = $this->headerSelector->selectHeaders(
+            ['application/json', 'application/problem+json', ],
+            $contentType,
+            $multipart
+        );
+
+        // for model (json/xml)
+        if (isset($post_api_v3_studios_studio_channels_request)) {
+            if (stripos($headers['Content-Type'], 'application/json') !== false) {
+                # if Content-Type contains "application/json", json_encode the body
+                try {
+                    $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($post_api_v3_studios_studio_channels_request), JSON_THROW_ON_ERROR);
+                } catch (\JsonException $e) {
+                    throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
+                }
+            } else {
+                $httpBody = $post_api_v3_studios_studio_channels_request;
+            }
+        } elseif (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(
+            'POST',
+            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
+    /**
+     * Operation postApiV3StudiosStudioTerms
+     *
+     * 新建 studio 级术语
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioTermsRequest $post_api_v3_studios_studio_terms_request post_api_v3_studios_studio_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTerms'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function postApiV3StudiosStudioTerms($studio, $post_api_v3_studios_studio_terms_request, string $contentType = self::contentTypes['postApiV3StudiosStudioTerms'][0])
+    {
+        list($response) = $this->postApiV3StudiosStudioTermsWithHttpInfo($studio, $post_api_v3_studios_studio_terms_request, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation postApiV3StudiosStudioTermsWithHttpInfo
+     *
+     * 新建 studio 级术语
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioTermsRequest $post_api_v3_studios_studio_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTerms'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function postApiV3StudiosStudioTermsWithHttpInfo($studio, $post_api_v3_studios_studio_terms_request, string $contentType = self::contentTypes['postApiV3StudiosStudioTerms'][0])
+    {
+        $request = $this->postApiV3StudiosStudioTermsRequest($studio, $post_api_v3_studios_studio_terms_request, $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\PostApiV3ChannelsChannelTerms200Response',
+                        $request,
+                        $response,
+                    );
+                case 201:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 409:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\PostApiV3ChannelsChannelTerms200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 201:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 409:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 postApiV3StudiosStudioTermsAsync
+     *
+     * 新建 studio 级术语
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioTermsRequest $post_api_v3_studios_studio_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTerms'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3StudiosStudioTermsAsync($studio, $post_api_v3_studios_studio_terms_request, string $contentType = self::contentTypes['postApiV3StudiosStudioTerms'][0])
+    {
+        return $this->postApiV3StudiosStudioTermsAsyncWithHttpInfo($studio, $post_api_v3_studios_studio_terms_request, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation postApiV3StudiosStudioTermsAsyncWithHttpInfo
+     *
+     * 新建 studio 级术语
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioTermsRequest $post_api_v3_studios_studio_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTerms'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3StudiosStudioTermsAsyncWithHttpInfo($studio, $post_api_v3_studios_studio_terms_request, string $contentType = self::contentTypes['postApiV3StudiosStudioTerms'][0])
+    {
+        $returnType = '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response';
+        $request = $this->postApiV3StudiosStudioTermsRequest($studio, $post_api_v3_studios_studio_terms_request, $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 'postApiV3StudiosStudioTerms'
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \WikipaliApi\Model\PostApiV3StudiosStudioTermsRequest $post_api_v3_studios_studio_terms_request (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTerms'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function postApiV3StudiosStudioTermsRequest($studio, $post_api_v3_studios_studio_terms_request, string $contentType = self::contentTypes['postApiV3StudiosStudioTerms'][0])
+    {
+
+        // verify the required parameter 'studio' is set
+        if ($studio === null || (is_array($studio) && count($studio) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $studio when calling postApiV3StudiosStudioTerms'
+            );
+        }
+
+        // verify the required parameter 'post_api_v3_studios_studio_terms_request' is set
+        if ($post_api_v3_studios_studio_terms_request === null || (is_array($post_api_v3_studios_studio_terms_request) && count($post_api_v3_studios_studio_terms_request) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $post_api_v3_studios_studio_terms_request when calling postApiV3StudiosStudioTerms'
+            );
+        }
+
+
+        $resourcePath = '/v3/studios/{studio}/terms';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($studio !== null) {
+            $resourcePath = str_replace(
+                '{studio}',
+                ObjectSerializer::toPathValue($studio),
+                $resourcePath
+            );
+        }
+
+
+        $headers = $this->headerSelector->selectHeaders(
+            ['application/json', 'application/problem+json', ],
+            $contentType,
+            $multipart
+        );
+
+        // for model (json/xml)
+        if (isset($post_api_v3_studios_studio_terms_request)) {
+            if (stripos($headers['Content-Type'], 'application/json') !== false) {
+                # if Content-Type contains "application/json", json_encode the body
+                try {
+                    $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($post_api_v3_studios_studio_terms_request), JSON_THROW_ON_ERROR);
+                } catch (\JsonException $e) {
+                    throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
+                }
+            } else {
+                $httpBody = $post_api_v3_studios_studio_terms_request;
+            }
+        } elseif (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(
+            'POST',
+            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
+    /**
+     * Operation postApiV3StudiosStudioTermsImports
+     *
+     * 向 studio 导入术语
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTermsImports'] 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\PostApiV3ChannelsChannelTermsImports200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function postApiV3StudiosStudioTermsImports($studio, $file, string $contentType = self::contentTypes['postApiV3StudiosStudioTermsImports'][0])
+    {
+        list($response) = $this->postApiV3StudiosStudioTermsImportsWithHttpInfo($studio, $file, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation postApiV3StudiosStudioTermsImportsWithHttpInfo
+     *
+     * 向 studio 导入术语
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTermsImports'] 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\PostApiV3ChannelsChannelTermsImports200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function postApiV3StudiosStudioTermsImportsWithHttpInfo($studio, $file, string $contentType = self::contentTypes['postApiV3StudiosStudioTermsImports'][0])
+    {
+        $request = $this->postApiV3StudiosStudioTermsImportsRequest($studio, $file, $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\PostApiV3ChannelsChannelTermsImports200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\PostApiV3ChannelsChannelTermsImports200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTermsImports200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 postApiV3StudiosStudioTermsImportsAsync
+     *
+     * 向 studio 导入术语
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTermsImports'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3StudiosStudioTermsImportsAsync($studio, $file, string $contentType = self::contentTypes['postApiV3StudiosStudioTermsImports'][0])
+    {
+        return $this->postApiV3StudiosStudioTermsImportsAsyncWithHttpInfo($studio, $file, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation postApiV3StudiosStudioTermsImportsAsyncWithHttpInfo
+     *
+     * 向 studio 导入术语
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTermsImports'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function postApiV3StudiosStudioTermsImportsAsyncWithHttpInfo($studio, $file, string $contentType = self::contentTypes['postApiV3StudiosStudioTermsImports'][0])
+    {
+        $returnType = '\WikipaliApi\Model\PostApiV3ChannelsChannelTermsImports200Response';
+        $request = $this->postApiV3StudiosStudioTermsImportsRequest($studio, $file, $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 'postApiV3StudiosStudioTermsImports'
+     *
+     * @param  string $studio 用户或团队的 uuid (required)
+     * @param  \SplFileObject $file xlsx 表格,不超过 5MB (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['postApiV3StudiosStudioTermsImports'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function postApiV3StudiosStudioTermsImportsRequest($studio, $file, string $contentType = self::contentTypes['postApiV3StudiosStudioTermsImports'][0])
+    {
+
+        // verify the required parameter 'studio' is set
+        if ($studio === null || (is_array($studio) && count($studio) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $studio when calling postApiV3StudiosStudioTermsImports'
+            );
+        }
+
+        // verify the required parameter 'file' is set
+        if ($file === null || (is_array($file) && count($file) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $file when calling postApiV3StudiosStudioTermsImports'
+            );
+        }
+
+
+        $resourcePath = '/v3/studios/{studio}/terms/imports';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($studio !== null) {
+            $resourcePath = str_replace(
+                '{studio}',
+                ObjectSerializer::toPathValue($studio),
+                $resourcePath
+            );
+        }
+
+        // form params
+        $formDataProcessor = new FormDataProcessor();
+
+        $formData = $formDataProcessor->prepare([
+            'file' => $file,
+        ]);
+
+        $formParams = $formDataProcessor->flatten($formData);
+        $multipart = $formDataProcessor->has_file;
+
+        $multipart = true;
+        $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(
+            'POST',
+            $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;
+    }
+}

+ 1617 - 0
api-test/client/lib/Api/TermsApi.php

@@ -0,0 +1,1617 @@
+<?php
+/**
+ * TermsApi
+ * 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;
+
+/**
+ * TermsApi Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+class TermsApi
+{
+    /**
+     * @var ClientInterface
+     */
+    protected $client;
+
+    /**
+     * @var Configuration
+     */
+    protected $config;
+
+    /**
+     * @var HeaderSelector
+     */
+    protected $headerSelector;
+
+    /**
+     * @var int Host index
+     */
+    protected $hostIndex;
+
+    /** @var string[] $contentTypes **/
+    public const contentTypes = [
+        'deleteApiV3TermsTerm' => [
+            'application/json',
+        ],
+        'getApiV3Terms' => [
+            'application/json',
+        ],
+        'getApiV3TermsTerm' => [
+            'application/json',
+        ],
+        'patchApiV3TermsTerm' => [
+            '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 deleteApiV3TermsTerm
+     *
+     * 删术语
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3TermsTerm'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function deleteApiV3TermsTerm($term, string $contentType = self::contentTypes['deleteApiV3TermsTerm'][0])
+    {
+        list($response) = $this->deleteApiV3TermsTermWithHttpInfo($term, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation deleteApiV3TermsTermWithHttpInfo
+     *
+     * 删术语
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3TermsTerm'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function deleteApiV3TermsTermWithHttpInfo($term, string $contentType = self::contentTypes['deleteApiV3TermsTerm'][0])
+    {
+        $request = $this->deleteApiV3TermsTermRequest($term, $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\PostApiV3ChannelsChannelTerms200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\PostApiV3ChannelsChannelTerms200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 deleteApiV3TermsTermAsync
+     *
+     * 删术语
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3TermsTerm'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function deleteApiV3TermsTermAsync($term, string $contentType = self::contentTypes['deleteApiV3TermsTerm'][0])
+    {
+        return $this->deleteApiV3TermsTermAsyncWithHttpInfo($term, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation deleteApiV3TermsTermAsyncWithHttpInfo
+     *
+     * 删术语
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3TermsTerm'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function deleteApiV3TermsTermAsyncWithHttpInfo($term, string $contentType = self::contentTypes['deleteApiV3TermsTerm'][0])
+    {
+        $returnType = '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response';
+        $request = $this->deleteApiV3TermsTermRequest($term, $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 'deleteApiV3TermsTerm'
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['deleteApiV3TermsTerm'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function deleteApiV3TermsTermRequest($term, string $contentType = self::contentTypes['deleteApiV3TermsTerm'][0])
+    {
+
+        // verify the required parameter 'term' is set
+        if ($term === null || (is_array($term) && count($term) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $term when calling deleteApiV3TermsTerm'
+            );
+        }
+
+
+        $resourcePath = '/v3/terms/{term}';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($term !== null) {
+            $resourcePath = str_replace(
+                '{term}',
+                ObjectSerializer::toPathValue($term),
+                $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(
+            'DELETE',
+            $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
+    /**
+     * Operation getApiV3Terms
+     *
+     * 按词查术语
+     *
+     * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @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 \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
+     * @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])
+    {
+        list($response) = $this->getApiV3TermsWithHttpInfo($word, $per_page, $tag, $channel, $language, $with_body, $page, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3TermsWithHttpInfo
+     *
+     * 按词查术语
+     *
+     * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @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 \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
+     * @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])
+    {
+        $request = $this->getApiV3TermsRequest($word, $per_page, $tag, $channel, $language, $with_body, $page, $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\GetApiV3ChannelsChannelTerms200Response',
+                        $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\GetApiV3ChannelsChannelTerms200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response',
+                        $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 getApiV3TermsAsync
+     *
+     * 按词查术语
+     *
+     * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @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])
+    {
+        return $this->getApiV3TermsAsyncWithHttpInfo($word, $per_page, $tag, $channel, $language, $with_body, $page, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3TermsAsyncWithHttpInfo
+     *
+     * 按词查术语
+     *
+     * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @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])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200Response';
+        $request = $this->getApiV3TermsRequest($word, $per_page, $tag, $channel, $language, $with_body, $page, $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 'getApiV3Terms'
+     *
+     * @param  string $word 巴利词,逗号分隔,最多 50 个 (required)
+     * @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])
+    {
+
+        // verify the required parameter 'word' is set
+        if ($word === null || (is_array($word) && count($word) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $word when calling getApiV3Terms'
+            );
+        }
+
+
+
+
+
+
+
+
+        $resourcePath = '/v3/terms';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $per_page,
+            'per_page', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $word,
+            'word', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            true // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $tag,
+            'tag', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $channel,
+            'channel', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $language,
+            'language', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            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
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+
+
+
+
+        $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
+        );
+    }
+
+    /**
+     * Operation getApiV3TermsTerm
+     *
+     * 术语详情
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string|null $channels 正文按这些 channel 解析(句子、术语),逗号分隔,最多 20 个;只认你看得见的,不给就用术语所在 channel (optional)
+     * @param  string|null $mode 正文模式 (optional, default to 'read')
+     * @param  string|null $format 正文格式:tree 给节点树 &#x60;body&#x60;,html 给 HTML 字符串 &#x60;html&#x60;(WebView 显示用) (optional, default to 'tree')
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TermsTerm'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3TermsTerm($term, $channels = null, $mode = 'read', $format = 'tree', string $contentType = self::contentTypes['getApiV3TermsTerm'][0])
+    {
+        list($response) = $this->getApiV3TermsTermWithHttpInfo($term, $channels, $mode, $format, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3TermsTermWithHttpInfo
+     *
+     * 术语详情
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string|null $channels 正文按这些 channel 解析(句子、术语),逗号分隔,最多 20 个;只认你看得见的,不给就用术语所在 channel (optional)
+     * @param  string|null $mode 正文模式 (optional, default to 'read')
+     * @param  string|null $format 正文格式:tree 给节点树 &#x60;body&#x60;,html 给 HTML 字符串 &#x60;html&#x60;(WebView 显示用) (optional, default to 'tree')
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TermsTerm'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3TermsTermWithHttpInfo($term, $channels = null, $mode = 'read', $format = 'tree', string $contentType = self::contentTypes['getApiV3TermsTerm'][0])
+    {
+        $request = $this->getApiV3TermsTermRequest($term, $channels, $mode, $format, $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\PostApiV3ChannelsChannelTerms200Response',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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\PostApiV3ChannelsChannelTerms200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $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 getApiV3TermsTermAsync
+     *
+     * 术语详情
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string|null $channels 正文按这些 channel 解析(句子、术语),逗号分隔,最多 20 个;只认你看得见的,不给就用术语所在 channel (optional)
+     * @param  string|null $mode 正文模式 (optional, default to 'read')
+     * @param  string|null $format 正文格式:tree 给节点树 &#x60;body&#x60;,html 给 HTML 字符串 &#x60;html&#x60;(WebView 显示用) (optional, default to 'tree')
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TermsTerm'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3TermsTermAsync($term, $channels = null, $mode = 'read', $format = 'tree', string $contentType = self::contentTypes['getApiV3TermsTerm'][0])
+    {
+        return $this->getApiV3TermsTermAsyncWithHttpInfo($term, $channels, $mode, $format, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3TermsTermAsyncWithHttpInfo
+     *
+     * 术语详情
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string|null $channels 正文按这些 channel 解析(句子、术语),逗号分隔,最多 20 个;只认你看得见的,不给就用术语所在 channel (optional)
+     * @param  string|null $mode 正文模式 (optional, default to 'read')
+     * @param  string|null $format 正文格式:tree 给节点树 &#x60;body&#x60;,html 给 HTML 字符串 &#x60;html&#x60;(WebView 显示用) (optional, default to 'tree')
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TermsTerm'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3TermsTermAsyncWithHttpInfo($term, $channels = null, $mode = 'read', $format = 'tree', string $contentType = self::contentTypes['getApiV3TermsTerm'][0])
+    {
+        $returnType = '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response';
+        $request = $this->getApiV3TermsTermRequest($term, $channels, $mode, $format, $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 'getApiV3TermsTerm'
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  string|null $channels 正文按这些 channel 解析(句子、术语),逗号分隔,最多 20 个;只认你看得见的,不给就用术语所在 channel (optional)
+     * @param  string|null $mode 正文模式 (optional, default to 'read')
+     * @param  string|null $format 正文格式:tree 给节点树 &#x60;body&#x60;,html 给 HTML 字符串 &#x60;html&#x60;(WebView 显示用) (optional, default to 'tree')
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TermsTerm'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3TermsTermRequest($term, $channels = null, $mode = 'read', $format = 'tree', string $contentType = self::contentTypes['getApiV3TermsTerm'][0])
+    {
+
+        // verify the required parameter 'term' is set
+        if ($term === null || (is_array($term) && count($term) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $term when calling getApiV3TermsTerm'
+            );
+        }
+
+
+
+
+
+        $resourcePath = '/v3/terms/{term}';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $channels,
+            'channels', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $mode,
+            'mode', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $format,
+            'format', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+
+
+        // path params
+        if ($term !== null) {
+            $resourcePath = str_replace(
+                '{term}',
+                ObjectSerializer::toPathValue($term),
+                $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
+        );
+    }
+
+    /**
+     * Operation patchApiV3TermsTerm
+     *
+     * 改术语
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  \WikipaliApi\Model\PatchApiV3TermsTermRequest|null $patch_api_v3_terms_term_request patch_api_v3_terms_term_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3TermsTerm'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     */
+    public function patchApiV3TermsTerm($term, $patch_api_v3_terms_term_request = null, string $contentType = self::contentTypes['patchApiV3TermsTerm'][0])
+    {
+        list($response) = $this->patchApiV3TermsTermWithHttpInfo($term, $patch_api_v3_terms_term_request, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation patchApiV3TermsTermWithHttpInfo
+     *
+     * 改术语
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  \WikipaliApi\Model\PatchApiV3TermsTermRequest|null $patch_api_v3_terms_term_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3TermsTerm'] 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\PostApiV3ChannelsChannelTerms200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function patchApiV3TermsTermWithHttpInfo($term, $patch_api_v3_terms_term_request = null, string $contentType = self::contentTypes['patchApiV3TermsTerm'][0])
+    {
+        $request = $this->patchApiV3TermsTermRequest($term, $patch_api_v3_terms_term_request, $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\PostApiV3ChannelsChannelTerms200Response',
+                        $request,
+                        $response,
+                    );
+                case 401:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 412:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 422:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
+                case 428:
+                    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\PostApiV3ChannelsChannelTerms200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 401:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 412:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 422:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+                case 428:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
+            }
+        
+
+            throw $e;
+        }
+    }
+
+    /**
+     * Operation patchApiV3TermsTermAsync
+     *
+     * 改术语
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  \WikipaliApi\Model\PatchApiV3TermsTermRequest|null $patch_api_v3_terms_term_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3TermsTerm'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function patchApiV3TermsTermAsync($term, $patch_api_v3_terms_term_request = null, string $contentType = self::contentTypes['patchApiV3TermsTerm'][0])
+    {
+        return $this->patchApiV3TermsTermAsyncWithHttpInfo($term, $patch_api_v3_terms_term_request, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation patchApiV3TermsTermAsyncWithHttpInfo
+     *
+     * 改术语
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  \WikipaliApi\Model\PatchApiV3TermsTermRequest|null $patch_api_v3_terms_term_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3TermsTerm'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function patchApiV3TermsTermAsyncWithHttpInfo($term, $patch_api_v3_terms_term_request = null, string $contentType = self::contentTypes['patchApiV3TermsTerm'][0])
+    {
+        $returnType = '\WikipaliApi\Model\PostApiV3ChannelsChannelTerms200Response';
+        $request = $this->patchApiV3TermsTermRequest($term, $patch_api_v3_terms_term_request, $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 'patchApiV3TermsTerm'
+     *
+     * @param  string $term 术语 id(guid) (required)
+     * @param  \WikipaliApi\Model\PatchApiV3TermsTermRequest|null $patch_api_v3_terms_term_request (optional)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['patchApiV3TermsTerm'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function patchApiV3TermsTermRequest($term, $patch_api_v3_terms_term_request = null, string $contentType = self::contentTypes['patchApiV3TermsTerm'][0])
+    {
+
+        // verify the required parameter 'term' is set
+        if ($term === null || (is_array($term) && count($term) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $term when calling patchApiV3TermsTerm'
+            );
+        }
+
+
+
+        $resourcePath = '/v3/terms/{term}';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+        // path params
+        if ($term !== null) {
+            $resourcePath = str_replace(
+                '{term}',
+                ObjectSerializer::toPathValue($term),
+                $resourcePath
+            );
+        }
+
+
+        $headers = $this->headerSelector->selectHeaders(
+            ['application/json', 'application/problem+json', ],
+            $contentType,
+            $multipart
+        );
+
+        // for model (json/xml)
+        if (isset($patch_api_v3_terms_term_request)) {
+            if (stripos($headers['Content-Type'], 'application/json') !== false) {
+                # if Content-Type contains "application/json", json_encode the body
+                try {
+                    $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization($patch_api_v3_terms_term_request), JSON_THROW_ON_ERROR);
+                } catch (\JsonException $e) {
+                    throw new \InvalidArgumentException('json_encode error: ' . $e->getMessage(), 0, $e);
+                }
+            } else {
+                $httpBody = $patch_api_v3_terms_term_request;
+            }
+        } elseif (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(
+            'PATCH',
+            $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;
+    }
+}

+ 542 - 0
api-test/client/lib/Api/TipitakaChannelsApi.php

@@ -0,0 +1,542 @@
+<?php
+/**
+ * TipitakaChannelsApi
+ * 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;
+
+/**
+ * TipitakaChannelsApi Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+class TipitakaChannelsApi
+{
+    /**
+     * @var ClientInterface
+     */
+    protected $client;
+
+    /**
+     * @var Configuration
+     */
+    protected $config;
+
+    /**
+     * @var HeaderSelector
+     */
+    protected $headerSelector;
+
+    /**
+     * @var int Host index
+     */
+    protected $hostIndex;
+
+    /** @var string[] $contentTypes **/
+    public const contentTypes = [
+        'getApiV3TipitakaChannels' => [
+            '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 getApiV3TipitakaChannels
+     *
+     * 列出有译文的公开 channel
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 译文语族(progress_chapters.lang,zh 涵盖简繁) (optional)
+     * @param  float|null $min_progress 章节完成度门槛 0–1 (optional, default to 0.8)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaChannels'] 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\GetApiV3TipitakaChannels200Response|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3TipitakaChannels($per_page = 20, $type = null, $lang = null, $min_progress = 0.8, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaChannels'][0])
+    {
+        list($response) = $this->getApiV3TipitakaChannelsWithHttpInfo($per_page, $type, $lang, $min_progress, $page, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3TipitakaChannelsWithHttpInfo
+     *
+     * 列出有译文的公开 channel
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 译文语族(progress_chapters.lang,zh 涵盖简繁) (optional)
+     * @param  float|null $min_progress 章节完成度门槛 0–1 (optional, default to 0.8)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaChannels'] 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\GetApiV3TipitakaChannels200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3TipitakaChannelsWithHttpInfo($per_page = 20, $type = null, $lang = null, $min_progress = 0.8, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaChannels'][0])
+    {
+        $request = $this->getApiV3TipitakaChannelsRequest($per_page, $type, $lang, $min_progress, $page, $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\GetApiV3TipitakaChannels200Response',
+                        $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\GetApiV3TipitakaChannels200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3TipitakaChannels200Response',
+                        $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 getApiV3TipitakaChannelsAsync
+     *
+     * 列出有译文的公开 channel
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 译文语族(progress_chapters.lang,zh 涵盖简繁) (optional)
+     * @param  float|null $min_progress 章节完成度门槛 0–1 (optional, default to 0.8)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaChannels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3TipitakaChannelsAsync($per_page = 20, $type = null, $lang = null, $min_progress = 0.8, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaChannels'][0])
+    {
+        return $this->getApiV3TipitakaChannelsAsyncWithHttpInfo($per_page, $type, $lang, $min_progress, $page, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3TipitakaChannelsAsyncWithHttpInfo
+     *
+     * 列出有译文的公开 channel
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 译文语族(progress_chapters.lang,zh 涵盖简繁) (optional)
+     * @param  float|null $min_progress 章节完成度门槛 0–1 (optional, default to 0.8)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaChannels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3TipitakaChannelsAsyncWithHttpInfo($per_page = 20, $type = null, $lang = null, $min_progress = 0.8, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaChannels'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3TipitakaChannels200Response';
+        $request = $this->getApiV3TipitakaChannelsRequest($per_page, $type, $lang, $min_progress, $page, $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 'getApiV3TipitakaChannels'
+     *
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 20)
+     * @param  string|null $type channel 类型 (optional)
+     * @param  string|null $lang 译文语族(progress_chapters.lang,zh 涵盖简繁) (optional)
+     * @param  float|null $min_progress 章节完成度门槛 0–1 (optional, default to 0.8)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaChannels'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3TipitakaChannelsRequest($per_page = 20, $type = null, $lang = null, $min_progress = 0.8, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaChannels'][0])
+    {
+
+
+
+
+
+
+
+        $resourcePath = '/v3/tipitaka-channels';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $per_page,
+            'per_page', // param base name
+            'integer', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $type,
+            'type', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $lang,
+            'lang', // param base name
+            'string', // openApiType
+            'form', // style
+            true, // explode
+            false // required
+        ) ?? []);
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $min_progress,
+            'min_progress', // param base name
+            'number', // 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
+        ) ?? []);
+
+
+
+
+        $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;
+    }
+}

+ 537 - 0
api-test/client/lib/Api/TipitakaParagraphChannelsApi.php

@@ -0,0 +1,537 @@
+<?php
+/**
+ * TipitakaParagraphChannelsApi
+ * 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;
+
+/**
+ * TipitakaParagraphChannelsApi Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+class TipitakaParagraphChannelsApi
+{
+    /**
+     * @var ClientInterface
+     */
+    protected $client;
+
+    /**
+     * @var Configuration
+     */
+    protected $config;
+
+    /**
+     * @var HeaderSelector
+     */
+    protected $headerSelector;
+
+    /**
+     * @var int Host index
+     */
+    protected $hostIndex;
+
+    /** @var string[] $contentTypes **/
+    public const contentTypes = [
+        'getApiV3TipitakaParagraphChannelsBookPara' => [
+            '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 getApiV3TipitakaParagraphChannelsBookPara
+     *
+     * 列出某段有内容的 channel
+     *
+     * @param  int $book 书 (required)
+     * @param  int $para 段 (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 100)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'] 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\GetApiV3Channels200Response|\WikipaliApi\Model\ProblemDetails
+     */
+    public function getApiV3TipitakaParagraphChannelsBookPara($book, $para, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'][0])
+    {
+        list($response) = $this->getApiV3TipitakaParagraphChannelsBookParaWithHttpInfo($book, $para, $per_page, $page, $contentType);
+        return $response;
+    }
+
+    /**
+     * Operation getApiV3TipitakaParagraphChannelsBookParaWithHttpInfo
+     *
+     * 列出某段有内容的 channel
+     *
+     * @param  int $book 书 (required)
+     * @param  int $para 段 (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 100)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'] 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\GetApiV3Channels200Response|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function getApiV3TipitakaParagraphChannelsBookParaWithHttpInfo($book, $para, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'][0])
+    {
+        $request = $this->getApiV3TipitakaParagraphChannelsBookParaRequest($book, $para, $per_page, $page, $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\GetApiV3Channels200Response',
+                        $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\GetApiV3Channels200Response',
+                $request,
+                $response,
+            );
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\GetApiV3Channels200Response',
+                        $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 getApiV3TipitakaParagraphChannelsBookParaAsync
+     *
+     * 列出某段有内容的 channel
+     *
+     * @param  int $book 书 (required)
+     * @param  int $para 段 (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 100)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3TipitakaParagraphChannelsBookParaAsync($book, $para, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'][0])
+    {
+        return $this->getApiV3TipitakaParagraphChannelsBookParaAsyncWithHttpInfo($book, $para, $per_page, $page, $contentType)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation getApiV3TipitakaParagraphChannelsBookParaAsyncWithHttpInfo
+     *
+     * 列出某段有内容的 channel
+     *
+     * @param  int $book 书 (required)
+     * @param  int $para 段 (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 100)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function getApiV3TipitakaParagraphChannelsBookParaAsyncWithHttpInfo($book, $para, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'][0])
+    {
+        $returnType = '\WikipaliApi\Model\GetApiV3Channels200Response';
+        $request = $this->getApiV3TipitakaParagraphChannelsBookParaRequest($book, $para, $per_page, $page, $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 'getApiV3TipitakaParagraphChannelsBookPara'
+     *
+     * @param  int $book 书 (required)
+     * @param  int $para 段 (required)
+     * @param  int|null $per_page 每页数量,最大 200 (optional, default to 100)
+     * @param  int|null $page 页码 (optional, default to 1)
+     * @param  string $contentType The value for the Content-Type header. Check self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'] to see the possible values for this operation
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function getApiV3TipitakaParagraphChannelsBookParaRequest($book, $para, $per_page = 100, $page = 1, string $contentType = self::contentTypes['getApiV3TipitakaParagraphChannelsBookPara'][0])
+    {
+
+        // verify the required parameter 'book' is set
+        if ($book === null || (is_array($book) && count($book) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $book when calling getApiV3TipitakaParagraphChannelsBookPara'
+            );
+        }
+
+        // verify the required parameter 'para' is set
+        if ($para === null || (is_array($para) && count($para) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $para when calling getApiV3TipitakaParagraphChannelsBookPara'
+            );
+        }
+
+
+
+
+        $resourcePath = '/v3/tipitaka-paragraph-channels/{book}/{para}';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+        // query params
+        $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+            $per_page,
+            'per_page', // param base name
+            'integer', // 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
+        ) ?? []);
+
+
+        // path params
+        if ($book !== null) {
+            $resourcePath = str_replace(
+                '{book}',
+                ObjectSerializer::toPathValue($book),
+                $resourcePath
+            );
+        }
+        // path params
+        if ($para !== null) {
+            $resourcePath = str_replace(
+                '{para}',
+                ObjectSerializer::toPathValue($para),
+                $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;
+    }
+}

+ 16 - 2
api-test/client/lib/Api/TipitakaReadingApi.php

@@ -144,7 +144,7 @@ class TipitakaReadingApi
      *
      * @throws \WikipaliApi\ApiException on non-2xx response or if the response body is not in the expected format
      * @throws \InvalidArgumentException
-     * @return \WikipaliApi\Model\GetApiV3TipitakaReadingChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
+     * @return \WikipaliApi\Model\GetApiV3TipitakaReadingChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails
      */
     public function getApiV3TipitakaReadingChannel($channel, $book = null, $chapter = null, $para = null, $to = null, $after = null, $page_size = 10, $unit = 'para', $format = 'html', $include = 'display', string $contentType = self::contentTypes['getApiV3TipitakaReadingChannel'][0])
     {
@@ -171,7 +171,7 @@ class TipitakaReadingApi
      *
      * @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\GetApiV3TipitakaReadingChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
+     * @return array of \WikipaliApi\Model\GetApiV3TipitakaReadingChannel200Response|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails|\WikipaliApi\Model\ProblemDetails, HTTP status code, HTTP response headers (array of strings)
      */
     public function getApiV3TipitakaReadingChannelWithHttpInfo($channel, $book = null, $chapter = null, $para = null, $to = null, $after = null, $page_size = 10, $unit = 'para', $format = 'html', $include = 'display', string $contentType = self::contentTypes['getApiV3TipitakaReadingChannel'][0])
     {
@@ -207,6 +207,12 @@ class TipitakaReadingApi
                         $request,
                         $response,
                     );
+                case 403:
+                    return $this->handleResponseWithDataType(
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $request,
+                        $response,
+                    );
                 case 404:
                     return $this->handleResponseWithDataType(
                         '\WikipaliApi\Model\ProblemDetails',
@@ -251,6 +257,14 @@ class TipitakaReadingApi
                     );
                     $e->setResponseObject($data);
                     throw $e;
+                case 403:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\WikipaliApi\Model\ProblemDetails',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    throw $e;
                 case 404:
                     $data = ObjectSerializer::deserialize(
                         $e->getResponseBody(),

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

@@ -0,0 +1,443 @@
+<?php
+/**
+ * GetApiV3Channels200Response
+ *
+ * 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;
+
+/**
+ * GetApiV3Channels200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3Channels200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3Channels200ResponseDataInner[]',
+        'meta' => '\WikipaliApi\Model\PaginationMeta'
+    ];
+
+    /**
+     * 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\GetApiV3Channels200ResponseDataInner[]|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3Channels200ResponseDataInner[]|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\PaginationMeta|null
+     */
+    public function getMeta()
+    {
+        return $this->container['meta'];
+    }
+
+    /**
+     * Sets meta
+     *
+     * @param \WikipaliApi\Model\PaginationMeta|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));
+    }
+}
+
+

+ 872 - 0
api-test/client/lib/Model/GetApiV3Channels200ResponseDataInner.php

@@ -0,0 +1,872 @@
+<?php
+/**
+ * GetApiV3Channels200ResponseDataInner
+ *
+ * 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;
+
+/**
+ * GetApiV3Channels200ResponseDataInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3Channels200ResponseDataInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_200_response_data_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'name' => 'string',
+        'summary' => 'string',
+        'type' => 'string',
+        'lang' => 'string',
+        'status' => 'int',
+        'is_system' => 'bool',
+        'source_type' => 'string',
+        'source_id' => 'string',
+        'owner' => '\WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerOwner',
+        'abilities' => '\WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerAbilities',
+        'progress' => 'float',
+        'created_at' => 'string',
+        'updated_at' => '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,
+        'name' => null,
+        'summary' => null,
+        'type' => null,
+        'lang' => null,
+        'status' => null,
+        'is_system' => null,
+        'source_type' => null,
+        'source_id' => null,
+        'owner' => null,
+        'abilities' => null,
+        'progress' => null,
+        'created_at' => null,
+        'updated_at' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'name' => false,
+        'summary' => true,
+        'type' => false,
+        'lang' => false,
+        'status' => false,
+        'is_system' => false,
+        'source_type' => false,
+        'source_id' => true,
+        'owner' => false,
+        'abilities' => false,
+        'progress' => true,
+        'created_at' => false,
+        'updated_at' => 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',
+        'name' => 'name',
+        'summary' => 'summary',
+        'type' => 'type',
+        'lang' => 'lang',
+        'status' => 'status',
+        'is_system' => 'is_system',
+        'source_type' => 'source_type',
+        'source_id' => 'source_id',
+        'owner' => 'owner',
+        'abilities' => 'abilities',
+        'progress' => 'progress',
+        'created_at' => 'created_at',
+        'updated_at' => 'updated_at'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'name' => 'setName',
+        'summary' => 'setSummary',
+        'type' => 'setType',
+        'lang' => 'setLang',
+        'status' => 'setStatus',
+        'is_system' => 'setIsSystem',
+        'source_type' => 'setSourceType',
+        'source_id' => 'setSourceId',
+        'owner' => 'setOwner',
+        'abilities' => 'setAbilities',
+        'progress' => 'setProgress',
+        'created_at' => 'setCreatedAt',
+        'updated_at' => 'setUpdatedAt'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'name' => 'getName',
+        'summary' => 'getSummary',
+        'type' => 'getType',
+        'lang' => 'getLang',
+        'status' => 'getStatus',
+        'is_system' => 'getIsSystem',
+        'source_type' => 'getSourceType',
+        'source_id' => 'getSourceId',
+        'owner' => 'getOwner',
+        'abilities' => 'getAbilities',
+        'progress' => 'getProgress',
+        'created_at' => 'getCreatedAt',
+        'updated_at' => 'getUpdatedAt'
+    ];
+
+    /**
+     * 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('name', $data ?? [], null);
+        $this->setIfExists('summary', $data ?? [], null);
+        $this->setIfExists('type', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('status', $data ?? [], null);
+        $this->setIfExists('is_system', $data ?? [], null);
+        $this->setIfExists('source_type', $data ?? [], null);
+        $this->setIfExists('source_id', $data ?? [], null);
+        $this->setIfExists('owner', $data ?? [], null);
+        $this->setIfExists('abilities', $data ?? [], null);
+        $this->setIfExists('progress', $data ?? [], null);
+        $this->setIfExists('created_at', $data ?? [], null);
+        $this->setIfExists('updated_at', $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 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 summary
+     *
+     * @return string|null
+     */
+    public function getSummary()
+    {
+        return $this->container['summary'];
+    }
+
+    /**
+     * Sets summary
+     *
+     * @param string|null $summary summary
+     *
+     * @return self
+     */
+    public function setSummary($summary)
+    {
+        if (is_null($summary)) {
+            array_push($this->openAPINullablesSetToNull, 'summary');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('summary', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['summary'] = $summary;
+
+        return $this;
+    }
+
+    /**
+     * Gets type
+     *
+     * @return string|null
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string|null $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $this->container['type'] = $type;
+
+        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 status
+     *
+     * @return int|null
+     */
+    public function getStatus()
+    {
+        return $this->container['status'];
+    }
+
+    /**
+     * Sets status
+     *
+     * @param int|null $status status
+     *
+     * @return self
+     */
+    public function setStatus($status)
+    {
+        if (is_null($status)) {
+            throw new \InvalidArgumentException('non-nullable status cannot be null');
+        }
+        $this->container['status'] = $status;
+
+        return $this;
+    }
+
+    /**
+     * Gets is_system
+     *
+     * @return bool|null
+     */
+    public function getIsSystem()
+    {
+        return $this->container['is_system'];
+    }
+
+    /**
+     * Sets is_system
+     *
+     * @param bool|null $is_system is_system
+     *
+     * @return self
+     */
+    public function setIsSystem($is_system)
+    {
+        if (is_null($is_system)) {
+            throw new \InvalidArgumentException('non-nullable is_system cannot be null');
+        }
+        $this->container['is_system'] = $is_system;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_type
+     *
+     * @return string|null
+     */
+    public function getSourceType()
+    {
+        return $this->container['source_type'];
+    }
+
+    /**
+     * Sets source_type
+     *
+     * @param string|null $source_type source_type
+     *
+     * @return self
+     */
+    public function setSourceType($source_type)
+    {
+        if (is_null($source_type)) {
+            throw new \InvalidArgumentException('non-nullable source_type cannot be null');
+        }
+        $this->container['source_type'] = $source_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_id
+     *
+     * @return string|null
+     */
+    public function getSourceId()
+    {
+        return $this->container['source_id'];
+    }
+
+    /**
+     * Sets source_id
+     *
+     * @param string|null $source_id source_id
+     *
+     * @return self
+     */
+    public function setSourceId($source_id)
+    {
+        if (is_null($source_id)) {
+            array_push($this->openAPINullablesSetToNull, 'source_id');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('source_id', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['source_id'] = $source_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets owner
+     *
+     * @return \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerOwner|null
+     */
+    public function getOwner()
+    {
+        return $this->container['owner'];
+    }
+
+    /**
+     * Sets owner
+     *
+     * @param \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerOwner|null $owner owner
+     *
+     * @return self
+     */
+    public function setOwner($owner)
+    {
+        if (is_null($owner)) {
+            throw new \InvalidArgumentException('non-nullable owner cannot be null');
+        }
+        $this->container['owner'] = $owner;
+
+        return $this;
+    }
+
+    /**
+     * Gets abilities
+     *
+     * @return \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerAbilities|null
+     */
+    public function getAbilities()
+    {
+        return $this->container['abilities'];
+    }
+
+    /**
+     * Sets abilities
+     *
+     * @param \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerAbilities|null $abilities abilities
+     *
+     * @return self
+     */
+    public function setAbilities($abilities)
+    {
+        if (is_null($abilities)) {
+            throw new \InvalidArgumentException('non-nullable abilities cannot be null');
+        }
+        $this->container['abilities'] = $abilities;
+
+        return $this;
+    }
+
+    /**
+     * Gets progress
+     *
+     * @return float|null
+     */
+    public function getProgress()
+    {
+        return $this->container['progress'];
+    }
+
+    /**
+     * Sets progress
+     *
+     * @param float|null $progress 仅在部分查询口径下返回。
+     *
+     * @return self
+     */
+    public function setProgress($progress)
+    {
+        if (is_null($progress)) {
+            array_push($this->openAPINullablesSetToNull, 'progress');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('progress', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['progress'] = $progress;
+
+        return $this;
+    }
+
+    /**
+     * Gets created_at
+     *
+     * @return string|null
+     */
+    public function getCreatedAt()
+    {
+        return $this->container['created_at'];
+    }
+
+    /**
+     * Sets created_at
+     *
+     * @param string|null $created_at created_at
+     *
+     * @return self
+     */
+    public function setCreatedAt($created_at)
+    {
+        if (is_null($created_at)) {
+            throw new \InvalidArgumentException('non-nullable created_at cannot be null');
+        }
+        $this->container['created_at'] = $created_at;
+
+        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)) {
+            throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
+        }
+        $this->container['updated_at'] = $updated_at;
+
+        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));
+    }
+}
+
+

+ 511 - 0
api-test/client/lib/Model/GetApiV3Channels200ResponseDataInnerAbilities.php

@@ -0,0 +1,511 @@
+<?php
+/**
+ * GetApiV3Channels200ResponseDataInnerAbilities
+ *
+ * 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;
+
+/**
+ * GetApiV3Channels200ResponseDataInnerAbilities Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3Channels200ResponseDataInnerAbilities implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_200_response_data_inner_abilities';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'read' => 'bool',
+        'write' => 'bool',
+        'update' => 'bool',
+        'delete' => 'bool'
+    ];
+
+    /**
+     * 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 = [
+        'read' => null,
+        'write' => null,
+        'update' => null,
+        'delete' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'read' => false,
+        'write' => false,
+        'update' => false,
+        'delete' => 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 = [
+        'read' => 'read',
+        'write' => 'write',
+        'update' => 'update',
+        'delete' => 'delete'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'read' => 'setRead',
+        'write' => 'setWrite',
+        'update' => 'setUpdate',
+        'delete' => 'setDelete'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'read' => 'getRead',
+        'write' => 'getWrite',
+        'update' => 'getUpdate',
+        'delete' => 'getDelete'
+    ];
+
+    /**
+     * 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('read', $data ?? [], null);
+        $this->setIfExists('write', $data ?? [], null);
+        $this->setIfExists('update', $data ?? [], null);
+        $this->setIfExists('delete', $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 read
+     *
+     * @return bool|null
+     */
+    public function getRead()
+    {
+        return $this->container['read'];
+    }
+
+    /**
+     * Sets read
+     *
+     * @param bool|null $read read
+     *
+     * @return self
+     */
+    public function setRead($read)
+    {
+        if (is_null($read)) {
+            throw new \InvalidArgumentException('non-nullable read cannot be null');
+        }
+        $this->container['read'] = $read;
+
+        return $this;
+    }
+
+    /**
+     * Gets write
+     *
+     * @return bool|null
+     */
+    public function getWrite()
+    {
+        return $this->container['write'];
+    }
+
+    /**
+     * Sets write
+     *
+     * @param bool|null $write write
+     *
+     * @return self
+     */
+    public function setWrite($write)
+    {
+        if (is_null($write)) {
+            throw new \InvalidArgumentException('non-nullable write cannot be null');
+        }
+        $this->container['write'] = $write;
+
+        return $this;
+    }
+
+    /**
+     * Gets update
+     *
+     * @return bool|null
+     */
+    public function getUpdate()
+    {
+        return $this->container['update'];
+    }
+
+    /**
+     * Sets update
+     *
+     * @param bool|null $update update
+     *
+     * @return self
+     */
+    public function setUpdate($update)
+    {
+        if (is_null($update)) {
+            throw new \InvalidArgumentException('non-nullable update cannot be null');
+        }
+        $this->container['update'] = $update;
+
+        return $this;
+    }
+
+    /**
+     * Gets delete
+     *
+     * @return bool|null
+     */
+    public function getDelete()
+    {
+        return $this->container['delete'];
+    }
+
+    /**
+     * Sets delete
+     *
+     * @param bool|null $delete delete
+     *
+     * @return self
+     */
+    public function setDelete($delete)
+    {
+        if (is_null($delete)) {
+            throw new \InvalidArgumentException('non-nullable delete cannot be null');
+        }
+        $this->container['delete'] = $delete;
+
+        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));
+    }
+}
+
+

+ 552 - 0
api-test/client/lib/Model/GetApiV3Channels200ResponseDataInnerOwner.php

@@ -0,0 +1,552 @@
+<?php
+/**
+ * GetApiV3Channels200ResponseDataInnerOwner
+ *
+ * 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;
+
+/**
+ * GetApiV3Channels200ResponseDataInnerOwner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3Channels200ResponseDataInnerOwner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_200_response_data_inner_owner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'kind' => 'string',
+        'id' => 'string',
+        'nick_name' => 'string',
+        'real_name' => 'string',
+        'avatar' => '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 = [
+        'kind' => null,
+        'id' => null,
+        'nick_name' => null,
+        'real_name' => null,
+        'avatar' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'kind' => false,
+        'id' => false,
+        'nick_name' => false,
+        'real_name' => false,
+        'avatar' => true
+    ];
+
+    /**
+     * 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 = [
+        'kind' => 'kind',
+        'id' => 'id',
+        'nick_name' => 'nickName',
+        'real_name' => 'realName',
+        'avatar' => 'avatar'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'kind' => 'setKind',
+        'id' => 'setId',
+        'nick_name' => 'setNickName',
+        'real_name' => 'setRealName',
+        'avatar' => 'setAvatar'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'kind' => 'getKind',
+        'id' => 'getId',
+        'nick_name' => 'getNickName',
+        'real_name' => 'getRealName',
+        'avatar' => 'getAvatar'
+    ];
+
+    /**
+     * 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('kind', $data ?? [], null);
+        $this->setIfExists('id', $data ?? [], null);
+        $this->setIfExists('nick_name', $data ?? [], null);
+        $this->setIfExists('real_name', $data ?? [], null);
+        $this->setIfExists('avatar', $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 kind
+     *
+     * @return string|null
+     */
+    public function getKind()
+    {
+        return $this->container['kind'];
+    }
+
+    /**
+     * Sets kind
+     *
+     * @param string|null $kind kind
+     *
+     * @return self
+     */
+    public function setKind($kind)
+    {
+        if (is_null($kind)) {
+            throw new \InvalidArgumentException('non-nullable kind cannot be null');
+        }
+        $this->container['kind'] = $kind;
+
+        return $this;
+    }
+
+    /**
+     * 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 nick_name
+     *
+     * @return string|null
+     */
+    public function getNickName()
+    {
+        return $this->container['nick_name'];
+    }
+
+    /**
+     * Sets nick_name
+     *
+     * @param string|null $nick_name nick_name
+     *
+     * @return self
+     */
+    public function setNickName($nick_name)
+    {
+        if (is_null($nick_name)) {
+            throw new \InvalidArgumentException('non-nullable nick_name cannot be null');
+        }
+        $this->container['nick_name'] = $nick_name;
+
+        return $this;
+    }
+
+    /**
+     * Gets real_name
+     *
+     * @return string|null
+     */
+    public function getRealName()
+    {
+        return $this->container['real_name'];
+    }
+
+    /**
+     * Sets real_name
+     *
+     * @param string|null $real_name real_name
+     *
+     * @return self
+     */
+    public function setRealName($real_name)
+    {
+        if (is_null($real_name)) {
+            throw new \InvalidArgumentException('non-nullable real_name cannot be null');
+        }
+        $this->container['real_name'] = $real_name;
+
+        return $this;
+    }
+
+    /**
+     * Gets avatar
+     *
+     * @return string|null
+     */
+    public function getAvatar()
+    {
+        return $this->container['avatar'];
+    }
+
+    /**
+     * Sets avatar
+     *
+     * @param string|null $avatar avatar
+     *
+     * @return self
+     */
+    public function setAvatar($avatar)
+    {
+        if (is_null($avatar)) {
+            array_push($this->openAPINullablesSetToNull, 'avatar');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('avatar', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['avatar'] = $avatar;
+
+        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/GetApiV3ChannelsChannel200Response.php

@@ -0,0 +1,409 @@
+<?php
+/**
+ * GetApiV3ChannelsChannel200Response
+ *
+ * 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;
+
+/**
+ * GetApiV3ChannelsChannel200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannel200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel__200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3Channels200ResponseDataInner'
+    ];
+
+    /**
+     * 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\GetApiV3Channels200ResponseDataInner|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3Channels200ResponseDataInner|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/GetApiV3ChannelsChannelLinks200Response.php

@@ -0,0 +1,409 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelLinks200Response
+ *
+ * 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;
+
+/**
+ * GetApiV3ChannelsChannelLinks200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelLinks200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_links_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseData'
+    ];
+
+    /**
+     * 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\GetApiV3ChannelsChannelLinks200ResponseData|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseData|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));
+    }
+}
+
+

+ 593 - 0
api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseData.php

@@ -0,0 +1,593 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseData
+ *
+ * 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;
+
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseData Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelLinks200ResponseData implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_links_200_response_data';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'channel_id' => 'string',
+        'derived_from' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom',
+        'wbw' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom',
+        'fallback' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]',
+        'term_source' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]',
+        'can_update' => 'bool'
+    ];
+
+    /**
+     * 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 = [
+        'channel_id' => null,
+        'derived_from' => null,
+        'wbw' => null,
+        'fallback' => null,
+        'term_source' => null,
+        'can_update' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'channel_id' => false,
+        'derived_from' => true,
+        'wbw' => true,
+        'fallback' => false,
+        'term_source' => false,
+        'can_update' => 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 = [
+        'channel_id' => 'channel_id',
+        'derived_from' => 'derived_from',
+        'wbw' => 'wbw',
+        'fallback' => 'fallback',
+        'term_source' => 'term_source',
+        'can_update' => 'can_update'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'channel_id' => 'setChannelId',
+        'derived_from' => 'setDerivedFrom',
+        'wbw' => 'setWbw',
+        'fallback' => 'setFallback',
+        'term_source' => 'setTermSource',
+        'can_update' => 'setCanUpdate'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'channel_id' => 'getChannelId',
+        'derived_from' => 'getDerivedFrom',
+        'wbw' => 'getWbw',
+        'fallback' => 'getFallback',
+        'term_source' => 'getTermSource',
+        'can_update' => 'getCanUpdate'
+    ];
+
+    /**
+     * 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('channel_id', $data ?? [], null);
+        $this->setIfExists('derived_from', $data ?? [], null);
+        $this->setIfExists('wbw', $data ?? [], null);
+        $this->setIfExists('fallback', $data ?? [], null);
+        $this->setIfExists('term_source', $data ?? [], null);
+        $this->setIfExists('can_update', $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 channel_id
+     *
+     * @return string|null
+     */
+    public function getChannelId()
+    {
+        return $this->container['channel_id'];
+    }
+
+    /**
+     * Sets channel_id
+     *
+     * @param string|null $channel_id channel_id
+     *
+     * @return self
+     */
+    public function setChannelId($channel_id)
+    {
+        if (is_null($channel_id)) {
+            throw new \InvalidArgumentException('non-nullable channel_id cannot be null');
+        }
+        $this->container['channel_id'] = $channel_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets derived_from
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom|null
+     */
+    public function getDerivedFrom()
+    {
+        return $this->container['derived_from'];
+    }
+
+    /**
+     * Sets derived_from
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom|null $derived_from derived_from
+     *
+     * @return self
+     */
+    public function setDerivedFrom($derived_from)
+    {
+        if (is_null($derived_from)) {
+            array_push($this->openAPINullablesSetToNull, 'derived_from');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('derived_from', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['derived_from'] = $derived_from;
+
+        return $this;
+    }
+
+    /**
+     * Gets wbw
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom|null
+     */
+    public function getWbw()
+    {
+        return $this->container['wbw'];
+    }
+
+    /**
+     * Sets wbw
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom|null $wbw wbw
+     *
+     * @return self
+     */
+    public function setWbw($wbw)
+    {
+        if (is_null($wbw)) {
+            array_push($this->openAPINullablesSetToNull, 'wbw');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('wbw', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['wbw'] = $wbw;
+
+        return $this;
+    }
+
+    /**
+     * Gets fallback
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]|null
+     */
+    public function getFallback()
+    {
+        return $this->container['fallback'];
+    }
+
+    /**
+     * Sets fallback
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]|null $fallback fallback
+     *
+     * @return self
+     */
+    public function setFallback($fallback)
+    {
+        if (is_null($fallback)) {
+            throw new \InvalidArgumentException('non-nullable fallback cannot be null');
+        }
+        $this->container['fallback'] = $fallback;
+
+        return $this;
+    }
+
+    /**
+     * Gets term_source
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]|null
+     */
+    public function getTermSource()
+    {
+        return $this->container['term_source'];
+    }
+
+    /**
+     * Sets term_source
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]|null $term_source term_source
+     *
+     * @return self
+     */
+    public function setTermSource($term_source)
+    {
+        if (is_null($term_source)) {
+            throw new \InvalidArgumentException('non-nullable term_source cannot be null');
+        }
+        $this->container['term_source'] = $term_source;
+
+        return $this;
+    }
+
+    /**
+     * Gets can_update
+     *
+     * @return bool|null
+     */
+    public function getCanUpdate()
+    {
+        return $this->container['can_update'];
+    }
+
+    /**
+     * Sets can_update
+     *
+     * @param bool|null $can_update can_update
+     *
+     * @return self
+     */
+    public function setCanUpdate($can_update)
+    {
+        if (is_null($can_update)) {
+            throw new \InvalidArgumentException('non-nullable can_update cannot be null');
+        }
+        $this->container['can_update'] = $can_update;
+
+        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/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom.php

@@ -0,0 +1,545 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom
+ *
+ * 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;
+
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_links_200_response_data_derived_from';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'name' => 'string',
+        'type' => 'string',
+        'lang' => 'string',
+        'status' => '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 = [
+        'id' => null,
+        'name' => null,
+        'type' => null,
+        'lang' => null,
+        'status' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'name' => false,
+        'type' => false,
+        'lang' => false,
+        'status' => 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',
+        'name' => 'name',
+        'type' => 'type',
+        'lang' => 'lang',
+        'status' => 'status'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'name' => 'setName',
+        'type' => 'setType',
+        'lang' => 'setLang',
+        'status' => 'setStatus'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'name' => 'getName',
+        'type' => 'getType',
+        'lang' => 'getLang',
+        'status' => 'getStatus'
+    ];
+
+    /**
+     * 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('name', $data ?? [], null);
+        $this->setIfExists('type', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('status', $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 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 type
+     *
+     * @return string|null
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string|null $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $this->container['type'] = $type;
+
+        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 status
+     *
+     * @return int|null
+     */
+    public function getStatus()
+    {
+        return $this->container['status'];
+    }
+
+    /**
+     * Sets status
+     *
+     * @param int|null $status status
+     *
+     * @return self
+     */
+    public function setStatus($status)
+    {
+        if (is_null($status)) {
+            throw new \InvalidArgumentException('non-nullable status cannot be null');
+        }
+        $this->container['status'] = $status;
+
+        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/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner.php

@@ -0,0 +1,545 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner
+ *
+ * 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;
+
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_links_200_response_data_fallback_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'name' => 'string',
+        'type' => 'string',
+        'lang' => 'string',
+        'status' => '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 = [
+        'id' => null,
+        'name' => null,
+        'type' => null,
+        'lang' => null,
+        'status' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'name' => false,
+        'type' => false,
+        'lang' => false,
+        'status' => 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',
+        'name' => 'name',
+        'type' => 'type',
+        'lang' => 'lang',
+        'status' => 'status'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'name' => 'setName',
+        'type' => 'setType',
+        'lang' => 'setLang',
+        'status' => 'setStatus'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'name' => 'getName',
+        'type' => 'getType',
+        'lang' => 'getLang',
+        'status' => 'getStatus'
+    ];
+
+    /**
+     * 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('name', $data ?? [], null);
+        $this->setIfExists('type', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('status', $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 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 type
+     *
+     * @return string|null
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string|null $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $this->container['type'] = $type;
+
+        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 status
+     *
+     * @return int|null
+     */
+    public function getStatus()
+    {
+        return $this->container['status'];
+    }
+
+    /**
+     * Sets status
+     *
+     * @param int|null $status status
+     *
+     * @return self
+     */
+    public function setStatus($status)
+    {
+        if (is_null($status)) {
+            throw new \InvalidArgumentException('non-nullable status cannot be null');
+        }
+        $this->container['status'] = $status;
+
+        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/GetApiV3ChannelsChannelTerms200Response.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelTerms200Response
+ *
+ * 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;
+
+/**
+ * GetApiV3ChannelsChannelTerms200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelTerms200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_terms_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInner[]',
+        'meta' => '\WikipaliApi\Model\PaginationMeta'
+    ];
+
+    /**
+     * 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\GetApiV3ChannelsChannelTerms200ResponseDataInner[]|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInner[]|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\PaginationMeta|null
+     */
+    public function getMeta()
+    {
+        return $this->container['meta'];
+    }
+
+    /**
+     * Sets meta
+     *
+     * @param \WikipaliApi\Model\PaginationMeta|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));
+    }
+}
+
+

+ 1302 - 0
api-test/client/lib/Model/GetApiV3ChannelsChannelTerms200ResponseDataInner.php

@@ -0,0 +1,1302 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelTerms200ResponseDataInner
+ *
+ * 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;
+
+/**
+ * GetApiV3ChannelsChannelTerms200ResponseDataInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelTerms200ResponseDataInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_terms_200_response_data_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'word' => 'string',
+        'tag' => 'string',
+        'meaning' => 'string',
+        'other_meaning' => 'string',
+        'language' => 'string',
+        'channel_id' => 'string',
+        'channel' => '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel',
+        'owner_id' => 'string',
+        'quality' => 'string',
+        'content_type' => 'string',
+        'summary' => 'string',
+        'note' => 'string',
+        'redirect' => 'string',
+        'categories' => 'string[]',
+        'summary_text' => 'string',
+        'body' => '\WikipaliApi\Model\MarkupNode[]',
+        'html' => 'string',
+        'editor' => '\WikipaliApi\Model\GetApiV3AdminAgentRuns200ResponseDataInnerUser',
+        'co_editor' => '\WikipaliApi\Model\GetApiV3AdminAgentRuns200ResponseDataInnerUser',
+        'etag' => 'string',
+        'abilities' => '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities',
+        'created_at' => 'string',
+        'updated_at' => 'string',
+        'deleted_at' => '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,
+        'word' => null,
+        'tag' => null,
+        'meaning' => null,
+        'other_meaning' => null,
+        'language' => null,
+        'channel_id' => null,
+        'channel' => null,
+        'owner_id' => null,
+        'quality' => null,
+        'content_type' => null,
+        'summary' => null,
+        'note' => null,
+        'redirect' => null,
+        'categories' => null,
+        'summary_text' => null,
+        'body' => null,
+        'html' => null,
+        'editor' => null,
+        'co_editor' => null,
+        'etag' => null,
+        'abilities' => null,
+        'created_at' => null,
+        'updated_at' => null,
+        'deleted_at' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'word' => false,
+        'tag' => true,
+        'meaning' => false,
+        'other_meaning' => true,
+        'language' => false,
+        'channel_id' => true,
+        'channel' => true,
+        'owner_id' => false,
+        'quality' => true,
+        'content_type' => false,
+        'summary' => true,
+        'note' => true,
+        'redirect' => true,
+        'categories' => false,
+        'summary_text' => false,
+        'body' => false,
+        'html' => false,
+        'editor' => true,
+        'co_editor' => true,
+        'etag' => false,
+        'abilities' => false,
+        'created_at' => false,
+        'updated_at' => false,
+        'deleted_at' => true
+    ];
+
+    /**
+     * 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',
+        'other_meaning' => 'other_meaning',
+        'language' => 'language',
+        'channel_id' => 'channel_id',
+        'channel' => 'channel',
+        'owner_id' => 'owner_id',
+        'quality' => 'quality',
+        'content_type' => 'content_type',
+        'summary' => 'summary',
+        'note' => 'note',
+        'redirect' => 'redirect',
+        'categories' => 'categories',
+        'summary_text' => 'summary_text',
+        'body' => 'body',
+        'html' => 'html',
+        'editor' => 'editor',
+        'co_editor' => 'co_editor',
+        'etag' => 'etag',
+        'abilities' => 'abilities',
+        'created_at' => 'created_at',
+        'updated_at' => 'updated_at',
+        'deleted_at' => 'deleted_at'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'word' => 'setWord',
+        'tag' => 'setTag',
+        'meaning' => 'setMeaning',
+        'other_meaning' => 'setOtherMeaning',
+        'language' => 'setLanguage',
+        'channel_id' => 'setChannelId',
+        'channel' => 'setChannel',
+        'owner_id' => 'setOwnerId',
+        'quality' => 'setQuality',
+        'content_type' => 'setContentType',
+        'summary' => 'setSummary',
+        'note' => 'setNote',
+        'redirect' => 'setRedirect',
+        'categories' => 'setCategories',
+        'summary_text' => 'setSummaryText',
+        'body' => 'setBody',
+        'html' => 'setHtml',
+        'editor' => 'setEditor',
+        'co_editor' => 'setCoEditor',
+        'etag' => 'setEtag',
+        'abilities' => 'setAbilities',
+        'created_at' => 'setCreatedAt',
+        'updated_at' => 'setUpdatedAt',
+        'deleted_at' => 'setDeletedAt'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'word' => 'getWord',
+        'tag' => 'getTag',
+        'meaning' => 'getMeaning',
+        'other_meaning' => 'getOtherMeaning',
+        'language' => 'getLanguage',
+        'channel_id' => 'getChannelId',
+        'channel' => 'getChannel',
+        'owner_id' => 'getOwnerId',
+        'quality' => 'getQuality',
+        'content_type' => 'getContentType',
+        'summary' => 'getSummary',
+        'note' => 'getNote',
+        'redirect' => 'getRedirect',
+        'categories' => 'getCategories',
+        'summary_text' => 'getSummaryText',
+        'body' => 'getBody',
+        'html' => 'getHtml',
+        'editor' => 'getEditor',
+        'co_editor' => 'getCoEditor',
+        'etag' => 'getEtag',
+        'abilities' => 'getAbilities',
+        'created_at' => 'getCreatedAt',
+        'updated_at' => 'getUpdatedAt',
+        'deleted_at' => 'getDeletedAt'
+    ];
+
+    /**
+     * 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('other_meaning', $data ?? [], null);
+        $this->setIfExists('language', $data ?? [], null);
+        $this->setIfExists('channel_id', $data ?? [], null);
+        $this->setIfExists('channel', $data ?? [], null);
+        $this->setIfExists('owner_id', $data ?? [], null);
+        $this->setIfExists('quality', $data ?? [], null);
+        $this->setIfExists('content_type', $data ?? [], null);
+        $this->setIfExists('summary', $data ?? [], null);
+        $this->setIfExists('note', $data ?? [], null);
+        $this->setIfExists('redirect', $data ?? [], null);
+        $this->setIfExists('categories', $data ?? [], null);
+        $this->setIfExists('summary_text', $data ?? [], null);
+        $this->setIfExists('body', $data ?? [], null);
+        $this->setIfExists('html', $data ?? [], null);
+        $this->setIfExists('editor', $data ?? [], null);
+        $this->setIfExists('co_editor', $data ?? [], null);
+        $this->setIfExists('etag', $data ?? [], null);
+        $this->setIfExists('abilities', $data ?? [], null);
+        $this->setIfExists('created_at', $data ?? [], null);
+        $this->setIfExists('updated_at', $data ?? [], null);
+        $this->setIfExists('deleted_at', $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)) {
+            array_push($this->openAPINullablesSetToNull, 'tag');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('tag', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $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 other_meaning
+     *
+     * @return string|null
+     */
+    public function getOtherMeaning()
+    {
+        return $this->container['other_meaning'];
+    }
+
+    /**
+     * Sets other_meaning
+     *
+     * @param string|null $other_meaning other_meaning
+     *
+     * @return self
+     */
+    public function setOtherMeaning($other_meaning)
+    {
+        if (is_null($other_meaning)) {
+            array_push($this->openAPINullablesSetToNull, 'other_meaning');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('other_meaning', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['other_meaning'] = $other_meaning;
+
+        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)) {
+            throw new \InvalidArgumentException('non-nullable language cannot be null');
+        }
+        $this->container['language'] = $language;
+
+        return $this;
+    }
+
+    /**
+     * Gets channel_id
+     *
+     * @return string|null
+     */
+    public function getChannelId()
+    {
+        return $this->container['channel_id'];
+    }
+
+    /**
+     * Sets channel_id
+     *
+     * @param string|null $channel_id channel_id
+     *
+     * @return self
+     */
+    public function setChannelId($channel_id)
+    {
+        if (is_null($channel_id)) {
+            array_push($this->openAPINullablesSetToNull, 'channel_id');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('channel_id', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['channel_id'] = $channel_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets channel
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel|null
+     */
+    public function getChannel()
+    {
+        return $this->container['channel'];
+    }
+
+    /**
+     * Sets channel
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel|null $channel channel
+     *
+     * @return self
+     */
+    public function setChannel($channel)
+    {
+        if (is_null($channel)) {
+            array_push($this->openAPINullablesSetToNull, 'channel');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('channel', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['channel'] = $channel;
+
+        return $this;
+    }
+
+    /**
+     * Gets owner_id
+     *
+     * @return string|null
+     */
+    public function getOwnerId()
+    {
+        return $this->container['owner_id'];
+    }
+
+    /**
+     * Sets owner_id
+     *
+     * @param string|null $owner_id owner_id
+     *
+     * @return self
+     */
+    public function setOwnerId($owner_id)
+    {
+        if (is_null($owner_id)) {
+            throw new \InvalidArgumentException('non-nullable owner_id cannot be null');
+        }
+        $this->container['owner_id'] = $owner_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets quality
+     *
+     * @return string|null
+     */
+    public function getQuality()
+    {
+        return $this->container['quality'];
+    }
+
+    /**
+     * Sets quality
+     *
+     * @param string|null $quality quality
+     *
+     * @return self
+     */
+    public function setQuality($quality)
+    {
+        if (is_null($quality)) {
+            array_push($this->openAPINullablesSetToNull, 'quality');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('quality', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['quality'] = $quality;
+
+        return $this;
+    }
+
+    /**
+     * Gets content_type
+     *
+     * @return string|null
+     */
+    public function getContentType()
+    {
+        return $this->container['content_type'];
+    }
+
+    /**
+     * Sets content_type
+     *
+     * @param string|null $content_type content_type
+     *
+     * @return self
+     */
+    public function setContentType($content_type)
+    {
+        if (is_null($content_type)) {
+            throw new \InvalidArgumentException('non-nullable content_type cannot be null');
+        }
+        $this->container['content_type'] = $content_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets summary
+     *
+     * @return string|null
+     */
+    public function getSummary()
+    {
+        return $this->container['summary'];
+    }
+
+    /**
+     * Sets summary
+     *
+     * @param string|null $summary summary
+     *
+     * @return self
+     */
+    public function setSummary($summary)
+    {
+        if (is_null($summary)) {
+            array_push($this->openAPINullablesSetToNull, 'summary');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('summary', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['summary'] = $summary;
+
+        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)) {
+            array_push($this->openAPINullablesSetToNull, 'note');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('note', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['note'] = $note;
+
+        return $this;
+    }
+
+    /**
+     * Gets redirect
+     *
+     * @return string|null
+     */
+    public function getRedirect()
+    {
+        return $this->container['redirect'];
+    }
+
+    /**
+     * Sets redirect
+     *
+     * @param string|null $redirect redirect
+     *
+     * @return self
+     */
+    public function setRedirect($redirect)
+    {
+        if (is_null($redirect)) {
+            array_push($this->openAPINullablesSetToNull, 'redirect');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('redirect', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['redirect'] = $redirect;
+
+        return $this;
+    }
+
+    /**
+     * Gets categories
+     *
+     * @return string[]|null
+     */
+    public function getCategories()
+    {
+        return $this->container['categories'];
+    }
+
+    /**
+     * Sets categories
+     *
+     * @param string[]|null $categories categories
+     *
+     * @return self
+     */
+    public function setCategories($categories)
+    {
+        if (is_null($categories)) {
+            throw new \InvalidArgumentException('non-nullable categories cannot be null');
+        }
+        $this->container['categories'] = $categories;
+
+        return $this;
+    }
+
+    /**
+     * Gets summary_text
+     *
+     * @return string|null
+     */
+    public function getSummaryText()
+    {
+        return $this->container['summary_text'];
+    }
+
+    /**
+     * Sets summary_text
+     *
+     * @param string|null $summary_text summary_text
+     *
+     * @return self
+     */
+    public function setSummaryText($summary_text)
+    {
+        if (is_null($summary_text)) {
+            throw new \InvalidArgumentException('non-nullable summary_text cannot be null');
+        }
+        $this->container['summary_text'] = $summary_text;
+
+        return $this;
+    }
+
+    /**
+     * Gets body
+     *
+     * @return \WikipaliApi\Model\MarkupNode[]|null
+     */
+    public function getBody()
+    {
+        return $this->container['body'];
+    }
+
+    /**
+     * Sets body
+     *
+     * @param \WikipaliApi\Model\MarkupNode[]|null $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;
+    }
+
+    /**
+     * Gets html
+     *
+     * @return string|null
+     */
+    public function getHtml()
+    {
+        return $this->container['html'];
+    }
+
+    /**
+     * Sets html
+     *
+     * @param string|null $html 仅在部分查询口径下返回。
+     *
+     * @return self
+     */
+    public function setHtml($html)
+    {
+        if (is_null($html)) {
+            throw new \InvalidArgumentException('non-nullable html cannot be null');
+        }
+        $this->container['html'] = $html;
+
+        return $this;
+    }
+
+    /**
+     * Gets editor
+     *
+     * @return \WikipaliApi\Model\GetApiV3AdminAgentRuns200ResponseDataInnerUser|null
+     */
+    public function getEditor()
+    {
+        return $this->container['editor'];
+    }
+
+    /**
+     * Sets editor
+     *
+     * @param \WikipaliApi\Model\GetApiV3AdminAgentRuns200ResponseDataInnerUser|null $editor editor
+     *
+     * @return self
+     */
+    public function setEditor($editor)
+    {
+        if (is_null($editor)) {
+            array_push($this->openAPINullablesSetToNull, 'editor');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('editor', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['editor'] = $editor;
+
+        return $this;
+    }
+
+    /**
+     * Gets co_editor
+     *
+     * @return \WikipaliApi\Model\GetApiV3AdminAgentRuns200ResponseDataInnerUser|null
+     */
+    public function getCoEditor()
+    {
+        return $this->container['co_editor'];
+    }
+
+    /**
+     * Sets co_editor
+     *
+     * @param \WikipaliApi\Model\GetApiV3AdminAgentRuns200ResponseDataInnerUser|null $co_editor co_editor
+     *
+     * @return self
+     */
+    public function setCoEditor($co_editor)
+    {
+        if (is_null($co_editor)) {
+            array_push($this->openAPINullablesSetToNull, 'co_editor');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('co_editor', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['co_editor'] = $co_editor;
+
+        return $this;
+    }
+
+    /**
+     * Gets etag
+     *
+     * @return string|null
+     */
+    public function getEtag()
+    {
+        return $this->container['etag'];
+    }
+
+    /**
+     * Sets etag
+     *
+     * @param string|null $etag etag
+     *
+     * @return self
+     */
+    public function setEtag($etag)
+    {
+        if (is_null($etag)) {
+            throw new \InvalidArgumentException('non-nullable etag cannot be null');
+        }
+        $this->container['etag'] = $etag;
+
+        return $this;
+    }
+
+    /**
+     * Gets abilities
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities|null
+     */
+    public function getAbilities()
+    {
+        return $this->container['abilities'];
+    }
+
+    /**
+     * Sets abilities
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities|null $abilities abilities
+     *
+     * @return self
+     */
+    public function setAbilities($abilities)
+    {
+        if (is_null($abilities)) {
+            throw new \InvalidArgumentException('non-nullable abilities cannot be null');
+        }
+        $this->container['abilities'] = $abilities;
+
+        return $this;
+    }
+
+    /**
+     * Gets created_at
+     *
+     * @return string|null
+     */
+    public function getCreatedAt()
+    {
+        return $this->container['created_at'];
+    }
+
+    /**
+     * Sets created_at
+     *
+     * @param string|null $created_at created_at
+     *
+     * @return self
+     */
+    public function setCreatedAt($created_at)
+    {
+        if (is_null($created_at)) {
+            throw new \InvalidArgumentException('non-nullable created_at cannot be null');
+        }
+        $this->container['created_at'] = $created_at;
+
+        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)) {
+            throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
+        }
+        $this->container['updated_at'] = $updated_at;
+
+        return $this;
+    }
+
+    /**
+     * Gets deleted_at
+     *
+     * @return string|null
+     */
+    public function getDeletedAt()
+    {
+        return $this->container['deleted_at'];
+    }
+
+    /**
+     * Sets deleted_at
+     *
+     * @param string|null $deleted_at deleted_at
+     *
+     * @return self
+     */
+    public function setDeletedAt($deleted_at)
+    {
+        if (is_null($deleted_at)) {
+            array_push($this->openAPINullablesSetToNull, 'deleted_at');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('deleted_at', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['deleted_at'] = $deleted_at;
+
+        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/GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities
+ *
+ * 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;
+
+/**
+ * GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelTerms200ResponseDataInnerAbilities implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_terms_200_response_data_inner_abilities';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'update' => 'bool',
+        'delete' => 'bool'
+    ];
+
+    /**
+     * 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 = [
+        'update' => null,
+        'delete' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'update' => false,
+        'delete' => 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 = [
+        'update' => 'update',
+        'delete' => 'delete'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'update' => 'setUpdate',
+        'delete' => 'setDelete'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'update' => 'getUpdate',
+        'delete' => 'getDelete'
+    ];
+
+    /**
+     * 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('update', $data ?? [], null);
+        $this->setIfExists('delete', $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 update
+     *
+     * @return bool|null
+     */
+    public function getUpdate()
+    {
+        return $this->container['update'];
+    }
+
+    /**
+     * Sets update
+     *
+     * @param bool|null $update update
+     *
+     * @return self
+     */
+    public function setUpdate($update)
+    {
+        if (is_null($update)) {
+            throw new \InvalidArgumentException('non-nullable update cannot be null');
+        }
+        $this->container['update'] = $update;
+
+        return $this;
+    }
+
+    /**
+     * Gets delete
+     *
+     * @return bool|null
+     */
+    public function getDelete()
+    {
+        return $this->container['delete'];
+    }
+
+    /**
+     * Sets delete
+     *
+     * @param bool|null $delete delete
+     *
+     * @return self
+     */
+    public function setDelete($delete)
+    {
+        if (is_null($delete)) {
+            throw new \InvalidArgumentException('non-nullable delete cannot be null');
+        }
+        $this->container['delete'] = $delete;
+
+        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/GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel
+ *
+ * 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;
+
+/**
+ * GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelTerms200ResponseDataInnerChannel implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_terms_200_response_data_inner_channel';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'name' => '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,
+        'name' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'name' => 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',
+        'name' => 'name'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'name' => 'setName'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'name' => 'getName'
+    ];
+
+    /**
+     * 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('name', $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 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;
+    }
+    /**
+     * 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));
+    }
+}
+
+

+ 17 - 17
api-test/client/lib/Model/GetApiV3Discussions200ResponseDataInner.php

@@ -68,7 +68,7 @@ class GetApiV3Discussions200ResponseDataInner implements ModelInterface, ArrayAc
         'title' => 'string',
         'content' => 'string',
         'content_type' => 'string',
-        'html' => 'string',
+        'body' => '\WikipaliApi\Model\MarkupNode[]',
         'summary' => 'string',
         'tpl_id' => 'string',
         'pos_start' => 'int',
@@ -105,7 +105,7 @@ class GetApiV3Discussions200ResponseDataInner implements ModelInterface, ArrayAc
         'title' => null,
         'content' => null,
         'content_type' => null,
-        'html' => null,
+        'body' => null,
         'summary' => null,
         'tpl_id' => null,
         'pos_start' => null,
@@ -140,7 +140,7 @@ class GetApiV3Discussions200ResponseDataInner implements ModelInterface, ArrayAc
         'title' => true,
         'content' => true,
         'content_type' => false,
-        'html' => false,
+        'body' => false,
         'summary' => false,
         'tpl_id' => true,
         'pos_start' => true,
@@ -255,7 +255,7 @@ class GetApiV3Discussions200ResponseDataInner implements ModelInterface, ArrayAc
         'title' => 'title',
         'content' => 'content',
         'content_type' => 'content_type',
-        'html' => 'html',
+        'body' => 'body',
         'summary' => 'summary',
         'tpl_id' => 'tpl_id',
         'pos_start' => 'pos_start',
@@ -290,7 +290,7 @@ class GetApiV3Discussions200ResponseDataInner implements ModelInterface, ArrayAc
         'title' => 'setTitle',
         'content' => 'setContent',
         'content_type' => 'setContentType',
-        'html' => 'setHtml',
+        'body' => 'setBody',
         'summary' => 'setSummary',
         'tpl_id' => 'setTplId',
         'pos_start' => 'setPosStart',
@@ -325,7 +325,7 @@ class GetApiV3Discussions200ResponseDataInner implements ModelInterface, ArrayAc
         'title' => 'getTitle',
         'content' => 'getContent',
         'content_type' => 'getContentType',
-        'html' => 'getHtml',
+        'body' => 'getBody',
         'summary' => 'getSummary',
         'tpl_id' => 'getTplId',
         'pos_start' => 'getPosStart',
@@ -411,7 +411,7 @@ class GetApiV3Discussions200ResponseDataInner implements ModelInterface, ArrayAc
         $this->setIfExists('title', $data ?? [], null);
         $this->setIfExists('content', $data ?? [], null);
         $this->setIfExists('content_type', $data ?? [], null);
-        $this->setIfExists('html', $data ?? [], null);
+        $this->setIfExists('body', $data ?? [], null);
         $this->setIfExists('summary', $data ?? [], null);
         $this->setIfExists('tpl_id', $data ?? [], null);
         $this->setIfExists('pos_start', $data ?? [], null);
@@ -804,28 +804,28 @@ class GetApiV3Discussions200ResponseDataInner implements ModelInterface, ArrayAc
     }
 
     /**
-     * Gets html
+     * Gets body
      *
-     * @return string|null
+     * @return \WikipaliApi\Model\MarkupNode[]|null
      */
-    public function getHtml()
+    public function getBody()
     {
-        return $this->container['html'];
+        return $this->container['body'];
     }
 
     /**
-     * Sets html
+     * Sets body
      *
-     * @param string|null $html 仅在部分查询口径下返回。
+     * @param \WikipaliApi\Model\MarkupNode[]|null $body 仅在部分查询口径下返回。
      *
      * @return self
      */
-    public function setHtml($html)
+    public function setBody($body)
     {
-        if (is_null($html)) {
-            throw new \InvalidArgumentException('non-nullable html cannot be null');
+        if (is_null($body)) {
+            throw new \InvalidArgumentException('non-nullable body cannot be null');
         }
-        $this->container['html'] = $html;
+        $this->container['body'] = $body;
 
         return $this;
     }

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

@@ -0,0 +1,443 @@
+<?php
+/**
+ * GetApiV3GlossariesKind200Response
+ *
+ * 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;
+
+/**
+ * GetApiV3GlossariesKind200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3GlossariesKind200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_glossaries_kind__200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3GlossariesKind200ResponseDataInner[]',
+        'meta' => '\WikipaliApi\Model\GetApiV3GlossariesKind200ResponseMeta'
+    ];
+
+    /**
+     * 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\GetApiV3GlossariesKind200ResponseDataInner[]|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3GlossariesKind200ResponseDataInner[]|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\GetApiV3GlossariesKind200ResponseMeta|null
+     */
+    public function getMeta()
+    {
+        return $this->container['meta'];
+    }
+
+    /**
+     * Sets meta
+     *
+     * @param \WikipaliApi\Model\GetApiV3GlossariesKind200ResponseMeta|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));
+    }
+}
+
+

+ 559 - 0
api-test/client/lib/Model/GetApiV3GlossariesKind200ResponseDataInner.php

@@ -0,0 +1,559 @@
+<?php
+/**
+ * GetApiV3GlossariesKind200ResponseDataInner
+ *
+ * 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;
+
+/**
+ * GetApiV3GlossariesKind200ResponseDataInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3GlossariesKind200ResponseDataInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_glossaries_kind__200_response_data_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'word' => 'string',
+        'tag' => 'string',
+        'meaning' => 'string',
+        'other_meaning' => '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,
+        'word' => null,
+        'tag' => null,
+        'meaning' => null,
+        'other_meaning' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'word' => false,
+        'tag' => true,
+        'meaning' => false,
+        'other_meaning' => true
+    ];
+
+    /**
+     * 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',
+        'other_meaning' => 'other_meaning'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'word' => 'setWord',
+        'tag' => 'setTag',
+        'meaning' => 'setMeaning',
+        'other_meaning' => 'setOtherMeaning'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'word' => 'getWord',
+        'tag' => 'getTag',
+        'meaning' => 'getMeaning',
+        'other_meaning' => 'getOtherMeaning'
+    ];
+
+    /**
+     * 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('other_meaning', $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)) {
+            array_push($this->openAPINullablesSetToNull, 'tag');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('tag', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $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 other_meaning
+     *
+     * @return string|null
+     */
+    public function getOtherMeaning()
+    {
+        return $this->container['other_meaning'];
+    }
+
+    /**
+     * Sets other_meaning
+     *
+     * @param string|null $other_meaning other_meaning
+     *
+     * @return self
+     */
+    public function setOtherMeaning($other_meaning)
+    {
+        if (is_null($other_meaning)) {
+            array_push($this->openAPINullablesSetToNull, 'other_meaning');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('other_meaning', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['other_meaning'] = $other_meaning;
+
+        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/GetApiV3GlossariesKind200ResponseMeta.php

@@ -0,0 +1,477 @@
+<?php
+/**
+ * GetApiV3GlossariesKind200ResponseMeta
+ *
+ * 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;
+
+/**
+ * GetApiV3GlossariesKind200ResponseMeta Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3GlossariesKind200ResponseMeta implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_glossaries_kind__200_response_meta';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'kind' => 'string',
+        'lang' => 'string',
+        'total' => '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 = [
+        'kind' => null,
+        'lang' => null,
+        'total' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'kind' => false,
+        'lang' => false,
+        'total' => 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 = [
+        'kind' => 'kind',
+        'lang' => 'lang',
+        'total' => 'total'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'kind' => 'setKind',
+        'lang' => 'setLang',
+        'total' => 'setTotal'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'kind' => 'getKind',
+        'lang' => 'getLang',
+        'total' => 'getTotal'
+    ];
+
+    /**
+     * 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('kind', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('total', $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 kind
+     *
+     * @return string|null
+     */
+    public function getKind()
+    {
+        return $this->container['kind'];
+    }
+
+    /**
+     * Sets kind
+     *
+     * @param string|null $kind 哪张表
+     *
+     * @return self
+     */
+    public function setKind($kind)
+    {
+        if (is_null($kind)) {
+            throw new \InvalidArgumentException('non-nullable kind cannot be null');
+        }
+        $this->container['kind'] = $kind;
+
+        return $this;
+    }
+
+    /**
+     * Gets lang
+     *
+     * @return string|null
+     */
+    public function getLang()
+    {
+        return $this->container['lang'];
+    }
+
+    /**
+     * Sets lang
+     *
+     * @param string|null $lang 实际用到的语言(没有该语言的表时是 en)
+     *
+     * @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 total
+     *
+     * @return int|null
+     */
+    public function getTotal()
+    {
+        return $this->container['total'];
+    }
+
+    /**
+     * Sets total
+     *
+     * @param int|null $total 条数
+     *
+     * @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;
+    }
+    /**
+     * 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/GetApiV3TipitakaChannels200Response.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * GetApiV3TipitakaChannels200Response
+ *
+ * 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;
+
+/**
+ * GetApiV3TipitakaChannels200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3TipitakaChannels200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_tipitaka_channels_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3TipitakaChannels200ResponseDataInner[]',
+        'meta' => '\WikipaliApi\Model\PaginationMeta'
+    ];
+
+    /**
+     * 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\GetApiV3TipitakaChannels200ResponseDataInner[]|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3TipitakaChannels200ResponseDataInner[]|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\PaginationMeta|null
+     */
+    public function getMeta()
+    {
+        return $this->container['meta'];
+    }
+
+    /**
+     * Sets meta
+     *
+     * @param \WikipaliApi\Model\PaginationMeta|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));
+    }
+}
+
+

+ 865 - 0
api-test/client/lib/Model/GetApiV3TipitakaChannels200ResponseDataInner.php

@@ -0,0 +1,865 @@
+<?php
+/**
+ * GetApiV3TipitakaChannels200ResponseDataInner
+ *
+ * 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;
+
+/**
+ * GetApiV3TipitakaChannels200ResponseDataInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3TipitakaChannels200ResponseDataInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_tipitaka_channels_200_response_data_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'name' => 'string',
+        'summary' => 'string',
+        'type' => 'string',
+        'lang' => 'string',
+        'status' => 'int',
+        'is_system' => 'bool',
+        'source_type' => 'string',
+        'source_id' => 'string',
+        'owner' => '\WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerOwner',
+        'abilities' => '\WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerAbilities',
+        'chapter_count' => 'int',
+        'created_at' => 'string',
+        'updated_at' => '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,
+        'name' => null,
+        'summary' => null,
+        'type' => null,
+        'lang' => null,
+        'status' => null,
+        'is_system' => null,
+        'source_type' => null,
+        'source_id' => null,
+        'owner' => null,
+        'abilities' => null,
+        'chapter_count' => null,
+        'created_at' => null,
+        'updated_at' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'name' => false,
+        'summary' => true,
+        'type' => false,
+        'lang' => false,
+        'status' => false,
+        'is_system' => false,
+        'source_type' => false,
+        'source_id' => true,
+        'owner' => false,
+        'abilities' => false,
+        'chapter_count' => false,
+        'created_at' => false,
+        'updated_at' => 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',
+        'name' => 'name',
+        'summary' => 'summary',
+        'type' => 'type',
+        'lang' => 'lang',
+        'status' => 'status',
+        'is_system' => 'is_system',
+        'source_type' => 'source_type',
+        'source_id' => 'source_id',
+        'owner' => 'owner',
+        'abilities' => 'abilities',
+        'chapter_count' => 'chapter_count',
+        'created_at' => 'created_at',
+        'updated_at' => 'updated_at'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'name' => 'setName',
+        'summary' => 'setSummary',
+        'type' => 'setType',
+        'lang' => 'setLang',
+        'status' => 'setStatus',
+        'is_system' => 'setIsSystem',
+        'source_type' => 'setSourceType',
+        'source_id' => 'setSourceId',
+        'owner' => 'setOwner',
+        'abilities' => 'setAbilities',
+        'chapter_count' => 'setChapterCount',
+        'created_at' => 'setCreatedAt',
+        'updated_at' => 'setUpdatedAt'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'name' => 'getName',
+        'summary' => 'getSummary',
+        'type' => 'getType',
+        'lang' => 'getLang',
+        'status' => 'getStatus',
+        'is_system' => 'getIsSystem',
+        'source_type' => 'getSourceType',
+        'source_id' => 'getSourceId',
+        'owner' => 'getOwner',
+        'abilities' => 'getAbilities',
+        'chapter_count' => 'getChapterCount',
+        'created_at' => 'getCreatedAt',
+        'updated_at' => 'getUpdatedAt'
+    ];
+
+    /**
+     * 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('name', $data ?? [], null);
+        $this->setIfExists('summary', $data ?? [], null);
+        $this->setIfExists('type', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('status', $data ?? [], null);
+        $this->setIfExists('is_system', $data ?? [], null);
+        $this->setIfExists('source_type', $data ?? [], null);
+        $this->setIfExists('source_id', $data ?? [], null);
+        $this->setIfExists('owner', $data ?? [], null);
+        $this->setIfExists('abilities', $data ?? [], null);
+        $this->setIfExists('chapter_count', $data ?? [], null);
+        $this->setIfExists('created_at', $data ?? [], null);
+        $this->setIfExists('updated_at', $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 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 summary
+     *
+     * @return string|null
+     */
+    public function getSummary()
+    {
+        return $this->container['summary'];
+    }
+
+    /**
+     * Sets summary
+     *
+     * @param string|null $summary summary
+     *
+     * @return self
+     */
+    public function setSummary($summary)
+    {
+        if (is_null($summary)) {
+            array_push($this->openAPINullablesSetToNull, 'summary');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('summary', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['summary'] = $summary;
+
+        return $this;
+    }
+
+    /**
+     * Gets type
+     *
+     * @return string|null
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string|null $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $this->container['type'] = $type;
+
+        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 status
+     *
+     * @return int|null
+     */
+    public function getStatus()
+    {
+        return $this->container['status'];
+    }
+
+    /**
+     * Sets status
+     *
+     * @param int|null $status status
+     *
+     * @return self
+     */
+    public function setStatus($status)
+    {
+        if (is_null($status)) {
+            throw new \InvalidArgumentException('non-nullable status cannot be null');
+        }
+        $this->container['status'] = $status;
+
+        return $this;
+    }
+
+    /**
+     * Gets is_system
+     *
+     * @return bool|null
+     */
+    public function getIsSystem()
+    {
+        return $this->container['is_system'];
+    }
+
+    /**
+     * Sets is_system
+     *
+     * @param bool|null $is_system is_system
+     *
+     * @return self
+     */
+    public function setIsSystem($is_system)
+    {
+        if (is_null($is_system)) {
+            throw new \InvalidArgumentException('non-nullable is_system cannot be null');
+        }
+        $this->container['is_system'] = $is_system;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_type
+     *
+     * @return string|null
+     */
+    public function getSourceType()
+    {
+        return $this->container['source_type'];
+    }
+
+    /**
+     * Sets source_type
+     *
+     * @param string|null $source_type source_type
+     *
+     * @return self
+     */
+    public function setSourceType($source_type)
+    {
+        if (is_null($source_type)) {
+            throw new \InvalidArgumentException('non-nullable source_type cannot be null');
+        }
+        $this->container['source_type'] = $source_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_id
+     *
+     * @return string|null
+     */
+    public function getSourceId()
+    {
+        return $this->container['source_id'];
+    }
+
+    /**
+     * Sets source_id
+     *
+     * @param string|null $source_id source_id
+     *
+     * @return self
+     */
+    public function setSourceId($source_id)
+    {
+        if (is_null($source_id)) {
+            array_push($this->openAPINullablesSetToNull, 'source_id');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('source_id', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['source_id'] = $source_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets owner
+     *
+     * @return \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerOwner|null
+     */
+    public function getOwner()
+    {
+        return $this->container['owner'];
+    }
+
+    /**
+     * Sets owner
+     *
+     * @param \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerOwner|null $owner owner
+     *
+     * @return self
+     */
+    public function setOwner($owner)
+    {
+        if (is_null($owner)) {
+            throw new \InvalidArgumentException('non-nullable owner cannot be null');
+        }
+        $this->container['owner'] = $owner;
+
+        return $this;
+    }
+
+    /**
+     * Gets abilities
+     *
+     * @return \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerAbilities|null
+     */
+    public function getAbilities()
+    {
+        return $this->container['abilities'];
+    }
+
+    /**
+     * Sets abilities
+     *
+     * @param \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerAbilities|null $abilities abilities
+     *
+     * @return self
+     */
+    public function setAbilities($abilities)
+    {
+        if (is_null($abilities)) {
+            throw new \InvalidArgumentException('non-nullable abilities cannot be null');
+        }
+        $this->container['abilities'] = $abilities;
+
+        return $this;
+    }
+
+    /**
+     * Gets chapter_count
+     *
+     * @return int|null
+     */
+    public function getChapterCount()
+    {
+        return $this->container['chapter_count'];
+    }
+
+    /**
+     * Sets chapter_count
+     *
+     * @param int|null $chapter_count chapter_count
+     *
+     * @return self
+     */
+    public function setChapterCount($chapter_count)
+    {
+        if (is_null($chapter_count)) {
+            throw new \InvalidArgumentException('non-nullable chapter_count cannot be null');
+        }
+        $this->container['chapter_count'] = $chapter_count;
+
+        return $this;
+    }
+
+    /**
+     * Gets created_at
+     *
+     * @return string|null
+     */
+    public function getCreatedAt()
+    {
+        return $this->container['created_at'];
+    }
+
+    /**
+     * Sets created_at
+     *
+     * @param string|null $created_at created_at
+     *
+     * @return self
+     */
+    public function setCreatedAt($created_at)
+    {
+        if (is_null($created_at)) {
+            throw new \InvalidArgumentException('non-nullable created_at cannot be null');
+        }
+        $this->container['created_at'] = $created_at;
+
+        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)) {
+            throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
+        }
+        $this->container['updated_at'] = $updated_at;
+
+        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));
+    }
+}
+
+

+ 552 - 0
api-test/client/lib/Model/MarkupElement.php

@@ -0,0 +1,552 @@
+<?php
+/**
+ * MarkupElement
+ *
+ * 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;
+
+/**
+ * MarkupElement Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class MarkupElement implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'MarkupElement';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'type' => 'string',
+        'tag' => 'string',
+        'attrs' => 'array<string,string>',
+        'children' => '\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 = [
+        'type' => null,
+        'tag' => null,
+        'attrs' => null,
+        'children' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'type' => false,
+        'tag' => false,
+        'attrs' => false,
+        'children' => 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 = [
+        'type' => 'type',
+        'tag' => 'tag',
+        'attrs' => 'attrs',
+        'children' => 'children'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'type' => 'setType',
+        'tag' => 'setTag',
+        'attrs' => 'setAttrs',
+        'children' => 'setChildren'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'type' => 'getType',
+        'tag' => 'getTag',
+        'attrs' => 'getAttrs',
+        'children' => 'getChildren'
+    ];
+
+    /**
+     * 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;
+    }
+
+    public const TYPE_EL = 'el';
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getTypeAllowableValues()
+    {
+        return [
+            self::TYPE_EL,
+        ];
+    }
+
+    /**
+     * 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('type', $data ?? [], null);
+        $this->setIfExists('tag', $data ?? [], null);
+        $this->setIfExists('attrs', $data ?? [], null);
+        $this->setIfExists('children', $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['type'] === null) {
+            $invalidProperties[] = "'type' can't be null";
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'type', must be one of '%s'",
+                $this->container['type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        if ($this->container['tag'] === null) {
+            $invalidProperties[] = "'tag' can't be null";
+        }
+        if ($this->container['children'] === null) {
+            $invalidProperties[] = "'children' 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 type
+     *
+     * @return string
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!in_array($type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'type', must be one of '%s'",
+                    $type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['type'] = $type;
+
+        return $this;
+    }
+
+    /**
+     * Gets tag
+     *
+     * @return string
+     */
+    public function getTag()
+    {
+        return $this->container['tag'];
+    }
+
+    /**
+     * Sets tag
+     *
+     * @param string $tag 白名单内的 HTML 标签名(小写)
+     *
+     * @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 attrs
+     *
+     * @return array<string,string>|null
+     */
+    public function getAttrs()
+    {
+        return $this->container['attrs'];
+    }
+
+    /**
+     * Sets attrs
+     *
+     * @param array<string,string>|null $attrs attrs
+     *
+     * @return self
+     */
+    public function setAttrs($attrs)
+    {
+        if (is_null($attrs)) {
+            throw new \InvalidArgumentException('non-nullable attrs cannot be null');
+        }
+        $this->container['attrs'] = $attrs;
+
+        return $this;
+    }
+
+    /**
+     * Gets children
+     *
+     * @return \WikipaliApi\Model\MarkupNode[]
+     */
+    public function getChildren()
+    {
+        return $this->container['children'];
+    }
+
+    /**
+     * Sets children
+     *
+     * @param \WikipaliApi\Model\MarkupNode[] $children children
+     *
+     * @return self
+     */
+    public function setChildren($children)
+    {
+        if (is_null($children)) {
+            throw new \InvalidArgumentException('non-nullable children cannot be null');
+        }
+        $this->container['children'] = $children;
+
+        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));
+    }
+}
+
+

+ 668 - 0
api-test/client/lib/Model/MarkupNode.php

@@ -0,0 +1,668 @@
+<?php
+/**
+ * MarkupNode
+ *
+ * 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;
+
+/**
+ * MarkupNode Class Doc Comment
+ *
+ * @category Class
+ * @description 正文(markdown + 模板)渲染后的节点树,由 App\\Services\\Markup 生成。 三种节点:text 纯文本(前端作为 React 文本节点,自动转义);el HTML 元素(tag 与 attrs 已过白名单); tpl 模板(name 是前端组件名,props 随模板而定,props 里嵌套的内容也是节点数组)。
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class MarkupNode implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'MarkupNode';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'type' => 'string',
+        'value' => 'string',
+        'tag' => 'string',
+        'attrs' => 'array<string,string>',
+        'children' => '\WikipaliApi\Model\MarkupNode[]',
+        'name' => 'string',
+        'props' => 'array<string,mixed>'
+    ];
+
+    /**
+     * 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 = [
+        'type' => null,
+        'value' => null,
+        'tag' => null,
+        'attrs' => null,
+        'children' => null,
+        'name' => null,
+        'props' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'type' => false,
+        'value' => false,
+        'tag' => false,
+        'attrs' => false,
+        'children' => false,
+        'name' => false,
+        'props' => 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 = [
+        'type' => 'type',
+        'value' => 'value',
+        'tag' => 'tag',
+        'attrs' => 'attrs',
+        'children' => 'children',
+        'name' => 'name',
+        'props' => 'props'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'type' => 'setType',
+        'value' => 'setValue',
+        'tag' => 'setTag',
+        'attrs' => 'setAttrs',
+        'children' => 'setChildren',
+        'name' => 'setName',
+        'props' => 'setProps'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'type' => 'getType',
+        'value' => 'getValue',
+        'tag' => 'getTag',
+        'attrs' => 'getAttrs',
+        'children' => 'getChildren',
+        'name' => 'getName',
+        'props' => 'getProps'
+    ];
+
+    /**
+     * 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;
+    }
+
+    public const TYPE_TEXT = 'text';
+    public const TYPE_EL = 'el';
+    public const TYPE_TPL = 'tpl';
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getTypeAllowableValues()
+    {
+        return [
+            self::TYPE_TEXT,
+            self::TYPE_EL,
+            self::TYPE_TPL,
+        ];
+    }
+
+    /**
+     * 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('type', $data ?? [], null);
+        $this->setIfExists('value', $data ?? [], null);
+        $this->setIfExists('tag', $data ?? [], null);
+        $this->setIfExists('attrs', $data ?? [], null);
+        $this->setIfExists('children', $data ?? [], null);
+        $this->setIfExists('name', $data ?? [], null);
+        $this->setIfExists('props', $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['type'] === null) {
+            $invalidProperties[] = "'type' can't be null";
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'type', must be one of '%s'",
+                $this->container['type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        if ($this->container['value'] === null) {
+            $invalidProperties[] = "'value' can't be null";
+        }
+        if ($this->container['tag'] === null) {
+            $invalidProperties[] = "'tag' can't be null";
+        }
+        if ($this->container['children'] === null) {
+            $invalidProperties[] = "'children' can't be null";
+        }
+        if ($this->container['name'] === null) {
+            $invalidProperties[] = "'name' can't be null";
+        }
+        if ($this->container['props'] === null) {
+            $invalidProperties[] = "'props' 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 type
+     *
+     * @return string
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!in_array($type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'type', must be one of '%s'",
+                    $type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['type'] = $type;
+
+        return $this;
+    }
+
+    /**
+     * Gets value
+     *
+     * @return string
+     */
+    public function getValue()
+    {
+        return $this->container['value'];
+    }
+
+    /**
+     * Sets value
+     *
+     * @param string $value value
+     *
+     * @return self
+     */
+    public function setValue($value)
+    {
+        if (is_null($value)) {
+            throw new \InvalidArgumentException('non-nullable value cannot be null');
+        }
+        $this->container['value'] = $value;
+
+        return $this;
+    }
+
+    /**
+     * Gets tag
+     *
+     * @return string
+     */
+    public function getTag()
+    {
+        return $this->container['tag'];
+    }
+
+    /**
+     * Sets tag
+     *
+     * @param string $tag 白名单内的 HTML 标签名(小写)
+     *
+     * @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 attrs
+     *
+     * @return array<string,string>|null
+     */
+    public function getAttrs()
+    {
+        return $this->container['attrs'];
+    }
+
+    /**
+     * Sets attrs
+     *
+     * @param array<string,string>|null $attrs attrs
+     *
+     * @return self
+     */
+    public function setAttrs($attrs)
+    {
+        if (is_null($attrs)) {
+            throw new \InvalidArgumentException('non-nullable attrs cannot be null');
+        }
+        $this->container['attrs'] = $attrs;
+
+        return $this;
+    }
+
+    /**
+     * Gets children
+     *
+     * @return \WikipaliApi\Model\MarkupNode[]
+     */
+    public function getChildren()
+    {
+        return $this->container['children'];
+    }
+
+    /**
+     * Sets children
+     *
+     * @param \WikipaliApi\Model\MarkupNode[] $children children
+     *
+     * @return self
+     */
+    public function setChildren($children)
+    {
+        if (is_null($children)) {
+            throw new \InvalidArgumentException('non-nullable children cannot be null');
+        }
+        $this->container['children'] = $children;
+
+        return $this;
+    }
+
+    /**
+     * Gets name
+     *
+     * @return string
+     */
+    public function getName()
+    {
+        return $this->container['name'];
+    }
+
+    /**
+     * Sets name
+     *
+     * @param string $name 前端组件名:term、note、sentread、sentedit、quote、quote-link、mermaid…
+     *
+     * @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 props
+     *
+     * @return array<string,mixed>
+     */
+    public function getProps()
+    {
+        return $this->container['props'];
+    }
+
+    /**
+     * Sets props
+     *
+     * @param array<string,mixed> $props props
+     *
+     * @return self
+     */
+    public function setProps($props)
+    {
+        if (is_null($props)) {
+            throw new \InvalidArgumentException('non-nullable props cannot be null');
+        }
+        $this->container['props'] = $props;
+
+        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));
+    }
+}
+
+

+ 555 - 0
api-test/client/lib/Model/MarkupTemplate.php

@@ -0,0 +1,555 @@
+<?php
+/**
+ * MarkupTemplate
+ *
+ * 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;
+
+/**
+ * MarkupTemplate Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class MarkupTemplate implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'MarkupTemplate';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'type' => 'string',
+        'name' => 'string',
+        'props' => 'array<string,mixed>',
+        'children' => '\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 = [
+        'type' => null,
+        'name' => null,
+        'props' => null,
+        'children' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'type' => false,
+        'name' => false,
+        'props' => false,
+        'children' => 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 = [
+        'type' => 'type',
+        'name' => 'name',
+        'props' => 'props',
+        'children' => 'children'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'type' => 'setType',
+        'name' => 'setName',
+        'props' => 'setProps',
+        'children' => 'setChildren'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'type' => 'getType',
+        'name' => 'getName',
+        'props' => 'getProps',
+        'children' => 'getChildren'
+    ];
+
+    /**
+     * 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;
+    }
+
+    public const TYPE_TPL = 'tpl';
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getTypeAllowableValues()
+    {
+        return [
+            self::TYPE_TPL,
+        ];
+    }
+
+    /**
+     * 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('type', $data ?? [], null);
+        $this->setIfExists('name', $data ?? [], null);
+        $this->setIfExists('props', $data ?? [], null);
+        $this->setIfExists('children', $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['type'] === null) {
+            $invalidProperties[] = "'type' can't be null";
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'type', must be one of '%s'",
+                $this->container['type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        if ($this->container['name'] === null) {
+            $invalidProperties[] = "'name' can't be null";
+        }
+        if ($this->container['props'] === null) {
+            $invalidProperties[] = "'props' can't be null";
+        }
+        if ($this->container['children'] === null) {
+            $invalidProperties[] = "'children' 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 type
+     *
+     * @return string
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!in_array($type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'type', must be one of '%s'",
+                    $type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['type'] = $type;
+
+        return $this;
+    }
+
+    /**
+     * Gets name
+     *
+     * @return string
+     */
+    public function getName()
+    {
+        return $this->container['name'];
+    }
+
+    /**
+     * Sets name
+     *
+     * @param string $name 前端组件名:term、note、sentread、sentedit、quote、quote-link、mermaid…
+     *
+     * @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 props
+     *
+     * @return array<string,mixed>
+     */
+    public function getProps()
+    {
+        return $this->container['props'];
+    }
+
+    /**
+     * Sets props
+     *
+     * @param array<string,mixed> $props props
+     *
+     * @return self
+     */
+    public function setProps($props)
+    {
+        if (is_null($props)) {
+            throw new \InvalidArgumentException('non-nullable props cannot be null');
+        }
+        $this->container['props'] = $props;
+
+        return $this;
+    }
+
+    /**
+     * Gets children
+     *
+     * @return \WikipaliApi\Model\MarkupNode[]
+     */
+    public function getChildren()
+    {
+        return $this->container['children'];
+    }
+
+    /**
+     * Sets children
+     *
+     * @param \WikipaliApi\Model\MarkupNode[] $children children
+     *
+     * @return self
+     */
+    public function setChildren($children)
+    {
+        if (is_null($children)) {
+            throw new \InvalidArgumentException('non-nullable children cannot be null');
+        }
+        $this->container['children'] = $children;
+
+        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));
+    }
+}
+
+

+ 481 - 0
api-test/client/lib/Model/MarkupText.php

@@ -0,0 +1,481 @@
+<?php
+/**
+ * MarkupText
+ *
+ * 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;
+
+/**
+ * MarkupText Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class MarkupText implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'MarkupText';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'type' => 'string',
+        'value' => '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 = [
+        'type' => null,
+        'value' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'type' => false,
+        'value' => 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 = [
+        'type' => 'type',
+        'value' => 'value'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'type' => 'setType',
+        'value' => 'setValue'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'type' => 'getType',
+        'value' => 'getValue'
+    ];
+
+    /**
+     * 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;
+    }
+
+    public const TYPE_TEXT = 'text';
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getTypeAllowableValues()
+    {
+        return [
+            self::TYPE_TEXT,
+        ];
+    }
+
+    /**
+     * 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('type', $data ?? [], null);
+        $this->setIfExists('value', $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['type'] === null) {
+            $invalidProperties[] = "'type' can't be null";
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'type', must be one of '%s'",
+                $this->container['type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        if ($this->container['value'] === null) {
+            $invalidProperties[] = "'value' 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 type
+     *
+     * @return string
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!in_array($type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'type', must be one of '%s'",
+                    $type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['type'] = $type;
+
+        return $this;
+    }
+
+    /**
+     * Gets value
+     *
+     * @return string
+     */
+    public function getValue()
+    {
+        return $this->container['value'];
+    }
+
+    /**
+     * Sets value
+     *
+     * @param string $value value
+     *
+     * @return self
+     */
+    public function setValue($value)
+    {
+        if (is_null($value)) {
+            throw new \InvalidArgumentException('non-nullable value cannot be null');
+        }
+        $this->container['value'] = $value;
+
+        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));
+    }
+}
+
+

+ 525 - 0
api-test/client/lib/Model/PatchApiV3ChannelsChannelLinksRequest.php

@@ -0,0 +1,525 @@
+<?php
+/**
+ * PatchApiV3ChannelsChannelLinksRequest
+ *
+ * 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;
+
+/**
+ * PatchApiV3ChannelsChannelLinksRequest Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PatchApiV3ChannelsChannelLinksRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'patch_api_v3_channels_channel_links_request';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'derived_from' => 'string',
+        'wbw' => 'string',
+        'fallback' => 'string[]',
+        'term_source' => '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 = [
+        'derived_from' => null,
+        'wbw' => null,
+        'fallback' => null,
+        'term_source' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'derived_from' => true,
+        'wbw' => true,
+        'fallback' => false,
+        'term_source' => 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 = [
+        'derived_from' => 'derived_from',
+        'wbw' => 'wbw',
+        'fallback' => 'fallback',
+        'term_source' => 'term_source'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'derived_from' => 'setDerivedFrom',
+        'wbw' => 'setWbw',
+        'fallback' => 'setFallback',
+        'term_source' => 'setTermSource'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'derived_from' => 'getDerivedFrom',
+        'wbw' => 'getWbw',
+        'fallback' => 'getFallback',
+        'term_source' => 'getTermSource'
+    ];
+
+    /**
+     * 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('derived_from', $data ?? [], null);
+        $this->setIfExists('wbw', $data ?? [], null);
+        $this->setIfExists('fallback', $data ?? [], null);
+        $this->setIfExists('term_source', $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 derived_from
+     *
+     * @return string|null
+     */
+    public function getDerivedFrom()
+    {
+        return $this->container['derived_from'];
+    }
+
+    /**
+     * Sets derived_from
+     *
+     * @param string|null $derived_from 继承自哪个 channel(如英文版译自中文版),只记录
+     *
+     * @return self
+     */
+    public function setDerivedFrom($derived_from)
+    {
+        if (is_null($derived_from)) {
+            array_push($this->openAPINullablesSetToNull, 'derived_from');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('derived_from', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['derived_from'] = $derived_from;
+
+        return $this;
+    }
+
+    /**
+     * Gets wbw
+     *
+     * @return string|null
+     */
+    public function getWbw()
+    {
+        return $this->container['wbw'];
+    }
+
+    /**
+     * Sets wbw
+     *
+     * @param string|null $wbw 捆绑的逐词 channel,必须是 wbw 类型;载入时当原文
+     *
+     * @return self
+     */
+    public function setWbw($wbw)
+    {
+        if (is_null($wbw)) {
+            array_push($this->openAPINullablesSetToNull, 'wbw');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('wbw', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['wbw'] = $wbw;
+
+        return $this;
+    }
+
+    /**
+     * Gets fallback
+     *
+     * @return string[]|null
+     */
+    public function getFallback()
+    {
+        return $this->container['fallback'];
+    }
+
+    /**
+     * Sets fallback
+     *
+     * @param string[]|null $fallback 降级 channel,有序,最多 3 个,须与本 channel 同类型;段落没有数据时由客户端改取
+     *
+     * @return self
+     */
+    public function setFallback($fallback)
+    {
+        if (is_null($fallback)) {
+            throw new \InvalidArgumentException('non-nullable fallback cannot be null');
+        }
+        $this->container['fallback'] = $fallback;
+
+        return $this;
+    }
+
+    /**
+     * Gets term_source
+     *
+     * @return string[]|null
+     */
+    public function getTermSource()
+    {
+        return $this->container['term_source'];
+    }
+
+    /**
+     * Sets term_source
+     *
+     * @param string[]|null $term_source 术语路径,有序,最多 10 个,只能是 translation;只有 translation channel 能设
+     *
+     * @return self
+     */
+    public function setTermSource($term_source)
+    {
+        if (is_null($term_source)) {
+            throw new \InvalidArgumentException('non-nullable term_source cannot be null');
+        }
+        $this->container['term_source'] = $term_source;
+
+        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));
+    }
+}
+
+

+ 725 - 0
api-test/client/lib/Model/PatchApiV3ChannelsChannelRequest.php

@@ -0,0 +1,725 @@
+<?php
+/**
+ * PatchApiV3ChannelsChannelRequest
+ *
+ * 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;
+
+/**
+ * PatchApiV3ChannelsChannelRequest Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PatchApiV3ChannelsChannelRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'patch_api_v3_channels_channel__request';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'name' => 'string',
+        'type' => 'string',
+        'lang' => 'string',
+        'summary' => 'string',
+        'status' => 'int',
+        'source_type' => 'string',
+        'source_id' => 'string',
+        'config' => '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 = [
+        'name' => null,
+        'type' => null,
+        'lang' => null,
+        'summary' => null,
+        'status' => null,
+        'source_type' => null,
+        'source_id' => null,
+        'config' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'name' => false,
+        'type' => false,
+        'lang' => false,
+        'summary' => false,
+        'status' => false,
+        'source_type' => false,
+        'source_id' => false,
+        'config' => 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',
+        'type' => 'type',
+        'lang' => 'lang',
+        'summary' => 'summary',
+        'status' => 'status',
+        'source_type' => 'source_type',
+        'source_id' => 'source_id',
+        'config' => 'config'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'name' => 'setName',
+        'type' => 'setType',
+        'lang' => 'setLang',
+        'summary' => 'setSummary',
+        'status' => 'setStatus',
+        'source_type' => 'setSourceType',
+        'source_id' => 'setSourceId',
+        'config' => 'setConfig'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'name' => 'getName',
+        'type' => 'getType',
+        'lang' => 'getLang',
+        'summary' => 'getSummary',
+        'status' => 'getStatus',
+        'source_type' => 'getSourceType',
+        'source_id' => 'getSourceId',
+        'config' => 'getConfig'
+    ];
+
+    /**
+     * 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;
+    }
+
+    public const TYPE_TRANSLATION = 'translation';
+    public const TYPE_NISSAYA = 'nissaya';
+    public const TYPE_ORIGINAL = 'original';
+    public const TYPE_WBW = 'wbw';
+    public const TYPE_COMMENTARY = 'commentary';
+    public const TYPE_SIMILAR = 'similar';
+    public const SOURCE_TYPE_ORIGINAL = 'original';
+    public const SOURCE_TYPE_REPRINT = 'reprint';
+    public const SOURCE_TYPE_AI = 'ai';
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getTypeAllowableValues()
+    {
+        return [
+            self::TYPE_TRANSLATION,
+            self::TYPE_NISSAYA,
+            self::TYPE_ORIGINAL,
+            self::TYPE_WBW,
+            self::TYPE_COMMENTARY,
+            self::TYPE_SIMILAR,
+        ];
+    }
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getSourceTypeAllowableValues()
+    {
+        return [
+            self::SOURCE_TYPE_ORIGINAL,
+            self::SOURCE_TYPE_REPRINT,
+            self::SOURCE_TYPE_AI,
+        ];
+    }
+
+    /**
+     * 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('type', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('summary', $data ?? [], null);
+        $this->setIfExists('status', $data ?? [], null);
+        $this->setIfExists('source_type', $data ?? [], null);
+        $this->setIfExists('source_id', $data ?? [], null);
+        $this->setIfExists('config', $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 = [];
+
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'type', must be one of '%s'",
+                $this->container['type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        $allowedValues = $this->getSourceTypeAllowableValues();
+        if (!is_null($this->container['source_type']) && !in_array($this->container['source_type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'source_type', must be one of '%s'",
+                $this->container['source_type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        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 名字,最长 128;同一 studio 内不能重名
+     *
+     * @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 type
+     *
+     * @return string|null
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string|null $type 类型
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!in_array($type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'type', must be one of '%s'",
+                    $type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['type'] = $type;
+
+        return $this;
+    }
+
+    /**
+     * Gets lang
+     *
+     * @return string|null
+     */
+    public function getLang()
+    {
+        return $this->container['lang'];
+    }
+
+    /**
+     * Sets lang
+     *
+     * @param string|null $lang 语言,最长 16
+     *
+     * @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 summary
+     *
+     * @return string|null
+     */
+    public function getSummary()
+    {
+        return $this->container['summary'];
+    }
+
+    /**
+     * Sets summary
+     *
+     * @param string|null $summary 简介,最长 1024
+     *
+     * @return self
+     */
+    public function setSummary($summary)
+    {
+        if (is_null($summary)) {
+            throw new \InvalidArgumentException('non-nullable summary cannot be null');
+        }
+        $this->container['summary'] = $summary;
+
+        return $this;
+    }
+
+    /**
+     * Gets status
+     *
+     * @return int|null
+     */
+    public function getStatus()
+    {
+        return $this->container['status'];
+    }
+
+    /**
+     * Sets status
+     *
+     * @param int|null $status 10 私有、20 公开不列出(拿到链接能看,不进任何公开列表)、30 公开
+     *
+     * @return self
+     */
+    public function setStatus($status)
+    {
+        if (is_null($status)) {
+            throw new \InvalidArgumentException('non-nullable status cannot be null');
+        }
+        $this->container['status'] = $status;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_type
+     *
+     * @return string|null
+     */
+    public function getSourceType()
+    {
+        return $this->container['source_type'];
+    }
+
+    /**
+     * Sets source_type
+     *
+     * @param string|null $source_type 来源
+     *
+     * @return self
+     */
+    public function setSourceType($source_type)
+    {
+        if (is_null($source_type)) {
+            throw new \InvalidArgumentException('non-nullable source_type cannot be null');
+        }
+        $allowedValues = $this->getSourceTypeAllowableValues();
+        if (!in_array($source_type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'source_type', must be one of '%s'",
+                    $source_type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['source_type'] = $source_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_id
+     *
+     * @return string|null
+     */
+    public function getSourceId()
+    {
+        return $this->container['source_id'];
+    }
+
+    /**
+     * Sets source_id
+     *
+     * @param string|null $source_id 来源 id
+     *
+     * @return self
+     */
+    public function setSourceId($source_id)
+    {
+        if (is_null($source_id)) {
+            throw new \InvalidArgumentException('non-nullable source_id cannot be null');
+        }
+        $this->container['source_id'] = $source_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets config
+     *
+     * @return object|null
+     */
+    public function getConfig()
+    {
+        return $this->container['config'];
+    }
+
+    /**
+     * Sets config
+     *
+     * @param object|null $config 配置
+     *
+     * @return self
+     */
+    public function setConfig($config)
+    {
+        if (is_null($config)) {
+            throw new \InvalidArgumentException('non-nullable config cannot be null');
+        }
+        $this->container['config'] = $config;
+
+        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));
+    }
+}
+
+

+ 754 - 0
api-test/client/lib/Model/PatchApiV3TermsTermRequest.php

@@ -0,0 +1,754 @@
+<?php
+/**
+ * PatchApiV3TermsTermRequest
+ *
+ * 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;
+
+/**
+ * PatchApiV3TermsTermRequest Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PatchApiV3TermsTermRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'patch_api_v3_terms_term__request';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'meaning' => 'string',
+        'other_meaning' => 'string',
+        'note' => 'string',
+        'summary' => 'string',
+        'quality' => 'string',
+        'content_type' => 'string',
+        'redirect' => 'string',
+        'language' => '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 = [
+        'meaning' => null,
+        'other_meaning' => null,
+        'note' => null,
+        'summary' => null,
+        'quality' => null,
+        'content_type' => null,
+        'redirect' => null,
+        'language' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'meaning' => false,
+        'other_meaning' => true,
+        'note' => true,
+        'summary' => true,
+        'quality' => true,
+        'content_type' => false,
+        'redirect' => true,
+        'language' => 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 = [
+        'meaning' => 'meaning',
+        'other_meaning' => 'other_meaning',
+        'note' => 'note',
+        'summary' => 'summary',
+        'quality' => 'quality',
+        'content_type' => 'content_type',
+        'redirect' => 'redirect',
+        'language' => 'language'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'meaning' => 'setMeaning',
+        'other_meaning' => 'setOtherMeaning',
+        'note' => 'setNote',
+        'summary' => 'setSummary',
+        'quality' => 'setQuality',
+        'content_type' => 'setContentType',
+        'redirect' => 'setRedirect',
+        'language' => 'setLanguage'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'meaning' => 'getMeaning',
+        'other_meaning' => 'getOtherMeaning',
+        'note' => 'getNote',
+        'summary' => 'getSummary',
+        'quality' => 'getQuality',
+        'content_type' => 'getContentType',
+        'redirect' => 'getRedirect',
+        'language' => 'getLanguage'
+    ];
+
+    /**
+     * 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;
+    }
+
+    public const QUALITY_FEATURED = 'featured';
+    public const QUALITY_STANDARD = 'standard';
+    public const QUALITY_DRAFT = 'draft';
+    public const QUALITY_PENDING = 'pending';
+    public const CONTENT_TYPE_MARKDOWN = 'markdown';
+    public const CONTENT_TYPE_MARKDOWN_E2 = 'markdown-e2';
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getQualityAllowableValues()
+    {
+        return [
+            self::QUALITY_FEATURED,
+            self::QUALITY_STANDARD,
+            self::QUALITY_DRAFT,
+            self::QUALITY_PENDING,
+        ];
+    }
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getContentTypeAllowableValues()
+    {
+        return [
+            self::CONTENT_TYPE_MARKDOWN,
+            self::CONTENT_TYPE_MARKDOWN_E2,
+        ];
+    }
+
+    /**
+     * 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('meaning', $data ?? [], null);
+        $this->setIfExists('other_meaning', $data ?? [], null);
+        $this->setIfExists('note', $data ?? [], null);
+        $this->setIfExists('summary', $data ?? [], null);
+        $this->setIfExists('quality', $data ?? [], null);
+        $this->setIfExists('content_type', $data ?? [], null);
+        $this->setIfExists('redirect', $data ?? [], null);
+        $this->setIfExists('language', $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 = [];
+
+        $allowedValues = $this->getQualityAllowableValues();
+        if (!is_null($this->container['quality']) && !in_array($this->container['quality'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'quality', must be one of '%s'",
+                $this->container['quality'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        $allowedValues = $this->getContentTypeAllowableValues();
+        if (!is_null($this->container['content_type']) && !in_array($this->container['content_type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'content_type', must be one of '%s'",
+                $this->container['content_type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        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 meaning
+     *
+     * @return string|null
+     */
+    public function getMeaning()
+    {
+        return $this->container['meaning'];
+    }
+
+    /**
+     * Sets meaning
+     *
+     * @param string|null $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 other_meaning
+     *
+     * @return string|null
+     */
+    public function getOtherMeaning()
+    {
+        return $this->container['other_meaning'];
+    }
+
+    /**
+     * Sets other_meaning
+     *
+     * @param string|null $other_meaning 其它释义
+     *
+     * @return self
+     */
+    public function setOtherMeaning($other_meaning)
+    {
+        if (is_null($other_meaning)) {
+            array_push($this->openAPINullablesSetToNull, 'other_meaning');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('other_meaning', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['other_meaning'] = $other_meaning;
+
+        return $this;
+    }
+
+    /**
+     * Gets note
+     *
+     * @return string|null
+     */
+    public function getNote()
+    {
+        return $this->container['note'];
+    }
+
+    /**
+     * Sets note
+     *
+     * @param string|null $note 正文
+     *
+     * @return self
+     */
+    public function setNote($note)
+    {
+        if (is_null($note)) {
+            array_push($this->openAPINullablesSetToNull, 'note');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('note', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['note'] = $note;
+
+        return $this;
+    }
+
+    /**
+     * Gets summary
+     *
+     * @return string|null
+     */
+    public function getSummary()
+    {
+        return $this->container['summary'];
+    }
+
+    /**
+     * Sets summary
+     *
+     * @param string|null $summary 摘要,格式与 note 相同
+     *
+     * @return self
+     */
+    public function setSummary($summary)
+    {
+        if (is_null($summary)) {
+            array_push($this->openAPINullablesSetToNull, 'summary');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('summary', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['summary'] = $summary;
+
+        return $this;
+    }
+
+    /**
+     * Gets quality
+     *
+     * @return string|null
+     */
+    public function getQuality()
+    {
+        return $this->container['quality'];
+    }
+
+    /**
+     * Sets quality
+     *
+     * @param string|null $quality 质量
+     *
+     * @return self
+     */
+    public function setQuality($quality)
+    {
+        if (is_null($quality)) {
+            array_push($this->openAPINullablesSetToNull, 'quality');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('quality', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $allowedValues = $this->getQualityAllowableValues();
+        if (!is_null($quality) && !in_array($quality, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'quality', must be one of '%s'",
+                    $quality,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['quality'] = $quality;
+
+        return $this;
+    }
+
+    /**
+     * Gets content_type
+     *
+     * @return string|null
+     */
+    public function getContentType()
+    {
+        return $this->container['content_type'];
+    }
+
+    /**
+     * Sets content_type
+     *
+     * @param string|null $content_type 正文方言
+     *
+     * @return self
+     */
+    public function setContentType($content_type)
+    {
+        if (is_null($content_type)) {
+            throw new \InvalidArgumentException('non-nullable content_type cannot be null');
+        }
+        $allowedValues = $this->getContentTypeAllowableValues();
+        if (!in_array($content_type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'content_type', must be one of '%s'",
+                    $content_type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['content_type'] = $content_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets redirect
+     *
+     * @return string|null
+     */
+    public function getRedirect()
+    {
+        return $this->container['redirect'];
+    }
+
+    /**
+     * Sets redirect
+     *
+     * @param string|null $redirect 重定向到 word 或 word@tag
+     *
+     * @return self
+     */
+    public function setRedirect($redirect)
+    {
+        if (is_null($redirect)) {
+            array_push($this->openAPINullablesSetToNull, 'redirect');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('redirect', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['redirect'] = $redirect;
+
+        return $this;
+    }
+
+    /**
+     * Gets language
+     *
+     * @return string|null
+     */
+    public function getLanguage()
+    {
+        return $this->container['language'];
+    }
+
+    /**
+     * Sets language
+     *
+     * @param string|null $language 语言(只有 studio 级术语能改)
+     *
+     * @return self
+     */
+    public function setLanguage($language)
+    {
+        if (is_null($language)) {
+            throw new \InvalidArgumentException('non-nullable language cannot be null');
+        }
+        $this->container['language'] = $language;
+
+        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/PostApiV3ChannelsBatchProgress200Response.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * PostApiV3ChannelsBatchProgress200Response
+ *
+ * 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;
+
+/**
+ * PostApiV3ChannelsBatchProgress200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3ChannelsBatchProgress200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_channels_batch_progress_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\PostApiV3ChannelsBatchProgress200ResponseDataInner[]',
+        'meta' => '\WikipaliApi\Model\PaginationMeta'
+    ];
+
+    /**
+     * 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\PostApiV3ChannelsBatchProgress200ResponseDataInner[]|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\PostApiV3ChannelsBatchProgress200ResponseDataInner[]|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\PaginationMeta|null
+     */
+    public function getMeta()
+    {
+        return $this->container['meta'];
+    }
+
+    /**
+     * Sets meta
+     *
+     * @param \WikipaliApi\Model\PaginationMeta|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));
+    }
+}
+
+

+ 954 - 0
api-test/client/lib/Model/PostApiV3ChannelsBatchProgress200ResponseDataInner.php

@@ -0,0 +1,954 @@
+<?php
+/**
+ * PostApiV3ChannelsBatchProgress200ResponseDataInner
+ *
+ * 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;
+
+/**
+ * PostApiV3ChannelsBatchProgress200ResponseDataInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3ChannelsBatchProgress200ResponseDataInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_channels_batch_progress_200_response_data_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'name' => 'string',
+        'summary' => 'string',
+        'type' => 'string',
+        'lang' => 'string',
+        'status' => 'int',
+        'is_system' => 'bool',
+        'source_type' => 'string',
+        'source_id' => 'string',
+        'owner' => '\WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerOwner',
+        'abilities' => '\WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerAbilities',
+        'final' => 'string[]',
+        'content_created_at' => 'string',
+        'content_updated_at' => 'string',
+        'created_at' => 'string',
+        'updated_at' => '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,
+        'name' => null,
+        'summary' => null,
+        'type' => null,
+        'lang' => null,
+        'status' => null,
+        'is_system' => null,
+        'source_type' => null,
+        'source_id' => null,
+        'owner' => null,
+        'abilities' => null,
+        'final' => null,
+        'content_created_at' => null,
+        'content_updated_at' => null,
+        'created_at' => null,
+        'updated_at' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'name' => false,
+        'summary' => true,
+        'type' => false,
+        'lang' => false,
+        'status' => false,
+        'is_system' => false,
+        'source_type' => false,
+        'source_id' => true,
+        'owner' => false,
+        'abilities' => false,
+        'final' => true,
+        'content_created_at' => true,
+        'content_updated_at' => true,
+        'created_at' => false,
+        'updated_at' => 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',
+        'name' => 'name',
+        'summary' => 'summary',
+        'type' => 'type',
+        'lang' => 'lang',
+        'status' => 'status',
+        'is_system' => 'is_system',
+        'source_type' => 'source_type',
+        'source_id' => 'source_id',
+        'owner' => 'owner',
+        'abilities' => 'abilities',
+        'final' => 'final',
+        'content_created_at' => 'content_created_at',
+        'content_updated_at' => 'content_updated_at',
+        'created_at' => 'created_at',
+        'updated_at' => 'updated_at'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'name' => 'setName',
+        'summary' => 'setSummary',
+        'type' => 'setType',
+        'lang' => 'setLang',
+        'status' => 'setStatus',
+        'is_system' => 'setIsSystem',
+        'source_type' => 'setSourceType',
+        'source_id' => 'setSourceId',
+        'owner' => 'setOwner',
+        'abilities' => 'setAbilities',
+        'final' => 'setFinal',
+        'content_created_at' => 'setContentCreatedAt',
+        'content_updated_at' => 'setContentUpdatedAt',
+        'created_at' => 'setCreatedAt',
+        'updated_at' => 'setUpdatedAt'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'name' => 'getName',
+        'summary' => 'getSummary',
+        'type' => 'getType',
+        'lang' => 'getLang',
+        'status' => 'getStatus',
+        'is_system' => 'getIsSystem',
+        'source_type' => 'getSourceType',
+        'source_id' => 'getSourceId',
+        'owner' => 'getOwner',
+        'abilities' => 'getAbilities',
+        'final' => 'getFinal',
+        'content_created_at' => 'getContentCreatedAt',
+        'content_updated_at' => 'getContentUpdatedAt',
+        'created_at' => 'getCreatedAt',
+        'updated_at' => 'getUpdatedAt'
+    ];
+
+    /**
+     * 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('name', $data ?? [], null);
+        $this->setIfExists('summary', $data ?? [], null);
+        $this->setIfExists('type', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('status', $data ?? [], null);
+        $this->setIfExists('is_system', $data ?? [], null);
+        $this->setIfExists('source_type', $data ?? [], null);
+        $this->setIfExists('source_id', $data ?? [], null);
+        $this->setIfExists('owner', $data ?? [], null);
+        $this->setIfExists('abilities', $data ?? [], null);
+        $this->setIfExists('final', $data ?? [], null);
+        $this->setIfExists('content_created_at', $data ?? [], null);
+        $this->setIfExists('content_updated_at', $data ?? [], null);
+        $this->setIfExists('created_at', $data ?? [], null);
+        $this->setIfExists('updated_at', $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 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 summary
+     *
+     * @return string|null
+     */
+    public function getSummary()
+    {
+        return $this->container['summary'];
+    }
+
+    /**
+     * Sets summary
+     *
+     * @param string|null $summary summary
+     *
+     * @return self
+     */
+    public function setSummary($summary)
+    {
+        if (is_null($summary)) {
+            array_push($this->openAPINullablesSetToNull, 'summary');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('summary', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['summary'] = $summary;
+
+        return $this;
+    }
+
+    /**
+     * Gets type
+     *
+     * @return string|null
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string|null $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $this->container['type'] = $type;
+
+        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 status
+     *
+     * @return int|null
+     */
+    public function getStatus()
+    {
+        return $this->container['status'];
+    }
+
+    /**
+     * Sets status
+     *
+     * @param int|null $status status
+     *
+     * @return self
+     */
+    public function setStatus($status)
+    {
+        if (is_null($status)) {
+            throw new \InvalidArgumentException('non-nullable status cannot be null');
+        }
+        $this->container['status'] = $status;
+
+        return $this;
+    }
+
+    /**
+     * Gets is_system
+     *
+     * @return bool|null
+     */
+    public function getIsSystem()
+    {
+        return $this->container['is_system'];
+    }
+
+    /**
+     * Sets is_system
+     *
+     * @param bool|null $is_system is_system
+     *
+     * @return self
+     */
+    public function setIsSystem($is_system)
+    {
+        if (is_null($is_system)) {
+            throw new \InvalidArgumentException('non-nullable is_system cannot be null');
+        }
+        $this->container['is_system'] = $is_system;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_type
+     *
+     * @return string|null
+     */
+    public function getSourceType()
+    {
+        return $this->container['source_type'];
+    }
+
+    /**
+     * Sets source_type
+     *
+     * @param string|null $source_type source_type
+     *
+     * @return self
+     */
+    public function setSourceType($source_type)
+    {
+        if (is_null($source_type)) {
+            throw new \InvalidArgumentException('non-nullable source_type cannot be null');
+        }
+        $this->container['source_type'] = $source_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_id
+     *
+     * @return string|null
+     */
+    public function getSourceId()
+    {
+        return $this->container['source_id'];
+    }
+
+    /**
+     * Sets source_id
+     *
+     * @param string|null $source_id source_id
+     *
+     * @return self
+     */
+    public function setSourceId($source_id)
+    {
+        if (is_null($source_id)) {
+            array_push($this->openAPINullablesSetToNull, 'source_id');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('source_id', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['source_id'] = $source_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets owner
+     *
+     * @return \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerOwner|null
+     */
+    public function getOwner()
+    {
+        return $this->container['owner'];
+    }
+
+    /**
+     * Sets owner
+     *
+     * @param \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerOwner|null $owner owner
+     *
+     * @return self
+     */
+    public function setOwner($owner)
+    {
+        if (is_null($owner)) {
+            throw new \InvalidArgumentException('non-nullable owner cannot be null');
+        }
+        $this->container['owner'] = $owner;
+
+        return $this;
+    }
+
+    /**
+     * Gets abilities
+     *
+     * @return \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerAbilities|null
+     */
+    public function getAbilities()
+    {
+        return $this->container['abilities'];
+    }
+
+    /**
+     * Sets abilities
+     *
+     * @param \WikipaliApi\Model\GetApiV3Channels200ResponseDataInnerAbilities|null $abilities abilities
+     *
+     * @return self
+     */
+    public function setAbilities($abilities)
+    {
+        if (is_null($abilities)) {
+            throw new \InvalidArgumentException('non-nullable abilities cannot be null');
+        }
+        $this->container['abilities'] = $abilities;
+
+        return $this;
+    }
+
+    /**
+     * Gets final
+     *
+     * @return string[]|null
+     */
+    public function getFinal()
+    {
+        return $this->container['final'];
+    }
+
+    /**
+     * Sets final
+     *
+     * @param string[]|null $final final
+     *
+     * @return self
+     */
+    public function setFinal($final)
+    {
+        if (is_null($final)) {
+            array_push($this->openAPINullablesSetToNull, 'final');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('final', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['final'] = $final;
+
+        return $this;
+    }
+
+    /**
+     * Gets content_created_at
+     *
+     * @return string|null
+     */
+    public function getContentCreatedAt()
+    {
+        return $this->container['content_created_at'];
+    }
+
+    /**
+     * Sets content_created_at
+     *
+     * @param string|null $content_created_at content_created_at
+     *
+     * @return self
+     */
+    public function setContentCreatedAt($content_created_at)
+    {
+        if (is_null($content_created_at)) {
+            array_push($this->openAPINullablesSetToNull, 'content_created_at');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('content_created_at', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['content_created_at'] = $content_created_at;
+
+        return $this;
+    }
+
+    /**
+     * Gets content_updated_at
+     *
+     * @return string|null
+     */
+    public function getContentUpdatedAt()
+    {
+        return $this->container['content_updated_at'];
+    }
+
+    /**
+     * Sets content_updated_at
+     *
+     * @param string|null $content_updated_at content_updated_at
+     *
+     * @return self
+     */
+    public function setContentUpdatedAt($content_updated_at)
+    {
+        if (is_null($content_updated_at)) {
+            array_push($this->openAPINullablesSetToNull, 'content_updated_at');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('content_updated_at', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['content_updated_at'] = $content_updated_at;
+
+        return $this;
+    }
+
+    /**
+     * Gets created_at
+     *
+     * @return string|null
+     */
+    public function getCreatedAt()
+    {
+        return $this->container['created_at'];
+    }
+
+    /**
+     * Sets created_at
+     *
+     * @param string|null $created_at created_at
+     *
+     * @return self
+     */
+    public function setCreatedAt($created_at)
+    {
+        if (is_null($created_at)) {
+            throw new \InvalidArgumentException('non-nullable created_at cannot be null');
+        }
+        $this->container['created_at'] = $created_at;
+
+        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)) {
+            throw new \InvalidArgumentException('non-nullable updated_at cannot be null');
+        }
+        $this->container['updated_at'] = $updated_at;
+
+        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));
+    }
+}
+
+

+ 446 - 0
api-test/client/lib/Model/PostApiV3ChannelsBatchProgressRequest.php

@@ -0,0 +1,446 @@
+<?php
+/**
+ * PostApiV3ChannelsBatchProgressRequest
+ *
+ * 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;
+
+/**
+ * PostApiV3ChannelsBatchProgressRequest Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3ChannelsBatchProgressRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_channels_batch_progress_request';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'sentences' => 'string[]',
+        'studio' => '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 = [
+        'sentences' => null,
+        'studio' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'sentences' => false,
+        'studio' => 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 = [
+        'sentences' => 'sentences',
+        'studio' => 'studio'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'sentences' => 'setSentences',
+        'studio' => 'setStudio'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'sentences' => 'getSentences',
+        'studio' => 'getStudio'
+    ];
+
+    /**
+     * 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('sentences', $data ?? [], null);
+        $this->setIfExists('studio', $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['sentences'] === null) {
+            $invalidProperties[] = "'sentences' 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 sentences
+     *
+     * @return string[]
+     */
+    public function getSentences()
+    {
+        return $this->container['sentences'];
+    }
+
+    /**
+     * Sets sentences
+     *
+     * @param string[] $sentences 句子 id 列表,`book-para-wordStart-wordEnd`,最多 2000 个
+     *
+     * @return self
+     */
+    public function setSentences($sentences)
+    {
+        if (is_null($sentences)) {
+            throw new \InvalidArgumentException('non-nullable sentences cannot be null');
+        }
+        $this->container['sentences'] = $sentences;
+
+        return $this;
+    }
+
+    /**
+     * Gets studio
+     *
+     * @return string|null
+     */
+    public function getStudio()
+    {
+        return $this->container['studio'];
+    }
+
+    /**
+     * Sets studio
+     *
+     * @param string|null $studio 只看这个 studio(用户或团队 uuid)名下的
+     *
+     * @return self
+     */
+    public function setStudio($studio)
+    {
+        if (is_null($studio)) {
+            throw new \InvalidArgumentException('non-nullable studio cannot be null');
+        }
+        $this->container['studio'] = $studio;
+
+        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/PostApiV3ChannelsChannelTerms200Response.php

@@ -0,0 +1,409 @@
+<?php
+/**
+ * PostApiV3ChannelsChannelTerms200Response
+ *
+ * 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;
+
+/**
+ * PostApiV3ChannelsChannelTerms200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3ChannelsChannelTerms200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_channels_channel_terms_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInner'
+    ];
+
+    /**
+     * 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\GetApiV3ChannelsChannelTerms200ResponseDataInner|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelTerms200ResponseDataInner|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/PostApiV3ChannelsChannelTermsImports200Response.php

@@ -0,0 +1,409 @@
+<?php
+/**
+ * PostApiV3ChannelsChannelTermsImports200Response
+ *
+ * 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;
+
+/**
+ * PostApiV3ChannelsChannelTermsImports200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3ChannelsChannelTermsImports200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_channels_channel_terms_imports_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\PostApiV3ChannelsChannelTermsImports200ResponseData'
+    ];
+
+    /**
+     * 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\PostApiV3ChannelsChannelTermsImports200ResponseData|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\PostApiV3ChannelsChannelTermsImports200ResponseData|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));
+    }
+}
+
+

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

@@ -0,0 +1,545 @@
+<?php
+/**
+ * PostApiV3ChannelsChannelTermsImports200ResponseData
+ *
+ * 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;
+
+/**
+ * PostApiV3ChannelsChannelTermsImports200ResponseData Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3ChannelsChannelTermsImports200ResponseData implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_channels_channel_terms_imports_200_response_data';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'created' => 'int',
+        'updated' => 'int',
+        'unchanged' => 'int',
+        'reindexed' => 'bool',
+        'errors' => '\WikipaliApi\Model\PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner[]'
+    ];
+
+    /**
+     * 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 = [
+        'created' => null,
+        'updated' => null,
+        'unchanged' => null,
+        'reindexed' => null,
+        'errors' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'created' => false,
+        'updated' => false,
+        'unchanged' => false,
+        'reindexed' => false,
+        'errors' => 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 = [
+        'created' => 'created',
+        'updated' => 'updated',
+        'unchanged' => 'unchanged',
+        'reindexed' => 'reindexed',
+        'errors' => 'errors'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'created' => 'setCreated',
+        'updated' => 'setUpdated',
+        'unchanged' => 'setUnchanged',
+        'reindexed' => 'setReindexed',
+        'errors' => 'setErrors'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'created' => 'getCreated',
+        'updated' => 'getUpdated',
+        'unchanged' => 'getUnchanged',
+        'reindexed' => 'getReindexed',
+        'errors' => 'getErrors'
+    ];
+
+    /**
+     * 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('created', $data ?? [], null);
+        $this->setIfExists('updated', $data ?? [], null);
+        $this->setIfExists('unchanged', $data ?? [], null);
+        $this->setIfExists('reindexed', $data ?? [], null);
+        $this->setIfExists('errors', $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 created
+     *
+     * @return int|null
+     */
+    public function getCreated()
+    {
+        return $this->container['created'];
+    }
+
+    /**
+     * Sets created
+     *
+     * @param int|null $created created
+     *
+     * @return self
+     */
+    public function setCreated($created)
+    {
+        if (is_null($created)) {
+            throw new \InvalidArgumentException('non-nullable created cannot be null');
+        }
+        $this->container['created'] = $created;
+
+        return $this;
+    }
+
+    /**
+     * Gets updated
+     *
+     * @return int|null
+     */
+    public function getUpdated()
+    {
+        return $this->container['updated'];
+    }
+
+    /**
+     * Sets updated
+     *
+     * @param int|null $updated updated
+     *
+     * @return self
+     */
+    public function setUpdated($updated)
+    {
+        if (is_null($updated)) {
+            throw new \InvalidArgumentException('non-nullable updated cannot be null');
+        }
+        $this->container['updated'] = $updated;
+
+        return $this;
+    }
+
+    /**
+     * Gets unchanged
+     *
+     * @return int|null
+     */
+    public function getUnchanged()
+    {
+        return $this->container['unchanged'];
+    }
+
+    /**
+     * Sets unchanged
+     *
+     * @param int|null $unchanged unchanged
+     *
+     * @return self
+     */
+    public function setUnchanged($unchanged)
+    {
+        if (is_null($unchanged)) {
+            throw new \InvalidArgumentException('non-nullable unchanged cannot be null');
+        }
+        $this->container['unchanged'] = $unchanged;
+
+        return $this;
+    }
+
+    /**
+     * Gets reindexed
+     *
+     * @return bool|null
+     */
+    public function getReindexed()
+    {
+        return $this->container['reindexed'];
+    }
+
+    /**
+     * Sets reindexed
+     *
+     * @param bool|null $reindexed reindexed
+     *
+     * @return self
+     */
+    public function setReindexed($reindexed)
+    {
+        if (is_null($reindexed)) {
+            throw new \InvalidArgumentException('non-nullable reindexed cannot be null');
+        }
+        $this->container['reindexed'] = $reindexed;
+
+        return $this;
+    }
+
+    /**
+     * Gets errors
+     *
+     * @return \WikipaliApi\Model\PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner[]|null
+     */
+    public function getErrors()
+    {
+        return $this->container['errors'];
+    }
+
+    /**
+     * Sets errors
+     *
+     * @param \WikipaliApi\Model\PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner[]|null $errors errors
+     *
+     * @return self
+     */
+    public function setErrors($errors)
+    {
+        if (is_null($errors)) {
+            throw new \InvalidArgumentException('non-nullable errors cannot be null');
+        }
+        $this->container['errors'] = $errors;
+
+        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/PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner.php

@@ -0,0 +1,443 @@
+<?php
+/**
+ * PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner
+ *
+ * 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;
+
+/**
+ * PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3ChannelsChannelTermsImports200ResponseDataErrorsInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_channels_channel_terms_imports_200_response_data_errors_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'row' => 'int',
+        'message' => '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 = [
+        'row' => null,
+        'message' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'row' => false,
+        'message' => 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 = [
+        'row' => 'row',
+        'message' => 'message'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'row' => 'setRow',
+        'message' => 'setMessage'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'row' => 'getRow',
+        'message' => 'getMessage'
+    ];
+
+    /**
+     * 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('row', $data ?? [], null);
+        $this->setIfExists('message', $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 row
+     *
+     * @return int|null
+     */
+    public function getRow()
+    {
+        return $this->container['row'];
+    }
+
+    /**
+     * Sets row
+     *
+     * @param int|null $row row
+     *
+     * @return self
+     */
+    public function setRow($row)
+    {
+        if (is_null($row)) {
+            throw new \InvalidArgumentException('non-nullable row cannot be null');
+        }
+        $this->container['row'] = $row;
+
+        return $this;
+    }
+
+    /**
+     * Gets message
+     *
+     * @return string|null
+     */
+    public function getMessage()
+    {
+        return $this->container['message'];
+    }
+
+    /**
+     * Sets message
+     *
+     * @param string|null $message message
+     *
+     * @return self
+     */
+    public function setMessage($message)
+    {
+        if (is_null($message)) {
+            throw new \InvalidArgumentException('non-nullable message cannot be null');
+        }
+        $this->container['message'] = $message;
+
+        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));
+    }
+}
+
+

+ 801 - 0
api-test/client/lib/Model/PostApiV3ChannelsChannelTermsRequest.php

@@ -0,0 +1,801 @@
+<?php
+/**
+ * PostApiV3ChannelsChannelTermsRequest
+ *
+ * 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;
+
+/**
+ * PostApiV3ChannelsChannelTermsRequest Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3ChannelsChannelTermsRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_channels_channel_terms_request';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'word' => 'string',
+        'tag' => 'string',
+        'meaning' => 'string',
+        'other_meaning' => 'string',
+        'note' => 'string',
+        'summary' => 'string',
+        'quality' => 'string',
+        'content_type' => 'string',
+        'redirect' => '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 = [
+        'word' => null,
+        'tag' => null,
+        'meaning' => null,
+        'other_meaning' => null,
+        'note' => null,
+        'summary' => null,
+        'quality' => null,
+        'content_type' => null,
+        'redirect' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'word' => false,
+        'tag' => true,
+        'meaning' => false,
+        'other_meaning' => true,
+        'note' => true,
+        'summary' => true,
+        'quality' => true,
+        'content_type' => false,
+        'redirect' => true
+    ];
+
+    /**
+     * 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 = [
+        'word' => 'word',
+        'tag' => 'tag',
+        'meaning' => 'meaning',
+        'other_meaning' => 'other_meaning',
+        'note' => 'note',
+        'summary' => 'summary',
+        'quality' => 'quality',
+        'content_type' => 'content_type',
+        'redirect' => 'redirect'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'word' => 'setWord',
+        'tag' => 'setTag',
+        'meaning' => 'setMeaning',
+        'other_meaning' => 'setOtherMeaning',
+        'note' => 'setNote',
+        'summary' => 'setSummary',
+        'quality' => 'setQuality',
+        'content_type' => 'setContentType',
+        'redirect' => 'setRedirect'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'word' => 'getWord',
+        'tag' => 'getTag',
+        'meaning' => 'getMeaning',
+        'other_meaning' => 'getOtherMeaning',
+        'note' => 'getNote',
+        'summary' => 'getSummary',
+        'quality' => 'getQuality',
+        'content_type' => 'getContentType',
+        'redirect' => 'getRedirect'
+    ];
+
+    /**
+     * 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;
+    }
+
+    public const QUALITY_FEATURED = 'featured';
+    public const QUALITY_STANDARD = 'standard';
+    public const QUALITY_DRAFT = 'draft';
+    public const QUALITY_PENDING = 'pending';
+    public const CONTENT_TYPE_MARKDOWN = 'markdown';
+    public const CONTENT_TYPE_MARKDOWN_E2 = 'markdown-e2';
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getQualityAllowableValues()
+    {
+        return [
+            self::QUALITY_FEATURED,
+            self::QUALITY_STANDARD,
+            self::QUALITY_DRAFT,
+            self::QUALITY_PENDING,
+        ];
+    }
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getContentTypeAllowableValues()
+    {
+        return [
+            self::CONTENT_TYPE_MARKDOWN,
+            self::CONTENT_TYPE_MARKDOWN_E2,
+        ];
+    }
+
+    /**
+     * 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('word', $data ?? [], null);
+        $this->setIfExists('tag', $data ?? [], null);
+        $this->setIfExists('meaning', $data ?? [], null);
+        $this->setIfExists('other_meaning', $data ?? [], null);
+        $this->setIfExists('note', $data ?? [], null);
+        $this->setIfExists('summary', $data ?? [], null);
+        $this->setIfExists('quality', $data ?? [], null);
+        $this->setIfExists('content_type', $data ?? [], 'markdown-e2');
+        $this->setIfExists('redirect', $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['word'] === null) {
+            $invalidProperties[] = "'word' can't be null";
+        }
+        if ($this->container['meaning'] === null) {
+            $invalidProperties[] = "'meaning' can't be null";
+        }
+        $allowedValues = $this->getQualityAllowableValues();
+        if (!is_null($this->container['quality']) && !in_array($this->container['quality'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'quality', must be one of '%s'",
+                $this->container['quality'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        $allowedValues = $this->getContentTypeAllowableValues();
+        if (!is_null($this->container['content_type']) && !in_array($this->container['content_type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'content_type', must be one of '%s'",
+                $this->container['content_type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        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 word
+     *
+     * @return string
+     */
+    public function getWord()
+    {
+        return $this->container['word'];
+    }
+
+    /**
+     * Sets word
+     *
+     * @param string $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 义项(同词多义时区分),不能含 @,建立后不能改
+     *
+     * @return self
+     */
+    public function setTag($tag)
+    {
+        if (is_null($tag)) {
+            array_push($this->openAPINullablesSetToNull, 'tag');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('tag', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['tag'] = $tag;
+
+        return $this;
+    }
+
+    /**
+     * Gets meaning
+     *
+     * @return string
+     */
+    public function getMeaning()
+    {
+        return $this->container['meaning'];
+    }
+
+    /**
+     * Sets meaning
+     *
+     * @param string $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 other_meaning
+     *
+     * @return string|null
+     */
+    public function getOtherMeaning()
+    {
+        return $this->container['other_meaning'];
+    }
+
+    /**
+     * Sets other_meaning
+     *
+     * @param string|null $other_meaning 其它释义
+     *
+     * @return self
+     */
+    public function setOtherMeaning($other_meaning)
+    {
+        if (is_null($other_meaning)) {
+            array_push($this->openAPINullablesSetToNull, 'other_meaning');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('other_meaning', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['other_meaning'] = $other_meaning;
+
+        return $this;
+    }
+
+    /**
+     * Gets note
+     *
+     * @return string|null
+     */
+    public function getNote()
+    {
+        return $this->container['note'];
+    }
+
+    /**
+     * Sets note
+     *
+     * @param string|null $note 正文
+     *
+     * @return self
+     */
+    public function setNote($note)
+    {
+        if (is_null($note)) {
+            array_push($this->openAPINullablesSetToNull, 'note');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('note', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['note'] = $note;
+
+        return $this;
+    }
+
+    /**
+     * Gets summary
+     *
+     * @return string|null
+     */
+    public function getSummary()
+    {
+        return $this->container['summary'];
+    }
+
+    /**
+     * Sets summary
+     *
+     * @param string|null $summary 摘要,格式与 note 相同
+     *
+     * @return self
+     */
+    public function setSummary($summary)
+    {
+        if (is_null($summary)) {
+            array_push($this->openAPINullablesSetToNull, 'summary');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('summary', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['summary'] = $summary;
+
+        return $this;
+    }
+
+    /**
+     * Gets quality
+     *
+     * @return string|null
+     */
+    public function getQuality()
+    {
+        return $this->container['quality'];
+    }
+
+    /**
+     * Sets quality
+     *
+     * @param string|null $quality 质量
+     *
+     * @return self
+     */
+    public function setQuality($quality)
+    {
+        if (is_null($quality)) {
+            array_push($this->openAPINullablesSetToNull, 'quality');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('quality', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $allowedValues = $this->getQualityAllowableValues();
+        if (!is_null($quality) && !in_array($quality, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'quality', must be one of '%s'",
+                    $quality,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['quality'] = $quality;
+
+        return $this;
+    }
+
+    /**
+     * Gets content_type
+     *
+     * @return string|null
+     */
+    public function getContentType()
+    {
+        return $this->container['content_type'];
+    }
+
+    /**
+     * Sets content_type
+     *
+     * @param string|null $content_type 正文方言
+     *
+     * @return self
+     */
+    public function setContentType($content_type)
+    {
+        if (is_null($content_type)) {
+            throw new \InvalidArgumentException('non-nullable content_type cannot be null');
+        }
+        $allowedValues = $this->getContentTypeAllowableValues();
+        if (!in_array($content_type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'content_type', must be one of '%s'",
+                    $content_type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['content_type'] = $content_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets redirect
+     *
+     * @return string|null
+     */
+    public function getRedirect()
+    {
+        return $this->container['redirect'];
+    }
+
+    /**
+     * Sets redirect
+     *
+     * @param string|null $redirect 重定向到 word 或 word@tag
+     *
+     * @return self
+     */
+    public function setRedirect($redirect)
+    {
+        if (is_null($redirect)) {
+            array_push($this->openAPINullablesSetToNull, 'redirect');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('redirect', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['redirect'] = $redirect;
+
+        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));
+    }
+}
+
+

+ 700 - 0
api-test/client/lib/Model/PostApiV3StudiosStudioChannelsRequest.php

@@ -0,0 +1,700 @@
+<?php
+/**
+ * PostApiV3StudiosStudioChannelsRequest
+ *
+ * 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;
+
+/**
+ * PostApiV3StudiosStudioChannelsRequest Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3StudiosStudioChannelsRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_studios_studio_channels_request';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'name' => 'string',
+        'type' => 'string',
+        'lang' => 'string',
+        'summary' => 'string',
+        'status' => 'int',
+        'source_type' => 'string',
+        'source_id' => '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,
+        'type' => null,
+        'lang' => null,
+        'summary' => null,
+        'status' => null,
+        'source_type' => null,
+        'source_id' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'name' => false,
+        'type' => false,
+        'lang' => false,
+        'summary' => false,
+        'status' => false,
+        'source_type' => false,
+        'source_id' => 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',
+        'type' => 'type',
+        'lang' => 'lang',
+        'summary' => 'summary',
+        'status' => 'status',
+        'source_type' => 'source_type',
+        'source_id' => 'source_id'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'name' => 'setName',
+        'type' => 'setType',
+        'lang' => 'setLang',
+        'summary' => 'setSummary',
+        'status' => 'setStatus',
+        'source_type' => 'setSourceType',
+        'source_id' => 'setSourceId'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'name' => 'getName',
+        'type' => 'getType',
+        'lang' => 'getLang',
+        'summary' => 'getSummary',
+        'status' => 'getStatus',
+        'source_type' => 'getSourceType',
+        'source_id' => 'getSourceId'
+    ];
+
+    /**
+     * 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;
+    }
+
+    public const TYPE_TRANSLATION = 'translation';
+    public const TYPE_NISSAYA = 'nissaya';
+    public const TYPE_ORIGINAL = 'original';
+    public const TYPE_WBW = 'wbw';
+    public const TYPE_COMMENTARY = 'commentary';
+    public const TYPE_SIMILAR = 'similar';
+    public const SOURCE_TYPE_ORIGINAL = 'original';
+    public const SOURCE_TYPE_REPRINT = 'reprint';
+    public const SOURCE_TYPE_AI = 'ai';
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getTypeAllowableValues()
+    {
+        return [
+            self::TYPE_TRANSLATION,
+            self::TYPE_NISSAYA,
+            self::TYPE_ORIGINAL,
+            self::TYPE_WBW,
+            self::TYPE_COMMENTARY,
+            self::TYPE_SIMILAR,
+        ];
+    }
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getSourceTypeAllowableValues()
+    {
+        return [
+            self::SOURCE_TYPE_ORIGINAL,
+            self::SOURCE_TYPE_REPRINT,
+            self::SOURCE_TYPE_AI,
+        ];
+    }
+
+    /**
+     * 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('type', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('summary', $data ?? [], null);
+        $this->setIfExists('status', $data ?? [], 10);
+        $this->setIfExists('source_type', $data ?? [], null);
+        $this->setIfExists('source_id', $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['name'] === null) {
+            $invalidProperties[] = "'name' can't be null";
+        }
+        if ($this->container['type'] === null) {
+            $invalidProperties[] = "'type' can't be null";
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'type', must be one of '%s'",
+                $this->container['type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        if ($this->container['lang'] === null) {
+            $invalidProperties[] = "'lang' can't be null";
+        }
+        $allowedValues = $this->getSourceTypeAllowableValues();
+        if (!is_null($this->container['source_type']) && !in_array($this->container['source_type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'source_type', must be one of '%s'",
+                $this->container['source_type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        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
+     */
+    public function getName()
+    {
+        return $this->container['name'];
+    }
+
+    /**
+     * Sets name
+     *
+     * @param string $name 名字,最长 128
+     *
+     * @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 type
+     *
+     * @return string
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string $type 类型
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $allowedValues = $this->getTypeAllowableValues();
+        if (!in_array($type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'type', must be one of '%s'",
+                    $type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['type'] = $type;
+
+        return $this;
+    }
+
+    /**
+     * Gets lang
+     *
+     * @return string
+     */
+    public function getLang()
+    {
+        return $this->container['lang'];
+    }
+
+    /**
+     * Sets lang
+     *
+     * @param string $lang 语言,最长 16
+     *
+     * @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 summary
+     *
+     * @return string|null
+     */
+    public function getSummary()
+    {
+        return $this->container['summary'];
+    }
+
+    /**
+     * Sets summary
+     *
+     * @param string|null $summary 简介,最长 1024
+     *
+     * @return self
+     */
+    public function setSummary($summary)
+    {
+        if (is_null($summary)) {
+            throw new \InvalidArgumentException('non-nullable summary cannot be null');
+        }
+        $this->container['summary'] = $summary;
+
+        return $this;
+    }
+
+    /**
+     * Gets status
+     *
+     * @return int|null
+     */
+    public function getStatus()
+    {
+        return $this->container['status'];
+    }
+
+    /**
+     * Sets status
+     *
+     * @param int|null $status 10 私有、20 公开不列出(拿到链接能看,不进任何公开列表)、30 公开
+     *
+     * @return self
+     */
+    public function setStatus($status)
+    {
+        if (is_null($status)) {
+            throw new \InvalidArgumentException('non-nullable status cannot be null');
+        }
+        $this->container['status'] = $status;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_type
+     *
+     * @return string|null
+     */
+    public function getSourceType()
+    {
+        return $this->container['source_type'];
+    }
+
+    /**
+     * Sets source_type
+     *
+     * @param string|null $source_type 来源
+     *
+     * @return self
+     */
+    public function setSourceType($source_type)
+    {
+        if (is_null($source_type)) {
+            throw new \InvalidArgumentException('non-nullable source_type cannot be null');
+        }
+        $allowedValues = $this->getSourceTypeAllowableValues();
+        if (!in_array($source_type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'source_type', must be one of '%s'",
+                    $source_type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['source_type'] = $source_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets source_id
+     *
+     * @return string|null
+     */
+    public function getSourceId()
+    {
+        return $this->container['source_id'];
+    }
+
+    /**
+     * Sets source_id
+     *
+     * @param string|null $source_id 来源 id
+     *
+     * @return self
+     */
+    public function setSourceId($source_id)
+    {
+        if (is_null($source_id)) {
+            throw new \InvalidArgumentException('non-nullable source_id cannot be null');
+        }
+        $this->container['source_id'] = $source_id;
+
+        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));
+    }
+}
+
+

+ 838 - 0
api-test/client/lib/Model/PostApiV3StudiosStudioTermsRequest.php

@@ -0,0 +1,838 @@
+<?php
+/**
+ * PostApiV3StudiosStudioTermsRequest
+ *
+ * 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;
+
+/**
+ * PostApiV3StudiosStudioTermsRequest Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PostApiV3StudiosStudioTermsRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'post_api_v3_studios_studio_terms_request';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'word' => 'string',
+        'tag' => 'string',
+        'meaning' => 'string',
+        'language' => 'string',
+        'other_meaning' => 'string',
+        'note' => 'string',
+        'summary' => 'string',
+        'quality' => 'string',
+        'content_type' => 'string',
+        'redirect' => '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 = [
+        'word' => null,
+        'tag' => null,
+        'meaning' => null,
+        'language' => null,
+        'other_meaning' => null,
+        'note' => null,
+        'summary' => null,
+        'quality' => null,
+        'content_type' => null,
+        'redirect' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'word' => false,
+        'tag' => true,
+        'meaning' => false,
+        'language' => false,
+        'other_meaning' => true,
+        'note' => true,
+        'summary' => true,
+        'quality' => true,
+        'content_type' => false,
+        'redirect' => true
+    ];
+
+    /**
+     * 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 = [
+        'word' => 'word',
+        'tag' => 'tag',
+        'meaning' => 'meaning',
+        'language' => 'language',
+        'other_meaning' => 'other_meaning',
+        'note' => 'note',
+        'summary' => 'summary',
+        'quality' => 'quality',
+        'content_type' => 'content_type',
+        'redirect' => 'redirect'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'word' => 'setWord',
+        'tag' => 'setTag',
+        'meaning' => 'setMeaning',
+        'language' => 'setLanguage',
+        'other_meaning' => 'setOtherMeaning',
+        'note' => 'setNote',
+        'summary' => 'setSummary',
+        'quality' => 'setQuality',
+        'content_type' => 'setContentType',
+        'redirect' => 'setRedirect'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'word' => 'getWord',
+        'tag' => 'getTag',
+        'meaning' => 'getMeaning',
+        'language' => 'getLanguage',
+        'other_meaning' => 'getOtherMeaning',
+        'note' => 'getNote',
+        'summary' => 'getSummary',
+        'quality' => 'getQuality',
+        'content_type' => 'getContentType',
+        'redirect' => 'getRedirect'
+    ];
+
+    /**
+     * 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;
+    }
+
+    public const QUALITY_FEATURED = 'featured';
+    public const QUALITY_STANDARD = 'standard';
+    public const QUALITY_DRAFT = 'draft';
+    public const QUALITY_PENDING = 'pending';
+    public const CONTENT_TYPE_MARKDOWN = 'markdown';
+    public const CONTENT_TYPE_MARKDOWN_E2 = 'markdown-e2';
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getQualityAllowableValues()
+    {
+        return [
+            self::QUALITY_FEATURED,
+            self::QUALITY_STANDARD,
+            self::QUALITY_DRAFT,
+            self::QUALITY_PENDING,
+        ];
+    }
+
+    /**
+     * Gets allowable values of the enum
+     *
+     * @return string[]
+     */
+    public function getContentTypeAllowableValues()
+    {
+        return [
+            self::CONTENT_TYPE_MARKDOWN,
+            self::CONTENT_TYPE_MARKDOWN_E2,
+        ];
+    }
+
+    /**
+     * 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('word', $data ?? [], null);
+        $this->setIfExists('tag', $data ?? [], null);
+        $this->setIfExists('meaning', $data ?? [], null);
+        $this->setIfExists('language', $data ?? [], null);
+        $this->setIfExists('other_meaning', $data ?? [], null);
+        $this->setIfExists('note', $data ?? [], null);
+        $this->setIfExists('summary', $data ?? [], null);
+        $this->setIfExists('quality', $data ?? [], null);
+        $this->setIfExists('content_type', $data ?? [], 'markdown-e2');
+        $this->setIfExists('redirect', $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['word'] === null) {
+            $invalidProperties[] = "'word' can't be null";
+        }
+        if ($this->container['meaning'] === null) {
+            $invalidProperties[] = "'meaning' can't be null";
+        }
+        if ($this->container['language'] === null) {
+            $invalidProperties[] = "'language' can't be null";
+        }
+        $allowedValues = $this->getQualityAllowableValues();
+        if (!is_null($this->container['quality']) && !in_array($this->container['quality'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'quality', must be one of '%s'",
+                $this->container['quality'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        $allowedValues = $this->getContentTypeAllowableValues();
+        if (!is_null($this->container['content_type']) && !in_array($this->container['content_type'], $allowedValues, true)) {
+            $invalidProperties[] = sprintf(
+                "invalid value '%s' for 'content_type', must be one of '%s'",
+                $this->container['content_type'],
+                implode("', '", $allowedValues)
+            );
+        }
+
+        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 word
+     *
+     * @return string
+     */
+    public function getWord()
+    {
+        return $this->container['word'];
+    }
+
+    /**
+     * Sets word
+     *
+     * @param string $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 义项(同词多义时区分),不能含 @,建立后不能改
+     *
+     * @return self
+     */
+    public function setTag($tag)
+    {
+        if (is_null($tag)) {
+            array_push($this->openAPINullablesSetToNull, 'tag');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('tag', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['tag'] = $tag;
+
+        return $this;
+    }
+
+    /**
+     * Gets meaning
+     *
+     * @return string
+     */
+    public function getMeaning()
+    {
+        return $this->container['meaning'];
+    }
+
+    /**
+     * Sets meaning
+     *
+     * @param string $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 language
+     *
+     * @return string
+     */
+    public function getLanguage()
+    {
+        return $this->container['language'];
+    }
+
+    /**
+     * Sets language
+     *
+     * @param string $language 语言
+     *
+     * @return self
+     */
+    public function setLanguage($language)
+    {
+        if (is_null($language)) {
+            throw new \InvalidArgumentException('non-nullable language cannot be null');
+        }
+        $this->container['language'] = $language;
+
+        return $this;
+    }
+
+    /**
+     * Gets other_meaning
+     *
+     * @return string|null
+     */
+    public function getOtherMeaning()
+    {
+        return $this->container['other_meaning'];
+    }
+
+    /**
+     * Sets other_meaning
+     *
+     * @param string|null $other_meaning 其它释义
+     *
+     * @return self
+     */
+    public function setOtherMeaning($other_meaning)
+    {
+        if (is_null($other_meaning)) {
+            array_push($this->openAPINullablesSetToNull, 'other_meaning');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('other_meaning', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['other_meaning'] = $other_meaning;
+
+        return $this;
+    }
+
+    /**
+     * Gets note
+     *
+     * @return string|null
+     */
+    public function getNote()
+    {
+        return $this->container['note'];
+    }
+
+    /**
+     * Sets note
+     *
+     * @param string|null $note 正文
+     *
+     * @return self
+     */
+    public function setNote($note)
+    {
+        if (is_null($note)) {
+            array_push($this->openAPINullablesSetToNull, 'note');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('note', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['note'] = $note;
+
+        return $this;
+    }
+
+    /**
+     * Gets summary
+     *
+     * @return string|null
+     */
+    public function getSummary()
+    {
+        return $this->container['summary'];
+    }
+
+    /**
+     * Sets summary
+     *
+     * @param string|null $summary 摘要,格式与 note 相同
+     *
+     * @return self
+     */
+    public function setSummary($summary)
+    {
+        if (is_null($summary)) {
+            array_push($this->openAPINullablesSetToNull, 'summary');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('summary', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['summary'] = $summary;
+
+        return $this;
+    }
+
+    /**
+     * Gets quality
+     *
+     * @return string|null
+     */
+    public function getQuality()
+    {
+        return $this->container['quality'];
+    }
+
+    /**
+     * Sets quality
+     *
+     * @param string|null $quality 质量
+     *
+     * @return self
+     */
+    public function setQuality($quality)
+    {
+        if (is_null($quality)) {
+            array_push($this->openAPINullablesSetToNull, 'quality');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('quality', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $allowedValues = $this->getQualityAllowableValues();
+        if (!is_null($quality) && !in_array($quality, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'quality', must be one of '%s'",
+                    $quality,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['quality'] = $quality;
+
+        return $this;
+    }
+
+    /**
+     * Gets content_type
+     *
+     * @return string|null
+     */
+    public function getContentType()
+    {
+        return $this->container['content_type'];
+    }
+
+    /**
+     * Sets content_type
+     *
+     * @param string|null $content_type 正文方言
+     *
+     * @return self
+     */
+    public function setContentType($content_type)
+    {
+        if (is_null($content_type)) {
+            throw new \InvalidArgumentException('non-nullable content_type cannot be null');
+        }
+        $allowedValues = $this->getContentTypeAllowableValues();
+        if (!in_array($content_type, $allowedValues, true)) {
+            throw new \InvalidArgumentException(
+                sprintf(
+                    "Invalid value '%s' for 'content_type', must be one of '%s'",
+                    $content_type,
+                    implode("', '", $allowedValues)
+                )
+            );
+        }
+        $this->container['content_type'] = $content_type;
+
+        return $this;
+    }
+
+    /**
+     * Gets redirect
+     *
+     * @return string|null
+     */
+    public function getRedirect()
+    {
+        return $this->container['redirect'];
+    }
+
+    /**
+     * Sets redirect
+     *
+     * @param string|null $redirect 重定向到 word 或 word@tag
+     *
+     * @return self
+     */
+    public function setRedirect($redirect)
+    {
+        if (is_null($redirect)) {
+            array_push($this->openAPINullablesSetToNull, 'redirect');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('redirect', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['redirect'] = $redirect;
+
+        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));
+    }
+}
+
+

+ 0 - 28
api-v13/app/Console/Commands/TestMdRender.php

@@ -3,7 +3,6 @@
 namespace App\Console\Commands;
 
 use App\Http\Api\MdRender;
-use App\Services\Template\TemplateService;
 use App\Tools\Markdown;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
@@ -48,33 +47,6 @@ class TestMdRender extends Command
             return 0;
         }
 
-        $content = <<<'md'
-        # 测试
-        ## 测试
-
-        {{note|text=这是一个普通信息提示|type=info}}
-
-        下面是一个警告信息:
-        {{warning|message=请注意这个重要提示|title=重要}}
-
-        你也可以使用位置参数:
-        {{note|
-        成功完成操作|
-        success}}
-
-        支持嵌套模板:
-        {{info|
-        content=外层信息 {{note|内嵌提示|warning}} 继续外层|
-        title=嵌套示例}}
-
-        **粗体文本** 和 *斜体文本* 也被支持。
-        md;
-        $parser = new TemplateService(false);
-        $render = $parser->parseAndRender($content, 'json');
-        var_dump($render);
-
-        return 0;
-
         Log::info('md render start item='.$this->argument('item'));
         $data = [];
         $data['bold'] = <<<'md'

+ 35 - 80
api-v13/app/Http/Api/ChannelApi.php

@@ -3,41 +3,37 @@
 namespace App\Http\Api;
 
 use App\Models\Channel;
-use Illuminate\Support\Facades\Log;
-use Illuminate\Support\Str;
-
+use App\Services\ChannelService;
+use App\Services\V3\ChannelAbilityService;
+
+/**
+ * **v2 专用,v3 代码一律不准引用本类。**
+ *
+ * 两部分:
+ * - 纯能力(取 channel 摘要、系统 channel、自定义书 channel):**冻结的转发壳**,实现全在
+ *   {@see ChannelService},新代码直接注入它。保留这些方法只为 v2 的几十个调用点不必改。
+ * - 权限判定(`getCanReadByUser` … `canManageByUser`):v2 的旧口径——只认拥有者本人 + 共享,
+ *   不认团队角色、不排除软删以外的状态。**不转发到 v3**:v3 的口径(团队角色、status 20 公开不列出)
+ *   在 {@see ChannelAbilityService},把 v2 转过去等于改 v2 权限(铁律 1)。
+ *   原地留着,随 v4 下线删除。
+ *
+ * @deprecated 纯能力用 App\Services\ChannelService;权限用 App\Services\V3\ChannelAbilityService
+ */
 class ChannelApi
 {
+    /** @deprecated 用 ChannelService::summary() */
     public static function getById(?string $id)
     {
-        if (! Str::isUuid($id)) {
-            return false;
-        }
-        $channel = Channel::where('uid', $id)->first();
-        if ($channel) {
-            return [
-                'id' => $id,
-                'name' => $channel['name'],
-                'type' => $channel['type'],
-                'lang' => $channel['lang'],
-                'studio_id' => $channel['owner_uid'],
-                'status' => $channel['status'],
-            ];
-        } else {
-            return false;
-        }
+        return self::service()->summary($id);
     }
 
+    /** @deprecated 用 ChannelService::summaries() */
     public static function getByIds(array $ids)
     {
-        $channels = [];
-        foreach ($ids as $id) {
-            $channels[] = self::getById($id);
-        }
-
-        return $channels;
+        return self::service()->summaries($ids);
     }
 
+    /** v2 口径,v3 用 ChannelAbilityService::scopeListable() / abilities() */
     public static function getCanReadByUser($userUuid = null)
     {
         // 获取 user 在某章节 所有有权限的 channel 列表
@@ -70,6 +66,7 @@ class ChannelApi
         return $output;
     }
 
+    /** v2 口径,v3 用 ChannelAbilityService::writableUids() */
     public static function getCanEditByUser($userUuid = null)
     {
         // 获取 user 在某章节 所有有权限的 channel 列表
@@ -107,6 +104,7 @@ class ChannelApi
         return in_array($channelUid, $channels);
     }
 
+    /** v2 口径,v3 用 ChannelAbilityService::canWrite() */
     public static function userCanEdit($userUid, $channelUid)
     {
         $channels = ChannelApi::getCanEditByUser($userUid);
@@ -122,74 +120,31 @@ class ChannelApi
         return $isOwner;
     }
 
+    /** @deprecated 用 ChannelService::systemUid() */
     public static function getSysChannel($channel_name, $fallback = '')
     {
-        $channel = Channel::where('name', $channel_name)
-            ->where('owner_uid', config('mint.admin.root_uuid'))
-            ->first();
-        if (! $channel) {
-            if (! empty($fallback)) {
-                $channel = Channel::where('name', $fallback)
-                    ->where('owner_uid', config('mint.admin.root_uuid'))
-                    ->first();
-                if (! $channel) {
-                    return false;
-                } else {
-                    return $channel->uid;
-                }
-            }
-
-            return false;
-        } else {
-            return $channel->uid;
-        }
+        return self::service()->systemUid((string) $channel_name, (string) $fallback);
     }
 
+    /** @deprecated 用 ChannelService::byNameOrFail() */
     public static function getChannelByName($name)
     {
-        $channel = Channel::where('name', $name)
-            ->first();
-        if (! $channel) {
-            throw new \Exception('channel is invalid');
-        }
-
-        return $channel;
+        return self::service()->byNameOrFail((string) $name);
     }
 
     /**
      * 获取某个studio 的某个语言的自定义书的channel
      * 如果没有,建立
+     *
+     * @deprecated 用 ChannelService::userBookUid()
      */
     public static function userBookGetOrCreate($studioId, $lang, $status)
     {
-        $channelName = '_user_book_'.$lang;
-        $channel = Channel::where('owner_uid', $studioId)
-            ->where('name', $channelName)->first();
-        if ($channel) {
-            return $channel->uid;
-        }
-        $channelUuid = Str::uuid();
-        $channel = new Channel;
-        $channel->id = app('snowflake')->id();
-        $channel->uid = $channelUuid;
-        $channel->owner_uid = $studioId;
-        $channel->name = $channelName;
-        $channel->type = 'original';
-        $channel->lang = $lang;
-        $channel->editor_id = 0;
-        $channel->is_system = true;
-        $channel->create_time = time() * 1000;
-        $channel->modify_time = time() * 1000;
-        $channel->status = $status;
-        $saveOk = $channel->save();
-        if ($saveOk) {
-            Log::debug('copy user book : create channel success name='.$channelName);
-
-            return $channel->uid;
-        } else {
-            Log::error('copy user book : create channel fail.', ['channel' => $channelName, 'studioId' => $studioId]);
-
-            return false;
-        }
+        return self::service()->userBookUid((string) $studioId, (string) $lang, (int) $status);
+    }
+
+    private static function service(): ChannelService
+    {
+        return app(ChannelService::class);
     }
 }

+ 3 - 2
api-v13/app/Http/Api/TemplateRender.php

@@ -11,6 +11,7 @@ use App\Models\Discussion;
 use App\Models\PageNumber;
 use App\Models\PaliText;
 use App\Services\ArticleService;
+use App\Services\ChannelService;
 use App\Tools\Tools;
 use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Str;
@@ -425,7 +426,7 @@ class TemplateRender
 
         if (! $tplParam) {
             $this->info('没有,再查社区', 'term');
-            $community_channel = ChannelApi::getSysChannel('_community_term_zh-hans_');
+            $community_channel = app(ChannelService::class)->systemUid('_community_term_zh-hans_');
             $table = DhammaTerm::where('word', $word);
             if (! empty($tag)) {
                 $table = $table->where('tag', $tag);
@@ -1374,7 +1375,7 @@ class TemplateRender
         $word = $this->get_param($this->param, 'word', 1);
         $props = ['word' => $word];
 
-        $localTermChannel = ChannelApi::getSysChannel(
+        $localTermChannel = app(ChannelService::class)->systemUid(
             '_System_Grammar_Term_'.strtolower($this->lang).'_',
             '_System_Grammar_Term_en_'
         );

+ 38 - 177
api-v13/app/Http/Controllers/Library/WikiController.php

@@ -4,24 +4,18 @@ namespace App\Http\Controllers\Library;
 
 use App\Helpers\WikiContentParser;
 use App\Http\Controllers\Controller;
-use App\Services\OpenSearchService;
 use App\Services\TermService;
+use App\Services\WikiService;
 use Illuminate\Http\Request;
-use Illuminate\Support\Str;
 
+/**
+ * library 百科页。词条数据直接查库({@see WikiService}),不经 OpenSearch。
+ */
 class WikiController extends Controller
 {
-    // 质量等级(数值越小等级越高)
-    private $qualityRank = [
-        'featured' => 1,
-        'standard' => 2,
-        'draft' => 3,
-        'pending' => 4,
-    ];
-
     public function __construct(
         private TermService $termService,
-        private OpenSearchService $searchService
+        private WikiService $wiki,
     ) {}
 
     // ── Mock 数据 ────────────────────────────────────────────────
@@ -75,15 +69,24 @@ HTML,
 
         if ($category) {
             $taxNode = collect(config('taxonomy'))->firstWhere('id', $category);
-            $subs = $taxNode ? $this->subEntries($taxNode['subs'], $lang, $quality) : null;
+            // 不是分类树里的一级 id,就当作分类名(词条正文里的 {{category|…}} 链过来的)
+            $subs = $taxNode
+                ? $this->subEntries($taxNode['subs'], $lang, $quality)
+                : [[
+                    'id' => $category,
+                    'label' => $category,
+                    'tags' => [],
+                    'entries' => $this->wiki->categoryEntries([$category], $lang, $quality),
+                ]];
         }
 
         $result = $this->termService->communityTerms($lang);
         $fakeRequest = Request::create('', 'GET', []);
         $terms = $result['data']->toArray($fakeRequest);
-        $first = $terms[0];
+        // 该语言的社区 channel 不存在或没有数据时不显示「今日词条」(原来直接取 [0],会 500)
+        $first = $terms[0] ?? null;
 
-        $today = [
+        $today = $first ? [
             'word' => $first['word'],
             'lang' => $first['language'],
             'slug' => $first['word'],
@@ -91,7 +94,7 @@ HTML,
             'quality' => 'featured',
             'category' => '法义术语',
             'content' => $first['summary'],
-        ];
+        ] : null;
 
         return response()
             ->view('library.wiki.index', [
@@ -109,136 +112,46 @@ HTML,
     }
 
     /**
-     * 给每个二级分类注入 词条列表
-     * 真实数据替换时:按 sub['tags'] 查询术语表,返回同结构数组即可
+     * 给每个二级分类注入词条列表:分类名为二级分类本身或它下面的任一标签。
      */
     private function subEntries(array $subs, string $lang, string $quality): array
     {
         return array_map(function ($sub) use ($lang, $quality) {
-            $entries = $this->querySubCat($sub['tags'], $lang, $quality);
+            $entries = $this->wiki->categoryEntries([$sub['label'], ...$sub['tags']], $lang, $quality);
 
             return array_merge($sub, ['entries' => $entries]);
         }, $subs);
     }
 
-    private function querySubCat(array $cats, string $lang, string $quality): array
-    {
-        $params = [
-            'pageSize' => 1000,
-            'resourceType' => 'term',
-            'language' => $lang,
-            'tags' => array_map(fn ($n) => "category:{$n}", $cats),
-        ];
-
-        $result = $this->searchService->search($params);
-
-        // 当前允许的最大等级
-        $maxRank = $this->qualityRank[$quality] ?? 4;
-
-        $unique = [];
-
-        foreach ($result['hits']['hits'] as $item) {
-            $text = $item['_source']['title']['text'];
-            $id = $item['_source']['resource_id'];
-
-            if (isset($item['_source']['tags'])) {
-                $itemQuality = $this->getQuality($item['_source']['tags']) ?? 'pending';
-            } else {
-                $itemQuality = 'pending';
-            }
-
-            $itemRank = $this->qualityRank[$itemQuality] ?? 4;
-
-            // 按输入质量过滤
-            if ($itemRank > $maxRank) {
-                continue;
-            }
-
-            $record = [
-                'id' => $id,
-                'word' => $text['pali'],
-                'zh' => $text['zh'],
-                'quality' => $itemQuality,
-            ];
-
-            // 用 pali + zh 去重
-            $key = mb_strtolower(trim($text['pali']).'|'.trim($text['zh']));
-
-            // 如果不存在,直接保存
-            if (! isset($unique[$key])) {
-                $unique[$key] = $record;
-
-                continue;
-            }
-
-            // 已存在时,保留质量更高的
-            $existingQuality = $unique[$key]['quality'];
-            $existingRank = $this->qualityRank[$existingQuality] ?? 4;
-
-            if ($itemRank < $existingRank) {
-                $unique[$key] = $record;
-            }
-        }
-
-        return array_values($unique);
-    }
-
-    private function getQuality(array $tags)
-    {
-        $qualityTag = array_find($tags, function ($tag) {
-            return str_contains($tag, 'quality:');
-        });
-        if ($qualityTag) {
-            return mb_substr($qualityTag, 8, null, 'UTF-8');
-        } else {
-            return null;
-        }
-    }
-
-    private function getCategories(array $tags)
-    {
-        $catTag = array_filter($tags, function ($tag) {
-            return str_contains($tag, 'category:');
-        });
-
-        return array_map(fn ($item) => mb_substr($item, mb_strlen('category:', 'UTF-8')), $catTag);
-    }
-
+    /**
+     * 词条详情。$word 是词或 guid;词条设了重定向(同一词条的另一种拼写)就转到目标词条。
+     */
     public function show(string $lang, string $word)
     {
-        if (Str::isUuid($word)) {
-            $term = $this->termService->find($word, 'html');
-        } else {
-            $term = $this->termService->communityWiki($word, $lang, 'html');
-        }
-
-        try {
-            $result = $this->searchService->get("term_{$term['guid']}");
-        } catch (\Throwable $th) {
+        $term = $this->wiki->find($lang, $word);
+        if (! $term) {
             abort(404);
         }
-
-        if (isset($result['_source']['tags'])) {
-            $quality = $this->getQuality($result['_source']['tags']);
-        } else {
-            $quality = null;
+        $target = $this->wiki->redirectTarget($term);
+        if ($target) {
+            return redirect()->route('library.wiki.show', [$lang, $target->guid]);
         }
 
-        $cats = $this->getCategories($result['_source']['tags']);
+        $cats = $this->wiki->categoriesOf($term);
         $entry = [
-            'word' => $term['word'],
-            'lang' => $term['language'],
-            'slug' => $term['word'],
-            'meaning' => $term['meaning'],
-            'quality' => $quality,   // featured | standard | draft | pending | null
+            'word' => $term->word,
+            'lang' => $term->language,
+            'slug' => $term->word,
+            'meaning' => $term->meaning,
+            'quality' => $term->quality,   // featured | standard | draft | pending | null
             'category' => '法义术语',
             'tags' => $cats,
             'langs' => [
                 ['lang' => 'zh-Hant', 'label' => '繁体中文',   'word' => '无常'],
                 ['lang' => 'en', 'label' => 'English', 'word' => 'Impermanence'],
             ],
-            'related' => $this->related($cats),
-            'content' => $term['html'] ?? '',
+            'related' => $this->wiki->related($term, $cats),
+            'content' => $this->wiki->contentHtml($term, $lang),
         ];
         $parsed = WikiContentParser::parse($entry['content']);
 
@@ -246,9 +159,9 @@ HTML,
             'entry' => array_merge($entry, [
                 'content' => $parsed['content'],
                 'toc' => $parsed['toc'],
-                'edit_url' => config('mint.server.dashboard_base_path')."/workspace/term/{$term['guid']}/edit",
+                'edit_url' => config('mint.server.dashboard_base_path')."/workspace/term/{$term->guid}/edit",
                 'zh' => '编辑',
-                'other_versions' => $this->otherVersions($term['word']),
+                'other_versions' => $this->wiki->otherVersions($term),
             ]),
             'categories' => $this->categories(),
             'lang' => $lang,
@@ -256,28 +169,6 @@ HTML,
         ]);
     }
 
-    private function related(array $tags): array
-    {
-        $params = [
-            'pageSize' => 5,
-            'resourceType' => 'term',
-            'tags' => array_map(fn ($n) => "category:{$n}", $tags),
-        ];
-
-        $result = $this->searchService->search($params);
-        $relates = [];
-
-        foreach ($result['hits']['hits'] as $item) {
-            $relates[] = [
-                'word' => $item['_source']['title']['text']['pali'],
-                'zh' => $item['_source']['title']['text']['zh'],
-                'lang' => $item['_source']['language'],
-            ];
-        }
-
-        return $relates;
-    }
-
     // ── Helpers ──────────────────────────────────────────────────
 
     private function categories(): array
@@ -369,34 +260,4 @@ HTML,
             ['word' => 'Rājagaha', 'lang' => 'pi'],
         ];
     }
-
-    private function otherVersions(string $word): array
-    {
-        $params = [
-            'query' => $word,
-            'pageSize' => 10,
-            'resourceType' => 'term',
-            'tags' => array_map(fn ($n) => "quality:{$n}", array_keys($this->qualityRank)),
-        ];
-
-        $result = $this->searchService->search($params);
-        $versions = [];
-
-        foreach ($result['hits']['hits'] as $item) {
-            $text = $item['_source']['title']['text'];
-            $id = $item['_source']['resource_id'];
-            $versions[] = [
-                'type' => 'term',
-                'id' => $id,
-                'lang' => $item['_source']['language'],
-                'title' => $text['zh'] ?? 'null',
-                'quality' => $this->getQuality($item['_source']['tags'] ?? 'quality:pending'),
-                'category' => '法義術語',
-                'snippet' => $item['_source']['summary']['text'],
-                'updated' => $item['_source']['updated_at'],
-            ];
-        }
-
-        return $versions;
-    }
 }

+ 44 - 0
api-v13/app/Http/Controllers/V3/ChannelBatchProgressController.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\ChannelBatchProgressRequest;
+use App\Http\Resources\V3\ChannelProgressResource;
+use App\Services\V3\ChannelProgressService;
+
+/**
+ * 一批句子在各 channel 的完成度。
+ *
+ * 取代 `POST /v2/channel-progress`(`ChannelController@progress`):v2 的 `owner=all|my` 改成可选的
+ * `studio`(本人或团队的 uuid,团队空间传团队)。v2 那份在 dashboard-v4 下线前原样保留,不要改动。
+ */
+class ChannelBatchProgressController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly ChannelProgressService $progress) {}
+
+    /**
+     * 查一批句子在各 channel 的完成度
+     *
+     * 列出这些句子上有译文且看得见的 channel,加上我能写的 channel(没译文也列)。
+     * 给了 `studio` 只列该 studio 名下的。不登录只看得到公开的。
+     *
+     * @unauthenticated
+     *
+     * @bodyParam sentences string[] required 句子 id 列表,`book-para-wordStart-wordEnd`,最多 2000 个
+     * @bodyParam studio string 只看这个 studio(用户或团队 uuid)名下的
+     *
+     * @responseStatus 403 给了 studio,但不能查看它
+     */
+    public function __invoke(ChannelBatchProgressRequest $request)
+    {
+        return ChannelProgressResource::collection($this->progress->forSentences(
+            $request->validated('sentences'),
+            $this->currentUserUid($request),
+            $request->validated('studio'),
+        ));
+    }
+}

+ 123 - 0
api-v13/app/Http/Controllers/V3/ChannelController.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\IndexChannelRequest;
+use App\Http\Requests\V3\UpdateChannelRequest;
+use App\Http\Resources\V3\ChannelResource;
+use App\Models\Channel;
+use App\Services\V3\ChannelService;
+use Illuminate\Http\Request;
+
+/**
+ * channel:公开目录、详情、改信息、删除。
+ *
+ * 取代 `GET /v2/channel?view=public|system`、`GET|PUT|PATCH|DELETE /v2/channel/{channel}`
+ * (`ChannelController`)。某个 studio 的列表与新建见 {@see StudioChannelController},
+ * 我能写的见 {@see EditableChannelController}。v2 那份在 dashboard-v4 下线前原样保留,不要改动。
+ *
+ * channels 表不支持 AI 模型代写(2026-11-16 定):模型 token 调改、删一律 403。
+ */
+class ChannelController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly ChannelService $channels) {}
+
+    /**
+     * 公开 channel 目录
+     *
+     * 只列全网公开的。`system=true` 只要系统 channel——系统 channel 是全站共用的原文、术语等,
+     * 不论 status 都列(巴利原文 `_System_Pali_VRI_` 就是 status 10)。带 `book` + `para` 时每条多返回该章的完成度
+     * `progress`,并可按它排序。
+     *
+     * @unauthenticated
+     *
+     * @queryParam system boolean 只列系统 channel
+     * @queryParam search string 按名字模糊匹配
+     * @queryParam type string channel 类型。Enum: translation,nissaya,original,wbw,commentary,similar
+     * @queryParam lang string 语言
+     * @queryParam book integer 章节所在的书(与 para 同时给)
+     * @queryParam para integer 章节起始段(与 book 同时给)
+     * @queryParam order string 排序字段。Enum: updated_at,created_at,name,progress Default: updated_at
+     * @queryParam dir string 排序方向。Enum: asc,desc Default: desc
+     * @queryParam page integer 页码。Default: 1
+     * @queryParam per_page integer 每页数量,最大 200。Default: 20
+     */
+    public function index(IndexChannelRequest $request)
+    {
+        $filters = $request->safe()->except(['system', 'page', 'per_page']);
+        $filters['system'] = $request->boolean('system');
+
+        return ChannelResource::collection($this->channels->listPublic(
+            $filters,
+            $this->currentUserUid($request),
+            $request->integer('per_page', 20),
+        ));
+    }
+
+    /**
+     * channel 详情
+     *
+     * 公开的谁都能看;私有的只有拥有者、团队成员、被共享的人能看。带查看者的 `abilities`。
+     *
+     * @unauthenticated
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @responseStatus 403 私有 channel,且看不见
+     */
+    public function show(Request $request, Channel $channel)
+    {
+        return ChannelResource::make($this->channels->show($channel, $this->currentUserUid($request)));
+    }
+
+    /**
+     * 改 channel 信息
+     *
+     * 只改传了的字段。拥有者;团队的 channel 由团队 owner / manager / editor 改;共享权限 ≥30 也能改。
+     * 系统 channel 不能改。AI 模型不能改。
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @bodyParam name string 名字,最长 128;同一 studio 内不能重名
+     * @bodyParam type string 类型。Enum: translation,nissaya,original,wbw,commentary,similar
+     * @bodyParam lang string 语言,最长 16
+     * @bodyParam summary string 简介,最长 1024
+     * @bodyParam status integer 10 私有、20 公开不列出(拿到链接能看,不进任何公开列表)、30 公开
+     * @bodyParam source_type string 来源。Enum: original,reprint,ai
+     * @bodyParam source_id string 来源 id
+     * @bodyParam config object 配置
+     *
+     * @responseStatus 403 不能修改
+     */
+    public function update(UpdateChannelRequest $request, Channel $channel)
+    {
+        return ChannelResource::make($this->channels->update(
+            $channel,
+            $this->currentUser($request)['user_uid'],
+            $request->validated(),
+        ));
+    }
+
+    /**
+     * 删除 channel
+     *
+     * 软删除,返回被删的 channel。个人 channel 由拥有者删,团队的只有团队 owner 能删。
+     * channel 下已有译文、术语或逐词时拒绝(409,`content` 列出有哪几类)。系统 channel 不能删。
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @responseStatus 403 不能删除
+     * @responseStatus 409 channel 下还有内容
+     */
+    public function destroy(Request $request, Channel $channel)
+    {
+        return ChannelResource::make($this->channels->delete(
+            $channel,
+            $this->currentUser($request)['user_uid'],
+        ));
+    }
+}

+ 68 - 0
api-v13/app/Http/Controllers/V3/ChannelLinkController.php

@@ -0,0 +1,68 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\UpdateChannelLinksRequest;
+use App\Http\Resources\V3\ChannelLinksResource;
+use App\Models\Channel;
+use App\Services\V3\ChannelLinkService;
+use Illuminate\Http\Request;
+
+/**
+ * channel 之间的关系设置:继承自、降级、捆绑的逐词、术语路径(单例资源,每个 channel 一份)。
+ *
+ * 新能力,没有对应的 v2 端点。服务端只记录,降级的拼接、术语的取用由客户端做。
+ */
+class ChannelLinkController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly ChannelLinkService $links) {}
+
+    /**
+     * channel 的关系设置
+     *
+     * 能读这个 channel 的人都能看。指向的 channel 已删除、或查看者看不见的,不出现在结果里。
+     * `can_update` 表示查看者能不能改。
+     *
+     * @unauthenticated
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @responseStatus 403 私有 channel,且看不见
+     */
+    public function show(Request $request, Channel $channel)
+    {
+        return ChannelLinksResource::make($this->links->get($channel, $this->currentUserUid($request)));
+    }
+
+    /**
+     * 改 channel 的关系设置
+     *
+     * 传了哪个键就整体替换哪一种关系,没传的不动;单值传 null 清掉,列表传 [] 清空。
+     * 能改 channel 信息的人才能改(拥有者、团队 owner / manager / editor、共享权限 ≥30)。AI 模型不能改。
+     * 目标必须是你看得见的 channel,且不能是自己。降级版本必须与本 channel 同类型;
+     * 术语路径只有 translation channel 能设,目标也只能是 translation(传 [] 清空总是允许)。
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @bodyParam derived_from string|null 继承自哪个 channel(如英文版译自中文版),只记录
+     * @bodyParam wbw string|null 捆绑的逐词 channel,必须是 wbw 类型;载入时当原文
+     * @bodyParam fallback string[] 降级 channel,有序,最多 3 个,须与本 channel 同类型;段落没有数据时由客户端改取
+     * @bodyParam fallback.* string channel uid
+     * @bodyParam term_source string[] 术语路径,有序,最多 10 个,只能是 translation;只有 translation channel 能设
+     * @bodyParam term_source.* string channel uid
+     *
+     * @responseStatus 403 不能修改
+     */
+    public function update(UpdateChannelLinksRequest $request, Channel $channel)
+    {
+        return ChannelLinksResource::make($this->links->update(
+            $channel,
+            $this->currentUser($request)['user_uid'],
+            $request->validated(),
+        ));
+    }
+}

+ 102 - 0
api-v13/app/Http/Controllers/V3/ChannelTermController.php

@@ -0,0 +1,102 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\IndexTermRequest;
+use App\Http\Requests\V3\StoreTermRequest;
+use App\Http\Resources\V3\TermResource;
+use App\Models\Channel;
+use App\Services\V3\AgentGrantService;
+use App\Services\V3\TermExchangeService;
+use App\Services\V3\TermService;
+
+/**
+ * 某个 channel 的术语:列表与新建。
+ *
+ * 取代 `GET /v2/terms?view=channel` 与带 channel 的 `POST /v2/terms`(`DhammaTermController`),v2 原样保留。
+ */
+class ChannelTermController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(
+        private readonly TermService $terms,
+        private readonly AgentGrantService $grants,
+        private readonly TermExchangeService $exchange,
+    ) {}
+
+    /**
+     * channel 的术语列表
+     *
+     * 能读 channel 的人都能看。请求头 `Accept` 是
+     * `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` 时导出成 xlsx:整表(过滤同列表、不分页),
+     * 列为 id / word / tag / meaning / other_meaning / summary / note / quality / content_type / redirect / language /
+     * channel_id / etag,可改后用导入接口传回(取代 v2 `terms-export`)。
+     *
+     * @unauthenticated
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @queryParam search string 按词、释义搜索
+     * @queryParam quality string 质量;pending 含未评级的。Enum: featured,standard,draft,pending
+     * @queryParam category string 百科分类
+     * @queryParam order string 排序字段。Enum: updated_at,created_at,word Default: updated_at
+     * @queryParam dir string 排序方向。Enum: asc,desc
+     * @queryParam page integer 页码
+     * @queryParam per_page integer 每页条数,最大 200。Default: 20
+     *
+     * @responseStatus 403 私有 channel,且看不见
+     */
+    public function index(IndexTermRequest $request, Channel $channel)
+    {
+        if (in_array(TermExchangeService::MIME, $request->getAcceptableContentTypes(), true)) {
+            return response($this->exchange->export($this->terms->filtered(
+                $this->terms->channelQuery($channel, $this->currentUserUid($request)),
+                $request->validated(),
+            )), 200, ['Content-Type' => TermExchangeService::MIME, 'Content-Disposition' => 'attachment; filename="terms.xlsx"']);
+        }
+
+        return TermResource::collection($this->terms->listInChannel(
+            $channel,
+            $request->validated(),
+            $this->currentUserUid($request),
+            $request->integer('per_page', 20),
+        ));
+    }
+
+    /**
+     * 在 channel 里新建术语
+     *
+     * 能写 channel 内容的人(含团队 editor)。owner 与语言跟 channel。同一 channel 里 word@tag 唯一(409)。
+     * 分类写在 note 的 `{{category|…}}` 里。AI 模型凭 `X-Agent-Grant` 代写。
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @bodyParam word string required 巴利词,建立后不能改
+     * @bodyParam tag string|null 义项(同词多义时区分),不能含 @,建立后不能改
+     * @bodyParam meaning string required 释义
+     * @bodyParam other_meaning string|null 其它释义
+     * @bodyParam note string|null 正文
+     * @bodyParam summary string|null 摘要,格式与 note 相同
+     * @bodyParam quality string|null 质量。Enum: featured,standard,draft,pending
+     * @bodyParam content_type string 正文方言。Enum: markdown,markdown-e2 Default: markdown-e2
+     * @bodyParam redirect string|null 重定向到 word 或 word@tag
+     *
+     * @responseStatus 201 已新建
+     * @responseStatus 403 不能写这个 channel
+     * @responseStatus 409 已有这个 word@tag
+     */
+    public function store(StoreTermRequest $request, Channel $channel)
+    {
+        return TermResource::make($this->terms->createInChannel(
+            $channel,
+            $this->grants->actor(
+                $this->currentUser($request)['user_uid'],
+                $request->header(AgentGrantService::HEADER),
+            ),
+            $request->validated(),
+        ))->response()->setStatusCode(201);
+    }
+}

+ 45 - 0
api-v13/app/Http/Controllers/V3/ChannelTermImportController.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\ImportTermsRequest;
+use App\Http\Resources\V3\TermImportResource;
+use App\Models\Channel;
+use App\Services\V3\TermExchangeService;
+
+/**
+ * 向 channel 导入术语(xlsx)。
+ *
+ * 取代 `GET /v2/terms-import?view=channel`(`TermExportController@import`)。v2 原样保留。
+ */
+class ChannelTermImportController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly TermExchangeService $exchange) {}
+
+    /**
+     * 向 channel 导入术语
+     *
+     * 上传 xlsx(第一行是列名,至少有 word、meaning;可以直接用导出的表格)。所有行都落在这个 channel,
+     * 语言跟随 channel。有 id 的行改那一条(word / tag 不能改;带 etag 列时与当前不一致就跳过),
+     * 没有 id 的按 word + tag 找,有就改、没有就建。**部分成功**:出错的行跳过,`errors` 逐行给出原因。
+     * 能写这个 channel 的人(含团队 editor)才能导入;AI 模型不能导入。最多 5000 行。
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @bodyParam file file required xlsx 表格,不超过 5MB
+     *
+     * @responseStatus 403 不能写这个 channel
+     */
+    public function __invoke(ImportTermsRequest $request, Channel $channel)
+    {
+        return TermImportResource::make($this->exchange->importToChannel(
+            $channel,
+            $this->currentUser($request)['user_uid'],
+            $request->file('file'),
+        ));
+    }
+}

+ 45 - 0
api-v13/app/Http/Controllers/V3/EditableChannelController.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\IndexEditableChannelRequest;
+use App\Http\Resources\V3\ChannelResource;
+use App\Services\V3\ChannelService;
+
+/**
+ * 我能写内容的 channel,跨 studio:本人的、本人是团队 editor 及以上的团队名下的、共享权限 ≥20 的。
+ *
+ * 取代 `GET /v2/channel?view=user-edit`(`ChannelController@index`)。v2 的搜索一直是坏的(前端传 `key`、
+ * 后端读 `search`),这里用 `search`。写入前挑 channel 用(编辑器、wikipali-plugins)。
+ * v2 那份在 dashboard-v4 下线前原样保留,不要改动。
+ */
+class EditableChannelController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly ChannelService $channels) {}
+
+    /**
+     * 列出我能写的 channel
+     *
+     * @queryParam search string 按名字模糊匹配
+     * @queryParam type string channel 类型。Enum: translation,nissaya,original,wbw,commentary,similar
+     * @queryParam lang string 语言
+     * @queryParam book integer 章节所在的书(与 para 同时给)
+     * @queryParam para integer 章节起始段(与 book 同时给)
+     * @queryParam order string 排序字段。Enum: updated_at,created_at,name,progress Default: updated_at
+     * @queryParam dir string 排序方向。Enum: asc,desc Default: desc
+     * @queryParam page integer 页码。Default: 1
+     * @queryParam per_page integer 每页数量,最大 200。Default: 20
+     */
+    public function __invoke(IndexEditableChannelRequest $request)
+    {
+        return ChannelResource::collection($this->channels->listWritable(
+            $this->currentUser($request)['user_uid'],
+            $request->safe()->except(['page', 'per_page']),
+            $request->integer('per_page', 20),
+        ));
+    }
+}

+ 46 - 0
api-v13/app/Http/Controllers/V3/GlossaryController.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\IndexGlossaryRequest;
+use App\Http\Resources\V3\GlossaryEntryResource;
+use App\Services\V3\GlossaryService;
+
+/**
+ * 术语词汇表:语法术语表 / 社区译名表(只读)。
+ *
+ * 取代 `GET /v2/term-vocabulary?view=grammar|community`(`TermVocabularyController@index`)。
+ * v2 那份在 dashboard-v4 下线前原样保留,不要改动。
+ */
+class GlossaryController extends Controller
+{
+    public function __construct(private readonly GlossaryService $glossaries) {}
+
+    /**
+     * 术语词汇表
+     *
+     * 整表返回、不分页(客户端启动时拉一次,本地查词)。`meta.lang` 是实际用到的语言:
+     * 该语言没有这张表时回退到英文。
+     *
+     * @unauthenticated
+     *
+     * @urlParam kind string required 哪张表:grammar 语法术语,community 社区译名。Enum: grammar,community
+     *
+     * @queryParam lang string 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果)
+     *
+     * @meta kind string 哪张表
+     * @meta lang string 实际用到的语言(没有该语言的表时是 en)
+     * @meta total integer 条数
+     */
+    public function __invoke(IndexGlossaryRequest $request, string $kind)
+    {
+        $result = $this->glossaries->entries($kind, $request->validated('lang') ?? app()->getLocale());
+
+        return GlossaryEntryResource::collection($result['items'])->additional(['meta' => [
+            'kind' => $kind,
+            'lang' => $result['lang'],
+            'total' => $result['items']->count(),
+        ]]);
+    }
+}

+ 4 - 0
api-v13/app/Http/Controllers/V3/GroupMemberController.php

@@ -85,6 +85,8 @@ class GroupMemberController extends Controller
      */
     public function update(UpdateGroupMemberRequest $request, GroupInfo $group, GroupMember $member)
     {
+        // FIXME: {member} 是 group_members.id(雪花 id),应改成用户 uuid:一个用户在一个团队里只有一行
+        //   (唯一索引 user_id + group_id),路由改为 groups/{group}/members/{user_id}。见 routes/v3/group.php。
         return GroupMemberResource::make($this->members->update(
             $group,
             $member,
@@ -107,6 +109,8 @@ class GroupMemberController extends Controller
      */
     public function destroy(Request $request, GroupInfo $group, GroupMember $member)
     {
+        // FIXME: {member} 是 group_members.id(雪花 id),应改成用户 uuid:一个用户在一个团队里只有一行
+        //   (唯一索引 user_id + group_id),路由改为 groups/{group}/members/{user_id}。见 routes/v3/group.php。
         $this->members->remove($group, $member, $this->currentUser($request)['user_uid']);
 
         return response()->noContent();

+ 3 - 0
api-v13/app/Http/Controllers/V3/GroupShareController.php

@@ -58,6 +58,9 @@ class GroupShareController extends Controller
      */
     public function destroy(Request $request, GroupInfo $group, Share $share)
     {
+        // FIXME: {share} 是 shares.id(雪花 id),应改成被共享资源的 uuid:一项资源在一个团队下只共享一次
+        //   (唯一索引 res_id + res_type + cooperator_id + cooperator_type),路由改为 groups/{group}/shares/{res_id}。
+        //   见 routes/v3/group.php。
         $this->shares->remove($group, $share, $this->currentUser($request)['user_uid']);
 
         return response()->noContent();

+ 36 - 0
api-v13/app/Http/Controllers/V3/NissayaCardController.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\ShowNissayaCardRequest;
+use App\Http\Resources\V3\NissayaCardResource;
+use App\Services\V3\NissayaCardService;
+
+/**
+ * 缅文 nissaya 词尾卡片(只读、公开)。
+ *
+ * 取代 `GET /v2/nissaya-card/{ending}`(`NissayaCardController@show`)。v2 那份在 dashboard-v4 下线前原样保留,不要改动。
+ */
+class NissayaCardController extends Controller
+{
+    public function __construct(private readonly NissayaCardService $cards) {}
+
+    /**
+     * 缅文词尾卡片
+     *
+     * 词尾对应的语法术语(说明是新渲染器的节点树),以及它表达的语法关系:关系名与格位都带本地译名,
+     * 另有含义分类与翻译建议。术语取 `_System_Grammar_Term_{lang}_`,没有就用 en(`lang` 字段是实际用到的语言)。
+     * 词尾查不到时 `term` 为 null、`relations` 为空,不是 404。
+     *
+     * @unauthenticated
+     *
+     * @urlParam ending string required 缅文词尾,如 သည်
+     *
+     * @queryParam lang string 语言,如 zh-Hans。缺省用界面语言(Accept-Language 协商的结果)
+     */
+    public function __invoke(ShowNissayaCardRequest $request, string $ending)
+    {
+        return NissayaCardResource::make($this->cards->card($ending, $request->validated('lang') ?? app()->getLocale()));
+    }
+}

+ 21 - 3
api-v13/app/Http/Controllers/V3/SearchPlusController.php

@@ -3,9 +3,11 @@
 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
@@ -13,7 +15,15 @@ class SearchPlusController extends Controller
     /**
      * 构造函数,注入 OpenSearchService
      */
-    public function __construct(protected OpenSearchService $searchService) {}
+    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,
+    ) {}
 
     /**
      * 全文检索
@@ -137,13 +147,21 @@ class SearchPlusController extends Controller
      *
      * 直接从 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($id)
+    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) {

+ 86 - 0
api-v13/app/Http/Controllers/V3/StudioChannelController.php

@@ -0,0 +1,86 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\IndexStudioChannelRequest;
+use App\Http\Requests\V3\StoreChannelRequest;
+use App\Http\Resources\V3\ChannelResource;
+use App\Services\V3\ChannelService;
+
+/**
+ * 某个 studio(本人或团队)的 channel:工作区列表与新建。
+ *
+ * 取代 `GET /v2/channel?view=studio|studio-all`(含 `view2`、`collaborator`)、`GET /v2/channel-my-number`
+ * (数量读 `meta.total`)与 `POST /v2/channel`(`ChannelController`)。`{studio}` 一律是 uuid:
+ * 用户 uuid 或团队 uuid(团队空间)。v2 那份在 dashboard-v4 下线前原样保留,不要改动。
+ */
+class StudioChannelController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly ChannelService $channels) {}
+
+    /**
+     * 列出 studio 的 channel
+     *
+     * 只有本人,或该团队的成员能看。`relation`:own 它名下的(默认),shared 直接共享给它的
+     * (个人空间不含经团队转来的——团队的在团队空间里看),all 两者合起来。
+     *
+     * @urlParam studio string required 用户 uuid 或团队 uuid
+     *
+     * @queryParam relation string 关系。Enum: own,shared,all Default: own
+     * @queryParam collaborator string 只看这个拥有者共享过来的(uuid)
+     * @queryParam search string 按名字模糊匹配
+     * @queryParam type string channel 类型。Enum: translation,nissaya,original,wbw,commentary,similar
+     * @queryParam lang string 语言
+     * @queryParam book integer 章节所在的书(与 para 同时给)
+     * @queryParam para integer 章节起始段(与 book 同时给)
+     * @queryParam order string 排序字段。Enum: updated_at,created_at,name,progress Default: updated_at
+     * @queryParam dir string 排序方向。Enum: asc,desc Default: desc
+     * @queryParam page integer 页码。Default: 1
+     * @queryParam per_page integer 每页数量,最大 200。Default: 20
+     *
+     * @responseStatus 403 不能查看这个 studio
+     */
+    public function index(IndexStudioChannelRequest $request, string $studio)
+    {
+        return ChannelResource::collection($this->channels->listForStudio(
+            $studio,
+            $this->currentUser($request)['user_uid'],
+            $request->safe()->except(['page', 'per_page']),
+            $request->integer('per_page', 20),
+        ));
+    }
+
+    /**
+     * 在 studio 名下建 channel
+     *
+     * 本人名下,或团队名下(团队 owner / manager)。同一 studio 内不能重名。默认私有。AI 模型不能建。
+     *
+     * @urlParam studio string required 用户 uuid 或团队 uuid
+     *
+     * @bodyParam name string required 名字,最长 128
+     * @bodyParam type string required 类型。Enum: translation,nissaya,original,wbw,commentary,similar
+     * @bodyParam lang string required 语言,最长 16
+     * @bodyParam summary string 简介,最长 1024
+     * @bodyParam status integer 10 私有、20 公开不列出(拿到链接能看,不进任何公开列表)、30 公开。Default: 10
+     * @bodyParam source_type string 来源。Enum: original,reprint,ai
+     * @bodyParam source_id string 来源 id
+     *
+     * @responseStatus 201 建好了
+     * @responseStatus 403 不能在这个 studio 名下建
+     */
+    public function store(StoreChannelRequest $request, string $studio)
+    {
+        $user = $this->currentUser($request);
+
+        return ChannelResource::make($this->channels->create(
+            $studio,
+            $user['user_uid'],
+            (int) $user['user_id'],
+            $request->validated(),
+        ));
+    }
+}

+ 100 - 0
api-v13/app/Http/Controllers/V3/StudioTermController.php

@@ -0,0 +1,100 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\IndexTermRequest;
+use App\Http\Requests\V3\StoreTermRequest;
+use App\Http\Resources\V3\TermResource;
+use App\Services\V3\AgentGrantService;
+use App\Services\V3\TermExchangeService;
+use App\Services\V3\TermService;
+
+/**
+ * 某个 studio(本人或团队)的术语:列表与新建 studio 级术语。
+ *
+ * 取代 `GET /v2/terms?view=studio` 与不带 channel 的 `POST /v2/terms`(`DhammaTermController`),v2 原样保留。
+ */
+class StudioTermController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(
+        private readonly TermService $terms,
+        private readonly AgentGrantService $grants,
+        private readonly TermExchangeService $exchange,
+    ) {}
+
+    /**
+     * studio 的术语列表
+     *
+     * studio 名下的全部术语(它的 channel 里的与 studio 级的)。本人或团队成员能看。请求头 `Accept` 是
+     * `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` 时导出成 xlsx(列与说明同 channel 的术语列表),
+     * 取代 v2 `terms-export?view=studio`。
+     *
+     * @urlParam studio string required 用户或团队的 uuid
+     *
+     * @queryParam search string 按词、释义搜索
+     * @queryParam quality string 质量;pending 含未评级的。Enum: featured,standard,draft,pending
+     * @queryParam category string 百科分类
+     * @queryParam general boolean 只要 studio 级术语(不属于任何 channel)
+     * @queryParam order string 排序字段。Enum: updated_at,created_at,word Default: updated_at
+     * @queryParam dir string 排序方向。Enum: asc,desc
+     * @queryParam page integer 页码
+     * @queryParam per_page integer 每页条数,最大 200。Default: 20
+     *
+     * @responseStatus 403 不是本人,也不是团队成员
+     */
+    public function index(IndexTermRequest $request, string $studio)
+    {
+        if (in_array(TermExchangeService::MIME, $request->getAcceptableContentTypes(), true)) {
+            return response($this->exchange->export($this->terms->filtered(
+                $this->terms->studioQuery($studio, ['general' => $request->boolean('general')] + $request->validated(), $this->currentUser($request)['user_uid']),
+                $request->validated(),
+            )), 200, ['Content-Type' => TermExchangeService::MIME, 'Content-Disposition' => 'attachment; filename="terms.xlsx"']);
+        }
+
+        return TermResource::collection($this->terms->listInStudio(
+            $studio,
+            ['general' => $request->boolean('general')] + $request->validated(),
+            $this->currentUser($request)['user_uid'],
+            $request->integer('per_page', 20),
+        ));
+    }
+
+    /**
+     * 新建 studio 级术语
+     *
+     * 不属于任何 channel,owner 名下所有 channel 共用。本人或团队 owner / manager 能建;AI 模型不能建。
+     * 同一 studio、同一语言里 word@tag 唯一(409)。
+     *
+     * @urlParam studio string required 用户或团队的 uuid
+     *
+     * @bodyParam word string required 巴利词,建立后不能改
+     * @bodyParam tag string|null 义项(同词多义时区分),不能含 @,建立后不能改
+     * @bodyParam meaning string required 释义
+     * @bodyParam language string required 语言
+     * @bodyParam other_meaning string|null 其它释义
+     * @bodyParam note string|null 正文
+     * @bodyParam summary string|null 摘要,格式与 note 相同
+     * @bodyParam quality string|null 质量。Enum: featured,standard,draft,pending
+     * @bodyParam content_type string 正文方言。Enum: markdown,markdown-e2 Default: markdown-e2
+     * @bodyParam redirect string|null 重定向到 word 或 word@tag
+     *
+     * @responseStatus 201 已新建
+     * @responseStatus 403 不能在这个 studio 新建
+     * @responseStatus 409 已有这个 word@tag
+     */
+    public function store(StoreTermRequest $request, string $studio)
+    {
+        return TermResource::make($this->terms->createInStudio(
+            $studio,
+            $this->grants->actor(
+                $this->currentUser($request)['user_uid'],
+                $request->header(AgentGrantService::HEADER),
+            ),
+            $request->validated(),
+        ))->response()->setStatusCode(201);
+    }
+}

+ 43 - 0
api-v13/app/Http/Controllers/V3/StudioTermImportController.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\ImportTermsRequest;
+use App\Http\Resources\V3\TermImportResource;
+use App\Services\V3\TermExchangeService;
+
+/**
+ * 向 studio 导入术语(xlsx)。
+ *
+ * 取代 `GET /v2/terms-import?view=studio`(`TermExportController@import`)。v2 原样保留。
+ */
+class StudioTermImportController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly TermExchangeService $exchange) {}
+
+    /**
+     * 向 studio 导入术语
+     *
+     * 上传 xlsx。`channel_id` 列有值的行落在那个 channel(必须属于这个 studio、你能写),没有的是 studio 通用术语
+     * (要填 `language`;新建要团队 owner / manager,修改团队 editor 也行)。其余规则同向 channel 导入:
+     * 部分成功、word / tag 不能改、带 etag 列时校验。AI 模型不能导入。最多 5000 行。
+     *
+     * @urlParam studio string required 用户或团队的 uuid
+     *
+     * @bodyParam file file required xlsx 表格,不超过 5MB
+     *
+     * @responseStatus 403 不是本人,也不是团队成员
+     */
+    public function __invoke(ImportTermsRequest $request, string $studio)
+    {
+        return TermImportResource::make($this->exchange->importToStudio(
+            $studio,
+            $this->currentUser($request)['user_uid'],
+            $request->file('file'),
+        ));
+    }
+}

+ 127 - 0
api-v13/app/Http/Controllers/V3/TermController.php

@@ -0,0 +1,127 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\LookupTermRequest;
+use App\Http\Requests\V3\ShowTermRequest;
+use App\Http\Requests\V3\UpdateTermRequest;
+use App\Http\Resources\V3\TermResource;
+use App\Models\DhammaTerm;
+use App\Services\V3\AgentGrantService;
+use App\Services\V3\TermService;
+use Illuminate\Http\Request;
+
+/**
+ * 术语 / 百科词条:按词查、单条、改、删。
+ *
+ * 取代 `GET /v2/terms?view=word`、`GET /v2/terms/{id}`、`PUT /v2/terms/{id}`、`DELETE /v2/terms/{id}`
+ * (`DhammaTermController`)。v2 那份在 dashboard-v4 下线前原样保留,不要改动。
+ * 列表与新建在 {@see ChannelTermController}、{@see StudioTermController}。
+ *
+ * AI 模型可凭人类授权(请求头 `X-Agent-Grant`)代写 channel 里的术语:editor 记授权人、co_editor 记模型。
+ */
+class TermController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(
+        private readonly TermService $terms,
+        private readonly AgentGrantService $grants,
+    ) {}
+
+    /**
+     * 按词查术语
+     *
+     * 这些词在你看得见的 channel 与 studio 级术语里的词条(编辑时看同词的其它义项、社区译法)。
+     *
+     * @unauthenticated
+     *
+     * @queryParam word string required 巴利词,逗号分隔,最多 50 个
+     * @queryParam tag string 义项;传空串只要没有义项的
+     * @queryParam channel string 只要这个 channel 的
+     * @queryParam language string 只要这个语言的
+     * @queryParam with_body boolean 每条都带渲染后的正文 `body`
+     * @queryParam page integer 页码
+     * @queryParam per_page integer 每页条数,最大 200。Default: 20
+     */
+    public function index(LookupTermRequest $request)
+    {
+        return TermResource::collection($this->terms->lookup(
+            ['with_body' => $request->boolean('with_body')] + $request->validated(),
+            $this->currentUserUid($request),
+            $request->integer('per_page', 20),
+        ));
+    }
+
+    /**
+     * 术语详情
+     *
+     * 带渲染后的「摘要 + 正文」(`body`)。channel 里的术语跟 channel 的可见性,studio 级的谁都能看。
+     * 响应带 `ETag` 头(与 `etag` 字段相同),修改时放进 `If-Match`。
+     *
+     * @unauthenticated
+     *
+     * @urlParam term string required 术语 id(guid)
+     *
+     * @queryParam channels string 正文按这些 channel 解析(句子、术语),逗号分隔,最多 20 个;只认你看得见的,不给就用术语所在 channel
+     * @queryParam mode string 正文模式。Enum: read,edit Default: read
+     * @queryParam format string 正文格式:tree 给节点树 `body`,html 给 HTML 字符串 `html`(WebView 显示用)。Enum: tree,html Default: tree
+     *
+     * @responseStatus 403 所在 channel 看不见
+     */
+    public function show(ShowTermRequest $request, DhammaTerm $term)
+    {
+        return TermResource::make($this->terms->show($term, $this->currentUserUid($request), $request->render()));
+    }
+
+    /**
+     * 改术语
+     *
+     * 只改传了的字段;word / tag 不能改(要改就新建一条,把旧的 redirect 过去)。必须带请求头
+     * `If-Match`(取自详情的 `etag` / `ETag`):不带 428,这条在你编辑期间被改过 412(响应里给出最新的 `etag`)。
+     * 分类从 note 的 `{{category|…}}` 重新抽取。channel 里的术语跟 channel 的写权限,studio 级的要团队 editor 以上。
+     *
+     * @urlParam term string required 术语 id(guid)
+     *
+     * @bodyParam meaning string 释义
+     * @bodyParam other_meaning string|null 其它释义
+     * @bodyParam note string|null 正文
+     * @bodyParam summary string|null 摘要,格式与 note 相同
+     * @bodyParam quality string|null 质量。Enum: featured,standard,draft,pending
+     * @bodyParam content_type string 正文方言。Enum: markdown,markdown-e2
+     * @bodyParam redirect string|null 重定向到 word 或 word@tag
+     * @bodyParam language string 语言(只有 studio 级术语能改)
+     *
+     * @responseStatus 403 不能修改
+     * @responseStatus 412 这条在你编辑期间被改过
+     * @responseStatus 428 没带 If-Match
+     */
+    public function update(UpdateTermRequest $request, DhammaTerm $term)
+    {
+        return TermResource::make($this->terms->update(
+            $term,
+            $this->grants->actor(
+                $this->currentUser($request)['user_uid'],
+                $request->header(AgentGrantService::HEADER),
+            ),
+            $request->validated(),
+            $request->header('If-Match'),
+        ));
+    }
+
+    /**
+     * 删术语
+     *
+     * 软删除,返回被删的术语。拥有者本人或团队 owner 能删;AI 模型不能删。
+     *
+     * @urlParam term string required 术语 id(guid)
+     *
+     * @responseStatus 403 不能删除
+     */
+    public function destroy(Request $request, DhammaTerm $term)
+    {
+        return TermResource::make($this->terms->delete($term, $this->currentUser($request)['user_uid']));
+    }
+}

+ 44 - 0
api-v13/app/Http/Controllers/V3/TipitakaChannelController.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\IndexTipitakaChannelRequest;
+use App\Http\Resources\V3\TipitakaChannelResource;
+use App\Services\V3\TipitakaChannelService;
+
+/**
+ * 有译文的公开 channel 目录(mobile 发现页「译本合集」)。
+ *
+ * 取代 `GET /v2/progress?view=channel`(`ProgressChapterController@index`)。v2 那份在 dashboard-v4
+ * 下线前原样保留,不要改动。
+ */
+class TipitakaChannelController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly TipitakaChannelService $channels) {}
+
+    /**
+     * 列出有译文的公开 channel
+     *
+     * 只列公开的、有完成度过门槛的章节的 channel,按章节数降序,每条带 `chapter_count`。
+     *
+     * @unauthenticated
+     *
+     * @queryParam type string channel 类型。Enum: translation,nissaya,original,wbw,commentary,similar
+     * @queryParam lang string 译文语族(progress_chapters.lang,zh 涵盖简繁)。Example: zh
+     * @queryParam min_progress number 章节完成度门槛 0–1。Default: 0.8
+     * @queryParam page integer 页码。Default: 1
+     * @queryParam per_page integer 每页数量,最大 200。Default: 20
+     */
+    public function __invoke(IndexTipitakaChannelRequest $request)
+    {
+        return TipitakaChannelResource::collection($this->channels->withChapters(
+            $request->safe()->only(['type', 'lang', 'min_progress']),
+            $this->currentUserUid($request),
+            $request->integer('per_page', 20),
+        ));
+    }
+}

+ 46 - 0
api-v13/app/Http/Controllers/V3/TipitakaParagraphChannelController.php

@@ -0,0 +1,46 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\IndexTipitakaParagraphChannelRequest;
+use App\Http\Resources\V3\ChannelResource;
+use App\Services\V3\TipitakaChannelService;
+
+/**
+ * 某一段有内容的 channel(mobile 与 wikipali-plugins 读某段的各版本用)。
+ *
+ * 取代 `GET /v2/channel?view=paragraphs`(`ChannelController@index`)。与 v2 不同:只列看得见的
+ * (v2 连私有 channel 也列),一次一段(v2 的 para 可逗号多段,没有调用方用)。
+ * v2 那份在 dashboard-v4 下线前原样保留,不要改动。
+ */
+class TipitakaParagraphChannelController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly TipitakaChannelService $channels) {}
+
+    /**
+     * 列出某段有内容的 channel
+     *
+     * 最近更新的在前。不登录只看得到公开的。
+     *
+     * @unauthenticated
+     *
+     * @urlParam book integer required 书
+     * @urlParam para integer required 段
+     *
+     * @queryParam page integer 页码。Default: 1
+     * @queryParam per_page integer 每页数量,最大 200。Default: 100
+     */
+    public function __invoke(IndexTipitakaParagraphChannelRequest $request, int $book, int $para)
+    {
+        return ChannelResource::collection($this->channels->forParagraph(
+            $book,
+            $para,
+            $this->currentUserUid($request),
+            $request->integer('per_page', 100),
+        ));
+    }
+}

+ 14 - 3
api-v13/app/Http/Controllers/V3/TipitakaReadingController.php

@@ -2,9 +2,11 @@
 
 namespace App\Http\Controllers\V3;
 
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
 use App\Http\Controllers\Controller;
 use App\Http\Requests\V3\TipitakaReadingRequest;
 use App\Http\Resources\V3\ReadParagraphResource;
+use App\Services\V3\ChannelAbilityService;
 use App\Services\V3\TipitakaReadingService;
 
 /**
@@ -23,7 +25,12 @@ use App\Services\V3\TipitakaReadingService;
  */
 class TipitakaReadingController extends Controller
 {
-    public function __construct(private readonly TipitakaReadingService $reading) {}
+    use ResolvesCurrentUser;
+
+    public function __construct(
+        private readonly TipitakaReadingService $reading,
+        private readonly ChannelAbilityService $abilities,
+    ) {}
 
     /**
      * 读取译文
@@ -39,6 +46,8 @@ class TipitakaReadingController extends Controller
      * channel(实测最大的有 52 万段、跨 217 本书),每翻一页都去 count 一次不划算。
      * 无过滤时用 `next_cursor` 是否为 null 判断结束,不要指望百分比。
      *
+     * 私有 channel 只有拥有者、团队成员、被共享的人能读(要带 token);公开与「公开不列出」不用登录。
+     *
      * @unauthenticated
      *
      * @urlParam channel string required 译文 channel 的 uuid
@@ -54,12 +63,13 @@ class TipitakaReadingController extends Controller
      *             Default: 10
      * @queryParam unit string 每块大小的单位:para 按段落数,byte 按段落长度累加。
      *             两种单位下每块都至少一段、至多 200 段。Enum: para,byte Default: para
-     * @queryParam format string 内容格式。Enum: html,markdown,react,text Default: html
+     * @queryParam format string 内容格式。Enum: html,markdown,text Default: html
      * @queryParam include string 输出口径:display 整段合并,sentences 逐句,all 两者都给。
      *             不叫 view 是因为 v2 的 `view=` 是必填互斥的业务路径开关,名字撞上会误导。
      *             Enum: display,sentences,all Default: display
      *
-     * @responseStatus 404 指定的 chapter 在 pali_texts 里不存在
+     * @responseStatus 403 私有 channel,且当前身份看不见
+     * @responseStatus 404 channel 不存在,或指定的 chapter 在 pali_texts 里不存在
      *
      * @meta page_size integer 每块大小(按 unit 计)
      * @meta page_size_unit string 每块大小的单位:para 或 byte
@@ -69,6 +79,7 @@ class TipitakaReadingController extends Controller
      */
     public function __invoke(TipitakaReadingRequest $request, string $channel)
     {
+        $this->abilities->assertReadable($channel, $this->currentUserUid($request));
         $page = $this->reading->page($channel, $request->validated());
 
         return ReadParagraphResource::collection($page['items'])

+ 32 - 0
api-v13/app/Http/Requests/V3/ChannelBatchProgressRequest.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Services\V3\ChannelProgressService;
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * `POST /v3/channels/batch-progress` 的入参:一批句子 id,可选只看某个 studio 名下的。
+ */
+class ChannelBatchProgressRequest extends FormRequest
+{
+    /**
+     * 登录与权限在 Service 里判:未登录也能查(只看得到公开的)。
+     */
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'sentences' => ['required', 'array', 'min:1', 'max:'.ChannelProgressService::MAX_SENTENCES],
+            'sentences.*' => ['string', 'regex:/^\d+-\d+-\d+-\d+$/'],
+            'studio' => ['sometimes', 'uuid'],
+        ];
+    }
+}

+ 26 - 0
api-v13/app/Http/Requests/V3/ImportTermsRequest.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * 术语导入:上传一个 xlsx(multipart/form-data 的 `file`),不超过 5MB。
+ */
+class ImportTermsRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'file' => ['required', 'file', 'extensions:xlsx', 'max:5120'],
+        ];
+    }
+}

+ 45 - 0
api-v13/app/Http/Requests/V3/IndexChannelRequest.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Services\V3\ChannelService;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+/**
+ * `GET /v3/channels` 的入参:公开目录。`system=true` 只要系统 channel;带 book + para 时每条多返回该章完成度。
+ */
+class IndexChannelRequest extends FormRequest
+{
+    /** channels.type 的取值 */
+    public const TYPES = ['translation', 'nissaya', 'original', 'wbw', 'commentary', 'similar'];
+
+    /**
+     * 登录与权限在中间件 / Service 里判:authorize() 返回 false 会渲染成 403,
+     * 而「没登录」应该是 401、无权要带具体文案。
+     */
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'system' => ['sometimes', 'in:true,false,1,0'],
+            'search' => ['sometimes', 'nullable', 'string', 'max:128'],
+            'type' => ['sometimes', 'string', Rule::in(self::TYPES)],
+            'lang' => ['sometimes', 'string', 'max:16'],
+            // 不能用 sometimes:缺 book 时 sometimes 会跳过整条规则,required_with 就不生效
+            'book' => ['required_with:para', 'integer', 'min:1'],
+            'para' => ['required_with:book', 'integer', 'min:1'],
+            'order' => ['sometimes', 'string', Rule::in(ChannelService::ORDERS)],
+            'dir' => ['sometimes', 'in:asc,desc'],
+            'page' => ['integer', 'min:1'],
+            'per_page' => ['integer', 'min:1', 'max:200'],
+        ];
+    }
+}

+ 41 - 0
api-v13/app/Http/Requests/V3/IndexEditableChannelRequest.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Services\V3\ChannelService;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+/**
+ * `GET /v3/channels/editable` 的入参:我能写内容的 channel(跨 studio)。
+ */
+class IndexEditableChannelRequest extends FormRequest
+{
+    /**
+     * 登录与权限在中间件 / Service 里判:authorize() 返回 false 会渲染成 403,
+     * 而「没登录」应该是 401、无权要带具体文案。
+     */
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'search' => ['sometimes', 'nullable', 'string', 'max:128'],
+            'type' => ['sometimes', 'string', Rule::in(IndexChannelRequest::TYPES)],
+            'lang' => ['sometimes', 'string', 'max:16'],
+            // 不能用 sometimes:缺 book 时 sometimes 会跳过整条规则,required_with 就不生效
+            'book' => ['required_with:para', 'integer', 'min:1'],
+            'para' => ['required_with:book', 'integer', 'min:1'],
+            'order' => ['sometimes', 'string', Rule::in(ChannelService::ORDERS)],
+            'dir' => ['sometimes', 'in:asc,desc'],
+            'page' => ['integer', 'min:1'],
+            'per_page' => ['integer', 'min:1', 'max:200'],
+        ];
+    }
+}

+ 26 - 0
api-v13/app/Http/Requests/V3/IndexGlossaryRequest.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * `GET /v3/glossaries/{kind}`:词汇表的语言(可选,缺省用请求协商出的界面语言)。
+ */
+class IndexGlossaryRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'lang' => ['sometimes', 'string', 'max:16', 'regex:/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/'],
+        ];
+    }
+}

+ 43 - 0
api-v13/app/Http/Requests/V3/IndexStudioChannelRequest.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Services\V3\ChannelService;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+/**
+ * `GET /v3/studios/{studio}/channels` 的入参:某个 studio(本人或团队)的工作区列表。
+ */
+class IndexStudioChannelRequest extends FormRequest
+{
+    /**
+     * 登录与权限在中间件 / Service 里判:authorize() 返回 false 会渲染成 403,
+     * 而「没登录」应该是 401、无权要带具体文案。
+     */
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'relation' => ['sometimes', 'in:own,shared,all'],
+            'collaborator' => ['sometimes', 'uuid'],
+            'search' => ['sometimes', 'nullable', 'string', 'max:128'],
+            'type' => ['sometimes', 'string', Rule::in(IndexChannelRequest::TYPES)],
+            'lang' => ['sometimes', 'string', 'max:16'],
+            // 不能用 sometimes:缺 book 时 sometimes 会跳过整条规则,required_with 就不生效
+            'book' => ['required_with:para', 'integer', 'min:1'],
+            'para' => ['required_with:book', 'integer', 'min:1'],
+            'order' => ['sometimes', 'string', Rule::in(ChannelService::ORDERS)],
+            'dir' => ['sometimes', 'in:asc,desc'],
+            'page' => ['integer', 'min:1'],
+            'per_page' => ['integer', 'min:1', 'max:200'],
+        ];
+    }
+}

+ 37 - 0
api-v13/app/Http/Requests/V3/IndexTermRequest.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Models\DhammaTerm;
+use App\Services\V3\TermService;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+/**
+ * 术语列表(某个 channel / studio 的)的过滤与分页。都是可选叠加的过滤。
+ */
+class IndexTermRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'search' => ['sometimes', 'nullable', 'string', 'max:128'],
+            'quality' => ['sometimes', 'string', Rule::in(DhammaTerm::QUALITIES)],
+            'category' => ['sometimes', 'string', 'max:128'],
+            // 查询串里是字符串:Laravel 的 boolean 规则不收 "true"/"false",取值处用 \$request->boolean()
+            'general' => ['sometimes', 'in:true,false,1,0'],
+            'order' => ['sometimes', 'string', Rule::in(TermService::ORDERS)],
+            'dir' => ['sometimes', 'in:asc,desc'],
+            'page' => ['integer', 'min:1'],
+            'per_page' => ['integer', 'min:1', 'max:200'],
+        ];
+    }
+}

+ 31 - 0
api-v13/app/Http/Requests/V3/IndexTipitakaChannelRequest.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+/**
+ * `GET /v3/tipitaka-channels` 的入参:有译文的公开 channel 目录。
+ */
+class IndexTipitakaChannelRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'type' => ['sometimes', 'string', Rule::in(IndexChannelRequest::TYPES)],
+            'lang' => ['sometimes', 'string', 'max:16'],
+            'min_progress' => ['sometimes', 'numeric', 'min:0', 'max:1'],
+            'page' => ['integer', 'min:1'],
+            'per_page' => ['integer', 'min:1', 'max:200'],
+        ];
+    }
+}

+ 27 - 0
api-v13/app/Http/Requests/V3/IndexTipitakaParagraphChannelRequest.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * `GET /v3/tipitaka-paragraph-channels/{book}/{para}` 的入参:只有分页。
+ */
+class IndexTipitakaParagraphChannelRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'page' => ['integer', 'min:1'],
+            'per_page' => ['integer', 'min:1', 'max:200'],
+        ];
+    }
+}

+ 37 - 0
api-v13/app/Http/Requests/V3/LookupTermRequest.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * `GET /v3/terms`:按词查。word 必填(逗号分隔,最多 50 个)。
+ */
+class LookupTermRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'word' => ['required', 'string', 'max:2048', function (string $attribute, mixed $value, \Closure $fail) {
+                if (count(array_filter(explode(',', (string) $value), fn ($w) => trim($w) !== '')) > 50) {
+                    $fail(__('validation.max.array', ['attribute' => $attribute, 'max' => 50]));
+                }
+            }],
+            'tag' => ['sometimes', 'nullable', 'string', 'max:1024'],
+            'channel' => ['sometimes', 'uuid'],
+            'language' => ['sometimes', 'string', 'max:16'],
+            // 查询串里是字符串:Laravel 的 boolean 规则不收 "true"/"false",取值处用 \$request->boolean()
+            'with_body' => ['sometimes', 'in:true,false,1,0'],
+            'page' => ['integer', 'min:1'],
+            'per_page' => ['integer', 'min:1', 'max:200'],
+        ];
+    }
+}

+ 26 - 0
api-v13/app/Http/Requests/V3/ShowNissayaCardRequest.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * `GET /v3/nissaya-cards/{ending}`:卡片的语言(可选,缺省用请求协商出的界面语言)。
+ */
+class ShowNissayaCardRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'lang' => ['sometimes', 'string', 'max:16', 'regex:/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/'],
+        ];
+    }
+}

+ 41 - 0
api-v13/app/Http/Requests/V3/ShowTermRequest.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * `GET /v3/terms/{term}`:正文按哪些 channel 渲染、read / edit 模式、节点树或 HTML(都可选)。
+ */
+class ShowTermRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'channels' => ['sometimes', 'string', 'max:1024', 'regex:/^[0-9a-fA-F-]{36}(,[0-9a-fA-F-]{36}){0,19}$/'],
+            'mode' => ['sometimes', 'in:read,edit'],
+            'format' => ['sometimes', 'in:tree,html'],
+        ];
+    }
+
+    /**
+     * @return array{channels?: list<string>, mode?: string, format?: string}
+     */
+    public function render(): array
+    {
+        $data = $this->validated();
+        if (isset($data['channels'])) {
+            $data['channels'] = array_values(array_unique(explode(',', $data['channels'])));
+        }
+
+        return $data;
+    }
+}

+ 38 - 0
api-v13/app/Http/Requests/V3/StoreChannelRequest.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Models\Channel;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+/**
+ * `POST /v3/studios/{studio}/channels` 的入参:建 channel。同一 studio 内不能重名(Service 里判)。
+ */
+class StoreChannelRequest extends FormRequest
+{
+    /**
+     * 登录与权限在中间件 / Service 里判:authorize() 返回 false 会渲染成 403,
+     * 而「没登录」应该是 401、无权要带具体文案。
+     */
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'name' => ['required', 'string', 'max:128'],
+            'type' => ['required', 'string', Rule::in(IndexChannelRequest::TYPES)],
+            'lang' => ['required', 'string', 'max:16'],
+            'summary' => ['sometimes', 'nullable', 'string', 'max:1024'],
+            'status' => ['sometimes', 'integer', Rule::in([Channel::STATUS_PRIVATE, Channel::STATUS_UNLISTED, Channel::STATUS_PUBLIC])],
+            'source_type' => ['sometimes', 'string', Rule::in(['original', 'reprint', 'ai'])],
+            'source_id' => ['sometimes', 'nullable', 'string', 'max:36'],
+        ];
+    }
+}

+ 1 - 1
api-v13/app/Http/Requests/V3/StoreDiscussionRequest.php

@@ -9,7 +9,7 @@ use Illuminate\Validation\Rule;
 /**
  * `POST /v3/discussions` 的入参:发起话题,或新建一条批注。
  *
- * 不收 content_type:v3 只写 markdown(v6 已没有 html 编辑器)。
+ * 不收 content_type:v3 一律按 markdown-e2 写(存 content_type_v2,见 Discussion::markWrittenByV3())。
  * severity 的取值随 type 而定,见 {@see Discussion::SEVERITIES};不收 severity 的类型传了就 422。
  *
  * 批注(note / commentary)与评论线程的规则不同:只能挂在句子上、标题可省、正文必填,

+ 41 - 0
api-v13/app/Http/Requests/V3/StoreTermRequest.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Models\DhammaTerm;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+/**
+ * 新建术语(`POST /v3/channels/{channel}/terms`、`POST /v3/studios/{studio}/terms`)。
+ *
+ * studio 级术语要给 language;channel 里的跟 channel 的语言,传了也不用。分类写在 note 的 {{category|…}} 里。
+ */
+class StoreTermRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        $isStudio = $this->route('studio') !== null;
+
+        return [
+            'word' => ['required', 'string', 'max:1024'],
+            'tag' => ['sometimes', 'nullable', 'string', 'max:1024', 'not_regex:/@/'],
+            'meaning' => ['required', 'string', 'max:1024'],
+            'other_meaning' => ['sometimes', 'nullable', 'string', 'max:1024'],
+            'note' => ['sometimes', 'nullable', 'string'],
+            'summary' => ['sometimes', 'nullable', 'string'],
+            'quality' => ['sometimes', 'nullable', 'string', Rule::in(DhammaTerm::QUALITIES)],
+            'content_type' => ['sometimes', 'string', Rule::in(DhammaTerm::CONTENT_TYPES)],
+            'redirect' => ['sometimes', 'nullable', 'string', 'max:1024'],
+            'language' => [$isStudio ? 'required' : 'prohibited', 'string', 'max:16'],
+        ];
+    }
+}

+ 1 - 1
api-v13/app/Http/Requests/V3/TipitakaReadingRequest.php

@@ -40,7 +40,7 @@ class TipitakaReadingRequest extends FormRequest
             'after' => ['string', 'regex:/^\d+-\d+$/'],
             'page_size' => ['integer', 'min:1'],
             'unit' => ['string', 'in:para,byte'],
-            'format' => ['string', 'in:html,markdown,react,text'],
+            'format' => ['string', 'in:html,markdown,text'],
             'include' => ['string', 'in:display,sentences,all'],
         ];
     }

+ 36 - 0
api-v13/app/Http/Requests/V3/UpdateChannelLinksRequest.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Models\ChannelLink;
+use App\Services\V3\ChannelLinkService;
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * `PATCH /v3/channels/{channel}/links` 的入参:传了哪个键就整体替换哪一种关系,没有必填项。
+ *
+ * 目标是否存在、看不看得见、是不是自己、逐词类型对不对,在 {@see ChannelLinkService} 里判。
+ */
+class UpdateChannelLinksRequest extends FormRequest
+{
+    /** 登录与权限在中间件 / Service 里判 */
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'derived_from' => ['sometimes', 'nullable', 'uuid'],
+            'wbw' => ['sometimes', 'nullable', 'uuid'],
+            'fallback' => ['sometimes', 'array', 'max:'.ChannelLink::LISTS[ChannelLink::FALLBACK]],
+            'fallback.*' => ['uuid', 'distinct'],
+            'term_source' => ['sometimes', 'array', 'max:'.ChannelLink::LISTS[ChannelLink::TERM_SOURCE]],
+            'term_source.*' => ['uuid', 'distinct'],
+        ];
+    }
+}

+ 39 - 0
api-v13/app/Http/Requests/V3/UpdateChannelRequest.php

@@ -0,0 +1,39 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Models\Channel;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+/**
+ * `PATCH /v3/channels/{channel}` 的入参:改 channel 信息。只做局部更新,没有必填项。
+ */
+class UpdateChannelRequest extends FormRequest
+{
+    /**
+     * 登录与权限在中间件 / Service 里判:authorize() 返回 false 会渲染成 403,
+     * 而「没登录」应该是 401、无权要带具体文案。
+     */
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'name' => ['sometimes', 'string', 'max:128'],
+            'type' => ['sometimes', 'string', Rule::in(IndexChannelRequest::TYPES)],
+            'lang' => ['sometimes', 'string', 'max:16'],
+            'summary' => ['sometimes', 'nullable', 'string', 'max:1024'],
+            'status' => ['sometimes', 'integer', Rule::in([Channel::STATUS_PRIVATE, Channel::STATUS_UNLISTED, Channel::STATUS_PUBLIC])],
+            'source_type' => ['sometimes', 'string', Rule::in(['original', 'reprint', 'ai'])],
+            'source_id' => ['sometimes', 'nullable', 'string', 'max:36'],
+            'config' => ['sometimes', 'nullable', 'array'],
+        ];
+    }
+}

+ 49 - 0
api-v13/app/Http/Requests/V3/UpdateTermRequest.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Models\DhammaTerm;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+/**
+ * `PATCH /v3/terms/{term}`:只改传了的字段。word / tag 建立后不准改(引用方写 `[[word@tag]]`),
+ * 要改就新建一条、把旧的 redirect 过去。乐观锁的 If-Match 在 Service 里判。
+ */
+class UpdateTermRequest extends FormRequest
+{
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'word' => ['prohibited'],
+            'tag' => ['prohibited'],
+            'meaning' => ['sometimes', 'string', 'max:1024'],
+            'other_meaning' => ['sometimes', 'nullable', 'string', 'max:1024'],
+            'note' => ['sometimes', 'nullable', 'string'],
+            'summary' => ['sometimes', 'nullable', 'string'],
+            'quality' => ['sometimes', 'nullable', 'string', Rule::in(DhammaTerm::QUALITIES)],
+            'content_type' => ['sometimes', 'string', Rule::in(DhammaTerm::CONTENT_TYPES)],
+            'redirect' => ['sometimes', 'nullable', 'string', 'max:1024'],
+            'language' => ['sometimes', 'string', 'max:16'],
+        ];
+    }
+
+    /**
+     * @return array<string, string>
+     */
+    public function messages(): array
+    {
+        return [
+            'word.prohibited' => __('messages.term_word_immutable'),
+            'tag.prohibited' => __('messages.term_word_immutable'),
+        ];
+    }
+}

+ 49 - 0
api-v13/app/Http/Resources/V3/ChannelLinksResource.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace App\Http\Resources\V3;
+
+use App\Models\Channel;
+use App\Services\V3\ChannelLinkService;
+use Illuminate\Http\Request;
+
+/**
+ * 一个 channel 的关系设置(`channel_links` 表)。载荷来自 {@see ChannelLinkService::get()}。
+ */
+class ChannelLinksResource extends BaseResource
+{
+    /**
+     * @return array{
+     *     channel_id: string,
+     *     derived_from: array{id: string, name: string, type: string, lang: string, status: int}|null,
+     *     wbw: array{id: string, name: string, type: string, lang: string, status: int}|null,
+     *     fallback: list<array{id: string, name: string, type: string, lang: string, status: int}>,
+     *     term_source: list<array{id: string, name: string, type: string, lang: string, status: int}>,
+     *     can_update: bool
+     * }
+     */
+    public function toArray(Request $request): array
+    {
+        return [
+            'channel_id' => $this->resource['channel_id'],
+            'derived_from' => $this->ref($this->resource['derived_from']),
+            'wbw' => $this->ref($this->resource['wbw']),
+            'fallback' => array_map(fn (Channel $c) => $this->ref($c), $this->resource['fallback']),
+            'term_source' => array_map(fn (Channel $c) => $this->ref($c), $this->resource['term_source']),
+            'can_update' => $this->resource['can_update'],
+        ];
+    }
+
+    /**
+     * @return array{id: string, name: string, type: string, lang: string, status: int}|null
+     */
+    private function ref(?Channel $channel): ?array
+    {
+        return $channel === null ? null : [
+            'id' => (string) $channel->uid,
+            'name' => (string) $channel->name,
+            'type' => (string) $channel->type,
+            'lang' => (string) $channel->lang,
+            'status' => (int) $channel->status,
+        ];
+    }
+}

+ 47 - 0
api-v13/app/Http/Resources/V3/ChannelProgressResource.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace App\Http\Resources\V3;
+
+use App\Models\Channel;
+use Illuminate\Http\Request;
+
+/**
+ * 一个 channel 在一批句子上的完成度:channel 本身 + `final` + 内容的最早 / 最近时间。
+ *
+ * `final` 与请求里的句子一一对应:`[原文字符数, 是否已译]`;这个 channel 在这批句子上一句都没译时为 null
+ * (它出现在结果里是因为我能写它)。由 Service 挂上,本类不查库。
+ *
+ * @mixin Channel
+ */
+class ChannelProgressResource extends ChannelResource
+{
+    /**
+     * @param  Request  $request
+     * @return array{
+     *     id: string,
+     *     name: string,
+     *     summary: string|null,
+     *     type: string,
+     *     lang: string,
+     *     status: int,
+     *     is_system: bool,
+     *     source_type: string,
+     *     source_id: string|null,
+     *     owner: array{kind: string, id: string, nickName: string, realName: string, avatar: string|null},
+     *     abilities: array{read: bool, write: bool, update: bool, delete: bool},
+     *     final: array|null,
+     *     content_created_at: string|null,
+     *     content_updated_at: string|null,
+     *     created_at: string,
+     *     updated_at: string
+     * }
+     */
+    public function toArray($request): array
+    {
+        return parent::toArray($request) + [
+            'final' => $this->getAttribute('final'),
+            'content_created_at' => $this->getAttribute('content_created_at'),
+            'content_updated_at' => $this->getAttribute('content_updated_at'),
+        ];
+    }
+}

+ 90 - 0
api-v13/app/Http/Resources/V3/ChannelResource.php

@@ -0,0 +1,90 @@
+<?php
+
+namespace App\Http\Resources\V3;
+
+use App\Http\Resources\Concerns\ResolvesActor;
+use App\Models\Channel;
+use Illuminate\Http\Request;
+
+/**
+ * 一个 channel(译文集,界面上叫「版本风格」)。
+ *
+ * `owner` 是拥有者:个人(kind=user)或团队(kind=team,团队空间里建的)。
+ * `abilities` 是**当前查看者**能做什么,前端据此显示按钮。`progress` 只在列表带了 book + para 时出现
+ * (该章的完成度,没有进度为 null)。**本类不查库**:拥有者来自预加载,abilities / progress 由 Service 挂上。
+ *
+ * 字段类型取自 channels 表:type / source_type / source_id 都是 varchar。
+ *
+ * @mixin Channel
+ */
+class ChannelResource extends BaseResource
+{
+    use ResolvesActor;
+
+    /**
+     * @param  Request  $request
+     * @return array{
+     *     id: string,
+     *     name: string,
+     *     summary: string|null,
+     *     type: string,
+     *     lang: string,
+     *     status: int,
+     *     is_system: bool,
+     *     source_type: string,
+     *     source_id: string|null,
+     *     owner: array{kind: string, id: string, nickName: string, realName: string, avatar: string|null},
+     *     abilities: array{read: bool, write: bool, update: bool, delete: bool},
+     *     progress?: float|null,
+     *     created_at: string,
+     *     updated_at: string
+     * }
+     */
+    public function toArray($request): array
+    {
+        return [
+            'id' => (string) $this->uid,
+            'name' => $this->name,
+            'summary' => $this->summary,
+            'type' => $this->type,
+            'lang' => $this->lang,
+            'status' => (int) $this->status,
+            'is_system' => (bool) $this->is_system,
+            'source_type' => $this->source_type,
+            'source_id' => $this->source_id,
+            'owner' => $this->ownerSummary(),
+            'abilities' => $this->getAttribute('abilities'),
+            'progress' => $this->when(
+                array_key_exists('progress', $this->resource->getAttributes()),
+                fn () => $this->progress === null ? null : (float) $this->progress,
+            ),
+            'created_at' => $this->created_at,
+            'updated_at' => $this->updated_at,
+        ];
+    }
+
+    /**
+     * @return array{kind: string, id: string, nickName: string, realName: string, avatar: string|null}
+     */
+    private function ownerSummary(): array
+    {
+        if ($this->ownerGroup) {
+            return [
+                'kind' => 'team',
+                'id' => $this->ownerGroup->uid,
+                'nickName' => $this->ownerGroup->name,
+                'realName' => $this->ownerGroup->uid,
+                'avatar' => null,
+            ];
+        }
+        $user = $this->actor($this->owner);
+
+        return [
+            'kind' => 'user',
+            'id' => (string) ($user['id'] ?? $this->owner_uid),
+            'nickName' => (string) ($user['nickName'] ?? ''),
+            'realName' => (string) ($user['realName'] ?? ''),
+            'avatar' => $user['avatar'] ?? null,
+        ];
+    }
+}

+ 13 - 3
api-v13/app/Http/Resources/V3/DiscussionResource.php

@@ -4,6 +4,8 @@ namespace App\Http\Resources\V3;
 
 use App\Http\Resources\Concerns\ResolvesActor;
 use App\Models\Discussion;
+use App\Services\Markup\MarkupService;
+use App\Services\Markup\Render\TreeRenderer;
 use App\Services\V3\DiscussionService;
 use Illuminate\Http\Request;
 
@@ -26,6 +28,14 @@ use Illuminate\Http\Request;
  * `sentence` 只在按经文范围列出时有(`GET /v3/tipitaka-discussions/{channel}`):所在句子的坐标,
  * 由查询顺带取出(`sentence_*` 属性),本类不另查。
  *
+ * `body` 是渲染后的正文({@see MarkupService} 的节点树,节点形状见
+ * {@see TreeRenderer}),`summary` 是纯文本摘要;两者只在挂在句子上、
+ * 未删除、有正文时给(正文里的模板要用句子所在的 channel 解析)。取代了 v3 早期的 `html`
+ * (v2 MdRender 的 MdTpl HTML 字符串)。
+ *
+ * `content_type` 是正文实际的方言:v3 写入的是 `markdown-e2`(存在 content_type_v2 列),
+ * v2 写入的是原 content_type(markdown / text / html),见 {@see Discussion::effectiveContentType()}。
+ *
  * 字段名改了两处(v2 → v3):res_type / res_id → target_type / target_id,
  * parent → parent_id;children_count → reply_count(只有话题有)。
  *
@@ -49,7 +59,7 @@ class DiscussionResource extends BaseResource
      *     title: string|null,
      *     content: string|null,
      *     content_type: string,
-     *     html?: string,
+     *     body?: list<MarkupNode>,
      *     summary?: string,
      *     tpl_id: string|null,
      *     pos_start: int|null,
@@ -82,8 +92,8 @@ class DiscussionResource extends BaseResource
             'status' => $this->status,
             'title' => $tombstone ? null : $this->title,
             'content' => $tombstone ? null : $this->content,
-            'content_type' => $this->content_type,
-            'html' => $this->when($this->rendered !== null, fn () => $this->rendered['html']),
+            'content_type' => $this->effectiveContentType(),
+            'body' => $this->when($this->rendered !== null, fn () => $this->rendered['body']),
             'summary' => $this->when($this->rendered !== null, fn () => $this->rendered['summary']),
             'tpl_id' => $this->tpl_id,
             'pos_start' => $this->pos_start,

+ 37 - 0
api-v13/app/Http/Resources/V3/GlossaryEntryResource.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace App\Http\Resources\V3;
+
+use App\Models\DhammaTerm;
+use Illuminate\Http\Request;
+
+/**
+ * 词汇表的一条(`dhamma_terms` 表里系统 channel 的术语)。只给客户端本地查词要用的字段;`id` 是术语 guid。
+ *
+ * @mixin DhammaTerm
+ */
+class GlossaryEntryResource extends BaseResource
+{
+    /**
+     * @return array{
+     *     id: string,
+     *     word: string,
+     *     tag: string|null,
+     *     meaning: string,
+     *     other_meaning: string|null
+     * }
+     */
+    public function toArray(Request $request): array
+    {
+        $tag = trim((string) $this->tag);
+        $other = trim((string) $this->other_meaning);
+
+        return [
+            'id' => (string) $this->guid,
+            'word' => (string) $this->word,
+            'tag' => $tag === '' ? null : $tag,
+            'meaning' => (string) $this->meaning,
+            'other_meaning' => $other === '' ? null : $other,
+        ];
+    }
+}

Some files were not shown because too many files changed in this diff