forked from Garfield-yin/wework-chat-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
197 lines (189 loc) · 3.45 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
export interface InitParams {
/** 企业ID */
corpid: string;
/** App Secret */
secret: string;
/**私钥,用于消息解密 */
private_key: string;
/** 数据拉取index */
seq?: number;
}
export interface GetDataParams {
/** 返回条数,最大1000 */
max_results: number;
/** 超时时间 单位 s */
timeout: number;
/** 数据拉取index */
seq: number;
}
export interface GetMediaDataParams {
/** 媒体资源的id信息 */
sdk_fileid: string;
/**媒体消息分片拉取,需要填入每次拉取的索引信息 */
index_buf?: string;
}
export interface MediaDataResp {
is_finished: boolean;
buf_index: string;
data: Buffer;
}
export interface ChatDataItem {
msgid: string;
action: string;
from: string;
tolist: string[];
roomid: string;
msgtime: number;
msgtype:
| "text"
| "image"
| "revoke"
| "disagree"
| "voice"
| "video"
| "location"
| "emotion"
| "file"
| "link"
| "weapp"
| "chatrecord"
| "todo"
| "vote"
| "collect"
| "redpacket"
| "card"
| "meeting"
| "docmsg"
| "markdown"
| "news"
| "calendar"
| "mixed"
| "meeting_voice_call"
| "voip_doc_share"
| "external_redpacket"
| "sphfeed";
text?: {
content: string;
};
image?: {
md5sum: string;
filesize: number;
sdkfileid: string;
};
revoke?: {
pre_msgid: string;
};
disagree?: {
userid: string;
disagree_time: number;
};
voice?: {
md5sum: string;
voice_size: number;
sdkfileid: string;
play_length: number;
};
video?: {
md5sum: string;
filesize: number;
sdkfileid: string;
play_length: number;
};
card?: {
corpname: string;
userid: string;
};
location?: {
longitude: number;
latitude: number;
address: string;
title: string;
zoom: number;
};
emotion?: {
type: 1 | 2;
width: number;
height: number;
sdkfileid: string;
md5sum: string;
imagesize: number;
};
file?: {
sdkfileid: string;
md5sum: string;
filename: string;
fileext: string;
filesize: number;
};
link?: {
title: string; // 消息标题。String类型
description: string; // 消息描述。String类型
link_url: string; // 链接url地址。String类型
image_url: string; //
};
weapp?: {
title: string; // 消息标题。String类型
description: string; // 消息描述。String类型
username: string; // 用户名称。String类型
displayname: string;
};
chatrecord?: any;
todo?: {
title: string;
content: string;
};
vote?: any;
collect?: {
room_name: string;
creator: string;
create_time: string;
title: string;
details: {
id: number;
ques: string;
type: "Text" | "Number" | "Date" | "Time" | "String";
}[];
};
redpacket?: {
type: number;
wish: string;
totalcnt: number;
totalamount: number;
};
meeting?: {
topic: string;
starttime: number;
endtime: number;
address: string;
remarks: string;
meetingtype: number;
meetingid: number;
status: number;
};
docmsg?: any;
markdown?: any;
news?: any;
calendar?: any;
mixed?: any;
meeting_voice_call?: any;
voip_doc_share?: any;
external_redpacket?: any;
sphfeed?: any;
}
export interface ChatDataResp {
/** 最后一条数据的 seq */
last_seq: number;
data: string[];
}
export interface CallbackFunc {
(msg: string): void;
}
export interface WeWorkChat {
getMediaData(params: GetMediaDataParams): MediaDataResp;
fetchData(fn: CallbackFunc): any;
stopFetch(): number;
getChatData(params: GetDataParams): ChatDataResp;
}
export const WeWorkChat: {
new (param: InitParams): WeWorkChat;
};