quickblox-react-ui-kit 0.3.0-beta.3 → 0.3.0-beta.4
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/dist/Data/Stubs.d.ts +1 -1
- package/dist/Data/dto/file/RemoteFileDTO.d.ts +1 -1
- package/dist/Data/dto/message/RemoteMessageDTO.d.ts +1 -1
- package/dist/Data/dto/user/LocalUserDTO.d.ts +1 -1
- package/dist/Data/dto/user/RemoteUserDTO.d.ts +2 -2
- package/dist/Domain/entity/FileEntity.d.ts +1 -1
- package/dist/Domain/entity/UserEntity.d.ts +1 -1
- package/dist/Presentation/Views/Dialog/AIComponents/AIAssist/AIAssist.d.ts +2 -1
- package/dist/Presentation/Views/Dialog/AIComponents/AITranslate/AITranslate.d.ts +2 -1
- package/dist/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.d.ts +1 -0
- package/dist/Presentation/Views/Dialog/ForwardMessageFlow/ForwardMessageFlow.d.ts +1 -0
- package/dist/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.d.ts +2 -2
- package/dist/Presentation/Views/Dialog/MessageContextMenu/MessageContextMenu.d.ts +2 -1
- package/dist/Presentation/Views/Dialog/MessageItem/MessageItem.d.ts +2 -1
- package/dist/Presentation/Views/DialogInfo/DialogInfo.d.ts +1 -0
- package/dist/Presentation/Views/DialogList/DialogList.d.ts +1 -0
- package/dist/Presentation/Views/EditDialog/EditDialog.d.ts +2 -1
- package/dist/Presentation/Views/Flow/CreateDialogFlow/CreateNewDialogFlow.d.ts +1 -0
- package/dist/Presentation/Views/PreviewDialog/PreviewDialog.d.ts +1 -0
- package/dist/Presentation/providers/QuickBloxUIKitProvider/useQBConnection.d.ts +1 -0
- package/dist/Presentation/ui-components/DialogWindow/DialogWindow.d.ts +3 -2
- package/dist/Presentation/ui-components/Dropdown/DropdownOption.d.ts +2 -1
- package/dist/Presentation/ui-components/MessageInput/AttachmentUploader/AttachmentUploader.d.ts +1 -0
- package/dist/Presentation/ui-components/MessageInput/MessageInput.d.ts +1 -0
- package/dist/index-ui.js +518 -362
- package/dist/index-ui.js.map +1 -1
- package/dist/qb-api-calls/index.d.ts +8 -7
- package/global.d.ts +2513 -546
- package/package.json +1 -1
- package/src/App.scss +3 -0
- package/src/App.tsx +2 -2
- package/src/Data/Creator.ts +1 -2
- package/src/Data/DefaultConfigurations.ts +4 -4
- package/src/Data/Stubs.ts +4 -5
- package/src/Data/dto/file/RemoteFileDTO.ts +2 -2
- package/src/Data/dto/message/RemoteMessageDTO.ts +1 -1
- package/src/Data/dto/user/LocalUserDTO.ts +2 -2
- package/src/Data/dto/user/RemoteUserDTO.ts +4 -4
- package/src/Data/mapper/FileRemoteDTOMapper.ts +8 -6
- package/src/Data/mapper/MessageRemoteDTOMapper.ts +1 -1
- package/src/Data/mapper/UserLocalDTOMapper.ts +2 -2
- package/src/Data/mapper/UserRemoteDTOMapper.ts +2 -2
- package/src/Data/repository/MessagesRepository.ts +2 -2
- package/src/Data/repository/UsersRepository.ts +1 -1
- package/src/Data/source/remote/Mapper/FileDTOMapper.ts +23 -23
- package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +2 -2
- package/src/Data/source/remote/Mapper/UserDTOMapper.ts +0 -2
- package/src/Data/source/remote/RemoteDataSource.ts +50 -8
- package/src/Domain/entity/FileEntity.ts +1 -1
- package/src/Domain/entity/UserEntity.ts +1 -11
- package/src/Domain/use_cases/UpdateDialogUseCase.ts +6 -1
- package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +1 -1
- package/src/Presentation/Views/Dialog/AIComponents/AIAssist/AIAssist.scss +5 -0
- package/src/Presentation/Views/Dialog/AIComponents/AIAssist/AIAssist.tsx +9 -2
- package/src/Presentation/Views/Dialog/AIComponents/AITranslate/AITranslate.scss +10 -0
- package/src/Presentation/Views/Dialog/AIComponents/AITranslate/AITranslate.tsx +16 -7
- package/src/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.scss +7 -2
- package/src/Presentation/Views/Dialog/AIWidgets/AIRephraseWidget/AIRephraseWidget.tsx +12 -3
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/DialogsWithSearch/DialogListItem/DialogListItem.scss +1 -1
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/ForwardMessageFlow.tsx +9 -5
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.scss +31 -1
- package/src/Presentation/Views/Dialog/ForwardMessageFlow/InputForForwarding/InputForForwarding.tsx +7 -7
- package/src/Presentation/Views/Dialog/MessageContextMenu/MessageContextMenu.tsx +17 -6
- package/src/Presentation/Views/Dialog/MessageItem/MessageItem.tsx +6 -0
- package/src/Presentation/Views/Dialog/useDialogViewModel.ts +1 -0
- package/src/Presentation/Views/DialogInfo/DialogInfo.scss +11 -1
- package/src/Presentation/Views/DialogInfo/DialogInfo.tsx +36 -18
- package/src/Presentation/Views/DialogInfo/UsersList/useUsersListViewModel.ts +1 -0
- package/src/Presentation/Views/DialogList/DialogList.scss +5 -0
- package/src/Presentation/Views/DialogList/DialogList.tsx +12 -2
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +33 -16
- package/src/Presentation/Views/EditDialog/EditDialog.scss +11 -0
- package/src/Presentation/Views/EditDialog/EditDialog.tsx +9 -1
- package/src/Presentation/Views/Flow/CreateDialogFlow/CreateNewDialogFlow.tsx +14 -0
- package/src/Presentation/Views/InviteMembers/useInviteMembersViewModel.ts +1 -11
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.tsx +4 -0
- package/src/Presentation/icons/media/video-file.svg +2 -2
- package/src/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +110 -52
- package/src/Presentation/providers/QuickBloxUIKitProvider/useQBConnection.ts +16 -0
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.scss +11 -0
- package/src/Presentation/ui-components/DialogWindow/DialogWindow.tsx +4 -1
- package/src/Presentation/ui-components/Dropdown/Dropdown.scss +4 -0
- package/src/Presentation/ui-components/Dropdown/Dropdown.tsx +1 -1
- package/src/Presentation/ui-components/Dropdown/DropdownOption.tsx +9 -1
- package/src/Presentation/ui-components/MessageInput/AttachmentUploader/AttachmentUploader.tsx +3 -0
- package/src/Presentation/ui-components/MessageInput/MessageInput.scss +18 -4
- package/src/Presentation/ui-components/MessageInput/MessageInput.tsx +8 -2
- package/src/Presentation/ui-components/PreviewFileMessage/PreviewFileMessage.tsx +2 -2
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.stories.tsx +2 -0
- package/src/QBconfig.ts +4 -4
- package/src/index.scss +5 -2
- package/src/qb-api-calls/index.ts +58 -49
- package/storybook-static/758.53b4954a.iframe.bundle.js +14 -0
- package/storybook-static/{758.e75a5a47.iframe.bundle.js.map → 758.53b4954a.iframe.bundle.js.map} +1 -1
- package/storybook-static/{Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.90aa44c5.iframe.bundle.js → Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.6665bbfb.iframe.bundle.js} +1 -1
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.cf340397.iframe.bundle.js +1 -0
- package/storybook-static/{Presentation-ui-components-Dropdown-Dropdown-stories.aacf2ec2.iframe.bundle.js → Presentation-ui-components-Dropdown-Dropdown-stories.b32a1e17.iframe.bundle.js} +1 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.c2ead6a5.iframe.bundle.js +1 -0
- package/storybook-static/{Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.1661d95b.iframe.bundle.js → Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.527e000e.iframe.bundle.js} +1 -1
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.2ff75703.iframe.bundle.js +1 -0
- package/storybook-static/iframe.html +2 -2
- package/storybook-static/project.json +1 -1
- package/storybook-static/{runtime~main.e945879b.iframe.bundle.js → runtime~main.12da9712.iframe.bundle.js} +1 -1
- package/storybook-static/static/css/{Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.e720ff21.chunk.css → Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bee082ca.chunk.css} +2 -2
- package/storybook-static/static/css/{Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.e720ff21.chunk.css.map → Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bee082ca.chunk.css.map} +1 -1
- package/storybook-static/static/css/{Presentation-ui-components-DialogWindow-DialogWindow-stories.6fb3af8d.chunk.css → Presentation-ui-components-DialogWindow-DialogWindow-stories.4f813450.chunk.css} +2 -2
- package/storybook-static/static/css/Presentation-ui-components-DialogWindow-DialogWindow-stories.4f813450.chunk.css.map +1 -0
- package/storybook-static/static/css/{Presentation-ui-components-Dropdown-Dropdown-stories.66965d64.chunk.css → Presentation-ui-components-Dropdown-Dropdown-stories.e37f549d.chunk.css} +2 -2
- package/storybook-static/static/css/Presentation-ui-components-Dropdown-Dropdown-stories.e37f549d.chunk.css.map +1 -0
- package/storybook-static/static/css/{Presentation-ui-components-MessageInput-MessageInput-stories.0e99d80b.chunk.css → Presentation-ui-components-MessageInput-MessageInput-stories.7eb916fc.chunk.css} +2 -2
- package/storybook-static/static/css/Presentation-ui-components-MessageInput-MessageInput-stories.7eb916fc.chunk.css.map +1 -0
- package/storybook-static/static/css/{main.6fa55a2c.css → main.a921485c.css} +2 -2
- package/storybook-static/static/css/{main.6fa55a2c.css.map → main.a921485c.css.map} +1 -1
- package/storybook-static/static/media/video-file.dbd1f8c63a3769f9e9a027f0922d56b2.svg +3 -0
- package/storybook-static/758.e75a5a47.iframe.bundle.js +0 -14
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.3523a670.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.262a0cf2.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.8f6fca84.iframe.bundle.js +0 -1
- package/storybook-static/static/css/Presentation-ui-components-DialogWindow-DialogWindow-stories.6fb3af8d.chunk.css.map +0 -1
- package/storybook-static/static/css/Presentation-ui-components-Dropdown-Dropdown-stories.66965d64.chunk.css.map +0 -1
- package/storybook-static/static/css/Presentation-ui-components-MessageInput-MessageInput-stories.0e99d80b.chunk.css.map +0 -1
- package/storybook-static/static/media/video-file.dc2971be489b2af7b1c04dcc55bfe881.svg +0 -3
package/global.d.ts
CHANGED
|
@@ -4,11 +4,7 @@ interface Tone {
|
|
|
4
4
|
iconEmoji: string;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
type Dictionary<T> = Record<string, T>;
|
|
8
|
-
|
|
9
|
-
type DictionaryByKey<T, V> = {
|
|
10
|
-
[K in keyof T]?: V;
|
|
11
|
-
};
|
|
7
|
+
// type Dictionary<T> = Record<string, T>; from SDK
|
|
12
8
|
|
|
13
9
|
type Primitive = string | number | boolean | undefined | null | Date | File;
|
|
14
10
|
|
|
@@ -18,11 +14,6 @@ type SetTails<T, R extends Primitive> = T extends Array<unknown>
|
|
|
18
14
|
[K in keyof T]: T[K] extends Primitive ? R : SetTails<T[K], R>;
|
|
19
15
|
};
|
|
20
16
|
|
|
21
|
-
interface DateRange {
|
|
22
|
-
from: Date;
|
|
23
|
-
to: Date;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
17
|
type ProxyConfig = {
|
|
27
18
|
api: string;
|
|
28
19
|
servername: string;
|
|
@@ -51,23 +42,24 @@ interface QBConfig {
|
|
|
51
42
|
accountKey: string;
|
|
52
43
|
authKey: string;
|
|
53
44
|
authSecret: string;
|
|
54
|
-
sessionToken: string;
|
|
45
|
+
sessionToken: string; // ??? ui-kit
|
|
55
46
|
};
|
|
56
47
|
configAIApi: {
|
|
48
|
+
// ui-kit
|
|
57
49
|
AIAnswerAssistWidgetConfig: WidgetConfig;
|
|
58
50
|
AITranslateWidgetConfig: AITranslateWidgetConfig;
|
|
59
51
|
AIRephraseWidgetConfig: AIRephraseWidgetConfig;
|
|
60
52
|
};
|
|
61
53
|
appConfig: {
|
|
62
|
-
maxFileSize: number;
|
|
63
|
-
sessionTimeOut: number;
|
|
54
|
+
maxFileSize: number; // ui-kit
|
|
55
|
+
sessionTimeOut: number; // ?? webRTc -> ui-kit
|
|
64
56
|
chatProtocol: {
|
|
65
57
|
active: number;
|
|
66
58
|
};
|
|
67
59
|
debug: boolean;
|
|
68
|
-
enableForwarding: boolean;
|
|
69
|
-
enableReplying: boolean;
|
|
70
|
-
regexUserName?: string;
|
|
60
|
+
enableForwarding: boolean; // ui-kit
|
|
61
|
+
enableReplying: boolean; // ui-kit
|
|
62
|
+
regexUserName?: string; // ui-kit
|
|
71
63
|
endpoints: {
|
|
72
64
|
api: string;
|
|
73
65
|
chat: string;
|
|
@@ -81,334 +73,1259 @@ interface QBConfig {
|
|
|
81
73
|
};
|
|
82
74
|
}
|
|
83
75
|
|
|
84
|
-
|
|
76
|
+
/*
|
|
77
|
+
* QuickBlox Types - start
|
|
78
|
+
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
type Dictionary<T> = Record<string, T>;
|
|
82
|
+
|
|
83
|
+
type RequiredProps<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
84
|
+
|
|
85
|
+
declare enum QBChatProtocol {
|
|
86
|
+
BOSH = 1,
|
|
87
|
+
WebSockets = 2,
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface ICEServer {
|
|
91
|
+
urls: string;
|
|
92
|
+
username: string;
|
|
93
|
+
credential: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// QBConfig in UI KIt should rename to QbUIKItConfig
|
|
97
|
+
|
|
98
|
+
// declare interface QBConfig {
|
|
99
|
+
// /** [Custom endpoints](https://docs.quickblox.com/docs/js-setup#section-custom-endpoints) configuration. */
|
|
100
|
+
// endpoints?: {
|
|
101
|
+
// /** API endpoint. */
|
|
102
|
+
// api?: string;
|
|
103
|
+
// /** Chat endpoint. */
|
|
104
|
+
// chat?: string;
|
|
105
|
+
// };
|
|
106
|
+
// /** [WebRTC](https://docs.quickblox.com/docs/js-video-calling-advanced#section-video-calling-settings) configuration. */
|
|
107
|
+
// webrtc?: {
|
|
108
|
+
// /**
|
|
109
|
+
// * Maximum answer time for the QB.webrtc.onUserNotAnswerListener callback to be fired.
|
|
110
|
+
// * The answer time interval shows how much time an opponent has to answer your call.
|
|
111
|
+
// */
|
|
112
|
+
// answerTimeInterval?: number;
|
|
113
|
+
// /**
|
|
114
|
+
// * If there is at least one active (recurring) call session and the autoReject is true,
|
|
115
|
+
// * the call gets rejected.
|
|
116
|
+
// */
|
|
117
|
+
// autoReject?: boolean;
|
|
118
|
+
// /**
|
|
119
|
+
// * If the number of active (recurring) call sessions
|
|
120
|
+
// * is more than it is defined by incomingLimit, the call gets rejected.
|
|
121
|
+
// */
|
|
122
|
+
// incomingLimit?: number;
|
|
123
|
+
// /**
|
|
124
|
+
// * The interval between call requests produced by the session.call() method.
|
|
125
|
+
// * Dialing time interval indicates how often to notify your opponents about your call.
|
|
126
|
+
// */
|
|
127
|
+
// dialingTimeInterval?: number;
|
|
128
|
+
// /**
|
|
129
|
+
// * If an opponent has lost the connection then, after this time,
|
|
130
|
+
// * the caller will know about it via the QB.webrtc.onSessionConnectionStateChangedListener callback.
|
|
131
|
+
// */
|
|
132
|
+
// disconnectTimeInterval?: number;
|
|
133
|
+
// /**
|
|
134
|
+
// * Allows access to the statistical information about peer connection state (connected, failed, disconnected, etc).
|
|
135
|
+
// * Set the number of seconds for the statistical information to be received.
|
|
136
|
+
// */
|
|
137
|
+
// statsReportTimeInterval?: boolean;
|
|
138
|
+
// /**
|
|
139
|
+
// * You can customize a list of ICE servers. By default,
|
|
140
|
+
// * WebRTC module will use internal ICE servers that are usually enough,
|
|
141
|
+
// * but you can always set your own.
|
|
142
|
+
// */
|
|
143
|
+
// iceServers?: ICEServer[];
|
|
144
|
+
// };
|
|
145
|
+
// /** Chat protocol configuration. */
|
|
146
|
+
// chatProtocol?: {
|
|
147
|
+
// /** Set 1 to use BOSH, set 2 to use WebSockets. Default: WebSocket. */
|
|
148
|
+
// active: QBChatProtocol;
|
|
149
|
+
// };
|
|
150
|
+
// /** [Stream management](https://docs.quickblox.com/docs/js-setup#section-stream-management) configuration. */
|
|
151
|
+
// streamManagement?: {
|
|
152
|
+
// enable: boolean;
|
|
153
|
+
// };
|
|
154
|
+
// /** [Debug mode](https://docs.quickblox.com/docs/js-setup#enable-logging) configuration. */
|
|
155
|
+
// debug?: boolean | { mode: 1 } | { mode: 2; file: string };
|
|
156
|
+
// on?: {
|
|
157
|
+
// sessionExpired?: (
|
|
158
|
+
// response: any,
|
|
159
|
+
// retry: (session: QBSession) => void,
|
|
160
|
+
// ) => void;
|
|
161
|
+
// };
|
|
162
|
+
// }
|
|
163
|
+
|
|
164
|
+
declare interface QBError {
|
|
85
165
|
code?: number;
|
|
86
166
|
status?: string;
|
|
87
167
|
detail?: string | string[] | Dictionary<string | string[]>;
|
|
88
168
|
message: string | string[] | Dictionary<string | string[]>;
|
|
89
169
|
}
|
|
90
170
|
|
|
91
|
-
interface
|
|
171
|
+
interface QBCallback<T> {
|
|
172
|
+
(error: null | undefined, result: T): void;
|
|
173
|
+
(error: QBError, result: null | undefined): void;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
declare interface QBUser {
|
|
177
|
+
/** ID of the user. Generated automatically by the server after user creation. */
|
|
92
178
|
id: number;
|
|
179
|
+
/** User's full name. */
|
|
93
180
|
full_name: string;
|
|
181
|
+
/** User's email. */
|
|
94
182
|
email: string;
|
|
183
|
+
/** User's login. */
|
|
95
184
|
login: string;
|
|
185
|
+
/** User's phone number. */
|
|
96
186
|
phone: string;
|
|
97
|
-
website
|
|
98
|
-
|
|
187
|
+
/** User's website url. */
|
|
188
|
+
website: string | null;
|
|
189
|
+
/** Date & time when record was created, filled automatically. */
|
|
99
190
|
created_at: string;
|
|
100
|
-
/** Date
|
|
191
|
+
/** Date & time when record was created, filled automatically. */
|
|
101
192
|
updated_at: string;
|
|
102
|
-
/** Date
|
|
103
|
-
last_request_at:
|
|
104
|
-
|
|
193
|
+
/** Date & time when a user sent the last request, filled automatically. */
|
|
194
|
+
last_request_at: number;
|
|
195
|
+
/** ID of the user in the external system. */
|
|
196
|
+
external_user_id: number | null;
|
|
197
|
+
/** ID of the user's Facebook account. */
|
|
105
198
|
facebook_id: string | null;
|
|
106
|
-
|
|
199
|
+
/** ID of the file/blob. Generated automatically by the server after file/blob creation. */
|
|
200
|
+
blob_id: number | null;
|
|
201
|
+
/** User's additional info. */
|
|
107
202
|
custom_data: string | null;
|
|
108
|
-
|
|
109
|
-
allow_statistics_analysis: boolean;
|
|
110
|
-
allow_sales_activities: boolean;
|
|
111
|
-
parents_contacts: string;
|
|
203
|
+
/** User's tags. Comma separated array of tags. */
|
|
112
204
|
user_tags: string | null;
|
|
205
|
+
/** @deprecated Marketing info. */
|
|
206
|
+
allow_sales_activities: boolean | null;
|
|
207
|
+
/** @deprecated Marketing info. */
|
|
208
|
+
allow_statistics_analysis: boolean | null;
|
|
209
|
+
/** @deprecated GDPR info. */
|
|
210
|
+
age_over16: boolean | null;
|
|
211
|
+
/** @deprecated GDPR info. */
|
|
212
|
+
parents_contacts: string | null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
declare interface QBUserCreate
|
|
216
|
+
extends Partial<
|
|
217
|
+
Omit<
|
|
218
|
+
QBUser,
|
|
219
|
+
'id' | 'created_at' | 'updated_at' | 'last_request_at' | 'user_tags'
|
|
220
|
+
>
|
|
221
|
+
> {
|
|
222
|
+
/** User's password. */
|
|
223
|
+
password: string;
|
|
224
|
+
/** User's tags. */
|
|
225
|
+
tag_list?: string | string[];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
declare type QBUserCreateParams =
|
|
229
|
+
| RequiredProps<QBUserCreate, 'email'>
|
|
230
|
+
| RequiredProps<QBUserCreate, 'phone'>
|
|
231
|
+
| RequiredProps<QBUserCreate, 'login'>;
|
|
232
|
+
|
|
233
|
+
declare interface QBUserUpdate
|
|
234
|
+
extends Partial<
|
|
235
|
+
Omit<
|
|
236
|
+
QBUser,
|
|
237
|
+
'id' | 'created_at' | 'updated_at' | 'last_request_at' | 'user_tags'
|
|
238
|
+
>
|
|
239
|
+
> {
|
|
240
|
+
/** User's new password. */
|
|
113
241
|
password?: string;
|
|
242
|
+
/** User's old password. */
|
|
114
243
|
old_password?: string;
|
|
244
|
+
/** User's tags. */
|
|
245
|
+
tag_list?: string | string[];
|
|
115
246
|
}
|
|
116
247
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
gender: string;
|
|
123
|
-
language: string;
|
|
124
|
-
avatar: {
|
|
125
|
-
id: number;
|
|
126
|
-
uid: string;
|
|
127
|
-
};
|
|
128
|
-
}>;
|
|
129
|
-
|
|
130
|
-
interface QBUserWithCustomData extends Omit<QBUser, 'custom_data'> {
|
|
131
|
-
custom_data: QBUserCustomData;
|
|
248
|
+
declare interface ListUserResponse {
|
|
249
|
+
current_page: number;
|
|
250
|
+
per_page: number;
|
|
251
|
+
total_entries: number;
|
|
252
|
+
items: Array<{ user: QBUser }>;
|
|
132
253
|
}
|
|
133
254
|
|
|
134
|
-
interface QBSession {
|
|
135
|
-
|
|
255
|
+
declare interface QBSession {
|
|
256
|
+
/** ID of the session. Generated automatically by the server after session creation. */
|
|
257
|
+
id: number;
|
|
258
|
+
/** ID of the user's application. */
|
|
136
259
|
application_id: number;
|
|
137
|
-
/**
|
|
260
|
+
/** ID of the session's owner. */
|
|
261
|
+
user_id: QBUser['id'];
|
|
262
|
+
/** Date & time when a record was created, filled automatically. */
|
|
138
263
|
created_at: string;
|
|
139
|
-
|
|
264
|
+
/** Date & time when a record was created, filled automatically. */
|
|
265
|
+
updated_at: string;
|
|
266
|
+
/** Unique Random Value. Parameter from a session creating request is used. */
|
|
140
267
|
nonce: number;
|
|
268
|
+
/** Session identifier. Each API request should contain this parameter in QB-Token header. */
|
|
141
269
|
token: string;
|
|
270
|
+
/** Unix Timestamp. Parameter from session creating request is used. */
|
|
142
271
|
ts: number;
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
|
|
272
|
+
/**
|
|
273
|
+
* ID of the session. Generated automatically by the server after session creation.
|
|
274
|
+
* Date & time when a record was updated, filled automatically.
|
|
275
|
+
*/
|
|
276
|
+
_id: string;
|
|
146
277
|
}
|
|
147
278
|
|
|
148
279
|
type ChatConnectParams =
|
|
149
280
|
| {
|
|
150
|
-
|
|
151
|
-
|
|
281
|
+
/** Connect to the chat by user id */
|
|
282
|
+
userId: QBUser['id'];
|
|
283
|
+
/** The user's password or session token */
|
|
152
284
|
password: string;
|
|
153
285
|
}
|
|
154
286
|
| {
|
|
287
|
+
/** Connect to the chat by user jid */
|
|
155
288
|
jid: string;
|
|
156
|
-
/** user's password or session token */
|
|
289
|
+
/** The user's password or session token */
|
|
157
290
|
password: string;
|
|
158
291
|
}
|
|
159
292
|
| {
|
|
293
|
+
/** Connect to the chat by user's email */
|
|
160
294
|
email: string;
|
|
161
|
-
/** user's password or session token */
|
|
295
|
+
/** The user's password or session token */
|
|
162
296
|
password: string;
|
|
163
297
|
};
|
|
164
298
|
|
|
165
|
-
|
|
166
|
-
|
|
299
|
+
type QBCustomField =
|
|
300
|
+
| string
|
|
301
|
+
| string[]
|
|
302
|
+
| number
|
|
303
|
+
| number[]
|
|
304
|
+
| boolean
|
|
305
|
+
| boolean[]
|
|
306
|
+
| null
|
|
307
|
+
| undefined;
|
|
308
|
+
|
|
309
|
+
declare interface ChatMessageAttachment {
|
|
310
|
+
/** ID of the file on QuickBlox server. */
|
|
167
311
|
id: string | number;
|
|
168
|
-
|
|
169
|
-
/** Type of attachment. Example: audio, video, image or other */
|
|
312
|
+
/** Type of attachment. Example: `audio`, `video`, `image` or other */
|
|
170
313
|
type: string;
|
|
171
|
-
/** Link to a file in Internet */
|
|
314
|
+
/** Link to a file in Internet. */
|
|
172
315
|
url?: string;
|
|
316
|
+
/** UID of file from `QB.content.createAndUpload` */
|
|
317
|
+
uid?: string;
|
|
318
|
+
/** Name of attachment. */
|
|
173
319
|
name?: string;
|
|
320
|
+
/** Size of attachment. */
|
|
174
321
|
size?: number;
|
|
175
|
-
[key: string]:
|
|
322
|
+
[key: string]: QBCustomField;
|
|
176
323
|
}
|
|
177
324
|
|
|
178
|
-
enum QBChatDialogType {
|
|
179
|
-
|
|
325
|
+
declare enum QBChatDialogType {
|
|
326
|
+
PUBLIC_GROUP = 1,
|
|
180
327
|
GROUP = 2,
|
|
181
328
|
PRIVATE = 3,
|
|
182
329
|
}
|
|
183
330
|
|
|
184
|
-
interface QBChatDialog {
|
|
331
|
+
declare interface QBChatDialog {
|
|
332
|
+
/** ID of the dialog. Generated automatically by the server after dialog creation. */
|
|
185
333
|
_id: string;
|
|
186
|
-
/**
|
|
334
|
+
/** ID of dialog's owner. */
|
|
335
|
+
user_id: QBUser['id'];
|
|
336
|
+
/** Date & time when a record was created, filled automatically. */
|
|
187
337
|
created_at: string;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
338
|
+
/** Date & time when a record was created, filled automatically. */
|
|
339
|
+
updated_at: string;
|
|
340
|
+
/**
|
|
341
|
+
* Type of dialog. Possible values are:
|
|
342
|
+
* - type=1 (`PUBLIC_GROUP`)
|
|
343
|
+
* - type=2 (`GROUP`)
|
|
344
|
+
* - type=3 (`PRIVATE`)
|
|
345
|
+
*/
|
|
346
|
+
type: QBChatDialogType;
|
|
347
|
+
/**
|
|
348
|
+
* Name of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
|
|
349
|
+
* The maximum length for the dialog name is 200 symbols.
|
|
350
|
+
*/
|
|
194
351
|
name: string;
|
|
195
|
-
|
|
196
|
-
|
|
352
|
+
/**
|
|
353
|
+
* Photo of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
|
|
354
|
+
* Can contain a link to a file in Content module, Custom Objects module or just a web link.
|
|
355
|
+
*/
|
|
197
356
|
photo: null | string;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
357
|
+
/**
|
|
358
|
+
* JID of XMPP room for group chat to connect. Nil if type=3 (PRIVATE).
|
|
359
|
+
* Generated automatically by the server after dialog creation.
|
|
360
|
+
*/
|
|
202
361
|
xmpp_room_jid: string | null;
|
|
362
|
+
/** Array of users' IDs - dialog occupants. Does not make sense if type=1 (PUBLIC_GROUP). */
|
|
363
|
+
occupants_ids: number[];
|
|
364
|
+
/** Last sent message in this dialog. */
|
|
365
|
+
last_message: string | null;
|
|
366
|
+
/** Timestamp of last sent message in this dialog. */
|
|
367
|
+
last_message_date_sent: number | null | string; // todo: switch type to number
|
|
368
|
+
/** ID of the user who sent last message in this dialog. */
|
|
369
|
+
last_message_user_id: QBUser['id'] | null;
|
|
370
|
+
/** ID of last message in this dialog. */
|
|
371
|
+
last_message_id: string | null;
|
|
372
|
+
/** Number of unread messages in this dialog for a current user. */
|
|
203
373
|
unread_messages_count: number | null;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
attachments?: ChatMessageAttachment[];
|
|
214
|
-
save_to_history: 0 | 1;
|
|
215
|
-
dialog_id: QBChatDialog['_id'];
|
|
216
|
-
notification_type?: string;
|
|
217
|
-
sender_id?: QBUser['id'];
|
|
218
|
-
qb_message_action?: 'forward' | 'reply';
|
|
219
|
-
origin_sender_name?: string;
|
|
220
|
-
qb_original_messages?: string;
|
|
374
|
+
/**
|
|
375
|
+
* - Information about class and fields in Custom Objects.
|
|
376
|
+
* - Any dialog can be extended using Custom Objects to store additional parameters.
|
|
377
|
+
*/
|
|
378
|
+
data?: {
|
|
379
|
+
/** Class name in Custom Objects. */
|
|
380
|
+
class_name: string;
|
|
381
|
+
/** Field name of class in Custom Objects. Can be many: 1..N. */
|
|
382
|
+
[field_name_N: string]: QBCustomField;
|
|
221
383
|
};
|
|
222
|
-
|
|
384
|
+
new_occupants_ids?: number[]; // TODO: EXTENDS TYPE AND SWITCH TO THIS NEW TYPE
|
|
385
|
+
joined?: boolean; // TODO: EXTENDS TYPE AND SWITCH TO THIS NEW TYPE
|
|
223
386
|
}
|
|
224
387
|
|
|
225
|
-
interface QBChatMessage {
|
|
388
|
+
declare interface QBChatMessage {
|
|
389
|
+
/** ID of the message. Generated automatically by the server after message creation. */
|
|
226
390
|
_id: string;
|
|
227
|
-
|
|
228
|
-
chat_dialog_id: QBChatDialog['_id'];
|
|
229
|
-
/** Date ISO string */
|
|
391
|
+
/** Date & time when a record was created, filled automatically. */
|
|
230
392
|
created_at: string;
|
|
231
|
-
/** Date
|
|
393
|
+
/** Date & time when a record was created, filled automatically. */
|
|
394
|
+
updated_at: string;
|
|
395
|
+
/** ID of dialog to which current message is connected. Generated automatically by the server after message creation. */
|
|
396
|
+
chat_dialog_id: QBChatDialog['_id'];
|
|
397
|
+
/** Message body. */
|
|
398
|
+
message: string | null;
|
|
399
|
+
/** Message date sent. */
|
|
232
400
|
date_sent: number;
|
|
233
|
-
|
|
234
|
-
message: string;
|
|
235
|
-
read_ids?: Array<QBUser['id']>;
|
|
236
|
-
read: 0 | 1;
|
|
237
|
-
recipient_id: QBUser['id'] | null;
|
|
401
|
+
/** Message sender ID. */
|
|
238
402
|
sender_id: QBUser['id'];
|
|
239
|
-
/**
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
403
|
+
/** Message recipient ID. */
|
|
404
|
+
recipient_id: QBUser['id'];
|
|
405
|
+
/**
|
|
406
|
+
* @deprecated
|
|
407
|
+
* Read message status. Diplayed as read=1 after retiriving by the opponent.
|
|
408
|
+
* Works only for type=3 (`PRIVATE`) dialog.
|
|
409
|
+
* Remains as read=0 after retiriving for type=2 (`GROUP`) and type=1 (`PUBLIC_GROUP`) dialogs.
|
|
410
|
+
* */
|
|
411
|
+
read: 0 | 1;
|
|
412
|
+
/** Array of users' IDs who read messages. Works only for type=2 (GROUP) dialog. */
|
|
413
|
+
read_ids: Array<QBUser['id']>;
|
|
414
|
+
/** Array of users' IDs who received the messages. */
|
|
415
|
+
delivered_ids: Array<QBUser['id']>;
|
|
416
|
+
/**
|
|
417
|
+
* Each attachment object contains 3 required keys:
|
|
418
|
+
* - `id` - link to file ID in QuickBlox,
|
|
419
|
+
* - `type` - audio/video/image,
|
|
420
|
+
* - `url` - link to file in Internet.
|
|
421
|
+
*/
|
|
422
|
+
attachments: ChatMessageAttachment[];
|
|
423
|
+
/**
|
|
424
|
+
* Name of the custom field.
|
|
425
|
+
* Chat message can be extended with additional fields and contain any other user key-value custom parameters.
|
|
426
|
+
* Can be many 1..N.
|
|
427
|
+
*/
|
|
428
|
+
[custom_field_N: string]: any;
|
|
245
429
|
}
|
|
246
430
|
|
|
247
|
-
interface QBMessageStatusParams {
|
|
431
|
+
declare interface QBMessageStatusParams {
|
|
432
|
+
/** ID of the message. */
|
|
248
433
|
messageId: QBChatMessage['_id'];
|
|
434
|
+
/** ID of the dialog. */
|
|
249
435
|
dialogId: QBChatDialog['_id'];
|
|
436
|
+
/** ID of the user. */
|
|
250
437
|
userId: QBUser['id'];
|
|
251
438
|
}
|
|
252
439
|
|
|
253
|
-
interface
|
|
440
|
+
declare interface QBChatNewMessage {
|
|
441
|
+
type: 'chat' | 'groupchat';
|
|
442
|
+
body: string;
|
|
443
|
+
notification_type?: string; // TODO: NED ADD TO TYPE
|
|
444
|
+
dialog_id: QBChatDialog['_id']; // TODO: NED ADD TO TYPE
|
|
445
|
+
extension: {
|
|
446
|
+
attachments?: ChatMessageAttachment[];
|
|
447
|
+
save_to_history: 0 | 1;
|
|
448
|
+
dialog_id: QBChatDialog['_id'];
|
|
449
|
+
notification_type?: string; // TODO: NED ADD TO TYPE
|
|
450
|
+
sender_id?: QBUser['id']; // TODO: NED ADD TO TYPE
|
|
451
|
+
qb_message_action?: 'forward' | 'reply'; // TODO: NED ADD TO TYPE
|
|
452
|
+
origin_sender_name?: string; // TODO: NED ADD TO TYPE
|
|
453
|
+
qb_original_messages?: string; // TODO: NED ADD TO TYPE
|
|
454
|
+
};
|
|
455
|
+
markable: 0 | 1;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
declare interface QBChatXMPPMessage {
|
|
254
459
|
id: string;
|
|
255
460
|
dialog_id: QBChatDialog['_id'];
|
|
256
461
|
recipient_id: null;
|
|
257
462
|
type: 'chat' | 'groupchat';
|
|
258
|
-
notification_type?: string;
|
|
259
463
|
body: string;
|
|
260
464
|
delay: null;
|
|
261
465
|
markable: 0 | 1;
|
|
262
466
|
extension: {
|
|
263
467
|
attachments?: ChatMessageAttachment[];
|
|
264
468
|
date_sent: string;
|
|
265
|
-
|
|
266
|
-
save_to_history?: 0 | 1;
|
|
267
|
-
dialog_id?: QBChatDialog['_id'];
|
|
268
|
-
sender_id?: QBUser['id'];
|
|
469
|
+
[custom_field_N: string]: any;
|
|
269
470
|
};
|
|
270
471
|
}
|
|
271
472
|
|
|
473
|
+
// declare interface QBSystemMessage {
|
|
474
|
+
// id: string;
|
|
475
|
+
// userId: QBUser['id'];
|
|
476
|
+
// body?: null | string;
|
|
477
|
+
// extension?: Dictionary<any>;
|
|
478
|
+
// }
|
|
479
|
+
|
|
272
480
|
interface QBSystemMessageExtension {
|
|
273
481
|
[key: string]: string | undefined;
|
|
274
482
|
notification_type: string;
|
|
275
483
|
action?: 'read' | 'delete';
|
|
276
484
|
}
|
|
277
485
|
|
|
278
|
-
interface QBSystemMessage {
|
|
486
|
+
declare interface QBSystemMessage {
|
|
487
|
+
// todo extended type
|
|
279
488
|
id: string;
|
|
280
489
|
userId: QBUser['id'];
|
|
281
490
|
body: null | string;
|
|
282
491
|
extension: QBSystemMessageExtension;
|
|
283
492
|
}
|
|
284
493
|
|
|
285
|
-
interface QBGetDialogResult {
|
|
494
|
+
declare interface QBGetDialogResult {
|
|
286
495
|
items: QBChatDialog[];
|
|
287
496
|
limit: number;
|
|
288
497
|
skip: number;
|
|
289
498
|
total_entries: number;
|
|
290
499
|
}
|
|
291
500
|
|
|
292
|
-
type GetMessagesResult = {
|
|
501
|
+
declare type GetMessagesResult = {
|
|
293
502
|
items: QBChatMessage[];
|
|
294
503
|
limit: number;
|
|
295
504
|
skip: number;
|
|
296
505
|
};
|
|
297
506
|
|
|
298
507
|
interface QBChatModule {
|
|
299
|
-
dialog: {
|
|
300
|
-
create(
|
|
301
|
-
params: Dictionary<unknown>,
|
|
302
|
-
callback: (error?: QBError, result: QBChatDialog) => void,
|
|
303
|
-
): void;
|
|
304
|
-
list(
|
|
305
|
-
params: Dictionary<unknown>,
|
|
306
|
-
callback: (error?: QBError, result: QBGetDialogResult) => void,
|
|
307
|
-
): void;
|
|
308
|
-
update(
|
|
309
|
-
id: string,
|
|
310
|
-
data: Dictionary<unknown>,
|
|
311
|
-
callback: (error?: QBError, result: QBChatDialog) => void,
|
|
312
|
-
): void;
|
|
313
|
-
delete(
|
|
314
|
-
dialogIds: Array<QBChatDialog['_id']>,
|
|
315
|
-
callback: (error?: QBError) => void,
|
|
316
|
-
): void;
|
|
317
|
-
};
|
|
318
|
-
message: {
|
|
319
|
-
list(
|
|
320
|
-
params: Dictionary<unknown>,
|
|
321
|
-
callback: (error?: QBError, result: GetMessagesResult) => void,
|
|
322
|
-
): void;
|
|
323
|
-
};
|
|
324
508
|
isConnected: boolean;
|
|
509
|
+
/**
|
|
510
|
+
* Connect to the Chat
|
|
511
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-connection#connect-to-chat-server-with-quickblox-session-token))
|
|
512
|
+
*/
|
|
513
|
+
connect(params: ChatConnectParams, callback: QBCallback<any>): void;
|
|
514
|
+
reconnect(): void;
|
|
515
|
+
/** Disconnect from the Chat ([read more](https://docs.quickblox.com/docs/js-chat-connection#disconnect-from-chat-server)). */
|
|
516
|
+
disconnect(): void;
|
|
517
|
+
/**
|
|
518
|
+
* Send query to get last user activity by `QB.chat.onLastUserActivityListener(userId, seconds)`
|
|
519
|
+
* ([read more](https://xmpp.org/extensions/xep-0012.html)).
|
|
520
|
+
*/
|
|
521
|
+
getLastUserActivity(jidOrUserId: QBUser['id'] | string): void;
|
|
522
|
+
/** Receive confirm request ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#confirm-the-contact-request)). */
|
|
523
|
+
onConfirmSubscribeListener?: (userId: QBUser['id']) => void;
|
|
524
|
+
/** Receive user status (online/offline)([read more](https://docs.quickblox.com/docs/js-chat-contact-list#contact-list-updates)). */
|
|
525
|
+
onContactListListener?: (userId: QBUser['id'], type: string) => void;
|
|
526
|
+
/** Receive delivery confirmations ([read more](https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-delivered)). */
|
|
527
|
+
onDeliveredStatusListener?: (
|
|
528
|
+
messageId: string,
|
|
529
|
+
dialogId: QBChatDialog['_id'],
|
|
530
|
+
userId: QBUser['id'],
|
|
531
|
+
) => void;
|
|
532
|
+
/** Run after disconnect from chat. */
|
|
533
|
+
onDisconnectedListener?: () => void;
|
|
534
|
+
/** You will receive this callback when some user joined group chat dialog you are in. */
|
|
535
|
+
onJoinOccupant?: (
|
|
536
|
+
dialogId: QBChatDialog['_id'],
|
|
537
|
+
userId: QBUser['id'],
|
|
538
|
+
) => void;
|
|
539
|
+
/**
|
|
540
|
+
* You will receive this callback when you are in group chat dialog(joined)
|
|
541
|
+
* and other user (chat dialog's creator) removed you from occupants.
|
|
542
|
+
*/
|
|
543
|
+
onKickOccupant?: (
|
|
544
|
+
dialogId: QBChatDialog['_id'],
|
|
545
|
+
initiatorUserId: QBUser['id'],
|
|
546
|
+
) => void;
|
|
547
|
+
/** Receive user's last activity (time ago). */
|
|
548
|
+
onLastUserActivityListener?: (userId: QBUser['id'], seconds: number) => void;
|
|
549
|
+
/** You will receive this callback when some user left group chat dialog you are in. */
|
|
550
|
+
onLeaveOccupant?: (
|
|
551
|
+
dialogId: QBChatDialog['_id'],
|
|
552
|
+
userId: QBUser['id'],
|
|
553
|
+
) => void;
|
|
554
|
+
/** Blocked entities receive an error when try to chat with a user in a 1-1 chat and receivie nothing in a group chat. */
|
|
555
|
+
onMessageErrorListener?: (
|
|
556
|
+
messageId: QBChatMessage['_id'],
|
|
557
|
+
error: any,
|
|
558
|
+
) => void;
|
|
559
|
+
/**
|
|
560
|
+
* You need to set onMessageListener function, to get messages
|
|
561
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#subscribe-message-events)).
|
|
562
|
+
*/
|
|
563
|
+
onMessageListener?: (
|
|
564
|
+
userId: QBUser['id'],
|
|
565
|
+
message: QBChatXMPPMessage,
|
|
566
|
+
) => void;
|
|
567
|
+
/**
|
|
568
|
+
* Show typing status in chat or groupchat
|
|
569
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators)).
|
|
570
|
+
*/
|
|
571
|
+
onMessageTypingListener?: (
|
|
572
|
+
isTyping: boolean,
|
|
573
|
+
userId: QBUser['id'],
|
|
574
|
+
dialogId: QBChatDialog['_id'],
|
|
575
|
+
) => void;
|
|
576
|
+
/**
|
|
577
|
+
* You can manage 'read' notifications in chat
|
|
578
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-read)).
|
|
579
|
+
*/
|
|
580
|
+
onReadStatusListener?: (
|
|
581
|
+
messageId: QBChatMessage['_id'],
|
|
582
|
+
dialogId: QBChatDialog['_id'],
|
|
583
|
+
userId: QBUser['id'],
|
|
584
|
+
) => void;
|
|
585
|
+
/**
|
|
586
|
+
* By default Javascript SDK reconnects automatically when connection to server is lost
|
|
587
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-connection#reconnection)).
|
|
588
|
+
*/
|
|
589
|
+
onReconnectListener?: () => void;
|
|
590
|
+
onReconnectFailedListener?: (error: any) => void;
|
|
591
|
+
onSessionExpiredListener?: (error?: QBError) => void;
|
|
592
|
+
/**
|
|
593
|
+
* Receive reject request
|
|
594
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#reject-the-contact-request)).
|
|
595
|
+
*/
|
|
596
|
+
onRejectSubscribeListener?: (userId: QBUser['id']) => void;
|
|
597
|
+
/**
|
|
598
|
+
* This feature defines an approach for ensuring is the message delivered to the server.
|
|
599
|
+
* This feature is unabled by default
|
|
600
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#check-if-a-message-is-sent)).
|
|
601
|
+
*/
|
|
602
|
+
onSentMessageCallback?: (
|
|
603
|
+
messageLost: QBChatMessage,
|
|
604
|
+
messageSent: QBChatMessage,
|
|
605
|
+
) => void;
|
|
606
|
+
/**
|
|
607
|
+
* Receive subscription request
|
|
608
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#add-user-to-your-contact-list)).
|
|
609
|
+
*/
|
|
610
|
+
onSubscribeListener?: (userId: QBUser['id']) => void;
|
|
611
|
+
/**
|
|
612
|
+
* These messages work over separated channel and won't be mixed with the regular chat messages
|
|
613
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-system-messages)).
|
|
614
|
+
*/
|
|
615
|
+
onSystemMessageListener?: (message: QBSystemMessage) => void;
|
|
616
|
+
/**
|
|
617
|
+
* Send message to 1 to 1 or group dialog
|
|
618
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-text-message)).
|
|
619
|
+
*/
|
|
325
620
|
send<T extends QBChatNewMessage>(
|
|
326
621
|
jidOrUserId: QBUser['id'] | string,
|
|
327
622
|
message: T,
|
|
328
623
|
): string;
|
|
624
|
+
/**
|
|
625
|
+
* Send is stop typing status
|
|
626
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators)).
|
|
627
|
+
*/
|
|
628
|
+
sendIsStopTypingStatus(jidOrUserId: QBUser['id'] | string): void;
|
|
629
|
+
/**
|
|
630
|
+
* Send is typing status
|
|
631
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators)).
|
|
632
|
+
*/
|
|
633
|
+
sendIsTypingStatus(jidOrUserId: QBUser['id'] | string): void;
|
|
634
|
+
/**
|
|
635
|
+
* Send is read status
|
|
636
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-read)).
|
|
637
|
+
*/
|
|
638
|
+
sendReadStatus(params: QBMessageStatusParams): void;
|
|
639
|
+
/**
|
|
640
|
+
* Send system message (system notification) to 1 to 1 or group dialog
|
|
641
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-system-messages)).
|
|
642
|
+
*/
|
|
329
643
|
sendSystemMessage(
|
|
330
644
|
jidOrUserId: QBUser['id'] | string,
|
|
645
|
+
// TODO: change type
|
|
331
646
|
message: { extension: QBSystemMessage['extension'] },
|
|
332
647
|
): string;
|
|
648
|
+
/** Send is delivered status. */
|
|
333
649
|
sendDeliveredStatus(params: QBMessageStatusParams): void;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
650
|
+
ping(jidOrUserId: string | number, callback: QBCallback<any>): string;
|
|
651
|
+
ping(callback: QBCallback<any>): string;
|
|
652
|
+
|
|
653
|
+
dialog: {
|
|
654
|
+
/**
|
|
655
|
+
* Create new dialog
|
|
656
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#create-dialog)).
|
|
657
|
+
*/
|
|
658
|
+
create(params: Dictionary<any>, callback: QBCallback<QBChatDialog>): void;
|
|
659
|
+
/**
|
|
660
|
+
* Delete a dialog or dialogs
|
|
661
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#delete-dialog)).
|
|
662
|
+
*/
|
|
663
|
+
delete(
|
|
664
|
+
id: QBChatDialog['_id'] | Array<QBChatDialog['_id']>,
|
|
665
|
+
params: { force: 1 },
|
|
666
|
+
callback: QBCallback<any>,
|
|
667
|
+
);
|
|
668
|
+
/**
|
|
669
|
+
* Delete a dialog or dialogs
|
|
670
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#delete-dialog)).
|
|
671
|
+
*/
|
|
672
|
+
delete(
|
|
673
|
+
id: QBChatDialog['_id'] | Array<QBChatDialog['_id']>,
|
|
674
|
+
callback: QBCallback<any>,
|
|
675
|
+
);
|
|
676
|
+
/**
|
|
677
|
+
* Retrieve list of dialogs
|
|
678
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#retrieve-list-of-dialogs)).
|
|
679
|
+
*/
|
|
680
|
+
list(
|
|
681
|
+
params: {
|
|
682
|
+
limit?: number;
|
|
683
|
+
skip?: number;
|
|
684
|
+
sort_asc?: string;
|
|
685
|
+
sort_desc?: string;
|
|
686
|
+
[field: string]: any;
|
|
687
|
+
},
|
|
688
|
+
callback: QBCallback<QBGetDialogResult>,
|
|
689
|
+
): void;
|
|
690
|
+
/**
|
|
691
|
+
* Update group dialog
|
|
692
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#update-dialog)).
|
|
693
|
+
*/
|
|
694
|
+
update(
|
|
695
|
+
id: QBChatDialog['_id'],
|
|
696
|
+
data: Dictionary<any>,
|
|
697
|
+
callback: QBCallback<QBChatDialog>,
|
|
698
|
+
): void;
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
message: {
|
|
702
|
+
/** Create message. */
|
|
703
|
+
create(params: Dictionary<any>, callback: QBCallback<QBChatMessage>): void;
|
|
704
|
+
/**
|
|
705
|
+
* Delete message
|
|
706
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#delete-message)).
|
|
707
|
+
*/
|
|
708
|
+
delete(
|
|
709
|
+
id: QBChatMessage['_id'],
|
|
710
|
+
params: { force: 1 },
|
|
711
|
+
callback: QBCallback<{
|
|
712
|
+
SuccessfullyDeleted: {
|
|
713
|
+
ids: string[];
|
|
714
|
+
};
|
|
715
|
+
NotFound: {
|
|
716
|
+
ids: string[];
|
|
717
|
+
};
|
|
718
|
+
}>,
|
|
719
|
+
): void;
|
|
720
|
+
/**
|
|
721
|
+
* Delete message
|
|
722
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#delete-message)).
|
|
723
|
+
*/
|
|
724
|
+
delete(
|
|
725
|
+
id: QBChatMessage['_id'],
|
|
726
|
+
callback: QBCallback<{
|
|
727
|
+
SuccessfullyDeleted: {
|
|
728
|
+
ids: string[];
|
|
729
|
+
};
|
|
730
|
+
NotFound: {
|
|
731
|
+
ids: string[];
|
|
732
|
+
};
|
|
733
|
+
}>,
|
|
734
|
+
): void;
|
|
735
|
+
/**
|
|
736
|
+
* Get a chat history
|
|
737
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#retrieve-chat-history)).
|
|
738
|
+
*/
|
|
739
|
+
list(
|
|
740
|
+
params: {
|
|
741
|
+
limit?: number;
|
|
742
|
+
skip?: number;
|
|
743
|
+
sort_asc?: string;
|
|
744
|
+
sort_desc?: string;
|
|
745
|
+
mark_as_read?: number;
|
|
746
|
+
[field: string]: any;
|
|
747
|
+
},
|
|
748
|
+
callback: QBCallback<GetMessagesResult>,
|
|
749
|
+
): void;
|
|
750
|
+
/**
|
|
751
|
+
* Get unread messages counter for one or group of dialogs
|
|
752
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#get-number-of-unread-messages)).
|
|
753
|
+
*/
|
|
754
|
+
unreadCount(
|
|
755
|
+
params: { chat_dialog_ids: string | string[] },
|
|
756
|
+
callback: QBCallback<{ total: number }>,
|
|
757
|
+
): void;
|
|
758
|
+
/**
|
|
759
|
+
* Update message
|
|
760
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-messaging#update-message)).
|
|
761
|
+
*/
|
|
762
|
+
update(
|
|
763
|
+
id: QBChatMessage['_id'],
|
|
764
|
+
params: Dictionary<any>,
|
|
765
|
+
callback: QBCallback<QBChatMessage>,
|
|
348
766
|
): void;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
muc: {
|
|
770
|
+
/**
|
|
771
|
+
* Join to the group dialog
|
|
772
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#join-dialog)).
|
|
773
|
+
*/
|
|
774
|
+
join(dialogJid: string, callback: QBCallback<any>): void;
|
|
775
|
+
/**
|
|
776
|
+
* Leave group chat dialog
|
|
777
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#leave-dialog)).
|
|
778
|
+
*/
|
|
779
|
+
leave(dialogJid: string, callback: QBCallback<any>): void;
|
|
780
|
+
/**
|
|
781
|
+
* Leave group chat dialog
|
|
782
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#retrieve-online-users)).
|
|
783
|
+
*/
|
|
784
|
+
listOnlineUsers(dialogJid: string, callback: QBCallback<any>): void;
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
roster: {
|
|
788
|
+
/**
|
|
789
|
+
* Add users to contact list
|
|
790
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#add-user-to-your-contact-list)).
|
|
791
|
+
*/
|
|
792
|
+
add(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
793
|
+
/**
|
|
794
|
+
* Confirm subscription with some user
|
|
795
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#confirm-the-contact-request)).
|
|
796
|
+
*/
|
|
797
|
+
confirm(
|
|
798
|
+
jidOrUserId: string | QBUser['id'],
|
|
799
|
+
callback: QBCallback<any>,
|
|
352
800
|
): void;
|
|
801
|
+
/**
|
|
802
|
+
* Receive contact list
|
|
803
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#access-contact-list)).
|
|
804
|
+
*/
|
|
805
|
+
get(callback: QBCallback<any>): void;
|
|
806
|
+
/**
|
|
807
|
+
* Reject subscription with some user
|
|
808
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#reject-the-contact-request)).
|
|
809
|
+
*/
|
|
810
|
+
reject(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
811
|
+
/**
|
|
812
|
+
* Remove subscription with some user from your contact list
|
|
813
|
+
* ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#remove-user-from-the-contact-list)).
|
|
814
|
+
*/
|
|
815
|
+
remove(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
353
816
|
};
|
|
817
|
+
|
|
354
818
|
helpers: {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
819
|
+
/** Get unique id. */
|
|
820
|
+
getUniqueId(suffix: string | number): string;
|
|
821
|
+
/** Generate BSON ObjectId. */
|
|
822
|
+
getBsonObjectId(): string;
|
|
823
|
+
/** Get the dialog id from jid. */
|
|
824
|
+
getDialogIdFromNode(jid: string): QBChatDialog['_id'];
|
|
825
|
+
/** Get the User id from jid. */
|
|
826
|
+
getIdFromNode(jid: string): QBUser['id'];
|
|
827
|
+
/** Get user id from dialog's full jid. */
|
|
828
|
+
getIdFromResource(jid: string): QBUser['id'];
|
|
829
|
+
/** Get the recipient id. */
|
|
359
830
|
getRecipientId(
|
|
360
831
|
occupantsIds: Array<QBUser['id']>,
|
|
361
832
|
userId: QBUser['id'],
|
|
362
|
-
):
|
|
833
|
+
): QBUser['id'];
|
|
834
|
+
/** Get the full room jid from room bare jid & user jid. */
|
|
835
|
+
getRoomJid(jid: string, userJid: string): string;
|
|
836
|
+
/** Get the room jid from dialog id. */
|
|
837
|
+
getRoomJidFromDialogId(dialogId: QBChatDialog['_id']): string;
|
|
838
|
+
/** Get bare dialog's jid from dialog's full jid. */
|
|
839
|
+
getRoomJidFromRoomFullJid(jid: string): string;
|
|
840
|
+
/** Get the user id from the room jid. */
|
|
841
|
+
getUserIdFromRoomJid(jid: string): string;
|
|
842
|
+
/** Get the User jid id. */
|
|
843
|
+
getUserJid(userId: QBUser['id'], appId?: string | number): string;
|
|
844
|
+
/** Get the User nick with the muc domain. */
|
|
845
|
+
getUserNickWithMucDomain(userId: QBUser['id']): string;
|
|
846
|
+
/** Get unique id. */
|
|
847
|
+
jidOrUserId(jidOrUserId: QBUser['id'] | string): string;
|
|
848
|
+
/** Get the chat type. */
|
|
849
|
+
typeChat(jidOrUserId: QBUser['id'] | string): 'chat' | 'groupchat';
|
|
850
|
+
/** Get the dialog jid from dialog id. */
|
|
851
|
+
getDialogJid(dialogId: QBChatDialog['_id']): string;
|
|
852
|
+
/** Get user jid from current user. */
|
|
853
|
+
getUserCurrentJid(): string;
|
|
363
854
|
};
|
|
364
|
-
onMessageListener?: (
|
|
365
|
-
senderId: QBUser['id'],
|
|
366
|
-
message: QBChatXMPPMessage,
|
|
367
|
-
) => void;
|
|
368
|
-
onMessageErrorListener?: (messageId: string, error: unknown) => void;
|
|
369
|
-
onMessageTypingListener?: (
|
|
370
|
-
isTyping: boolean,
|
|
371
|
-
userId: QBUser['id'],
|
|
372
|
-
dialogId: QBChatDialog['_id'],
|
|
373
|
-
) => void;
|
|
374
|
-
onDeliveredStatusListener?: (
|
|
375
|
-
messageId: string,
|
|
376
|
-
dialogId: QBChatDialog['_id'],
|
|
377
|
-
userId: QBUser['id'],
|
|
378
|
-
) => void;
|
|
379
|
-
onReadStatusListener?: (
|
|
380
|
-
messageId: string,
|
|
381
|
-
dialogId: QBChatDialog['_id'],
|
|
382
|
-
userId: QBUser['id'],
|
|
383
|
-
) => void;
|
|
384
|
-
onSystemMessageListener?: (message: QBSystemMessage) => void;
|
|
385
|
-
onReconnectFailedListener?: (error: unknown) => void;
|
|
386
|
-
onDisconnectedListener?: VoidFunction;
|
|
387
|
-
onReconnectListener?: VoidFunction;
|
|
388
|
-
onSessionExpiredListener?: (error?: QBError) => void;
|
|
389
855
|
}
|
|
390
|
-
interface
|
|
856
|
+
// interface QBChatModule {
|
|
857
|
+
// isConnected: boolean;
|
|
858
|
+
// /**
|
|
859
|
+
// * Connect to the Chat
|
|
860
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-connection#connect-to-chat-server-with-quickblox-session-token))
|
|
861
|
+
// */
|
|
862
|
+
// connect(params: ChatConnectParams, callback: QBCallback<any>): void;
|
|
863
|
+
// reconnect(): void;
|
|
864
|
+
// /** Disconnect from the Chat ([read more](https://docs.quickblox.com/docs/js-chat-connection#disconnect-from-chat-server)). */
|
|
865
|
+
// disconnect(): void;
|
|
866
|
+
// /**
|
|
867
|
+
// * Send query to get last user activity by `QB.chat.onLastUserActivityListener(userId, seconds)`
|
|
868
|
+
// * ([read more](https://xmpp.org/extensions/xep-0012.html)).
|
|
869
|
+
// */
|
|
870
|
+
// getLastUserActivity(jidOrUserId: QBUser['id'] | string): void;
|
|
871
|
+
// /** Receive confirm request ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#confirm-the-contact-request)). */
|
|
872
|
+
// onConfirmSubscribeListener(userId: QBUser['id']): void;
|
|
873
|
+
// /** Receive user status (online/offline)([read more](https://docs.quickblox.com/docs/js-chat-contact-list#contact-list-updates)). */
|
|
874
|
+
// onContactListListener(userId: QBUser['id'], type: string): void;
|
|
875
|
+
// /** Receive delivery confirmations ([read more](https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-delivered)). */
|
|
876
|
+
// onDeliveredStatusListener(
|
|
877
|
+
// messageId: string,
|
|
878
|
+
// dialogId: QBChatDialog['_id'],
|
|
879
|
+
// userId: QBUser['id'],
|
|
880
|
+
// ): void;
|
|
881
|
+
// /** Run after disconnect from chat. */
|
|
882
|
+
// onDisconnectedListener(): void;
|
|
883
|
+
// /** You will receive this callback when some user joined group chat dialog you are in. */
|
|
884
|
+
// onJoinOccupant(dialogId: QBChatDialog['_id'], userId: QBUser['id']): void;
|
|
885
|
+
// /**
|
|
886
|
+
// * You will receive this callback when you are in group chat dialog(joined)
|
|
887
|
+
// * and other user (chat dialog's creator) removed you from occupants.
|
|
888
|
+
// */
|
|
889
|
+
// onKickOccupant(
|
|
890
|
+
// dialogId: QBChatDialog['_id'],
|
|
891
|
+
// initiatorUserId: QBUser['id'],
|
|
892
|
+
// ): void;
|
|
893
|
+
// /** Receive user's last activity (time ago). */
|
|
894
|
+
// onLastUserActivityListener(userId: QBUser['id'], seconds: number): void;
|
|
895
|
+
// /** You will receive this callback when some user left group chat dialog you are in. */
|
|
896
|
+
// onLeaveOccupant(dialogId: QBChatDialog['_id'], userId: QBUser['id']): void;
|
|
897
|
+
// /** Blocked entities receive an error when try to chat with a user in a 1-1 chat and receivie nothing in a group chat. */
|
|
898
|
+
// onMessageErrorListener(messageId: QBChatMessage['_id'], error: any): void;
|
|
899
|
+
// /**
|
|
900
|
+
// * You need to set onMessageListener function, to get messages
|
|
901
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#subscribe-message-events)).
|
|
902
|
+
// */
|
|
903
|
+
// onMessageListener(userId: QBUser['id'], message: QBChatXMPPMessage): void;
|
|
904
|
+
// /**
|
|
905
|
+
// * Show typing status in chat or groupchat
|
|
906
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators)).
|
|
907
|
+
// */
|
|
908
|
+
// onMessageTypingListener(
|
|
909
|
+
// isTyping: boolean,
|
|
910
|
+
// userId: QBUser['id'],
|
|
911
|
+
// dialogId: QBChatDialog['_id'],
|
|
912
|
+
// ): void;
|
|
913
|
+
// /**
|
|
914
|
+
// * You can manage 'read' notifications in chat
|
|
915
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-read)).
|
|
916
|
+
// */
|
|
917
|
+
// onReadStatusListener(
|
|
918
|
+
// messageId: QBChatMessage['_id'],
|
|
919
|
+
// dialogId: QBChatDialog['_id'],
|
|
920
|
+
// userId: QBUser['id'],
|
|
921
|
+
// ): void;
|
|
922
|
+
// /**
|
|
923
|
+
// * By default Javascript SDK reconnects automatically when connection to server is lost
|
|
924
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-connection#reconnection)).
|
|
925
|
+
// */
|
|
926
|
+
// onReconnectListener(): void;
|
|
927
|
+
// onReconnectFailedListener(error: any): void;
|
|
928
|
+
// onSessionExpiredListener(error?: QBError): void;
|
|
929
|
+
// /**
|
|
930
|
+
// * Receive reject request
|
|
931
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#reject-the-contact-request)).
|
|
932
|
+
// */
|
|
933
|
+
// onRejectSubscribeListener(userId: QBUser['id']): void;
|
|
934
|
+
// /**
|
|
935
|
+
// * This feature defines an approach for ensuring is the message delivered to the server.
|
|
936
|
+
// * This feature is unabled by default
|
|
937
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#check-if-a-message-is-sent)).
|
|
938
|
+
// */
|
|
939
|
+
// onSentMessageCallback(
|
|
940
|
+
// messageLost: QBChatMessage,
|
|
941
|
+
// messageSent: QBChatMessage,
|
|
942
|
+
// ): void;
|
|
943
|
+
// /**
|
|
944
|
+
// * Receive subscription request
|
|
945
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#add-user-to-your-contact-list)).
|
|
946
|
+
// */
|
|
947
|
+
// onSubscribeListener(userId: QBUser['id']): void;
|
|
948
|
+
// /**
|
|
949
|
+
// * These messages work over separated channel and won't be mixed with the regular chat messages
|
|
950
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-system-messages)).
|
|
951
|
+
// */
|
|
952
|
+
// onSystemMessageListener(message: QBSystemMessage): void;
|
|
953
|
+
// /**
|
|
954
|
+
// * Send message to 1 to 1 or group dialog
|
|
955
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-text-message)).
|
|
956
|
+
// */
|
|
957
|
+
// send<T extends QBChatNewMessage>(
|
|
958
|
+
// jidOrUserId: QBUser['id'] | string,
|
|
959
|
+
// message: T,
|
|
960
|
+
// ): string;
|
|
961
|
+
// /**
|
|
962
|
+
// * Send is stop typing status
|
|
963
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators)).
|
|
964
|
+
// */
|
|
965
|
+
// sendIsStopTypingStatus(jidOrUserId: QBUser['id'] | string): void;
|
|
966
|
+
// /**
|
|
967
|
+
// * Send is typing status
|
|
968
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-typing-indicators)).
|
|
969
|
+
// */
|
|
970
|
+
// sendIsTypingStatus(jidOrUserId: QBUser['id'] | string): void;
|
|
971
|
+
// /**
|
|
972
|
+
// * Send is read status
|
|
973
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#mark-message-as-read)).
|
|
974
|
+
// */
|
|
975
|
+
// sendReadStatus(params: QBMessageStatusParams): void;
|
|
976
|
+
// /**
|
|
977
|
+
// * Send system message (system notification) to 1 to 1 or group dialog
|
|
978
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#send-system-messages)).
|
|
979
|
+
// */
|
|
980
|
+
// sendSystemMessage(
|
|
981
|
+
// jidOrUserId: QBUser['id'] | string,
|
|
982
|
+
// // TODO: change type
|
|
983
|
+
// message: { extension: QBSystemMessage['extension'] },
|
|
984
|
+
// ): string;
|
|
985
|
+
// /** Send is delivered status. */
|
|
986
|
+
// sendDeliveredStatus(params: QBMessageStatusParams): void;
|
|
987
|
+
// ping(jidOrUserId: string | number, callback: QBCallback<any>): string;
|
|
988
|
+
// ping(callback: QBCallback<any>): string;
|
|
989
|
+
//
|
|
990
|
+
// dialog: {
|
|
991
|
+
// /**
|
|
992
|
+
// * Create new dialog
|
|
993
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#create-dialog)).
|
|
994
|
+
// */
|
|
995
|
+
// create(params: Dictionary<any>, callback: QBCallback<QBChatDialog>): void;
|
|
996
|
+
// /**
|
|
997
|
+
// * Delete a dialog or dialogs
|
|
998
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#delete-dialog)).
|
|
999
|
+
// */
|
|
1000
|
+
// delete(
|
|
1001
|
+
// id: QBChatDialog['_id'] | Array<QBChatDialog['_id']>,
|
|
1002
|
+
// params: { force: 1 },
|
|
1003
|
+
// callback: QBCallback<any>,
|
|
1004
|
+
// );
|
|
1005
|
+
// /**
|
|
1006
|
+
// * Delete a dialog or dialogs
|
|
1007
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#delete-dialog)).
|
|
1008
|
+
// */
|
|
1009
|
+
// delete(
|
|
1010
|
+
// id: QBChatDialog['_id'] | Array<QBChatDialog['_id']>,
|
|
1011
|
+
// callback: QBCallback<any>,
|
|
1012
|
+
// );
|
|
1013
|
+
// /**
|
|
1014
|
+
// * Retrieve list of dialogs
|
|
1015
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#retrieve-list-of-dialogs)).
|
|
1016
|
+
// */
|
|
1017
|
+
// list(
|
|
1018
|
+
// params: {
|
|
1019
|
+
// limit?: number;
|
|
1020
|
+
// skip?: number;
|
|
1021
|
+
// sort_asc?: string;
|
|
1022
|
+
// sort_desc?: string;
|
|
1023
|
+
// [field: string]: any;
|
|
1024
|
+
// },
|
|
1025
|
+
// callback: QBCallback<QBGetDialogResult>,
|
|
1026
|
+
// ): void;
|
|
1027
|
+
// /**
|
|
1028
|
+
// * Update group dialog
|
|
1029
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#update-dialog)).
|
|
1030
|
+
// */
|
|
1031
|
+
// update(
|
|
1032
|
+
// id: QBChatDialog['_id'],
|
|
1033
|
+
// data: Dictionary<any>,
|
|
1034
|
+
// callback: QBCallback<QBChatDialog>,
|
|
1035
|
+
// ): void;
|
|
1036
|
+
// };
|
|
1037
|
+
//
|
|
1038
|
+
// message: {
|
|
1039
|
+
// /** Create message. */
|
|
1040
|
+
// create(params: Dictionary<any>, callback: QBCallback<QBChatMessage>): void;
|
|
1041
|
+
// /**
|
|
1042
|
+
// * Delete message
|
|
1043
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#delete-message)).
|
|
1044
|
+
// */
|
|
1045
|
+
// delete(
|
|
1046
|
+
// id: QBChatMessage['_id'],
|
|
1047
|
+
// params: { force: 1 },
|
|
1048
|
+
// callback: QBCallback<{
|
|
1049
|
+
// SuccessfullyDeleted: {
|
|
1050
|
+
// ids: string[];
|
|
1051
|
+
// };
|
|
1052
|
+
// NotFound: {
|
|
1053
|
+
// ids: string[];
|
|
1054
|
+
// };
|
|
1055
|
+
// }>,
|
|
1056
|
+
// ): void;
|
|
1057
|
+
// /**
|
|
1058
|
+
// * Delete message
|
|
1059
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#delete-message)).
|
|
1060
|
+
// */
|
|
1061
|
+
// delete(
|
|
1062
|
+
// id: QBChatMessage['_id'],
|
|
1063
|
+
// callback: QBCallback<{
|
|
1064
|
+
// SuccessfullyDeleted: {
|
|
1065
|
+
// ids: string[];
|
|
1066
|
+
// };
|
|
1067
|
+
// NotFound: {
|
|
1068
|
+
// ids: string[];
|
|
1069
|
+
// };
|
|
1070
|
+
// }>,
|
|
1071
|
+
// ): void;
|
|
1072
|
+
// /**
|
|
1073
|
+
// * Get a chat history
|
|
1074
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#retrieve-chat-history)).
|
|
1075
|
+
// */
|
|
1076
|
+
// list(
|
|
1077
|
+
// params: {
|
|
1078
|
+
// limit?: number;
|
|
1079
|
+
// skip?: number;
|
|
1080
|
+
// sort_asc?: string;
|
|
1081
|
+
// sort_desc?: string;
|
|
1082
|
+
// mark_as_read?: number;
|
|
1083
|
+
// [field: string]: any;
|
|
1084
|
+
// },
|
|
1085
|
+
// callback: QBCallback<GetMessagesResult>,
|
|
1086
|
+
// ): void;
|
|
1087
|
+
// /**
|
|
1088
|
+
// * Get unread messages counter for one or group of dialogs
|
|
1089
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#get-number-of-unread-messages)).
|
|
1090
|
+
// */
|
|
1091
|
+
// unreadCount(
|
|
1092
|
+
// params: { chat_dialog_ids: string | string[] },
|
|
1093
|
+
// callback: QBCallback<{ total: number }>,
|
|
1094
|
+
// ): void;
|
|
1095
|
+
// /**
|
|
1096
|
+
// * Update message
|
|
1097
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-messaging#update-message)).
|
|
1098
|
+
// */
|
|
1099
|
+
// update(
|
|
1100
|
+
// id: QBChatMessage['_id'],
|
|
1101
|
+
// params: Dictionary<any>,
|
|
1102
|
+
// callback: QBCallback<QBChatMessage>,
|
|
1103
|
+
// ): void;
|
|
1104
|
+
// };
|
|
1105
|
+
//
|
|
1106
|
+
// muc: {
|
|
1107
|
+
// /**
|
|
1108
|
+
// * Join to the group dialog
|
|
1109
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#join-dialog)).
|
|
1110
|
+
// */
|
|
1111
|
+
// join(dialogJid: string, callback: QBCallback<any>): void;
|
|
1112
|
+
// /**
|
|
1113
|
+
// * Leave group chat dialog
|
|
1114
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#leave-dialog)).
|
|
1115
|
+
// */
|
|
1116
|
+
// leave(dialogJid: string, callback: QBCallback<any>): void;
|
|
1117
|
+
// /**
|
|
1118
|
+
// * Leave group chat dialog
|
|
1119
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-dialogs#retrieve-online-users)).
|
|
1120
|
+
// */
|
|
1121
|
+
// listOnlineUsers(dialogJid: string, callback: QBCallback<any>): void;
|
|
1122
|
+
// };
|
|
1123
|
+
//
|
|
1124
|
+
// roster: {
|
|
1125
|
+
// /**
|
|
1126
|
+
// * Add users to contact list
|
|
1127
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#add-user-to-your-contact-list)).
|
|
1128
|
+
// */
|
|
1129
|
+
// add(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
1130
|
+
// /**
|
|
1131
|
+
// * Confirm subscription with some user
|
|
1132
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#confirm-the-contact-request)).
|
|
1133
|
+
// */
|
|
1134
|
+
// confirm(
|
|
1135
|
+
// jidOrUserId: string | QBUser['id'],
|
|
1136
|
+
// callback: QBCallback<any>,
|
|
1137
|
+
// ): void;
|
|
1138
|
+
// /**
|
|
1139
|
+
// * Receive contact list
|
|
1140
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#access-contact-list)).
|
|
1141
|
+
// */
|
|
1142
|
+
// get(callback: QBCallback<any>): void;
|
|
1143
|
+
// /**
|
|
1144
|
+
// * Reject subscription with some user
|
|
1145
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#reject-the-contact-request)).
|
|
1146
|
+
// */
|
|
1147
|
+
// reject(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
1148
|
+
// /**
|
|
1149
|
+
// * Remove subscription with some user from your contact list
|
|
1150
|
+
// * ([read more](https://docs.quickblox.com/docs/js-chat-contact-list#remove-user-from-the-contact-list)).
|
|
1151
|
+
// */
|
|
1152
|
+
// remove(jidOrUserId: string | QBUser['id'], callback: QBCallback<any>): void;
|
|
1153
|
+
// };
|
|
1154
|
+
//
|
|
1155
|
+
// helpers: {
|
|
1156
|
+
// /** Get unique id. */
|
|
1157
|
+
// getUniqueId(suffix: string | number): string;
|
|
1158
|
+
// /** Generate BSON ObjectId. */
|
|
1159
|
+
// getBsonObjectId(): string;
|
|
1160
|
+
// /** Get the dialog id from jid. */
|
|
1161
|
+
// getDialogIdFromNode(jid: string): QBChatDialog['_id'];
|
|
1162
|
+
// /** Get the User id from jid. */
|
|
1163
|
+
// getIdFromNode(jid: string): QBUser['id'];
|
|
1164
|
+
// /** Get user id from dialog's full jid. */
|
|
1165
|
+
// getIdFromResource(jid: string): QBUser['id'];
|
|
1166
|
+
// /** Get the recipient id. */
|
|
1167
|
+
// getRecipientId(
|
|
1168
|
+
// occupantsIds: Array<QBUser['id']>,
|
|
1169
|
+
// userId: QBUser['id'],
|
|
1170
|
+
// ): QBUser['id'];
|
|
1171
|
+
// /** Get the full room jid from room bare jid & user jid. */
|
|
1172
|
+
// getRoomJid(jid: string, userJid: string): string;
|
|
1173
|
+
// /** Get the room jid from dialog id. */
|
|
1174
|
+
// getRoomJidFromDialogId(dialogId: QBChatDialog['_id']): string;
|
|
1175
|
+
// /** Get bare dialog's jid from dialog's full jid. */
|
|
1176
|
+
// getRoomJidFromRoomFullJid(jid: string): string;
|
|
1177
|
+
// /** Get the user id from the room jid. */
|
|
1178
|
+
// getUserIdFromRoomJid(jid: string): string;
|
|
1179
|
+
// /** Get the User jid id. */
|
|
1180
|
+
// getUserJid(userId: QBUser['id'], appId?: string | number): string;
|
|
1181
|
+
// /** Get the User nick with the muc domain. */
|
|
1182
|
+
// getUserNickWithMucDomain(userId: QBUser['id']): string;
|
|
1183
|
+
// /** Get unique id. */
|
|
1184
|
+
// jidOrUserId(jidOrUserId: QBUser['id'] | string): string;
|
|
1185
|
+
// /** Get the chat type. */
|
|
1186
|
+
// typeChat(jidOrUserId: QBUser['id'] | string): 'chat' | 'groupchat';
|
|
1187
|
+
// /** Get the dialog jid from dialog id. */
|
|
1188
|
+
// getDialogJid(dialogId: QBChatDialog['_id']): string;
|
|
1189
|
+
// /** Get user jid from current user. */
|
|
1190
|
+
// getUserCurrentJid(): string;
|
|
1191
|
+
// };
|
|
1192
|
+
// }
|
|
1193
|
+
|
|
1194
|
+
declare interface QBDataFile {
|
|
1195
|
+
content_type: string;
|
|
1196
|
+
file_id: string;
|
|
391
1197
|
name: string;
|
|
392
|
-
file: any;
|
|
393
|
-
type: string;
|
|
394
1198
|
size: number;
|
|
395
|
-
public: boolean; // optional, "false" by default
|
|
396
1199
|
}
|
|
397
1200
|
|
|
398
|
-
interface
|
|
399
|
-
account_id: number;
|
|
400
|
-
app_id: number;
|
|
401
|
-
content_type: string;
|
|
402
|
-
created_at: string;
|
|
1201
|
+
declare interface QBBlob {
|
|
403
1202
|
id: number;
|
|
1203
|
+
uid: string;
|
|
1204
|
+
content_type: string;
|
|
404
1205
|
name: string;
|
|
405
|
-
public: boolean;
|
|
406
1206
|
size: number;
|
|
407
|
-
|
|
1207
|
+
created_at: string;
|
|
408
1208
|
updated_at: string;
|
|
1209
|
+
blob_status: string;
|
|
1210
|
+
set_completed_at: number;
|
|
1211
|
+
public: boolean;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
declare interface QBBlobCreate extends QBBlob {
|
|
1215
|
+
account_id: number;
|
|
1216
|
+
app_id: number;
|
|
1217
|
+
blob_object_access: {
|
|
1218
|
+
id: number;
|
|
1219
|
+
blob_id: number;
|
|
1220
|
+
expires: string;
|
|
1221
|
+
object_access_type: string;
|
|
1222
|
+
params: string;
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
interface QBBlobCreateUploadParams {
|
|
1227
|
+
name: string;
|
|
1228
|
+
file: File;
|
|
1229
|
+
type: string;
|
|
1230
|
+
size: number;
|
|
1231
|
+
public?: boolean; // optional, "false" by default
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
interface QBContentModule {
|
|
1235
|
+
/** Create new file object. */
|
|
1236
|
+
create(
|
|
1237
|
+
params: { name: string; content_type: string; public?: boolean },
|
|
1238
|
+
callback: QBCallback<QBBlobCreate>,
|
|
1239
|
+
): void;
|
|
1240
|
+
/**
|
|
1241
|
+
* Create file > upload file > mark file as uploaded > return result
|
|
1242
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#upload-file)).
|
|
1243
|
+
*/
|
|
1244
|
+
createAndUpload(
|
|
1245
|
+
params: QBBlobCreateUploadParams,
|
|
1246
|
+
callback: QBCallback<QBBlob>,
|
|
1247
|
+
): void;
|
|
1248
|
+
/**
|
|
1249
|
+
* Delete file by id
|
|
1250
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#delete-file)).
|
|
1251
|
+
*/
|
|
1252
|
+
delete(id: number, callback: QBCallback<any>): void;
|
|
1253
|
+
/**
|
|
1254
|
+
* Download file by UID.
|
|
1255
|
+
* If the file is public then it's possible to download it without a session token
|
|
1256
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#download-file-by-uid)).
|
|
1257
|
+
*/
|
|
1258
|
+
getFile(uid: string, callback: QBCallback<{ blob: QBBlob }>): void;
|
|
1259
|
+
/**
|
|
1260
|
+
* Retrieve file object info by id
|
|
1261
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#get-file-info)).
|
|
1262
|
+
*/
|
|
1263
|
+
getInfo(id: number, callback: QBCallback<{ blob: QBBlob }>): void;
|
|
1264
|
+
/**
|
|
1265
|
+
* Get a list of files for current user
|
|
1266
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#retrieve-files)).
|
|
1267
|
+
*/
|
|
1268
|
+
list(
|
|
1269
|
+
params: { page?: number; per_page?: number },
|
|
1270
|
+
callback: QBCallback<{
|
|
1271
|
+
current_page: number;
|
|
1272
|
+
per_page: number;
|
|
1273
|
+
total_entries: number;
|
|
1274
|
+
items: Array<{
|
|
1275
|
+
blob: QBBlob;
|
|
1276
|
+
}>;
|
|
1277
|
+
}>,
|
|
1278
|
+
): void;
|
|
1279
|
+
/** Declare file uploaded. The file's 'status' field will be set to 'complete'. */
|
|
1280
|
+
markUploaded(
|
|
1281
|
+
params: { id: number; size: number },
|
|
1282
|
+
callback: QBCallback<{ blob: { size: number } }>,
|
|
1283
|
+
): void;
|
|
1284
|
+
/**
|
|
1285
|
+
* Edit a file by ID
|
|
1286
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#update-file)).
|
|
1287
|
+
*/
|
|
1288
|
+
update(
|
|
1289
|
+
params: {
|
|
1290
|
+
id: QBBlob['id'];
|
|
1291
|
+
name?: QBBlob['name'];
|
|
1292
|
+
},
|
|
1293
|
+
callback: QBCallback<{ blob: QBBlob }>,
|
|
1294
|
+
): void;
|
|
1295
|
+
/** Upload a file to cloud storage. */
|
|
1296
|
+
upload(
|
|
1297
|
+
params: {
|
|
1298
|
+
url: string;
|
|
1299
|
+
data: Dictionary<any>;
|
|
1300
|
+
},
|
|
1301
|
+
callback: QBCallback<any>,
|
|
1302
|
+
): void;
|
|
1303
|
+
/**
|
|
1304
|
+
* Get private URL for file download by file_uid (blob_uid)
|
|
1305
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#get-private-url)).
|
|
1306
|
+
*/
|
|
1307
|
+
privateUrl(fileUID: string): string;
|
|
1308
|
+
/**
|
|
1309
|
+
* Get public URL for file download by file_uid (blob_uid)
|
|
1310
|
+
* ([read more](https://docs.quickblox.com/docs/js-content#get-public-url)).
|
|
1311
|
+
*/
|
|
1312
|
+
publicUrl(fileUID: string): string;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
declare interface QBCustomObjectAccess {
|
|
1316
|
+
access: 'open' | 'owner' | 'open_for_users_ids' | 'open_for_groups';
|
|
1317
|
+
ids?: string[];
|
|
1318
|
+
groups?: string[];
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
declare interface QBCustomObjectPermissions {
|
|
1322
|
+
create?: QBCustomObjectAccess;
|
|
1323
|
+
read?: QBCustomObjectAccess;
|
|
1324
|
+
update?: QBCustomObjectAccess;
|
|
1325
|
+
delete?: QBCustomObjectAccess;
|
|
409
1326
|
}
|
|
410
1327
|
|
|
411
|
-
interface QBCustomObject {
|
|
1328
|
+
declare interface QBCustomObject {
|
|
412
1329
|
/**
|
|
413
1330
|
* ID of the record
|
|
414
1331
|
* Generated automatically by the server after record creation
|
|
@@ -422,196 +1339,195 @@ interface QBCustomObject {
|
|
|
422
1339
|
created_at: number;
|
|
423
1340
|
/** Date & time when record was updated, filled automatically */
|
|
424
1341
|
updated_at: number;
|
|
1342
|
+
// permissions?: Required<QBCustomObjectPermissions>;
|
|
425
1343
|
}
|
|
426
1344
|
|
|
427
|
-
interface
|
|
428
|
-
priority: number;
|
|
429
|
-
client_id: QBUser['id'];
|
|
430
|
-
provider_id: QBUser['id'];
|
|
431
|
-
dialog_id: QBChatDialog['_id'];
|
|
432
|
-
description: string;
|
|
433
|
-
notes: string;
|
|
434
|
-
conclusion?: string;
|
|
435
|
-
date_start?: string;
|
|
436
|
-
date_end?: string;
|
|
437
|
-
language?: string;
|
|
438
|
-
records?: Array<QBContentObject['id']>;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
interface QBSchedule extends QBCustomObject {
|
|
442
|
-
provider_id: QBUser['id'];
|
|
443
|
-
duration: number;
|
|
444
|
-
timezone: string;
|
|
445
|
-
holidays: string[] | null;
|
|
446
|
-
sunday: string[] | null;
|
|
447
|
-
monday: string[] | null;
|
|
448
|
-
tuesday: string[] | null;
|
|
449
|
-
wednesday: string[] | null;
|
|
450
|
-
thursday: string[] | null;
|
|
451
|
-
friday: string[] | null;
|
|
452
|
-
saturday: string[] | null;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
interface QBCalendarEvent extends QBCustomObject {
|
|
456
|
-
date: string;
|
|
457
|
-
duration: number;
|
|
458
|
-
provider_id: QBUser['id'];
|
|
459
|
-
client_id: QBUser['id'];
|
|
460
|
-
appointment_id: QBAppointment['_id'];
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
type CreateAndUploadParams = {
|
|
464
|
-
file: File;
|
|
465
|
-
name: File['name'];
|
|
466
|
-
type: File['type'];
|
|
467
|
-
size: File['size'];
|
|
468
|
-
public?: boolean;
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
interface QBContentModule {
|
|
472
|
-
privateUrl(fileUID: string): string;
|
|
473
|
-
publicUrl(fileUID: string): string;
|
|
474
|
-
getInfo(
|
|
475
|
-
id: number,
|
|
476
|
-
callback: (error?: QBError, file: { blob: QBContentObject }) => void,
|
|
477
|
-
);
|
|
478
|
-
delete(id: number, callback: (error?: QBError, file: unknown) => void);
|
|
479
|
-
createAndUpload(
|
|
480
|
-
param: QBContentParam,
|
|
481
|
-
callback: (error?: QBError, file: { blob: QBContentObject }) => void,
|
|
482
|
-
);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
interface QBDataDeletedResponse {
|
|
1345
|
+
declare interface QBDataDeletedResponse {
|
|
486
1346
|
deleted: Array<QBCustomObject['_id']>;
|
|
487
1347
|
deletedCount: number;
|
|
488
1348
|
}
|
|
489
1349
|
|
|
490
1350
|
interface QBDataModule {
|
|
1351
|
+
/**
|
|
1352
|
+
* Create new custom object
|
|
1353
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#create-records)).
|
|
1354
|
+
*/
|
|
491
1355
|
create<T extends QBCustomObject>(
|
|
492
1356
|
className: string,
|
|
493
|
-
data: Dictionary<
|
|
494
|
-
callback:
|
|
1357
|
+
data: { permissions?: QBCustomObjectPermissions } & Dictionary<any>,
|
|
1358
|
+
callback: QBCallback<T>,
|
|
495
1359
|
): void;
|
|
496
|
-
|
|
1360
|
+
/**
|
|
1361
|
+
* Delete record/records by ID, IDs or criteria (filters) of particular class
|
|
1362
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#delete-records)).
|
|
1363
|
+
*/
|
|
1364
|
+
delete(
|
|
497
1365
|
className: string,
|
|
498
|
-
ids:
|
|
499
|
-
callback:
|
|
1366
|
+
ids: QBCustomObject['_id'] | Array<QBCustomObject['_id']>,
|
|
1367
|
+
callback: QBCallback<QBDataDeletedResponse>,
|
|
500
1368
|
): void;
|
|
1369
|
+
/**
|
|
1370
|
+
* Delete record/records by ID, IDs or criteria (filters) of particular class
|
|
1371
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#delete-records)).
|
|
1372
|
+
*/
|
|
1373
|
+
delete(
|
|
1374
|
+
className: string,
|
|
1375
|
+
criteria: Dictionary<any>,
|
|
1376
|
+
callback: QBCallback<{ total_deleted: number }>,
|
|
1377
|
+
): void;
|
|
1378
|
+
/**
|
|
1379
|
+
* Delete file from file field by ID
|
|
1380
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#delete-file)).
|
|
1381
|
+
*/
|
|
1382
|
+
deleteFile(
|
|
1383
|
+
className: string,
|
|
1384
|
+
params: { id: string; field_name: string },
|
|
1385
|
+
callback: QBCallback<any>,
|
|
1386
|
+
): void;
|
|
1387
|
+
/**
|
|
1388
|
+
* Download file from file field by ID
|
|
1389
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#download-file)).
|
|
1390
|
+
*/
|
|
1391
|
+
downloadFile(
|
|
1392
|
+
className: string,
|
|
1393
|
+
params: { id: string; field_name: string },
|
|
1394
|
+
callback: QBCallback<any>,
|
|
1395
|
+
): void;
|
|
1396
|
+
/** Return file's URL from file field by ID. */
|
|
1397
|
+
fileUrl(
|
|
1398
|
+
className: string,
|
|
1399
|
+
params: { id: string; field_name: string },
|
|
1400
|
+
): string;
|
|
1401
|
+
/**
|
|
1402
|
+
* Search for records of particular class
|
|
1403
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#retrieve-records)).
|
|
1404
|
+
*/
|
|
501
1405
|
list<T extends QBCustomObject>(
|
|
502
1406
|
className: string,
|
|
503
|
-
filters:
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
1407
|
+
filters: {
|
|
1408
|
+
limit?: number;
|
|
1409
|
+
skip?: number;
|
|
1410
|
+
sort_asc?: string;
|
|
1411
|
+
sort_desc?: string;
|
|
1412
|
+
group_by?: string;
|
|
1413
|
+
[field: string]: any;
|
|
1414
|
+
},
|
|
1415
|
+
callback: QBCallback<{
|
|
1416
|
+
class_name: string;
|
|
1417
|
+
items: T[];
|
|
1418
|
+
limit: number;
|
|
1419
|
+
skip: number;
|
|
1420
|
+
}>,
|
|
513
1421
|
): void;
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
1422
|
+
/**
|
|
1423
|
+
* Update record by ID of particular class
|
|
1424
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#update-records)).
|
|
1425
|
+
*/
|
|
1426
|
+
update<T extends QBCustomObject>(
|
|
518
1427
|
className: string,
|
|
519
|
-
data:
|
|
520
|
-
|
|
1428
|
+
data: {
|
|
1429
|
+
_id: string;
|
|
1430
|
+
permissions?: QBCustomObjectPermissions;
|
|
1431
|
+
} & Dictionary<any>,
|
|
1432
|
+
callback: QBCallback<T>,
|
|
1433
|
+
): void;
|
|
1434
|
+
/**
|
|
1435
|
+
* Upload file to file field
|
|
1436
|
+
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#files)).
|
|
1437
|
+
*/
|
|
1438
|
+
uploadFile(
|
|
1439
|
+
className: string,
|
|
1440
|
+
params: { id: string; field_name: string; file: File; name: string },
|
|
1441
|
+
callback: QBCallback<QBDataFile>,
|
|
521
1442
|
): void;
|
|
522
1443
|
}
|
|
523
1444
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
external_user_id?: string | number;
|
|
531
|
-
facebook_id?: string;
|
|
532
|
-
full_name?: string;
|
|
533
|
-
phone?: string;
|
|
534
|
-
tag_list?: string | string[];
|
|
535
|
-
twitter_id?: string;
|
|
536
|
-
website?: string;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
interface QBCreateUserWithEmail {
|
|
540
|
-
email: string;
|
|
541
|
-
password: string;
|
|
542
|
-
blob_id?: number;
|
|
543
|
-
custom_data?: string;
|
|
544
|
-
external_user_id?: string | number;
|
|
545
|
-
facebook_id?: string;
|
|
546
|
-
full_name?: string;
|
|
547
|
-
login?: string;
|
|
548
|
-
phone?: string;
|
|
549
|
-
tag_list?: string | string[];
|
|
550
|
-
twitter_id?: string;
|
|
551
|
-
website?: string;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
type QBCreateUserParams = QBCreateUserWithLogin | QBCreateUserWithEmail;
|
|
1445
|
+
declare type ListUserParams = {
|
|
1446
|
+
page?: number;
|
|
1447
|
+
per_page?: number;
|
|
1448
|
+
filter?: Dictionary<any>;
|
|
1449
|
+
order?: string;
|
|
1450
|
+
};
|
|
555
1451
|
|
|
556
|
-
type
|
|
1452
|
+
declare type GetUserParams =
|
|
557
1453
|
| { login: string }
|
|
558
|
-
| { full_name: string }
|
|
1454
|
+
| { full_name: string; page?: number; per_page?: number }
|
|
559
1455
|
| { facebook_id: string }
|
|
560
|
-
| { twitter_id: string }
|
|
561
1456
|
| { phone: string }
|
|
562
1457
|
| { email: string }
|
|
563
|
-
| { tags: string }
|
|
1458
|
+
| { tags: string | string[]; page?: number; per_page?: number }
|
|
1459
|
+
| Omit<ListUserParams, 'filter'>
|
|
564
1460
|
| { external: string };
|
|
565
1461
|
|
|
566
|
-
type GetUserParams =
|
|
567
|
-
| GetUserParam
|
|
568
|
-
| {
|
|
569
|
-
page?: number;
|
|
570
|
-
per_page?: number;
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
type ListUserParams = {
|
|
574
|
-
page?: number;
|
|
575
|
-
per_page?: number;
|
|
576
|
-
filter?: Dictionary<unknown>;
|
|
577
|
-
order?: string;
|
|
578
|
-
};
|
|
579
|
-
|
|
580
|
-
interface ListUserResponse {
|
|
581
|
-
current_page: number;
|
|
582
|
-
per_page: number;
|
|
583
|
-
total_entries: number;
|
|
584
|
-
items: Array<{ user: QBUser }>;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
1462
|
interface QBUsersModule {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
1463
|
+
/**
|
|
1464
|
+
* Registers a new app user.
|
|
1465
|
+
* Call this API to register a user for the app.
|
|
1466
|
+
* You must provide either a user login or email address along with their password,
|
|
1467
|
+
* passing both email address and login is permitted but not required
|
|
1468
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#create-user)).
|
|
1469
|
+
*/
|
|
1470
|
+
create(
|
|
1471
|
+
params:
|
|
1472
|
+
| RequiredProps<QBUserCreate, 'email'>
|
|
1473
|
+
| RequiredProps<QBUserCreate, 'phone'>
|
|
1474
|
+
| RequiredProps<QBUserCreate, 'login'>,
|
|
1475
|
+
callback: QBCallback<QBUser>,
|
|
595
1476
|
): void;
|
|
1477
|
+
/**
|
|
1478
|
+
* Remove a user from the app, by user's id that represents the user in an external user registry.
|
|
1479
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#delete-user)).
|
|
1480
|
+
*/
|
|
1481
|
+
delete(userId: QBUser['id'], callback: QBCallback<any>): void;
|
|
1482
|
+
/**
|
|
1483
|
+
* Remove a user from the app, by user's external id that represents the user in an external user registry.
|
|
1484
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#delete-user)).
|
|
1485
|
+
*/
|
|
1486
|
+
delete(params: { external: number }, callback: QBCallback<any>): void;
|
|
1487
|
+
/**
|
|
1488
|
+
* Retrieve the user by id.
|
|
1489
|
+
*/
|
|
1490
|
+
get(userId: QBUser['id'], callback: QBCallback<QBUser>): void;
|
|
1491
|
+
/**
|
|
1492
|
+
* Retrieve a specific users.
|
|
1493
|
+
*/
|
|
1494
|
+
get(params: GetUserParams, callback: QBCallback<ListUserResponse>): void;
|
|
1495
|
+
/**
|
|
1496
|
+
* Call this API to get a list of current users of you app.
|
|
1497
|
+
* By default it returns upto 10 users, but you can change this by adding pagination parameters.
|
|
1498
|
+
* You can filter the list of users by supplying a filter string. You can sort results by ask/desc
|
|
1499
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#retrieve-users)).
|
|
1500
|
+
*/
|
|
596
1501
|
listUsers(
|
|
597
1502
|
params: ListUserParams,
|
|
598
|
-
callback:
|
|
599
|
-
): void;
|
|
600
|
-
create(
|
|
601
|
-
params: QBCreateUserParams,
|
|
602
|
-
callback: (error?: QBError, user: QBUser) => void,
|
|
1503
|
+
callback: QBCallback<ListUserResponse>,
|
|
603
1504
|
): void;
|
|
1505
|
+
/**
|
|
1506
|
+
* You can initiate password resets for users who have emails associated with their account.
|
|
1507
|
+
* Password reset instruction will be sent to this email address
|
|
1508
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#reset-user-password)).
|
|
1509
|
+
*/
|
|
1510
|
+
resetPassword(email: string, callback: QBCallback<any>): void;
|
|
1511
|
+
/**
|
|
1512
|
+
* Update current user. In normal usage,
|
|
1513
|
+
* nobody except the user is allowed to modify their own data.
|
|
1514
|
+
* Any fields you don’t specify will remain unchanged,
|
|
1515
|
+
* so you can update just a subset of the user’s data.
|
|
1516
|
+
* login/email and password may be changed,
|
|
1517
|
+
* but the new login/email must not already be in use
|
|
1518
|
+
* ([read more](https://docs.quickblox.com/docs/js-users#update-user)).
|
|
1519
|
+
*/
|
|
604
1520
|
update(
|
|
605
1521
|
userId: number,
|
|
606
|
-
user:
|
|
607
|
-
callback:
|
|
1522
|
+
user: QBUserUpdate,
|
|
1523
|
+
callback: QBCallback<QBUser>,
|
|
608
1524
|
): void;
|
|
609
1525
|
}
|
|
610
1526
|
|
|
611
|
-
interface
|
|
1527
|
+
declare interface QBMediaParams {
|
|
612
1528
|
audio: MediaStreamConstraints['audio'];
|
|
613
1529
|
video: MediaStreamConstraints['video'];
|
|
614
|
-
/**
|
|
1530
|
+
/** Id attribute of HTMLVideoElement */
|
|
615
1531
|
elemId?: string;
|
|
616
1532
|
options?: {
|
|
617
1533
|
muted?: boolean;
|
|
@@ -619,7 +1535,20 @@ interface QBGetUserMediaParams {
|
|
|
619
1535
|
};
|
|
620
1536
|
}
|
|
621
1537
|
|
|
622
|
-
|
|
1538
|
+
declare enum QBWebRTCSessionState {
|
|
1539
|
+
NEW = 1,
|
|
1540
|
+
ACTIVE = 2,
|
|
1541
|
+
HUNGUP = 3,
|
|
1542
|
+
REJECTED = 4,
|
|
1543
|
+
CLOSED = 5,
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
declare enum QBWebRTCCallType {
|
|
1547
|
+
VIDEO = 1,
|
|
1548
|
+
AUDIO = 2,
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
declare interface QBWebRTCSession {
|
|
623
1552
|
State: {
|
|
624
1553
|
NEW: 1;
|
|
625
1554
|
ACTIVE: 2;
|
|
@@ -629,97 +1558,358 @@ interface QBWebRTCSession {
|
|
|
629
1558
|
};
|
|
630
1559
|
ID: string;
|
|
631
1560
|
/**
|
|
632
|
-
* One of
|
|
1561
|
+
* One of
|
|
1562
|
+
* - state=1 (`NEW`)
|
|
1563
|
+
* - state=2 (`ACTIVE`)
|
|
1564
|
+
* - state=3 (`HUNGUP`)
|
|
1565
|
+
* - state=4 (`REJECTED`)
|
|
1566
|
+
* - state=5 (`CLOSED`)
|
|
1567
|
+
*/
|
|
1568
|
+
state: QBWebRTCSessionState;
|
|
1569
|
+
initiatorID: QBUser['id'];
|
|
1570
|
+
currentUserID: QBUser['id'];
|
|
1571
|
+
opponentsIDs: Array<QBUser['id']>;
|
|
1572
|
+
peerConnections: { [userId: QBUser['id']]: RTCPeerConnection };
|
|
1573
|
+
acceptCallTime: string;
|
|
1574
|
+
bandwidth: number;
|
|
1575
|
+
/**
|
|
1576
|
+
* One of
|
|
1577
|
+
* - callType=1 (`VIDEO`)
|
|
1578
|
+
* - callType=2 (`AUDIO`)
|
|
633
1579
|
*/
|
|
634
|
-
|
|
635
|
-
initiatorID: number;
|
|
636
|
-
opponentsIDs: number[];
|
|
637
|
-
peerConnections: { [userId: number]: RTCPeerConnection };
|
|
638
|
-
callType: 1 | 2;
|
|
1580
|
+
callType: QBWebRTCCallType;
|
|
639
1581
|
startCallTime?: Date;
|
|
640
1582
|
localStream?: MediaStream;
|
|
641
|
-
mediaParams:
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
1583
|
+
mediaParams: QBMediaParams | null;
|
|
1584
|
+
/**
|
|
1585
|
+
* Get the user media stream
|
|
1586
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#access-local-media-stream)).
|
|
1587
|
+
*/
|
|
1588
|
+
getUserMedia(params: QBMediaParams, callback: QBCallback<MediaStream>): void;
|
|
1589
|
+
/**
|
|
1590
|
+
* Attach media stream to audio/video element
|
|
1591
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#attach-local-media-stream)).
|
|
1592
|
+
*/
|
|
647
1593
|
attachMediaStream(
|
|
648
1594
|
videoElemId: string,
|
|
649
1595
|
stream: MediaStream,
|
|
650
|
-
options?:
|
|
1596
|
+
options?: QBMediaParams['options'],
|
|
651
1597
|
): void;
|
|
652
1598
|
/** Detach media stream from audio/video element */
|
|
653
1599
|
detachMediaStream(videoElemId: string): void;
|
|
1600
|
+
/**
|
|
1601
|
+
* Mutes the stream
|
|
1602
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling-advanced#mute-audio)).
|
|
1603
|
+
*/
|
|
654
1604
|
mute(type: 'audio' | 'video'): void;
|
|
1605
|
+
/**
|
|
1606
|
+
* Unmutes the stream
|
|
1607
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling-advanced#mute-audio)).
|
|
1608
|
+
*/
|
|
655
1609
|
unmute(type: 'audio' | 'video'): void;
|
|
656
|
-
/**
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
1610
|
+
/**
|
|
1611
|
+
* Initiate a call
|
|
1612
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#make-a-call)).
|
|
1613
|
+
*/
|
|
1614
|
+
call(extension: Dictionary<any>, callback: (error: null) => void): void;
|
|
1615
|
+
/**
|
|
1616
|
+
* Accept a call
|
|
1617
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#accept-a-call)).
|
|
1618
|
+
*/
|
|
1619
|
+
accept(extension: Dictionary<any>): void;
|
|
1620
|
+
/**
|
|
1621
|
+
* Reject a call
|
|
1622
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#reject-a-call)).
|
|
1623
|
+
*/
|
|
1624
|
+
reject(extension: Dictionary<any>): void;
|
|
1625
|
+
/**
|
|
1626
|
+
* Stop a call
|
|
1627
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#end-a-call)).
|
|
1628
|
+
*/
|
|
1629
|
+
stop(extension: Dictionary<any>): void;
|
|
1630
|
+
/** Update a call. */
|
|
1631
|
+
update(extension: Dictionary<any>, userID?: QBUser['id']): void;
|
|
1632
|
+
/**
|
|
1633
|
+
* Switch media tracks in audio/video HTML's element and replace its in peers
|
|
1634
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling-advanced#switch-camera)).
|
|
1635
|
+
*/
|
|
664
1636
|
switchMediaTracks(
|
|
665
1637
|
deviceIds: { audio?: { exact: string }; video?: { exact: string } },
|
|
666
|
-
callback:
|
|
1638
|
+
callback: QBCallback<MediaStream>,
|
|
667
1639
|
): void;
|
|
668
1640
|
/** Add tracks from provided stream to local stream (and replace in peers) */
|
|
669
1641
|
_replaceTracks(stream: MediaStream): void;
|
|
670
1642
|
}
|
|
671
1643
|
|
|
672
|
-
interface QBWebRTCModule {
|
|
1644
|
+
declare interface QBWebRTCModule {
|
|
673
1645
|
CallType: {
|
|
674
1646
|
VIDEO: 1;
|
|
675
1647
|
AUDIO: 2;
|
|
676
1648
|
};
|
|
1649
|
+
sessions: {
|
|
1650
|
+
[sessionId]: QBWebRTCSession;
|
|
1651
|
+
};
|
|
1652
|
+
/** Return data or all active devices. */
|
|
677
1653
|
getMediaDevices(kind?: MediaDeviceKind): Promise<MediaDeviceInfo[]>;
|
|
678
|
-
|
|
1654
|
+
/**
|
|
1655
|
+
* Creates the new session
|
|
1656
|
+
* ([read more](https://docs.quickblox.com/docs/js-video-calling#create-session)).
|
|
1657
|
+
*/
|
|
1658
|
+
createNewSession(
|
|
1659
|
+
opponentsIds: number[],
|
|
1660
|
+
callType?: QBWebRTCCallType,
|
|
1661
|
+
initiatorID?: QBUser['id'],
|
|
1662
|
+
opts?: { bandwidth: number },
|
|
1663
|
+
): QBWebRTCSession;
|
|
1664
|
+
/** Deletes a session. */
|
|
1665
|
+
clearSession(sessionId: QBWebRTCSession['ID']): void;
|
|
1666
|
+
/** Check all session and find session with status 'NEW' or 'ACTIVE' which ID != provided. */
|
|
1667
|
+
isExistLiveSessionExceptSessionID(sessionId: QBWebRTCSession['ID']): boolean;
|
|
1668
|
+
/** Get new sessions count */
|
|
1669
|
+
getNewSessionsCount(exceptSessionId?: QBWebRTCSession['ID']): number;
|
|
1670
|
+
|
|
679
1671
|
onAcceptCallListener?: (
|
|
680
1672
|
session: QBWebRTCSession,
|
|
681
|
-
userId:
|
|
682
|
-
userInfo: Dictionary<
|
|
1673
|
+
userId: QBUser['id'],
|
|
1674
|
+
userInfo: Dictionary<any>,
|
|
683
1675
|
) => void;
|
|
684
1676
|
onCallListener?: (
|
|
685
1677
|
session: QBWebRTCSession,
|
|
686
|
-
userInfo: Dictionary<
|
|
1678
|
+
userInfo: Dictionary<any>,
|
|
687
1679
|
) => void;
|
|
688
1680
|
onCallStatsReport?: (
|
|
689
1681
|
session: QBWebRTCSession,
|
|
690
|
-
userId:
|
|
1682
|
+
userId: QBUser['id'],
|
|
691
1683
|
stats: string[],
|
|
692
1684
|
) => void;
|
|
693
1685
|
onRejectCallListener?: (
|
|
694
1686
|
session: QBWebRTCSession,
|
|
695
|
-
userId:
|
|
696
|
-
userInfo: Dictionary<
|
|
1687
|
+
userId: QBUser['id'],
|
|
1688
|
+
userInfo: Dictionary<any>,
|
|
697
1689
|
) => void;
|
|
698
1690
|
onRemoteStreamListener?: (
|
|
699
1691
|
sesion: QBWebRTCSession,
|
|
700
|
-
userId:
|
|
1692
|
+
userId: QBUser['id'],
|
|
701
1693
|
stream: MediaStream,
|
|
702
1694
|
) => void;
|
|
703
1695
|
onSessionCloseListener?: (session: QBWebRTCSession) => void;
|
|
704
1696
|
onSessionConnectionStateChangedListener?: (
|
|
705
1697
|
sesion: QBWebRTCSession,
|
|
706
|
-
userId:
|
|
707
|
-
state:
|
|
1698
|
+
userId: QBUser['id'],
|
|
1699
|
+
state: any,
|
|
708
1700
|
) => void;
|
|
709
1701
|
onStopCallListener?: (
|
|
710
1702
|
session: QBWebRTCSession,
|
|
711
|
-
userId:
|
|
712
|
-
userInfo: Dictionary<
|
|
1703
|
+
userId: QBUser['id'],
|
|
1704
|
+
userInfo: Dictionary<any>,
|
|
713
1705
|
) => void;
|
|
714
1706
|
onUpdateCallListener?: (
|
|
715
1707
|
session: QBWebRTCSession,
|
|
716
1708
|
userId: number,
|
|
717
|
-
userInfo: Dictionary<
|
|
1709
|
+
userInfo: Dictionary<any>,
|
|
718
1710
|
) => void;
|
|
719
1711
|
onUserNotAnswerListener?: (session: QBWebRTCSession, userId: number) => void;
|
|
1712
|
+
onReconnectListener?: (
|
|
1713
|
+
session: QBWebRTCSession,
|
|
1714
|
+
userId: number,
|
|
1715
|
+
state: any,
|
|
1716
|
+
) => void;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
declare interface QBPushNotificationsEventsCreate {
|
|
1720
|
+
/**
|
|
1721
|
+
* Type of notification.
|
|
1722
|
+
* Allowed values: push or email.
|
|
1723
|
+
*/
|
|
1724
|
+
notification_type: 'push' | 'email';
|
|
1725
|
+
/**
|
|
1726
|
+
* An environment of the notification.
|
|
1727
|
+
* Allowed values: development or production.
|
|
1728
|
+
*/
|
|
1729
|
+
environment: 'development' | 'production';
|
|
1730
|
+
/**
|
|
1731
|
+
* A payload of event. For push notifications:
|
|
1732
|
+
* if event[push_type] not present - should be Base64 encoded text.
|
|
1733
|
+
*/
|
|
1734
|
+
message: string;
|
|
1735
|
+
/**
|
|
1736
|
+
* Push Notification type.
|
|
1737
|
+
* Used only if event[notification_type] = push, ignored in other cases.
|
|
1738
|
+
* If not present - Notification will be delivered to all possible devices for specified users.
|
|
1739
|
+
* Each platform has their own standard format.
|
|
1740
|
+
* If specified - Notification will be delivered to the specified platform only.
|
|
1741
|
+
* Allowed values: apns, apns_voip, gcm, mpns or bbps.
|
|
1742
|
+
*/
|
|
1743
|
+
push_type?: 'apns' | 'apns_voip' | 'gcm' | 'mpns' | 'bbps';
|
|
1744
|
+
/**
|
|
1745
|
+
* Allowed values: one_shot, fixed_date or period_date. one_shot - a one-time event,
|
|
1746
|
+
* which causes by an external object (the value is only valid if the 'date' is not specified).
|
|
1747
|
+
* fixed_date - a one-time event, which occurs at a specified 'date' (the value is valid only if the 'date' is given).
|
|
1748
|
+
* period_date - reusable event that occurs within a given 'period' from the initial 'date'
|
|
1749
|
+
* (the value is only valid if the 'period' specified).
|
|
1750
|
+
* By default: fixed_date, if 'date' is specified. period_date, if 'period' is specified.
|
|
1751
|
+
* one_shot, if 'date' is not specified.
|
|
1752
|
+
*/
|
|
1753
|
+
event_type?: 'one_shot' | 'fixed_date' | 'period_date';
|
|
1754
|
+
/**
|
|
1755
|
+
* The name of the event. Service information.
|
|
1756
|
+
* Only for your own usage.
|
|
1757
|
+
*/
|
|
1758
|
+
name?: string;
|
|
1759
|
+
/**
|
|
1760
|
+
* The period of the event in seconds.
|
|
1761
|
+
* Required if the event[event_type] = period_date.
|
|
1762
|
+
* Possible values: 86400 (1 day). 604800 (1 week). 2592000 (1 month). 31557600 (1 year).
|
|
1763
|
+
*/
|
|
1764
|
+
period?: number;
|
|
1765
|
+
/**
|
|
1766
|
+
* The date of the event to send on.
|
|
1767
|
+
* Required if event[event_type] = fixed_date or period_date.
|
|
1768
|
+
* If event[event_type] = fixed_date, the date can not be in the pas.
|
|
1769
|
+
*/
|
|
1770
|
+
date?: number;
|
|
1771
|
+
user?: {
|
|
1772
|
+
/** Notification's recipients - should contain a string of users' ids divided by commas. */
|
|
1773
|
+
ids?: Array<QBUser['id']>;
|
|
1774
|
+
tags?: {
|
|
1775
|
+
/**
|
|
1776
|
+
* Notification's recipients - should contain a string of tags divided by commas.
|
|
1777
|
+
* Recipients (users) must have at least one tag that specified in the list.
|
|
1778
|
+
*/
|
|
1779
|
+
any?: string[];
|
|
1780
|
+
/**
|
|
1781
|
+
* Notification's recipients - should contain a string of tags divided by commas.
|
|
1782
|
+
* Recipients (users) must exactly have only all tags that specified in list.
|
|
1783
|
+
*/
|
|
1784
|
+
all?: string[];
|
|
1785
|
+
/**
|
|
1786
|
+
* Notification's recipients - should contain a string of tags divided by commas.
|
|
1787
|
+
* Recipients (users) mustn't have tags that specified in list.
|
|
1788
|
+
*/
|
|
1789
|
+
exclude?: string[];
|
|
1790
|
+
};
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
declare interface QBPushNotificationsSubscriptionsCreate {
|
|
1795
|
+
/**
|
|
1796
|
+
* Declare which notification channels could be used to notify user about events.
|
|
1797
|
+
* Allowed values: apns, apns_voip, gcm, mpns, bbps and email.
|
|
1798
|
+
*/
|
|
1799
|
+
notification_channel:
|
|
1800
|
+
| 'apns'
|
|
1801
|
+
| 'apns_voip'
|
|
1802
|
+
| 'gcm'
|
|
1803
|
+
| 'mpns'
|
|
1804
|
+
| 'bbps'
|
|
1805
|
+
| 'email';
|
|
1806
|
+
push_token: {
|
|
1807
|
+
/**
|
|
1808
|
+
* Determine application mode.
|
|
1809
|
+
* It allows conveniently separate development and production modes.
|
|
1810
|
+
* Allowed values: development or production.
|
|
1811
|
+
*/
|
|
1812
|
+
environment: 'development' | 'production';
|
|
1813
|
+
/**
|
|
1814
|
+
* A unique identifier for client's application.
|
|
1815
|
+
* In iOS, this is the Bundle Identifier.
|
|
1816
|
+
* In Android - package id.
|
|
1817
|
+
*/
|
|
1818
|
+
bundle_identifier?: string;
|
|
1819
|
+
/**
|
|
1820
|
+
* Identifies client device in 3-rd party service like APNS, GCM/FCM, BBPS or MPNS.
|
|
1821
|
+
* Initially retrieved from 3-rd service and should be send to QuickBlox to let it send push notifications to the client.
|
|
1822
|
+
*/
|
|
1823
|
+
client_identification_sequence: string;
|
|
1824
|
+
};
|
|
1825
|
+
device: {
|
|
1826
|
+
/**
|
|
1827
|
+
* Platform of device, which is the source of application running.
|
|
1828
|
+
* Allowed values: ios, android, windows_phone, blackberry.
|
|
1829
|
+
*/
|
|
1830
|
+
platform: 'ios' | 'android' | 'windows_phone' | 'blackberry';
|
|
1831
|
+
/**
|
|
1832
|
+
* UDID (Unique Device identifier) of device, which is the source of application running.
|
|
1833
|
+
* This must be anything sequence which uniquely identify particular device.
|
|
1834
|
+
* This is needed to support schema: 1 User - Multiple devices.
|
|
1835
|
+
*/
|
|
1836
|
+
udid: string;
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
declare interface QBPushNotificationsModule {
|
|
1841
|
+
events: {
|
|
1842
|
+
/**
|
|
1843
|
+
* Create notification event.
|
|
1844
|
+
* This request will immediately produce notification delivery
|
|
1845
|
+
* (push notification or email)
|
|
1846
|
+
* ([read more](https://docs.quickblox.com/docs/js-push-notifications#send-push-notifications)).
|
|
1847
|
+
*/
|
|
1848
|
+
create(
|
|
1849
|
+
params: QBPushNotificationsEventsCreate,
|
|
1850
|
+
callback: QBCallback<any>,
|
|
1851
|
+
): void;
|
|
1852
|
+
/** Delete an event by ID. */
|
|
1853
|
+
delete(id, callback: QBCallback<any>): void;
|
|
1854
|
+
/** Retrieve an event by ID. */
|
|
1855
|
+
get(id, callback: QBCallback<any>): void;
|
|
1856
|
+
/** Get list of events which were created by current user. */
|
|
1857
|
+
list(params, callback: QBCallback<any>): void;
|
|
1858
|
+
/** Retrieve an event's status by ID. */
|
|
1859
|
+
status(id, callback: QBCallback<any>): void;
|
|
1860
|
+
};
|
|
1861
|
+
subscriptions: {
|
|
1862
|
+
/** Create device based subscription. */
|
|
1863
|
+
create(
|
|
1864
|
+
params: QBPushNotificationsSubscriptionsCreate,
|
|
1865
|
+
callback: QBCallback<any>,
|
|
1866
|
+
): void;
|
|
1867
|
+
/** Remove a subscription by its identifier. */
|
|
1868
|
+
delete(id: number, callback: QBCallback<any>): void;
|
|
1869
|
+
/** Retrieve subscriptions for the user which is specified in the session token. */
|
|
1870
|
+
list(callback: QBCallback<any>): void;
|
|
1871
|
+
};
|
|
1872
|
+
base64Encode(payload: any): string;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
declare interface QBAddressBookModule {
|
|
1876
|
+
/**
|
|
1877
|
+
* Upload address book
|
|
1878
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#upload-address-book)).
|
|
1879
|
+
*/
|
|
1880
|
+
uploadAddressBook(
|
|
1881
|
+
contacts: any[],
|
|
1882
|
+
options: { udid?: string; force?: 1 },
|
|
1883
|
+
callback: QBCallback<any>,
|
|
1884
|
+
): void;
|
|
1885
|
+
/**
|
|
1886
|
+
* Upload address book
|
|
1887
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#upload-address-book)).
|
|
1888
|
+
*/
|
|
1889
|
+
uploadAddressBook(contacts: any[], callback: QBCallback<any>): void;
|
|
1890
|
+
/**
|
|
1891
|
+
* Retrieve address book
|
|
1892
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#retrieve-address-book)).
|
|
1893
|
+
*/
|
|
1894
|
+
get(UDID: string, callback: QBCallback<any>): void;
|
|
1895
|
+
/**
|
|
1896
|
+
* Retrieve address book
|
|
1897
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#retrieve-address-book)).
|
|
1898
|
+
*/
|
|
1899
|
+
get(callback: QBCallback<any>): void;
|
|
1900
|
+
/**
|
|
1901
|
+
* Retrieve registered users
|
|
1902
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#retrieve-registered-users)).
|
|
1903
|
+
*/
|
|
1904
|
+
getRegisteredUsers(isCompact: boolean, callback: QBCallback<any>): void;
|
|
1905
|
+
/**
|
|
1906
|
+
* Retrieve registered users
|
|
1907
|
+
* ([read more](https://docs.quickblox.com/docs/js-address-book#retrieve-registered-users)).
|
|
1908
|
+
*/
|
|
1909
|
+
getRegisteredUsers(callback: QBCallback<any>): void;
|
|
720
1910
|
}
|
|
721
1911
|
|
|
722
|
-
type QBLoginParams =
|
|
1912
|
+
declare type QBLoginParams =
|
|
723
1913
|
| {
|
|
724
1914
|
login: string;
|
|
725
1915
|
password: string;
|
|
@@ -731,184 +1921,961 @@ type QBLoginParams =
|
|
|
731
1921
|
| {
|
|
732
1922
|
provider: 'firebase_phone';
|
|
733
1923
|
firebase_phone: { access_token: string; project_id: string };
|
|
1924
|
+
}
|
|
1925
|
+
| {
|
|
1926
|
+
provider: 'facebook';
|
|
1927
|
+
keys: { token: string; secret: string | null };
|
|
734
1928
|
};
|
|
735
1929
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
};
|
|
1930
|
+
class QuickBlox {
|
|
1931
|
+
version: string;
|
|
1932
|
+
|
|
740
1933
|
buildNumber: string;
|
|
1934
|
+
|
|
741
1935
|
chat: QBChatModule;
|
|
1936
|
+
|
|
742
1937
|
content: QBContentModule;
|
|
743
|
-
|
|
744
|
-
params?: QBLoginParams,
|
|
745
|
-
callback: (error?: QBError, session: QBSession) => void,
|
|
746
|
-
): void;
|
|
1938
|
+
|
|
747
1939
|
data: QBDataModule;
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
1940
|
+
|
|
1941
|
+
users: QBUsersModule;
|
|
1942
|
+
|
|
1943
|
+
webrtc: QBWebRTCModule;
|
|
1944
|
+
|
|
1945
|
+
pushnotifications: QBPushNotificationsModule;
|
|
1946
|
+
|
|
1947
|
+
addressbook: QBAddressBookModule;
|
|
1948
|
+
|
|
1949
|
+
/**
|
|
1950
|
+
* Create new session
|
|
1951
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#create-session)).
|
|
1952
|
+
*/
|
|
1953
|
+
createSession: {
|
|
1954
|
+
(callback: QBCallback<QBSession>): void;
|
|
1955
|
+
(params: QBLoginParams, callback: QBCallback<QBSession>): void;
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1958
|
+
startSessionWithToken(
|
|
1959
|
+
token: string,
|
|
1960
|
+
callback: QBCallback<{ session: QBSession }>,
|
|
1961
|
+
);
|
|
1962
|
+
|
|
1963
|
+
/**
|
|
1964
|
+
* Destroy current session
|
|
1965
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#destroy-session-token)).
|
|
1966
|
+
*/
|
|
1967
|
+
destroySession(callback: QBCallback<any>): void;
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* Return current session
|
|
1971
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#get-session)).
|
|
1972
|
+
*/
|
|
1973
|
+
getSession(callback: QBCallback<{ session: QBSession }>): void;
|
|
1974
|
+
|
|
1975
|
+
/**
|
|
1976
|
+
* Init QuickBlox SDK
|
|
1977
|
+
* ([read more](https://docs.quickblox.com/docs/js-setup#initialize-quickblox-sdk))
|
|
1978
|
+
*/
|
|
752
1979
|
init(
|
|
753
1980
|
appIdOrToken: string | number,
|
|
754
1981
|
authKeyOrAppId: string | number,
|
|
755
|
-
authSecret
|
|
1982
|
+
authSecret: string | null | undefined,
|
|
756
1983
|
accountKey: string,
|
|
757
1984
|
config?: QBConfig,
|
|
758
1985
|
): void;
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* Init QuickBlox SDK with User Account data to start session with token
|
|
1989
|
+
* ([read more](https://docs.quickblox.com/docs/js-setup#initialize-quickblox-sdk-without-authorization-key-and-secret)).
|
|
1990
|
+
*/
|
|
1991
|
+
initWithAppId(appId: number, accountKey: string, config?: QBConfig): void;
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* Login to QuickBlox application
|
|
1995
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#log-in-user)).
|
|
1996
|
+
*/
|
|
1997
|
+
login(params: QBLoginParams, callback: QBCallback<QBUser>): void;
|
|
1998
|
+
|
|
1999
|
+
/**
|
|
2000
|
+
* Remove user from current session, but doesn't destroy it
|
|
2001
|
+
* ([read more](https://docs.quickblox.com/docs/js-authentication#log-out-user)).
|
|
2002
|
+
*/
|
|
2003
|
+
logout(callback: QBCallback<any>): void;
|
|
2004
|
+
|
|
764
2005
|
service: {
|
|
765
2006
|
qbInst: {
|
|
2007
|
+
session: QBSession | null;
|
|
766
2008
|
config: {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
2009
|
+
endpoints: Required<Required<QBConfig>['endpoints']>;
|
|
2010
|
+
webrtc: Required<Required<QBConfig>['webrtc']>;
|
|
2011
|
+
chatProtocol: Required<Required<QBConfig>['chatProtocol']>;
|
|
2012
|
+
on: Required<Required<QBConfig>['on']>;
|
|
2013
|
+
streamManagement: Required<Required<QBConfig>['streamManagement']>;
|
|
2014
|
+
debug: QBConfig['debug'];
|
|
2015
|
+
version: string;
|
|
2016
|
+
buildNumber: string;
|
|
2017
|
+
creds: {
|
|
2018
|
+
appId: number;
|
|
2019
|
+
authKey: string;
|
|
2020
|
+
authSecret: string;
|
|
2021
|
+
accountKey: string;
|
|
772
2022
|
};
|
|
773
2023
|
urls: {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
2024
|
+
account: 'account_settings';
|
|
2025
|
+
session: 'session';
|
|
2026
|
+
login: 'login';
|
|
2027
|
+
users: 'users';
|
|
2028
|
+
chat: 'chat';
|
|
2029
|
+
blobs: 'blobs';
|
|
2030
|
+
subscriptions: 'subscriptions';
|
|
2031
|
+
events: 'events';
|
|
2032
|
+
data: 'data';
|
|
2033
|
+
addressbook: 'address_book';
|
|
2034
|
+
addressbookRegistered: 'address_book/registered_users';
|
|
2035
|
+
type: '.json';
|
|
777
2036
|
};
|
|
2037
|
+
qbTokenExpirationDate: Date | null;
|
|
778
2038
|
};
|
|
779
2039
|
};
|
|
780
2040
|
};
|
|
781
|
-
users: QBUsersModule;
|
|
782
|
-
webrtc: QBWebRTCModule;
|
|
783
|
-
version: string;
|
|
784
2041
|
}
|
|
785
2042
|
|
|
786
|
-
interface
|
|
787
|
-
prototype:
|
|
788
|
-
new ():
|
|
2043
|
+
interface QuickBloxConstructor {
|
|
2044
|
+
prototype: QuickBlox;
|
|
2045
|
+
new (): QuickBlox;
|
|
789
2046
|
}
|
|
790
2047
|
|
|
791
|
-
interface QB extends
|
|
792
|
-
QuickBlox:
|
|
2048
|
+
interface QB extends QuickBlox {
|
|
2049
|
+
QuickBlox: QuickBloxConstructor;
|
|
793
2050
|
}
|
|
794
2051
|
|
|
795
|
-
declare const
|
|
2052
|
+
declare const SDK: QB;
|
|
796
2053
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
mimeType?: string;
|
|
800
|
-
workerPath?: string;
|
|
801
|
-
/**
|
|
802
|
-
* The minimum number of milliseconds of data to return
|
|
803
|
-
* in a single Blob, fire 'ondataavaible' callback
|
|
804
|
-
* (isn't need to use with 'audio/wav' of 'audio/mp3')
|
|
805
|
-
*
|
|
806
|
-
* @default 1000
|
|
807
|
-
*/
|
|
808
|
-
timeslice?: number;
|
|
809
|
-
/**
|
|
810
|
-
* What to do with a muted input MediaStreamTrack,
|
|
811
|
-
* e.g. insert black frames/zero audio volume in the recording
|
|
812
|
-
* or ignore altogether
|
|
813
|
-
*
|
|
814
|
-
* @default true
|
|
815
|
-
*/
|
|
816
|
-
ignoreMutedMedia?: boolean;
|
|
817
|
-
/** Recording start event handler */
|
|
818
|
-
onstart?: VoidFunction;
|
|
819
|
-
/** Recording stop event handler */
|
|
820
|
-
onstop?: (file: Blob) => void;
|
|
821
|
-
/** Recording pause event handler */
|
|
822
|
-
onpause?: VoidFunction;
|
|
823
|
-
/** Recording resume event handler */
|
|
824
|
-
onresume?: VoidFunction;
|
|
825
|
-
/** Error event handler */
|
|
826
|
-
onerror?: (error: unknown) => void;
|
|
827
|
-
/**
|
|
828
|
-
* `dataavailable` event handler.
|
|
829
|
-
* The Blob of recorded data is contained in this event (callback
|
|
830
|
-
* isn't supported if use 'audio/wav' of 'audio/mp3' for recording)
|
|
831
|
-
*/
|
|
832
|
-
ondataavailable?: (event: { data: Blob }) => void;
|
|
833
|
-
}
|
|
2054
|
+
//
|
|
2055
|
+
declare const QB: QB; // should leave for backward compatibility
|
|
834
2056
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
* Switch recording Blob objects to the specified
|
|
838
|
-
* MIME type if `MediaRecorder` support it.
|
|
839
|
-
*/
|
|
840
|
-
toggleMimeType(mimeType: string): void;
|
|
841
|
-
/**
|
|
842
|
-
* Returns current `MediaRecorder` state
|
|
843
|
-
*/
|
|
844
|
-
getState(): 'inactive' | 'recording' | 'paused';
|
|
845
|
-
/**
|
|
846
|
-
* Starts recording a stream.
|
|
847
|
-
* Fires `onstart` callback.
|
|
848
|
-
*/
|
|
849
|
-
start(stream: MediaStream): void;
|
|
850
|
-
/**
|
|
851
|
-
* Stops recording a stream
|
|
852
|
-
*
|
|
853
|
-
* @fires `onstop` callback and passing there Blob recorded
|
|
854
|
-
*/
|
|
855
|
-
stop(): void;
|
|
856
|
-
/** Pausing stream recording */
|
|
857
|
-
pause(): void;
|
|
858
|
-
/** Resumes stream recording */
|
|
859
|
-
resume(): void;
|
|
860
|
-
/**
|
|
861
|
-
* Change record source
|
|
862
|
-
*/
|
|
863
|
-
change(stream: MediaStream): void;
|
|
864
|
-
/**
|
|
865
|
-
* Create a file from blob and download as file.
|
|
866
|
-
* This method will call `stop` if recording is in progress.
|
|
867
|
-
*
|
|
868
|
-
* @param {string} filename Name of video file to be downloaded
|
|
869
|
-
* (default to `Date.now()`)
|
|
870
|
-
*/
|
|
871
|
-
download(filename?: string): void;
|
|
872
|
-
_getBlobRecorded(): Blob;
|
|
873
|
-
callbacks: Pick<
|
|
874
|
-
QBMediaRecorderConstructorProps,
|
|
875
|
-
| 'onstart'
|
|
876
|
-
| 'onstop'
|
|
877
|
-
| 'onpause'
|
|
878
|
-
| 'onresume'
|
|
879
|
-
| 'ondataavailable'
|
|
880
|
-
| 'onerror'
|
|
881
|
-
>;
|
|
882
|
-
}
|
|
2057
|
+
/*
|
|
2058
|
+
* QuickBlox Types - end
|
|
883
2059
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
2060
|
+
*/
|
|
2061
|
+
//
|
|
2062
|
+
// interface QBError {
|
|
2063
|
+
// code?: number;
|
|
2064
|
+
// status?: string;
|
|
2065
|
+
// detail?: string | string[] | Dictionary<string | string[]>;
|
|
2066
|
+
// message: string | string[] | Dictionary<string | string[]>;
|
|
2067
|
+
// }
|
|
2068
|
+
//
|
|
2069
|
+
// interface QBUser {
|
|
2070
|
+
// id: number;
|
|
2071
|
+
// full_name: string;
|
|
2072
|
+
// email: string;
|
|
2073
|
+
// login: string;
|
|
2074
|
+
// phone: string;
|
|
2075
|
+
// website: string;
|
|
2076
|
+
// /** Date ISO string */
|
|
2077
|
+
// created_at: string;
|
|
2078
|
+
// /** Date ISO string */
|
|
2079
|
+
// updated_at: string;
|
|
2080
|
+
// /** Date ISO string */
|
|
2081
|
+
// last_request_at: string;
|
|
2082
|
+
// external_user_id: null;
|
|
2083
|
+
// facebook_id: string | null;
|
|
2084
|
+
// blob_id: number | string | null;
|
|
2085
|
+
// custom_data: string | null;
|
|
2086
|
+
// age_over16: boolean;
|
|
2087
|
+
// allow_statistics_analysis: boolean;
|
|
2088
|
+
// allow_sales_activities: boolean;
|
|
2089
|
+
// parents_contacts: string;
|
|
2090
|
+
// user_tags: string | null;
|
|
2091
|
+
// password?: string;
|
|
2092
|
+
// old_password?: string;
|
|
2093
|
+
// }
|
|
2094
|
+
//
|
|
2095
|
+
// type QBUserCustomData = Partial<{
|
|
2096
|
+
// full_name: string;
|
|
2097
|
+
// address: string;
|
|
2098
|
+
// birthdate: string;
|
|
2099
|
+
// description: string;
|
|
2100
|
+
// gender: string;
|
|
2101
|
+
// language: string;
|
|
2102
|
+
// avatar: {
|
|
2103
|
+
// id: number;
|
|
2104
|
+
// uid: string;
|
|
2105
|
+
// };
|
|
2106
|
+
// }>;
|
|
2107
|
+
//
|
|
2108
|
+
// interface QBUserWithCustomData extends Omit<QBUser, 'custom_data'> {
|
|
2109
|
+
// custom_data: QBUserCustomData;
|
|
2110
|
+
// }
|
|
2111
|
+
//
|
|
2112
|
+
// interface QBSession {
|
|
2113
|
+
// _id: string;
|
|
2114
|
+
// application_id: number;
|
|
2115
|
+
// /** Date ISO string */
|
|
2116
|
+
// created_at: string;
|
|
2117
|
+
// id: number;
|
|
2118
|
+
// nonce: number;
|
|
2119
|
+
// token: string;
|
|
2120
|
+
// ts: number;
|
|
2121
|
+
// /** Date ISO string */
|
|
2122
|
+
// updated_at: string;
|
|
2123
|
+
// user_id: QBUser['id'];
|
|
2124
|
+
// }
|
|
2125
|
+
//
|
|
2126
|
+
// type ChatConnectParams =
|
|
2127
|
+
// | {
|
|
2128
|
+
// userId: number;
|
|
2129
|
+
// /** user's password or session token */
|
|
2130
|
+
// password: string;
|
|
2131
|
+
// }
|
|
2132
|
+
// | {
|
|
2133
|
+
// jid: string;
|
|
2134
|
+
// /** user's password or session token */
|
|
2135
|
+
// password: string;
|
|
2136
|
+
// }
|
|
2137
|
+
// | {
|
|
2138
|
+
// email: string;
|
|
2139
|
+
// /** user's password or session token */
|
|
2140
|
+
// password: string;
|
|
2141
|
+
// };
|
|
2142
|
+
//
|
|
2143
|
+
// interface ChatMessageAttachment {
|
|
2144
|
+
// /** ID of the file on QuickBlox server (UID of file from QB.content.createAndUpload) */
|
|
2145
|
+
// id: string | number;
|
|
2146
|
+
// uid?: string;
|
|
2147
|
+
// /** Type of attachment. Example: audio, video, image or other */
|
|
2148
|
+
// type: string;
|
|
2149
|
+
// /** Link to a file in Internet */
|
|
2150
|
+
// url?: string;
|
|
2151
|
+
// name?: string;
|
|
2152
|
+
// size?: number;
|
|
2153
|
+
// [key: string]: unknown;
|
|
2154
|
+
// }
|
|
2155
|
+
//
|
|
2156
|
+
// enum QBChatDialogType {
|
|
2157
|
+
// PUBLIC = 1,
|
|
2158
|
+
// GROUP = 2,
|
|
2159
|
+
// PRIVATE = 3,
|
|
2160
|
+
// }
|
|
2161
|
+
//
|
|
2162
|
+
// interface QBChatDialog {
|
|
2163
|
+
// _id: string;
|
|
2164
|
+
// /** Date ISO string */
|
|
2165
|
+
// created_at: string;
|
|
2166
|
+
// data?: { [key: string]: string };
|
|
2167
|
+
// last_message: string | null;
|
|
2168
|
+
// /** Date ISO string */
|
|
2169
|
+
// last_message_date_sent: string | null;
|
|
2170
|
+
// last_message_id: string | null;
|
|
2171
|
+
// last_message_user_id: QBUser['id'] | null;
|
|
2172
|
+
// name: string;
|
|
2173
|
+
// occupants_ids: number[];
|
|
2174
|
+
// new_occupants_ids: number[];
|
|
2175
|
+
// photo: null | string;
|
|
2176
|
+
// type: typeof QBChatDialogType | number;
|
|
2177
|
+
// /** Date ISO string */
|
|
2178
|
+
// updated_at: string;
|
|
2179
|
+
// user_id: QBUser['id'];
|
|
2180
|
+
// xmpp_room_jid: string | null;
|
|
2181
|
+
// unread_messages_count: number | null;
|
|
2182
|
+
// joined?: boolean;
|
|
2183
|
+
// }
|
|
2184
|
+
//
|
|
2185
|
+
// interface QBChatNewMessage {
|
|
2186
|
+
// type: 'chat' | 'groupchat';
|
|
2187
|
+
// body: string;
|
|
2188
|
+
// notification_type?: string;
|
|
2189
|
+
// dialog_id?: QBChatDialog['_id'];
|
|
2190
|
+
// extension: {
|
|
2191
|
+
// attachments?: ChatMessageAttachment[];
|
|
2192
|
+
// save_to_history: 0 | 1;
|
|
2193
|
+
// dialog_id: QBChatDialog['_id'];
|
|
2194
|
+
// notification_type?: string;
|
|
2195
|
+
// sender_id?: QBUser['id'];
|
|
2196
|
+
// qb_message_action?: 'forward' | 'reply';
|
|
2197
|
+
// origin_sender_name?: string;
|
|
2198
|
+
// qb_original_messages?: string;
|
|
2199
|
+
// };
|
|
2200
|
+
// markable: 0 | 1;
|
|
2201
|
+
// }
|
|
2202
|
+
//
|
|
2203
|
+
// interface QBChatMessage {
|
|
2204
|
+
// _id: string;
|
|
2205
|
+
// attachments: ChatMessageAttachment[];
|
|
2206
|
+
// chat_dialog_id: QBChatDialog['_id'];
|
|
2207
|
+
// /** Date ISO string */
|
|
2208
|
+
// created_at: string;
|
|
2209
|
+
// /** Date timestamp */
|
|
2210
|
+
// date_sent: number;
|
|
2211
|
+
// delivered_ids?: Array<QBUser['id']>;
|
|
2212
|
+
// message: string;
|
|
2213
|
+
// read_ids?: Array<QBUser['id']>;
|
|
2214
|
+
// read: 0 | 1;
|
|
2215
|
+
// recipient_id: QBUser['id'] | null;
|
|
2216
|
+
// sender_id: QBUser['id'];
|
|
2217
|
+
// /** Date ISO string */
|
|
2218
|
+
// updated_at: string;
|
|
2219
|
+
// notification_type?: string;
|
|
2220
|
+
// qb_message_action?: 'forward' | 'reply';
|
|
2221
|
+
// origin_sender_name?: string;
|
|
2222
|
+
// qb_original_messages?: string;
|
|
2223
|
+
// }
|
|
2224
|
+
//
|
|
2225
|
+
// interface QBMessageStatusParams {
|
|
2226
|
+
// messageId: QBChatMessage['_id'];
|
|
2227
|
+
// dialogId: QBChatDialog['_id'];
|
|
2228
|
+
// userId: QBUser['id'];
|
|
2229
|
+
// }
|
|
2230
|
+
//
|
|
2231
|
+
// interface QBChatXMPPMessage {
|
|
2232
|
+
// id: string;
|
|
2233
|
+
// dialog_id: QBChatDialog['_id'];
|
|
2234
|
+
// recipient_id: null;
|
|
2235
|
+
// type: 'chat' | 'groupchat';
|
|
2236
|
+
// notification_type?: string;
|
|
2237
|
+
// body: string;
|
|
2238
|
+
// delay: null;
|
|
2239
|
+
// markable: 0 | 1;
|
|
2240
|
+
// extension: {
|
|
2241
|
+
// attachments?: ChatMessageAttachment[];
|
|
2242
|
+
// date_sent: string;
|
|
2243
|
+
// notification_type?: string;
|
|
2244
|
+
// save_to_history?: 0 | 1;
|
|
2245
|
+
// dialog_id?: QBChatDialog['_id'];
|
|
2246
|
+
// sender_id?: QBUser['id'];
|
|
2247
|
+
// };
|
|
2248
|
+
// }
|
|
2249
|
+
//
|
|
2250
|
+
|
|
2251
|
+
//
|
|
2252
|
+
// interface QBGetDialogResult {
|
|
2253
|
+
// items: QBChatDialog[];
|
|
2254
|
+
// limit: number;
|
|
2255
|
+
// skip: number;
|
|
2256
|
+
// total_entries: number;
|
|
2257
|
+
// }
|
|
2258
|
+
//
|
|
2259
|
+
// type GetMessagesResult = {
|
|
2260
|
+
// items: QBChatMessage[];
|
|
2261
|
+
// limit: number;
|
|
2262
|
+
// skip: number;
|
|
2263
|
+
// };
|
|
2264
|
+
//
|
|
2265
|
+
// interface QBChatModule {
|
|
2266
|
+
// dialog: {
|
|
2267
|
+
// create(
|
|
2268
|
+
// params: Dictionary<unknown>,
|
|
2269
|
+
// callback: (error?: QBError, result: QBChatDialog) => void,
|
|
2270
|
+
// ): void;
|
|
2271
|
+
// list(
|
|
2272
|
+
// params: Dictionary<unknown>,
|
|
2273
|
+
// callback: (error?: QBError, result: QBGetDialogResult) => void,
|
|
2274
|
+
// ): void;
|
|
2275
|
+
// update(
|
|
2276
|
+
// id: string,
|
|
2277
|
+
// data: Dictionary<unknown>,
|
|
2278
|
+
// callback: (error?: QBError, result: QBChatDialog) => void,
|
|
2279
|
+
// ): void;
|
|
2280
|
+
// delete(
|
|
2281
|
+
// dialogIds: Array<QBChatDialog['_id']>,
|
|
2282
|
+
// callback: (error?: QBError) => void,
|
|
2283
|
+
// ): void;
|
|
2284
|
+
// };
|
|
2285
|
+
// message: {
|
|
2286
|
+
// list(
|
|
2287
|
+
// params: Dictionary<unknown>,
|
|
2288
|
+
// callback: (error?: QBError, result: GetMessagesResult) => void,
|
|
2289
|
+
// ): void;
|
|
2290
|
+
// };
|
|
2291
|
+
// isConnected: boolean;
|
|
2292
|
+
// send<T extends QBChatNewMessage>(
|
|
2293
|
+
// jidOrUserId: QBUser['id'] | string,
|
|
2294
|
+
// message: T,
|
|
2295
|
+
// ): string;
|
|
2296
|
+
// sendSystemMessage(
|
|
2297
|
+
// jidOrUserId: QBUser['id'] | string,
|
|
2298
|
+
// message: { extension: QBSystemMessage['extension'] },
|
|
2299
|
+
// ): string;
|
|
2300
|
+
// sendDeliveredStatus(params: QBMessageStatusParams): void;
|
|
2301
|
+
// sendReadStatus(params: QBMessageStatusParams): void;
|
|
2302
|
+
// sendIsTypingStatus(jidOrUserId: QBUser['id'] | string): void;
|
|
2303
|
+
// sendIsStopTypingStatus(jidOrUserId: QBUser['id'] | string): void;
|
|
2304
|
+
// connect: (
|
|
2305
|
+
// params: ChatConnectParams,
|
|
2306
|
+
// callback: (error?: QBError, result: unknown) => void,
|
|
2307
|
+
// ) => void;
|
|
2308
|
+
// disconnect: () => void;
|
|
2309
|
+
// ping(jidOrUserId: string | number, callback: (error: unknown) => void): void;
|
|
2310
|
+
// ping(callback: (error?: QBError) => void): void;
|
|
2311
|
+
// muc: {
|
|
2312
|
+
// join(
|
|
2313
|
+
// dialogJid: string,
|
|
2314
|
+
// callback: (error?: QBError, result: unknown) => void,
|
|
2315
|
+
// ): void;
|
|
2316
|
+
// leave(
|
|
2317
|
+
// dialogJid: string,
|
|
2318
|
+
// callback: (error?: QBError, result: unknown) => void,
|
|
2319
|
+
// ): void;
|
|
2320
|
+
// };
|
|
2321
|
+
// helpers: {
|
|
2322
|
+
// getDialogJid(dialogId: QBChatDialog['_id']): string;
|
|
2323
|
+
// getUserCurrentJid(): string;
|
|
2324
|
+
// getUserJid(userId: QBUser['id'], appId?: string | number): string;
|
|
2325
|
+
// getRoomJidFromDialogId(dialogId: QBChatDialog['_id']): string;
|
|
2326
|
+
// getRecipientId(
|
|
2327
|
+
// occupantsIds: Array<QBUser['id']>,
|
|
2328
|
+
// userId: QBUser['id'],
|
|
2329
|
+
// ): number;
|
|
2330
|
+
// };
|
|
2331
|
+
// onMessageListener?: (
|
|
2332
|
+
// senderId: QBUser['id'],
|
|
2333
|
+
// message: QBChatXMPPMessage,
|
|
2334
|
+
// ) => void;
|
|
2335
|
+
// onMessageErrorListener?: (messageId: string, error: unknown) => void;
|
|
2336
|
+
// onMessageTypingListener?: (
|
|
2337
|
+
// isTyping: boolean,
|
|
2338
|
+
// userId: QBUser['id'],
|
|
2339
|
+
// dialogId: QBChatDialog['_id'],
|
|
2340
|
+
// ) => void;
|
|
2341
|
+
// onDeliveredStatusListener?: (
|
|
2342
|
+
// messageId: string,
|
|
2343
|
+
// dialogId: QBChatDialog['_id'],
|
|
2344
|
+
// userId: QBUser['id'],
|
|
2345
|
+
// ) => void;
|
|
2346
|
+
// onReadStatusListener?: (
|
|
2347
|
+
// messageId: string,
|
|
2348
|
+
// dialogId: QBChatDialog['_id'],
|
|
2349
|
+
// userId: QBUser['id'],
|
|
2350
|
+
// ) => void;
|
|
2351
|
+
// onSystemMessageListener?: (message: QBSystemMessage) => void;
|
|
2352
|
+
// onReconnectFailedListener?: (error: unknown) => void;
|
|
2353
|
+
// onDisconnectedListener?: VoidFunction;
|
|
2354
|
+
// onReconnectListener?: VoidFunction;
|
|
2355
|
+
// onSessionExpiredListener?: (error?: QBError) => void;
|
|
2356
|
+
// }
|
|
2357
|
+
// interface QBContentParam {
|
|
2358
|
+
// name: string;
|
|
2359
|
+
// file: any;
|
|
2360
|
+
// type: string;
|
|
2361
|
+
// size: number;
|
|
2362
|
+
// public: boolean; // optional, "false" by default
|
|
2363
|
+
// }
|
|
2364
|
+
//
|
|
2365
|
+
// interface QBContentObject {
|
|
2366
|
+
// account_id: number;
|
|
2367
|
+
// app_id: number;
|
|
2368
|
+
// content_type: string;
|
|
2369
|
+
// created_at: string;
|
|
2370
|
+
// id: number;
|
|
2371
|
+
// name: string;
|
|
2372
|
+
// public: boolean;
|
|
2373
|
+
// size: number;
|
|
2374
|
+
// uid: string;
|
|
2375
|
+
// updated_at: string;
|
|
2376
|
+
// }
|
|
2377
|
+
//
|
|
2378
|
+
// interface QBCustomObject {
|
|
2379
|
+
// /**
|
|
2380
|
+
// * ID of the record
|
|
2381
|
+
// * Generated automatically by the server after record creation
|
|
2382
|
+
// */
|
|
2383
|
+
// _id: string;
|
|
2384
|
+
// /** ID of the user who created the record */
|
|
2385
|
+
// user_id: QBUser['id'];
|
|
2386
|
+
// /** ID of parent object (Relations) */
|
|
2387
|
+
// _parent_id: string | null;
|
|
2388
|
+
// /** Date & time when a record was created, filled automatically */
|
|
2389
|
+
// created_at: number;
|
|
2390
|
+
// /** Date & time when record was updated, filled automatically */
|
|
2391
|
+
// updated_at: number;
|
|
2392
|
+
// }
|
|
2393
|
+
//
|
|
2394
|
+
// interface QBAppointment extends QBCustomObject {
|
|
2395
|
+
// priority: number;
|
|
2396
|
+
// client_id: QBUser['id'];
|
|
2397
|
+
// provider_id: QBUser['id'];
|
|
2398
|
+
// dialog_id: QBChatDialog['_id'];
|
|
2399
|
+
// description: string;
|
|
2400
|
+
// notes: string;
|
|
2401
|
+
// conclusion?: string;
|
|
2402
|
+
// date_start?: string;
|
|
2403
|
+
// date_end?: string;
|
|
2404
|
+
// language?: string;
|
|
2405
|
+
// records?: Array<QBContentObject['id']>;
|
|
2406
|
+
// }
|
|
2407
|
+
//
|
|
2408
|
+
// interface QBSchedule extends QBCustomObject {
|
|
2409
|
+
// provider_id: QBUser['id'];
|
|
2410
|
+
// duration: number;
|
|
2411
|
+
// timezone: string;
|
|
2412
|
+
// holidays: string[] | null;
|
|
2413
|
+
// sunday: string[] | null;
|
|
2414
|
+
// monday: string[] | null;
|
|
2415
|
+
// tuesday: string[] | null;
|
|
2416
|
+
// wednesday: string[] | null;
|
|
2417
|
+
// thursday: string[] | null;
|
|
2418
|
+
// friday: string[] | null;
|
|
2419
|
+
// saturday: string[] | null;
|
|
2420
|
+
// }
|
|
2421
|
+
//
|
|
2422
|
+
// interface QBCalendarEvent extends QBCustomObject {
|
|
2423
|
+
// date: string;
|
|
2424
|
+
// duration: number;
|
|
2425
|
+
// provider_id: QBUser['id'];
|
|
2426
|
+
// client_id: QBUser['id'];
|
|
2427
|
+
// appointment_id: QBAppointment['_id'];
|
|
2428
|
+
// }
|
|
2429
|
+
//
|
|
2430
|
+
// type CreateAndUploadParams = {
|
|
2431
|
+
// file: File;
|
|
2432
|
+
// name: File['name'];
|
|
2433
|
+
// type: File['type'];
|
|
2434
|
+
// size: File['size'];
|
|
2435
|
+
// public?: boolean;
|
|
2436
|
+
// };
|
|
2437
|
+
//
|
|
2438
|
+
// interface QBContentModule {
|
|
2439
|
+
// privateUrl(fileUID: string): string;
|
|
2440
|
+
// publicUrl(fileUID: string): string;
|
|
2441
|
+
// getInfo(
|
|
2442
|
+
// id: number,
|
|
2443
|
+
// callback: (error?: QBError, file: { blob: QBContentObject }) => void,
|
|
2444
|
+
// );
|
|
2445
|
+
// delete(id: number, callback: (error?: QBError, file: unknown) => void);
|
|
2446
|
+
// createAndUpload(
|
|
2447
|
+
// param: QBContentParam,
|
|
2448
|
+
// callback: (error?: QBError, file: { blob: QBContentObject }) => void,
|
|
2449
|
+
// );
|
|
2450
|
+
// }
|
|
2451
|
+
//
|
|
2452
|
+
// interface QBDataDeletedResponse {
|
|
2453
|
+
// deleted: Array<QBCustomObject['_id']>;
|
|
2454
|
+
// deletedCount: number;
|
|
2455
|
+
// }
|
|
2456
|
+
//
|
|
2457
|
+
// interface QBDataModule {
|
|
2458
|
+
// create<T extends QBCustomObject>(
|
|
2459
|
+
// className: string,
|
|
2460
|
+
// data: Dictionary<unknown>,
|
|
2461
|
+
// callback: (error?: QBError, customObject: T) => void,
|
|
2462
|
+
// ): void;
|
|
2463
|
+
// delete<T extends QBCustomObject['_id'] | Array<QBCustomObject['_id']>>(
|
|
2464
|
+
// className: string,
|
|
2465
|
+
// ids: T,
|
|
2466
|
+
// callback: (error?: QBError, res: QBDataDeletedResponse) => void,
|
|
2467
|
+
// ): void;
|
|
2468
|
+
// list<T extends QBCustomObject>(
|
|
2469
|
+
// className: string,
|
|
2470
|
+
// filters: Dictionary<unknown>,
|
|
2471
|
+
// callback: (
|
|
2472
|
+
// error?: QBError,
|
|
2473
|
+
// result: {
|
|
2474
|
+
// class_name: string;
|
|
2475
|
+
// items: T[];
|
|
2476
|
+
// limit: number;
|
|
2477
|
+
// skip: number;
|
|
2478
|
+
// },
|
|
2479
|
+
// ) => void,
|
|
2480
|
+
// ): void;
|
|
2481
|
+
// update<
|
|
2482
|
+
// D extends { _id: string } & Dictionary<unknown>,
|
|
2483
|
+
// T extends QBCustomObject,
|
|
2484
|
+
// >(
|
|
2485
|
+
// className: string,
|
|
2486
|
+
// data: D,
|
|
2487
|
+
// callback: (error?: QBError, result: T) => void,
|
|
2488
|
+
// ): void;
|
|
2489
|
+
// }
|
|
2490
|
+
//
|
|
2491
|
+
// interface QBCreateUserWithLogin {
|
|
2492
|
+
// login: string;
|
|
2493
|
+
// password: string;
|
|
2494
|
+
// blob_id?: number;
|
|
2495
|
+
// custom_data?: string;
|
|
2496
|
+
// email?: string;
|
|
2497
|
+
// external_user_id?: string | number;
|
|
2498
|
+
// facebook_id?: string;
|
|
2499
|
+
// full_name?: string;
|
|
2500
|
+
// phone?: string;
|
|
2501
|
+
// tag_list?: string | string[];
|
|
2502
|
+
// twitter_id?: string;
|
|
2503
|
+
// website?: string;
|
|
2504
|
+
// }
|
|
2505
|
+
//
|
|
2506
|
+
// interface QBCreateUserWithEmail {
|
|
2507
|
+
// email: string;
|
|
2508
|
+
// password: string;
|
|
2509
|
+
// blob_id?: number;
|
|
2510
|
+
// custom_data?: string;
|
|
2511
|
+
// external_user_id?: string | number;
|
|
2512
|
+
// facebook_id?: string;
|
|
2513
|
+
// full_name?: string;
|
|
2514
|
+
// login?: string;
|
|
2515
|
+
// phone?: string;
|
|
2516
|
+
// tag_list?: string | string[];
|
|
2517
|
+
// twitter_id?: string;
|
|
2518
|
+
// website?: string;
|
|
2519
|
+
// }
|
|
2520
|
+
//
|
|
2521
|
+
// type QBCreateUserParams = QBCreateUserWithLogin | QBCreateUserWithEmail;
|
|
2522
|
+
//
|
|
2523
|
+
// type GetUserParam =
|
|
2524
|
+
// | { login: string }
|
|
2525
|
+
// | { full_name: string }
|
|
2526
|
+
// | { facebook_id: string }
|
|
2527
|
+
// | { twitter_id: string }
|
|
2528
|
+
// | { phone: string }
|
|
2529
|
+
// | { email: string }
|
|
2530
|
+
// | { tags: string }
|
|
2531
|
+
// | { external: string };
|
|
2532
|
+
//
|
|
2533
|
+
// type GetUserParams =
|
|
2534
|
+
// | GetUserParam
|
|
2535
|
+
// | {
|
|
2536
|
+
// page?: number;
|
|
2537
|
+
// per_page?: number;
|
|
2538
|
+
// };
|
|
2539
|
+
//
|
|
2540
|
+
// type ListUserParams = {
|
|
2541
|
+
// page?: number;
|
|
2542
|
+
// per_page?: number;
|
|
2543
|
+
// filter?: Dictionary<unknown>;
|
|
2544
|
+
// order?: string;
|
|
2545
|
+
// };
|
|
2546
|
+
//
|
|
2547
|
+
// interface ListUserResponse {
|
|
2548
|
+
// current_page: number;
|
|
2549
|
+
// per_page: number;
|
|
2550
|
+
// total_entries: number;
|
|
2551
|
+
// items: Array<{ user: QBUser }>;
|
|
2552
|
+
// }
|
|
2553
|
+
//
|
|
2554
|
+
// interface QBUsersModule {
|
|
2555
|
+
// get(
|
|
2556
|
+
// params: number,
|
|
2557
|
+
// callback: (error?: QBError, response?: QBUser) => void,
|
|
2558
|
+
// ): void;
|
|
2559
|
+
// get(
|
|
2560
|
+
// params: GetUserParams,
|
|
2561
|
+
// callback: (error?: QBError, response: ListUserResponse) => void,
|
|
2562
|
+
// ): void;
|
|
2563
|
+
// listUsers(
|
|
2564
|
+
// params: ListUserParams,
|
|
2565
|
+
// callback: (error?: QBError, response: ListUserResponse) => void,
|
|
2566
|
+
// ): void;
|
|
2567
|
+
// create(
|
|
2568
|
+
// params: QBCreateUserParams,
|
|
2569
|
+
// callback: (error?: QBError, user: QBUser) => void,
|
|
2570
|
+
// ): void;
|
|
2571
|
+
// update(
|
|
2572
|
+
// userId: number,
|
|
2573
|
+
// user: Partial<QBUser>,
|
|
2574
|
+
// callback: (error?: QBError, user: QBUser) => void,
|
|
2575
|
+
// ): void;
|
|
2576
|
+
// }
|
|
2577
|
+
//
|
|
2578
|
+
// interface QBGetUserMediaParams {
|
|
2579
|
+
// audio: MediaStreamConstraints['audio'];
|
|
2580
|
+
// video: MediaStreamConstraints['video'];
|
|
2581
|
+
// /** id attribute of HTMLVideoElement */
|
|
2582
|
+
// elemId?: string;
|
|
2583
|
+
// options?: {
|
|
2584
|
+
// muted?: boolean;
|
|
2585
|
+
// mirror?: boolean;
|
|
2586
|
+
// };
|
|
2587
|
+
// }
|
|
2588
|
+
//
|
|
2589
|
+
// interface QBWebRTCSession {
|
|
2590
|
+
// State: {
|
|
2591
|
+
// NEW: 1;
|
|
2592
|
+
// ACTIVE: 2;
|
|
2593
|
+
// HUNGUP: 3;
|
|
2594
|
+
// REJECTED: 4;
|
|
2595
|
+
// CLOSED: 5;
|
|
2596
|
+
// };
|
|
2597
|
+
// ID: string;
|
|
2598
|
+
// /**
|
|
2599
|
+
// * One of {@link QBWebRTCSession#State}
|
|
2600
|
+
// */
|
|
2601
|
+
// state: number;
|
|
2602
|
+
// initiatorID: number;
|
|
2603
|
+
// opponentsIDs: number[];
|
|
2604
|
+
// peerConnections: { [userId: number]: RTCPeerConnection };
|
|
2605
|
+
// callType: 1 | 2;
|
|
2606
|
+
// startCallTime?: Date;
|
|
2607
|
+
// localStream?: MediaStream;
|
|
2608
|
+
// mediaParams: QBGetUserMediaParams | null;
|
|
2609
|
+
// getUserMedia(
|
|
2610
|
+
// params: QBGetUserMediaParams,
|
|
2611
|
+
// callback: (error?: QBError, stream?: MediaStream) => void,
|
|
2612
|
+
// ): void;
|
|
2613
|
+
// /** Attach media stream to audio/video element */
|
|
2614
|
+
// attachMediaStream(
|
|
2615
|
+
// videoElemId: string,
|
|
2616
|
+
// stream: MediaStream,
|
|
2617
|
+
// options?: QBGetUserMediaParams['options'],
|
|
2618
|
+
// ): void;
|
|
2619
|
+
// /** Detach media stream from audio/video element */
|
|
2620
|
+
// detachMediaStream(videoElemId: string): void;
|
|
2621
|
+
// mute(type: 'audio' | 'video'): void;
|
|
2622
|
+
// unmute(type: 'audio' | 'video'): void;
|
|
2623
|
+
// /** Innitiate a call */
|
|
2624
|
+
// call(params: Dictionary<unknown>): void;
|
|
2625
|
+
// /** Accept call */
|
|
2626
|
+
// accept(params: Dictionary<unknown>): void;
|
|
2627
|
+
// /** Reject call */
|
|
2628
|
+
// reject(params: Dictionary<unknown>): void;
|
|
2629
|
+
// /** Stop call (Hang up) */
|
|
2630
|
+
// stop(params: Dictionary<unknown>): void;
|
|
2631
|
+
// switchMediaTracks(
|
|
2632
|
+
// deviceIds: { audio?: { exact: string }; video?: { exact: string } },
|
|
2633
|
+
// callback: (error?: QBError, stream?: MediaStream) => void,
|
|
2634
|
+
// ): void;
|
|
2635
|
+
// /** Add tracks from provided stream to local stream (and replace in peers) */
|
|
2636
|
+
// _replaceTracks(stream: MediaStream): void;
|
|
2637
|
+
// }
|
|
2638
|
+
//
|
|
2639
|
+
// interface QBWebRTCModule {
|
|
2640
|
+
// CallType: {
|
|
2641
|
+
// VIDEO: 1;
|
|
2642
|
+
// AUDIO: 2;
|
|
2643
|
+
// };
|
|
2644
|
+
// getMediaDevices(kind?: MediaDeviceKind): Promise<MediaDeviceInfo[]>;
|
|
2645
|
+
// createNewSession(opponentsIds: number[], callType: 1 | 2): QBWebRTCSession;
|
|
2646
|
+
// onAcceptCallListener?: (
|
|
2647
|
+
// session: QBWebRTCSession,
|
|
2648
|
+
// userId: number,
|
|
2649
|
+
// userInfo: Dictionary<unknown>,
|
|
2650
|
+
// ) => void;
|
|
2651
|
+
// onCallListener?: (
|
|
2652
|
+
// session: QBWebRTCSession,
|
|
2653
|
+
// userInfo: Dictionary<unknown>,
|
|
2654
|
+
// ) => void;
|
|
2655
|
+
// onCallStatsReport?: (
|
|
2656
|
+
// session: QBWebRTCSession,
|
|
2657
|
+
// userId: number,
|
|
2658
|
+
// stats: string[],
|
|
2659
|
+
// ) => void;
|
|
2660
|
+
// onRejectCallListener?: (
|
|
2661
|
+
// session: QBWebRTCSession,
|
|
2662
|
+
// userId: number,
|
|
2663
|
+
// userInfo: Dictionary<unknown>,
|
|
2664
|
+
// ) => void;
|
|
2665
|
+
// onRemoteStreamListener?: (
|
|
2666
|
+
// sesion: QBWebRTCSession,
|
|
2667
|
+
// userId: number,
|
|
2668
|
+
// stream: MediaStream,
|
|
2669
|
+
// ) => void;
|
|
2670
|
+
// onSessionCloseListener?: (session: QBWebRTCSession) => void;
|
|
2671
|
+
// onSessionConnectionStateChangedListener?: (
|
|
2672
|
+
// sesion: QBWebRTCSession,
|
|
2673
|
+
// userId: number,
|
|
2674
|
+
// state: unknown,
|
|
2675
|
+
// ) => void;
|
|
2676
|
+
// onStopCallListener?: (
|
|
2677
|
+
// session: QBWebRTCSession,
|
|
2678
|
+
// userId: number,
|
|
2679
|
+
// userInfo: Dictionary<unknown>,
|
|
2680
|
+
// ) => void;
|
|
2681
|
+
// onUpdateCallListener?: (
|
|
2682
|
+
// session: QBWebRTCSession,
|
|
2683
|
+
// userId: number,
|
|
2684
|
+
// userInfo: Dictionary<unknown>,
|
|
2685
|
+
// ) => void;
|
|
2686
|
+
// onUserNotAnswerListener?: (session: QBWebRTCSession, userId: number) => void;
|
|
2687
|
+
// }
|
|
2688
|
+
//
|
|
2689
|
+
// type QBLoginParams =
|
|
2690
|
+
// | {
|
|
2691
|
+
// login: string;
|
|
2692
|
+
// password: string;
|
|
2693
|
+
// }
|
|
2694
|
+
// | {
|
|
2695
|
+
// email: string;
|
|
2696
|
+
// password: string;
|
|
2697
|
+
// }
|
|
2698
|
+
// | {
|
|
2699
|
+
// provider: 'firebase_phone';
|
|
2700
|
+
// firebase_phone: { access_token: string; project_id: string };
|
|
2701
|
+
// };
|
|
2702
|
+
//
|
|
2703
|
+
// interface Quickblox {
|
|
2704
|
+
// auth: {
|
|
2705
|
+
// createSession: VoidFunction;
|
|
2706
|
+
// };
|
|
2707
|
+
// buildNumber: string;
|
|
2708
|
+
// chat: QBChatModule;
|
|
2709
|
+
// content: QBContentModule;
|
|
2710
|
+
// createSession(
|
|
2711
|
+
// params?: QBLoginParams,
|
|
2712
|
+
// callback: (error?: QBError, session: QBSession) => void,
|
|
2713
|
+
// ): void;
|
|
2714
|
+
// data: QBDataModule;
|
|
2715
|
+
// destroySession(callback: (error?: QBError, res: unknown) => void): void;
|
|
2716
|
+
// getSession(
|
|
2717
|
+
// callback: (error?: QBError, response?: { session: QBSession }) => void,
|
|
2718
|
+
// ): void;
|
|
2719
|
+
// init(
|
|
2720
|
+
// appIdOrToken: string | number,
|
|
2721
|
+
// authKeyOrAppId: string | number,
|
|
2722
|
+
// authSecret?: string,
|
|
2723
|
+
// accountKey: string,
|
|
2724
|
+
// config?: QBConfig,
|
|
2725
|
+
// ): void;
|
|
2726
|
+
// login(
|
|
2727
|
+
// params: QBLoginParams,
|
|
2728
|
+
// callback: (error: unknown, user: QBUser) => void,
|
|
2729
|
+
// ): void;
|
|
2730
|
+
// logout(callback: (error: unknown, res: unknown) => void): void;
|
|
2731
|
+
// service: {
|
|
2732
|
+
// qbInst: {
|
|
2733
|
+
// config: {
|
|
2734
|
+
// webrtc: {
|
|
2735
|
+
// answerTimeInterval: number;
|
|
2736
|
+
// };
|
|
2737
|
+
// endpoints: {
|
|
2738
|
+
// api: string;
|
|
2739
|
+
// };
|
|
2740
|
+
// urls: {
|
|
2741
|
+
// blobs: string;
|
|
2742
|
+
// type: string;
|
|
2743
|
+
// data: string;
|
|
2744
|
+
// };
|
|
2745
|
+
// };
|
|
2746
|
+
// };
|
|
2747
|
+
// };
|
|
2748
|
+
// users: QBUsersModule;
|
|
2749
|
+
// webrtc: QBWebRTCModule;
|
|
2750
|
+
// version: string;
|
|
2751
|
+
// }
|
|
2752
|
+
//
|
|
2753
|
+
// interface QuickbloxConstructor {
|
|
2754
|
+
// prototype: Quickblox;
|
|
2755
|
+
// new (): Quickblox;
|
|
2756
|
+
// }
|
|
2757
|
+
//
|
|
2758
|
+
// interface QB extends Quickblox {
|
|
2759
|
+
// QuickBlox: QuickbloxConstructor;
|
|
2760
|
+
// }
|
|
2761
|
+
//
|
|
2762
|
+
// declare const QB: QB;
|
|
2763
|
+
//
|
|
2764
|
+
// interface QBMediaRecorderConstructorProps {
|
|
2765
|
+
// /** Preferred MIME type */
|
|
2766
|
+
// mimeType?: string;
|
|
2767
|
+
// workerPath?: string;
|
|
2768
|
+
// /**
|
|
2769
|
+
// * The minimum number of milliseconds of data to return
|
|
2770
|
+
// * in a single Blob, fire 'ondataavaible' callback
|
|
2771
|
+
// * (isn't need to use with 'audio/wav' of 'audio/mp3')
|
|
2772
|
+
// *
|
|
2773
|
+
// * @default 1000
|
|
2774
|
+
// */
|
|
2775
|
+
// timeslice?: number;
|
|
2776
|
+
// /**
|
|
2777
|
+
// * What to do with a muted input MediaStreamTrack,
|
|
2778
|
+
// * e.g. insert black frames/zero audio volume in the recording
|
|
2779
|
+
// * or ignore altogether
|
|
2780
|
+
// *
|
|
2781
|
+
// * @default true
|
|
2782
|
+
// */
|
|
2783
|
+
// ignoreMutedMedia?: boolean;
|
|
2784
|
+
// /** Recording start event handler */
|
|
2785
|
+
// onstart?: VoidFunction;
|
|
2786
|
+
// /** Recording stop event handler */
|
|
2787
|
+
// onstop?: (file: Blob) => void;
|
|
2788
|
+
// /** Recording pause event handler */
|
|
2789
|
+
// onpause?: VoidFunction;
|
|
2790
|
+
// /** Recording resume event handler */
|
|
2791
|
+
// onresume?: VoidFunction;
|
|
2792
|
+
// /** Error event handler */
|
|
2793
|
+
// onerror?: (error: unknown) => void;
|
|
2794
|
+
// /**
|
|
2795
|
+
// * `dataavailable` event handler.
|
|
2796
|
+
// * The Blob of recorded data is contained in this event (callback
|
|
2797
|
+
// * isn't supported if use 'audio/wav' of 'audio/mp3' for recording)
|
|
2798
|
+
// */
|
|
2799
|
+
// ondataavailable?: (event: { data: Blob }) => void;
|
|
2800
|
+
// }
|
|
2801
|
+
//
|
|
2802
|
+
// interface QBMediaRecorder {
|
|
2803
|
+
// /**
|
|
2804
|
+
// * Switch recording Blob objects to the specified
|
|
2805
|
+
// * MIME type if `MediaRecorder` support it.
|
|
2806
|
+
// */
|
|
2807
|
+
// toggleMimeType(mimeType: string): void;
|
|
2808
|
+
// /**
|
|
2809
|
+
// * Returns current `MediaRecorder` state
|
|
2810
|
+
// */
|
|
2811
|
+
// getState(): 'inactive' | 'recording' | 'paused';
|
|
2812
|
+
// /**
|
|
2813
|
+
// * Starts recording a stream.
|
|
2814
|
+
// * Fires `onstart` callback.
|
|
2815
|
+
// */
|
|
2816
|
+
// start(stream: MediaStream): void;
|
|
2817
|
+
// /**
|
|
2818
|
+
// * Stops recording a stream
|
|
2819
|
+
// *
|
|
2820
|
+
// * @fires `onstop` callback and passing there Blob recorded
|
|
2821
|
+
// */
|
|
2822
|
+
// stop(): void;
|
|
2823
|
+
// /** Pausing stream recording */
|
|
2824
|
+
// pause(): void;
|
|
2825
|
+
// /** Resumes stream recording */
|
|
2826
|
+
// resume(): void;
|
|
2827
|
+
// /**
|
|
2828
|
+
// * Change record source
|
|
2829
|
+
// */
|
|
2830
|
+
// change(stream: MediaStream): void;
|
|
2831
|
+
// /**
|
|
2832
|
+
// * Create a file from blob and download as file.
|
|
2833
|
+
// * This method will call `stop` if recording is in progress.
|
|
2834
|
+
// *
|
|
2835
|
+
// * @param {string} filename Name of video file to be downloaded
|
|
2836
|
+
// * (default to `Date.now()`)
|
|
2837
|
+
// */
|
|
2838
|
+
// download(filename?: string): void;
|
|
2839
|
+
// _getBlobRecorded(): Blob;
|
|
2840
|
+
// callbacks: Pick<
|
|
2841
|
+
// QBMediaRecorderConstructorProps,
|
|
2842
|
+
// | 'onstart'
|
|
2843
|
+
// | 'onstop'
|
|
2844
|
+
// | 'onpause'
|
|
2845
|
+
// | 'onresume'
|
|
2846
|
+
// | 'ondataavailable'
|
|
2847
|
+
// | 'onerror'
|
|
2848
|
+
// >;
|
|
2849
|
+
// }
|
|
2850
|
+
//
|
|
2851
|
+
// declare const QBMediaRecorder: {
|
|
2852
|
+
// /**
|
|
2853
|
+
// * Checks capability of recording in the environment.
|
|
2854
|
+
// * Checks `MediaRecorder`, `MediaRecorder.isTypeSupported` and `Blob`.
|
|
2855
|
+
// */
|
|
2856
|
+
// isAvailable(): boolean;
|
|
2857
|
+
// /**
|
|
2858
|
+
// * Checks if AudioContext API is available.
|
|
2859
|
+
// * Checks `window.AudioContext` or `window.webkitAudioContext`.
|
|
2860
|
+
// */
|
|
2861
|
+
// isAudioContext(): boolean;
|
|
2862
|
+
// /**
|
|
2863
|
+
// * The `QBMediaRecorder.isTypeSupported()` static method returns
|
|
2864
|
+
// * a Boolean which is true if the MIME type specified is one
|
|
2865
|
+
// * the user agent should be able to successfully record.
|
|
2866
|
+
// * @param mimeType The MIME media type to check.
|
|
2867
|
+
// *
|
|
2868
|
+
// * @returns true if the `MediaRecorder` implementation is capable of
|
|
2869
|
+
// * recording `Blob` objects for the specified MIME type. Recording may
|
|
2870
|
+
// * still fail if there are insufficient resources to support the
|
|
2871
|
+
// * recording and encoding process. If the value is false, the user
|
|
2872
|
+
// * agent is incapable of recording the specified format.
|
|
2873
|
+
// */
|
|
2874
|
+
// isTypeSupported(mimeType: string): boolean;
|
|
2875
|
+
// /**
|
|
2876
|
+
// * Return supported mime types
|
|
2877
|
+
// * @param type video or audio (dafault to 'video')
|
|
2878
|
+
// */
|
|
2879
|
+
// getSupportedMimeTypes(type: 'audio' | 'video' = 'video'): string[];
|
|
2880
|
+
// new (config: QBMediaRecorderConstructorProps): QBMediaRecorder;
|
|
2881
|
+
// };
|