@turka/koishi-plugin-zhaozhao-client 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/package.json +5 -9
package/lib/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ declare class ZhaoClient extends Service {
|
|
|
18
18
|
};
|
|
19
19
|
constructor(ctx: Context, config: ZhaoClient.Config);
|
|
20
20
|
getHealth(): Promise<Models.ZhaoHealthVO | null>;
|
|
21
|
+
zhaozhao(findStr: string): Promise<Models.ZhaoContent | null>;
|
|
21
22
|
/**
|
|
22
23
|
* 通用请求 GET 方法
|
|
23
24
|
*
|
|
@@ -25,6 +26,7 @@ declare class ZhaoClient extends Service {
|
|
|
25
26
|
* @returns
|
|
26
27
|
*/
|
|
27
28
|
private getEndpoint;
|
|
29
|
+
private isBlank;
|
|
28
30
|
}
|
|
29
31
|
declare namespace ZhaoClient {
|
|
30
32
|
interface Config {
|
package/lib/index.js
CHANGED
|
@@ -43,6 +43,9 @@ var ZhaoClient = class extends import_koishi.Service {
|
|
|
43
43
|
async getHealth() {
|
|
44
44
|
return this.getEndpoint("/health");
|
|
45
45
|
}
|
|
46
|
+
async zhaozhao(findStr) {
|
|
47
|
+
return this.getEndpoint(`/zhaozhao${this.isBlank(findStr) ? "" : "/" + findStr}`);
|
|
48
|
+
}
|
|
46
49
|
/**
|
|
47
50
|
* 通用请求 GET 方法
|
|
48
51
|
*
|
|
@@ -72,6 +75,9 @@ var ZhaoClient = class extends import_koishi.Service {
|
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
}
|
|
78
|
+
isBlank(str) {
|
|
79
|
+
return !str || str.trim().length === 0;
|
|
80
|
+
}
|
|
75
81
|
};
|
|
76
82
|
((ZhaoClient2) => {
|
|
77
83
|
ZhaoClient2.Config = import_koishi.Schema.object({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turka/koishi-plugin-zhaozhao-client",
|
|
3
3
|
"description": "涂鸦找找客户端 Koishi 插件,提供基础 API 支持",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -18,16 +18,12 @@
|
|
|
18
18
|
],
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "
|
|
21
|
+
"url": "https://cnb.cool/turka/zhaozhao/koishi-plugin-zhaozhao-client.git"
|
|
22
22
|
},
|
|
23
23
|
"koishi": {
|
|
24
24
|
"service": {
|
|
25
|
-
"required": [
|
|
26
|
-
|
|
27
|
-
],
|
|
28
|
-
"implements": [
|
|
29
|
-
"zhaoClient"
|
|
30
|
-
]
|
|
25
|
+
"required": ["http"],
|
|
26
|
+
"implements": ["zhaoClient"]
|
|
31
27
|
},
|
|
32
28
|
"preview": "true"
|
|
33
29
|
},
|
|
@@ -35,4 +31,4 @@
|
|
|
35
31
|
"peerDependencies": {
|
|
36
32
|
"koishi": "^4.18.7"
|
|
37
33
|
}
|
|
38
|
-
}
|
|
34
|
+
}
|