forked from SAP-archive/SDK-NodeJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
82 lines (82 loc) · 2.42 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
declare module 'recastai' {
export interface Message {
chatId: string;
content: string;
conversationId: string;
recastToken: string;
senderId: string;
type: string;
addReply(replies: object[]): void;
reply(replies?: object[]): Promise<any>;
}
export interface Intent {
slug: string;
confidence: number;
}
export interface Entities {
[key: string]: object[];
}
export interface Response {
entities: Entities;
intents: Intent[];
sentiment: string;
type: string;
act: string;
}
export interface Memory {
[key: string]: object;
}
export interface Action {
slug: string;
done: boolean;
reply: string;
}
export class Conversation {
action: Action | null;
conversationToken: string;
entities: Entities;
intents: Intent[];
language: string;
memory: Memory;
nextActions: Action[];
processing_language: string;
replies: string[];
sentiment: string;
source: string;
status: number;
timestamp: string;
uuid: string;
version: string;
all(name: string): object[] | null;
get(name: string): object | null;
getMemory(): Memory;
getMemory(alias: string): object | undefined | null;
isNegative(): boolean;
isNeutral(): boolean;
isPositive(): boolean;
isVNegative(): boolean;
isVPositive(): boolean;
joinedReplies(sep?: string): string;
nextAction(): string | null;
reply(): string | null;
resetConversation(): Promise<Memory>;
resetMemory(alias: string): Promise<Memory>;
setMemory(memory: Memory): Promise<Memory>;
}
export class Request {
constructor(token: string, language: string);
analyseText(text: string, option?: object): Promise<Response>;
converseText(text: string, option?: object): Promise<Conversation>;
}
export class Connect {
constructor(token: string, language: string);
handleMessage<T>(req: any, res: any, onMessageReceived: (m: Message) => T): T;
}
export default class Client {
static request: Request;
static connect: Connect;
constructor(token: string, language: string);
request: Request;
connect: Connect;
}
}