Skip to content

Commit c0369a4

Browse files
committed
Add MatrixLib developer API docs
1 parent b783e3a commit c0369a4

File tree

2 files changed

+107
-1
lines changed

2 files changed

+107
-1
lines changed

docs/matrixlib/developer-api.mdx

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: MatrixLib 开发者 API
3+
description: MatrixLib 面向开发者的公开 API 范围与 Javadoc 生成方式。
4+
---
5+
6+
# MatrixLib 开发者 API
7+
8+
MatrixLib 当前公开的开发者 API 主要集中在这些包:
9+
10+
- `com.y54895.matrixlib.api.action`
11+
- `com.y54895.matrixlib.api.brand`
12+
- `com.y54895.matrixlib.api.compat`
13+
- `com.y54895.matrixlib.api.console`
14+
- `com.y54895.matrixlib.api.economy`
15+
- `com.y54895.matrixlib.api.hologram`
16+
- `com.y54895.matrixlib.api.menu`
17+
- `com.y54895.matrixlib.api.metrics`
18+
- `com.y54895.matrixlib.api.resource`
19+
- `com.y54895.matrixlib.api.text`
20+
- `com.y54895.matrixlib.api.update`
21+
22+
## 代码树
23+
24+
当前 `MatrixLib` 代码树里,面向开发者的入口和内部支撑层大致是这样:
25+
26+
```text
27+
src/main/kotlin/com/y54895/matrixlib/
28+
├─ MatrixLib.kt
29+
├─ api/
30+
│ ├─ action/
31+
│ │ └─ ActionApi.kt
32+
│ ├─ brand/
33+
│ │ └─ MatrixBranding.kt
34+
│ ├─ compat/
35+
│ │ └─ CompatApi.kt
36+
│ ├─ console/
37+
│ │ └─ MatrixConsoleVisuals.kt
38+
│ ├─ economy/
39+
│ │ └─ MatrixEconomy.kt
40+
│ ├─ hologram/
41+
│ │ ├─ MatrixHologramRequest.kt
42+
│ │ ├─ MatrixHolograms.kt
43+
│ │ └─ internal/
44+
│ │ ├─ CMIHologramsAdapter.kt
45+
│ │ ├─ DecentHologramsAdapter.kt
46+
│ │ ├─ FancyHologramsAdapter.kt
47+
│ │ └─ MatrixHologramAdapter.kt
48+
│ ├─ menu/
49+
│ │ └─ MenuApi.kt
50+
│ ├─ metrics/
51+
│ │ └─ MatrixBStats.kt
52+
│ ├─ resource/
53+
│ │ └─ MatrixResourceFiles.kt
54+
│ ├─ text/
55+
│ │ ├─ MatrixText.kt
56+
│ │ └─ MatrixYamlBundle.kt
57+
│ └─ update/
58+
│ └─ MatrixPluginUpdates.kt
59+
├─ command/
60+
│ └─ MatrixLibCommands.kt
61+
└─ metrics/
62+
└─ BStatsMetrics.kt
63+
```
64+
65+
推荐约定:
66+
67+
- 业务插件开发时优先使用 `api/` 下的类型。
68+
- `api/hologram/internal/` 视为提供者桥接内部层,不建议下游直接依赖。
69+
- `command/``metrics/` 目录主要是 MatrixLib 自身运行时接入,不作为稳定业务 API。
70+
71+
## 生成 Javadoc
72+
73+
MatrixLib 使用 `Dokka Javadoc` 生成 Kotlin API 文档。
74+
75+
本地命令:
76+
77+
```bash
78+
cd /www/codex-work/MatrixLib
79+
bash ./gradlew generateJavadoc
80+
```
81+
82+
输出目录:
83+
84+
```text
85+
build/dokka/javadoc/
86+
```
87+
88+
构建产物:
89+
90+
```text
91+
build/libs/MatrixLib-<version>-javadoc.jar
92+
```
93+
94+
## 推荐阅读入口
95+
96+
- `MatrixBranding`
97+
- `MatrixText`
98+
- `MatrixYamlBundle`
99+
- `MenuLoader`
100+
- `MenuRenderer`
101+
- `MatrixEconomy`
102+
- `MatrixHolograms`
103+
- `MatrixBStats`
104+
- `MatrixPluginUpdates`

docs/matrixlib/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ slug: /matrixlib
2020
- 发布说明:[1.4.0 发布说明](/docs/matrixlib/release-notes-1-4-0)
2121
- 遥测说明:[bStats 与遥测](/docs/matrixlib/bstats-and-telemetry)
2222
- 更新器说明:[自动更新与审批](/docs/matrixlib/updater-and-approval)
23+
- 开发者 API:[开发者 API](/docs/matrixlib/developer-api)
2324

2425
## 推荐阅读
2526

2627
1. [1.4.0 发布说明](/docs/matrixlib/release-notes-1-4-0)
2728
2. [自动更新与审批](/docs/matrixlib/updater-and-approval)
28-
3. [bStats 与遥测](/docs/matrixlib/bstats-and-telemetry)
29+
3. [开发者 API](/docs/matrixlib/developer-api)
30+
4. [bStats 与遥测](/docs/matrixlib/bstats-and-telemetry)
2931

3032
## 后续文档预留
3133

0 commit comments

Comments
 (0)