@lagent_titi/kick.js-ts 1.0.1
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/LICENSE +21 -0
- package/README.md +501 -0
- package/dist/README.md +501 -0
- package/dist/client.d.ts +56 -0
- package/dist/client.js +86 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/package.json +44 -0
- package/dist/services/categories.d.ts +7 -0
- package/dist/services/categories.js +30 -0
- package/dist/services/channels.d.ts +10 -0
- package/dist/services/channels.js +46 -0
- package/dist/services/chat.d.ts +13 -0
- package/dist/services/chat.js +43 -0
- package/dist/services/events.d.ts +40 -0
- package/dist/services/events.js +100 -0
- package/dist/services/publicKey.d.ts +6 -0
- package/dist/services/publicKey.js +17 -0
- package/dist/services/users.d.ts +7 -0
- package/dist/services/users.js +39 -0
- package/dist/types/webhooks.d.ts +9 -0
- package/dist/types/webhooks.js +111 -0
- package/dist/utils/signature.d.ts +6 -0
- package/dist/utils/signature.js +21 -0
- package/dist/webhooks/handler.d.ts +10 -0
- package/dist/webhooks/handler.js +59 -0
- package/dist/webhooks/server.d.ts +17 -0
- package/dist/webhooks/server.js +56 -0
- package/package.json +44 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
import express from 'express';
|
2
|
+
export class WebhookServer {
|
3
|
+
constructor(client, options = {}) {
|
4
|
+
this.client = client;
|
5
|
+
this.port = options.port || 3000;
|
6
|
+
this.path = options.path || '/webhook';
|
7
|
+
this.app = express();
|
8
|
+
this.server = null;
|
9
|
+
}
|
10
|
+
setup() {
|
11
|
+
this.app.use(express.raw({ type: 'application/json' }));
|
12
|
+
this.app.post(this.path, async (req, res) => {
|
13
|
+
try {
|
14
|
+
const result = await this.client.handleWebhookRequest(req.headers, req.body);
|
15
|
+
res.json({ success: true, event: result.eventType });
|
16
|
+
}
|
17
|
+
catch (error) {
|
18
|
+
res.status(400).json({ error: error.message });
|
19
|
+
}
|
20
|
+
});
|
21
|
+
}
|
22
|
+
start() {
|
23
|
+
return new Promise((resolve, reject) => {
|
24
|
+
try {
|
25
|
+
this.setup();
|
26
|
+
this.server = this.app.listen(this.port, () => {
|
27
|
+
this.client.emit('webhookServerStarted', {
|
28
|
+
port: this.port,
|
29
|
+
path: this.path
|
30
|
+
});
|
31
|
+
resolve();
|
32
|
+
});
|
33
|
+
}
|
34
|
+
catch (error) {
|
35
|
+
reject(error);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
}
|
39
|
+
stop() {
|
40
|
+
return new Promise((resolve, reject) => {
|
41
|
+
if (this.server) {
|
42
|
+
this.server.close((err) => {
|
43
|
+
if (err)
|
44
|
+
reject(err);
|
45
|
+
else {
|
46
|
+
this.client.emit('webhookServerStopped');
|
47
|
+
resolve();
|
48
|
+
}
|
49
|
+
});
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
resolve();
|
53
|
+
}
|
54
|
+
});
|
55
|
+
}
|
56
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"name": "@lagent_titi/kick.js-ts",
|
3
|
+
"version": "1.0.1",
|
4
|
+
"description": "Node.js TypeScript client for Kick.com API",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"types": "dist/index.d.ts",
|
7
|
+
"files": [
|
8
|
+
"dist"
|
9
|
+
],
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "git+https://github.com/lagentiti/kick.api-ts.git"
|
13
|
+
},
|
14
|
+
"keywords": [
|
15
|
+
"kick",
|
16
|
+
"kickapi",
|
17
|
+
"kickcom",
|
18
|
+
"api"
|
19
|
+
],
|
20
|
+
"author": "botk4cp3r",
|
21
|
+
"license": "MIT",
|
22
|
+
"bugs": {
|
23
|
+
"url": "https://github.com/BOT-K4CP3R/kick.api/issues"
|
24
|
+
},
|
25
|
+
"homepage": "https://github.com/BOT-K4CP3R/kick.api#readme",
|
26
|
+
"dependencies": {
|
27
|
+
"express": "^4.21.2"
|
28
|
+
},
|
29
|
+
"devDependencies": {
|
30
|
+
"@types/express": "^5.0.3",
|
31
|
+
"@types/node": "^24.0.10",
|
32
|
+
"cpx": "^1.5.0",
|
33
|
+
"typescript": "^5.8.3"
|
34
|
+
},
|
35
|
+
"scripts": {
|
36
|
+
"build": "tsc && cpx \"package.json\" dist && cpx \"README.md\" dist",
|
37
|
+
"start": "node dist/index.js",
|
38
|
+
"dev": "ts-node src/index.ts"
|
39
|
+
},
|
40
|
+
"publishConfig": {
|
41
|
+
"access": "public",
|
42
|
+
"registry": "https://registry.npmjs.org/"
|
43
|
+
}
|
44
|
+
}
|