quickblox 2.16.0 → 2.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/quickblox.d.ts +1122 -288
- package/quickblox.js +2 -2
- package/quickblox.min.js +1 -1
- package/src/qbConfig.js +2 -2
package/quickblox.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
type Dictionary<T> = Record<string, T>;
|
|
2
2
|
|
|
3
|
+
type RequiredProps<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
4
|
+
|
|
3
5
|
declare enum QBChatProtocol {
|
|
4
6
|
BOSH = 1,
|
|
5
7
|
WebSockets = 2,
|
|
@@ -12,20 +14,66 @@ interface ICEServer {
|
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export declare interface QBConfig {
|
|
15
|
-
|
|
17
|
+
/** [Custom endpoints](https://docs.quickblox.com/docs/js-setup#section-custom-endpoints) configuration. */
|
|
16
18
|
endpoints?: {
|
|
17
|
-
|
|
19
|
+
/** API endpoint. */
|
|
18
20
|
api?: string;
|
|
21
|
+
/** Chat endpoint. */
|
|
22
|
+
chat?: string;
|
|
19
23
|
};
|
|
24
|
+
/** [WebRTC](https://docs.quickblox.com/docs/js-video-calling-advanced#section-video-calling-settings) configuration. */
|
|
20
25
|
webrtc?: {
|
|
26
|
+
/**
|
|
27
|
+
* Maximum answer time for the QB.webrtc.onUserNotAnswerListener callback to be fired.
|
|
28
|
+
* The answer time interval shows how much time an opponent has to answer your call.
|
|
29
|
+
*/
|
|
30
|
+
answerTimeInterval?: number,
|
|
31
|
+
/**
|
|
32
|
+
* If there is at least one active (recurring) call session and the autoReject is true,
|
|
33
|
+
* the call gets rejected.
|
|
34
|
+
*/
|
|
35
|
+
autoReject?: boolean,
|
|
36
|
+
/**
|
|
37
|
+
* If the number of active (recurring) call sessions
|
|
38
|
+
* is more than it is defined by incomingLimit, the call gets rejected.
|
|
39
|
+
*/
|
|
40
|
+
incomingLimit?: number,
|
|
41
|
+
/**
|
|
42
|
+
* The interval between call requests produced by the session.call() method.
|
|
43
|
+
* Dialing time interval indicates how often to notify your opponents about your call.
|
|
44
|
+
*/
|
|
45
|
+
dialingTimeInterval?: number,
|
|
46
|
+
/**
|
|
47
|
+
* If an opponent has lost the connection then, after this time,
|
|
48
|
+
* the caller will know about it via the QB.webrtc.onSessionConnectionStateChangedListener callback.
|
|
49
|
+
*/
|
|
50
|
+
disconnectTimeInterval?: number,
|
|
51
|
+
/**
|
|
52
|
+
* Allows access to the statistical information about peer connection state (connected, failed, disconnected, etc).
|
|
53
|
+
* Set the number of seconds for the statistical information to be received.
|
|
54
|
+
*/
|
|
55
|
+
statsReportTimeInterval?: boolean,
|
|
56
|
+
/**
|
|
57
|
+
* You can customize a list of ICE servers. By default,
|
|
58
|
+
* WebRTC module will use internal ICE servers that are usually enough,
|
|
59
|
+
* but you can always set your own.
|
|
60
|
+
*/
|
|
21
61
|
iceServers?: ICEServer[];
|
|
22
62
|
};
|
|
63
|
+
/** Chat protocol configuration. */
|
|
23
64
|
chatProtocol?: {
|
|
65
|
+
/** Set 1 to use BOSH, set 2 to use WebSockets. Default: WebSocket. */
|
|
24
66
|
active: QBChatProtocol;
|
|
25
67
|
};
|
|
68
|
+
/** [Stream management](https://docs.quickblox.com/docs/js-setup#section-stream-management) configuration. */
|
|
26
69
|
streamManagement?: {
|
|
27
70
|
enable: boolean;
|
|
28
71
|
};
|
|
72
|
+
/** [Debug mode](https://docs.quickblox.com/docs/js-setup#enable-logging) configuration. */
|
|
73
|
+
debug?: boolean | { mode: 1 } | { mode: 2; file: string };
|
|
74
|
+
on?: {
|
|
75
|
+
sessionExpired?: (response: any, retry: (session: QBSession) => void) => void
|
|
76
|
+
}
|
|
29
77
|
}
|
|
30
78
|
|
|
31
79
|
export declare interface QBError {
|
|
@@ -41,21 +89,69 @@ interface QBCallback<T> {
|
|
|
41
89
|
}
|
|
42
90
|
|
|
43
91
|
export declare interface QBUser {
|
|
92
|
+
/** ID of the user. Generated automatically by the server after user creation. */
|
|
44
93
|
id: number;
|
|
94
|
+
/** User's full name. */
|
|
45
95
|
full_name: string;
|
|
96
|
+
/** User's email. */
|
|
46
97
|
email: string;
|
|
98
|
+
/** User's login. */
|
|
47
99
|
login: string;
|
|
100
|
+
/** User's phone number. */
|
|
48
101
|
phone: string;
|
|
49
|
-
/**
|
|
102
|
+
/** User's website url. */
|
|
103
|
+
website: string | null;
|
|
104
|
+
/** Date & time when record was created, filled automatically. */
|
|
50
105
|
created_at: string;
|
|
51
|
-
/** Date
|
|
106
|
+
/** Date & time when record was created, filled automatically. */
|
|
52
107
|
updated_at: string;
|
|
53
|
-
/** Date
|
|
54
|
-
last_request_at:
|
|
108
|
+
/** Date & time when a user sent the last request, filled automatically. */
|
|
109
|
+
last_request_at: number;
|
|
110
|
+
/** ID of the user in the external system. */
|
|
111
|
+
external_user_id: number | null;
|
|
112
|
+
/** ID of the user's Facebook account. */
|
|
113
|
+
facebook_id: string | null;
|
|
114
|
+
/** ID of the file/blob. Generated automatically by the server after file/blob creation. */
|
|
115
|
+
blob_id: number | null;
|
|
116
|
+
/** User's additional info. */
|
|
55
117
|
custom_data: string | null;
|
|
118
|
+
/** User's tags. Comma separated array of tags. */
|
|
56
119
|
user_tags: string | null;
|
|
120
|
+
/** @deprecated Marketing info. */
|
|
121
|
+
allow_sales_activities: boolean | null;
|
|
122
|
+
/** @deprecated Marketing info. */
|
|
123
|
+
allow_statistics_analysis: boolean | null;
|
|
124
|
+
/** @deprecated GDPR info. */
|
|
125
|
+
age_over16: boolean | null;
|
|
126
|
+
/** @deprecated GDPR info. */
|
|
127
|
+
parents_contacts: string | null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export declare interface QBUserCreate extends Partial<Omit<QBUser, 'id' | 'created_at' | 'updated_at' | 'last_request_at' | 'user_tags'>> {
|
|
131
|
+
/** User's password. */
|
|
132
|
+
password: string;
|
|
133
|
+
/** User's tags. */
|
|
134
|
+
tag_list?: string | string[]
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export declare type QBUserCreateByEmailParams = RequiredProps<QBUserCreate, 'email'>
|
|
138
|
+
|
|
139
|
+
export declare type QBUserCreateByPhoneParams = RequiredProps<QBUserCreate, 'phone'>
|
|
140
|
+
|
|
141
|
+
export declare type QBUserCreateByLoginParams = RequiredProps<QBUserCreate, 'login'>
|
|
142
|
+
|
|
143
|
+
export declare type QBUserCreateParams =
|
|
144
|
+
| QBUserCreateByEmailParams
|
|
145
|
+
| QBUserCreateByPhoneParams
|
|
146
|
+
| QBUserCreateByLoginParams;
|
|
147
|
+
|
|
148
|
+
export declare interface QBUserUpdate extends Partial<Omit<QBUser, 'id' | 'created_at' | 'updated_at' | 'last_request_at' | 'user_tags'>> {
|
|
149
|
+
/** User's new password. */
|
|
57
150
|
password?: string;
|
|
151
|
+
/** User's old password. */
|
|
58
152
|
old_password?: string;
|
|
153
|
+
/** User's tags. */
|
|
154
|
+
tag_list?: string | string[]
|
|
59
155
|
}
|
|
60
156
|
|
|
61
157
|
export declare interface ListUserResponse {
|
|
@@ -66,98 +162,177 @@ export declare interface ListUserResponse {
|
|
|
66
162
|
}
|
|
67
163
|
|
|
68
164
|
export declare interface QBSession {
|
|
69
|
-
|
|
165
|
+
/** ID of the session. Generated automatically by the server after session creation. */
|
|
166
|
+
id: number;
|
|
167
|
+
/** ID of the user's application. */
|
|
70
168
|
application_id: number;
|
|
71
|
-
/**
|
|
169
|
+
/** ID of the session's owner. */
|
|
170
|
+
user_id: QBUser["id"];
|
|
171
|
+
/** Date & time when a record was created, filled automatically. */
|
|
72
172
|
created_at: string;
|
|
73
|
-
|
|
74
|
-
|
|
173
|
+
/** Date & time when a record was created, filled automatically. */
|
|
174
|
+
updated_at: string;
|
|
175
|
+
/** Unique Random Value. Parameter from a session creating request is used. */
|
|
176
|
+
nonce: number;
|
|
177
|
+
/** Session identifier. Each API request should contain this parameter in QB-Token header. */
|
|
75
178
|
token: string;
|
|
179
|
+
/** Unix Timestamp. Parameter from session creating request is used. */
|
|
76
180
|
ts: number;
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
-
|
|
181
|
+
/**
|
|
182
|
+
* ID of the session. Generated automatically by the server after session creation.
|
|
183
|
+
* Date & time when a record was updated, filled automatically.
|
|
184
|
+
*/
|
|
185
|
+
_id: string;
|
|
80
186
|
}
|
|
81
187
|
|
|
82
188
|
type ChatConnectParams =
|
|
83
189
|
| {
|
|
84
|
-
|
|
85
|
-
|
|
190
|
+
/** Connect to the chat by user id */
|
|
191
|
+
userId: QBUser['id'];
|
|
192
|
+
/** The user's password or session token */
|
|
86
193
|
password: string;
|
|
87
194
|
}
|
|
88
195
|
| {
|
|
196
|
+
/** Connect to the chat by user jid */
|
|
89
197
|
jid: string;
|
|
90
|
-
/** user's password or session token */
|
|
198
|
+
/** The user's password or session token */
|
|
91
199
|
password: string;
|
|
92
200
|
}
|
|
93
201
|
| {
|
|
202
|
+
/** Connect to the chat by user's email */
|
|
94
203
|
email: string;
|
|
95
|
-
/** user's password or session token */
|
|
204
|
+
/** The user's password or session token */
|
|
96
205
|
password: string;
|
|
97
206
|
};
|
|
98
207
|
|
|
208
|
+
type QBCustomField = string | string[] | number | number[] | boolean | boolean[] | null | undefined;
|
|
209
|
+
|
|
99
210
|
export declare interface ChatMessageAttachment {
|
|
100
|
-
/** ID of the file on QuickBlox server
|
|
211
|
+
/** ID of the file on QuickBlox server. */
|
|
101
212
|
id: string | number;
|
|
102
|
-
|
|
103
|
-
/** Type of attachment. Example: audio, video, image or other */
|
|
213
|
+
/** Type of attachment. Example: `audio`, `video`, `image` or other */
|
|
104
214
|
type: string;
|
|
105
|
-
/** Link to a file in Internet */
|
|
215
|
+
/** Link to a file in Internet. */
|
|
106
216
|
url?: string;
|
|
217
|
+
/** UID of file from `QB.content.createAndUpload` */
|
|
218
|
+
uid?: string;
|
|
219
|
+
/** Name of attachment. */
|
|
107
220
|
name?: string;
|
|
221
|
+
/** Size of attachment. */
|
|
108
222
|
size?: number;
|
|
109
|
-
[key: string]:
|
|
223
|
+
[key: string]: QBCustomField;
|
|
110
224
|
}
|
|
111
225
|
|
|
112
226
|
declare enum QBChatDialogType {
|
|
113
|
-
|
|
227
|
+
PUBLIC_GROUP = 1,
|
|
114
228
|
GROUP = 2,
|
|
115
229
|
PRIVATE = 3,
|
|
116
230
|
}
|
|
117
231
|
|
|
118
232
|
export declare interface QBChatDialog {
|
|
233
|
+
/** ID of the dialog. Generated automatically by the server after dialog creation. */
|
|
119
234
|
_id: string;
|
|
120
|
-
/**
|
|
235
|
+
/** ID of dialog's owner. */
|
|
236
|
+
user_id: QBUser["id"];
|
|
237
|
+
/** Date & time when a record was created, filled automatically. */
|
|
121
238
|
created_at: string;
|
|
122
|
-
|
|
123
|
-
last_message: string | null;
|
|
124
|
-
/** Date ISO string */
|
|
125
|
-
last_message_date_sent: string | null;
|
|
126
|
-
last_message_id: string | null;
|
|
127
|
-
last_message_user_id: QBUser["id"] | null;
|
|
128
|
-
name: string;
|
|
129
|
-
occupants_ids: number[];
|
|
130
|
-
photo: null;
|
|
131
|
-
type: QBChatDialogType;
|
|
132
|
-
/** Date ISO string */
|
|
239
|
+
/** Date & time when a record was created, filled automatically. */
|
|
133
240
|
updated_at: string;
|
|
134
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Type of dialog. Possible values are:
|
|
243
|
+
* - type=1 (`PUBLIC_GROUP`)
|
|
244
|
+
* - type=2 (`GROUP`)
|
|
245
|
+
* - type=3 (`PRIVATE`)
|
|
246
|
+
*/
|
|
247
|
+
type: QBChatDialogType;
|
|
248
|
+
/**
|
|
249
|
+
* Name of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
|
|
250
|
+
* The maximum length for the dialog name is 200 symbols.
|
|
251
|
+
*/
|
|
252
|
+
name: string;
|
|
253
|
+
/**
|
|
254
|
+
* Photo of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
|
|
255
|
+
* Can contain a link to a file in Content module, Custom Objects module or just a web link.
|
|
256
|
+
*/
|
|
257
|
+
photo: null | string;
|
|
258
|
+
/**
|
|
259
|
+
* JID of XMPP room for group chat to connect. Nil if type=3 (PRIVATE).
|
|
260
|
+
* Generated automatically by the server after dialog creation.
|
|
261
|
+
*/
|
|
135
262
|
xmpp_room_jid: string | null;
|
|
263
|
+
/** Array of users' IDs - dialog occupants. Does not make sense if type=1 (PUBLIC_GROUP). */
|
|
264
|
+
occupants_ids: number[];
|
|
265
|
+
/** Last sent message in this dialog. */
|
|
266
|
+
last_message: string | null;
|
|
267
|
+
/** Timestamp of last sent message in this dialog. */
|
|
268
|
+
last_message_date_sent: number | null;
|
|
269
|
+
/** ID of the user who sent last message in this dialog. */
|
|
270
|
+
last_message_user_id: QBUser["id"] | null;
|
|
271
|
+
/** ID of last message in this dialog. */
|
|
272
|
+
last_message_id: string | null;
|
|
273
|
+
/** Number of unread messages in this dialog for a current user. */
|
|
136
274
|
unread_messages_count: number | null;
|
|
137
|
-
|
|
275
|
+
/**
|
|
276
|
+
* - Information about class and fields in Custom Objects.
|
|
277
|
+
* - Any dialog can be extended using Custom Objects to store additional parameters.
|
|
278
|
+
*/
|
|
279
|
+
data?: {
|
|
280
|
+
/** Class name in Custom Objects. */
|
|
281
|
+
class_name: string;
|
|
282
|
+
/** Field name of class in Custom Objects. Can be many: 1..N. */
|
|
283
|
+
[field_name_N: string]: QBCustomField;
|
|
284
|
+
};
|
|
138
285
|
}
|
|
139
286
|
|
|
140
287
|
export declare interface QBChatMessage {
|
|
288
|
+
/** ID of the message. Generated automatically by the server after message creation. */
|
|
141
289
|
_id: string;
|
|
142
|
-
|
|
143
|
-
chat_dialog_id: QBChatDialog["_id"];
|
|
144
|
-
/** Date ISO string */
|
|
290
|
+
/** Date & time when a record was created, filled automatically. */
|
|
145
291
|
created_at: string;
|
|
146
|
-
/** Date
|
|
147
|
-
|
|
148
|
-
|
|
292
|
+
/** Date & time when a record was created, filled automatically. */
|
|
293
|
+
updated_at: string;
|
|
294
|
+
/** ID of dialog to which current message is connected. Generated automatically by the server after message creation. */
|
|
295
|
+
chat_dialog_id: QBChatDialog["_id"];
|
|
296
|
+
/** Message body. */
|
|
149
297
|
message: string | null;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
298
|
+
/** Message date sent. */
|
|
299
|
+
date_sent: number;
|
|
300
|
+
/** Message sender ID. */
|
|
153
301
|
sender_id: QBUser["id"];
|
|
154
|
-
/**
|
|
155
|
-
|
|
302
|
+
/** Message recipient ID. */
|
|
303
|
+
recipient_id: QBUser["id"] | null;
|
|
304
|
+
/**
|
|
305
|
+
* @deprecated
|
|
306
|
+
* Read message status. Diplayed as read=1 after retiriving by the opponent.
|
|
307
|
+
* Works only for type=3 (`PRIVATE`) dialog.
|
|
308
|
+
* Remains as read=0 after retiriving for type=2 (`GROUP`) and type=1 (`PUBLIC_GROUP`) dialogs.
|
|
309
|
+
* */
|
|
310
|
+
read: 0 | 1;
|
|
311
|
+
/** Array of users' IDs who read messages. Works only for type=2 (GROUP) dialog. */
|
|
312
|
+
read_ids: Array<QBUser["id"]>;
|
|
313
|
+
/** Array of users' IDs who received the messages. */
|
|
314
|
+
delivered_ids: Array<QBUser["id"]>;
|
|
315
|
+
/**
|
|
316
|
+
* Each attachment object contains 3 required keys:
|
|
317
|
+
* - `id` - link to file ID in QuickBlox,
|
|
318
|
+
* - `type` - audio/video/image,
|
|
319
|
+
* - `url` - link to file in Internet.
|
|
320
|
+
*/
|
|
321
|
+
attachments: ChatMessageAttachment[];
|
|
322
|
+
/**
|
|
323
|
+
* Name of the custom field.
|
|
324
|
+
* Chat message can be extended with additional fields and contain any other user key-value custom parameters.
|
|
325
|
+
* Can be many 1..N.
|
|
326
|
+
*/
|
|
327
|
+
[custom_field_N: string]: any;
|
|
156
328
|
}
|
|
157
329
|
|
|
158
330
|
export declare interface QBMessageStatusParams {
|
|
331
|
+
/** ID of the message. */
|
|
159
332
|
messageId: QBChatMessage["_id"];
|
|
333
|
+
/** ID of the dialog. */
|
|
160
334
|
dialogId: QBChatDialog["_id"];
|
|
335
|
+
/** ID of the user. */
|
|
161
336
|
userId: QBUser["id"];
|
|
162
337
|
}
|
|
163
338
|
|
|
@@ -183,10 +358,7 @@ export declare interface QBChatXMPPMessage {
|
|
|
183
358
|
extension: {
|
|
184
359
|
attachments?: ChatMessageAttachment[];
|
|
185
360
|
date_sent: string;
|
|
186
|
-
|
|
187
|
-
user_id?: string;
|
|
188
|
-
profile_id?: string;
|
|
189
|
-
organization_id?: string;
|
|
361
|
+
[custom_field_N: string]: any;
|
|
190
362
|
};
|
|
191
363
|
}
|
|
192
364
|
|
|
@@ -194,7 +366,7 @@ export declare interface QBSystemMessage {
|
|
|
194
366
|
id: string;
|
|
195
367
|
userId: QBUser["id"];
|
|
196
368
|
body?: null | string;
|
|
197
|
-
extension?: Dictionary<
|
|
369
|
+
extension?: Dictionary<any>;
|
|
198
370
|
}
|
|
199
371
|
|
|
200
372
|
export declare interface QBGetDialogResult {
|
|
@@ -211,104 +383,449 @@ export declare type GetMessagesResult = {
|
|
|
211
383
|
};
|
|
212
384
|
|
|
213
385
|
interface QBChatModule {
|
|
386
|
+
isConnected: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Connect to the Chat
|
|
389
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-connection#connect-to-chat-server-with-quickblox-session-token))
|
|
390
|
+
*/
|
|
391
|
+
connect(params: ChatConnectParams, callback: QBCallback<any>): void;
|
|
392
|
+
reconnect(): void
|
|
393
|
+
/** Disconnect from the Chat ([read more](https://docs.quickblox.com/docs/js-chat-connection#disconnect-from-chat-server)). */
|
|
394
|
+
disconnect(): void;
|
|
395
|
+
/**
|
|
396
|
+
* Send query to get last user activity by `QB.chat.onLastUserActivityListener(userId, seconds)`
|
|
397
|
+
* ([read more](https://xmpp.org/extensions/xep-0012.html)).
|
|
398
|
+
*/
|
|
399
|
+
getLastUserActivity(jidOrUserId: QBUser['id'] | string): void;
|
|
400
|
+
/** Receive confirm request ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#confirm-the-contact-request)). */
|
|
401
|
+
onConfirmSubscribeListener?: (userId: QBUser['id']) => void;
|
|
402
|
+
/** Receive user status (online/offline)([read more](https://docs.quickblox.com/docs/js-chat-contact-list#contact-list-updates)). */
|
|
403
|
+
onContactListListener?: (userId: QBUser['id'], type: string) => void;
|
|
404
|
+
/** Receive delivery confirmations ([read more](https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-delivered)). */
|
|
405
|
+
onDeliveredStatusListener?: (
|
|
406
|
+
messageId: string,
|
|
407
|
+
dialogId: QBChatDialog["_id"],
|
|
408
|
+
userId: QBUser["id"],
|
|
409
|
+
) => void;
|
|
410
|
+
/** Run after disconnect from chat. */
|
|
411
|
+
onDisconnectedListener?: () => void;
|
|
412
|
+
/** You will receive this callback when some user joined group chat dialog you are in. */
|
|
413
|
+
onJoinOccupant?: (dialogId: QBChatDialog['_id'], userId: QBUser["id"]) => void;
|
|
414
|
+
/**
|
|
415
|
+
* You will receive this callback when you are in group chat dialog(joined)
|
|
416
|
+
* and other user (chat dialog's creator) removed you from occupants.
|
|
417
|
+
*/
|
|
418
|
+
onKickOccupant?: (dialogId: QBChatDialog['_id'], initiatorUserId: QBUser["id"]) => void;
|
|
419
|
+
/** Receive user's last activity (time ago). */
|
|
420
|
+
onLastUserActivityListener?: (userId: QBUser["id"], seconds: number) => void;
|
|
421
|
+
/** You will receive this callback when some user left group chat dialog you are in. */
|
|
422
|
+
onLeaveOccupant?: (dialogId: QBChatDialog['_id'], userId: QBUser["id"]) => void;
|
|
423
|
+
/** Blocked entities receive an error when try to chat with a user in a 1-1 chat and receivie nothing in a group chat. */
|
|
424
|
+
onMessageErrorListener?: (messageId: QBChatMessage['_id'], error: any) => void;
|
|
425
|
+
/**
|
|
426
|
+
* You need to set onMessageListener function, to get messages
|
|
427
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#subscribe-message-events)).
|
|
428
|
+
*/
|
|
429
|
+
onMessageListener?: (userId: QBUser['id'], message: QBChatXMPPMessage) => void;
|
|
430
|
+
/**
|
|
431
|
+
* Show typing status in chat or groupchat
|
|
432
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators)).
|
|
433
|
+
*/
|
|
434
|
+
onMessageTypingListener?: (
|
|
435
|
+
isTyping: boolean,
|
|
436
|
+
userId: QBUser["id"],
|
|
437
|
+
dialogId: QBChatDialog["_id"]
|
|
438
|
+
) => void;
|
|
439
|
+
/**
|
|
440
|
+
* You can manage 'read' notifications in chat
|
|
441
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-read)).
|
|
442
|
+
*/
|
|
443
|
+
onReadStatusListener?: (
|
|
444
|
+
messageId: QBChatMessage['_id'],
|
|
445
|
+
dialogId: QBChatDialog["_id"],
|
|
446
|
+
userId: QBUser["id"]
|
|
447
|
+
) => void;
|
|
448
|
+
/**
|
|
449
|
+
* By default Javascript SDK reconnects automatically when connection to server is lost
|
|
450
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-connection#reconnection)).
|
|
451
|
+
*/
|
|
452
|
+
onReconnectListener?: () => void;
|
|
453
|
+
onReconnectFailedListener?: (error: any) => void;
|
|
454
|
+
onSessionExpiredListener?: (error?: QBError) => void;
|
|
455
|
+
/**
|
|
456
|
+
* Receive reject request
|
|
457
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#reject-the-contact-request)).
|
|
458
|
+
*/
|
|
459
|
+
onRejectSubscribeListener?: (userId: QBUser['id']) => void;
|
|
460
|
+
/**
|
|
461
|
+
* This feature defines an approach for ensuring is the message delivered to the server.
|
|
462
|
+
* This feature is unabled by default
|
|
463
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#check-if-a-message-is-sent)).
|
|
464
|
+
*/
|
|
465
|
+
onSentMessageCallback?: (messageLost: QBChatMessage, messageSent: QBChatMessage) => void;
|
|
466
|
+
/**
|
|
467
|
+
* Receive subscription request
|
|
468
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#add-user-to-your-contact-list)).
|
|
469
|
+
*/
|
|
470
|
+
onSubscribeListener?: (userId: QBUser['id']) => void;
|
|
471
|
+
/**
|
|
472
|
+
* These messages work over separated channel and won't be mixed with the regular chat messages
|
|
473
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-system-messages)).
|
|
474
|
+
*/
|
|
475
|
+
onSystemMessageListener?: (message: QBSystemMessage) => void;
|
|
476
|
+
/**
|
|
477
|
+
* Send message to 1 to 1 or group dialog
|
|
478
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-text-message)).
|
|
479
|
+
*/
|
|
480
|
+
send<T extends QBChatNewMessage>(
|
|
481
|
+
jidOrUserId: QBUser["id"] | string,
|
|
482
|
+
message: T
|
|
483
|
+
): string;
|
|
484
|
+
/**
|
|
485
|
+
* Send is stop typing status
|
|
486
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators)).
|
|
487
|
+
*/
|
|
488
|
+
sendIsStopTypingStatus(jidOrUserId: QBUser["id"] | string): void;
|
|
489
|
+
/**
|
|
490
|
+
* Send is typing status
|
|
491
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators)).
|
|
492
|
+
*/
|
|
493
|
+
sendIsTypingStatus(jidOrUserId: QBUser["id"] | string): void;
|
|
494
|
+
/**
|
|
495
|
+
* Send is read status
|
|
496
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-read)).
|
|
497
|
+
*/
|
|
498
|
+
sendReadStatus(params: QBMessageStatusParams): void;
|
|
499
|
+
/**
|
|
500
|
+
* Send system message (system notification) to 1 to 1 or group dialog
|
|
501
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-system-messages)).
|
|
502
|
+
*/
|
|
503
|
+
sendSystemMessage(
|
|
504
|
+
jidOrUserId: QBUser["id"] | string,
|
|
505
|
+
// TODO: change type
|
|
506
|
+
message: { extension: QBSystemMessage["extension"] }
|
|
507
|
+
): string;
|
|
508
|
+
/** Send is delivered status. */
|
|
509
|
+
sendDeliveredStatus(params: QBMessageStatusParams): void;
|
|
510
|
+
ping(jidOrUserId: string | number, callback: QBCallback<any>): string;
|
|
511
|
+
ping(callback: QBCallback<any>): string;
|
|
512
|
+
|
|
214
513
|
dialog: {
|
|
514
|
+
/**
|
|
515
|
+
* Create new dialog
|
|
516
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#create-dialog)).
|
|
517
|
+
*/
|
|
215
518
|
create(
|
|
216
|
-
params: Dictionary<
|
|
519
|
+
params: Dictionary<any>,
|
|
217
520
|
callback: QBCallback<QBChatDialog>
|
|
218
521
|
): void;
|
|
522
|
+
/**
|
|
523
|
+
* Delete a dialog or dialogs
|
|
524
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#delete-dialog)).
|
|
525
|
+
*/
|
|
526
|
+
delete(id: QBChatDialog['_id'] | Array<QBChatDialog['_id']>, params: { force: 1 }, callback: QBCallback<any>)
|
|
527
|
+
/**
|
|
528
|
+
* Delete a dialog or dialogs
|
|
529
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#delete-dialog)).
|
|
530
|
+
*/
|
|
531
|
+
delete(id: QBChatDialog['_id'] | Array<QBChatDialog['_id']>, callback: QBCallback<any>)
|
|
532
|
+
/**
|
|
533
|
+
* Retrieve list of dialogs
|
|
534
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#retrieve-list-of-dialogs)).
|
|
535
|
+
*/
|
|
219
536
|
list(
|
|
220
|
-
params:
|
|
537
|
+
params: {
|
|
538
|
+
limit?: number;
|
|
539
|
+
skip?: number;
|
|
540
|
+
sort_asc?: string;
|
|
541
|
+
sort_desc?: string;
|
|
542
|
+
[field: string]: any;
|
|
543
|
+
},
|
|
221
544
|
callback: QBCallback<QBGetDialogResult>
|
|
222
545
|
): void;
|
|
546
|
+
/**
|
|
547
|
+
* Update group dialog
|
|
548
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#update-dialog)).
|
|
549
|
+
*/
|
|
223
550
|
update(
|
|
224
|
-
id:
|
|
225
|
-
data: Dictionary<
|
|
551
|
+
id: QBChatDialog['_id'],
|
|
552
|
+
data: Dictionary<any>,
|
|
226
553
|
callback: QBCallback<QBChatDialog>
|
|
227
554
|
): void;
|
|
228
555
|
};
|
|
556
|
+
|
|
229
557
|
message: {
|
|
558
|
+
/** Create message. */
|
|
559
|
+
create(params: Dictionary<any>, callback: QBCallback<QBChatMessage>): void;
|
|
560
|
+
/**
|
|
561
|
+
* Delete message
|
|
562
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#delete-message)).
|
|
563
|
+
*/
|
|
564
|
+
delete(
|
|
565
|
+
id: QBChatMessage['_id'],
|
|
566
|
+
params: { force: 1 },
|
|
567
|
+
callback: QBCallback<{
|
|
568
|
+
SuccessfullyDeleted: {
|
|
569
|
+
ids: string[];
|
|
570
|
+
};
|
|
571
|
+
NotFound: {
|
|
572
|
+
ids: string[];
|
|
573
|
+
};
|
|
574
|
+
}>,
|
|
575
|
+
): void;
|
|
576
|
+
/**
|
|
577
|
+
* Delete message
|
|
578
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#delete-message)).
|
|
579
|
+
*/
|
|
580
|
+
delete(
|
|
581
|
+
id: QBChatMessage['_id'],
|
|
582
|
+
callback: QBCallback<{
|
|
583
|
+
SuccessfullyDeleted: {
|
|
584
|
+
ids: string[];
|
|
585
|
+
};
|
|
586
|
+
NotFound: {
|
|
587
|
+
ids: string[];
|
|
588
|
+
};
|
|
589
|
+
}>,
|
|
590
|
+
): void;
|
|
591
|
+
/**
|
|
592
|
+
* Get a chat history
|
|
593
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#retrieve-chat-history)).
|
|
594
|
+
*/
|
|
230
595
|
list(
|
|
231
|
-
params:
|
|
596
|
+
params: {
|
|
597
|
+
limit?: number;
|
|
598
|
+
skip?: number;
|
|
599
|
+
sort_asc?: string;
|
|
600
|
+
sort_desc?: string;
|
|
601
|
+
mark_as_read?: number;
|
|
602
|
+
[field: string]: any;
|
|
603
|
+
},
|
|
232
604
|
callback: QBCallback<GetMessagesResult>
|
|
233
605
|
): void;
|
|
606
|
+
/**
|
|
607
|
+
* Get unread messages counter for one or group of dialogs
|
|
608
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#get-number-of-unread-messages)).
|
|
609
|
+
*/
|
|
610
|
+
unreadCount(params: { chat_dialog_ids: string | string[] }, callback: QBCallback<{ total: number }>): void;
|
|
611
|
+
/**
|
|
612
|
+
* Update message
|
|
613
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#update-message)).
|
|
614
|
+
*/
|
|
615
|
+
update(id: QBChatMessage['_id'], params: Dictionary<any>, callback: QBCallback<QBChatMessage>): void;
|
|
234
616
|
};
|
|
235
|
-
|
|
236
|
-
send<T extends QBChatNewMessage>(
|
|
237
|
-
jidOrUserId: QBUser["id"] | string,
|
|
238
|
-
message: T
|
|
239
|
-
): string;
|
|
240
|
-
sendSystemMessage(
|
|
241
|
-
jidOrUserId: QBUser["id"] | string,
|
|
242
|
-
message: { extension: QBSystemMessage["extension"] }
|
|
243
|
-
): string;
|
|
244
|
-
sendDeliveredStatus(params: QBMessageStatusParams): void;
|
|
245
|
-
sendReadStatus(params: QBMessageStatusParams): void;
|
|
246
|
-
sendIsTypingStatus(jidOrUserId: QBUser["id"] | string): void;
|
|
247
|
-
sendIsStopTypingStatus(jidOrUserId: QBUser["id"] | string): void;
|
|
248
|
-
connect: (params: ChatConnectParams, callback: QBCallback<unknown>) => void;
|
|
249
|
-
disconnect: () => void;
|
|
250
|
-
ping(jidOrUserId: string | number, callback: QBCallback<unknown>): void;
|
|
251
|
-
ping(callback: QBCallback<unknown>): void;
|
|
617
|
+
|
|
252
618
|
muc: {
|
|
253
|
-
|
|
254
|
-
|
|
619
|
+
/**
|
|
620
|
+
* Join to the group dialog
|
|
621
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#join-dialog)).
|
|
622
|
+
*/
|
|
623
|
+
join(dialogJid: string, callback: QBCallback<any>): void;
|
|
624
|
+
/**
|
|
625
|
+
* Leave group chat dialog
|
|
626
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#leave-dialog)).
|
|
627
|
+
*/
|
|
628
|
+
leave(dialogJid: string, callback: QBCallback<any>): void;
|
|
629
|
+
/**
|
|
630
|
+
* Leave group chat dialog
|
|
631
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#retrieve-online-users)).
|
|
632
|
+
*/
|
|
633
|
+
listOnlineUsers(dialogJid: string, callback: QBCallback<any>): void;
|
|
255
634
|
};
|
|
635
|
+
|
|
636
|
+
roster: {
|
|
637
|
+
/**
|
|
638
|
+
* Add users to contact list
|
|
639
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#add-user-to-your-contact-list)).
|
|
640
|
+
*/
|
|
641
|
+
add(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
642
|
+
/**
|
|
643
|
+
* Confirm subscription with some user
|
|
644
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#confirm-the-contact-request)).
|
|
645
|
+
*/
|
|
646
|
+
confirm(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
647
|
+
/**
|
|
648
|
+
* Receive contact list
|
|
649
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#access-contact-list)).
|
|
650
|
+
*/
|
|
651
|
+
get(callback: QBCallback<any>): void;
|
|
652
|
+
/**
|
|
653
|
+
* Reject subscription with some user
|
|
654
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#reject-the-contact-request)).
|
|
655
|
+
*/
|
|
656
|
+
reject(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
657
|
+
/**
|
|
658
|
+
* Remove subscription with some user from your contact list
|
|
659
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#remove-user-from-the-contact-list)).
|
|
660
|
+
*/
|
|
661
|
+
remove(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
662
|
+
};
|
|
663
|
+
|
|
256
664
|
helpers: {
|
|
257
|
-
|
|
665
|
+
/** Get unique id. */
|
|
666
|
+
getUniqueId(suffix: string | number): string;
|
|
667
|
+
/** Generate BSON ObjectId. */
|
|
668
|
+
getBsonObjectId(): string;
|
|
669
|
+
/** Get the dialog id from jid. */
|
|
258
670
|
getDialogIdFromNode(jid: string): QBChatDialog["_id"];
|
|
259
|
-
|
|
671
|
+
/** Get the User id from jid. */
|
|
672
|
+
getIdFromNode(jid: string): QBUser['id'];
|
|
673
|
+
/** Get user id from dialog's full jid. */
|
|
674
|
+
getIdFromResource(jid: string): QBUser['id'];
|
|
675
|
+
/** Get the recipient id. */
|
|
676
|
+
getRecipientId(occupantsIds: Array<QBUser['id']>, userId: QBUser['id']): QBUser['id'];
|
|
677
|
+
/** Get the full room jid from room bare jid & user jid. */
|
|
678
|
+
getRoomJid(jid: string, userJid: string): string;
|
|
679
|
+
/** Get the room jid from dialog id. */
|
|
680
|
+
getRoomJidFromDialogId(dialogId: QBChatDialog['_id']): string
|
|
681
|
+
/** Get bare dialog's jid from dialog's full jid. */
|
|
682
|
+
getRoomJidFromRoomFullJid(jid: string):string
|
|
683
|
+
/** Get the user id from the room jid. */
|
|
684
|
+
getUserIdFromRoomJid(jid: string): string
|
|
685
|
+
/** Get the User jid id. */
|
|
260
686
|
getUserJid(userId: QBUser["id"], appId?: string | number): string;
|
|
261
|
-
|
|
687
|
+
/** Get the User nick with the muc domain. */
|
|
688
|
+
getUserNickWithMucDomain(userId: QBUser['id']): string;
|
|
689
|
+
/** Get unique id. */
|
|
690
|
+
jidOrUserId(jidOrUserId: QBUser['id'] | string): string;
|
|
691
|
+
/** Get the chat type. */
|
|
692
|
+
typeChat(jidOrUserId: QBUser['id'] | string): 'chat' | 'groupchat';
|
|
693
|
+
/** Get the dialog jid from dialog id. */
|
|
694
|
+
getDialogJid(dialogId: QBChatDialog["_id"]): string;
|
|
695
|
+
/** Get user jid from current user. */
|
|
696
|
+
getUserCurrentJid(): string;
|
|
262
697
|
};
|
|
263
|
-
onMessageListener?: (
|
|
264
|
-
senderId: QBUser["id"],
|
|
265
|
-
message: QBChatXMPPMessage
|
|
266
|
-
) => void;
|
|
267
|
-
onMessageErrorListener?: (messageId: string, error: unknown) => void;
|
|
268
|
-
onMessageTypingListener?: (
|
|
269
|
-
isTyping: boolean,
|
|
270
|
-
userId: QBUser["id"],
|
|
271
|
-
dialogId: QBChatDialog["_id"]
|
|
272
|
-
) => void;
|
|
273
|
-
onDeliveredStatusListener?: (
|
|
274
|
-
messageId: string,
|
|
275
|
-
dialogId: QBChatDialog["_id"],
|
|
276
|
-
userId: QBUser["id"]
|
|
277
|
-
) => void;
|
|
278
|
-
onReadStatusListener?: (
|
|
279
|
-
messageId: string,
|
|
280
|
-
dialogId: QBChatDialog["_id"],
|
|
281
|
-
userId: QBUser["id"]
|
|
282
|
-
) => void;
|
|
283
|
-
onSystemMessageListener?: (message: QBSystemMessage) => void;
|
|
284
|
-
onReconnectFailedListener?: (error: unknown) => void;
|
|
285
|
-
onDisconnectedListener?: VoidFunction;
|
|
286
|
-
onReconnectListener?: VoidFunction;
|
|
287
698
|
}
|
|
288
699
|
|
|
289
|
-
export declare interface
|
|
290
|
-
account_id: number;
|
|
291
|
-
app_id: number;
|
|
700
|
+
export declare interface QBDataFile {
|
|
292
701
|
content_type: string;
|
|
293
|
-
|
|
294
|
-
id: number;
|
|
702
|
+
file_id: string;
|
|
295
703
|
name: string;
|
|
296
|
-
public: boolean;
|
|
297
704
|
size: number;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
export declare interface QBBlob {
|
|
708
|
+
id: number;
|
|
298
709
|
uid: string;
|
|
710
|
+
content_type: string;
|
|
711
|
+
name: string;
|
|
712
|
+
size: number;
|
|
713
|
+
created_at: string;
|
|
299
714
|
updated_at: string;
|
|
715
|
+
blob_status: string;
|
|
716
|
+
set_completed_at: number;
|
|
717
|
+
public: boolean;
|
|
718
|
+
}
|
|
719
|
+
export declare interface QBBlobCreate extends QBBlob {
|
|
720
|
+
account_id: number;
|
|
721
|
+
app_id: number;
|
|
722
|
+
blob_object_access: {
|
|
723
|
+
id: number;
|
|
724
|
+
blob_id: number;
|
|
725
|
+
expires: string;
|
|
726
|
+
object_access_type: string;
|
|
727
|
+
params: string;
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
export declare interface QBBlobCreateUploadParams {
|
|
731
|
+
name: string;
|
|
732
|
+
file: File;
|
|
733
|
+
type: string;
|
|
734
|
+
size: number;
|
|
735
|
+
public?: boolean; // optional, "false" by default
|
|
736
|
+
}
|
|
737
|
+
interface QBContentModule {
|
|
738
|
+
/** Create new file object. */
|
|
739
|
+
create(
|
|
740
|
+
params: { name: string; content_type: string; public?: boolean },
|
|
741
|
+
callback: QBCallback<QBBlobCreate>
|
|
742
|
+
): void;
|
|
743
|
+
/**
|
|
744
|
+
* Create file > upload file > mark file as uploaded > return result
|
|
745
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#upload-file)).
|
|
746
|
+
*/
|
|
747
|
+
createAndUpload(
|
|
748
|
+
params: QBBlobCreateUploadParams,
|
|
749
|
+
callback: QBCallback<QBBlob>
|
|
750
|
+
): void;
|
|
751
|
+
/**
|
|
752
|
+
* Delete file by id
|
|
753
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#delete-file)).
|
|
754
|
+
*/
|
|
755
|
+
delete(id: number, callback: QBCallback<any>): void;
|
|
756
|
+
/**
|
|
757
|
+
* Download file by UID.
|
|
758
|
+
* If the file is public then it's possible to download it without a session token
|
|
759
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#download-file-by-uid)).
|
|
760
|
+
*/
|
|
761
|
+
getFile(uid: string, callback: QBCallback<{ blob: QBBlob }>): void;
|
|
762
|
+
/**
|
|
763
|
+
* Retrieve file object info by id
|
|
764
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#get-file-info)).
|
|
765
|
+
*/
|
|
766
|
+
getInfo(id: number, callback: QBCallback<{ blob: QBBlob }>): void;
|
|
767
|
+
/**
|
|
768
|
+
* Get a list of files for current user
|
|
769
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#retrieve-files)).
|
|
770
|
+
*/
|
|
771
|
+
list(
|
|
772
|
+
params: { page?: number, per_page?: number },
|
|
773
|
+
callback: QBCallback<{
|
|
774
|
+
current_page: number;
|
|
775
|
+
per_page: number;
|
|
776
|
+
total_entries: number;
|
|
777
|
+
items: Array<{
|
|
778
|
+
blob: QBBlob;
|
|
779
|
+
}>
|
|
780
|
+
}>
|
|
781
|
+
): void
|
|
782
|
+
/** Declare file uploaded. The file's 'status' field will be set to 'complete'. */
|
|
783
|
+
markUploaded(
|
|
784
|
+
params: { id: number; size: number },
|
|
785
|
+
callback: QBCallback<{ blob: { size: number } }>
|
|
786
|
+
): void;
|
|
787
|
+
/**
|
|
788
|
+
* Edit a file by ID
|
|
789
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#update-file)).
|
|
790
|
+
*/
|
|
791
|
+
update(
|
|
792
|
+
params: {
|
|
793
|
+
id: QBBlob['id']
|
|
794
|
+
name?: QBBlob['name']
|
|
795
|
+
},
|
|
796
|
+
callback: QBCallback<{ blob: QBBlob }>
|
|
797
|
+
): void;
|
|
798
|
+
/** Upload a file to cloud storage. */
|
|
799
|
+
upload(
|
|
800
|
+
params: {
|
|
801
|
+
url: string;
|
|
802
|
+
data: Dictionary<any>;
|
|
803
|
+
},
|
|
804
|
+
callback: QBCallback<any>
|
|
805
|
+
): void;
|
|
806
|
+
/**
|
|
807
|
+
* Get private URL for file download by file_uid (blob_uid)
|
|
808
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#get-private-url)).
|
|
809
|
+
*/
|
|
810
|
+
privateUrl(fileUID: string): string;
|
|
811
|
+
/**
|
|
812
|
+
* Get public URL for file download by file_uid (blob_uid)
|
|
813
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#get-public-url)).
|
|
814
|
+
*/
|
|
815
|
+
publicUrl(fileUID: string): string;
|
|
300
816
|
}
|
|
301
817
|
|
|
302
|
-
interface
|
|
818
|
+
export declare interface QBCustomObjectAccess {
|
|
303
819
|
access: "open" | "owner" | "open_for_users_ids" | "open_for_groups";
|
|
304
|
-
|
|
820
|
+
ids?: string[];
|
|
821
|
+
groups?: string[];
|
|
305
822
|
}
|
|
306
823
|
|
|
307
|
-
interface
|
|
308
|
-
create
|
|
309
|
-
read
|
|
310
|
-
update
|
|
311
|
-
delete
|
|
824
|
+
export declare interface QBCustomObjectPermissions {
|
|
825
|
+
create?: QBCustomObjectAccess;
|
|
826
|
+
read?: QBCustomObjectAccess;
|
|
827
|
+
update?: QBCustomObjectAccess;
|
|
828
|
+
delete?: QBCustomObjectAccess;
|
|
312
829
|
}
|
|
313
830
|
|
|
314
831
|
export declare interface QBCustomObject {
|
|
@@ -325,45 +842,7 @@ export declare interface QBCustomObject {
|
|
|
325
842
|
created_at: number;
|
|
326
843
|
/** Date & time when record was updated, filled automatically */
|
|
327
844
|
updated_at: number;
|
|
328
|
-
permissions
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export declare interface QBDataFile {
|
|
332
|
-
content_type: string;
|
|
333
|
-
file_id: string;
|
|
334
|
-
name: string;
|
|
335
|
-
size: number;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export declare interface BlobObject extends QBContentObject {
|
|
339
|
-
blob_object_access: { params: string };
|
|
340
|
-
blob_status: unknown;
|
|
341
|
-
set_completed_at: unknown;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
interface QBContentModule {
|
|
345
|
-
privateUrl(fileUID: string): string;
|
|
346
|
-
publicUrl(fileUID: string): string;
|
|
347
|
-
getInfo(id: number, callback: QBCallback<{ blob: QBContentObject }>);
|
|
348
|
-
create(
|
|
349
|
-
params: { name: string; content_type: string; public?: boolean },
|
|
350
|
-
callback: QBCallback<BlobObject>
|
|
351
|
-
);
|
|
352
|
-
markUploaded(
|
|
353
|
-
params: { id: number; size: number },
|
|
354
|
-
callback: QBCallback<unknown>
|
|
355
|
-
);
|
|
356
|
-
delete(id: number, callback: QBCallback<unknown>);
|
|
357
|
-
createAndUpload(
|
|
358
|
-
params: {
|
|
359
|
-
name: string;
|
|
360
|
-
file: Buffer;
|
|
361
|
-
type: string;
|
|
362
|
-
size: number;
|
|
363
|
-
public?: boolean;
|
|
364
|
-
},
|
|
365
|
-
callback: QBCallback<QBContentObject>
|
|
366
|
-
);
|
|
845
|
+
// permissions?: Required<QBCustomObjectPermissions>;
|
|
367
846
|
}
|
|
368
847
|
|
|
369
848
|
export declare interface QBDataDeletedResponse {
|
|
@@ -372,19 +851,70 @@ export declare interface QBDataDeletedResponse {
|
|
|
372
851
|
}
|
|
373
852
|
|
|
374
853
|
interface QBDataModule {
|
|
854
|
+
/**
|
|
855
|
+
* Create new custom object
|
|
856
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#create-records)).
|
|
857
|
+
*/
|
|
375
858
|
create<T extends QBCustomObject>(
|
|
376
859
|
className: string,
|
|
377
|
-
data: Dictionary<
|
|
860
|
+
data: { permissions?: QBCustomObjectPermissions; } & Dictionary<any>,
|
|
378
861
|
callback: QBCallback<T>
|
|
379
862
|
): void;
|
|
380
|
-
|
|
863
|
+
/**
|
|
864
|
+
* Delete record/records by ID, IDs or criteria (filters) of particular class
|
|
865
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#delete-records)).
|
|
866
|
+
*/
|
|
867
|
+
delete(
|
|
381
868
|
className: string,
|
|
382
|
-
ids:
|
|
869
|
+
ids: QBCustomObject["_id"] | Array<QBCustomObject["_id"]>,
|
|
383
870
|
callback: QBCallback<QBDataDeletedResponse>
|
|
384
871
|
): void;
|
|
872
|
+
/**
|
|
873
|
+
* Delete record/records by ID, IDs or criteria (filters) of particular class
|
|
874
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#delete-records)).
|
|
875
|
+
*/
|
|
876
|
+
delete(
|
|
877
|
+
className: string,
|
|
878
|
+
criteria: Dictionary<any>,
|
|
879
|
+
callback: QBCallback<{ total_deleted: number }>
|
|
880
|
+
): void;
|
|
881
|
+
/**
|
|
882
|
+
* Delete file from file field by ID
|
|
883
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#delete-file)).
|
|
884
|
+
*/
|
|
885
|
+
deleteFile(
|
|
886
|
+
className: string,
|
|
887
|
+
params: { id: string; field_name: string },
|
|
888
|
+
callback: QBCallback<any>
|
|
889
|
+
): void;
|
|
890
|
+
/**
|
|
891
|
+
* Download file from file field by ID
|
|
892
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#download-file)).
|
|
893
|
+
*/
|
|
894
|
+
downloadFile(
|
|
895
|
+
className: string,
|
|
896
|
+
params: { id: string; field_name: string },
|
|
897
|
+
callback: QBCallback<any>
|
|
898
|
+
): void;
|
|
899
|
+
/** Return file's URL from file field by ID. */
|
|
900
|
+
fileUrl(
|
|
901
|
+
className: string,
|
|
902
|
+
params: { id: string; field_name: string }
|
|
903
|
+
): string;
|
|
904
|
+
/**
|
|
905
|
+
* Search for records of particular class
|
|
906
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#retrieve-records)).
|
|
907
|
+
*/
|
|
385
908
|
list<T extends QBCustomObject>(
|
|
386
909
|
className: string,
|
|
387
|
-
filters:
|
|
910
|
+
filters: {
|
|
911
|
+
limit?: number;
|
|
912
|
+
skip?: number;
|
|
913
|
+
sort_asc?: string;
|
|
914
|
+
sort_desc?: string;
|
|
915
|
+
group_by?: string;
|
|
916
|
+
[field: string]: any;
|
|
917
|
+
},
|
|
388
918
|
callback: QBCallback<{
|
|
389
919
|
class_name: string;
|
|
390
920
|
items: T[];
|
|
@@ -392,101 +922,108 @@ interface QBDataModule {
|
|
|
392
922
|
skip: number;
|
|
393
923
|
}>
|
|
394
924
|
): void;
|
|
925
|
+
/**
|
|
926
|
+
* Update record by ID of particular class
|
|
927
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#update-records)).
|
|
928
|
+
*/
|
|
395
929
|
update<
|
|
396
|
-
D extends { _id: string } & Dictionary<unknown>,
|
|
397
930
|
T extends QBCustomObject
|
|
398
931
|
>(
|
|
399
932
|
className: string,
|
|
400
|
-
data:
|
|
933
|
+
data: { _id: string; permissions?: QBCustomObjectPermissions; } & Dictionary<any>,
|
|
401
934
|
callback: QBCallback<T>
|
|
402
935
|
): void;
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
936
|
+
/**
|
|
937
|
+
* Upload file to file field
|
|
938
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#files)).
|
|
939
|
+
*/
|
|
407
940
|
uploadFile(
|
|
408
941
|
className: string,
|
|
409
942
|
params: { id: string; field_name: string; file: File; name: string },
|
|
410
943
|
callback: QBCallback<QBDataFile>
|
|
411
944
|
): void;
|
|
412
|
-
deleteFile(
|
|
413
|
-
className: string,
|
|
414
|
-
params: { id: string; field_name: string },
|
|
415
|
-
callback: QBCallback<unknown>
|
|
416
|
-
);
|
|
417
945
|
}
|
|
418
946
|
|
|
419
|
-
export declare interface QBCreateUserWithLogin {
|
|
420
|
-
login: string;
|
|
421
|
-
password: string;
|
|
422
|
-
blob_id?: number;
|
|
423
|
-
custom_data?: string | null;
|
|
424
|
-
email?: string;
|
|
425
|
-
external_user_id?: string | number;
|
|
426
|
-
facebook_id?: string;
|
|
427
|
-
full_name?: string;
|
|
428
|
-
phone?: string;
|
|
429
|
-
tag_list?: string | string[];
|
|
430
|
-
website?: string;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
export declare interface QBCreateUserWithEmail {
|
|
434
|
-
email: string;
|
|
435
|
-
password: string;
|
|
436
|
-
blob_id?: number;
|
|
437
|
-
custom_data?: string | null;
|
|
438
|
-
external_user_id?: string | number;
|
|
439
|
-
facebook_id?: string;
|
|
440
|
-
full_name?: string;
|
|
441
|
-
login?: string;
|
|
442
|
-
phone?: string;
|
|
443
|
-
tag_list?: string | string[];
|
|
444
|
-
website?: string;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
export declare type GetUserParam =
|
|
448
|
-
| { login: string }
|
|
449
|
-
| { full_name: string }
|
|
450
|
-
| { facebook_id: string }
|
|
451
|
-
| { phone: string }
|
|
452
|
-
| { email: string }
|
|
453
|
-
| { tags: string }
|
|
454
|
-
| { external: string };
|
|
455
|
-
|
|
456
|
-
export declare type GetUserParams =
|
|
457
|
-
| GetUserParam
|
|
458
|
-
| {
|
|
459
|
-
page?: number;
|
|
460
|
-
per_page?: number;
|
|
461
|
-
};
|
|
462
|
-
|
|
463
947
|
export declare type ListUserParams = {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
948
|
+
page?: number;
|
|
949
|
+
per_page?: number;
|
|
950
|
+
filter?: Dictionary<any>;
|
|
951
|
+
order?: string;
|
|
468
952
|
};
|
|
469
953
|
|
|
954
|
+
export declare type GetUserParams =
|
|
955
|
+
| { login: string }
|
|
956
|
+
| { full_name: string; page?: number; per_page?: number }
|
|
957
|
+
| { facebook_id: string }
|
|
958
|
+
| { phone: string }
|
|
959
|
+
| { email: string }
|
|
960
|
+
| { tags: string | string[]; page?: number; per_page?: number }
|
|
961
|
+
| Omit<ListUserParams, 'filter'>
|
|
962
|
+
| { external: string };
|
|
963
|
+
|
|
470
964
|
interface QBUsersModule {
|
|
471
|
-
|
|
965
|
+
/**
|
|
966
|
+
* Registers a new app user.
|
|
967
|
+
* Call this API to register a user for the app.
|
|
968
|
+
* You must provide either a user login or email address along with their password,
|
|
969
|
+
* passing both email address and login is permitted but not required
|
|
970
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#create-user)).
|
|
971
|
+
*/
|
|
972
|
+
create(
|
|
973
|
+
params: QBUserCreateParams,
|
|
974
|
+
callback: QBCallback<QBUser>
|
|
975
|
+
): void;
|
|
976
|
+
/**
|
|
977
|
+
* Remove a user from the app, by user's id that represents the user in an external user registry.
|
|
978
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#delete-user)).
|
|
979
|
+
*/
|
|
980
|
+
delete(userId: QBUser['id'], callback: QBCallback<any>): void;
|
|
981
|
+
/**
|
|
982
|
+
* Remove a user from the app, by user's external id that represents the user in an external user registry.
|
|
983
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#delete-user)).
|
|
984
|
+
*/
|
|
985
|
+
delete(params: { external: number }, callback: QBCallback<any>): void;
|
|
986
|
+
/**
|
|
987
|
+
* Retrieve the user by id.
|
|
988
|
+
*/
|
|
989
|
+
get(userId: QBUser['id'], callback: QBCallback<QBUser>): void;
|
|
990
|
+
/**
|
|
991
|
+
* Retrieve a specific users.
|
|
992
|
+
*/
|
|
472
993
|
get(params: GetUserParams, callback: QBCallback<ListUserResponse>): void;
|
|
994
|
+
/**
|
|
995
|
+
* Call this API to get a list of current users of you app.
|
|
996
|
+
* By default it returns upto 10 users, but you can change this by adding pagination parameters.
|
|
997
|
+
* You can filter the list of users by supplying a filter string. You can sort results by ask/desc
|
|
998
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#retrieve-users)).
|
|
999
|
+
*/
|
|
473
1000
|
listUsers(
|
|
474
1001
|
params: ListUserParams,
|
|
475
1002
|
callback: QBCallback<ListUserResponse>
|
|
476
1003
|
): void;
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
1004
|
+
/**
|
|
1005
|
+
* You can initiate password resets for users who have emails associated with their account.
|
|
1006
|
+
* Password reset instruction will be sent to this email address
|
|
1007
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#reset-user-password)).
|
|
1008
|
+
*/
|
|
1009
|
+
resetPassword(email: string, callback: QBCallback<any>): void;
|
|
1010
|
+
/**
|
|
1011
|
+
* Update current user. In normal usage,
|
|
1012
|
+
* nobody except the user is allowed to modify their own data.
|
|
1013
|
+
* Any fields you don’t specify will remain unchanged,
|
|
1014
|
+
* so you can update just a subset of the user’s data.
|
|
1015
|
+
* login/email and password may be changed,
|
|
1016
|
+
* but the new login/email must not already be in use
|
|
1017
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#update-user)).
|
|
1018
|
+
*/
|
|
482
1019
|
update(
|
|
483
1020
|
userId: number,
|
|
484
|
-
user:
|
|
1021
|
+
user: QBUserUpdate,
|
|
485
1022
|
callback: QBCallback<QBUser>
|
|
486
1023
|
): void;
|
|
487
1024
|
}
|
|
488
1025
|
|
|
489
|
-
export declare interface
|
|
1026
|
+
export declare interface QBMediaParams {
|
|
490
1027
|
audio: MediaStreamConstraints["audio"];
|
|
491
1028
|
video: MediaStreamConstraints["video"];
|
|
492
1029
|
/** Id attribute of HTMLVideoElement */
|
|
@@ -497,6 +1034,19 @@ export declare interface QBGetUserMediaParams {
|
|
|
497
1034
|
};
|
|
498
1035
|
}
|
|
499
1036
|
|
|
1037
|
+
declare enum QBWebRTCSessionState {
|
|
1038
|
+
NEW = 1,
|
|
1039
|
+
ACTIVE = 2,
|
|
1040
|
+
HUNGUP = 3,
|
|
1041
|
+
REJECTED = 4,
|
|
1042
|
+
CLOSED = 5,
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
declare enum QBWebRTCCallType {
|
|
1046
|
+
VIDEO = 1,
|
|
1047
|
+
AUDIO = 2,
|
|
1048
|
+
}
|
|
1049
|
+
|
|
500
1050
|
export declare interface QBWebRTCSession {
|
|
501
1051
|
State: {
|
|
502
1052
|
NEW: 1;
|
|
@@ -507,38 +1057,84 @@ export declare interface QBWebRTCSession {
|
|
|
507
1057
|
};
|
|
508
1058
|
ID: string;
|
|
509
1059
|
/**
|
|
510
|
-
* One of
|
|
1060
|
+
* One of
|
|
1061
|
+
* - state=1 (`NEW`)
|
|
1062
|
+
* - state=2 (`ACTIVE`)
|
|
1063
|
+
* - state=3 (`HUNGUP`)
|
|
1064
|
+
* - state=4 (`REJECTED`)
|
|
1065
|
+
* - state=5 (`CLOSED`)
|
|
1066
|
+
*/
|
|
1067
|
+
state: QBWebRTCSessionState;
|
|
1068
|
+
initiatorID: QBUser['id'];
|
|
1069
|
+
currentUserID: QBUser['id'];
|
|
1070
|
+
opponentsIDs: Array<QBUser['id']>;
|
|
1071
|
+
peerConnections: { [userId: QBUser['id']]: RTCPeerConnection };
|
|
1072
|
+
acceptCallTime: string
|
|
1073
|
+
bandwidth: number
|
|
1074
|
+
/**
|
|
1075
|
+
* One of
|
|
1076
|
+
* - callType=1 (`VIDEO`)
|
|
1077
|
+
* - callType=2 (`AUDIO`)
|
|
511
1078
|
*/
|
|
512
|
-
|
|
513
|
-
initiatorID: number;
|
|
514
|
-
opponentsIDs: number[];
|
|
515
|
-
peerConnections: { [userId: number]: RTCPeerConnection };
|
|
516
|
-
callType: 1 | 2;
|
|
1079
|
+
callType: QBWebRTCCallType;
|
|
517
1080
|
startCallTime?: Date;
|
|
518
1081
|
localStream?: MediaStream;
|
|
519
|
-
mediaParams:
|
|
1082
|
+
mediaParams: QBMediaParams | null;
|
|
1083
|
+
/**
|
|
1084
|
+
* Get the user media stream
|
|
1085
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#access-local-media-stream)).
|
|
1086
|
+
*/
|
|
520
1087
|
getUserMedia(
|
|
521
|
-
params:
|
|
1088
|
+
params: QBMediaParams,
|
|
522
1089
|
callback: QBCallback<MediaStream>
|
|
523
1090
|
): void;
|
|
524
|
-
/**
|
|
1091
|
+
/**
|
|
1092
|
+
* Attach media stream to audio/video element
|
|
1093
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#attach-local-media-stream)).
|
|
1094
|
+
*/
|
|
525
1095
|
attachMediaStream(
|
|
526
1096
|
videoElemId: string,
|
|
527
1097
|
stream: MediaStream,
|
|
528
|
-
options?:
|
|
1098
|
+
options?: QBMediaParams["options"]
|
|
529
1099
|
): void;
|
|
530
1100
|
/** Detach media stream from audio/video element */
|
|
531
1101
|
detachMediaStream(videoElemId: string): void;
|
|
1102
|
+
/**
|
|
1103
|
+
* Mutes the stream
|
|
1104
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling-advanced#mute-audio)).
|
|
1105
|
+
*/
|
|
532
1106
|
mute(type: "audio" | "video"): void;
|
|
1107
|
+
/**
|
|
1108
|
+
* Unmutes the stream
|
|
1109
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling-advanced#mute-audio)).
|
|
1110
|
+
*/
|
|
533
1111
|
unmute(type: "audio" | "video"): void;
|
|
534
|
-
/**
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
1112
|
+
/**
|
|
1113
|
+
* Initiate a call
|
|
1114
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#make-a-call)).
|
|
1115
|
+
*/
|
|
1116
|
+
call(extension: Dictionary<any>, callback?: (error: null) => void): void;
|
|
1117
|
+
/**
|
|
1118
|
+
* Accept a call
|
|
1119
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#accept-a-call)).
|
|
1120
|
+
*/
|
|
1121
|
+
accept(extension: Dictionary<any>): void;
|
|
1122
|
+
/**
|
|
1123
|
+
* Reject a call
|
|
1124
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#reject-a-call)).
|
|
1125
|
+
*/
|
|
1126
|
+
reject(extension: Dictionary<any>): void;
|
|
1127
|
+
/**
|
|
1128
|
+
* Stop a call
|
|
1129
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#end-a-call)).
|
|
1130
|
+
*/
|
|
1131
|
+
stop(extension: Dictionary<any>): void;
|
|
1132
|
+
/** Update a call. */
|
|
1133
|
+
update(extension:Dictionary<any>, userID?: QBUser['id']): void;
|
|
1134
|
+
/**
|
|
1135
|
+
* Switch media tracks in audio/video HTML's element and replace its in peers
|
|
1136
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling-advanced#switch-camera)).
|
|
1137
|
+
*/
|
|
542
1138
|
switchMediaTracks(
|
|
543
1139
|
deviceIds: { audio?: { exact: string }; video?: { exact: string } },
|
|
544
1140
|
callback: QBCallback<MediaStream>
|
|
@@ -552,49 +1148,247 @@ export declare interface QBWebRTCModule {
|
|
|
552
1148
|
VIDEO: 1;
|
|
553
1149
|
AUDIO: 2;
|
|
554
1150
|
};
|
|
1151
|
+
sessions: {
|
|
1152
|
+
[sessionId: string]: QBWebRTCSession;
|
|
1153
|
+
};
|
|
1154
|
+
/** Return data or all active devices. */
|
|
555
1155
|
getMediaDevices(kind?: MediaDeviceKind): Promise<MediaDeviceInfo[]>;
|
|
556
|
-
|
|
1156
|
+
/**
|
|
1157
|
+
* Creates the new session
|
|
1158
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#create-session)).
|
|
1159
|
+
*/
|
|
1160
|
+
createNewSession(
|
|
1161
|
+
opponentsIds: number[],
|
|
1162
|
+
callType?: QBWebRTCCallType,
|
|
1163
|
+
initiatorID?: QBUser['id'],
|
|
1164
|
+
opts?: { bandwidth: number }
|
|
1165
|
+
): QBWebRTCSession;
|
|
1166
|
+
/** Deletes a session. */
|
|
1167
|
+
clearSession(sessionId: QBWebRTCSession['ID']): void;
|
|
1168
|
+
/** Check all session and find session with status 'NEW' or 'ACTIVE' which ID != provided. */
|
|
1169
|
+
isExistLiveSessionExceptSessionID(sessionId: QBWebRTCSession['ID']): boolean;
|
|
1170
|
+
/** Get new sessions count */
|
|
1171
|
+
getNewSessionsCount(exceptSessionId?: QBWebRTCSession['ID']): number;
|
|
1172
|
+
|
|
557
1173
|
onAcceptCallListener?: (
|
|
558
1174
|
session: QBWebRTCSession,
|
|
559
|
-
userId:
|
|
560
|
-
userInfo: Dictionary<
|
|
1175
|
+
userId: QBUser['id'],
|
|
1176
|
+
userInfo: Dictionary<any>
|
|
561
1177
|
) => void;
|
|
562
1178
|
onCallListener?: (
|
|
563
1179
|
session: QBWebRTCSession,
|
|
564
|
-
userInfo: Dictionary<
|
|
1180
|
+
userInfo: Dictionary<any>
|
|
565
1181
|
) => void;
|
|
566
1182
|
onCallStatsReport?: (
|
|
567
1183
|
session: QBWebRTCSession,
|
|
568
|
-
userId:
|
|
1184
|
+
userId: QBUser['id'],
|
|
569
1185
|
stats: string[]
|
|
570
1186
|
) => void;
|
|
571
1187
|
onRejectCallListener?: (
|
|
572
1188
|
session: QBWebRTCSession,
|
|
573
|
-
userId:
|
|
574
|
-
userInfo: Dictionary<
|
|
1189
|
+
userId: QBUser['id'],
|
|
1190
|
+
userInfo: Dictionary<any>
|
|
575
1191
|
) => void;
|
|
576
1192
|
onRemoteStreamListener?: (
|
|
577
1193
|
sesion: QBWebRTCSession,
|
|
578
|
-
userId:
|
|
1194
|
+
userId: QBUser['id'],
|
|
579
1195
|
stream: MediaStream
|
|
580
1196
|
) => void;
|
|
581
1197
|
onSessionCloseListener?: (session: QBWebRTCSession) => void;
|
|
582
1198
|
onSessionConnectionStateChangedListener?: (
|
|
583
1199
|
sesion: QBWebRTCSession,
|
|
584
|
-
userId:
|
|
585
|
-
state:
|
|
1200
|
+
userId: QBUser['id'],
|
|
1201
|
+
state: any
|
|
586
1202
|
) => void;
|
|
587
1203
|
onStopCallListener?: (
|
|
588
1204
|
session: QBWebRTCSession,
|
|
589
|
-
userId:
|
|
590
|
-
userInfo: Dictionary<
|
|
1205
|
+
userId: QBUser['id'],
|
|
1206
|
+
userInfo: Dictionary<any>
|
|
591
1207
|
) => void;
|
|
592
1208
|
onUpdateCallListener?: (
|
|
593
1209
|
session: QBWebRTCSession,
|
|
594
1210
|
userId: number,
|
|
595
|
-
userInfo: Dictionary<
|
|
1211
|
+
userInfo: Dictionary<any>
|
|
596
1212
|
) => void;
|
|
597
1213
|
onUserNotAnswerListener?: (session: QBWebRTCSession, userId: number) => void;
|
|
1214
|
+
onReconnectListener?: (session: QBWebRTCSession, userId: number, state: any) => void;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
declare interface QBPushNotificationsEventsCreate {
|
|
1218
|
+
/**
|
|
1219
|
+
* Type of notification.
|
|
1220
|
+
* Allowed values: push or email.
|
|
1221
|
+
*/
|
|
1222
|
+
notification_type: 'push' | 'email';
|
|
1223
|
+
/**
|
|
1224
|
+
* An environment of the notification.
|
|
1225
|
+
* Allowed values: development or production.
|
|
1226
|
+
*/
|
|
1227
|
+
environment: 'development' | 'production';
|
|
1228
|
+
/**
|
|
1229
|
+
* A payload of event. For push notifications:
|
|
1230
|
+
* if event[push_type] not present - should be Base64 encoded text.
|
|
1231
|
+
*/
|
|
1232
|
+
message: string;
|
|
1233
|
+
/**
|
|
1234
|
+
* Push Notification type.
|
|
1235
|
+
* Used only if event[notification_type] = push, ignored in other cases.
|
|
1236
|
+
* If not present - Notification will be delivered to all possible devices for specified users.
|
|
1237
|
+
* Each platform has their own standard format.
|
|
1238
|
+
* If specified - Notification will be delivered to the specified platform only.
|
|
1239
|
+
* Allowed values: apns, apns_voip, gcm, mpns or bbps.
|
|
1240
|
+
*/
|
|
1241
|
+
push_type?: 'apns' | 'apns_voip' | 'gcm' | 'mpns' | 'bbps';
|
|
1242
|
+
/**
|
|
1243
|
+
* Allowed values: one_shot, fixed_date or period_date. one_shot - a one-time event,
|
|
1244
|
+
* which causes by an external object (the value is only valid if the 'date' is not specified).
|
|
1245
|
+
* fixed_date - a one-time event, which occurs at a specified 'date' (the value is valid only if the 'date' is given).
|
|
1246
|
+
* period_date - reusable event that occurs within a given 'period' from the initial 'date'
|
|
1247
|
+
* (the value is only valid if the 'period' specified).
|
|
1248
|
+
* By default: fixed_date, if 'date' is specified. period_date, if 'period' is specified.
|
|
1249
|
+
* one_shot, if 'date' is not specified.
|
|
1250
|
+
*/
|
|
1251
|
+
event_type?: 'one_shot' | 'fixed_date' | 'period_date';
|
|
1252
|
+
/**
|
|
1253
|
+
* The name of the event. Service information.
|
|
1254
|
+
* Only for your own usage.
|
|
1255
|
+
*/
|
|
1256
|
+
name?: string;
|
|
1257
|
+
/**
|
|
1258
|
+
* The period of the event in seconds.
|
|
1259
|
+
* Required if the event[event_type] = period_date.
|
|
1260
|
+
* Possible values: 86400 (1 day). 604800 (1 week). 2592000 (1 month). 31557600 (1 year).
|
|
1261
|
+
*/
|
|
1262
|
+
period?: number;
|
|
1263
|
+
/**
|
|
1264
|
+
* The date of the event to send on.
|
|
1265
|
+
* Required if event[event_type] = fixed_date or period_date.
|
|
1266
|
+
* If event[event_type] = fixed_date, the date can not be in the pas.
|
|
1267
|
+
*/
|
|
1268
|
+
date?: number;
|
|
1269
|
+
user?: {
|
|
1270
|
+
/** Notification's recipients - should contain a string of users' ids divided by commas. */
|
|
1271
|
+
ids?: Array<QBUser['id']>
|
|
1272
|
+
tags?: {
|
|
1273
|
+
/**
|
|
1274
|
+
* Notification's recipients - should contain a string of tags divided by commas.
|
|
1275
|
+
* Recipients (users) must have at least one tag that specified in the list.
|
|
1276
|
+
*/
|
|
1277
|
+
any?: string[];
|
|
1278
|
+
/**
|
|
1279
|
+
* Notification's recipients - should contain a string of tags divided by commas.
|
|
1280
|
+
* Recipients (users) must exactly have only all tags that specified in list.
|
|
1281
|
+
*/
|
|
1282
|
+
all?: string[];
|
|
1283
|
+
/**
|
|
1284
|
+
* Notification's recipients - should contain a string of tags divided by commas.
|
|
1285
|
+
* Recipients (users) mustn't have tags that specified in list.
|
|
1286
|
+
*/
|
|
1287
|
+
exclude?: string[];
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
declare interface QBPushNotificationsSubscriptionsCreate {
|
|
1293
|
+
/**
|
|
1294
|
+
* Declare which notification channels could be used to notify user about events.
|
|
1295
|
+
* Allowed values: apns, apns_voip, gcm, mpns, bbps and email.
|
|
1296
|
+
*/
|
|
1297
|
+
notification_channel: 'apns' | 'apns_voip' | 'gcm' | 'mpns' | 'bbps' | 'email';
|
|
1298
|
+
push_token: {
|
|
1299
|
+
/**
|
|
1300
|
+
* Determine application mode.
|
|
1301
|
+
* It allows conveniently separate development and production modes.
|
|
1302
|
+
* Allowed values: development or production.
|
|
1303
|
+
*/
|
|
1304
|
+
environment: 'development' | 'production';
|
|
1305
|
+
/**
|
|
1306
|
+
* A unique identifier for client's application.
|
|
1307
|
+
* In iOS, this is the Bundle Identifier.
|
|
1308
|
+
* In Android - package id.
|
|
1309
|
+
*/
|
|
1310
|
+
bundle_identifier?: string;
|
|
1311
|
+
/**
|
|
1312
|
+
* Identifies client device in 3-rd party service like APNS, GCM/FCM, BBPS or MPNS.
|
|
1313
|
+
* Initially retrieved from 3-rd service and should be send to QuickBlox to let it send push notifications to the client.
|
|
1314
|
+
*/
|
|
1315
|
+
client_identification_sequence: string
|
|
1316
|
+
};
|
|
1317
|
+
device: {
|
|
1318
|
+
/**
|
|
1319
|
+
* Platform of device, which is the source of application running.
|
|
1320
|
+
* Allowed values: ios, android, windows_phone, blackberry.
|
|
1321
|
+
*/
|
|
1322
|
+
platform: 'ios' | 'android' | 'windows_phone' | 'blackberry';
|
|
1323
|
+
/**
|
|
1324
|
+
* UDID (Unique Device identifier) of device, which is the source of application running.
|
|
1325
|
+
* This must be anything sequence which uniquely identify particular device.
|
|
1326
|
+
* This is needed to support schema: 1 User - Multiple devices.
|
|
1327
|
+
*/
|
|
1328
|
+
udid: string;
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
export declare interface QBPushNotificationsModule {
|
|
1333
|
+
events: {
|
|
1334
|
+
/**
|
|
1335
|
+
* Create notification event.
|
|
1336
|
+
* This request will immediately produce notification delivery
|
|
1337
|
+
* (push notification or email)
|
|
1338
|
+
* ([read more](https://docs.quickblox.com/docs/js-push-notifications#send-push-notifications)).
|
|
1339
|
+
*/
|
|
1340
|
+
create(params: QBPushNotificationsEventsCreate, callback: QBCallback<any>): void;
|
|
1341
|
+
/** Delete an event by ID. */
|
|
1342
|
+
delete(id, callback: QBCallback<any>): void;
|
|
1343
|
+
/** Retrieve an event by ID. */
|
|
1344
|
+
get(id, callback: QBCallback<any>): void;
|
|
1345
|
+
/** Get list of events which were created by current user. */
|
|
1346
|
+
list(params, callback: QBCallback<any>): void;
|
|
1347
|
+
/** Retrieve an event's status by ID. */
|
|
1348
|
+
status(id, callback: QBCallback<any>): void;
|
|
1349
|
+
};
|
|
1350
|
+
subscriptions: {
|
|
1351
|
+
/** Create device based subscription. */
|
|
1352
|
+
create(params: QBPushNotificationsSubscriptionsCreate, callback: QBCallback<any>): void;
|
|
1353
|
+
/** Remove a subscription by its identifier. */
|
|
1354
|
+
delete(id: number, callback: QBCallback<any>): void;
|
|
1355
|
+
/** Retrieve subscriptions for the user which is specified in the session token. */
|
|
1356
|
+
list(callback: QBCallback<any>): void;
|
|
1357
|
+
};
|
|
1358
|
+
base64Encode(payload: any): string;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
export declare interface QBAddressBookModule {
|
|
1362
|
+
/**
|
|
1363
|
+
* Upload address book
|
|
1364
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#upload-address-book)).
|
|
1365
|
+
*/
|
|
1366
|
+
uploadAddressBook(contacts: any[], options: { udid?: string; force?: 1 }, callback: QBCallback<any>): void;
|
|
1367
|
+
/**
|
|
1368
|
+
* Upload address book
|
|
1369
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#upload-address-book)).
|
|
1370
|
+
*/
|
|
1371
|
+
uploadAddressBook(contacts: any[], callback: QBCallback<any>): void;
|
|
1372
|
+
/**
|
|
1373
|
+
* Retrieve address book
|
|
1374
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#retrieve-address-book)).
|
|
1375
|
+
*/
|
|
1376
|
+
get(UDID: string, callback: QBCallback<any>): void;
|
|
1377
|
+
/**
|
|
1378
|
+
* Retrieve address book
|
|
1379
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#retrieve-address-book)).
|
|
1380
|
+
*/
|
|
1381
|
+
get(callback: QBCallback<any>): void;
|
|
1382
|
+
/**
|
|
1383
|
+
* Retrieve registered users
|
|
1384
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#retrieve-registered-users)).
|
|
1385
|
+
*/
|
|
1386
|
+
getRegisteredUsers(isCompact: boolean, callback: QBCallback<any>): void;
|
|
1387
|
+
/**
|
|
1388
|
+
* Retrieve registered users
|
|
1389
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#retrieve-registered-users)).
|
|
1390
|
+
*/
|
|
1391
|
+
getRegisteredUsers(callback: QBCallback<any>): void;
|
|
598
1392
|
}
|
|
599
1393
|
|
|
600
1394
|
export declare type QBLoginParams =
|
|
@@ -607,33 +1401,50 @@ export declare type QBLoginParams =
|
|
|
607
1401
|
password: string;
|
|
608
1402
|
}
|
|
609
1403
|
| {
|
|
610
|
-
provider:
|
|
1404
|
+
provider: 'firebase_phone';
|
|
611
1405
|
firebase_phone: { access_token: string; project_id: string };
|
|
612
|
-
}
|
|
1406
|
+
}
|
|
1407
|
+
| {
|
|
1408
|
+
provider: 'facebook';
|
|
1409
|
+
keys: { token: string, secret: string | null };
|
|
1410
|
+
};
|
|
613
1411
|
|
|
614
1412
|
export class QuickBlox {
|
|
1413
|
+
version: string;
|
|
615
1414
|
buildNumber: string;
|
|
616
|
-
|
|
617
1415
|
chat: QBChatModule;
|
|
618
|
-
|
|
619
1416
|
content: QBContentModule;
|
|
620
|
-
|
|
621
1417
|
data: QBDataModule;
|
|
622
|
-
|
|
1418
|
+
users: QBUsersModule;
|
|
1419
|
+
webrtc: QBWebRTCModule;
|
|
1420
|
+
pushnotifications: QBPushNotificationsModule;
|
|
1421
|
+
addressbook: QBAddressBookModule;
|
|
1422
|
+
/**
|
|
1423
|
+
* Create new session
|
|
1424
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#create-session)).
|
|
1425
|
+
*/
|
|
623
1426
|
createSession: {
|
|
624
1427
|
(callback: QBCallback<QBSession>): void;
|
|
625
1428
|
(params: QBLoginParams, callback: QBCallback<QBSession>): void;
|
|
626
1429
|
};
|
|
627
|
-
|
|
628
1430
|
startSessionWithToken(
|
|
629
1431
|
token: string,
|
|
630
1432
|
callback: QBCallback<{ session: QBSession }>
|
|
631
1433
|
);
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
1434
|
+
/**
|
|
1435
|
+
* Destroy current session
|
|
1436
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#destroy-session-token)).
|
|
1437
|
+
*/
|
|
1438
|
+
destroySession(callback: QBCallback<any>): void;
|
|
1439
|
+
/**
|
|
1440
|
+
* Return current session
|
|
1441
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#get-session)).
|
|
1442
|
+
*/
|
|
635
1443
|
getSession(callback: QBCallback<{ session: QBSession }>): void;
|
|
636
|
-
|
|
1444
|
+
/**
|
|
1445
|
+
* Init QuickBlox SDK
|
|
1446
|
+
* ([read more](https://docs.quickblox.com/docs/js-setup#initialize-quickblox-sdk))
|
|
1447
|
+
*/
|
|
637
1448
|
init(
|
|
638
1449
|
appIdOrToken: string | number,
|
|
639
1450
|
authKeyOrAppId: string | number,
|
|
@@ -641,35 +1452,58 @@ export class QuickBlox {
|
|
|
641
1452
|
accountKey: string,
|
|
642
1453
|
config?: QBConfig
|
|
643
1454
|
): void;
|
|
1455
|
+
/**
|
|
1456
|
+
* Init QuickBlox SDK with User Account data to start session with token
|
|
1457
|
+
* ([read more](https://docs.quickblox.com/docs/js-setup#initialize-quickblox-sdk-without-authorization-key-and-secret)).
|
|
1458
|
+
*/
|
|
1459
|
+
initWithAppId(appId: number, accountKey: string, config?: QBConfig):void;
|
|
644
1460
|
|
|
1461
|
+
/**
|
|
1462
|
+
* Login to QuickBlox application
|
|
1463
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#log-in-user)).
|
|
1464
|
+
*/
|
|
645
1465
|
login(params: QBLoginParams, callback: QBCallback<QBUser>): void;
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
1466
|
+
/**
|
|
1467
|
+
* Remove user from current session, but doesn't destroy it
|
|
1468
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#log-out-user)).
|
|
1469
|
+
*/
|
|
1470
|
+
logout(callback: QBCallback<any>): void;
|
|
649
1471
|
service: {
|
|
650
1472
|
qbInst: {
|
|
651
1473
|
session: QBSession | null;
|
|
652
1474
|
config: {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
1475
|
+
endpoints: Required<Required<QBConfig>['endpoints']>,
|
|
1476
|
+
webrtc: Required<Required<QBConfig>['webrtc']>,
|
|
1477
|
+
chatProtocol: Required<Required<QBConfig>['chatProtocol']>,
|
|
1478
|
+
on: Required<Required<QBConfig>['on']>,
|
|
1479
|
+
streamManagement: Required<Required<QBConfig>['streamManagement']>,
|
|
1480
|
+
debug: QBConfig['debug'],
|
|
1481
|
+
version: string,
|
|
1482
|
+
buildNumber: string,
|
|
1483
|
+
creds: {
|
|
1484
|
+
appId: number,
|
|
1485
|
+
authKey: string,
|
|
1486
|
+
authSecret: string,
|
|
1487
|
+
accountKey: string,
|
|
1488
|
+
},
|
|
659
1489
|
urls: {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
1490
|
+
account: 'account_settings',
|
|
1491
|
+
session: 'session',
|
|
1492
|
+
login: 'login',
|
|
1493
|
+
users: 'users',
|
|
1494
|
+
chat: 'chat',
|
|
1495
|
+
blobs: 'blobs',
|
|
1496
|
+
subscriptions: 'subscriptions',
|
|
1497
|
+
events: 'events',
|
|
1498
|
+
data: 'data',
|
|
1499
|
+
addressbook: 'address_book',
|
|
1500
|
+
addressbookRegistered: 'address_book/registered_users',
|
|
1501
|
+
type: '.json'
|
|
1502
|
+
},
|
|
1503
|
+
qbTokenExpirationDate: Date | null,
|
|
664
1504
|
};
|
|
665
1505
|
};
|
|
666
1506
|
};
|
|
667
|
-
|
|
668
|
-
users: QBUsersModule;
|
|
669
|
-
|
|
670
|
-
webrtc: QBWebRTCModule;
|
|
671
|
-
|
|
672
|
-
version: string;
|
|
673
1507
|
}
|
|
674
1508
|
|
|
675
1509
|
interface QuickBloxConstructor {
|