-
Notifications
You must be signed in to change notification settings - Fork 273
/
Copy pathapi.d.ts
64 lines (64 loc) · 1.89 KB
/
api.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
export class RealtimeAPI extends RealtimeEventHandler {
/**
* Create a new RealtimeAPI instance
* @param {{url?: string, model?: string, apiKey?: string, dangerouslyAllowAPIKeyInBrowser?: boolean, debug?: boolean}} [settings]
* @returns {RealtimeAPI}
*/
constructor({ url, apiKey, model, dangerouslyAllowAPIKeyInBrowser, debug }?: {
url?: string;
model?: string;
apiKey?: string;
dangerouslyAllowAPIKeyInBrowser?: boolean;
debug?: boolean;
});
defaultUrl: string;
defaultModel: string;
url: string;
apiKey: string;
model: string;
debug: boolean;
ws: any;
/**
* Tells us whether or not the WebSocket is connected
* @returns {boolean}
*/
isConnected(): boolean;
/**
* Writes WebSocket logs to console
* @param {...any} args
* @returns {true}
*/
log(...args: any[]): true;
/**
* Connects to Realtime API Websocket Server
* @param {{model?: string}} [settings]
* @returns {Promise<true>}
*/
connect({ model }?: {
model?: string;
}): Promise<true>;
/**
* Disconnects from Realtime API server
* @param {WebSocket} [ws]
* @returns {true}
*/
disconnect(ws?: WebSocket): true;
/**
* Receives an event from WebSocket and dispatches as "server.{eventName}" and "server.*" events
* @param {string} eventName
* @param {{[key: string]: any}} event
* @returns {true}
*/
receive(eventName: string, event: {
[key: string]: any;
}): true;
/**
* Sends an event to WebSocket and dispatches as "client.{eventName}" and "client.*" events
* @param {string} eventName
* @param {{[key: string]: any}} event
* @returns {true}
*/
send(eventName: string, data: any): true;
}
import { RealtimeEventHandler } from './event_handler.js';
//# sourceMappingURL=api.d.ts.map