quickblox 2.16.2 → 2.16.3

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