-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
181 lines (181 loc) · 4.39 KB
/
index.d.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import { EventEmitter2 } from "eventemitter2";
import { iAntiFlood, iQuery } from "./interfaces";
export default class TS3QueryClient extends EventEmitter2 {
private socket;
/**
* Carriage return
* @type {string}
*/
private cr;
private data;
/**
* Pending queue
* @type {Array}
* @access private
*/
private queue;
/**
* Prepared queries
* @type {{}}
* @access private
*/
private prepared;
/**
* Total amount of performed queries
* @type {number}
*/
private queryCount;
/**
* Waiting time when antiflood limits are reached
* @type {number}
*/
private waitingTime;
/**
* Query currently executed
* @type {iQuery|null}
*/
private currentQuery;
/**
* Antiflood configuration
* @type {{config: {commands: number; time: number}; last: {query: number; time: number}; enabled: boolean}}
*/
private AntiFlood;
/**
* Return the next query ID
* @returns {number}
*/
getNextQueryID(): number;
/**
* Return the amount of queued pending queries
* @returns {number}
*/
getPendingQueryCount(): number;
/**
* Return the current anti flood configuration
* @returns {iAntiFlood}
*/
getAntiFloodStatus(): iAntiFlood;
/**
* Disable the anti flood feature
* @returns {iAntiFlood}
*/
disableAntiFlood(): iAntiFlood;
/**
* Enable the anti flood feature
* @returns {iAntiFlood}
*/
enableAntiFlood(): iAntiFlood;
/**
* Set the new limits for the anti flood feature
* @param commands
* @param time
* @returns {iAntiFlood}
*/
setAntiFloodLimits(commands: number, time: number): iAntiFlood;
/**
* Determine if the client has reach the flood limits
* @param query
* @returns {boolean}
*/
private isFlood(query);
/**
* Push the query into the queue list
* @param query
* @param resolve
* @param reject
*/
private queuePush(query, resolve, reject);
/**
* Unshift the query intor the queue list
* @param query
* @param resolve
* @param reject
*/
private queueUnshift(query, resolve, reject);
/**
* Process queue
*/
private processQueue();
/**
*
* @param data {string} Data to parse
*/
private readData(data);
/**
* Return the queue
* @returns {iQuery[]}
*/
getQueue(): iQuery[];
/**
* Clear the queue list
* @returns {boolean}
*/
clearQueue(): boolean;
/**
* Build a query from parameters and append it to the queue list
* @param cmd
* @param params
* @param flags
* @returns {Promise}
*/
query(cmd: string, params: object, flags: string[]): Promise<any>;
/**
* Build a query from parameters and prepend it to the queue list
* @param cmd
* @param params
* @param flags
* @returns {Promise}
*/
queryNow(cmd: string, params: object, flags: string[]): Promise<any>;
/**
* Prepare a query and store it into the prepared list
* @param name
* @param query
* @returns {boolean}
*/
prepare(name: string, query: string): boolean;
/**
* Append a prepared query to the queue list
* @param name
* @param params
* @returns {Promise}
*/
execute(name: string, params: any[]): Promise<any>;
/**
* Prepend a prepared query to the queue list
* @param name
* @param params
* @returns {Promise}
*/
executeNow(name: string, params: any[]): Promise<any>;
/**
* Append the query to the queue
* @param query
* @returns {Promise}
*/
send(query: string): Promise<any>;
/**
* Prepend the query to the queue
* @param query
* @returns {Promise}
*/
sendNow(query: string): Promise<any>;
/**
* Upload a file through the TeamSpeak 3 files interface
* @param name
* @param dest
* @param cid
* @param overwrite
* @param resume
* @param cpw
* @returns {Promise<any>}
*/
uploadFile(src: string, dest: string, cid: number, overwrite: 0 | 1, resume: 0 | 1, cpw?: string): Promise<any>;
/**
* Connect to the server and wait for instructions
* @param host
* @param port
* @returns {Promise}
*/
connect(host: string, port: number): Promise<any>;
}