Przeglądaj źródła

✨ channel 迁 v3:目录、studio 列表、我能写的、详情 / 改 / 删、阅读领域查询、batch-progress

channel 相关的 v2 接口全部有了 v3 端点,dashboard-v6 彻底切过去,团队空间里放开「版本风格」菜单:

- `GET /v3/channels`(公开目录;`system=true` 只要系统 channel,不论 status)
- `GET|POST /v3/studios/{studio}/channels`(studio 一律 uuid,用户或团队;relation=own|shared|all,
  个人空间的 shared 不含经团队转来的;数量读 meta.total,取代 channel-my-number)
- `GET /v3/channels/editable`(我能写的,跨 studio;v2 的搜索一直坏,这里修好)
- `GET|PATCH|DELETE /v3/channels/{channel}`(只有 PATCH;软删除,有内容 409;系统 channel 不能改删)
- `GET /v3/tipitaka-paragraph-channels/{book}/{para}`、`GET /v3/tipitaka-channels`(mobile「译本合集」)
- `POST /v3/channels/batch-progress`(取代 channel-progress,固定 4 次查询)

权限集中在 App\Services\V3\ChannelAbilityService:拥有者 + 团队角色 + share 三者叠加,每条带 abilities;
「能访问」(status ≥ 20,含新增的 20 公开不列出)与「会被列出」(只列 30 与系统 channel)分开判。
按 channel 取正文的 tipitaka-reading 与 search/{id} 整章文档加了读权限闸(私有 channel 非成员 403)。
tipitaka-chapter-channels 改用同一套可见性,并排除系统 channel 与软删的。
Channel 加了 SoftDeletes(v2 的删除也随之变成软删)。channels 表与团队都不支持 AI 模型建 / 改 / 删
(AgentGrantService::assertHuman;补上 POST /v3/groups 漏拦的模型 token)。

dashboard-v6:/workspace/channel 的页签、页码、每页条数、关键字、协作者、排序进 URL 可 F5 重入
(分页不受控 + 换 key 重挂,避免受控分页死循环);每页条数记 localStorage(utils/pageSize.ts);
角标与表格同条件(社区角标原来用错了变量);切换个人 / 团队空间时表格按新身份重新取。

测试:Pest 新增约 70 条;api-test 新增 14_channels.php;dashboard-test 新增 channel-url / channel-teamspace /
channel-unlisted,teamspace.spec 改用术语测「未支持的模块」。v2 旧端点经 overrides 标为已取代,
CLAUDE.md 对照表补一行。v6 channel 详情页的章节列表(progress?view=chapter)待迁 progress 时处理。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 1 dzień temu
rodzic
commit
dfada3e379
100 zmienionych plików z 17883 dodań i 558 usunięć
  1. 0 0
      CLAUDE.md
  2. 165 0
      api-test/cases/14_channels.php
  3. 48 0
      api-test/client/.openapi-generator/FILES
  4. 2329 0
      api-test/client/lib/Api/ChannelsApi.php
  5. 16 2
      api-test/client/lib/Api/SearchApi.php
  6. 1038 0
      api-test/client/lib/Api/StudiosApi.php
  7. 542 0
      api-test/client/lib/Api/TipitakaChannelsApi.php
  8. 537 0
      api-test/client/lib/Api/TipitakaParagraphChannelsApi.php
  9. 16 2
      api-test/client/lib/Api/TipitakaReadingApi.php
  10. 443 0
      api-test/client/lib/Model/GetApiV3Channels200Response.php
  11. 872 0
      api-test/client/lib/Model/GetApiV3Channels200ResponseDataInner.php
  12. 511 0
      api-test/client/lib/Model/GetApiV3Channels200ResponseDataInnerAbilities.php
  13. 552 0
      api-test/client/lib/Model/GetApiV3Channels200ResponseDataInnerOwner.php
  14. 409 0
      api-test/client/lib/Model/GetApiV3ChannelsChannel200Response.php
  15. 443 0
      api-test/client/lib/Model/GetApiV3TipitakaChannels200Response.php
  16. 865 0
      api-test/client/lib/Model/GetApiV3TipitakaChannels200ResponseDataInner.php
  17. 725 0
      api-test/client/lib/Model/PatchApiV3ChannelsChannelRequest.php
  18. 443 0
      api-test/client/lib/Model/PostApiV3ChannelsBatchProgress200Response.php
  19. 954 0
      api-test/client/lib/Model/PostApiV3ChannelsBatchProgress200ResponseDataInner.php
  20. 446 0
      api-test/client/lib/Model/PostApiV3ChannelsBatchProgressRequest.php
  21. 700 0
      api-test/client/lib/Model/PostApiV3StudiosStudioChannelsRequest.php
  22. 44 0
      api-v13/app/Http/Controllers/V3/ChannelBatchProgressController.php
  23. 123 0
      api-v13/app/Http/Controllers/V3/ChannelController.php
  24. 45 0
      api-v13/app/Http/Controllers/V3/EditableChannelController.php
  25. 21 3
      api-v13/app/Http/Controllers/V3/SearchPlusController.php
  26. 86 0
      api-v13/app/Http/Controllers/V3/StudioChannelController.php
  27. 44 0
      api-v13/app/Http/Controllers/V3/TipitakaChannelController.php
  28. 46 0
      api-v13/app/Http/Controllers/V3/TipitakaParagraphChannelController.php
  29. 13 2
      api-v13/app/Http/Controllers/V3/TipitakaReadingController.php
  30. 32 0
      api-v13/app/Http/Requests/V3/ChannelBatchProgressRequest.php
  31. 45 0
      api-v13/app/Http/Requests/V3/IndexChannelRequest.php
  32. 41 0
      api-v13/app/Http/Requests/V3/IndexEditableChannelRequest.php
  33. 43 0
      api-v13/app/Http/Requests/V3/IndexStudioChannelRequest.php
  34. 31 0
      api-v13/app/Http/Requests/V3/IndexTipitakaChannelRequest.php
  35. 27 0
      api-v13/app/Http/Requests/V3/IndexTipitakaParagraphChannelRequest.php
  36. 38 0
      api-v13/app/Http/Requests/V3/StoreChannelRequest.php
  37. 39 0
      api-v13/app/Http/Requests/V3/UpdateChannelRequest.php
  38. 47 0
      api-v13/app/Http/Resources/V3/ChannelProgressResource.php
  39. 90 0
      api-v13/app/Http/Resources/V3/ChannelResource.php
  40. 38 0
      api-v13/app/Http/Resources/V3/TipitakaChannelResource.php
  41. 31 0
      api-v13/app/Models/Channel.php
  42. 12 0
      api-v13/app/Services/V3/AgentGrantService.php
  43. 227 0
      api-v13/app/Services/V3/ChannelAbilityService.php
  44. 170 0
      api-v13/app/Services/V3/ChannelProgressService.php
  45. 302 0
      api-v13/app/Services/V3/ChannelService.php
  46. 6 1
      api-v13/app/Services/V3/GroupService.php
  47. 98 0
      api-v13/app/Services/V3/TipitakaChannelService.php
  48. 12 38
      api-v13/app/Services/V3/TipitakaChapterChannelService.php
  49. 5 0
      api-v13/resources/lang/en/messages.php
  50. 5 0
      api-v13/resources/lang/zh-Hans/messages.php
  51. 34 4
      api-v13/routes/v3/channel.php
  52. 11 0
      api-v13/routes/v3/tipitaka.php
  53. 105 0
      api-v13/tests/Feature/ChannelBatchProgressV3Test.php
  54. 100 0
      api-v13/tests/Feature/ChannelContentAccessV3Test.php
  55. 422 0
      api-v13/tests/Feature/ChannelV3Test.php
  56. 7 0
      api-v13/tests/Feature/GroupV3Test.php
  57. 125 0
      api-v13/tests/Feature/TipitakaChannelV3Test.php
  58. 38 0
      api-v13/tests/Pest.php
  59. 112 0
      dashboard-test/src/tests/channel-teamspace.spec.ts
  60. 52 0
      dashboard-test/src/tests/channel-unlisted.spec.ts
  61. 129 0
      dashboard-test/src/tests/channel-url.spec.ts
  62. 4 3
      dashboard-test/src/tests/teamspace.spec.ts
  63. 162 84
      dashboard-v6/src/api/channel.ts
  64. 929 24
      dashboard-v6/src/api/schema.d.ts
  65. 14 17
      dashboard-v6/src/components/channel/ChannelCreate.tsx
  66. 28 46
      dashboard-v6/src/components/channel/ChannelPickerTable.tsx
  67. 25 23
      dashboard-v6/src/components/channel/ChannelSelect.tsx
  68. 216 90
      dashboard-v6/src/components/channel/ChannelTable.tsx
  69. 1 0
      dashboard-v6/src/components/channel/ChannelTableModal.tsx
  70. 43 49
      dashboard-v6/src/components/channel/Edit.tsx
  71. 4 2
      dashboard-v6/src/components/channel/StudioSelect.tsx
  72. 9 32
      dashboard-v6/src/components/channel/hooks/useChannelProgress.ts
  73. 32 37
      dashboard-v6/src/components/course/CourseInfoEdit.tsx
  74. 13 8
      dashboard-v6/src/components/course/SelectChannel.tsx
  75. 2 0
      dashboard-v6/src/components/task/ProjectTable.tsx
  76. 8 17
      dashboard-v6/src/components/term/GrammarBook.tsx
  77. 2 6
      dashboard-v6/src/features/teamspace/scope.ts
  78. 5 4
      dashboard-v6/src/hooks/useActiveStudio.ts
  79. 72 9
      dashboard-v6/src/pages/workspace/channel/list.tsx
  80. 4 13
      dashboard-v6/src/pages/workspace/channel/setting.tsx
  81. 5 8
      dashboard-v6/src/pages/workspace/channel/show.tsx
  82. 2 2
      dashboard-v6/src/pages/workspace/course/edit.tsx
  83. 26 0
      dashboard-v6/src/utils/pageSize.ts
  84. 14 0
      openapi/public/assets/protocol/main.yaml
  85. 18 2
      openapi/public/assets/protocol/overrides/v2-channel-channel.yaml
  86. 5 0
      openapi/public/assets/protocol/overrides/v2-channel-my-number.yaml
  87. 5 0
      openapi/public/assets/protocol/overrides/v2-channel-progress.yaml
  88. 15 0
      openapi/public/assets/protocol/overrides/v2-channel.yaml
  89. 13 18
      openapi/public/assets/protocol/resources/auto/v2-channel-channel.yaml
  90. 3 1
      openapi/public/assets/protocol/resources/auto/v2-channel-my-number.yaml
  91. 3 1
      openapi/public/assets/protocol/resources/auto/v2-channel-progress.yaml
  92. 12 10
      openapi/public/assets/protocol/resources/auto/v2-channel.yaml
  93. 93 0
      openapi/public/assets/protocol/resources/auto/v3-channels-batch-progress.yaml
  94. 302 0
      openapi/public/assets/protocol/resources/auto/v3-channels-channel.yaml
  95. 137 0
      openapi/public/assets/protocol/resources/auto/v3-channels-editable.yaml
  96. 147 0
      openapi/public/assets/protocol/resources/auto/v3-channels.yaml
  97. 9 0
      openapi/public/assets/protocol/resources/auto/v3-search-search.yaml
  98. 352 0
      openapi/public/assets/protocol/resources/auto/v3-studios-studio-channels.yaml
  99. 105 0
      openapi/public/assets/protocol/resources/auto/v3-tipitaka-channels.yaml
  100. 94 0
      openapi/public/assets/protocol/resources/auto/v3-tipitaka-paragraph-channels-book-para.yaml

Plik diff jest za duży
+ 0 - 0
CLAUDE.md


+ 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));
+});

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

@@ -12,6 +12,7 @@ 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
@@ -26,9 +27,12 @@ docs/Api/ReadingTimeApi.md
 docs/Api/SearchApi.md
 docs/Api/SearchSuggestApi.md
 docs/Api/SessionsApi.md
+docs/Api/StudiosApi.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 +69,11 @@ 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/GetApiV3CreditPolicy200Response.md
 docs/Model/GetApiV3CreditPolicy200ResponseData.md
 docs/Model/GetApiV3CreditPolicy200ResponseDataDailyFree.md
@@ -104,6 +113,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
@@ -124,6 +135,7 @@ docs/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseDataInner.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200Response.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.md
 docs/Model/PaginationMeta.md
+docs/Model/PatchApiV3ChannelsChannelRequest.md
 docs/Model/PatchApiV3DiscussionsDiscussionRequest.md
 docs/Model/PatchApiV3GroupsGroupMembersMemberRequest.md
 docs/Model/PatchApiV3GroupsGroupRequest.md
@@ -144,6 +156,9 @@ 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/PostApiV3Discussions200Response.md
 docs/Model/PostApiV3DiscussionsBatchCount200Response.md
 docs/Model/PostApiV3DiscussionsBatchCount200ResponseDataInner.md
@@ -169,6 +184,7 @@ docs/Model/PostApiV3SearchRequest.md
 docs/Model/PostApiV3Sessions200Response.md
 docs/Model/PostApiV3Sessions200ResponseData.md
 docs/Model/PostApiV3SessionsRequest.md
+docs/Model/PostApiV3StudiosStudioChannelsRequest.md
 docs/Model/PostApiV3Users200Response.md
 docs/Model/PostApiV3Users200ResponseData.md
 docs/Model/PostApiV3UsersRequest.md
@@ -182,6 +198,7 @@ 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
@@ -196,9 +213,12 @@ lib/Api/ReadingTimeApi.php
 lib/Api/SearchApi.php
 lib/Api/SearchSuggestApi.php
 lib/Api/SessionsApi.php
+lib/Api/StudiosApi.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 +259,11 @@ 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/GetApiV3CreditPolicy200Response.php
 lib/Model/GetApiV3CreditPolicy200ResponseData.php
 lib/Model/GetApiV3CreditPolicy200ResponseDataDailyFree.php
@@ -278,6 +303,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
@@ -299,6 +326,7 @@ lib/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200Response.php
 lib/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.php
 lib/Model/ModelInterface.php
 lib/Model/PaginationMeta.php
+lib/Model/PatchApiV3ChannelsChannelRequest.php
 lib/Model/PatchApiV3DiscussionsDiscussionRequest.php
 lib/Model/PatchApiV3GroupsGroupMembersMemberRequest.php
 lib/Model/PatchApiV3GroupsGroupRequest.php
@@ -319,6 +347,9 @@ 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/PostApiV3Discussions200Response.php
 lib/Model/PostApiV3DiscussionsBatchCount200Response.php
 lib/Model/PostApiV3DiscussionsBatchCount200ResponseDataInner.php
@@ -344,6 +375,7 @@ lib/Model/PostApiV3SearchRequest.php
 lib/Model/PostApiV3Sessions200Response.php
 lib/Model/PostApiV3Sessions200ResponseData.php
 lib/Model/PostApiV3SessionsRequest.php
+lib/Model/PostApiV3StudiosStudioChannelsRequest.php
 lib/Model/PostApiV3Users200Response.php
 lib/Model/PostApiV3Users200ResponseData.php
 lib/Model/PostApiV3UsersRequest.php
@@ -358,6 +390,7 @@ 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
@@ -372,9 +405,12 @@ test/Api/ReadingTimeApiTest.php
 test/Api/SearchApiTest.php
 test/Api/SearchSuggestApiTest.php
 test/Api/SessionsApiTest.php
+test/Api/StudiosApiTest.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 +447,11 @@ 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/GetApiV3CreditPolicy200ResponseDataDailyFreeTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataEarnReadingTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataEarnTest.php
@@ -450,6 +491,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
@@ -470,6 +513,7 @@ test/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInnerTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseTest.php
 test/Model/PaginationMetaTest.php
+test/Model/PatchApiV3ChannelsChannelRequestTest.php
 test/Model/PatchApiV3DiscussionsDiscussionRequestTest.php
 test/Model/PatchApiV3GroupsGroupMembersMemberRequestTest.php
 test/Model/PatchApiV3GroupsGroupRequestTest.php
@@ -490,6 +534,9 @@ 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/PostApiV3Discussions200ResponseTest.php
 test/Model/PostApiV3DiscussionsBatchCount200ResponseDataInnerTest.php
 test/Model/PostApiV3DiscussionsBatchCount200ResponseTest.php
@@ -515,6 +562,7 @@ test/Model/PostApiV3SearchRequestTest.php
 test/Model/PostApiV3Sessions200ResponseDataTest.php
 test/Model/PostApiV3Sessions200ResponseTest.php
 test/Model/PostApiV3SessionsRequestTest.php
+test/Model/PostApiV3StudiosStudioChannelsRequestTest.php
 test/Model/PostApiV3Users200ResponseDataTest.php
 test/Model/PostApiV3Users200ResponseTest.php
 test/Model/PostApiV3UsersRequestTest.php

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

@@ -0,0 +1,2329 @@
+<?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',
+        ],
+        'getApiV3ChannelsEditable' => [
+            'application/json',
+        ],
+        'patchApiV3ChannelsChannel' => [
+            'application/json',
+        ],
+        'postApiV3ChannelsBatchProgress' => [
+            '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 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 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 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
+        );
+    }
+
+    /**
+     * 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(),

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

@@ -0,0 +1,1038 @@
+<?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',
+        ],
+        'postApiV3StudiosStudioChannels' => [
+            '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 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 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
+        );
+    }
+
+    /**
+     * 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));
+    }
+}
+
+

+ 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));
+    }
+}
+
+

+ 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));
+    }
+}
+
+

+ 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));
+    }
+}
+
+

+ 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));
+    }
+}
+
+

+ 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'],
+        ));
+    }
+}

+ 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),
+        ));
+    }
+}

+ 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(),
+        ));
+    }
+}

+ 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),
+        ));
+    }
+}

+ 13 - 2
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
@@ -59,7 +68,8 @@ class TipitakaReadingController extends Controller
      *             不叫 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'],
+        ];
+    }
+}

+ 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'],
+        ];
+    }
+}

+ 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'],
+        ];
+    }
+}

+ 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'],
+        ];
+    }
+}

+ 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'],
+        ];
+    }
+}

+ 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'],
+        ];
+    }
+}

+ 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,
+        ];
+    }
+}

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

@@ -0,0 +1,38 @@
+<?php
+
+namespace App\Http\Resources\V3;
+
+use App\Models\Channel;
+use Illuminate\Http\Request;
+
+/**
+ * 有译文的公开 channel:channel 本身 + `chapter_count`(完成度过门槛的章节数)。
+ *
+ * @mixin Channel
+ */
+class TipitakaChannelResource 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},
+     *     chapter_count: int,
+     *     created_at: string,
+     *     updated_at: string
+     * }
+     */
+    public function toArray($request): array
+    {
+        return parent::toArray($request) + ['chapter_count' => (int) $this->getAttribute('chapter_count')];
+    }
+}

+ 31 - 0
api-v13/app/Models/Channel.php

@@ -4,15 +4,38 @@ namespace App\Models;
 
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\SoftDeletes;
 
+/**
+ * 译文集(channel)。表 `channels`,界面上叫「版本风格」。
+ *
+ * `owner_uid` 是用户 uuid 或团队(`group_infos.uid`)uuid——团队空间里的 channel 属于团队。
+ * `status`:30 全网公开;20 公开不列出(拿到链接谁都能看,但不出现在社区目录、
+ * 章节版本列表等任何面向他人的列表里);10 私有(0 / 1 / 5 是历史值,按私有对待)。
+ *
+ * 软删除(2026-11-16 起):v2 与 v3 的删除都只标 `deleted_at`,查询自动排除。
+ * 删除前要求 channel 下没有译文、术语、逐词(v2 / v3 同口径),所以被删的 channel
+ * 不会再出现在 progress_chapters 等派生表里。
+ */
 class Channel extends Model
 {
     use HasFactory;
+    use SoftDeletes;
+
+    public const STATUS_PRIVATE = 10;
+
+    public const STATUS_UNLISTED = 20;
+
+    public const STATUS_PUBLIC = 30;
 
     protected $fillable = ['name', 'summary', 'type', 'lang', 'status', 'updated_at', 'created_at'];
 
     protected $primaryKey = 'uid';
 
+    /** 主键是 uuid:不声明的话关系预加载会按整数走 whereIntegerInRaw,把 uuid 全转成 0 */
+    protected $keyType = 'string';
+
     protected $casts = [
         'uid' => 'string',
     ];
@@ -31,4 +54,12 @@ class Channel extends Model
     {
         return $this->belongsTo(UserInfo::class, 'owner_uid', 'userid');
     }
+
+    /**
+     * 拥有它的团队(owner 是团队时才有)。
+     */
+    public function ownerGroup(): BelongsTo
+    {
+        return $this->belongsTo(GroupInfo::class, 'owner_uid', 'uid');
+    }
 }

+ 12 - 0
api-v13/app/Services/V3/AgentGrantService.php

@@ -141,6 +141,18 @@ class AgentGrantService
         return $channelUid === $scope['channel'] && ($scope['book'] === 0 || $book === $scope['book']);
     }
 
+    /**
+     * 只许人类操作的写入(channel、团队这类「权限本身」的资源不支持 agent 代写):模型 token 一律 403。
+     *
+     * @throws AuthorizationException
+     */
+    public function assertHuman(string $uid): void
+    {
+        if ($this->isModel($uid)) {
+            throw new AuthorizationException(__('messages.agent_not_allowed'));
+        }
+    }
+
     private function isModel(string $uid): bool
     {
         return AiModel::where('uid', $uid)->exists();

+ 227 - 0
api-v13/app/Services/V3/ChannelAbilityService.php

@@ -0,0 +1,227 @@
+<?php
+
+namespace App\Services\V3;
+
+use App\Models\Channel;
+use App\Models\GroupMember;
+use App\Models\Share;
+use Illuminate\Auth\Access\AuthorizationException;
+use Illuminate\Contracts\Database\Query\Builder;
+use Illuminate\Support\Str;
+
+/**
+ * channel 的权限判定(只给 v3 用):谁看得见、谁能写内容、谁能改信息、谁能删。
+ *
+ * 三种来源叠加:
+ * 1. **拥有者**:owner 是本人 → 什么都能做
+ * 2. **团队角色**:owner 是团队 → 按本人在团队里的角色({@see GroupAbilityService}):
+ *    reader 读;editor 读、写内容、改信息;manager 同 editor(另能在团队名下新建);owner 还能删
+ * 3. **共享**(shares 表,直接共享给本人或本人所在的团队):power 10 读、20 写内容、30 改信息
+ *
+ * 「能访问」与「会被列出」是两回事:
+ * - **能访问**({@see self::abilities()} 的 read):status ≥ 20 谁都能读——30 公开,20 公开不列出
+ *   (拿到链接就能看)。系统 channel(原文、系统术语等全站共用的基础数据)不论 status 也谁都能读——
+ *   库里一半系统 channel 是 status 10,巴利原文 `_System_Pali_VRI_` 就是。
+ * - **会被列出**({@see self::scopeListable()}):给别人看的列表只列 status 30 与系统 channel;
+ *   20 只在拥有者、团队成员、被共享的人自己的列表里出现。
+ * 系统 channel 不能改信息、不能删。
+ * v2 的判定(`ShareApi`、`ChecksChannelEditPower` …)只认「owner 是本人」,不改它(铁律 2)。
+ */
+class ChannelAbilityService
+{
+    public const SHARE_CHANNEL = 2;
+
+    public const POWER_READ = 10;
+
+    public const POWER_WRITE = 20;
+
+    public const POWER_MANAGE = 30;
+
+    /** 能写内容的团队角色 */
+    private const WRITER_ROLES = [GroupMember::ROLE_OWNER, GroupMember::ROLE_MANAGER, GroupMember::ROLE_EDITOR];
+
+    public function __construct(private readonly GroupAbilityService $groups) {}
+
+    /**
+     * 本人对一个 channel 能做什么。
+     *
+     * @return array{read: bool, write: bool, update: bool, delete: bool}
+     */
+    public function abilities(Channel $channel, ?string $userUid): array
+    {
+        return $this->abilitiesMany([$channel], $userUid)[$channel->uid];
+    }
+
+    /**
+     * 整页批量算:团队角色一次、共享权限一次,查询数与行数无关。
+     *
+     * @param  iterable<Channel>  $channels
+     * @return array<string, array{read: bool, write: bool, update: bool, delete: bool}>
+     */
+    public function abilitiesMany(iterable $channels, ?string $userUid): array
+    {
+        $teams = $userUid ? $this->teamRoles($userUid) : [];
+        $powers = [];
+        if ($userUid) {
+            $ids = [];
+            foreach ($channels as $channel) {
+                $ids[] = $channel->uid;
+            }
+            $powers = Share::whereIn('res_id', $ids)
+                ->where('res_type', self::SHARE_CHANNEL)
+                ->whereIn('cooperator_id', [$userUid, ...array_keys($teams)])
+                ->selectRaw('res_id, max(power) as power')
+                ->groupBy('res_id')
+                ->pluck('power', 'res_id')
+                ->all();
+        }
+
+        $result = [];
+        foreach ($channels as $channel) {
+            $read = (int) $channel->status >= Channel::STATUS_UNLISTED || (bool) $channel->is_system;
+            $write = $update = $delete = false;
+            if ($userUid !== null) {
+                if ($channel->owner_uid === $userUid) {
+                    $write = $update = $delete = true;
+                } else {
+                    $role = $teams[$channel->owner_uid] ?? null;
+                    $power = (int) ($powers[$channel->uid] ?? 0);
+                    $write = in_array($role, self::WRITER_ROLES, true) || $power >= self::POWER_WRITE;
+                    $update = GroupAbilityService::roleAllows($role, GroupAbilityService::UPDATE) || $power >= self::POWER_MANAGE;
+                    $delete = GroupAbilityService::roleAllows($role, GroupAbilityService::DELETE);
+                    $read = $read || $role !== null || $power >= self::POWER_READ;
+                }
+            }
+            if ($channel->is_system) {
+                $update = $delete = false;
+            }
+            $result[$channel->uid] = ['read' => $read || $write, 'write' => $write, 'update' => $update, 'delete' => $delete];
+        }
+
+        return $result;
+    }
+
+    /**
+     * 读正文前的闸:channel 不存在(或已软删)404,看不见 403。
+     *
+     * 给按 channel 取正文的接口用(`tipitaka-reading`、`search/{id}` 的整章文档):
+     * 私有 channel 只有拥有者、团队成员、被共享的人能读;公开与「公开不列出」谁都能读。
+     *
+     * @throws AuthorizationException
+     */
+    public function assertReadable(string $channelUid, ?string $userUid): void
+    {
+        $channel = Channel::query()
+            ->where('uid', $channelUid)
+            ->firstOrFail(['uid', 'owner_uid', 'status', 'is_system']);
+        if (! $this->abilities($channel, $userUid)['read']) {
+            throw new AuthorizationException(__('messages.channel_forbidden'));
+        }
+    }
+
+    /**
+     * 能不能在某个 studio(本人或团队)名下新建 channel。
+     */
+    public function canCreateIn(string $userUid, string $studioUid): bool
+    {
+        return $this->groups->can($userUid, $studioUid, GroupAbilityService::CREATE);
+    }
+
+    /**
+     * 能不能看某个 studio(本人或团队)的工作区列表:本人,或该团队的任何成员。
+     */
+    public function canListStudio(string $userUid, string $studioUid): bool
+    {
+        return $this->groups->can($userUid, $studioUid, GroupAbilityService::READ);
+    }
+
+    /**
+     * 查询约束:列表里列得出来的 channel——公开的(status 30)、系统的,加上(登录时)本人的、
+     * 本人所在团队名下的、共享给本人或本人所在团队的。status 20(公开不列出)只在后三种里出现。
+     *
+     * @param  string  $table  channels 表在查询里的名字(join 时可能带别名)
+     */
+    public function scopeListable(Builder $query, ?string $userUid, string $table = 'channels'): void
+    {
+        $query->where(function (Builder $q) use ($userUid, $table) {
+            $q->where("{$table}.status", '>=', Channel::STATUS_PUBLIC)
+                ->orWhere("{$table}.is_system", true);
+            if ($userUid === null) {
+                return;
+            }
+            $teams = $this->teamRoles($userUid);
+            $q->orWhere("{$table}.owner_uid", $userUid);
+            if ($teams !== []) {
+                $q->orWhereIn("{$table}.owner_uid", array_keys($teams));
+            }
+            $shared = $this->sharedChannels([$userUid, ...array_keys($teams)], self::POWER_READ);
+            if ($shared !== []) {
+                $q->orWhereIn("{$table}.uid", $shared);
+            }
+        });
+    }
+
+    /**
+     * 查询约束:能写内容的 channel(本人的、本人是团队 editor 及以上的团队名下的、共享权限 ≥20 的)。
+     */
+    public function scopeWritable(Builder $query, string $userUid, string $table = 'channels'): void
+    {
+        $teams = $this->teamRoles($userUid);
+        $writerTeams = array_keys(array_filter($teams, fn (string $role) => in_array($role, self::WRITER_ROLES, true)));
+        $shared = $this->sharedChannels([$userUid, ...array_keys($teams)], self::POWER_WRITE);
+
+        $query->where(function (Builder $q) use ($userUid, $table, $writerTeams, $shared) {
+            $q->where("{$table}.owner_uid", $userUid);
+            if ($writerTeams !== []) {
+                $q->orWhereIn("{$table}.owner_uid", $writerTeams);
+            }
+            if ($shared !== []) {
+                $q->orWhereIn("{$table}.uid", $shared);
+            }
+        });
+    }
+
+    /**
+     * 直接共享给某个 studio(本人或团队,**不含**经团队转来的)的 channel uid。
+     *
+     * @return list<string>
+     */
+    public function sharedTo(string $studioUid): array
+    {
+        return $this->sharedChannels([$studioUid], self::POWER_READ);
+    }
+
+    /**
+     * 本人所在的团队 → 角色。
+     *
+     * @return array<string, string>
+     */
+    private function teamRoles(string $userUid): array
+    {
+        $roles = [];
+        foreach (GroupMember::where('user_id', $userUid)->get(['group_id', 'role', 'power']) as $member) {
+            $roles[$member->group_id] = $member->effectiveRole();
+        }
+
+        return $roles;
+    }
+
+    /**
+     * 共享给这些人 / 团队、且权限不低于 $minPower 的 channel uid。
+     *
+     * @param  list<string>  $cooperators
+     * @return list<string>
+     */
+    private function sharedChannels(array $cooperators, int $minPower): array
+    {
+        return Share::whereIn('cooperator_id', $cooperators)
+            ->where('res_type', self::SHARE_CHANNEL)
+            ->where('power', '>=', $minPower)
+            ->pluck('res_id')
+            // shares.res_id 是 varchar,channels.uid 是 uuid;非法值进了 where 会让 pgsql 报错
+            ->filter(fn ($id) => Str::isUuid($id))
+            ->unique()
+            ->values()
+            ->all();
+    }
+}

+ 170 - 0
api-v13/app/Services/V3/ChannelProgressService.php

@@ -0,0 +1,170 @@
+<?php
+
+namespace App\Services\V3;
+
+use App\Models\Channel;
+use App\Models\CustomBook;
+use App\Models\Sentence;
+use App\Services\UserService;
+use Illuminate\Auth\Access\AuthorizationException;
+use Illuminate\Support\Collection;
+
+/**
+ * 一批句子在各 channel 的完成度(编辑器的「选版本」面板用)。
+ *
+ * 取代 v2 `ChannelController@progress`(`POST /v2/channel-progress`)。v2 那份逐个 channel 查句子(N+1);
+ * 这里固定 4 次查询:原文长度、有内容的 channel、channel 本身、各 channel 的已译句子。
+ *
+ * 列哪些 channel:这些句子上**有译文且看得见**的,加上**我能写的**(没译文也列,好让人挑一个开始写)。
+ * 给了 `studio` 就只列该 studio(本人或团队)名下的——团队空间传团队 uuid。
+ */
+class ChannelProgressService
+{
+    /** 一次最多查多少句(一章通常几百句) */
+    public const MAX_SENTENCES = 2000;
+
+    /** 原文所在的系统 channel(巴利三藏);自定义书(book ≥ 1000)的原文在 custom_books.channel_id */
+    private const PALI_CHANNEL = '_System_Pali_VRI_';
+
+    private const CUSTOM_BOOK_FROM = 1000;
+
+    public function __construct(private readonly ChannelAbilityService $abilities) {}
+
+    /**
+     * @param  list<string>  $sentences  `book-para-wordStart-wordEnd`,格式不对的忽略
+     * @return Collection<int, Channel> 每个 channel 挂好 abilities、final、content_created_at、content_updated_at
+     *
+     * @throws AuthorizationException 给了 studio,但不是本人也不是该团队成员
+     */
+    public function forSentences(array $sentences, ?string $viewerUid, ?string $studioUid): Collection
+    {
+        if ($studioUid !== null && ($viewerUid === null || ! $this->abilities->canListStudio($viewerUid, $studioUid))) {
+            throw new AuthorizationException(__('messages.channel_studio_forbidden'));
+        }
+
+        $coords = $this->parse($sentences);
+        if ($coords === []) {
+            return collect();
+        }
+        $lengths = $this->originalLengths($coords);
+        $keys = array_keys($coords);
+        $tuples = array_values($coords);
+
+        // 有内容的 channel(不分谁的,下面再套可见性)
+        $withContent = Sentence::query()
+            ->whereIns(['book_id', 'paragraph', 'word_start', 'word_end'], $tuples)
+            ->where('strlen', '>', 0)
+            ->distinct()
+            ->pluck('channel_uid')
+            ->all();
+
+        $query = Channel::query()
+            ->with([UserService::eagerLoadActor('owner')[0], 'ownerGroup:uid,name'])
+            ->where(function ($q) use ($withContent, $viewerUid) {
+                $q->where(function ($inner) use ($withContent, $viewerUid) {
+                    $inner->whereIn('uid', $withContent);
+                    $this->abilities->scopeListable($inner, $viewerUid);
+                });
+                if ($viewerUid !== null) {
+                    $q->orWhere(fn ($inner) => $this->abilities->scopeWritable($inner, $viewerUid));
+                }
+            })
+            ->when($studioUid, fn ($q, string $uid) => $q->where('owner_uid', $uid))
+            ->orderByDesc('updated_at')
+            ->orderBy('uid');
+        $channels = $query->get();
+        if ($channels->isEmpty()) {
+            return $channels;
+        }
+
+        // 各 channel 在这批句子上的已译行,一次取完
+        $done = [];
+        Sentence::query()
+            ->whereIns(['book_id', 'paragraph', 'word_start', 'word_end'], $tuples)
+            ->whereIn('channel_uid', $channels->pluck('uid')->all())
+            ->where('strlen', '>', 0)
+            ->get(['channel_uid', 'book_id', 'paragraph', 'word_start', 'word_end', 'created_at', 'updated_at'])
+            ->each(function (Sentence $row) use (&$done) {
+                $done[$row->channel_uid][] = $row;
+            });
+
+        $abilities = $this->abilities->abilitiesMany($channels, $viewerUid);
+        foreach ($channels as $channel) {
+            $rows = $done[$channel->uid] ?? [];
+            $translated = [];
+            foreach ($rows as $row) {
+                $translated["{$row->book_id}-{$row->paragraph}-{$row->word_start}-{$row->word_end}"] = true;
+            }
+            $channel->setAttribute('abilities', $abilities[$channel->uid]);
+            $channel->setAttribute('final', $rows === [] ? null : array_map(
+                fn (string $key) => [$lengths[$key] ?? 0, isset($translated[$key])],
+                $keys,
+            ));
+            $channel->setAttribute('content_created_at', $rows === [] ? null : collect($rows)->min('created_at'));
+            $channel->setAttribute('content_updated_at', $rows === [] ? null : collect($rows)->max('updated_at'));
+        }
+
+        return $channels;
+    }
+
+    /**
+     * 句子 id → [book, para, start, end],保持请求顺序、去重。
+     *
+     * @param  list<string>  $sentences
+     * @return array<string, array{0: int, 1: int, 2: int, 3: int}>
+     */
+    private function parse(array $sentences): array
+    {
+        $coords = [];
+        foreach ($sentences as $id) {
+            $parts = explode('-', (string) $id);
+            if (count($parts) !== 4 || array_filter($parts, fn ($p) => ! ctype_digit($p)) !== []) {
+                continue;
+            }
+            $coords[implode('-', array_map('intval', $parts))] = array_map('intval', $parts);
+        }
+
+        return $coords;
+    }
+
+    /**
+     * 每句原文的字符数(巴利三藏在系统原文 channel,自定义书在它自己的原文 channel)。
+     *
+     * @param  array<string, array{0: int, 1: int, 2: int, 3: int}>  $coords
+     * @return array<string, int>
+     */
+    private function originalLengths(array $coords): array
+    {
+        $pali = Channel::where('name', self::PALI_CHANNEL)
+            ->where('owner_uid', config('mint.admin.root_uuid'))
+            ->value('uid');
+        $customBooks = array_unique(array_filter(
+            array_map(fn (array $c) => $c[0], $coords),
+            fn (int $book) => $book >= self::CUSTOM_BOOK_FROM,
+        ));
+        $customChannels = $customBooks === []
+            ? []
+            : CustomBook::whereIn('book_id', $customBooks)->pluck('channel_id', 'book_id')->all();
+
+        $tuples = [];
+        foreach ($coords as $c) {
+            $channel = $c[0] >= self::CUSTOM_BOOK_FROM ? ($customChannels[$c[0]] ?? $pali) : $pali;
+            if ($channel) {
+                $tuples[] = [...$c, $channel];
+            }
+        }
+        if ($tuples === []) {
+            return [];
+        }
+
+        $lengths = [];
+        Sentence::query()
+            ->whereIns(['book_id', 'paragraph', 'word_start', 'word_end', 'channel_uid'], $tuples)
+            ->get(['book_id', 'paragraph', 'word_start', 'word_end', 'strlen'])
+            ->each(function (Sentence $row) use (&$lengths) {
+                $lengths["{$row->book_id}-{$row->paragraph}-{$row->word_start}-{$row->word_end}"] = (int) $row->strlen;
+            });
+
+        return $lengths;
+    }
+}

+ 302 - 0
api-v13/app/Services/V3/ChannelService.php

@@ -0,0 +1,302 @@
+<?php
+
+namespace App\Services\V3;
+
+use App\Exceptions\BusinessException;
+use App\Models\Channel;
+use App\Models\DhammaTerm;
+use App\Models\Sentence;
+use App\Models\WbwBlock;
+use App\Services\UserService;
+use Illuminate\Auth\Access\AuthorizationException;
+use Illuminate\Contracts\Pagination\LengthAwarePaginator;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Str;
+use Illuminate\Validation\ValidationException;
+
+/**
+ * channel 本身:公开目录、某个 studio 的工作区列表、我能写的、详情、建、改、删。
+ *
+ * 取代 v2 `ChannelController`(index 的 public / system / studio / studio-all / user-edit、
+ * show、store、update、patch、destroy、showMyNumber)。v2 那份原地保留不动(铁律 2),不共用代码。
+ * 权限一律经 {@see ChannelAbilityService};channels 表的写入只给人类({@see AgentGrantService::assertHuman()})。
+ *
+ * 列表行与详情都挂上 `abilities`(本人能做什么)、可选的 `progress`(带 book + para 时,该章的完成度),
+ * Resource 直接读,不查库。
+ */
+class ChannelService
+{
+    /** 列表可排序的字段;progress 只在带 book + para 时有意义 */
+    public const ORDERS = ['updated_at', 'created_at', 'name', 'progress'];
+
+    /** 列表要的列(不取 config 等大字段) */
+    private const COLUMNS = [
+        'channels.uid', 'channels.name', 'channels.summary', 'channels.type', 'channels.lang',
+        'channels.status', 'channels.is_system', 'channels.owner_uid', 'channels.source_type',
+        'channels.source_id', 'channels.created_at', 'channels.updated_at',
+    ];
+
+    public function __construct(
+        private readonly ChannelAbilityService $abilities,
+        private readonly AgentGrantService $agents,
+    ) {}
+
+    /**
+     * 公开目录:全网公开的 channel;`system=true` 只要系统 channel(不论 status)。
+     *
+     * @param  array{search?: string|null, type?: string, lang?: string, system?: bool, book?: int, para?: int, order?: string, dir?: string}  $filters
+     * @return LengthAwarePaginator<int, Channel>
+     */
+    public function listPublic(array $filters, ?string $viewerUid, int $perPage): LengthAwarePaginator
+    {
+        $query = $this->base($filters);
+        if (! empty($filters['system'])) {
+            // 系统 channel 不论 status 都列(巴利原文等是 status 10,按名字找它的调用方要能找到)
+            $query->where('channels.is_system', true);
+        } else {
+            $query->where('channels.status', '>=', Channel::STATUS_PUBLIC);
+        }
+
+        return $this->page($query, $filters, $viewerUid, $perPage);
+    }
+
+    /**
+     * 某个 studio(本人或团队)的工作区列表。
+     *
+     * `relation`:own 它名下的(默认),shared 直接共享给它的(**不含**经团队转来的——团队的东西在团队空间里看),
+     * all 两者合起来。`collaborator`:只看某个拥有者共享过来的。
+     *
+     * @param  array{relation?: string, collaborator?: string, search?: string|null, type?: string, lang?: string, book?: int, para?: int, order?: string, dir?: string}  $filters
+     * @return LengthAwarePaginator<int, Channel>
+     *
+     * @throws AuthorizationException 不是本人,也不是该团队成员
+     */
+    public function listForStudio(string $studioUid, string $viewerUid, array $filters, int $perPage): LengthAwarePaginator
+    {
+        if (! $this->abilities->canListStudio($viewerUid, $studioUid)) {
+            throw new AuthorizationException(__('messages.channel_studio_forbidden'));
+        }
+
+        $relation = $filters['relation'] ?? 'own';
+        $shared = $relation === 'own' ? [] : $this->abilities->sharedTo($studioUid);
+        $query = $this->base($filters)->where(function (Builder $q) use ($relation, $studioUid, $shared) {
+            if ($relation !== 'shared') {
+                $q->orWhere('channels.owner_uid', $studioUid);
+            }
+            if ($relation !== 'own') {
+                $q->orWhereIn('channels.uid', $shared);
+            }
+        });
+        if ($relation === 'shared') {
+            $query->where('channels.owner_uid', '<>', $studioUid);
+        }
+        if (! empty($filters['collaborator'])) {
+            $query->where('channels.owner_uid', $filters['collaborator']);
+        }
+
+        return $this->page($query, $filters, $viewerUid, $perPage);
+    }
+
+    /**
+     * 我能写内容的 channel,跨 studio(本人的、团队的、共享的)。写入前挑 channel 用。
+     *
+     * @param  array{search?: string|null, type?: string, lang?: string, book?: int, para?: int, order?: string, dir?: string}  $filters
+     * @return LengthAwarePaginator<int, Channel>
+     */
+    public function listWritable(string $viewerUid, array $filters, int $perPage): LengthAwarePaginator
+    {
+        $query = $this->base($filters);
+        $this->abilities->scopeWritable($query, $viewerUid);
+
+        return $this->page($query, $filters, $viewerUid, $perPage);
+    }
+
+    /**
+     * 详情:看不见就 403。
+     *
+     * @throws AuthorizationException
+     */
+    public function show(Channel $channel, ?string $viewerUid): Channel
+    {
+        $abilities = $this->abilities->abilities($channel, $viewerUid);
+        if (! $abilities['read']) {
+            throw new AuthorizationException(__('messages.channel_forbidden'));
+        }
+
+        return $this->decorate($channel, $abilities);
+    }
+
+    /**
+     * 在 studio(本人或团队)名下建 channel。同一 studio 里不能重名。
+     *
+     * @param  array{name: string, type: string, lang: string, summary?: string|null, status?: int, source_type?: string|null, source_id?: string|null}  $data
+     *
+     * @throws AuthorizationException 不能在这个 studio 名下建,或是 AI 模型
+     * @throws ValidationException 重名
+     */
+    public function create(string $studioUid, string $actorUid, int $actorId, array $data): Channel
+    {
+        $this->agents->assertHuman($actorUid);
+        if (! $this->abilities->canCreateIn($actorUid, $studioUid)) {
+            throw new AuthorizationException(__('messages.channel_studio_forbidden'));
+        }
+        $this->guardUniqueName($studioUid, $data['name']);
+
+        $now = time() * 1000;
+        $channel = new Channel;
+        $channel->forceFill($data + [
+            'id' => app('snowflake')->id(),
+            'uid' => (string) Str::uuid(),
+            'owner_uid' => $studioUid,
+            'editor_id' => $actorId,
+            'status' => Channel::STATUS_PRIVATE,
+            'create_time' => $now,
+            'modify_time' => $now,
+        ])->save();
+
+        // refresh 而不是 fresh:要保留 wasRecentlyCreated,Laravel 才会回 201
+        return $this->decorate($channel->refresh(), $this->abilities->abilities($channel, $actorUid));
+    }
+
+    /**
+     * 改信息(只改传了的字段)。改名时同一 studio 里不能重名。
+     *
+     * @param  array{name?: string, type?: string, lang?: string, summary?: string|null, status?: int, source_type?: string|null, source_id?: string|null, config?: string|null}  $data
+     *
+     * @throws AuthorizationException
+     * @throws ValidationException
+     */
+    public function update(Channel $channel, string $actorUid, array $data): Channel
+    {
+        $this->agents->assertHuman($actorUid);
+        $abilities = $this->abilities->abilities($channel, $actorUid);
+        if (! $abilities['update']) {
+            throw new AuthorizationException(__('messages.channel_forbidden'));
+        }
+        if (isset($data['name']) && $data['name'] !== $channel->name) {
+            $this->guardUniqueName($channel->owner_uid, $data['name'], $channel->uid);
+        }
+
+        if (array_key_exists('config', $data)) {
+            // json 列,模型上没有 cast(加 cast 会改变 v2 读到的类型),这里自己编码
+            $data['config'] = $data['config'] === null ? null : json_encode($data['config'], JSON_UNESCAPED_UNICODE);
+        }
+        $channel->forceFill($data + ['modify_time' => time() * 1000])->save();
+
+        return $this->decorate($channel->fresh(), $abilities);
+    }
+
+    /**
+     * 软删除。channel 下已有译文、术语或逐词时拒绝(与 v2 同口径)。返回被删的 channel(AIP-164)。
+     *
+     * @throws AuthorizationException
+     * @throws BusinessException 下面还有内容(409)
+     */
+    public function delete(Channel $channel, string $actorUid): Channel
+    {
+        $this->agents->assertHuman($actorUid);
+        $abilities = $this->abilities->abilities($channel, $actorUid);
+        if (! $abilities['delete']) {
+            throw new AuthorizationException(__('messages.channel_forbidden'));
+        }
+
+        $content = array_filter([
+            'sentence' => Sentence::where('channel_uid', $channel->uid)->exists(),
+            'term' => DhammaTerm::where('channal', $channel->uid)->exists(),
+            'wbw' => WbwBlock::where('channel_uid', $channel->uid)->exists(),
+        ]);
+        if ($content !== []) {
+            throw new BusinessException(
+                __('messages.channel_has_content'),
+                409,
+                'channel-has-content',
+                ['content' => array_keys($content)],
+            );
+        }
+
+        DB::transaction(fn () => $channel->delete());
+
+        return $this->decorate($channel, $abilities);
+    }
+
+    /**
+     * 所有列表共用的查询:列、拥有者预加载、筛选、可选的章节进度。
+     *
+     * @param  array<string, mixed>  $filters
+     * @return Builder<Channel>
+     */
+    private function base(array $filters): Builder
+    {
+        $query = Channel::query()
+            ->select(self::COLUMNS)
+            ->with([UserService::eagerLoadActor('owner')[0], 'ownerGroup:uid,name'])
+            ->when($filters['search'] ?? null, fn (Builder $q, string $v) => $q->where('channels.name', 'ilike', '%'.$v.'%'))
+            ->when($filters['type'] ?? null, fn (Builder $q, string $v) => $q->where('channels.type', $v))
+            ->when($filters['lang'] ?? null, fn (Builder $q, string $v) => $q->where('channels.lang', $v));
+
+        if (isset($filters['book'], $filters['para'])) {
+            $query->addSelect('progress_chapters.progress')
+                ->leftJoin('progress_chapters', function ($join) use ($filters) {
+                    $join->on('progress_chapters.channel_id', '=', 'channels.uid')
+                        ->where('progress_chapters.book', $filters['book'])
+                        ->where('progress_chapters.para', $filters['para']);
+                });
+        }
+
+        return $query;
+    }
+
+    /**
+     * 排序、分页,整页挂上 abilities。
+     *
+     * @param  Builder<Channel>  $query
+     * @param  array<string, mixed>  $filters
+     * @return LengthAwarePaginator<int, Channel>
+     */
+    private function page(Builder $query, array $filters, ?string $viewerUid, int $perPage): LengthAwarePaginator
+    {
+        $order = $filters['order'] ?? 'updated_at';
+        if (! in_array($order, self::ORDERS, true) || ($order === 'progress' && ! isset($filters['book'], $filters['para']))) {
+            $order = 'updated_at';
+        }
+        $column = $order === 'progress' ? 'progress_chapters.progress' : "channels.{$order}";
+        $dir = ($filters['dir'] ?? 'desc') === 'asc' ? 'asc' : 'desc';
+
+        $page = $query->orderByRaw("{$column} {$dir} nulls last")
+            ->orderBy('channels.uid')
+            ->paginate($perPage);
+
+        $abilities = $this->abilities->abilitiesMany($page->getCollection(), $viewerUid);
+        foreach ($page->getCollection() as $channel) {
+            $this->decorate($channel, $abilities[$channel->uid]);
+        }
+
+        return $page;
+    }
+
+    /**
+     * @param  array{read: bool, write: bool, update: bool, delete: bool}  $abilities
+     */
+    private function decorate(Channel $channel, array $abilities): Channel
+    {
+        $channel->loadMissing([UserService::eagerLoadActor('owner')[0], 'ownerGroup:uid,name']);
+        $channel->setAttribute('abilities', $abilities);
+
+        return $channel;
+    }
+
+    /**
+     * @throws ValidationException
+     */
+    private function guardUniqueName(string $studioUid, string $name, ?string $exceptUid = null): void
+    {
+        $exists = Channel::where('owner_uid', $studioUid)
+            ->where('name', $name)
+            ->when($exceptUid, fn (Builder $q, string $uid) => $q->where('uid', '<>', $uid))
+            ->exists();
+        if ($exists) {
+            throw ValidationException::withMessages(['name' => __('messages.channel_name_exists')]);
+        }
+    }
+}

+ 6 - 1
api-v13/app/Services/V3/GroupService.php

@@ -64,7 +64,10 @@ class GroupService
         'sent_block' => [SentBlock::class, 'owner_uid'],
     ];
 
-    public function __construct(private readonly GroupAbilityService $abilities) {}
+    public function __construct(
+        private readonly GroupAbilityService $abilities,
+        private readonly AgentGrantService $agents,
+    ) {}
 
     /**
      * 按名字搜公开团队(共享资源时挑团队用)。私有团队不出现。
@@ -105,6 +108,8 @@ class GroupService
      */
     public function create(string $userUid, array $data): GroupInfo
     {
+        // 团队是权限本身,不支持 AI 模型代建(模型从来不是任何团队的成员,改、删本来就过不了)
+        $this->agents->assertHuman($userUid);
         $this->guardUniqueName($userUid, $data['name']);
 
         $group = DB::transaction(function () use ($userUid, $data) {

+ 98 - 0
api-v13/app/Services/V3/TipitakaChannelService.php

@@ -0,0 +1,98 @@
+<?php
+
+namespace App\Services\V3;
+
+use App\Models\Channel;
+use App\Models\ProgressChapter;
+use App\Models\Sentence;
+use App\Services\UserService;
+use Illuminate\Contracts\Pagination\LengthAwarePaginator;
+use Illuminate\Database\Eloquent\Builder;
+
+/**
+ * 阅读领域的 channel 查询:某段有内容的 channel、有译文的公开 channel 目录。
+ *
+ * - {@see self::forParagraph()} 取代 v2 `GET /v2/channel?view=paragraphs`(`ChannelController@index`)
+ * - {@see self::withChapters()} 取代 v2 `GET /v2/progress?view=channel`(`ProgressChapterController@index`)
+ *
+ * v2 那两份原地保留不动(铁律 2)。可见性一律经 {@see ChannelAbilityService::scopeListable()}
+ * (v2 的 paragraphs 不判断可见性,私有 channel 也列)。
+ */
+class TipitakaChannelService
+{
+    /** 「有译文」的完成度门槛,沿用 v2 `progress?view=channel` 的默认值 */
+    public const MIN_PROGRESS = 0.8;
+
+    public function __construct(private readonly ChannelAbilityService $abilities) {}
+
+    /**
+     * 某段有内容的 channel(看得见的),最近更新的在前。
+     *
+     * @return LengthAwarePaginator<int, Channel>
+     */
+    public function forParagraph(int $book, int $para, ?string $viewerUid, int $perPage): LengthAwarePaginator
+    {
+        $query = $this->base()->whereIn(
+            'channels.uid',
+            Sentence::query()->where('book_id', $book)->where('paragraph', $para)->select('channel_uid')
+        );
+        $this->abilities->scopeListable($query, $viewerUid);
+
+        return $this->page($query->orderByDesc('channels.updated_at')->orderBy('channels.uid'), $viewerUid, $perPage);
+    }
+
+    /**
+     * 有已译章节的公开 channel,按章节数降序。`lang` 按 progress_chapters.lang(本来就是语族粒度,
+     * zh 涵盖简繁)。每条挂 `chapter_count`。
+     *
+     * @param  array{type?: string, lang?: string, min_progress?: float}  $filters
+     * @return LengthAwarePaginator<int, Channel>
+     */
+    public function withChapters(array $filters, ?string $viewerUid, int $perPage): LengthAwarePaginator
+    {
+        $counts = ProgressChapter::query()
+            ->selectRaw('channel_id, count(*) as chapter_count')
+            ->where('progress', '>', $filters['min_progress'] ?? self::MIN_PROGRESS)
+            ->when($filters['lang'] ?? null, fn (Builder $q, string $v) => $q->where('lang', $v))
+            ->groupBy('channel_id');
+
+        $query = $this->base()
+            ->addSelect('chapters.chapter_count')
+            ->joinSub($counts, 'chapters', 'chapters.channel_id', '=', 'channels.uid')
+            ->where('channels.status', '>=', Channel::STATUS_PUBLIC)
+            ->when($filters['type'] ?? null, fn (Builder $q, string $v) => $q->where('channels.type', $v))
+            ->orderByDesc('chapters.chapter_count')
+            ->orderBy('channels.uid');
+
+        return $this->page($query, $viewerUid, $perPage);
+    }
+
+    /**
+     * @return Builder<Channel>
+     */
+    private function base(): Builder
+    {
+        return Channel::query()
+            ->select([
+                'channels.uid', 'channels.name', 'channels.summary', 'channels.type', 'channels.lang',
+                'channels.status', 'channels.is_system', 'channels.owner_uid', 'channels.source_type',
+                'channels.source_id', 'channels.created_at', 'channels.updated_at',
+            ])
+            ->with([UserService::eagerLoadActor('owner')[0], 'ownerGroup:uid,name']);
+    }
+
+    /**
+     * @param  Builder<Channel>  $query
+     * @return LengthAwarePaginator<int, Channel>
+     */
+    private function page(Builder $query, ?string $viewerUid, int $perPage): LengthAwarePaginator
+    {
+        $page = $query->paginate($perPage);
+        $abilities = $this->abilities->abilitiesMany($page->getCollection(), $viewerUid);
+        foreach ($page->getCollection() as $channel) {
+            $channel->setAttribute('abilities', $abilities[$channel->uid]);
+        }
+
+        return $page;
+    }
+}

+ 12 - 38
api-v13/app/Services/V3/TipitakaChapterChannelService.php

@@ -4,15 +4,12 @@ namespace App\Services\V3;
 
 use App\Facades\RedisCache;
 use App\Models\GroupInfo;
-use App\Models\GroupMember;
 use App\Models\ProgressChapter;
-use App\Models\Share;
 use App\Models\View;
 use App\Services\UserService;
 use Illuminate\Contracts\Pagination\LengthAwarePaginator;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Support\Collection;
-use Illuminate\Support\Str;
 
 /**
  * 某一章有哪些 channel(译本 / 逐词 / 原文……)及各自的完成度。
@@ -21,19 +18,16 @@ use Illuminate\Support\Str;
  * 原样保留、不共用(CLAUDE.md 铁律 2)。v3 端点用 {@see self::list()},Laravel library 的
  * 作品版本页用 {@see self::all()}(经 `TipitakaCatalogService::workChannels()`)。与 v2 的差别:
  *
- * - **只列看得见的 channel**:公开的(status=30),加上登录用户自己的、共享给他(或他所在
- *   群组)的。v2 不判断可见性,私有 channel 的名字与进度对所有人可见。
+ * - **只列看得见的 channel**:判定见 {@see ChannelAbilityService::scopeListable()}(公开的,加上登录用户
+ *   自己的、所在团队名下的、共享给他或他所在团队的)。v2 不判断可见性,私有 channel 的名字与进度对所有人可见。
  * - 不再返回 likes(前端没用);views、studio 改成整页批量取,查询数与行数无关。
  */
 class TipitakaChapterChannelService
 {
-    /** channels.status:全网公开 */
-    private const STATUS_PUBLIC = 30;
-
-    /** shares.res_type:channel */
-    private const SHARE_CHANNEL = 2;
-
-    public function __construct(private readonly UserService $users) {}
+    public function __construct(
+        private readonly UserService $users,
+        private readonly ChannelAbilityService $abilities,
+    ) {}
 
     /**
      * 列出一章的 channel,按完成度从高到低(分页,给 v3 端点)。
@@ -92,7 +86,12 @@ class TipitakaChapterChannelService
             ->join('channels', 'progress_chapters.channel_id', '=', 'channels.uid')
             ->where('progress_chapters.book', $book)
             ->where('progress_chapters.para', $para)
-            ->where(fn (Builder $q) => $this->readableBy($q, $viewerUid))
+            // 软删的 channel 不列(join 绕过了模型的软删作用域)
+            ->whereNull('channels.deleted_at')
+            // 版本列表不列系统 channel(巴利原文、系统逐词,每章都有):它们对谁都可读,
+            // 不排除的话每章都会多出这两行;与 2026-11 迁移后 v3 一直以来的输出保持一致
+            ->where('channels.is_system', false)
+            ->where(fn (Builder $q) => $this->abilities->scopeListable($q, $viewerUid))
             ->orderByDesc('progress_chapters.progress')
             // 完成度相同时要稳定的 tiebreaker,否则跨页会漂移
             ->orderBy('progress_chapters.channel_id');
@@ -117,31 +116,6 @@ class TipitakaChapterChannelService
         }
     }
 
-    /**
-     * 可见性:公开的,或(登录时)自己的、共享给自己或自己所在群组的。
-     */
-    private function readableBy(Builder $query, ?string $viewerUid): void
-    {
-        $query->where('channels.status', self::STATUS_PUBLIC);
-        if ($viewerUid === null) {
-            return;
-        }
-
-        $query->orWhere('channels.owner_uid', $viewerUid);
-
-        $cooperators = GroupMember::where('user_id', $viewerUid)->pluck('group_id')->push($viewerUid);
-        $shared = Share::whereIn('cooperator_id', $cooperators)
-            ->where('res_type', self::SHARE_CHANNEL)
-            ->pluck('res_id')
-            // shares.res_id 是 varchar,channels.uid 是 uuid;非法值进了 where 会让 pgsql 报错
-            ->filter(fn ($id) => Str::isUuid($id))
-            ->unique()
-            ->values();
-        if ($shared->isNotEmpty()) {
-            $query->orWhereIn('channels.uid', $shared);
-        }
-    }
-
     /**
      * 每个章节进度行被浏览的次数(views 表一行一次)。
      *

+ 5 - 0
api-v13/resources/lang/en/messages.php

@@ -61,4 +61,9 @@ return [
     'group_has_resources' => 'The team still owns resources. Transfer or delete them before deleting the team.',
     'group_name_exists' => 'You already have a team with this name.',
     'group_share_not_found' => 'This resource is not shared with this team.',
+    'agent_not_allowed' => 'AI models cannot perform this action. Please use a human account.',
+    'channel_forbidden' => 'You are not allowed to do this.',
+    'channel_studio_forbidden' => 'You cannot view or manage the channels of this studio (team).',
+    'channel_name_exists' => 'A channel with this name already exists in this studio (team).',
+    'channel_has_content' => 'The channel already has translations, terms or word-by-word data and cannot be deleted.',
 ];

+ 5 - 0
api-v13/resources/lang/zh-Hans/messages.php

@@ -61,4 +61,9 @@ return [
     'group_has_resources' => '团队名下还有资源,请先转让或删除它们再删除团队。',
     'group_name_exists' => '你名下已经有同名的团队了。',
     'group_share_not_found' => '这项资源没有共享给这个团队。',
+    'agent_not_allowed' => 'AI 模型不能执行这个操作,请用人类账号。',
+    'channel_forbidden' => '你没有权限执行这个操作。',
+    'channel_studio_forbidden' => '你不能查看或管理这个工作室(团队)的版本。',
+    'channel_name_exists' => '这个工作室(团队)里已经有同名的版本了。',
+    'channel_has_content' => '版本里已经有译文、术语或逐词解析,不能删除。',
 ];

+ 34 - 4
api-v13/routes/v3/channel.php

@@ -2,18 +2,48 @@
 
 /*
 |--------------------------------------------------------------------------
-| v3 · channel —— 译本与翻译进度
+| v3 · channel —— 译文集(界面叫「版本风格」)与翻译进度
 |--------------------------------------------------------------------------
 |
 | 由 routes/api.php 的 v3 组 require 进来,前缀已在那边加好。
 |
-| channel 本身还没迁(见 CLAUDE.md 的 v3 重构一节),这里先只有 progress。
+| 阅读领域的 channel 查询(某章 / 某段有哪些 channel、有译文的 channel 目录)在 tipitaka.php。
 |
 */
 
+use App\Http\Controllers\V3\ChannelBatchProgressController;
+use App\Http\Controllers\V3\ChannelController;
+use App\Http\Controllers\V3\EditableChannelController;
 use App\Http\Controllers\V3\ProgressController;
+use App\Http\Controllers\V3\StudioChannelController;
 use Illuminate\Support\Facades\Route;
 
-// FIXME: ProgressController@index 还带着 switch($request->input('view')),
-// 不符合 v3 规范(v3 端点不准有 view 开关)。迁 channel 时一并处理。
 Route::apiResource('progress', ProgressController::class)->only(['index']);
+
+// 字面量段必须注册在 apiResource 之前,否则 {channel} 会把它们当成 uuid 吃掉
+Route::get('channels/editable', EditableChannelController::class)
+    ->name('channels.editable')
+    ->middleware('auth.v3');
+// 一批句子在各 channel 的完成度。POST:一章几百个句子 id 放不进查询串
+Route::post('channels/batch-progress', ChannelBatchProgressController::class)
+    ->name('channels.batch-progress');
+
+// 读公开(可选登录),写要登录。只注册 PATCH,不注册 PUT(v3-resource skill 硬规范第 10 条)
+Route::apiResource('channels', ChannelController::class)
+    ->only(['index', 'show', 'destroy'])
+    ->middlewareFor(['destroy'], 'auth.v3')
+    ->whereUuid('channel');
+Route::patch('channels/{channel}', [ChannelController::class, 'update'])
+    ->name('channels.update')
+    ->middleware('auth.v3')
+    ->whereUuid('channel');
+
+// 某个 studio(用户或团队,一律 uuid)的工作区列表与新建
+Route::get('studios/{studio}/channels', [StudioChannelController::class, 'index'])
+    ->name('studios.channels.index')
+    ->middleware('auth.v3')
+    ->whereUuid('studio');
+Route::post('studios/{studio}/channels', [StudioChannelController::class, 'store'])
+    ->name('studios.channels.store')
+    ->middleware('auth.v3')
+    ->whereUuid('studio');

+ 11 - 0
api-v13/routes/v3/tipitaka.php

@@ -18,9 +18,11 @@
 |
 */
 
+use App\Http\Controllers\V3\TipitakaChannelController;
 use App\Http\Controllers\V3\TipitakaChapterChannelController;
 use App\Http\Controllers\V3\TipitakaChapterController;
 use App\Http\Controllers\V3\TipitakaDiscussionController;
+use App\Http\Controllers\V3\TipitakaParagraphChannelController;
 use App\Http\Controllers\V3\TipitakaReadingController;
 use App\Http\Controllers\V3\TipitakaRelatedParagraphAggregateController;
 use App\Http\Controllers\V3\TipitakaRelatedParagraphController;
@@ -41,6 +43,15 @@ Route::get('tipitaka-chapter-channels/{book}/{para}', TipitakaChapterChannelCont
     ->whereNumber(['book', 'para']);
 
 // 章节标题:按名字找章节(容错),或列出一本书的全部标题(原 v2 search-title-index)。q / book 至少给一个,都是过滤条件。
+// 某段有内容的 channel(取代 v2 channel?view=paragraphs)
+Route::get('tipitaka-paragraph-channels/{book}/{para}', TipitakaParagraphChannelController::class)
+    ->name('tipitaka-paragraph-channels.index')
+    ->whereNumber(['book', 'para']);
+
+// 有译文的公开 channel 目录(取代 v2 progress?view=channel)
+Route::get('tipitaka-channels', TipitakaChannelController::class)
+    ->name('tipitaka-channels.index');
+
 Route::get('tipitaka-chapters', TipitakaChapterController::class)
     ->name('tipitaka-chapters.index');
 

+ 105 - 0
api-v13/tests/Feature/ChannelBatchProgressV3Test.php

@@ -0,0 +1,105 @@
+<?php
+
+use App\Models\Channel;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Str;
+
+uses(RefreshDatabase::class);
+
+/**
+ * POST /api/v3/channels/batch-progress:一批句子在各 channel 的完成度(取代 v2 channel-progress)。
+ *
+ * 这里断言的是形状而非契约(spectator 未安装,见 v3-resource skill 第 3 步)。
+ */
+function paliOriginal(): string
+{
+    config(['mint.admin.root_uuid' => config('mint.admin.root_uuid') ?: (string) Str::uuid()]);
+    $root = config('mint.admin.root_uuid');
+    $existing = Channel::where('name', '_System_Pali_VRI_')->where('owner_uid', $root)->value('uid');
+
+    return $existing ?? makeChannel($root, '_System_Pali_VRI_');
+}
+
+it('reports per-sentence progress for visible channels with content plus my writable ones', function () {
+    $pali = paliOriginal();
+    makeSentence($pali, 1, 2, 1, str_repeat('a', 10));
+    makeSentence($pali, 1, 2, 5, str_repeat('b', 20));
+
+    $me = makeStudio('me');
+    $public = makeChannel(makeStudio('a'), 'public translation');
+    makeSentence($public, 1, 2, 1, 'done');
+    $privateOther = makeChannel(makeStudio('b'), 'private other');
+    Channel::where('uid', $privateOther)->update(['status' => Channel::STATUS_PRIVATE]);
+    makeSentence($privateOther, 1, 2, 1, 'secret');
+    $myEmpty = makeChannel($me, 'my empty');
+    Channel::where('uid', $myEmpty)->update(['status' => Channel::STATUS_PRIVATE]);
+
+    $data = collect($this->postJson('/api/v3/channels/batch-progress', [
+        'sentences' => ['1-2-1-1', '1-2-5-5'],
+    ], authHeader($me))->assertOk()->json('data'))->keyBy('id');
+
+    // 原文 channel 自己也有内容且公开,所以也会出现;这里只看关心的几个
+    expect($data->has($privateOther))->toBeFalse();
+    expect($data[$public]['final'])->toBe([[10, true], [20, false]]);
+    expect($data[$public]['abilities']['write'])->toBeFalse();
+    expect($data[$public]['content_created_at'])->not->toBeNull();
+    expect($data[$myEmpty]['final'])->toBeNull();
+    expect($data[$myEmpty]['abilities']['write'])->toBeTrue();
+});
+
+it('only lists a studio\'s channels when studio is given', function () {
+    paliOriginal();
+    [$team, $users] = makeTeam();
+    $teamChannel = makeChannel($team, 'team channel');
+    makeSentence($teamChannel, 1, 2, 1, 'x');
+    $other = makeChannel(makeStudio('a'), 'other');
+    makeSentence($other, 1, 2, 1, 'y');
+
+    $ids = array_column($this->postJson('/api/v3/channels/batch-progress', [
+        'sentences' => ['1-2-1-1'], 'studio' => $team,
+    ], authHeader($users['reader']))->assertOk()->json('data'), 'id');
+
+    expect($ids)->toBe([$teamChannel]);
+
+    $this->postJson('/api/v3/channels/batch-progress', ['sentences' => ['1-2-1-1'], 'studio' => $team], authHeader($users['outsider']))
+        ->assertForbidden();
+});
+
+it('works without login, public channels only', function () {
+    paliOriginal();
+    $public = makeChannel(makeStudio('a'), 'public');
+    makeSentence($public, 1, 2, 1, 'x');
+
+    expect(array_column($this->postJson('/api/v3/channels/batch-progress', ['sentences' => ['1-2-1-1']])->assertOk()->json('data'), 'id'))
+        ->toContain($public);
+});
+
+it('validates the sentence list', function (array $payload, string $field) {
+    $this->postJson('/api/v3/channels/batch-progress', $payload)
+        ->assertUnprocessable()
+        ->assertJsonValidationErrors($field);
+})->with([
+    'missing' => [[], 'sentences'],
+    'bad id' => [['sentences' => ['1-2-3']], 'sentences.0'],
+    'too many' => [['sentences' => array_fill(0, 2001, '1-1-1-1')], 'sentences'],
+]);
+
+it('keeps a fixed number of queries regardless of channel count', function () {
+    paliOriginal();
+    $me = makeStudio('me');
+    $countQueriesFor = function (int $extra) use ($me): int {
+        for ($i = 0; $i < $extra; $i++) {
+            makeSentence(makeChannel(makeStudio('o-'.Str::random(8))), 3, 3, 1, 'x');
+        }
+        DB::flushQueryLog();
+        DB::enableQueryLog();
+        $this->postJson('/api/v3/channels/batch-progress', ['sentences' => ['3-3-1-1']], authHeader($me))->assertOk();
+        $count = count(DB::getQueryLog());
+        DB::disableQueryLog();
+
+        return $count;
+    };
+
+    expect($countQueriesFor(6))->toBe($countQueriesFor(1));
+});

+ 100 - 0
api-v13/tests/Feature/ChannelContentAccessV3Test.php

@@ -0,0 +1,100 @@
+<?php
+
+use App\Models\Channel;
+use App\Services\OpenSearchService;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Str;
+
+uses(RefreshDatabase::class);
+
+/**
+ * 按 channel 取正文的两个 v3 接口要判 channel 的读权限:
+ *   GET /api/v3/tipitaka-reading/{channel}
+ *   GET /api/v3/search/{id}(整章正文文档 tipitaka_chapter_{book}-{para}_{channel})
+ *
+ * 私有 channel 只有拥有者、团队成员、被共享的人能读;公开与「公开不列出」谁都能读。
+ * 这里断言的是形状而非契约(spectator 未安装,见 v3-resource skill 第 3 步)。
+ */
+function contentChannel(string $ownerUid, int $status): string
+{
+    $uid = makeChannel($ownerUid, 'content '.Str::random(6));
+    Channel::where('uid', $uid)->update(['status' => $status]);
+
+    return $uid;
+}
+
+/** 让 search/{id} 不真的去连 OpenSearch:被放行时返回一条最小文档 */
+function fakeSearchDocument(): void
+{
+    test()->mock(OpenSearchService::class)
+        ->shouldReceive('get')
+        ->andReturn(['_id' => 'doc', '_source' => [
+            'id' => 'doc', 'resource_id' => 'res', 'resource_type' => 'chapter', 'language' => 'zh',
+            'updated_at' => '2026-01-01T00:00:00Z',
+            'title' => ['text' => ['zh' => '标题']], 'content' => ['text' => ['zh' => '正文']],
+        ]]);
+}
+
+/* ---------------- tipitaka-reading ---------------- */
+
+it('reads a private channel only with access', function (string $who, int $status) {
+    [$team, $users] = makeTeam();
+    $channel = contentChannel($team, Channel::STATUS_PRIVATE);
+    $headers = $who === 'anonymous' ? [] : authHeader($users[$who]);
+
+    $this->getJson("/api/v3/tipitaka-reading/{$channel}", $headers)->assertStatus($status);
+})->with([
+    'anonymous' => ['anonymous', 403],
+    'outsider' => ['outsider', 403],
+    'team reader' => ['reader', 200],
+    'team owner' => ['owner', 200],
+]);
+
+it('reads a private channel shared with me', function () {
+    $me = makeStudio('me');
+    $channel = contentChannel(makeStudio('author'), Channel::STATUS_PRIVATE);
+    grantChannelShare($channel, $me, 10);
+
+    $this->getJson("/api/v3/tipitaka-reading/{$channel}", authHeader($me))->assertOk();
+});
+
+it('reads public and unlisted channels without login', function (int $status) {
+    $channel = contentChannel(makeStudio('author'), $status);
+
+    $this->getJson("/api/v3/tipitaka-reading/{$channel}")->assertOk();
+})->with(['public' => [Channel::STATUS_PUBLIC], 'unlisted' => [Channel::STATUS_UNLISTED]]);
+
+it('returns 404 for an unknown or deleted channel', function () {
+    $this->getJson('/api/v3/tipitaka-reading/'.Str::uuid())->assertNotFound();
+
+    $owner = makeStudio('owner');
+    $channel = contentChannel($owner, Channel::STATUS_PUBLIC);
+    Channel::where('uid', $channel)->first()->delete();
+    $this->getJson("/api/v3/tipitaka-reading/{$channel}")->assertNotFound();
+});
+
+/* ---------------- search/{id} 的整章正文 ---------------- */
+
+it('guards whole-chapter search documents by their channel', function () {
+    fakeSearchDocument();
+    [$team, $users] = makeTeam();
+    $private = contentChannel($team, Channel::STATUS_PRIVATE);
+    $doc = "tipitaka_chapter_1-2_{$private}";
+
+    $this->getJson("/api/v3/search/{$doc}")->assertForbidden();
+    $this->getJson("/api/v3/search/{$doc}", authHeader($users['outsider']))->assertForbidden();
+    $this->getJson("/api/v3/search/{$doc}", authHeader($users['reader']))->assertOk();
+});
+
+it('serves whole-chapter documents of public and unlisted channels to anyone', function (int $status) {
+    fakeSearchDocument();
+    $channel = contentChannel(makeStudio('author'), $status);
+
+    $this->getJson("/api/v3/search/tipitaka_chapter_1-2_{$channel}")->assertOk();
+})->with(['public' => [Channel::STATUS_PUBLIC], 'unlisted' => [Channel::STATUS_UNLISTED]]);
+
+it('leaves other search documents alone', function () {
+    fakeSearchDocument();
+
+    $this->getJson('/api/v3/search/term_'.Str::uuid())->assertOk();
+});

+ 422 - 0
api-v13/tests/Feature/ChannelV3Test.php

@@ -0,0 +1,422 @@
+<?php
+
+use App\Models\Channel;
+use App\Models\ProgressChapter;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Str;
+
+uses(RefreshDatabase::class);
+
+/**
+ * v3 channel:公开目录、studio 列表、我能写的、详情、建、改、删。
+ *
+ * 端点:
+ *   GET    /api/v3/channels                       公开目录(可不登录;system=true 只要系统 channel)
+ *   GET    /api/v3/channels/editable              我能写的(登录)
+ *   GET    /api/v3/channels/{channel}             详情(公开谁都能看;私有看权限)
+ *   PATCH  /api/v3/channels/{channel}             改信息
+ *   DELETE /api/v3/channels/{channel}             软删(有内容 409)
+ *   GET    /api/v3/studios/{studio}/channels      studio(本人或团队)的工作区列表
+ *   POST   /api/v3/studios/{studio}/channels      在 studio 名下建
+ *
+ * 这里断言的是形状而非契约(spectator 未安装,见 v3-resource skill 第 3 步)。
+ */
+function privateChannel(string $ownerUid, string $name = 'private channel'): string
+{
+    $uid = makeChannel($ownerUid, $name);
+    Channel::where('uid', $uid)->update(['status' => Channel::STATUS_PRIVATE]);
+
+    return $uid;
+}
+
+function channelIds(array $data): array
+{
+    return array_column($data, 'id');
+}
+
+/* ---------------- 详情与权限矩阵 ---------------- */
+
+it('shows public channels to anyone and hides private ones', function () {
+    $owner = makeStudio('owner');
+    $public = makeChannel($owner, 'pub');
+    $private = privateChannel($owner);
+
+    $this->getJson("/api/v3/channels/{$public}")
+        ->assertOk()
+        ->assertJsonPath('data.id', $public)
+        ->assertJsonPath('data.owner.kind', 'user')
+        ->assertJsonPath('data.owner.id', $owner)
+        ->assertJsonPath('data.abilities', ['read' => true, 'write' => false, 'update' => false, 'delete' => false]);
+
+    $this->getJson("/api/v3/channels/{$private}")->assertForbidden();
+    $this->getJson("/api/v3/channels/{$private}", authHeader(makeStudio('stranger')))->assertForbidden();
+    $this->getJson("/api/v3/channels/{$private}", authHeader($owner))
+        ->assertOk()
+        ->assertJsonPath('data.abilities', ['read' => true, 'write' => true, 'update' => true, 'delete' => true]);
+});
+
+it('derives abilities on a team channel from the team role', function (string $role, array $abilities) {
+    [$team, $users] = makeTeam();
+    $channel = privateChannel($team, 'team channel');
+
+    $response = $this->getJson("/api/v3/channels/{$channel}", authHeader($users[$role]));
+    if ($abilities === []) {
+        $response->assertForbidden();
+
+        return;
+    }
+    $response->assertOk()
+        ->assertJsonPath('data.owner.kind', 'team')
+        ->assertJsonPath('data.owner.id', $team)
+        ->assertJsonPath('data.abilities', $abilities);
+})->with([
+    'owner' => ['owner', ['read' => true, 'write' => true, 'update' => true, 'delete' => true]],
+    'manager' => ['manager', ['read' => true, 'write' => true, 'update' => true, 'delete' => false]],
+    'editor' => ['editor', ['read' => true, 'write' => true, 'update' => true, 'delete' => false]],
+    'reader' => ['reader', ['read' => true, 'write' => false, 'update' => false, 'delete' => false]],
+    'outsider' => ['outsider', []],
+]);
+
+it('derives abilities from share power, including shares to my team', function (int $power, bool $viaTeam, array $abilities) {
+    $me = makeStudio('me');
+    $channel = privateChannel(makeStudio('author'));
+    if ($viaTeam) {
+        $team = makeGroup(makeStudio('team-owner'));
+        addGroupMember($team, $me);
+        grantChannelShare($channel, $team, $power, true);
+    } else {
+        grantChannelShare($channel, $me, $power);
+    }
+
+    $this->getJson("/api/v3/channels/{$channel}", authHeader($me))
+        ->assertOk()
+        ->assertJsonPath('data.abilities', $abilities);
+})->with([
+    'reader' => [10, false, ['read' => true, 'write' => false, 'update' => false, 'delete' => false]],
+    'editor' => [20, false, ['read' => true, 'write' => true, 'update' => false, 'delete' => false]],
+    'manager' => [30, false, ['read' => true, 'write' => true, 'update' => true, 'delete' => false]],
+    'editor via team' => [20, true, ['read' => true, 'write' => true, 'update' => false, 'delete' => false]],
+]);
+
+it('lets anyone read system channels, even private ones', function () {
+    $root = makeStudio('root');
+    $pali = makeChannel($root, '_System_Pali_VRI_');
+    Channel::where('uid', $pali)->update(['is_system' => true, 'status' => Channel::STATUS_PRIVATE]);
+    makeSentence($pali, 7, 7, 1, 'namo');
+
+    $this->getJson("/api/v3/channels/{$pali}")->assertOk()->assertJsonPath('data.abilities.read', true);
+    expect(channelIds($this->getJson('/api/v3/channels?system=true')->json('data')))->toBe([$pali]);
+    expect(channelIds($this->getJson('/api/v3/tipitaka-paragraph-channels/7/7')->json('data')))->toBe([$pali]);
+    // 普通公开目录不列私有的系统 channel
+    expect(channelIds($this->getJson('/api/v3/channels')->json('data')))->toBe([]);
+});
+
+it('never lets anyone update or delete a system channel', function () {
+    $owner = makeStudio('root');
+    $channel = makeChannel($owner, '_System_Test_');
+    Channel::where('uid', $channel)->update(['is_system' => true]);
+
+    $this->getJson("/api/v3/channels/{$channel}", authHeader($owner))
+        ->assertJsonPath('data.abilities.update', false)
+        ->assertJsonPath('data.abilities.delete', false);
+    $this->patchJson("/api/v3/channels/{$channel}", ['name' => 'x'], authHeader($owner))->assertForbidden();
+});
+
+/* ---------------- 公开目录 ---------------- */
+
+it('lists public channels only, with optional system filter and search', function () {
+    $owner = makeStudio('owner');
+    $public = makeChannel($owner, 'Alpha public');
+    privateChannel($owner, 'Alpha private');
+    $system = makeChannel($owner, 'Alpha system');
+    Channel::where('uid', $system)->update(['is_system' => true]);
+
+    expect(channelIds($this->getJson('/api/v3/channels?search=alpha')->assertOk()->json('data')))
+        ->toEqualCanonicalizing([$public, $system]);
+    expect(channelIds($this->getJson('/api/v3/channels?system=true')->json('data')))->toBe([$system]);
+});
+
+it('adds chapter progress when book and para are given, and sorts by it', function () {
+    $owner = makeStudio('owner');
+    $low = makeChannel($owner, 'low');
+    $high = makeChannel($owner, 'high');
+    makeChannel($owner, 'none');
+    foreach ([[$low, 0.2], [$high, 0.9]] as [$channel, $progress]) {
+        (new ProgressChapter)->forceFill([
+            'uid' => (string) Str::uuid(), 'book' => 1, 'para' => 10, 'channel_id' => $channel,
+            'lang' => 'zh', 'all_trans' => 100, 'public' => 100, 'progress' => $progress,
+        ])->save();
+    }
+
+    $data = $this->getJson('/api/v3/channels?book=1&para=10&order=progress')->assertOk()->json('data');
+
+    expect(array_slice(channelIds($data), 0, 2))->toBe([$high, $low]);
+    expect($data[0]['progress'])->toBe(0.9);
+    expect($data[2]['progress'])->toBeNull();
+    expect($this->getJson('/api/v3/channels')->json('data.0'))->not->toHaveKey('progress');
+});
+
+it('rejects a para without a book', function () {
+    $this->getJson('/api/v3/channels?para=3')->assertUnprocessable()->assertJsonValidationErrors('book');
+});
+
+it('does not query per channel in lists', function () {
+    $me = makeStudio('me');
+    $countQueriesFor = function (int $extra) use ($me): int {
+        for ($i = 0; $i < $extra; $i++) {
+            makeChannel(makeStudio('o-'.Str::random(8)), 'n1 '.Str::random(5));
+        }
+        DB::flushQueryLog();
+        DB::enableQueryLog();
+        $this->getJson('/api/v3/channels?search=n1', authHeader($me))->assertOk();
+        $count = count(DB::getQueryLog());
+        DB::disableQueryLog();
+
+        return $count;
+    };
+
+    expect($countQueriesFor(8))->toBe($countQueriesFor(1));
+});
+
+/* ---------------- studio 列表 ---------------- */
+
+it('lists my own and directly shared channels, not those shared to my teams', function () {
+    $me = makeStudio('me');
+    $mine = privateChannel($me, 'mine');
+    $direct = privateChannel(makeStudio('a'), 'direct');
+    grantChannelShare($direct, $me, 10);
+    $team = makeGroup(makeStudio('team-owner'));
+    addGroupMember($team, $me);
+    $viaTeam = privateChannel(makeStudio('b'), 'via team');
+    grantChannelShare($viaTeam, $team, 20, true);
+
+    $list = fn (string $relation) => channelIds(
+        $this->getJson("/api/v3/studios/{$me}/channels?relation={$relation}", authHeader($me))->assertOk()->json('data')
+    );
+
+    expect($list('own'))->toBe([$mine]);
+    expect($list('shared'))->toBe([$direct]);
+    expect($list('all'))->toEqualCanonicalizing([$mine, $direct]);
+    $this->getJson("/api/v3/studios/{$me}/channels?relation=shared", authHeader($me))->assertJsonPath('meta.total', 1);
+});
+
+it('lists a team\'s own and shared channels in its teamspace', function () {
+    [$team, $users] = makeTeam();
+    $owned = privateChannel($team, 'team owned');
+    $shared = privateChannel(makeStudio('author'), 'shared to team');
+    grantChannelShare($shared, $team, 20, true);
+    privateChannel($users['reader'], 'reader personal');
+
+    $list = fn (string $relation) => channelIds(
+        $this->getJson("/api/v3/studios/{$team}/channels?relation={$relation}", authHeader($users['reader']))->assertOk()->json('data')
+    );
+
+    expect($list('own'))->toBe([$owned]);
+    expect($list('shared'))->toBe([$shared]);
+});
+
+it('filters shared channels by collaborator', function () {
+    $me = makeStudio('me');
+    $a = makeStudio('a');
+    $fromA = privateChannel($a, 'from a');
+    $fromB = privateChannel(makeStudio('b'), 'from b');
+    grantChannelShare($fromA, $me, 10);
+    grantChannelShare($fromB, $me, 10);
+
+    expect(channelIds($this->getJson("/api/v3/studios/{$me}/channels?relation=shared&collaborator={$a}", authHeader($me))->json('data')))
+        ->toBe([$fromA]);
+});
+
+it('hides a studio list from strangers and requires login', function () {
+    [$team, $users] = makeTeam();
+
+    $this->getJson("/api/v3/studios/{$team}/channels", authHeader($users['outsider']))->assertForbidden();
+    $this->getJson("/api/v3/studios/{$users['owner']}/channels", authHeader($users['editor']))->assertForbidden();
+    $this->getJson("/api/v3/studios/{$team}/channels")->assertUnauthorized();
+});
+
+/* ---------------- 新建 ---------------- */
+
+it('creates channels in my studio or in a team I can create in', function (string $role, int $status) {
+    [$team, $users] = makeTeam();
+    $actor = $users[$role];
+    $studio = $role === 'self' ? $actor : $team;
+
+    $response = $this->postJson("/api/v3/studios/{$studio}/channels", [
+        'name' => 'new channel', 'type' => 'translation', 'lang' => 'zh-Hans',
+    ], authHeader($actor));
+
+    $response->assertStatus($status);
+    if ($status === 201) {
+        $response->assertJsonPath('data.status', Channel::STATUS_PRIVATE)
+            ->assertJsonPath('data.owner.id', $studio)
+            ->assertJsonPath('data.abilities.update', true);
+        expect(Channel::where('owner_uid', $studio)->where('name', 'new channel')->exists())->toBeTrue();
+    }
+})->with([
+    'team owner' => ['owner', 201],
+    'team manager' => ['manager', 201],
+    'team editor' => ['editor', 403],
+    'team reader' => ['reader', 403],
+    'outsider' => ['outsider', 403],
+]);
+
+it('creates a channel in my own studio', function () {
+    $me = makeStudio('me');
+
+    $this->postJson("/api/v3/studios/{$me}/channels", ['name' => 'x', 'type' => 'translation', 'lang' => 'en'], authHeader($me))
+        ->assertCreated()
+        ->assertJsonPath('data.owner.kind', 'user');
+});
+
+it('rejects duplicate names within a studio and bad input', function () {
+    $me = makeStudio('me');
+    makeChannel($me, 'dup');
+
+    $this->postJson("/api/v3/studios/{$me}/channels", ['name' => 'dup', 'type' => 'translation', 'lang' => 'en'], authHeader($me))
+        ->assertUnprocessable()->assertJsonValidationErrors('name');
+    $this->postJson("/api/v3/studios/{$me}/channels", ['name' => 'x', 'type' => 'bogus'], authHeader($me))
+        ->assertUnprocessable()->assertJsonValidationErrors(['type', 'lang']);
+});
+
+it('does not let AI models create, update or delete channels', function () {
+    $owner = makeStudio('owner');
+    $model = makeModelAccount($owner);
+    $channel = makeChannel($model, 'model owned');
+
+    $this->postJson("/api/v3/studios/{$model}/channels", ['name' => 'x', 'type' => 'translation', 'lang' => 'en'], authHeader($model))
+        ->assertForbidden();
+    $this->patchJson("/api/v3/channels/{$channel}", ['name' => 'y'], authHeader($model))->assertForbidden();
+    $this->deleteJson("/api/v3/channels/{$channel}", [], authHeader($model))->assertForbidden();
+});
+
+/* ---------------- 改 ---------------- */
+
+it('updates only the fields sent', function () {
+    $me = makeStudio('me');
+    $channel = makeChannel($me, 'before');
+    Channel::where('uid', $channel)->update(['summary' => 'keep me']);
+
+    $this->patchJson("/api/v3/channels/{$channel}", ['name' => 'after', 'status' => 10], authHeader($me))
+        ->assertOk()
+        ->assertJsonPath('data.name', 'after')
+        ->assertJsonPath('data.status', 10)
+        ->assertJsonPath('data.summary', 'keep me');
+});
+
+it('lets team editors update a team channel but not readers', function () {
+    [$team, $users] = makeTeam();
+    $channel = privateChannel($team);
+
+    $this->patchJson("/api/v3/channels/{$channel}", ['summary' => 'edited'], authHeader($users['editor']))->assertOk();
+    $this->patchJson("/api/v3/channels/{$channel}", ['summary' => 'nope'], authHeader($users['reader']))->assertForbidden();
+});
+
+it('does not register PUT on channels', function () {
+    $me = makeStudio('me');
+    $channel = makeChannel($me);
+
+    $this->putJson("/api/v3/channels/{$channel}", ['name' => 'x'], authHeader($me))->assertMethodNotAllowed();
+});
+
+/* ---------------- 删 ---------------- */
+
+it('soft deletes an empty channel and returns it', function () {
+    $me = makeStudio('me');
+    $channel = makeChannel($me);
+
+    $this->deleteJson("/api/v3/channels/{$channel}", [], authHeader($me))
+        ->assertOk()
+        ->assertJsonPath('data.id', $channel);
+
+    $this->assertSoftDeleted('channels', ['uid' => $channel]);
+    $this->getJson("/api/v3/channels/{$channel}")->assertNotFound();
+});
+
+it('refuses to delete a channel with translations', function () {
+    $me = makeStudio('me');
+    $channel = makeChannel($me);
+    makeSentence($channel, 1, 1, 1, 'text');
+
+    $this->deleteJson("/api/v3/channels/{$channel}", [], authHeader($me))
+        ->assertConflict()
+        ->assertJsonPath('content', ['sentence']);
+});
+
+it('lets only the team owner delete a team channel', function () {
+    [$team, $users] = makeTeam();
+    $channel = privateChannel($team);
+
+    $this->deleteJson("/api/v3/channels/{$channel}", [], authHeader($users['manager']))->assertForbidden();
+    $this->deleteJson("/api/v3/channels/{$channel}", [], authHeader($users['owner']))->assertOk();
+});
+
+/* ---------------- 我能写的 ---------------- */
+
+it('lists channels I can write to across studios, with working search', function () {
+    $me = makeStudio('me');
+    $mine = privateChannel($me, 'pali mine');
+    $editorTeam = makeGroup(makeStudio('t1'));
+    addGroupMember($editorTeam, $me, 2, 'editor');
+    $teamChannel = privateChannel($editorTeam, 'pali team');
+    $readerTeam = makeGroup(makeStudio('t2'));
+    addGroupMember($readerTeam, $me);
+    privateChannel($readerTeam, 'pali read-only team');
+    $shared = privateChannel(makeStudio('a'), 'pali shared 20');
+    grantChannelShare($shared, $me, 20);
+    $readOnly = privateChannel(makeStudio('b'), 'pali shared 10');
+    grantChannelShare($readOnly, $me, 10);
+    makeChannel(makeStudio('c'), 'pali public');
+
+    expect(channelIds($this->getJson('/api/v3/channels/editable?search=PALI', authHeader($me))->assertOk()->json('data')))
+        ->toEqualCanonicalizing([$mine, $teamChannel, $shared]);
+    expect(channelIds($this->getJson('/api/v3/channels/editable?search=team', authHeader($me))->json('data')))
+        ->toBe([$teamChannel]);
+    $this->getJson('/api/v3/channels/editable')->assertUnauthorized();
+});
+
+/* ---------------- 公开不列出(status 20) ---------------- */
+
+it('lets anyone open an unlisted channel but keeps it out of public lists', function () {
+    $owner = makeStudio('owner');
+    $unlisted = makeChannel($owner, 'unlisted channel');
+    Channel::where('uid', $unlisted)->update(['status' => Channel::STATUS_UNLISTED]);
+    makeSentence($unlisted, 8, 8, 1, 'text');
+    (new ProgressChapter)->forceFill([
+        'uid' => (string) Str::uuid(), 'book' => 8, 'para' => 8, 'channel_id' => $unlisted,
+        'lang' => 'zh', 'all_trans' => 100, 'public' => 100, 'progress' => 1.0,
+    ])->save();
+    $stranger = authHeader(makeStudio('stranger'));
+
+    // 拿到链接能看(不登录也行),但不能改
+    $this->getJson("/api/v3/channels/{$unlisted}")
+        ->assertOk()
+        ->assertJsonPath('data.abilities', ['read' => true, 'write' => false, 'update' => false, 'delete' => false]);
+
+    // 面向他人的列表一律不出现
+    expect(channelIds($this->getJson('/api/v3/channels', $stranger)->json('data')))->not->toContain($unlisted);
+    expect(channelIds($this->getJson('/api/v3/tipitaka-channels?lang=zh')->json('data')))->not->toContain($unlisted);
+    expect(channelIds($this->getJson('/api/v3/tipitaka-paragraph-channels/8/8', $stranger)->json('data')))->not->toContain($unlisted);
+    expect(array_column(array_column($this->getJson('/api/v3/tipitaka-chapter-channels/8/8', $stranger)->json('data'), 'channel'), 'id'))
+        ->not->toContain($unlisted);
+
+    // 拥有者自己的列表里照常
+    expect(channelIds($this->getJson("/api/v3/studios/{$owner}/channels", authHeader($owner))->json('data')))->toContain($unlisted);
+    expect(channelIds($this->getJson('/api/v3/tipitaka-paragraph-channels/8/8', authHeader($owner))->json('data')))->toContain($unlisted);
+});
+
+it('accepts unlisted as a status and rejects unknown ones', function () {
+    $me = makeStudio('me');
+    $channel = makeChannel($me);
+
+    $this->patchJson("/api/v3/channels/{$channel}", ['status' => Channel::STATUS_UNLISTED], authHeader($me))
+        ->assertOk()
+        ->assertJsonPath('data.status', 20);
+    $this->patchJson("/api/v3/channels/{$channel}", ['status' => 15], authHeader($me))
+        ->assertUnprocessable()
+        ->assertJsonValidationErrors('status');
+    $this->postJson("/api/v3/studios/{$me}/channels", ['name' => 'u', 'type' => 'translation', 'lang' => 'en', 'status' => 20], authHeader($me))
+        ->assertCreated()
+        ->assertJsonPath('data.status', 20);
+});

+ 7 - 0
api-v13/tests/Feature/GroupV3Test.php

@@ -111,6 +111,13 @@ it('validates new teams', function (array $payload, string $field) {
     'bad status' => [['name' => 'x', 'status' => 20], 'status'],
 ]);
 
+it('does not let AI models create a team', function () {
+    $model = makeModelAccount(makeStudio('owner'));
+
+    $this->postJson('/api/v3/groups', ['name' => 'model team'], authHeader($model))->assertForbidden();
+    expect(GroupInfo::where('owner', $model)->exists())->toBeFalse();
+});
+
 it('requires login to create a team', function () {
     $this->postJson('/api/v3/groups', ['name' => 'x'])->assertUnauthorized();
 });

+ 125 - 0
api-v13/tests/Feature/TipitakaChannelV3Test.php

@@ -0,0 +1,125 @@
+<?php
+
+use App\Models\Channel;
+use App\Models\ProgressChapter;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Str;
+
+uses(RefreshDatabase::class);
+
+/**
+ * 阅读领域的 channel 查询:
+ *   GET /api/v3/tipitaka-paragraph-channels/{book}/{para}   某段有内容的 channel(取代 channel?view=paragraphs)
+ *   GET /api/v3/tipitaka-channels                           有译文的公开 channel 目录(取代 progress?view=channel)
+ *   GET /api/v3/tipitaka-chapter-channels/{book}/{para}     (已有)这里只补团队名下私有 channel 的可见性
+ *
+ * 这里断言的是形状而非契约(spectator 未安装,见 v3-resource skill 第 3 步)。
+ */
+function chapterProgress(string $channel, int $book, int $para, float $progress, string $lang = 'zh'): void
+{
+    (new ProgressChapter)->forceFill([
+        'uid' => (string) Str::uuid(), 'book' => $book, 'para' => $para, 'channel_id' => $channel,
+        'lang' => $lang, 'all_trans' => 100, 'public' => 100, 'progress' => $progress,
+    ])->save();
+}
+
+function hiddenChannel(string $ownerUid, string $name): string
+{
+    $uid = makeChannel($ownerUid, $name);
+    Channel::where('uid', $uid)->update(['status' => Channel::STATUS_PRIVATE]);
+
+    return $uid;
+}
+
+/* ---------------- 某段有内容的 channel ---------------- */
+
+it('lists channels with content in a paragraph, honouring visibility', function () {
+    [$team, $users] = makeTeam();
+    $public = makeChannel(makeStudio('a'), 'public');
+    $teamPrivate = hiddenChannel($team, 'team private');
+    $otherPrivate = hiddenChannel(makeStudio('b'), 'other private');
+    $elsewhere = makeChannel(makeStudio('c'), 'elsewhere');
+    foreach ([$public, $teamPrivate, $otherPrivate] as $channel) {
+        makeSentence($channel, 5, 7, 1, 'text');
+    }
+    makeSentence($elsewhere, 5, 8, 1, 'text');
+
+    $ids = fn (array $headers = []) => array_column(
+        $this->getJson('/api/v3/tipitaka-paragraph-channels/5/7', $headers)->assertOk()->json('data'),
+        'id'
+    );
+
+    expect($ids())->toBe([$public]);
+    expect($ids(authHeader($users['reader'])))->toEqualCanonicalizing([$public, $teamPrivate]);
+});
+
+it('returns 404 for a non-numeric paragraph', function () {
+    $this->getJson('/api/v3/tipitaka-paragraph-channels/5/abc')->assertNotFound();
+});
+
+/* ---------------- 有译文的公开 channel 目录 ---------------- */
+
+it('lists public channels with translated chapters, most chapters first', function () {
+    $owner = makeStudio('owner');
+    $big = makeChannel($owner, 'big');
+    $small = makeChannel($owner, 'small');
+    $hidden = hiddenChannel($owner, 'hidden');
+    $english = makeChannel($owner, 'english');
+    foreach ([1, 2, 3] as $para) {
+        chapterProgress($big, 1, $para, 0.95);
+    }
+    chapterProgress($small, 1, 1, 0.9);
+    chapterProgress($small, 1, 2, 0.5); // 没过门槛
+    chapterProgress($hidden, 1, 1, 1.0);
+    chapterProgress($english, 1, 1, 1.0, 'en');
+
+    $data = $this->getJson('/api/v3/tipitaka-channels?lang=zh&type=translation')->assertOk()->json('data');
+
+    expect(array_column($data, 'id'))->toBe([$big, $small]);
+    expect(array_column($data, 'chapter_count'))->toBe([3, 1]);
+    expect($data[0]['owner']['id'])->toBe($owner);
+
+    // 门槛可调
+    expect(array_column($this->getJson('/api/v3/tipitaka-channels?lang=zh&min_progress=0.4')->json('data'), 'chapter_count'))
+        ->toBe([3, 2]);
+});
+
+it('validates the progress threshold', function () {
+    $this->getJson('/api/v3/tipitaka-channels?min_progress=2')
+        ->assertUnprocessable()
+        ->assertJsonValidationErrors('min_progress');
+});
+
+/* ---------------- 某章的 channel:团队名下的私有 channel ---------------- */
+
+it('shows team-owned private channels of a chapter to team members only', function () {
+    [$team, $users] = makeTeam();
+    $teamPrivate = hiddenChannel($team, 'team private');
+    chapterProgress($teamPrivate, 9, 9, 0.5);
+
+    $ids = fn (array $headers = []) => array_column(
+        $this->getJson('/api/v3/tipitaka-chapter-channels/9/9', $headers)->assertOk()->json('data'),
+        'channel'
+    );
+
+    expect($ids())->toBe([]);
+    expect($ids(authHeader($users['outsider'])))->toBe([]);
+    expect(array_column($ids(authHeader($users['reader'])), 'id'))->toBe([$teamPrivate]);
+});
+
+it('keeps system channels out of a chapter\'s version list', function () {
+    $pali = makeChannel(makeStudio('root'), '_System_Pali_VRI_');
+    Channel::where('uid', $pali)->update(['is_system' => true, 'status' => Channel::STATUS_PRIVATE]);
+    chapterProgress($pali, 9, 9, 1.0);
+
+    expect($this->getJson('/api/v3/tipitaka-chapter-channels/9/9')->json('data'))->toBe([]);
+});
+
+it('drops soft-deleted channels from a chapter', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner, 'gone');
+    chapterProgress($channel, 9, 9, 0.5);
+    Channel::where('uid', $channel)->first()->delete();
+
+    expect($this->getJson('/api/v3/tipitaka-chapter-channels/9/9')->json('data'))->toBe([]);
+});

+ 38 - 0
api-v13/tests/Pest.php

@@ -1,9 +1,11 @@
 <?php
 
+use App\Models\AiModel;
 use App\Models\Channel;
 use App\Models\GroupInfo;
 use App\Models\GroupMember;
 use App\Models\Sentence;
+use App\Models\Share;
 use App\Models\UserInfo;
 use App\Services\AuthService;
 use Firebase\JWT\JWT;
@@ -244,3 +246,39 @@ function memberId(string $team, string $userUid): string
 {
     return (string) GroupMember::where('group_id', $team)->where('user_id', $userUid)->value('id');
 }
+
+/**
+ * 把 channel 共享给某人或某团队。power:10 读、20 写内容、30 改信息。
+ */
+function grantChannelShare(string $channelUid, string $cooperatorUid, int $power, bool $toTeam = false): void
+{
+    (new Share)->forceFill([
+        'id' => random_int(1, PHP_INT_MAX),
+        'res_id' => $channelUid,
+        'res_type' => 2,
+        'cooperator_id' => $cooperatorUid,
+        'cooperator_type' => $toTeam ? 1 : 0,
+        'power' => $power,
+        'create_time' => time() * 1000,
+        'modify_time' => time() * 1000,
+    ])->save();
+}
+
+/**
+ * 建一个 AI 模型账号(ai_models 一行就是一个身份),返回它的 uid;用它的 token 测「只给人类」的写入。
+ */
+function makeModelAccount(string $ownerUid): string
+{
+    $uid = (string) Str::uuid();
+    (new AiModel)->forceFill([
+        'id' => random_int(1, PHP_INT_MAX),
+        'uid' => $uid,
+        'name' => 'model',
+        'real_name' => 'model-'.Str::random(6),
+        'model' => 'gpt-4',
+        'owner_id' => $ownerUid,
+        'editor_id' => $ownerUid,
+    ])->save();
+
+    return $uid;
+}

+ 112 - 0
dashboard-test/src/tests/channel-teamspace.spec.ts

@@ -0,0 +1,112 @@
+import { test, expect, type Page, type APIRequestContext } from '@playwright/test';
+import { call } from '../lib/api.js';
+import { collect } from '../lib/collect.js';
+import { DESTRUCTIVE, shotDir } from '../lib/env.js';
+
+/**
+ * 团队空间里的 channel(v3 /studios/{团队 uuid}/channels):
+ * 「本工作室」列团队名下的,「协作」列共享给团队的;新建建在团队名下。
+ *
+ * 用测试账号名下的「e2e 团队空间」(teamspace.spec 也用它)。团队名下固定放一个 channel
+ * 「e2e 团队 channel」,只建一次、保留;新建用例的 e2e-tmp-* 测完软删。
+ */
+const SHOT = shotDir('channel-teamspace');
+const TEAM = 'e2e 团队空间';
+const TEAM_CHANNEL = 'e2e 团队 channel';
+
+const shot = (page: Page, name: string) =>
+  page.screenshot({ path: `${SHOT}/${name}.png`, fullPage: true });
+const row = (page: Page, name: string) => page.locator('.ant-table-row').filter({ hasText: name });
+
+async function ensureTeam(request: APIRequestContext): Promise<string> {
+  const mine = await call(request, 'GET', '/v3/me/groups?owned=true&per_page=200');
+  const found = (mine.body.data as { id: string; name: string }[]).find((g) => g.name === TEAM);
+  if (found) return found.id;
+  const created = await call(request, 'POST', '/v3/groups', { name: TEAM });
+  expect(created.status).toBe(201);
+  return created.body.data.id;
+}
+
+async function ensureTeamChannel(request: APIRequestContext, team: string): Promise<string> {
+  const list = await call(request, 'GET', `/v3/studios/${team}/channels?relation=own&per_page=200`);
+  const found = (list.body.data as { id: string; name: string }[]).find((c) => c.name === TEAM_CHANNEL);
+  if (found) return found.id;
+  const created = await call(request, 'POST', `/v3/studios/${team}/channels`, {
+    name: TEAM_CHANNEL, type: 'translation', lang: 'zh-Hans',
+  });
+  expect(created.status, JSON.stringify(created.body)).toBe(201);
+  return created.body.data.id;
+}
+
+/** 直接把团队空间写进 localStorage(切换流程本身由 teamspace.spec 测) */
+async function enterTeamspace(page: Page, team: string) {
+  await page.goto('workspace', { waitUntil: 'networkidle' });
+  await page.evaluate(
+    ([id, name]) => localStorage.setItem('teamspace', JSON.stringify({ id, nickName: name, realName: id })),
+    [team, TEAM],
+  );
+}
+
+test.describe('团队空间里的 channel', () => {
+  test('列表只有团队名下的,新建建在团队名下', async ({ page, request }) => {
+    test.skip(!DESTRUCTIVE, 'E2E_DESTRUCTIVE=0');
+    const log = collect(page);
+    const team = await ensureTeam(request);
+    await ensureTeamChannel(request, team);
+    const mine = await call(request, 'GET', '/v3/me');
+
+    await test.step('1. 本工作室页签:团队名下的 channel', async () => {
+      await enterTeamspace(page, team);
+      const listed = page.waitForResponse(
+        (r) => r.url().includes(`/api/v3/studios/${team}/channels`) && r.url().includes('relation=own'),
+      );
+      await page.goto('workspace/channel', { waitUntil: 'networkidle' });
+      expect((await listed).status()).toBe(200);
+      await expect(page.getByTestId('teamspace-badge')).toContainText(TEAM);
+      await expect(row(page, TEAM_CHANNEL)).toBeVisible();
+      // 个人名下的 channel 不出现:随便取一个个人 channel 名核对
+      const personal = await call(request, 'GET', `/v3/studios/${mine.body.data.id}/channels?relation=own&per_page=1`);
+      const personalName = personal.body.data?.[0]?.name as string | undefined;
+      if (personalName && personalName !== TEAM_CHANNEL) {
+        await expect(row(page, personalName)).toHaveCount(0);
+      }
+      await shot(page, '01-team-own');
+      log.dump('1. 团队名下');
+    });
+
+    await test.step('2. 新建:建在团队名下', async () => {
+      const name = `e2e-tmp-${Date.now()}`;
+      await page.getByRole('button', { name: /新建/ }).click();
+      const pop = page.locator('.ant-popover:visible');
+      await pop.getByRole('textbox').first().fill(name);
+      // 类型有默认值,语言必填(与 channel.spec 的新建写法一致)
+      await pop.locator('.ant-select').last().click();
+      await page.locator('.ant-select-dropdown:visible .ant-select-item-option').first().click();
+      const created = page.waitForResponse(
+        (r) => r.url().includes(`/api/v3/studios/${team}/channels`) && r.request().method() === 'POST',
+      );
+      await pop.getByRole('button', { name: /提 *交/ }).click();
+      const res = await created;
+      expect(res.status()).toBe(201);
+      const channel = (await res.json()).data;
+      expect(channel.owner).toMatchObject({ kind: 'team', id: team });
+      await expect(row(page, name)).toBeVisible();
+      await shot(page, '02-created');
+
+      // 清理:软删
+      expect((await call(request, 'DELETE', `/v3/channels/${channel.id}`)).status).toBe(200);
+    });
+
+    await test.step('3. 原地切回个人空间:表格按本人重新取,团队的 channel 不见了', async () => {
+      const relisted = page.waitForRequest(
+        (r) =>
+          r.url().includes(`/api/v3/studios/${mine.body.data.id}/channels`) &&
+          new URL(r.url()).searchParams.get('per_page') !== '1',
+      );
+      await page.getByTestId('teamspace-badge').locator('.ant-tag-close-icon').click();
+      await relisted;
+      await expect(row(page, TEAM_CHANNEL)).toHaveCount(0);
+      await shot(page, '03-back-to-personal');
+    });
+  });
+});

+ 52 - 0
dashboard-test/src/tests/channel-unlisted.spec.ts

@@ -0,0 +1,52 @@
+import { test, expect, type Page } from '@playwright/test';
+import { call } from '../lib/api.js';
+import { DESTRUCTIVE, shotDir } from '../lib/env.js';
+
+/**
+ * channel 公开性「公开不列出」(status 20):拿到链接谁都能看,但不出现在社区列表里。
+ * 用 e2e-tmp-* 临时 channel,测完软删。
+ */
+const SHOT = shotDir('channel-unlisted');
+const shot = (page: Page, name: string) =>
+  page.screenshot({ path: `${SHOT}/${name}.png`, fullPage: true });
+
+test('设置为「公开不列出」:社区里没有,直接打开可以', async ({ page, request, playwright }) => {
+  test.skip(!DESTRUCTIVE, 'E2E_DESTRUCTIVE=0');
+  const me = (await call(request, 'GET', '/v3/me')).body.data;
+  const name = `e2e-tmp-${Date.now()}`;
+  const created = await call(request, 'POST', `/v3/studios/${me.id}/channels`, {
+    name, type: 'translation', lang: 'zh-Hans', status: 30,
+  });
+  expect(created.status).toBe(201);
+  const id = created.body.data.id as string;
+
+  await test.step('1. 设置页选「公开不列出」并保存', async () => {
+    await page.goto(`workspace/channel/${id}/setting`, { waitUntil: 'networkidle' });
+    await page.locator('.ant-form-item').filter({ hasText: '公开性' }).locator('.ant-select').click();
+    await page.locator('.ant-select-dropdown:visible .ant-select-item-option').filter({ hasText: '公开不列出' }).click();
+    const saved = page.waitForResponse((r) => r.url().endsWith(`/api/v3/channels/${id}`) && r.request().method() === 'PATCH');
+    await page.getByRole('button', { name: /提 *交/ }).click();
+    const res = await saved;
+    expect(res.status()).toBe(200);
+    expect((await res.json()).data.status).toBe(20);
+    await shot(page, '01-saved');
+  });
+
+  await test.step('2. 社区页签搜不到它', async () => {
+    const listed = page.waitForResponse((r) => /\/api\/v3\/channels\?/.test(r.url()));
+    await page.goto(`workspace/channel?tab=community&q=${name}`, { waitUntil: 'networkidle' });
+    const body = await (await listed).json();
+    expect((body.data as { id: string }[]).map((c) => c.id)).not.toContain(id);
+    await expect(page.locator('.ant-table-row').filter({ hasText: name })).toHaveCount(0);
+  });
+
+  await test.step('3. 不登录也能直接打开它', async () => {
+    const anon = await playwright.request.newContext();
+    const res = await anon.get(new URL(`/api/v3/channels/${id}`, page.url()).toString());
+    expect(res.status()).toBe(200);
+    expect((await res.json()).data.abilities.read).toBe(true);
+    await anon.dispose();
+  });
+
+  expect((await call(request, 'DELETE', `/v3/channels/${id}`)).status).toBe(200);
+});

+ 129 - 0
dashboard-test/src/tests/channel-url.spec.ts

@@ -0,0 +1,129 @@
+import { test, expect, type Page, type Request } from '@playwright/test';
+import { collect } from '../lib/collect.js';
+import { shotDir } from '../lib/env.js';
+
+/**
+ * /workspace/channel 的列表状态在 URL 里:页签、页码、每页条数、关键字、排序都能 F5 重入。
+ */
+const SHOT = shotDir('channel-url');
+const TAB = '.ant-pro-table-list-toolbar-inline-menu-item';
+
+const shot = (page: Page, name: string) =>
+  page.screenshot({ path: `${SHOT}/${name}.png`, fullPage: true });
+const isList = (r: Request) =>
+  /\/api\/v3\/(channels|studios\/[^/]+\/channels)(\?|$)/.test(r.url()) && r.method() === 'GET';
+/** 下一次列表请求的查询参数(忽略数量徽标的 per_page=1 请求) */
+const nextList = (page: Page) =>
+  page
+    .waitForRequest((r) => isList(r) && new URL(r.url()).searchParams.get('per_page') !== '1')
+    .then((r) => ({ path: new URL(r.url()).pathname, query: new URL(r.url()).searchParams }));
+const activeTab = (page: Page) => page.locator(`${TAB}-active`);
+
+test.describe('channel 列表 URL 可重入', () => {
+  test('页签、搜索、页码、排序写进 URL,刷新后原样恢复', async ({ page }) => {
+    const log = collect(page);
+
+    await test.step('1. 带参数直接打开:按 URL 请求并显示', async () => {
+      const listed = nextList(page);
+      await page.goto('workspace/channel?tab=collaboration&q=test&pagesize=10', { waitUntil: 'networkidle' });
+      const { path, query } = await listed;
+      expect(path).toMatch(/\/studios\/[^/]+\/channels$/);
+      expect(query.get('relation')).toBe('shared');
+      expect(query.get('search')).toBe('test');
+      expect(query.get('per_page')).toBe('10');
+      await expect(activeTab(page)).toContainText('协作');
+      await expect(page.getByPlaceholder('请输入').first()).toHaveValue('test');
+      await shot(page, '01-from-url');
+    });
+
+    await test.step('2. 切页签:URL 跟着变,页码与协作者重置', async () => {
+      const listed = nextList(page);
+      await page.locator(TAB).filter({ hasText: '社区' }).click();
+      const { path } = await listed;
+      expect(path).toMatch(/\/v3\/channels$/);
+      await expect(page).toHaveURL(/tab=community/);
+      await expect(page).not.toHaveURL(/page=/);
+    });
+
+    await test.step('3. 排序:点创建时间表头,URL 记下排序', async () => {
+      // ProTable 点表头时会先按旧参数自己请求一次,URL 更新后才带上排序再请求——等后一次
+      const sorted = page.waitForRequest(
+        (r) => isList(r) && new URL(r.url()).searchParams.get('order') === 'created_at',
+      );
+      await page.locator('.ant-table-thead th').filter({ hasText: '创建' }).last().click();
+      await sorted;
+      await expect(page).toHaveURL(/order=created_at/);
+    });
+
+    await test.step('4. F5:页签、关键字、排序都还在', async () => {
+      const url = page.url();
+      const listed = nextList(page);
+      await page.reload({ waitUntil: 'networkidle' });
+      const { path, query } = await listed;
+      expect(page.url()).toBe(url);
+      expect(path).toMatch(/\/v3\/channels$/);
+      expect(query.get('search')).toBe('test');
+      expect(query.get('order')).toBe('created_at');
+      await expect(activeTab(page)).toContainText('社区');
+      await shot(page, '04-after-f5');
+    });
+
+    await test.step('4b. 改每页条数:记进 localStorage,不会来回请求(曾死循环闪烁)', async () => {
+      await page.goto('workspace/channel', { waitUntil: 'networkidle' });
+      await page.evaluate(() => localStorage.removeItem('pagesize/channel'));
+      await page.reload({ waitUntil: 'networkidle' });
+      const requests: string[] = [];
+      const onRequest = (r: Request) => {
+        if (isList(r) && new URL(r.url()).searchParams.get('per_page') !== '1') requests.push(r.url());
+      };
+      page.on('request', onRequest);
+      await page.locator('.ant-pagination-options .ant-select').click();
+      await page.locator('.ant-select-dropdown:visible .ant-select-item-option').filter({ hasText: '10' }).first().click();
+      await page.waitForTimeout(3000);
+      page.off('request', onRequest);
+      // 换每页条数最多两次请求(ProTable 自己一次 + 换 key 重新挂载一次),死循环时会持续增加
+      expect(requests.length, requests.join('\n')).toBeLessThanOrEqual(2);
+      expect(new URL(requests[requests.length - 1]).searchParams.get('per_page')).toBe('10');
+      expect(await page.evaluate(() => localStorage.getItem('pagesize/channel'))).toBe('10');
+      // 等于记下的默认值,不写进 URL
+      await expect(page).not.toHaveURL(/pagesize=/);
+    });
+
+    await test.step('4c. 不带 pagesize 重新打开:沿用记下的每页条数', async () => {
+      const listed = nextList(page);
+      await page.goto('workspace/channel', { waitUntil: 'networkidle' });
+      expect((await listed).query.get('per_page')).toBe('10');
+      await expect(page.locator('.ant-pagination-options')).toContainText('10');
+      // URL 显式带的优先
+      const explicit = nextList(page);
+      await page.goto('workspace/channel?pagesize=50', { waitUntil: 'networkidle' });
+      expect((await explicit).query.get('per_page')).toBe('50');
+    });
+
+    await test.step('4d. 每个页签的角标 = 切过去后表格的总条数', async () => {
+      for (const [tab, label] of [['my', '此工作室'], ['collaboration', '协作'], ['community', '社区']] as const) {
+        await page.goto(`workspace/channel${tab === 'my' ? '' : `?tab=${tab}`}`, { waitUntil: 'networkidle' });
+        const badgeText = (await page.locator(TAB).filter({ hasText: label }).innerText()).match(/\d+\+?/)?.[0] ?? '0';
+        const badge = Number(badgeText.replace('+', ''));
+        const totalText = await page.locator('.ant-pagination-total-text').innerText().catch(() => '');
+        const total = Number(totalText.match(/总共\s*(\d+)/)?.[1] ?? 0);
+        // 角标超过 99 显示「99+」(antd Badge 的封顶)
+        if (badgeText.endsWith('+')) {
+          expect(total, `${label}:角标 ${badgeText},表格「${totalText}」`).toBeGreaterThan(badge);
+        } else {
+          expect(badge, `${label}:角标 ${badgeText},表格「${totalText}」`).toBe(total);
+        }
+      }
+    });
+
+    await test.step('5. 页码:直接带 page=2 打开就请求第 2 页', async () => {
+      const listed = nextList(page);
+      await page.goto('workspace/channel?tab=community&page=2&pagesize=5', { waitUntil: 'networkidle' });
+      const { query } = await listed;
+      expect(query.get('page')).toBe('2');
+      expect(query.get('per_page')).toBe('5');
+      await expect(page.locator('.ant-pagination-item-active')).toHaveText('2');
+      log.dump('5. 页码');
+    });
+  });
+});

+ 4 - 3
dashboard-test/src/tests/teamspace.spec.ts

@@ -77,7 +77,8 @@ test.describe('团队空间切换', () => {
     });
 
     await test.step('2. 主导航:可团队化与个人专属的模块置灰,全局模块照常', async () => {
-      await expect(menuItem(page, '版本风格')).toHaveClass(/ant-menu-item-disabled/);
+      // channel 已迁 v3,团队空间里可用(看团队名下的与共享给团队的)
+      await expect(menuItem(page, '版本风格')).not.toHaveClass(/ant-menu-item-disabled/);
       await expect(menuItem(page, '术语')).toHaveClass(/ant-menu-item-disabled/);
       await expect(menuItem(page, '最近')).toHaveClass(/ant-menu-item-disabled/);
       await expect(menuItem(page, '主页')).not.toHaveClass(/ant-menu-item-disabled/);
@@ -117,8 +118,8 @@ test.describe('团队空间切换', () => {
       await expect(badge(page)).toContainText(TEAM);
     });
 
-    await test.step('3. 直接输入地址也进不去', async () => {
-      await page.goto('workspace/channel', { waitUntil: 'networkidle' });
+    await test.step('3. 直接输入地址也进不去(还没迁 v3 的术语)', async () => {
+      await page.goto('workspace/term', { waitUntil: 'networkidle' });
       await expect(page.getByTestId('teamspace-blocked')).toContainText('该模块暂不支持团队空间');
       await expect(page.locator('.ant-table')).toHaveCount(0);
       await shot(page, '03-blocked');

+ 162 - 84
dashboard-v6/src/api/channel.ts

@@ -1,7 +1,99 @@
 // src/api/channel.ts
 import type { LoaderFunctionArgs } from "react-router";
 import type { IStudio, TRole } from "./Auth";
-import { get, post } from "../request";
+import { get } from "../request";
+import { api, unwrap, unwrapQuiet } from "./client";
+import type { paths } from "./schema";
+
+/* ─── v3(channel 本身已迁 v3,取代 v2 channel / channel-my-number / channel-progress)─── */
+
+type ChannelSingle =
+  paths["/v3/channels/{channel}"]["get"]["responses"][200]["content"]["application/json"];
+type ChannelProgressList =
+  paths["/v3/channels/batch-progress"]["post"]["responses"][200]["content"]["application/json"];
+
+/** v3 的一个 channel:拥有者可以是个人或团队,带当前用户的 abilities */
+export type Channel = NonNullable<ChannelSingle["data"]>;
+export type ChannelAbilities = NonNullable<Channel["abilities"]>;
+export type ChannelProgress = NonNullable<ChannelProgressList["data"]>[number];
+export type PublicChannelQuery = NonNullable<
+  paths["/v3/channels"]["get"]["parameters"]["query"]
+>;
+export type StudioChannelQuery = NonNullable<
+  paths["/v3/studios/{studio}/channels"]["get"]["parameters"]["query"]
+>;
+export type EditableChannelQuery = NonNullable<
+  paths["/v3/channels/editable"]["get"]["parameters"]["query"]
+>;
+export type NewChannelInput =
+  paths["/v3/studios/{studio}/channels"]["post"]["requestBody"]["content"]["application/json"];
+export type ChannelInput = NonNullable<
+  paths["/v3/channels/{channel}"]["patch"]["requestBody"]
+>["content"]["application/json"];
+
+/** 列表里显示的身份:能删 = 拥有者,能改信息 = 管理员,能写 = 编辑,否则只读成员 */
+export const channelRole = (abilities?: ChannelAbilities): TRole =>
+  abilities?.delete
+    ? "owner"
+    : abilities?.update
+      ? "manager"
+      : abilities?.write
+        ? "editor"
+        : "member";
+
+/** 拥有者摘要 → 现有 Studio 组件吃的 IStudio */
+export const channelOwnerStudio = (
+  owner?: Channel["owner"],
+): IStudio | undefined =>
+  owner
+    ? {
+        id: owner.id ?? "",
+        nickName: owner.nickName,
+        realName: owner.realName,
+        studioName: owner.realName,
+        avatar: owner.avatar ?? undefined,
+      }
+    : undefined;
+
+export const fetchPublicChannels = async (query: PublicChannelQuery = {}) =>
+  unwrap(await api.GET("/v3/channels", { params: { query } }));
+
+export const fetchStudioChannels = async (
+  studio: string,
+  query: StudioChannelQuery = {},
+) =>
+  unwrap(
+    await api.GET("/v3/studios/{studio}/channels", {
+      params: { path: { studio }, query },
+    }),
+  );
+
+export const fetchEditableChannels = async (query: EditableChannelQuery = {}) =>
+  unwrap(await api.GET("/v3/channels/editable", { params: { query } }));
+
+export const createChannel = async (studio: string, body: NewChannelInput) =>
+  unwrap(
+    await api.POST("/v3/studios/{studio}/channels", {
+      params: { path: { studio } },
+      body,
+    }),
+  ).data;
+
+export const updateChannel = async (channel: string, body: ChannelInput) =>
+  unwrap(
+    await api.PATCH("/v3/channels/{channel}", {
+      params: { path: { channel } },
+      body,
+    }),
+  ).data;
+
+/** 软删除;channel 下还有内容时后端 409,原因由 unwrap 弹出 */
+export const deleteChannel = async (channel: string) =>
+  unwrap(
+    await api.DELETE("/v3/channels/{channel}", {
+      params: { path: { channel } },
+    }),
+  ).data;
 export interface IChannel {
   id: string;
   name: string;
@@ -9,24 +101,13 @@ export interface IChannel {
   lang?: string;
 }
 export type TChannelType =
-  | "translation"
-  | "nissaya"
-  | "original"
-  | "wbw"
-  | "commentary"
-  | "similar";
+  "translation" | "nissaya" | "original" | "wbw" | "commentary" | "similar";
 export interface IChannelApiData {
   id: string;
   name: string;
   type?: TChannelType;
 }
 
-export interface ChannelInfoProps {
-  channel: IChannelApiData;
-  studio: IStudio;
-  count?: number;
-}
-
 export type TChannelSourceType = "original" | "reprint" | "ai";
 export const SOURCE_TYPE_OPTIONS: TChannelSourceType[] = [
   "original",
@@ -39,39 +120,6 @@ export const SOURCE_TYPE_OPTIONS: TChannelSourceType[] = [
  *
  */
 export type IFinal = [number, boolean];
-export interface IApiResponseChannelData {
-  uid: string;
-  name: string;
-  summary: string;
-  type: TChannelType;
-  studio: IStudio;
-  lang: string;
-  status: number;
-  is_system: boolean;
-  progress?: number;
-  source_type?: TChannelSourceType | null;
-  source_id?: string | null;
-  created_at: string;
-  updated_at: string;
-  role?: TRole;
-  final?: IFinal[];
-  content_created_at: string;
-  content_updated_at: string;
-}
-export interface IApiResponseChannel {
-  ok: boolean;
-  message: string;
-  data: IApiResponseChannelData;
-}
-export interface IApiResponseChannelList {
-  ok: boolean;
-  message: string;
-  data: {
-    rows: IApiResponseChannelData[];
-    count: number;
-  };
-}
-
 export interface ISentInChapterListResponse {
   ok: boolean;
   data: ISentInChapterListData;
@@ -90,15 +138,6 @@ export interface ISentInChapterListDataRow {
   word_end: number;
 }
 
-export interface IResNumberResponse {
-  ok: boolean;
-  message: string;
-  data: {
-    my: number;
-    collaboration: number;
-  };
-}
-
 export interface IResNumber {
   translation?: number;
   nissaya?: number;
@@ -107,11 +146,6 @@ export interface IResNumber {
   sim?: number;
 }
 
-export interface IProgressRequest {
-  sentence: string[];
-  owner?: string;
-}
-
 export interface IChannelItem {
   id: number;
   uid: string;
@@ -130,27 +164,34 @@ export interface IChannelItem {
 }
 
 export async function channelLoader({ params }: LoaderFunctionArgs) {
-  const channelId = params.channelId;
-
-  if (!channelId) {
+  const channel = params.channelId;
+  if (!channel) {
     throw new Response("Missing channelId", { status: 400 });
   }
-
-  const res = await get<IApiResponseChannel>(`/api/v2/channel/${channelId}`);
-
-  if (!res.ok) {
+  try {
+    return unwrapQuiet(
+      await api.GET("/v3/channels/{channel}", {
+        params: { path: { channel } },
+      }),
+    ).data;
+  } catch {
     throw new Response("Channel not found", { status: 404 });
   }
-
-  return res.data;
 }
 
 /** 按 uid 取一个 channel;取不到返回 undefined(只用来显示名字之类,不弹错) */
 export const fetchChannel = async (
-  channelId: string
-): Promise<IApiResponseChannel["data"] | undefined> => {
-  const res = await get<IApiResponseChannel>(`/api/v2/channel/${channelId}`);
-  return res.ok ? res.data : undefined;
+  channel: string,
+): Promise<Channel | undefined> => {
+  try {
+    return unwrapQuiet(
+      await api.GET("/v3/channels/{channel}", {
+        params: { path: { channel } },
+      }),
+    ).data;
+  } catch {
+    return undefined;
+  }
 };
 
 // ─── 获取章节内所有句子 ID ───────────────────────────────────────────────────
@@ -160,25 +201,62 @@ export const fetchChannel = async (
  */
 export const fetchSentencesInChapter = (
   bookId: string,
-  para: string
+  para: string,
 ): Promise<ISentInChapterListResponse> =>
   get<ISentInChapterListResponse>(
-    `/api/v2/sentences-in-chapter?book=${bookId}&para=${para}`
+    `/api/v2/sentences-in-chapter?book=${bookId}&para=${para}`,
   );
 
 // ─── 获取频道进度列表 ────────────────────────────────────────────────────────
 
+/** 系统 channel(原文、系统逐词等)不在选版本面板里出现 */
+const isSystemName = (name?: string) => /^_sys/i.test(name ?? "");
+
+/** batch-progress 的一行 → 选版本面板用的 IChannelItem;系统 channel 返回 undefined */
+export const toChannelItem = (
+  item: ChannelProgress,
+  index: number,
+): IChannelItem | undefined => {
+  if (item.is_system || isSystemName(item.name)) {
+    return undefined;
+  }
+  const final = (item.final ?? undefined) as IFinal[] | undefined;
+  let all = 0;
+  let finished = 0;
+  final?.forEach(([len, done]) => {
+    all += len;
+    if (done) finished += len;
+  });
+  return {
+    id: index,
+    uid: item.id ?? "",
+    title: item.name ?? "",
+    summary: item.summary ?? "",
+    studio: channelOwnerStudio(item.owner) as IStudio,
+    shareType: "my",
+    role: channelRole(item.abilities),
+    type: item.type as TChannelType,
+    publicity: item.status ?? 0,
+    createdAt: new Date(item.created_at ?? 0).getTime(),
+    final,
+    progress: all ? finished / all : 0,
+    content_created_at: item.content_created_at ?? undefined,
+    content_updated_at: item.content_updated_at ?? undefined,
+  };
+};
+
 /**
- * 批量查询句子在各频道的翻译进度
+ * 一批句子在各 channel 的完成度:这些句子上有译文且看得见的 channel,加上我能写的。
  *
  * @param sentences 句子 ID 列表,格式 `book-para-wordBegin-wordEnd`
- * @param owner     "all" = 全部可见频道;"my" = 仅自己拥有的
+ * @param studio    只看这个 studio(用户或团队 uuid)名下的;不传 = 全部
  */
-export const fetchChannelProgress = (
+export const fetchChannelProgress = async (
   sentences: string[],
-  owner: "all" | "my" = "all"
-): Promise<IApiResponseChannelList> =>
-  post<IProgressRequest, IApiResponseChannelList>("/api/v2/channel-progress", {
-    sentence: sentences,
-    owner,
-  });
+  studio?: string,
+): Promise<ChannelProgress[]> =>
+  unwrap(
+    await api.POST("/v3/channels/batch-progress", {
+      body: { sentences, studio },
+    }),
+  ).data ?? [];

Plik diff jest za duży
+ 929 - 24
dashboard-v6/src/api/schema.d.ts


+ 14 - 17
dashboard-v6/src/components/channel/ChannelCreate.tsx

@@ -6,8 +6,7 @@ import {
 } from "@ant-design/pro-components";
 import { message } from "antd";
 
-import { post } from "../../../src/request";
-import type { IApiResponseChannel } from "../../api/channel";
+import { createChannel } from "../../api/channel";
 import ChannelTypeSelect from "./ChannelTypeSelect";
 import LangSelect from "../../../src/components/general/LangSelect";
 import { useRef } from "react";
@@ -16,14 +15,14 @@ interface IFormData {
   name: string;
   type: string;
   lang: string;
-  studio: string;
 }
 
 interface IWidget {
-  studio?: string;
+  /** 建在哪个 studio 名下:用户 uuid,或团队空间里的团队 uuid */
+  studioId?: string;
   onSuccess?: () => void;
 }
-const ChannelCreateWidget = ({ studio, onSuccess }: IWidget) => {
+const ChannelCreateWidget = ({ studioId, onSuccess }: IWidget) => {
   const intl = useIntl();
   const formRef = useRef<ProFormInstance | undefined>(undefined);
 
@@ -31,20 +30,18 @@ const ChannelCreateWidget = ({ studio, onSuccess }: IWidget) => {
     <ProForm<IFormData>
       formRef={formRef}
       onFinish={async (values: IFormData) => {
-        if (typeof studio === "undefined") {
+        if (!studioId) {
           return;
         }
-        values.studio = studio;
-        const res: IApiResponseChannel = await post(`/api/v2/channel`, values);
-        if (res.ok) {
-          message.success(intl.formatMessage({ id: "flashes.success" }));
-          if (typeof onSuccess !== "undefined") {
-            onSuccess();
-            formRef.current?.resetFields(["name"]);
-          }
-        } else {
-          message.error(res.message);
-        }
+        // 重名、无权在这个 studio 名下建等,由 unwrap 统一弹提示
+        await createChannel(studioId, {
+          name: values.name,
+          type: values.type as "translation",
+          lang: values.lang,
+        });
+        message.success(intl.formatMessage({ id: "flashes.success" }));
+        formRef.current?.resetFields(["name"]);
+        onSuccess?.();
       }}
     >
       <ProForm.Group>

+ 28 - 46
dashboard-v6/src/components/channel/ChannelPickerTable.tsx

@@ -11,13 +11,13 @@ import {
   ReloadOutlined,
 } from "@ant-design/icons";
 
-import type {
-  IApiResponseChannelList,
-  IChannel,
-  IChannelItem,
-  IProgressRequest,
+import {
+  fetchChannelProgress,
+  toChannelItem,
+  type IChannel,
+  type IChannelItem,
 } from "../../api/channel";
-import { post } from "../../../src/request";
+import { useActiveStudio } from "../../hooks/useActiveStudio";
 import { LockIcon } from "../../../src/assets/icon";
 
 import ProgressSvg from "./ProgressSvg";
@@ -58,6 +58,7 @@ const ChannelPickerTableWidget = ({
   const [copyChannel, setCopyChannel] = useState<IChannel>();
   const [copyOpen, setCopyOpen] = useState<boolean>(false);
   const [ownerChanged, setOwnerChanged] = useState<boolean>(false);
+  const { studioId } = useActiveStudio();
 
   const ref = useRef<ActionType | null>(null);
 
@@ -143,7 +144,7 @@ const ChannelPickerTableWidget = ({
                                 id: item.uid,
                                 name: item.title,
                               };
-                            })
+                            }),
                           );
                           setShowCheckBox(false);
                           ref.current?.reload();
@@ -183,58 +184,39 @@ const ChannelPickerTableWidget = ({
             setOwnerChanged(true);
           }
           console.log("owner", currOwner);
-          const res = await post<IProgressRequest, IApiResponseChannelList>(
-            `/api/v2/channel-progress`,
-            {
-              sentence: sentList,
-              owner: currOwner,
-            }
+          // 「我的」交给后端按 studio 过滤(团队空间里是团队);「协作」「公开」在前端筛
+          const rows = await fetchChannelProgress(
+            sentList,
+            currOwner === "my" ? studioId : undefined,
           );
-          console.debug("progress data", res.data.rows);
-          const items: IChannelItem[] = res.data.rows
-            .filter((value) => value.name.substring(0, 4) !== "_Sys")
-            .map((item, id) => {
-              const date = new Date(item.created_at);
-              let all: number = 0;
-              let finished: number = 0;
-              item.final?.forEach((value) => {
-                all += value[0];
-                finished += value[1] ? value[0] : 0;
-              });
-              const progress = finished / all;
-              return {
-                id: id,
-                uid: item.uid,
-                title: item.name,
-                summary: item.summary,
-                studio: item.studio,
-                shareType: "my",
-                role: item.role,
-                type: item.type,
-                publicity: item.status,
-                createdAt: date.getTime(),
-                final: item.final,
-                progress: progress,
-              };
-            });
+          const items: IChannelItem[] = rows
+            .filter((row) =>
+              currOwner === "collaborator"
+                ? row.owner?.id !== studioId && row.abilities?.write
+                : currOwner === "public"
+                  ? (row.status ?? 0) >= 30
+                  : true,
+            )
+            .map(toChannelItem)
+            .filter((item): item is IChannelItem => item !== undefined);
           //当前被选择的
           const currChannel = items.filter((value) =>
-            selectedRowKeys.includes(value.uid)
+            selectedRowKeys.includes(value.uid),
           );
           let show = selectedRowKeys;
           //有进度的
           const progressing = items.filter(
-            (value) => value.progress > 0 && !show.includes(value.uid)
+            (value) => value.progress > 0 && !show.includes(value.uid),
           );
           show = [...show, ...progressing.map((item) => item.uid)];
           //我自己的
           const myChannel = items.filter(
-            (value) => value.role === "owner" && !show.includes(value.uid)
+            (value) => value.role === "owner" && !show.includes(value.uid),
           );
           show = [...show, ...myChannel.map((item) => item.uid)];
           //其他的
           const others = items.filter(
-            (value) => !show.includes(value.uid) && value.role !== "member"
+            (value) => !show.includes(value.uid) && value.role !== "member",
           );
           setSelectedRowKeys(selectedRowKeys);
           const channelData = [
@@ -244,8 +226,8 @@ const ChannelPickerTableWidget = ({
             ...others,
           ];
           return {
-            total: res.data.count,
-            succcess: true,
+            total: channelData.length,
+            success: true,
             data: channelData,
           };
         }}

+ 25 - 23
dashboard-v6/src/components/channel/ChannelSelect.tsx

@@ -1,10 +1,8 @@
 import { ProFormCascader } from "@ant-design/pro-components";
-import { message } from "antd";
 import { useAppSelector } from "../../../src/hooks";
 import { currentUser } from "../../../src/reducers/current-user";
 
-import { get } from "../../../src/request";
-import type { IApiResponseChannelList } from "../../api/channel";
+import { fetchEditableChannels } from "../../api/channel";
 
 import { useIntl } from "react-intl";
 import type { IStudio } from "../../../src/api/Auth";
@@ -50,17 +48,21 @@ const ChannelSelectWidget = ({
       placeholder={placeholder}
       request={async ({ keyWords }) => {
         console.debug("keyWord", keyWords);
-        const url = `/api/v2/channel?view=user-edit&key=${keyWords}`;
-        console.info("ChannelSelect api request", url);
-        const json = await get<IApiResponseChannelList>(url);
-        console.debug("ChannelSelect api response", json);
-        if (json.ok) {
+        // 我能写的 channel(本人的、团队的、共享权限 ≥20 的)。v2 这里传 key、后端读 search,搜索一直没生效
+        const rows =
+          (
+            await fetchEditableChannels({
+              search: keyWords || undefined,
+              per_page: 200,
+            })
+          ).data ?? [];
+        {
           //获取studio list
           const studio = new Map<string, string>();
-          for (const iterator of json.data.rows) {
+          for (const iterator of rows) {
             studio.set(
-              iterator.studio.id,
-              iterator.studio.nickName ? iterator.studio.nickName : ""
+              iterator.owner?.id ?? "",
+              iterator.owner?.nickName ?? "",
             );
           }
           let channels: IOption[] = [];
@@ -85,10 +87,14 @@ const ChannelSelectWidget = ({
             channels.push({
               value: user.id,
               label: user.realName,
-              children: json.data.rows
-                .filter((value) => value.studio.id === user.id)
+              children: rows
+                .filter((value) => value.owner?.id === user.id)
                 .map((item) => {
-                  return { value: item.uid, label: item.name, lang: item.lang };
+                  return {
+                    value: item.id ?? "",
+                    label: item.name ?? "",
+                    lang: item.lang,
+                  };
                 }),
             });
           }
@@ -100,19 +106,19 @@ const ChannelSelectWidget = ({
 
           const others: IOption[] = arrStudio
             .sort((a, b) =>
-              a.nickName && b.nickName ? (a.nickName > b.nickName ? 1 : -1) : 0
+              a.nickName && b.nickName ? (a.nickName > b.nickName ? 1 : -1) : 0,
             )
             .filter((value) => value.id !== user?.id)
             .map((item) => {
               const node = {
                 value: item.id,
                 label: item.nickName,
-                children: json.data.rows
-                  .filter((value) => value.studio.id === item.id)
+                children: rows
+                  .filter((value) => value.owner?.id === item.id)
                   .map((item) => {
                     return {
-                      value: item.uid,
-                      label: item.name,
+                      value: item.id ?? "",
+                      label: item.name ?? "",
                       lang: item.lang,
                     };
                   }),
@@ -121,11 +127,7 @@ const ChannelSelectWidget = ({
             });
           channels = [...channels, ...others];
 
-          console.debug("ChannelSelect json", channels);
           return channels;
-        } else {
-          message.error(json.message);
-          return [];
         }
       }}
       fieldProps={{}}

+ 216 - 90
dashboard-v6/src/components/channel/ChannelTable.tsx

@@ -2,6 +2,7 @@ import { type ActionType, ProTable } from "@ant-design/pro-components";
 import { useIntl } from "react-intl";
 import { Link } from "react-router";
 import { Alert, message, Modal, Progress, Typography } from "antd";
+import type { SortOrder } from "antd/es/table/interface";
 import { Button, Dropdown, Popover } from "antd";
 import {
   PlusOutlined,
@@ -11,22 +12,27 @@ import {
 } from "@ant-design/icons";
 
 import ChannelCreate from "./ChannelCreate";
-import { delete_, get } from "../../../src/request";
-import type {
-  IApiResponseChannelList,
-  IChannel,
-  TChannelType,
+import {
+  channelOwnerStudio,
+  channelRole,
+  deleteChannel,
+  fetchPublicChannels,
+  fetchStudioChannels,
+  type IChannel,
+  type TChannelType,
 } from "../../api/channel";
 import { PublicityValueEnum } from "../studio/table";
-import type { IDeleteResponse } from "../../api/article";
-import { useEffect, useRef, useState } from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
+import { loadPageSize, savePageSize } from "../../utils/pageSize";
+
+/** 每页条数的本地记忆用这个列表名(工作区列表页与选版本弹窗共用) */
+export const CHANNEL_LIST = "channel";
 import type { IStudio, TRole } from "../../../src/api/Auth";
 import ShareModal from "../share/ShareModal";
 
 import StudioName from "../../../src/components/auth/Studio";
 import StudioSelect from "./StudioSelect";
 
-import { getSorterUrl } from "../../../src/utils";
 import TransferCreate from "../transfer/TransferCreate";
 import { TransferOutLinedIcon } from "../../../src/assets/icon";
 import { channelTypeFilter } from "./utils";
@@ -62,7 +68,30 @@ interface IChannelItem {
   created_at: string;
 }
 
+/** 列表的可重入状态:工作区列表页把它放进 URL,刷新(F5)后原样恢复 */
+export interface IChannelListQuery {
+  /** 页签:my 本工作室 / collaboration 协作 / community 社区 */
+  tab: "my" | "collaboration" | "community";
+  page: number;
+  pageSize: number;
+  /** 关键字 */
+  q?: string;
+  /** 协作页签里只看某个拥有者共享过来的 */
+  collaborator?: string;
+  order?: "created_at" | "updated_at" | "name" | "progress";
+  dir?: "asc" | "desc";
+}
+
 interface IWidget {
+  /**
+   * 受控模式:传了 query + onQueryChange 就由外部(URL)保存页签、页码、搜索、排序;
+   * 不传则组件自己记(选版本弹窗里用,不该改地址栏)。
+   */
+  query?: IChannelListQuery;
+  onQueryChange?: (next: Partial<IChannelListQuery>) => void;
+  /** v3:本人或团队的 uuid(列表、数量、新建都按它) */
+  studioId?: string;
+  /** 转让、协作者筛选仍走 v2,要 studio 名 */
   studioName?: string;
   type?: string;
   disableChannels?: string[];
@@ -71,7 +100,21 @@ interface IWidget {
   onSelect?: (channel: IChannel) => void;
 }
 
+/** 列表排序:ProTable 的 sorter → v3 的 order / dir */
+const toOrder = (sorter: Record<string, SortOrder>) => {
+  const [field, order] = Object.entries(sorter).find(([, v]) => v) ?? [];
+  return field
+    ? {
+        order: field as "created_at" | "updated_at" | "name" | "progress",
+        dir: (order === "ascend" ? "asc" : "desc") as "asc" | "desc",
+      }
+    : {};
+};
+
 const ChannelTableWidget = ({
+  query: controlledQuery,
+  onQueryChange,
+  studioId,
   studioName,
   disableChannels,
   channelType,
@@ -82,10 +125,32 @@ const ChannelTableWidget = ({
 
   const [openCreate, setOpenCreate] = useState(false);
 
-  const [activeKey, setActiveKey] = useState<React.Key | undefined>("my");
+  // 不受控时组件自己记;受控时一律以外部 query 为准
+  const [innerQuery, setInnerQuery] = useState<IChannelListQuery>(() => ({
+    tab: "my",
+    page: 1,
+    pageSize: loadPageSize(CHANNEL_LIST),
+  }));
+  const query = controlledQuery ?? innerQuery;
+  const changeQuery = (next: Partial<IChannelListQuery>) => {
+    // 用户改了每页条数就记下来,下次打开沿用
+    if (next.pageSize !== undefined && next.pageSize !== query.pageSize) {
+      savePageSize(CHANNEL_LIST, next.pageSize);
+    }
+    if (onQueryChange) {
+      onQueryChange(next);
+    } else {
+      setInnerQuery((prev) => ({ ...prev, ...next }));
+    }
+  };
+  const activeKey = query.tab;
+  // 搜索框的输入草稿:按回车才写进 query;query.q 变了(如从 URL 恢复、切页签)就跟着同步
+  const [keywordDraft, setKeywordDraft] = useState(query.q ?? "");
+  useEffect(() => setKeywordDraft(query.q ?? ""), [query.q]);
+  const collaborator = query.collaborator;
   const [myNumber, setMyNumber] = useState<number>(0);
   const [collaborationNumber, setCollaborationNumber] = useState<number>(0);
-  const [collaborator, setCollaborator] = useState<string>();
+  const [communityNumber, setCommunityNumber] = useState<number>(0);
   const [transfer, setTransfer] = useState<string[]>();
   const [transferName, setTransferName] = useState<string>();
   const [transferOpen, setTransferOpen] = useState(false);
@@ -94,19 +159,29 @@ const ChannelTableWidget = ({
     ref.current?.reload();
   }, [disableChannels]);
 
-  useEffect(() => {
-    /**
-     * 获取各种channel的数量
-     */
-    const url = `/api/v2/channel-my-number?studio=${studioName}`;
-    console.log("url", url);
-    get<IResNumberResponse>(url).then((json) => {
-      if (json.ok) {
-        setMyNumber(json.data.my);
-        setCollaborationNumber(json.data.collaboration);
-      }
-    });
-  }, [studioName]);
+  /**
+   * 三个页签的数量:各取一条,读 meta.total。条件与表格一致(带上 channelType),
+   * 角标才会等于切过去后表格下方的「总共 N 条」(不含关键字:角标是页签的总量)。
+   */
+  const refreshNumbers = useCallback(() => {
+    fetchPublicChannels({ type: channelType, per_page: 1 }).then((res) =>
+      setCommunityNumber(res.meta?.total ?? 0),
+    );
+    if (!studioId) {
+      return;
+    }
+    fetchStudioChannels(studioId, {
+      relation: "own",
+      type: channelType,
+      per_page: 1,
+    }).then((res) => setMyNumber(res.meta?.total ?? 0));
+    fetchStudioChannels(studioId, {
+      relation: "shared",
+      type: channelType,
+      per_page: 1,
+    }).then((res) => setCollaborationNumber(res.meta?.total ?? 0));
+  }, [studioId, channelType]);
+  useEffect(refreshNumbers, [refreshNumbers]);
 
   const showDeleteConfirm = (id: string, title: string) => {
     Modal.confirm({
@@ -127,20 +202,12 @@ const ChannelTableWidget = ({
       cancelText: intl.formatMessage({
         id: "buttons.no",
       }),
-      onOk() {
-        const url = `/api/v2/channel/${id}`;
-        console.log("delete api request", url);
-        return delete_<IDeleteResponse>(url)
-          .then((json) => {
-            console.info("api response", json);
-            if (json.ok) {
-              message.success("删除成功");
-              ref.current?.reload();
-            } else {
-              message.error(json.message);
-            }
-          })
-          .catch((e) => console.log("Oops errors!", e));
+      async onOk() {
+        // 有内容或无权删除时后端拒绝,原因由 unwrap 弹出
+        await deleteChannel(id);
+        message.success(intl.formatMessage({ id: "flashes.success" }));
+        ref.current?.reload();
+        refreshNumbers();
       },
     });
   };
@@ -158,6 +225,19 @@ const ChannelTableWidget = ({
       ) : undefined}
       <ProTable<IChannelItem>
         actionRef={ref}
+        // 与文章列表同一套做法(ArticleList):分页不受控,用 defaultCurrent / defaultPageSize;
+        // 除页码外的状态一变就换 key 重新挂载,让新的默认值生效。受控的 current / pageSize 会和
+        // ProTable 内部的分页状态互相纠正,URL 来回改、页面一直闪
+        key={[
+          // 切换个人 / 团队空间时 studioId 变,表格要按新身份重新取
+          studioId,
+          query.tab,
+          query.pageSize,
+          query.q,
+          query.collaborator,
+          query.order,
+          query.dir,
+        ].join("|")}
         columns={[
           {
             title: intl.formatMessage({
@@ -308,6 +388,12 @@ const ChannelTableWidget = ({
             dataIndex: "created_at",
             valueType: "date",
             sorter: true,
+            defaultSortOrder:
+              query.order === "created_at"
+                ? query.dir === "asc"
+                  ? "ascend"
+                  : "descend"
+                : undefined,
           },
           {
             title: intl.formatMessage({ id: "buttons.option" }),
@@ -378,80 +464,119 @@ const ChannelTableWidget = ({
             },
           },
         ]}
-        request={async (params = {}, sorter, filter) => {
-          console.log(params, sorter, filter);
-          let url = `/api/v2/channel?`;
-          if (activeKey === "community") {
-            url += `view=public`;
-          } else {
-            url += `view=studio&view2=${activeKey}&name=${studioName}`;
-          }
-          if (chapter) {
-            url += `&book=${chapter.book}&paragraph=${chapter.paragraph}`;
+        // 页签、页码、搜索、排序都在 query 里:它一变 ProTable 就重新请求
+        // 只在用户真的翻页、改每页条数、点排序时触发一次,写回 query(受控时进 URL)
+        onChange={(pagination, _filters, sorter) => {
+          const one = Array.isArray(sorter) ? sorter[0] : sorter;
+          const sort = one?.order
+            ? toOrder({ [String(one.columnKey ?? one.field)]: one.order })
+            : { order: undefined, dir: undefined };
+          const pageSize = pagination.pageSize ?? query.pageSize;
+          const sortChanged =
+            sort.order !== query.order || sort.dir !== query.dir;
+          // 每页条数或排序变了回到第 1 页
+          const page =
+            pageSize !== query.pageSize || sortChanged
+              ? 1
+              : (pagination.current ?? 1);
+          if (
+            page !== query.page ||
+            pageSize !== query.pageSize ||
+            sortChanged
+          ) {
+            changeQuery({ ...sort, page, pageSize });
           }
-          const offset =
-            ((params.current ? params.current : 1) - 1) *
-            (params.pageSize ? params.pageSize : 20);
-          url += `&limit=${params.pageSize}&offset=${offset}`;
-
-          url += collaborator ? "&collaborator=" + collaborator : "";
-          url += params.keyword ? "&search=" + params.keyword : "";
-          url += channelType ? "&type=" + channelType : "";
-          if (chapter && activeKey === "community") {
-            url += "&order=progress";
-          } else {
-            url += getSorterUrl(sorter);
-          }
-
-          console.log("url", url);
-          const res: IApiResponseChannelList = await get(url);
-          const items: IChannelItem[] = res.data.rows.map((item, id) => {
-            return {
-              id: id + 1,
-              uid: item.uid,
-              title: item.name,
-              summary: item.summary,
-              type: item.type,
-              role: item.role,
-              progress: item.progress,
-              studio: item.studio,
-              publicity: item.status,
-              created_at: item.created_at,
-            };
-          });
-          return {
-            total: res.data.count,
-            succcess: true,
-            data: items,
+        }}
+        request={async (params = {}) => {
+          // 页码由 ProTable 管(初值来自 query 的 defaultCurrent),其余条件取自 query
+          const page = params.current ?? query.page;
+          const perPage = params.pageSize ?? query.pageSize;
+          const listQuery = {
+            search: query.q || undefined,
+            type: channelType,
+            book: chapter?.book,
+            para: chapter?.paragraph,
+            page,
+            per_page: perPage,
+            ...(chapter && activeKey === "community"
+              ? { order: "progress" as const }
+              : { order: query.order, dir: query.dir }),
           };
+          try {
+            const res =
+              activeKey === "community"
+                ? await fetchPublicChannels(listQuery)
+                : studioId
+                  ? await fetchStudioChannels(studioId, {
+                      ...listQuery,
+                      relation: activeKey === "my" ? "own" : "shared",
+                      collaborator:
+                        collaborator && collaborator !== "all"
+                          ? collaborator
+                          : undefined,
+                    })
+                  : undefined;
+            const items: IChannelItem[] = (res?.data ?? []).map(
+              (item, index) => ({
+                id: (page - 1) * perPage + index + 1,
+                uid: item.id ?? "",
+                title: item.name ?? "",
+                summary: item.summary ?? "",
+                type: item.type as TChannelType,
+                role: channelRole(item.abilities),
+                progress: item.progress ?? undefined,
+                studio: channelOwnerStudio(item.owner),
+                publicity: item.status ?? 0,
+                created_at: item.created_at ?? "",
+              }),
+            );
+            return { total: res?.meta?.total ?? 0, success: true, data: items };
+          } catch {
+            return { total: 0, success: false, data: [] };
+          }
         }}
         rowKey="id"
         bordered
         pagination={{
+          defaultCurrent: query.page,
+          defaultPageSize: query.pageSize,
           showQuickJumper: true,
           showSizeChanger: true,
         }}
         search={false}
         options={{
-          search: true,
+          search: {
+            value: keywordDraft,
+            onChange: (e: React.ChangeEvent<HTMLInputElement>) =>
+              setKeywordDraft(e.target.value),
+            // 关键字记进 query(受控时进 URL),返回 false 让 ProTable 不再自己存一份
+            onSearch: (keyword: string) => {
+              changeQuery({ q: keyword || undefined, page: 1 });
+              return false;
+            },
+          },
         }}
         toolBarRender={() => [
           activeKey !== "my" ? (
             <StudioSelect
               studioName={studioName}
+              value={collaborator}
               onSelect={(value: string) => {
-                setCollaborator(value);
-                ref.current?.reload();
+                changeQuery({
+                  collaborator: value && value !== "all" ? value : undefined,
+                  page: 1,
+                });
               }}
             />
           ) : undefined,
           <Popover
             content={
               <ChannelCreate
-                studio={studioName}
+                studioId={studioId}
                 onSuccess={() => {
                   setOpenCreate(false);
                   ref.current?.reload();
+                  refreshNumbers();
                 }}
               />
             }
@@ -498,7 +623,7 @@ const ChannelTableWidget = ({
                   <span>
                     {intl.formatMessage({ id: "labels.community" })}
                     <StatusBadge
-                      count={collaborationNumber}
+                      count={communityNumber}
                       active={activeKey === "community"}
                     />
                   </span>
@@ -506,10 +631,11 @@ const ChannelTableWidget = ({
               },
             ],
             onChange(key) {
-              console.log("show course", key);
-              setActiveKey(key);
-              setCollaborator(undefined);
-              ref.current?.reload();
+              changeQuery({
+                tab: key as IChannelListQuery["tab"],
+                collaborator: undefined,
+                page: 1,
+              });
             },
           },
         }}

+ 1 - 0
dashboard-v6/src/components/channel/ChannelTableModal.tsx

@@ -72,6 +72,7 @@ const ChannelTableModalWidget = ({
       >
         <div style={{ overflowX: "scroll" }}>
           <ChannelTable
+            studioId={user?.id}
             studioName={user?.realName}
             type={type}
             chapter={chapter}

+ 43 - 49
dashboard-v6/src/components/channel/Edit.tsx

@@ -8,12 +8,13 @@ import {
 import { Alert, message } from "antd";
 
 import {
+  fetchChannel,
   SOURCE_TYPE_OPTIONS,
-  type IApiResponseChannel,
-  type IApiResponseChannelData,
+  updateChannel,
+  type Channel,
+  type ChannelInput,
   type TChannelSourceType,
 } from "../../api/channel";
-import { get, put } from "../../request";
 import ChannelTypeSelect from "./ChannelTypeSelect";
 import LangSelect from "../general/LangSelect";
 import PublicitySelect from "../studio/PublicitySelect";
@@ -27,20 +28,23 @@ interface IFormData {
   lang: string;
   summary: string;
   status: number;
-  studio: string;
   source_type?: TChannelSourceType | null;
   source_id?: string | null;
-  isSystem: boolean;
 }
 interface IWidget {
-  studioName?: string;
   channelId?: string;
-  onLoad?: (data: IApiResponseChannelData) => void;
+  onLoad?: (data: Channel) => void;
 }
-const EditWidget = ({ studioName, channelId, onLoad }: IWidget) => {
+/**
+ * channel 基本信息。没有「改信息」权限(abilities.update)时整张表只读——
+ * 系统 channel、只读成员、共享权限不足都属于这种。
+ */
+const EditWidget = ({ channelId, onLoad }: IWidget) => {
   const intl = useIntl();
   const [isSystem, setIsSystem] = useState<boolean>();
-  const [data, setData] = useState<IApiResponseChannelData>();
+  // 默认只读,取到 abilities 再放开,避免先可编辑、再变只读
+  const [readonly, setReadonly] = useState<boolean>(true);
+  const [data, setData] = useState<Channel>();
 
   const user = useAppSelector(currentUser);
   return (
@@ -52,46 +56,39 @@ const EditWidget = ({ studioName, channelId, onLoad }: IWidget) => {
       )}
       <ProForm<IFormData>
         submitter={{
-          resetButtonProps: { disabled: isSystem ? true : false },
-          submitButtonProps: { disabled: isSystem ? true : false },
+          resetButtonProps: { disabled: readonly },
+          submitButtonProps: { disabled: readonly },
         }}
         onFinish={async (values: IFormData) => {
-          console.log(values);
-          const res = await put(`/api/v2/channel/${channelId}`, values);
-          console.log(res);
+          if (!channelId) {
+            return;
+          }
+          // 只改动过的字段也无妨:PATCH 只认传了的字段。失败由 unwrap 统一弹提示
+          await updateChannel(channelId, {
+            ...values,
+            source_type: values.source_type ?? undefined,
+          } as ChannelInput);
           message.success(intl.formatMessage({ id: "flashes.success" }));
         }}
         formKey="channel_edit"
         request={async () => {
-          const res = await get<IApiResponseChannel>(
-            `/api/v2/channel/${channelId}`
-          );
-          if (res.ok === false) {
-            return {
-              name: "",
-              type: "",
-              lang: "",
-              summary: "",
-              status: 0,
-              studio: "",
-              isSystem: true,
-            };
-          }
-          setData(res.data);
-          if (typeof onLoad !== "undefined") {
-            onLoad(res.data);
+          const channel = channelId ? await fetchChannel(channelId) : undefined;
+          if (!channel) {
+            return { name: "", type: "", lang: "", summary: "", status: 0 };
           }
-          setIsSystem(res.data.is_system);
+          setData(channel);
+          onLoad?.(channel);
+          setIsSystem(channel.is_system);
+          setReadonly(!channel.abilities?.update);
           return {
-            name: res.data.name,
-            type: res.data.type,
-            lang: res.data.lang,
-            summary: res.data.summary,
-            status: res.data.status,
-            source_type: res.data.source_type,
-            source_id: res.data.source_id,
-            studio: studioName ? studioName : "",
-            isSystem: res.data.is_system,
+            name: channel.name ?? "",
+            type: channel.type ?? "",
+            lang: channel.lang ?? "",
+            summary: channel.summary ?? "",
+            status: channel.status ?? 0,
+            source_type: (channel.source_type ??
+              null) as TChannelSourceType | null,
+            source_id: channel.source_id,
           };
         }}
       >
@@ -99,7 +96,7 @@ const EditWidget = ({ studioName, channelId, onLoad }: IWidget) => {
           <ProFormText
             width="md"
             name="name"
-            readonly={isSystem ? true : false}
+            readonly={readonly}
             required
             label={intl.formatMessage({ id: "channel.name" })}
             rules={[
@@ -111,8 +108,8 @@ const EditWidget = ({ studioName, channelId, onLoad }: IWidget) => {
         </ProForm.Group>
 
         <ProForm.Group>
-          <ChannelTypeSelect readonly={isSystem ? true : false} />
-          <LangSelect readonly={isSystem ? true : false} />
+          <ChannelTypeSelect readonly={readonly} />
+          <LangSelect readonly={readonly} />
         </ProForm.Group>
         <ProForm.Group>
           <ProFormSelect
@@ -136,17 +133,14 @@ const EditWidget = ({ studioName, channelId, onLoad }: IWidget) => {
         <ProForm.Group>
           <PublicitySelect
             readonly={
-              isSystem || user?.roles?.includes("basic") || data?.status === 5
-                ? true
-                : false
+              readonly || user?.roles?.includes("basic") || data?.status === 5
             }
-            disable={["public_no_list"]}
           />
         </ProForm.Group>
 
         <ProForm.Group>
           <ProFormTextArea
-            readonly={isSystem ? true : false}
+            readonly={readonly}
             width="md"
             name="summary"
             label="简介"

+ 4 - 2
dashboard-v6/src/components/channel/StudioSelect.tsx

@@ -18,9 +18,11 @@ interface IOptions {
 }
 interface IWidget {
   studioName?: string;
+  /** 当前选中的拥有者 uuid(列表页从 URL 恢复);不传 = 全部 */
+  value?: string;
   onSelect?: (value: string) => void;
 }
-const StudioSelectWidget = ({ studioName, onSelect }: IWidget) => {
+const StudioSelectWidget = ({ studioName, value, onSelect }: IWidget) => {
   const [anthology, setAnthology] = useState<IOptions[]>([
     { value: "all", label: "全部" },
   ]);
@@ -48,7 +50,7 @@ const StudioSelectWidget = ({ studioName, onSelect }: IWidget) => {
   }, [studioName]);
   return (
     <Select
-      defaultValue="all"
+      value={value ?? "all"}
       style={{ width: 180 }}
       onChange={(value: string) => {
         console.log(`selected ${value}`);

+ 9 - 32
dashboard-v6/src/components/channel/hooks/useChannelProgress.ts

@@ -21,6 +21,7 @@ import { useState, useEffect, useCallback } from "react";
 import {
   fetchChannelProgress,
   fetchSentencesInChapter,
+  toChannelItem,
   type IChannelItem,
 } from "../../../api/channel";
 import type { ArticleType } from "../../../api/article";
@@ -36,7 +37,7 @@ interface IUseChannelProgressReturn {
 
 export const useChannelProgress = (
   type?: ArticleType | "editable",
-  articleId?: string
+  articleId?: string,
 ): IUseChannelProgressReturn => {
   const [channels, setChannels] = useState<IChannelItem[]>([]);
   const [sentencesId, setSentencesId] = useState<string[]>([]);
@@ -66,7 +67,7 @@ export const useChannelProgress = (
 
             sentList = res.data.rows.map(
               (item) =>
-                `${item.book}-${item.paragraph}-${item.word_begin}-${item.word_end}`
+                `${item.book}-${item.paragraph}-${item.word_begin}-${item.word_end}`,
             );
           }
         } else {
@@ -78,38 +79,14 @@ export const useChannelProgress = (
         setSentenceCount(sentList.length);
 
         // ── 2. 拉取频道进度 ──────────────────────────────────────────────────
-        const res = await fetchChannelProgress(sentList, "all");
+        const rows = await fetchChannelProgress(sentList);
         if (!active) return;
 
-        const items: IChannelItem[] = res.data.rows
-          .filter((v) => !v.name.startsWith("_sys"))
-          .map((item, id) => {
-            let all = 0;
-            let finished = 0;
-            item.final?.forEach((v) => {
-              all += v[0];
-              if (v[1]) finished += v[0];
-            });
-
-            return {
-              id,
-              uid: item.uid,
-              title: item.name,
-              summary: item.summary,
-              studio: item.studio,
-              shareType: "my",
-              role: item.role,
-              type: item.type,
-              publicity: item.status,
-              createdAt: new Date(item.created_at).getTime(),
-              final: item.final,
-              progress: all ? finished / all : 0,
-              content_created_at: item.content_created_at,
-              content_updated_at: item.content_updated_at,
-            };
-          });
-
-        setChannels(items);
+        setChannels(
+          rows
+            .map(toChannelItem)
+            .filter((item): item is IChannelItem => item !== undefined),
+        );
       } catch (err) {
         console.error("useChannelProgress fetch error", err);
       } finally {

+ 32 - 37
dashboard-v6/src/components/course/CourseInfoEdit.tsx

@@ -28,9 +28,10 @@ import type { DefaultOptionType } from "antd/lib/select";
 import type { UploadFile } from "antd/es/upload/interface";
 import type { IAttachmentResponse } from "../../api/Attachments";
 import type { IAnthologyListResponse } from "../../api/article";
-import type {
-  IApiResponseChannelData,
-  IApiResponseChannelList,
+import {
+  fetchPublicChannels,
+  fetchStudioChannels,
+  type Channel,
 } from "../../api/channel";
 
 interface IFormData {
@@ -52,12 +53,13 @@ interface IFormData {
 }
 
 interface IWidget {
-  studioName?: string;
+  /** v3:本人或团队 uuid,列「标准答案」可选的 channel 用 */
+  studioId?: string;
   courseId?: string;
   onTitleChange?: (title: string) => void;
 }
 const CourseInfoEditWidget = ({
-  studioName,
+  studioId,
   courseId,
   onTitleChange,
 }: IWidget) => {
@@ -115,7 +117,7 @@ const CourseInfoEditWidget = ({
           console.debug("course info edit put", url, postData);
           const res = await put<ICourseDataRequest, ICourseResponse>(
             url,
-            postData
+            postData,
           );
           console.debug("course info edit put", res);
           if (res.ok) {
@@ -245,7 +247,7 @@ const CourseInfoEditWidget = ({
                 return currTeacher ? [currTeacher] : [];
               }
               const json = await get<IUserListResponse>(
-                `/api/v2/user?view=key&key=${keyWords}`
+                `/api/v2/user?view=key&key=${keyWords}`,
               );
               const userList = json.data.rows.map((item) => {
                 return {
@@ -284,7 +286,7 @@ const CourseInfoEditWidget = ({
                 return currTextbook ? [currTextbook] : [];
               }
               const json = await get<IAnthologyListResponse>(
-                `/api/v2/anthology?view=public`
+                `/api/v2/anthology?view=public`,
               );
               const textbookList = json.data.rows.map((item) => {
                 return {
@@ -308,38 +310,31 @@ const CourseInfoEditWidget = ({
               if (typeof keyWords === "undefined" || keyWords === " ") {
                 return currChannel ? [currChannel] : [];
               }
-              let urlMy = `/api/v2/channel?view=studio-all&name=${studioName}`;
-              if (typeof keyWords !== "undefined" && keyWords !== "") {
-                urlMy += "&search=" + keyWords;
-              }
-              console.info("api request", urlMy);
-              const json = await get<IApiResponseChannelList>(urlMy);
-              console.info("api response", json);
-
-              let urlPublic = `/api/v2/channel?view=public`;
-              if (typeof keyWords !== "undefined" && keyWords !== "") {
-                urlPublic += "&search=" + keyWords;
-              }
-              console.info("api request", urlPublic);
-              const jsonPublic = await get<IApiResponseChannelList>(urlPublic);
-              console.info("api response", jsonPublic);
-
-              //查重
-              const channels1: IApiResponseChannelData[] = [];
-              const channels = [...json.data.rows, ...jsonPublic.data.rows];
-              channels.forEach((value) => {
-                const has = channels1.findIndex(
-                  (value1) => value1.uid === value.uid
-                );
-                if (has === -1) {
-                  channels1.push(value);
-                }
-              });
+              const search = keyWords || undefined;
+              // 本 studio 的(自己的 + 共享来的)与公开的,合并去重
+              const [mine, publicOnes] = await Promise.all([
+                studioId
+                  ? fetchStudioChannels(studioId, {
+                      relation: "all",
+                      search,
+                      per_page: 100,
+                    })
+                  : Promise.resolve({ data: [] as Channel[] }),
+                fetchPublicChannels({ search, per_page: 100 }),
+              ]);
+              const channels1: Channel[] = [];
+              [...(mine.data ?? []), ...(publicOnes.data ?? [])].forEach(
+                (value) => {
+                  if (!channels1.some((value1) => value1.id === value.id)) {
+                    channels1.push(value);
+                  }
+                },
+              );
 
               const channelList = channels1.map((item) => {
                 return {
-                  value: item.uid,
-                  label: `${item.studio.nickName}/${item.name}`,
+                  value: item.id ?? "",
+                  label: `${item.owner?.nickName}/${item.name}`,
                 };
               });
               console.debug("channelList", channelList);

+ 13 - 8
dashboard-v6/src/components/course/SelectChannel.tsx

@@ -5,7 +5,7 @@ import { GlobalOutlined } from "@ant-design/icons";
 import { useAppSelector } from "../../hooks";
 import { currentUser as _currentUser } from "../../reducers/current-user";
 
-import { get, put } from "../../request";
+import { put } from "../../request";
 
 import { LockIcon } from "../../assets/icon";
 import type {
@@ -13,7 +13,7 @@ import type {
   ICourseMemberResponse,
 } from "../../api/course";
 import { useIntl } from "react-intl";
-import type { IApiResponseChannelList } from "../../api/channel";
+import { fetchStudioChannels } from "../../api/channel";
 
 interface IWidget {
   courseId?: string | null;
@@ -64,7 +64,7 @@ const SelectChannelWidget = ({
               console.info("course select channel api request", url, data);
               const json = await put<ICourseMemberData, ICourseMemberResponse>(
                 url,
-                data
+                data,
               );
               console.info("course select channel api response", json);
               if (json.ok) {
@@ -96,14 +96,19 @@ const SelectChannelWidget = ({
                 },
               ]}
               request={async () => {
-                const channelData = await get<IApiResponseChannelList>(
-                  `/api/v2/channel?view=studio&name=${user?.realName}`
-                );
-                const channel = channelData.data.rows.map((item) => {
+                if (!user?.id) {
+                  return [];
+                }
+                // 学生交作业用的版本:只列本人名下的
+                const channelData = await fetchStudioChannels(user.id, {
+                  relation: "own",
+                  per_page: 200,
+                });
+                const channel = (channelData.data ?? []).map((item) => {
                   const icon =
                     item.status === 30 ? <GlobalOutlined /> : <LockIcon />;
                   return {
-                    value: item.uid,
+                    value: item.id ?? "",
                     label: (
                       <>
                         {icon} {item.name}

+ 2 - 0
dashboard-v6/src/components/task/ProjectTable.tsx

@@ -68,6 +68,8 @@ const ProjectTableWidget = ({ studioName, disableChannels }: IWidget) => {
         id: "buttons.no",
       }),
       onOk() {
+        // FIXME: 从 ChannelTable 复制来没改——删项目却调了删 channel 的接口(id 是项目 id,永远删不掉)。
+        // 应调项目的删除接口;迁任务 / 项目到 v3 时一并修。
         const url = `/api/v2/channel/${id}`;
         console.log("delete api request", url);
         return delete_<IDeleteResponse>(url)

+ 8 - 17
dashboard-v6/src/components/term/GrammarBook.tsx

@@ -20,11 +20,7 @@ import store from "../../store";
 import GrammarRecent, { type IGrammarRecent } from "./GrammarRecent";
 import { useIntl } from "react-intl";
 
-import { get } from "../../request";
-import type {
-  IApiResponseChannelData,
-  IApiResponseChannelList,
-} from "../../api/channel";
+import { fetchPublicChannels, type Channel } from "../../api/channel";
 import { grammarTermFetch } from "../../load";
 import TermModal from "./TermModal";
 import { popRecent, pushRecent } from "./utils";
@@ -43,8 +39,7 @@ const GrammarBookWidget = () => {
   const [localTermSearch, setLocalTermSearch] = useState<string>();
   const [showRecent, setShowRecent] = useState(false);
   const [create, setCreate] = useState(false);
-  const [grammarChannel, setGrammarChannel] =
-    useState<IApiResponseChannelData>();
+  const [grammarChannel, setGrammarChannel] = useState<Channel>();
   const sysGrammar = useAppSelector(getGrammar);
   const searchWord = useAppSelector(grammarWord);
   const searchWordId = useAppSelector(grammarWordId);
@@ -53,15 +48,11 @@ const GrammarBookWidget = () => {
   const termSearch = searchWord || localTermSearch;
 
   useEffect(() => {
-    const url = `/api/v2/channel?view=system`;
-    get<IApiResponseChannelList>(url).then((json) => {
-      if (json.ok) {
-        const channel = json.data.rows.find(
-          (value) => value.name === "_System_Grammar_Term_zh-hans_"
-        );
-        setGrammarChannel(channel);
-      }
-    });
+    const name = "_System_Grammar_Term_zh-hans_";
+    fetchPublicChannels({ system: true, search: name, per_page: 20 }).then(
+      (res) =>
+        setGrammarChannel(res.data?.find((value) => value.name === name)),
+    );
   }, []);
 
   useEffect(() => {
@@ -239,7 +230,7 @@ const GrammarBookWidget = () => {
         )}
       </div>
       <TermModal
-        parentChannelId={grammarChannel?.uid}
+        parentChannelId={grammarChannel?.id}
         tags={[":collection:"]}
         open={create}
         onClose={() => setCreate(false)}

+ 2 - 6
dashboard-v6/src/features/teamspace/scope.ts

@@ -24,7 +24,6 @@ const PERSONAL_ONLY = [
 const NOT_YET_SUPPORTED = [
   "workspace.article",
   "workspace.anthology",
-  "workspace.channel",
   "workspace.term",
   "workspace.course",
   "workspace.task",
@@ -36,10 +35,7 @@ const NOT_YET_SUPPORTED = [
 const TEAMSPACE_ONLY = ["workspace.members"];
 
 export type TeamspaceAvailability =
-  | "available"
-  | "personal"
-  | "unsupported"
-  | "teamspace-only";
+  "available" | "personal" | "unsupported" | "teamspace-only";
 
 const matches = (routeId: string, list: string[]) =>
   list.some((id) => routeId === id || routeId.startsWith(id + "."));
@@ -47,7 +43,7 @@ const matches = (routeId: string, list: string[]) =>
 /** 某个路由在当前空间(个人 / 团队)下能不能用;没有 id 的路由一律可用 */
 export function teamspaceAvailability(
   routeId: string | undefined,
-  isTeamspace: boolean
+  isTeamspace: boolean,
 ): TeamspaceAvailability {
   if (!routeId) {
     return "available";

+ 5 - 4
dashboard-v6/src/hooks/useActiveStudio.ts

@@ -1,12 +1,11 @@
 import { useAppSelector } from "../hooks";
-import {
-  currentStudio,
-  currentUser,
-} from "../reducers/current-user";
+import { currentStudio, currentUser } from "../reducers/current-user";
 
 /**
  * 当前「以谁的名义」浏览资源:团队空间里是 group,否则是登录用户本人。
  *
+ * `studioId` 给 v3 接口(`/v3/studios/{studio}/…` 一律 uuid);
+ *
  * `studioName` 直接传给 v2 接口的 `studio` / `name` 参数——后端
  * `StudioApi::getIdByName()` 对用户认 username、对 group 认 uid,
  * 所以 group 这里取的是 `realName`(= group uid)。
@@ -16,6 +15,8 @@ export function useActiveStudio() {
   const teamspace = useAppSelector(currentStudio);
 
   return {
+    /** v3 接口用:用户 uuid,或团队空间里的团队 uuid */
+    studioId: teamspace ? teamspace.id : user?.id,
     studioName: teamspace ? teamspace.realName : user?.realName,
     teamspace,
     isTeamspace: !!teamspace,

+ 72 - 9
dashboard-v6/src/pages/workspace/channel/list.tsx

@@ -1,26 +1,89 @@
-import { useNavigate } from "react-router";
+import { useNavigate, useSearchParams } from "react-router";
 import { useIntl } from "react-intl";
 
-import ChannelTable from "../../../components/channel/ChannelTable";
+import ChannelTable, {
+  CHANNEL_LIST,
+  type IChannelListQuery,
+} from "../../../components/channel/ChannelTable";
+import { loadPageSize } from "../../../utils/pageSize";
 import type { IChannel } from "../../../api/channel";
 import { useActiveStudio } from "../../../hooks/useActiveStudio";
 
+const TABS: IChannelListQuery["tab"][] = ["my", "collaboration", "community"];
+const ORDERS: NonNullable<IChannelListQuery["order"]>[] = [
+  "created_at",
+  "updated_at",
+  "name",
+  "progress",
+];
+
+/**
+ * 工作区的 channel 列表。页签、页码、每页条数、关键字、协作者、排序都放在 URL 里,
+ * 刷新(F5)或分享链接都能回到同一个视图。每页条数另记在 localStorage:URL 没带时用记下的值,
+ * 等于记下的值时也不写进 URL。
+ * `?tab=collaboration&page=2&pagesize=20&q=pali&collaborator=<uuid>&order=created_at&dir=asc`
+ */
 const Widget = () => {
-  const { studioName } = useActiveStudio();
+  const { studioId, studioName } = useActiveStudio();
   const navigate = useNavigate();
   const intl = useIntl();
-  console.debug("channel list", studioName);
+  const [searchParams, setSearchParams] = useSearchParams();
+
+  const defaultPageSize = loadPageSize(CHANNEL_LIST);
+  const tab = searchParams.get("tab") as IChannelListQuery["tab"];
+  const order = searchParams.get("order") as IChannelListQuery["order"];
+  const query: IChannelListQuery = {
+    tab: TABS.includes(tab) ? tab : "my",
+    page: Math.max(1, Number(searchParams.get("page")) || 1),
+    pageSize: Math.max(
+      1,
+      Number(searchParams.get("pagesize")) || defaultPageSize,
+    ),
+    q: searchParams.get("q") || undefined,
+    collaborator: searchParams.get("collaborator") || undefined,
+    order: order && ORDERS.includes(order) ? order : undefined,
+    dir: searchParams.get("dir") === "asc" ? "asc" : order ? "desc" : undefined,
+  };
+
+  const handleQueryChange = (next: Partial<IChannelListQuery>) => {
+    setSearchParams((prev) => {
+      const params = new URLSearchParams(prev);
+      const merged = { ...query, ...next };
+      // 改每页条数时 ChannelTable 已把新值记进 localStorage,这里再读就是新的默认值
+      const savedPageSize = loadPageSize(CHANNEL_LIST);
+      const values: Record<string, string | undefined> = {
+        tab: merged.tab === "my" ? undefined : merged.tab,
+        page: merged.page > 1 ? String(merged.page) : undefined,
+        pagesize:
+          merged.pageSize !== savedPageSize
+            ? String(merged.pageSize)
+            : undefined,
+        q: merged.q,
+        collaborator: merged.collaborator,
+        order: merged.order,
+        dir: merged.order ? merged.dir : undefined,
+      };
+      // 默认值不写进 URL,地址栏保持干净
+      Object.entries(values).forEach(([key, value]) =>
+        value ? params.set(key, value) : params.delete(key),
+      );
+      return params;
+    });
+  };
+
   return (
     <>
       <title>
         {intl.formatMessage({ id: "columns.studio.channel.title" })}
       </title>
       <ChannelTable
-      studioName={studioName}
-      onSelect={(channel: IChannel) => {
-        const url = `/workspace/channel/${channel.id}`;
-        navigate(url);
-      }}
+        query={query}
+        onQueryChange={handleQueryChange}
+        studioId={studioId}
+        studioName={studioName}
+        onSelect={(channel: IChannel) => {
+          navigate(`/workspace/channel/${channel.id}`);
+        }}
       />
     </>
   );

+ 4 - 13
dashboard-v6/src/pages/workspace/channel/setting.tsx

@@ -10,8 +10,7 @@ import Edit from "../../../components/channel/Edit";
 import WebhookList from "../../../components/webhook/WebhookList";
 import WebhookEdit from "../../../components/webhook/WebhookEdit";
 import { EResType } from "../../../components/share/utils";
-import type { IApiResponseChannelData } from "../../../api/channel";
-import { useActiveStudio } from "../../../hooks/useActiveStudio";
+import type { Channel } from "../../../api/channel";
 
 const Widget = () => {
   const intl = useIntl();
@@ -23,7 +22,6 @@ const Widget = () => {
     id: "columns.studio.channel.title",
   });
   const navigate = useNavigate();
-  const { studioName } = useActiveStudio();
 
   return (
     <>
@@ -50,9 +48,7 @@ const Widget = () => {
           size="small"
           defaultActiveKey={type}
           onChange={(activeKey: string) => {
-            navigate(
-              `/studio/${studioName}/channel/${channelId}/setting/${activeKey}`
-            );
+            navigate(`/workspace/channel/${channelId}/setting/${activeKey}`);
           }}
           items={[
             {
@@ -60,11 +56,8 @@ const Widget = () => {
               key: "basic",
               children: (
                 <Edit
-                  studioName={studioName}
                   channelId={channelId}
-                  onLoad={(data: IApiResponseChannelData) =>
-                    setTitle(data.name)
-                  }
+                  onLoad={(data: Channel) => setTitle(data.name ?? "")}
                 />
               ),
             },
@@ -74,14 +67,12 @@ const Widget = () => {
               children: id ? (
                 id === "new" ? (
                   <WebhookEdit
-                    studioName={studioName}
                     channelId={channelId}
                     res_type="channel"
                     res_id={channelId}
                   />
                 ) : (
                   <WebhookEdit
-                    studioName={studioName}
                     channelId={channelId}
                     id={id}
                     res_type="channel"
@@ -89,7 +80,7 @@ const Widget = () => {
                   />
                 )
               ) : (
-                <WebhookList studioName={studioName} channelId={channelId} />
+                <WebhookList channelId={channelId} />
               ),
             },
           ]}

+ 5 - 8
dashboard-v6/src/pages/workspace/channel/show.tsx

@@ -4,15 +4,13 @@ import { useIntl } from "react-intl";
 import { Button, Card, Space, Tabs } from "antd";
 import { ExportOutlined, TeamOutlined } from "@ant-design/icons";
 
-import { get } from "../../../request";
-
 import ChapterInChannelList from "../../../components/channel/ChapterInChannelList";
 import ShareModal from "../../../components/share/ShareModal";
 
 import { articlePath, fullUrl } from "../../../utils";
 import type { IArticleParam } from "../../../types/article";
 import { EResType } from "../../../components/share/utils";
-import type { IApiResponseChannel } from "../../../api/channel";
+import { fetchChannel } from "../../../api/channel";
 import TermList from "../../../components/term/TermList";
 
 const Widget = () => {
@@ -27,10 +25,9 @@ const Widget = () => {
   //const [param, setParam] = useState<IArticleParam>();
 
   useEffect(() => {
-    get<IApiResponseChannel>(`/api/v2/channel/${channelId}`).then((json) => {
-      console.debug("channel fetch", json.data);
-      setTitle(json.data.name);
-    });
+    if (channelId) {
+      fetchChannel(channelId).then((channel) => setTitle(channel?.name));
+    }
   }, [channelId]);
   return (
     <>
@@ -75,7 +72,7 @@ const Widget = () => {
                   channelId={channelId}
                   onSelect={(
                     event: React.MouseEvent<HTMLElement, MouseEvent>,
-                    chapter: IArticleParam
+                    chapter: IArticleParam,
                   ) => {
                     if (event.ctrlKey || event.metaKey) {
                       let url = `${articlePath(chapter.type, chapter.articleId)}?mode=`;

+ 2 - 2
dashboard-v6/src/pages/workspace/course/edit.tsx

@@ -13,7 +13,7 @@ import { useActiveStudio } from "../../../hooks/useActiveStudio";
 const Widget = () => {
   const intl = useIntl();
   const { courseId } = useParams(); //url 参数
-  const { studioName } = useActiveStudio();
+  const { studioId } = useActiveStudio();
   const [title, setTitle] = useState("loading");
   const [selected, setSelected] = useState<string>();
   const courseTitle = intl.formatMessage({
@@ -33,7 +33,7 @@ const Widget = () => {
               label: intl.formatMessage({ id: "course.basic.info.label" }),
               children: (
                 <CourseInfoEdit
-                  studioName={studioName}
+                  studioId={studioId}
                   courseId={courseId}
                   onTitleChange={(title: string) => {
                     setTitle(title);

+ 26 - 0
dashboard-v6/src/utils/pageSize.ts

@@ -0,0 +1,26 @@
+/**
+ * 列表「每页条数」的本地记忆(localStorage,键 `pagesize/<列表名>`)。
+ *
+ * 用户改过一次,下次打开同一个列表沿用;URL 里显式带了 pagesize 时以 URL 为准。
+ * 读写失败(隐私模式、存储被禁用)时静默退回默认值,不影响列表本身。
+ */
+const keyOf = (list: string) => `pagesize/${list}`;
+
+export function loadPageSize(list: string, fallback = 20): number {
+  try {
+    const value = Number(localStorage.getItem(keyOf(list)));
+    return Number.isInteger(value) && value > 0 && value <= 200
+      ? value
+      : fallback;
+  } catch {
+    return fallback;
+  }
+}
+
+export function savePageSize(list: string, size: number): void {
+  try {
+    localStorage.setItem(keyOf(list), String(size));
+  } catch {
+    // 存不了就算了:只是少了记忆
+  }
+}

+ 14 - 0
openapi/public/assets/protocol/main.yaml

@@ -707,6 +707,14 @@ paths:
     $ref: ./resources/auto/v3-agent-quota.yaml
   /v3/agent-traces:
     $ref: ./resources/auto/v3-agent-traces.yaml
+  /v3/channels:
+    $ref: ./resources/auto/v3-channels.yaml
+  /v3/channels/batch-progress:
+    $ref: ./resources/auto/v3-channels-batch-progress.yaml
+  /v3/channels/editable:
+    $ref: ./resources/auto/v3-channels-editable.yaml
+  '/v3/channels/{channel}':
+    $ref: ./resources/auto/v3-channels-channel.yaml
   /v3/credit-policy:
     $ref: ./resources/auto/v3-credit-policy.yaml
   /v3/discussions:
@@ -773,12 +781,18 @@ paths:
     $ref: ./resources/auto/v3-search-search.yaml
   /v3/sessions:
     $ref: ./resources/auto/v3-sessions.yaml
+  '/v3/studios/{studio}/channels':
+    $ref: ./resources/auto/v3-studios-studio-channels.yaml
+  /v3/tipitaka-channels:
+    $ref: ./resources/auto/v3-tipitaka-channels.yaml
   '/v3/tipitaka-chapter-channels/{book}/{para}':
     $ref: ./resources/auto/v3-tipitaka-chapter-channels-book-para.yaml
   /v3/tipitaka-chapters:
     $ref: ./resources/auto/v3-tipitaka-chapters.yaml
   '/v3/tipitaka-discussions/{channel}':
     $ref: ./resources/auto/v3-tipitaka-discussions-channel.yaml
+  '/v3/tipitaka-paragraph-channels/{book}/{para}':
+    $ref: ./resources/auto/v3-tipitaka-paragraph-channels-book-para.yaml
   '/v3/tipitaka-reading/{channel}':
     $ref: ./resources/auto/v3-tipitaka-reading-channel.yaml
   /v3/tipitaka-related-paragraphs:

+ 18 - 2
openapi/public/assets/protocol/overrides/v2-channel-channel.yaml

@@ -1,6 +1,9 @@
-# 手写补充:GET /v2/channel/{channel} 的 data 逐字段类型(对齐移动端 ChannelInfo)。
-# 只补 get 的响应,put/patch/delete 保持自动生成结果。
+# 手写补充:GET /v2/channel/{channel} 的 data 逐字段类型(对齐移动端 ChannelInfo);
+# 2026-11-16 起整条已被 v3 取代。
 get:
+  deprecated: true
+  description: |
+    已被 `GET /v3/channels/{channel}` 取代(带 `abilities`、拥有者可以是团队)。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
   responses:
     200:
       content:
@@ -36,3 +39,16 @@ get:
                         type: string
                       avatar:
                         type: string
+put:
+  deprecated: true
+  description: |
+    已被 `PATCH /v3/channels/{channel}`(局部更新)取代。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
+patch:
+  deprecated: true
+  description: |
+    已被 `PATCH /v3/channels/{channel}`(局部更新)取代。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
+delete:
+  deprecated: true
+  description: |
+    已被 `DELETE /v3/channels/{channel}`(软删除)取代。2026-11-16 起两边都是软删除。
+    保留仅为 dashboard-v4 兼容,待 v4 下线后删除。

+ 5 - 0
openapi/public/assets/protocol/overrides/v2-channel-my-number.yaml

@@ -0,0 +1,5 @@
+# 手写补充:已被 v3 取代(2026-11-16)。
+get:
+  deprecated: true
+  description: |
+    改读 `GET /v3/studios/{studio}/channels?relation=own|shared` 的 `meta.total`。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。

+ 5 - 0
openapi/public/assets/protocol/overrides/v2-channel-progress.yaml

@@ -0,0 +1,5 @@
+# 手写补充:已被 v3 取代(2026-11-16)。
+post:
+  deprecated: true
+  description: |
+    已被 `POST /v3/channels/batch-progress` 取代(`owner=all|my` 改为可选的 `studio`)。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。

+ 15 - 0
openapi/public/assets/protocol/overrides/v2-channel.yaml

@@ -0,0 +1,15 @@
+# 手写补充:v2 channel 列表与新建已被 v3 取代(2026-11-16)。
+get:
+  deprecated: true
+  description: |
+    各 view 的去向:
+    - `public` / `system` → `GET /v3/channels`(`system=true`)
+    - `studio`(含 `view2`、`collaborator`)/ `studio-all` → `GET /v3/studios/{studio}/channels?relation=own|shared|all`
+    - `user-edit` → `GET /v3/channels/editable`(搜索参数是 `search`)
+    - `paragraphs` → `GET /v3/tipitaka-paragraph-channels/{book}/{para}`
+    - `id`、`user-in-chapter` 没有消费者,不迁
+    保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
+post:
+  deprecated: true
+  description: |
+    已被 `POST /v3/studios/{studio}/channels` 取代。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。

+ 13 - 18
openapi/public/assets/protocol/resources/auto/v2-channel-channel.yaml

@@ -4,10 +4,8 @@ get:
   tags:
     - channel
   operationId: get_api_v2_channel_channel_
-  description: |-
-    返回 channel 详情,附带所属 studio 与作者信息。
-
-    实现:`ChannelController@show`
+  description: |
+    已被 `GET /v3/channels/{channel}` 取代(带 `abilities`、拥有者可以是团队)。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
   parameters:
     -
       name: channel
@@ -56,16 +54,14 @@ get:
       $ref: '../../main.yaml#/components/responses/Unauthorized'
     422:
       $ref: '../../main.yaml#/components/responses/ValidationError'
+  deprecated: true
 put:
   summary: '整体更新 channel'
   tags:
     - channel
   operationId: put_api_v2_channel_channel_
-  description: |-
-    覆盖式更新,未传的字段会被写成 null;只改部分字段请用 PATCH /channel。
-    系统 channel 不可修改;非 owner 需要 30 以上的协作权限。
-
-    实现:`ChannelController@update`
+  description: |
+    已被 `PATCH /v3/channels/{channel}`(局部更新)取代。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
   parameters:
     -
       name: channel
@@ -128,16 +124,14 @@ put:
       $ref: '../../main.yaml#/components/responses/Unauthorized'
     422:
       $ref: '../../main.yaml#/components/responses/ValidationError'
+  deprecated: true
 patch:
   summary: '整体更新 channel'
   tags:
     - channel
   operationId: patch_api_v2_channel_channel_
-  description: |-
-    覆盖式更新,未传的字段会被写成 null;只改部分字段请用 PATCH /channel。
-    系统 channel 不可修改;非 owner 需要 30 以上的协作权限。
-
-    实现:`ChannelController@update`
+  description: |
+    已被 `PATCH /v3/channels/{channel}`(局部更新)取代。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
   parameters:
     -
       name: channel
@@ -200,15 +194,15 @@ patch:
       $ref: '../../main.yaml#/components/responses/Unauthorized'
     422:
       $ref: '../../main.yaml#/components/responses/ValidationError'
+  deprecated: true
 delete:
   summary: '删除 channel'
   tags:
     - channel
   operationId: delete_api_v2_channel_channel_
-  description: |-
-    只有 owner 可以删除。channel 下已有译文、术语或逐词解析数据时拒绝删除。
-
-    实现:`ChannelController@destroy`
+  description: |
+    已被 `DELETE /v3/channels/{channel}`(软删除)取代。2026-11-16 起两边都是软删除。
+    保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
   parameters:
     -
       name: channel
@@ -235,3 +229,4 @@ delete:
       $ref: '../../main.yaml#/components/responses/Unauthorized'
     422:
       $ref: '../../main.yaml#/components/responses/ValidationError'
+  deprecated: true

+ 3 - 1
openapi/public/assets/protocol/resources/auto/v2-channel-my-number.yaml

@@ -4,7 +4,8 @@ get:
   tags:
     - channel-my-number
   operationId: get_api_v2_channel_my_number
-  description: 实现:`ChannelController@showMyNumber`
+  description: |
+    改读 `GET /v3/studios/{studio}/channels?relation=own|shared` 的 `meta.total`。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
   parameters:
     -
       name: studio
@@ -29,3 +30,4 @@ get:
       $ref: '../../main.yaml#/components/responses/Unauthorized'
     422:
       $ref: '../../main.yaml#/components/responses/ValidationError'
+  deprecated: true

+ 3 - 1
openapi/public/assets/protocol/resources/auto/v2-channel-progress.yaml

@@ -4,7 +4,8 @@ post:
   tags:
     - channel-progress
   operationId: post_api_v2_channel_progress
-  description: 实现:`ChannelController@progress`
+  description: |
+    已被 `POST /v3/channels/batch-progress` 取代(`owner=all|my` 改为可选的 `studio`)。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
   requestBody:
     required: false
     content:
@@ -34,3 +35,4 @@ post:
       $ref: '../../main.yaml#/components/responses/Unauthorized'
     422:
       $ref: '../../main.yaml#/components/responses/ValidationError'
+  deprecated: true

+ 12 - 10
openapi/public/assets/protocol/resources/auto/v2-channel.yaml

@@ -4,11 +4,14 @@ get:
   tags:
     - channel
   operationId: get_api_v2_channel
-  description: |-
-    按 view 指定的口径返回 channel 列表,支持关键字搜索、分页、排序。
-    需要登录的口径:studio、studio-all、user-edit、user-in-chapter。
-
-    实现:`ChannelController@index`
+  description: |
+    各 view 的去向:
+    - `public` / `system` → `GET /v3/channels`(`system=true`)
+    - `studio`(含 `view2`、`collaborator`)/ `studio-all` → `GET /v3/studios/{studio}/channels?relation=own|shared|all`
+    - `user-edit` → `GET /v3/channels/editable`(搜索参数是 `search`)
+    - `paragraphs` → `GET /v3/tipitaka-paragraph-channels/{book}/{para}`
+    - `id`、`user-in-chapter` 没有消费者,不迁
+    保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
   parameters:
     -
       name: book
@@ -153,16 +156,14 @@ get:
       $ref: '../../main.yaml#/components/responses/Unauthorized'
     422:
       $ref: '../../main.yaml#/components/responses/ValidationError'
+  deprecated: true
 post:
   summary: '新建 channel'
   tags:
     - channel
   operationId: post_api_v2_channel
-  description: |-
-    在指定 studio 下新建译文集。同一 studio 内不允许重名。
-    调用者必须对该 studio 有管理权限。
-
-    实现:`ChannelController@store`
+  description: |
+    已被 `POST /v3/studios/{studio}/channels` 取代。保留仅为 dashboard-v4 兼容,待 v4 下线后删除。
   requestBody:
     required: true
     content:
@@ -206,6 +207,7 @@ post:
       $ref: '../../main.yaml#/components/responses/Unauthorized'
     422:
       $ref: '../../main.yaml#/components/responses/ValidationError'
+  deprecated: true
 patch:
   summary: '局部更新 channel'
   tags:

+ 93 - 0
openapi/public/assets/protocol/resources/auto/v3-channels-batch-progress.yaml

@@ -0,0 +1,93 @@
+# 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-channels-batch-progress.yaml
+post:
+  summary: '查一批句子在各 channel 的完成度'
+  tags:
+    - channels
+  operationId: post_api_v3_channels_batch_progress
+  description: |-
+    列出这些句子上有译文且看得见的 channel,加上我能写的 channel(没译文也列)。
+    给了 `studio` 只列该 studio 名下的。不登录只看得到公开的。
+
+    实现:`V3\ChannelBatchProgressController@__invoke`
+  security:
+    - {  }
+    -
+      bearerAuth: []
+  requestBody:
+    required: true
+    content:
+      application/json:
+        schema:
+          type: object
+          properties:
+            sentences:
+              type: array
+              description: '句子 id 列表,`book-para-wordStart-wordEnd`,最多 2000 个'
+            studio:
+              type: string
+              description: '只看这个 studio(用户或团队 uuid)名下的'
+          required:
+            - sentences
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: array
+                items:
+                  type: object
+                  properties:
+                    id:
+                      type: string
+                    name:
+                      type: string
+                    summary:
+                      type: string
+                      nullable: true
+                    type:
+                      type: string
+                    lang:
+                      type: string
+                    status:
+                      type: integer
+                    is_system:
+                      type: boolean
+                    source_type:
+                      type: string
+                    source_id:
+                      type: string
+                      nullable: true
+                    owner:
+                      type: object
+                      properties: { kind: { type: string }, id: { type: string }, nickName: { type: string }, realName: { type: string }, avatar: { type: string, nullable: true } }
+                    abilities:
+                      type: object
+                      properties: { read: { type: boolean }, write: { type: boolean }, update: { type: boolean }, delete: { type: boolean } }
+                    final:
+                      type: array
+                      items: { type: string }
+                      nullable: true
+                    content_created_at:
+                      type: string
+                      nullable: true
+                    content_updated_at:
+                      type: string
+                      nullable: true
+                    created_at:
+                      type: string
+                    updated_at:
+                      type: string
+              meta:
+                $ref: '../../main.yaml#/components/schemas/PaginationMeta'
+    403:
+      description: '给了 studio,但不能查看它'
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'

+ 302 - 0
openapi/public/assets/protocol/resources/auto/v3-channels-channel.yaml

@@ -0,0 +1,302 @@
+# 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-channels-channel.yaml
+get:
+  summary: 'channel 详情'
+  tags:
+    - channels
+  operationId: get_api_v3_channels_channel_
+  description: |-
+    公开的谁都能看;私有的只有拥有者、团队成员、被共享的人能看。带查看者的 `abilities`。
+
+    实现:`V3\ChannelController@show`
+  security:
+    - {  }
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: channel
+      in: path
+      required: true
+      schema:
+        type: string
+      description: 'channel uid'
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: object
+                properties:
+                  id:
+                    type: string
+                  name:
+                    type: string
+                  summary:
+                    type: string
+                    nullable: true
+                  type:
+                    type: string
+                  lang:
+                    type: string
+                  status:
+                    type: integer
+                  is_system:
+                    type: boolean
+                  source_type:
+                    type: string
+                  source_id:
+                    type: string
+                    nullable: true
+                  owner:
+                    type: object
+                    properties:
+                      kind: { type: string }
+                      id: { type: string }
+                      nickName: { type: string }
+                      realName: { type: string }
+                      avatar: { type: string, nullable: true }
+                  abilities:
+                    type: object
+                    properties:
+                      read: { type: boolean }
+                      write: { type: boolean }
+                      update: { type: boolean }
+                      delete: { type: boolean }
+                  progress:
+                    type: number
+                    nullable: true
+                    description: 仅在部分查询口径下返回。
+                  created_at:
+                    type: string
+                  updated_at:
+                    type: string
+    403:
+      description: '私有 channel,且看不见'
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'
+delete:
+  summary: '删除 channel'
+  tags:
+    - channels
+  operationId: delete_api_v3_channels_channel_
+  description: |-
+    软删除,返回被删的 channel。个人 channel 由拥有者删,团队的只有团队 owner 能删。
+    channel 下已有译文、术语或逐词时拒绝(409,`content` 列出有哪几类)。系统 channel 不能删。
+
+    实现:`V3\ChannelController@destroy`
+  security:
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: channel
+      in: path
+      required: true
+      schema:
+        type: string
+      description: 'channel uid'
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: object
+                properties:
+                  id:
+                    type: string
+                  name:
+                    type: string
+                  summary:
+                    type: string
+                    nullable: true
+                  type:
+                    type: string
+                  lang:
+                    type: string
+                  status:
+                    type: integer
+                  is_system:
+                    type: boolean
+                  source_type:
+                    type: string
+                  source_id:
+                    type: string
+                    nullable: true
+                  owner:
+                    type: object
+                    properties:
+                      kind: { type: string }
+                      id: { type: string }
+                      nickName: { type: string }
+                      realName: { type: string }
+                      avatar: { type: string, nullable: true }
+                  abilities:
+                    type: object
+                    properties:
+                      read: { type: boolean }
+                      write: { type: boolean }
+                      update: { type: boolean }
+                      delete: { type: boolean }
+                  progress:
+                    type: number
+                    nullable: true
+                    description: 仅在部分查询口径下返回。
+                  created_at:
+                    type: string
+                  updated_at:
+                    type: string
+    401:
+      $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
+    403:
+      description: 不能删除
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    409:
+      description: 'channel 下还有内容'
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'
+patch:
+  summary: '改 channel 信息'
+  tags:
+    - channels
+  operationId: patch_api_v3_channels_channel_
+  description: |-
+    只改传了的字段。拥有者;团队的 channel 由团队 owner / manager / editor 改;共享权限 ≥30 也能改。
+    系统 channel 不能改。AI 模型不能改。
+
+    实现:`V3\ChannelController@update`
+  security:
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: channel
+      in: path
+      required: true
+      schema:
+        type: string
+      description: 'channel uid'
+  requestBody:
+    required: false
+    content:
+      application/json:
+        schema:
+          type: object
+          properties:
+            name:
+              type: string
+              description: '名字,最长 128;同一 studio 内不能重名'
+            type:
+              type: string
+              description: 类型
+              enum:
+                - translation
+                - nissaya
+                - original
+                - wbw
+                - commentary
+                - similar
+            lang:
+              type: string
+              description: '语言,最长 16'
+            summary:
+              type: string
+              description: '简介,最长 1024'
+            status:
+              type: integer
+              description: '10 私有、20 公开不列出(拿到链接能看,不进任何公开列表)、30 公开'
+            source_type:
+              type: string
+              description: 来源
+              enum:
+                - original
+                - reprint
+                - ai
+            source_id:
+              type: string
+              description: '来源 id'
+            config:
+              type: object
+              description: 配置
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: object
+                properties:
+                  id:
+                    type: string
+                  name:
+                    type: string
+                  summary:
+                    type: string
+                    nullable: true
+                  type:
+                    type: string
+                  lang:
+                    type: string
+                  status:
+                    type: integer
+                  is_system:
+                    type: boolean
+                  source_type:
+                    type: string
+                  source_id:
+                    type: string
+                    nullable: true
+                  owner:
+                    type: object
+                    properties:
+                      kind: { type: string }
+                      id: { type: string }
+                      nickName: { type: string }
+                      realName: { type: string }
+                      avatar: { type: string, nullable: true }
+                  abilities:
+                    type: object
+                    properties:
+                      read: { type: boolean }
+                      write: { type: boolean }
+                      update: { type: boolean }
+                      delete: { type: boolean }
+                  progress:
+                    type: number
+                    nullable: true
+                    description: 仅在部分查询口径下返回。
+                  created_at:
+                    type: string
+                  updated_at:
+                    type: string
+    401:
+      $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
+    403:
+      description: 不能修改
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'

+ 137 - 0
openapi/public/assets/protocol/resources/auto/v3-channels-editable.yaml

@@ -0,0 +1,137 @@
+# 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-channels-editable.yaml
+get:
+  summary: '列出我能写的 channel'
+  tags:
+    - channels
+  operationId: get_api_v3_channels_editable
+  description: 实现:`V3\EditableChannelController@__invoke`
+  security:
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: per_page
+      in: query
+      schema:
+        type: integer
+        default: 20
+      description: '每页数量,最大 200'
+    -
+      name: search
+      in: query
+      schema:
+        type: string
+      description: 按名字模糊匹配
+    -
+      name: type
+      in: query
+      schema:
+        type: string
+        enum:
+          - translation
+          - nissaya
+          - original
+          - wbw
+          - commentary
+          - similar
+      description: 'channel 类型'
+    -
+      name: lang
+      in: query
+      schema:
+        type: string
+      description: 语言
+    -
+      name: book
+      in: query
+      schema:
+        type: integer
+      description: '章节所在的书(与 para 同时给)'
+    -
+      name: para
+      in: query
+      schema:
+        type: integer
+      description: '章节起始段(与 book 同时给)'
+    -
+      name: order
+      in: query
+      schema:
+        type: string
+        enum:
+          - updated_at
+          - created_at
+          - name
+          - progress
+        default: updated_at
+      description: 排序字段
+    -
+      name: dir
+      in: query
+      schema:
+        type: string
+        enum:
+          - asc
+          - desc
+        default: desc
+      description: 排序方向
+    -
+      name: page
+      in: query
+      schema:
+        type: integer
+        default: 1
+      description: 页码
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: array
+                items:
+                  type: object
+                  properties:
+                    id:
+                      type: string
+                    name:
+                      type: string
+                    summary:
+                      type: string
+                      nullable: true
+                    type:
+                      type: string
+                    lang:
+                      type: string
+                    status:
+                      type: integer
+                    is_system:
+                      type: boolean
+                    source_type:
+                      type: string
+                    source_id:
+                      type: string
+                      nullable: true
+                    owner:
+                      type: object
+                      properties: { kind: { type: string }, id: { type: string }, nickName: { type: string }, realName: { type: string }, avatar: { type: string, nullable: true } }
+                    abilities:
+                      type: object
+                      properties: { read: { type: boolean }, write: { type: boolean }, update: { type: boolean }, delete: { type: boolean } }
+                    progress:
+                      type: number
+                      nullable: true
+                      description: 仅在部分查询口径下返回。
+                    created_at:
+                      type: string
+                    updated_at:
+                      type: string
+              meta:
+                $ref: '../../main.yaml#/components/schemas/PaginationMeta'
+    401:
+      $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'

+ 147 - 0
openapi/public/assets/protocol/resources/auto/v3-channels.yaml

@@ -0,0 +1,147 @@
+# 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-channels.yaml
+get:
+  summary: '公开 channel 目录'
+  tags:
+    - channels
+  operationId: get_api_v3_channels
+  description: |-
+    只列全网公开的。`system=true` 只要系统 channel——系统 channel 是全站共用的原文、术语等,
+    不论 status 都列(巴利原文 `_System_Pali_VRI_` 就是 status 10)。带 `book` + `para` 时每条多返回该章的完成度
+    `progress`,并可按它排序。
+
+    实现:`V3\ChannelController@index`
+  security:
+    - {  }
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: system
+      in: query
+      schema:
+        type: boolean
+      description: '只列系统 channel'
+    -
+      name: per_page
+      in: query
+      schema:
+        type: integer
+        default: 20
+      description: '每页数量,最大 200'
+    -
+      name: search
+      in: query
+      schema:
+        type: string
+      description: 按名字模糊匹配
+    -
+      name: type
+      in: query
+      schema:
+        type: string
+        enum:
+          - translation
+          - nissaya
+          - original
+          - wbw
+          - commentary
+          - similar
+      description: 'channel 类型'
+    -
+      name: lang
+      in: query
+      schema:
+        type: string
+      description: 语言
+    -
+      name: book
+      in: query
+      schema:
+        type: integer
+      description: '章节所在的书(与 para 同时给)'
+    -
+      name: para
+      in: query
+      schema:
+        type: integer
+      description: '章节起始段(与 book 同时给)'
+    -
+      name: order
+      in: query
+      schema:
+        type: string
+        enum:
+          - updated_at
+          - created_at
+          - name
+          - progress
+        default: updated_at
+      description: 排序字段
+    -
+      name: dir
+      in: query
+      schema:
+        type: string
+        enum:
+          - asc
+          - desc
+        default: desc
+      description: 排序方向
+    -
+      name: page
+      in: query
+      schema:
+        type: integer
+        default: 1
+      description: 页码
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: array
+                items:
+                  type: object
+                  properties:
+                    id:
+                      type: string
+                    name:
+                      type: string
+                    summary:
+                      type: string
+                      nullable: true
+                    type:
+                      type: string
+                    lang:
+                      type: string
+                    status:
+                      type: integer
+                    is_system:
+                      type: boolean
+                    source_type:
+                      type: string
+                    source_id:
+                      type: string
+                      nullable: true
+                    owner:
+                      type: object
+                      properties: { kind: { type: string }, id: { type: string }, nickName: { type: string }, realName: { type: string }, avatar: { type: string, nullable: true } }
+                    abilities:
+                      type: object
+                      properties: { read: { type: boolean }, write: { type: boolean }, update: { type: boolean }, delete: { type: boolean } }
+                    progress:
+                      type: number
+                      nullable: true
+                      description: 仅在部分查询口径下返回。
+                    created_at:
+                      type: string
+                    updated_at:
+                      type: string
+              meta:
+                $ref: '../../main.yaml#/components/schemas/PaginationMeta'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'

+ 9 - 0
openapi/public/assets/protocol/resources/auto/v3-search-search.yaml

@@ -6,6 +6,9 @@ get:
   operationId: get_api_v3_search_search_
   description: |-
     直接从 OpenSearch 按文档 id 取回,不走检索。取不到返回 404。
+    整章正文文档(`tipitaka_chapter_{book}-{para}_{channel}`)按它所属 channel 判权限:
+    私有 channel 只有拥有者、团队成员、被共享的人能读(要带 token)。索引里收了所有 channel,
+    不在这里挡的话拼出 id 就能读到私有正文。
 
     实现:`V3\SearchPlusController@show`
   security:
@@ -30,5 +33,11 @@ get:
             properties:
               data:
                 type: object
+    403:
+      description: '整章正文所属的 channel 是私有的,且当前身份看不见'
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
     422:
       $ref: '../../main.yaml#/components/responses/ProblemValidation'

+ 352 - 0
openapi/public/assets/protocol/resources/auto/v3-studios-studio-channels.yaml

@@ -0,0 +1,352 @@
+# 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-studios-studio-channels.yaml
+get:
+  summary: '列出 studio 的 channel'
+  tags:
+    - studios
+  operationId: get_api_v3_studios_studio_channels
+  description: |-
+    只有本人,或该团队的成员能看。`relation`:own 它名下的(默认),shared 直接共享给它的
+    (个人空间不含经团队转来的——团队的在团队空间里看),all 两者合起来。
+
+    实现:`V3\StudioChannelController@index`
+  security:
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: studio
+      in: path
+      required: true
+      schema:
+        type: string
+      description: '用户 uuid 或团队 uuid'
+    -
+      name: per_page
+      in: query
+      schema:
+        type: integer
+        default: 20
+      description: '每页数量,最大 200'
+    -
+      name: relation
+      in: query
+      schema:
+        type: string
+        enum:
+          - own
+          - shared
+          - all
+        default: own
+      description: 关系
+    -
+      name: collaborator
+      in: query
+      schema:
+        type: string
+      description: 只看这个拥有者共享过来的(uuid)
+    -
+      name: search
+      in: query
+      schema:
+        type: string
+      description: 按名字模糊匹配
+    -
+      name: type
+      in: query
+      schema:
+        type: string
+        enum:
+          - translation
+          - nissaya
+          - original
+          - wbw
+          - commentary
+          - similar
+      description: 'channel 类型'
+    -
+      name: lang
+      in: query
+      schema:
+        type: string
+      description: 语言
+    -
+      name: book
+      in: query
+      schema:
+        type: integer
+      description: '章节所在的书(与 para 同时给)'
+    -
+      name: para
+      in: query
+      schema:
+        type: integer
+      description: '章节起始段(与 book 同时给)'
+    -
+      name: order
+      in: query
+      schema:
+        type: string
+        enum:
+          - updated_at
+          - created_at
+          - name
+          - progress
+        default: updated_at
+      description: 排序字段
+    -
+      name: dir
+      in: query
+      schema:
+        type: string
+        enum:
+          - asc
+          - desc
+        default: desc
+      description: 排序方向
+    -
+      name: page
+      in: query
+      schema:
+        type: integer
+        default: 1
+      description: 页码
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: array
+                items:
+                  type: object
+                  properties:
+                    id:
+                      type: string
+                    name:
+                      type: string
+                    summary:
+                      type: string
+                      nullable: true
+                    type:
+                      type: string
+                    lang:
+                      type: string
+                    status:
+                      type: integer
+                    is_system:
+                      type: boolean
+                    source_type:
+                      type: string
+                    source_id:
+                      type: string
+                      nullable: true
+                    owner:
+                      type: object
+                      properties: { kind: { type: string }, id: { type: string }, nickName: { type: string }, realName: { type: string }, avatar: { type: string, nullable: true } }
+                    abilities:
+                      type: object
+                      properties: { read: { type: boolean }, write: { type: boolean }, update: { type: boolean }, delete: { type: boolean } }
+                    progress:
+                      type: number
+                      nullable: true
+                      description: 仅在部分查询口径下返回。
+                    created_at:
+                      type: string
+                    updated_at:
+                      type: string
+              meta:
+                $ref: '../../main.yaml#/components/schemas/PaginationMeta'
+    401:
+      $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
+    403:
+      description: '不能查看这个 studio'
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'
+post:
+  summary: '在 studio 名下建 channel'
+  tags:
+    - studios
+  operationId: post_api_v3_studios_studio_channels
+  description: |-
+    本人名下,或团队名下(团队 owner / manager)。同一 studio 内不能重名。默认私有。AI 模型不能建。
+
+    实现:`V3\StudioChannelController@store`
+  security:
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: studio
+      in: path
+      required: true
+      schema:
+        type: string
+      description: '用户 uuid 或团队 uuid'
+  requestBody:
+    required: true
+    content:
+      application/json:
+        schema:
+          type: object
+          properties:
+            name:
+              type: string
+              description: '名字,最长 128'
+            type:
+              type: string
+              description: 类型
+              enum:
+                - translation
+                - nissaya
+                - original
+                - wbw
+                - commentary
+                - similar
+            lang:
+              type: string
+              description: '语言,最长 16'
+            summary:
+              type: string
+              description: '简介,最长 1024'
+            status:
+              type: integer
+              description: '10 私有、20 公开不列出(拿到链接能看,不进任何公开列表)、30 公开'
+              default: 10
+            source_type:
+              type: string
+              description: 来源
+              enum:
+                - original
+                - reprint
+                - ai
+            source_id:
+              type: string
+              description: '来源 id'
+          required:
+            - name
+            - type
+            - lang
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: object
+                properties:
+                  id:
+                    type: string
+                  name:
+                    type: string
+                  summary:
+                    type: string
+                    nullable: true
+                  type:
+                    type: string
+                  lang:
+                    type: string
+                  status:
+                    type: integer
+                  is_system:
+                    type: boolean
+                  source_type:
+                    type: string
+                  source_id:
+                    type: string
+                    nullable: true
+                  owner:
+                    type: object
+                    properties:
+                      kind: { type: string }
+                      id: { type: string }
+                      nickName: { type: string }
+                      realName: { type: string }
+                      avatar: { type: string, nullable: true }
+                  abilities:
+                    type: object
+                    properties:
+                      read: { type: boolean }
+                      write: { type: boolean }
+                      update: { type: boolean }
+                      delete: { type: boolean }
+                  progress:
+                    type: number
+                    nullable: true
+                    description: 仅在部分查询口径下返回。
+                  created_at:
+                    type: string
+                  updated_at:
+                    type: string
+    201:
+      description: 建好了
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: object
+                properties:
+                  id:
+                    type: string
+                  name:
+                    type: string
+                  summary:
+                    type: string
+                    nullable: true
+                  type:
+                    type: string
+                  lang:
+                    type: string
+                  status:
+                    type: integer
+                  is_system:
+                    type: boolean
+                  source_type:
+                    type: string
+                  source_id:
+                    type: string
+                    nullable: true
+                  owner:
+                    type: object
+                    properties:
+                      kind: { type: string }
+                      id: { type: string }
+                      nickName: { type: string }
+                      realName: { type: string }
+                      avatar: { type: string, nullable: true }
+                  abilities:
+                    type: object
+                    properties:
+                      read: { type: boolean }
+                      write: { type: boolean }
+                      update: { type: boolean }
+                      delete: { type: boolean }
+                  progress:
+                    type: number
+                    nullable: true
+                    description: 仅在部分查询口径下返回。
+                  created_at:
+                    type: string
+                  updated_at:
+                    type: string
+    401:
+      $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
+    403:
+      description: '不能在这个 studio 名下建'
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'

+ 105 - 0
openapi/public/assets/protocol/resources/auto/v3-tipitaka-channels.yaml

@@ -0,0 +1,105 @@
+# 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-tipitaka-channels.yaml
+get:
+  summary: '列出有译文的公开 channel'
+  tags:
+    - tipitaka-channels
+  operationId: get_api_v3_tipitaka_channels
+  description: |-
+    只列公开的、有完成度过门槛的章节的 channel,按章节数降序,每条带 `chapter_count`。
+
+    实现:`V3\TipitakaChannelController@__invoke`
+  security:
+    - {  }
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: per_page
+      in: query
+      schema:
+        type: integer
+        default: 20
+      description: '每页数量,最大 200'
+    -
+      name: type
+      in: query
+      schema:
+        type: string
+        enum:
+          - translation
+          - nissaya
+          - original
+          - wbw
+          - commentary
+          - similar
+      description: 'channel 类型'
+    -
+      name: lang
+      in: query
+      schema:
+        type: string
+      description: '译文语族(progress_chapters.lang,zh 涵盖简繁)'
+      example: zh
+    -
+      name: min_progress
+      in: query
+      schema:
+        type: number
+        default: 0.8
+      description: '章节完成度门槛 0–1'
+    -
+      name: page
+      in: query
+      schema:
+        type: integer
+        default: 1
+      description: 页码
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: array
+                items:
+                  type: object
+                  properties:
+                    id:
+                      type: string
+                    name:
+                      type: string
+                    summary:
+                      type: string
+                      nullable: true
+                    type:
+                      type: string
+                    lang:
+                      type: string
+                    status:
+                      type: integer
+                    is_system:
+                      type: boolean
+                    source_type:
+                      type: string
+                    source_id:
+                      type: string
+                      nullable: true
+                    owner:
+                      type: object
+                      properties: { kind: { type: string }, id: { type: string }, nickName: { type: string }, realName: { type: string }, avatar: { type: string, nullable: true } }
+                    abilities:
+                      type: object
+                      properties: { read: { type: boolean }, write: { type: boolean }, update: { type: boolean }, delete: { type: boolean } }
+                    chapter_count:
+                      type: integer
+                    created_at:
+                      type: string
+                    updated_at:
+                      type: string
+              meta:
+                $ref: '../../main.yaml#/components/schemas/PaginationMeta'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'

+ 94 - 0
openapi/public/assets/protocol/resources/auto/v3-tipitaka-paragraph-channels-book-para.yaml

@@ -0,0 +1,94 @@
+# 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-tipitaka-paragraph-channels-book-para.yaml
+get:
+  summary: '列出某段有内容的 channel'
+  tags:
+    - tipitaka-paragraph-channels
+  operationId: get_api_v3_tipitaka_paragraph_channels_book_para_
+  description: |-
+    最近更新的在前。不登录只看得到公开的。
+
+    实现:`V3\TipitakaParagraphChannelController@__invoke`
+  security:
+    - {  }
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: book
+      in: path
+      required: true
+      schema:
+        type: integer
+      description: 书
+    -
+      name: para
+      in: path
+      required: true
+      schema:
+        type: integer
+      description: 段
+    -
+      name: per_page
+      in: query
+      schema:
+        type: integer
+        default: 100
+      description: '每页数量,最大 200'
+    -
+      name: page
+      in: query
+      schema:
+        type: integer
+        default: 1
+      description: 页码
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: array
+                items:
+                  type: object
+                  properties:
+                    id:
+                      type: string
+                    name:
+                      type: string
+                    summary:
+                      type: string
+                      nullable: true
+                    type:
+                      type: string
+                    lang:
+                      type: string
+                    status:
+                      type: integer
+                    is_system:
+                      type: boolean
+                    source_type:
+                      type: string
+                    source_id:
+                      type: string
+                      nullable: true
+                    owner:
+                      type: object
+                      properties: { kind: { type: string }, id: { type: string }, nickName: { type: string }, realName: { type: string }, avatar: { type: string, nullable: true } }
+                    abilities:
+                      type: object
+                      properties: { read: { type: boolean }, write: { type: boolean }, update: { type: boolean }, delete: { type: boolean } }
+                    progress:
+                      type: number
+                      nullable: true
+                      description: 仅在部分查询口径下返回。
+                    created_at:
+                      type: string
+                    updated_at:
+                      type: string
+              meta:
+                $ref: '../../main.yaml#/components/schemas/PaginationMeta'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików