-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwisp.ts
43 lines (39 loc) · 1.22 KB
/
wisp.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { WispAPI } from "./wisp_api/index.js";
import { WispSocket } from "./wisp_socket/index.js";
export interface WispInterface {
socket: WispSocket;
api: WispAPI;
logger: any;
}
/**
* The primary Wisp Interface, exposing interactions with both the HTTP and Websockets API
*
* @param domain The Domain of the Pterodactyl/Wisp panel (e.g. `my.gamepanel.gg`)
* @param uuid The UUID of the server to reference in all API requests
* @param token The panel API token to use for authorization
* @param ghPAT The Github Personal Access Token used for Cloning/Pulling of private repositories. This may be omitted if you do not need to interact with private repositories
*
* @public
*/
export class WispInterface {
constructor(domain: string, uuid: string, token: string, ghPAT?: string) {
this.logger = {
info: (msg: any) => {
console.log(msg);
},
error: (msg: string) => {
console.error(msg);
}
};
this.api = new WispAPI(domain, uuid, token, this.logger);
this.socket = new WispSocket(this.logger, this.api, ghPAT);
}
/**
* Manually disconnects from the Websocket connection(s)
*
* @public
*/
async disconnect() {
await this.socket.disconnect();
}
}