forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
60 lines (52 loc) · 1.57 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
// Type definitions for alexa-voice-service 0.0
// Project: https://github.com/miguelmota/alexa-voice-service.js
// Definitions by: Dolan Miu <https://github.com/dolanmiu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace AVS;
export = AVS;
declare namespace AVS {
enum EventTypes {
RECORD_STOP, RECORD_START, ERROR, TOKEN_INVALID, LOG, LOGIN, LOGOUT, TOKEN_SET, REFRESH_TOKEN_SET
}
interface AVSParams {
debug: boolean;
clientId: string;
clientSecret: string;
deviceId: string;
refreshToken: string;
}
interface TokenResponse {
token: string;
refreshToken: string;
}
class Player {
on(eventType: Player.EventTypes, callback?: () => void): void;
}
namespace Player {
enum EventTypes {
LOG, ERROR, PLAY, REPLAY, PAUSE, STOP, ENQUEUE, DEQUE
}
}
}
declare class AVS {
player: AVS.Player;
constructor(params: AVS.AVSParams);
on(eventType: AVS.EventTypes, callback?: () => void): void;
refreshToken(): Promise<AVS.TokenResponse>;
requestMic(): Promise<any>;
startRecording(): Promise<void>;
stopRecording(): Promise<DataView | undefined>;
sendAudio(dataView: DataView): Promise<{
xhr: any, response: {
httpVersion: string,
statusCode: string,
statusMessage: string,
method: string,
url: string,
headers: string,
body: string,
boundary: string,
multipart: string
}
}>;
}