quickblox-react-ui-kit 0.3.0 → 0.3.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CommonTypes/CommonTypes.d.ts +142 -0
- package/dist/CommonTypes/FunctionResult.d.ts +0 -54
- package/dist/Data/DefaultConfigurations.d.ts +2 -2
- package/dist/Data/Stubs.d.ts +6 -5
- package/dist/Data/dto/dialog/LocalDialogDTO.d.ts +1 -1
- package/dist/Data/dto/dialog/RemoteDialogDTO.d.ts +2 -2
- package/dist/Data/dto/user/LocalUserDTO.d.ts +1 -1
- package/dist/Data/dto/user/RemoteUserDTO.d.ts +1 -1
- package/dist/Data/source/remote/Mapper/MessageDTOMapper.d.ts +1 -0
- package/dist/Data/source/remote/RemoteDataSource.d.ts +1 -1
- package/dist/Domain/entity/LastMessageEntity.d.ts +1 -1
- package/dist/Domain/entity/UserEntity.d.ts +1 -1
- package/dist/Presentation/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.d.ts +3 -1
- package/dist/Presentation/ui-components/TextField/TextField.d.ts +2 -2
- package/dist/QBconfig.d.ts +2 -76
- package/dist/index-ui.js +767 -787
- package/dist/index-ui.js.map +1 -1
- package/dist/qb-api-calls/index.d.ts +14 -12
- package/dist/utils/formatFileSize.d.ts +1 -0
- package/dist/utils/parse.d.ts +1 -0
- package/global.d.ts +158 -2835
- package/package.json +3 -1
- package/src/App.tsx +3 -2
- package/src/CommonTypes/CommonTypes.ts +229 -0
- package/src/CommonTypes/FunctionResult.ts +0 -59
- package/src/Data/Creator.ts +1 -0
- package/src/Data/DefaultConfigurations.ts +6 -2
- package/src/Data/Stubs.ts +47 -47
- package/src/Data/dto/dialog/LocalDialogDTO.ts +2 -2
- package/src/Data/dto/dialog/RemoteDialogDTO.ts +4 -4
- package/src/Data/dto/user/LocalUserDTO.ts +2 -2
- package/src/Data/dto/user/RemoteUserDTO.ts +2 -2
- package/src/Data/mapper/DialogLocalDTOMapper.ts +4 -10
- package/src/Data/mapper/DialogRemoteDTOMapper.ts +11 -22
- package/src/Data/mapper/UserLocalDTOMapper.ts +2 -2
- package/src/Data/mapper/UserRemoteDTOMapper.ts +2 -2
- package/src/Data/repository/ConnectionRepository.ts +1 -0
- package/src/Data/repository/UsersRepository.ts +1 -1
- package/src/Data/source/local/ChatLocalStorageDataSource.ts +14 -14
- package/src/Data/source/remote/Mapper/DialogDTOMapper.ts +70 -52
- package/src/Data/source/remote/Mapper/FileDTOMapper.ts +4 -0
- package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +1 -0
- package/src/Data/source/remote/Mapper/UserDTOMapper.ts +1 -0
- package/src/Data/source/remote/RemoteDataSource.ts +76 -12
- package/src/Domain/entity/LastMessageEntity.ts +1 -1
- package/src/Domain/entity/UserEntity.ts +1 -1
- package/src/Presentation/Views/Dialog/MessageItem/MessageItem.tsx +2 -2
- package/src/Presentation/Views/Dialog/useDialogViewModel.ts +44 -150
- package/src/Presentation/Views/DialogInfo/DialogInfo.tsx +2 -1
- package/src/Presentation/Views/DialogList/DialogList.tsx +65 -2
- package/src/Presentation/Views/DialogList/useDialogListViewModel.ts +3 -0
- package/src/Presentation/Views/EditDialog/EditDialog.tsx +4 -3
- package/src/Presentation/Views/InviteMembers/InviteMembers.tsx +9 -1
- package/src/Presentation/Views/InviteMembers/useInviteMembersViewModel.ts +11 -1
- package/src/Presentation/Views/PreviewDialog/PreviewDialog.tsx +1 -0
- package/src/Presentation/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +9 -41
- package/src/Presentation/layouts/TestStage/LoginView/Login.tsx +7 -11
- package/src/Presentation/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider.tsx +30 -2
- package/src/Presentation/ui-components/SettingsItem/SettingsItem.stories.tsx +1 -0
- package/src/Presentation/ui-components/TextField/TextField.tsx +58 -48
- package/src/QBconfig.ts +13 -11
- package/src/qb-api-calls/index.ts +44 -14
- package/src/utils/formatFileSize.ts +8 -0
- package/src/utils/parse.ts +2 -0
- package/storybook-static/703.2cbec951.iframe.bundle.js +33 -0
- package/storybook-static/703.2cbec951.iframe.bundle.js.map +1 -0
- package/storybook-static/{758.53b4954a.iframe.bundle.js → 938.56e9d83c.iframe.bundle.js} +1 -14
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.1b74ae55.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.1b74ae55.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Button-Button-stories.84103f20.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Button-Button-stories.84103f20.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bf9005d3.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.bf9005d3.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.f81a8e38.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.f81a8e38.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.141a3ae7.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.141a3ae7.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Header-Header-stories.9f45c30e.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Header-Header-stories.9f45c30e.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.af01e15d.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.af01e15d.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-Message-Message-stories.264d251d.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-Message-Message-stories.264d251d.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.bf8a24d1.iframe.bundle.js +1 -0
- package/storybook-static/{Presentation-ui-components-Placeholder-Placeholder-stories.871f508c.iframe.bundle.js → Presentation-ui-components-Placeholder-Placeholder-stories.97287936.iframe.bundle.js} +14 -1
- package/storybook-static/Presentation-ui-components-Placeholder-Placeholder-stories.97287936.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.a9f5cd67.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.a9f5cd67.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.429a72d5.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.429a72d5.iframe.bundle.js.map +1 -0
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.fd8caf6c.iframe.bundle.js +14 -0
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.fd8caf6c.iframe.bundle.js.map +1 -0
- package/storybook-static/{Presentation-ui-components-Toast-Toast-stories.55e63162.iframe.bundle.js → Presentation-ui-components-Toast-Toast-stories.b903385b.iframe.bundle.js} +14 -1
- package/storybook-static/Presentation-ui-components-Toast-Toast-stories.b903385b.iframe.bundle.js.map +1 -0
- package/storybook-static/{Presentation-ui-components-UserListItem-UserListItem-stories.04d3eefe.iframe.bundle.js → Presentation-ui-components-UserListItem-UserListItem-stories.8781472b.iframe.bundle.js} +14 -1
- package/storybook-static/Presentation-ui-components-UserListItem-UserListItem-stories.8781472b.iframe.bundle.js.map +1 -0
- package/storybook-static/iframe.html +2 -2
- package/storybook-static/{main.597d432b.iframe.bundle.js → main.2f6d7582.iframe.bundle.js} +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/runtime~main.af13ca55.iframe.bundle.js +1 -0
- package/webpack.config.js +2 -1
- package/storybook-static/758.53b4954a.iframe.bundle.js.map +0 -1
- package/storybook-static/Presentation-ui-components-Avatar-avatar-stories.cf806856.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Button-Button-stories.4fac7996.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-DialogItemPreview-DialogItemPreview-stories.6665bbfb.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-DialogWindow-DialogWindow-stories.cf340397.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Dropdown-Dropdown-stories.b32a1e17.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Header-Header-stories.073c4507.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Loader-Loader-stories.9bf3fb63.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-Message-Message-stories.343dfae0.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-MessageInput-MessageInput-stories.c2ead6a5.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-PreviewFileMessage-PreviewFileMessage-stories.527e000e.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-SettingsItem-SettingsItem-stories.2ff75703.iframe.bundle.js +0 -1
- package/storybook-static/Presentation-ui-components-TextField-TextField-stories.4a2eef3e.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.7ee2126e.iframe.bundle.js +0 -1
package/global.d.ts
CHANGED
|
@@ -1,77 +1,75 @@
|
|
|
1
|
-
interface Tone {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// type
|
|
8
|
-
|
|
9
|
-
type Primitive = string | number | boolean | undefined | null | Date | File;
|
|
10
|
-
|
|
11
|
-
type SetTails<T, R extends Primitive> = T extends Array<unknown>
|
|
12
|
-
? Array<T[number] extends Primitive ? R : SetTails<T[number], R>>
|
|
13
|
-
: {
|
|
14
|
-
[K in keyof T]: T[K] extends Primitive ? R : SetTails<T[K], R>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type ProxyConfig = {
|
|
18
|
-
api: string;
|
|
19
|
-
servername: string;
|
|
20
|
-
port: string;
|
|
21
|
-
};
|
|
22
|
-
interface WidgetConfig {
|
|
23
|
-
apiKey: string;
|
|
24
|
-
useDefault: boolean;
|
|
25
|
-
maxTokens: number;
|
|
26
|
-
proxyConfig: ProxyConfig;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface AITranslateWidgetConfig extends WidgetConfig {
|
|
30
|
-
defaultLanguage: string;
|
|
31
|
-
languages: string[];
|
|
32
|
-
}
|
|
1
|
+
// interface Tone {
|
|
2
|
+
// name: string;
|
|
3
|
+
// description: string;
|
|
4
|
+
// iconEmoji: string;
|
|
5
|
+
// }
|
|
6
|
+
//
|
|
7
|
+
// type Primitive = string | number | boolean | undefined | null | Date | File;
|
|
33
8
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
9
|
+
// type SetTails<T, R extends Primitive> = T extends Array<unknown>
|
|
10
|
+
// ? Array<T[number] extends Primitive ? R : SetTails<T[number], R>>
|
|
11
|
+
// : {
|
|
12
|
+
// [K in keyof T]: T[K] extends Primitive ? R : SetTails<T[K], R>;
|
|
13
|
+
// };
|
|
38
14
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
15
|
+
// type ProxyConfig = {
|
|
16
|
+
// api: string;
|
|
17
|
+
// servername: string;
|
|
18
|
+
// port: string;
|
|
19
|
+
// };
|
|
20
|
+
// interface WidgetConfig {
|
|
21
|
+
// apiKey: string;
|
|
22
|
+
// useDefault: boolean;
|
|
23
|
+
// maxTokens: number;
|
|
24
|
+
// proxyConfig: ProxyConfig;
|
|
25
|
+
// }
|
|
26
|
+
//
|
|
27
|
+
// interface AITranslateWidgetConfig extends WidgetConfig {
|
|
28
|
+
// defaultLanguage: string;
|
|
29
|
+
// languages: string[];
|
|
30
|
+
// }
|
|
31
|
+
//
|
|
32
|
+
// interface AIRephraseWidgetConfig extends WidgetConfig {
|
|
33
|
+
// defaultTone: string;
|
|
34
|
+
// Tones: Tone[];
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
// interface QBConfig {
|
|
38
|
+
// credentials: {
|
|
39
|
+
// appId: number;
|
|
40
|
+
// accountKey: string;
|
|
41
|
+
// authKey: string;
|
|
42
|
+
// authSecret: string;
|
|
43
|
+
// sessionToken: string; // ??? ui-kit
|
|
44
|
+
// };
|
|
45
|
+
// configAIApi: {
|
|
46
|
+
// // ui-kit
|
|
47
|
+
// AIAnswerAssistWidgetConfig: WidgetConfig;
|
|
48
|
+
// AITranslateWidgetConfig: AITranslateWidgetConfig;
|
|
49
|
+
// AIRephraseWidgetConfig: AIRephraseWidgetConfig;
|
|
50
|
+
// };
|
|
51
|
+
// appConfig: {
|
|
52
|
+
// maxFileSize: number; // ui-kit
|
|
53
|
+
// sessionTimeOut: number; // ?? webRTc -> ui-kit
|
|
54
|
+
// chatProtocol: {
|
|
55
|
+
// active: number;
|
|
56
|
+
// };
|
|
57
|
+
// debug: boolean;
|
|
58
|
+
// enableForwarding: boolean; // ui-kit
|
|
59
|
+
// enableReplying: boolean; // ui-kit
|
|
60
|
+
// regexUserName?: string; // ui-kit
|
|
61
|
+
// endpoints: {
|
|
62
|
+
// api: string;
|
|
63
|
+
// chat: string;
|
|
64
|
+
// };
|
|
65
|
+
// // on: {
|
|
66
|
+
// // sessionExpired: (handleResponse: any, retry: any) => Promise<void>;
|
|
67
|
+
// // };
|
|
68
|
+
// streamManagement: {
|
|
69
|
+
// enable: boolean;
|
|
70
|
+
// };
|
|
71
|
+
// };
|
|
72
|
+
// }
|
|
75
73
|
|
|
76
74
|
/*
|
|
77
75
|
* QuickBlox Types - start
|
|
@@ -79,2803 +77,128 @@ interface QBConfig {
|
|
|
79
77
|
*/
|
|
80
78
|
|
|
81
79
|
type Dictionary<T> = Record<string, T>;
|
|
80
|
+
//
|
|
81
|
+
// type RequiredProps<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
// };
|
|
83
|
+
// declare enum QBChatProtocol {
|
|
84
|
+
// BOSH = 1,
|
|
85
|
+
// WebSockets = 2,
|
|
162
86
|
// }
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
message: string | string[] | Dictionary<string | string[]>;
|
|
169
|
-
}
|
|
170
|
-
|
|
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. */
|
|
178
|
-
id: number;
|
|
179
|
-
/** User's full name. */
|
|
180
|
-
full_name: string;
|
|
181
|
-
/** User's email. */
|
|
182
|
-
email: string;
|
|
183
|
-
/** User's login. */
|
|
184
|
-
login: string;
|
|
185
|
-
/** User's phone number. */
|
|
186
|
-
phone: string;
|
|
187
|
-
/** User's website url. */
|
|
188
|
-
website: string | null;
|
|
189
|
-
/** Date & time when record was created, filled automatically. */
|
|
190
|
-
created_at: string;
|
|
191
|
-
/** Date & time when record was created, filled automatically. */
|
|
192
|
-
updated_at: string;
|
|
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. */
|
|
198
|
-
facebook_id: string | null;
|
|
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. */
|
|
202
|
-
custom_data: string | null;
|
|
203
|
-
/** User's tags. Comma separated array of tags. */
|
|
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. */
|
|
241
|
-
password?: string;
|
|
242
|
-
/** User's old password. */
|
|
243
|
-
old_password?: string;
|
|
244
|
-
/** User's tags. */
|
|
245
|
-
tag_list?: string | string[];
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
declare interface ListUserResponse {
|
|
249
|
-
current_page: number;
|
|
250
|
-
per_page: number;
|
|
251
|
-
total_entries: number;
|
|
252
|
-
items: Array<{ user: QBUser }>;
|
|
253
|
-
}
|
|
254
|
-
|
|
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. */
|
|
259
|
-
application_id: number;
|
|
260
|
-
/** ID of the session's owner. */
|
|
261
|
-
user_id: QBUser['id'];
|
|
262
|
-
/** Date & time when a record was created, filled automatically. */
|
|
263
|
-
created_at: string;
|
|
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. */
|
|
267
|
-
nonce: number;
|
|
268
|
-
/** Session identifier. Each API request should contain this parameter in QB-Token header. */
|
|
269
|
-
token: string;
|
|
270
|
-
/** Unix Timestamp. Parameter from session creating request is used. */
|
|
271
|
-
ts: number;
|
|
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;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
type ChatConnectParams =
|
|
280
|
-
| {
|
|
281
|
-
/** Connect to the chat by user id */
|
|
282
|
-
userId: QBUser['id'];
|
|
283
|
-
/** The user's password or session token */
|
|
284
|
-
password: string;
|
|
285
|
-
}
|
|
286
|
-
| {
|
|
287
|
-
/** Connect to the chat by user jid */
|
|
288
|
-
jid: string;
|
|
289
|
-
/** The user's password or session token */
|
|
290
|
-
password: string;
|
|
291
|
-
}
|
|
292
|
-
| {
|
|
293
|
-
/** Connect to the chat by user's email */
|
|
294
|
-
email: string;
|
|
295
|
-
/** The user's password or session token */
|
|
296
|
-
password: string;
|
|
297
|
-
};
|
|
298
|
-
|
|
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. */
|
|
311
|
-
id: string | number;
|
|
312
|
-
/** Type of attachment. Example: `audio`, `video`, `image` or other */
|
|
313
|
-
type: string;
|
|
314
|
-
/** Link to a file in Internet. */
|
|
315
|
-
url?: string;
|
|
316
|
-
/** UID of file from `QB.content.createAndUpload` */
|
|
317
|
-
uid?: string;
|
|
318
|
-
/** Name of attachment. */
|
|
319
|
-
name?: string;
|
|
320
|
-
/** Size of attachment. */
|
|
321
|
-
size?: number;
|
|
322
|
-
[key: string]: QBCustomField;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
declare enum QBChatDialogType {
|
|
326
|
-
PUBLIC_GROUP = 1,
|
|
327
|
-
GROUP = 2,
|
|
328
|
-
PRIVATE = 3,
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
declare interface QBChatDialog {
|
|
332
|
-
/** ID of the dialog. Generated automatically by the server after dialog creation. */
|
|
333
|
-
_id: string;
|
|
334
|
-
/** ID of dialog's owner. */
|
|
335
|
-
user_id: QBUser['id'];
|
|
336
|
-
/** Date & time when a record was created, filled automatically. */
|
|
337
|
-
created_at: string;
|
|
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
|
-
*/
|
|
351
|
-
name: string;
|
|
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
|
-
*/
|
|
356
|
-
photo: null | string;
|
|
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
|
-
*/
|
|
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. */
|
|
373
|
-
unread_messages_count: number | null;
|
|
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;
|
|
383
|
-
};
|
|
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
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
declare interface QBChatMessage {
|
|
389
|
-
/** ID of the message. Generated automatically by the server after message creation. */
|
|
390
|
-
_id: string;
|
|
391
|
-
/** Date & time when a record was created, filled automatically. */
|
|
392
|
-
created_at: string;
|
|
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. */
|
|
400
|
-
date_sent: number;
|
|
401
|
-
/** Message sender ID. */
|
|
402
|
-
sender_id: QBUser['id'];
|
|
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;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
declare interface QBMessageStatusParams {
|
|
432
|
-
/** ID of the message. */
|
|
433
|
-
messageId: QBChatMessage['_id'];
|
|
434
|
-
/** ID of the dialog. */
|
|
435
|
-
dialogId: QBChatDialog['_id'];
|
|
436
|
-
/** ID of the user. */
|
|
437
|
-
userId: QBUser['id'];
|
|
438
|
-
}
|
|
439
|
-
|
|
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 {
|
|
459
|
-
id: string;
|
|
460
|
-
dialog_id: QBChatDialog['_id'];
|
|
461
|
-
recipient_id: null;
|
|
462
|
-
type: 'chat' | 'groupchat';
|
|
463
|
-
body: string;
|
|
464
|
-
delay: null;
|
|
465
|
-
markable: 0 | 1;
|
|
466
|
-
extension: {
|
|
467
|
-
attachments?: ChatMessageAttachment[];
|
|
468
|
-
date_sent: string;
|
|
469
|
-
[custom_field_N: string]: any;
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// declare interface QBSystemMessage {
|
|
474
|
-
// id: string;
|
|
475
|
-
// userId: QBUser['id'];
|
|
476
|
-
// body?: null | string;
|
|
477
|
-
// extension?: Dictionary<any>;
|
|
87
|
+
//
|
|
88
|
+
// interface ICEServer {
|
|
89
|
+
// urls: string;
|
|
90
|
+
// username: string;
|
|
91
|
+
// credential: string;
|
|
478
92
|
// }
|
|
479
93
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
declare interface QBSystemMessage {
|
|
487
|
-
// todo extended type
|
|
488
|
-
id: string;
|
|
489
|
-
userId: QBUser['id'];
|
|
490
|
-
body: null | string;
|
|
491
|
-
extension: QBSystemMessageExtension;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
declare interface QBGetDialogResult {
|
|
495
|
-
items: QBChatDialog[];
|
|
496
|
-
limit: number;
|
|
497
|
-
skip: number;
|
|
498
|
-
total_entries: number;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
declare type GetMessagesResult = {
|
|
502
|
-
items: QBChatMessage[];
|
|
503
|
-
limit: number;
|
|
504
|
-
skip: number;
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
interface QBChatModule {
|
|
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
|
-
*/
|
|
620
|
-
send<T extends QBChatNewMessage>(
|
|
621
|
-
jidOrUserId: QBUser['id'] | string,
|
|
622
|
-
message: T,
|
|
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
|
-
*/
|
|
643
|
-
sendSystemMessage(
|
|
644
|
-
jidOrUserId: QBUser['id'] | string,
|
|
645
|
-
// TODO: change type
|
|
646
|
-
message: { extension: QBSystemMessage['extension'] },
|
|
647
|
-
): string;
|
|
648
|
-
/** Send is delivered status. */
|
|
649
|
-
sendDeliveredStatus(params: QBMessageStatusParams): void;
|
|
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>,
|
|
766
|
-
): void;
|
|
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>,
|
|
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;
|
|
816
|
-
};
|
|
94
|
+
// declare enum QBChatDialogType {
|
|
95
|
+
// PUBLIC_GROUP = 1,
|
|
96
|
+
// GROUP = 2,
|
|
97
|
+
// PRIVATE = 3,
|
|
98
|
+
// }
|
|
817
99
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
/** Get user id from dialog's full jid. */
|
|
828
|
-
getIdFromResource(jid: string): QBUser['id'];
|
|
829
|
-
/** Get the recipient id. */
|
|
830
|
-
getRecipientId(
|
|
831
|
-
occupantsIds: Array<QBUser['id']>,
|
|
832
|
-
userId: QBUser['id'],
|
|
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;
|
|
854
|
-
};
|
|
855
|
-
}
|
|
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;
|
|
100
|
+
// declare interface QBChatDialog {
|
|
101
|
+
// /** ID of the dialog. Generated automatically by the server after dialog creation. */
|
|
102
|
+
// _id: string;
|
|
103
|
+
// /** ID of dialog's owner. */
|
|
104
|
+
// user_id: QBUser['id'];
|
|
105
|
+
// /** Date & time when a record was created, filled automatically. */
|
|
106
|
+
// created_at: string;
|
|
107
|
+
// /** Date & time when a record was created, filled automatically. */
|
|
108
|
+
// updated_at: string;
|
|
953
109
|
// /**
|
|
954
|
-
// *
|
|
955
|
-
// *
|
|
110
|
+
// * Type of dialog. Possible values are:
|
|
111
|
+
// * - type=1 (`PUBLIC_GROUP`)
|
|
112
|
+
// * - type=2 (`GROUP`)
|
|
113
|
+
// * - type=3 (`PRIVATE`)
|
|
956
114
|
// */
|
|
957
|
-
//
|
|
958
|
-
// jidOrUserId: QBUser['id'] | string,
|
|
959
|
-
// message: T,
|
|
960
|
-
// ): string;
|
|
115
|
+
// type: QBChatDialogType;
|
|
961
116
|
// /**
|
|
962
|
-
// *
|
|
963
|
-
// *
|
|
117
|
+
// * Name of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
|
|
118
|
+
// * The maximum length for the dialog name is 200 symbols.
|
|
964
119
|
// */
|
|
965
|
-
//
|
|
120
|
+
// name: string;
|
|
966
121
|
// /**
|
|
967
|
-
// *
|
|
968
|
-
// *
|
|
122
|
+
// * Photo of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
|
|
123
|
+
// * Can contain a link to a file in Content module, Custom Objects module or just a web link.
|
|
969
124
|
// */
|
|
970
|
-
//
|
|
125
|
+
// photo: null | string;
|
|
971
126
|
// /**
|
|
972
|
-
// *
|
|
973
|
-
// *
|
|
127
|
+
// * JID of XMPP room for group chat to connect. Nil if type=3 (PRIVATE).
|
|
128
|
+
// * Generated automatically by the server after dialog creation.
|
|
974
129
|
// */
|
|
975
|
-
//
|
|
130
|
+
// xmpp_room_jid: string | null;
|
|
131
|
+
// /** Array of users' IDs - dialog occupants. Does not make sense if type=1 (PUBLIC_GROUP). */
|
|
132
|
+
// occupants_ids: number[];
|
|
133
|
+
// /** Last sent message in this dialog. */
|
|
134
|
+
// last_message: string | null;
|
|
135
|
+
// /** Timestamp of last sent message in this dialog. */
|
|
136
|
+
// last_message_date_sent: number | null | string; // todo: switch type to number
|
|
137
|
+
// /** ID of the user who sent last message in this dialog. */
|
|
138
|
+
// last_message_user_id: QBUser['id'] | null;
|
|
139
|
+
// /** ID of last message in this dialog. */
|
|
140
|
+
// last_message_id: string | null;
|
|
141
|
+
// /** Number of unread messages in this dialog for a current user. */
|
|
142
|
+
// unread_messages_count: number | null;
|
|
976
143
|
// /**
|
|
977
|
-
// *
|
|
978
|
-
// *
|
|
144
|
+
// * - Information about class and fields in Custom Objects.
|
|
145
|
+
// * - Any dialog can be extended using Custom Objects to store additional parameters.
|
|
979
146
|
// */
|
|
980
|
-
//
|
|
981
|
-
//
|
|
982
|
-
//
|
|
983
|
-
//
|
|
984
|
-
//
|
|
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;
|
|
147
|
+
// data?: {
|
|
148
|
+
// /** Class name in Custom Objects. */
|
|
149
|
+
// class_name: string;
|
|
150
|
+
// /** Field name of class in Custom Objects. Can be many: 1..N. */
|
|
151
|
+
// [field_name_N: string]: QBCustomField;
|
|
1191
152
|
// };
|
|
153
|
+
// new_occupants_ids?: number[]; // TODO: EXTENDS TYPE AND SWITCH TO THIS NEW TYPE
|
|
154
|
+
// joined?: boolean; // TODO: EXTENDS TYPE AND SWITCH TO THIS NEW TYPE
|
|
1192
155
|
// }
|
|
1193
156
|
|
|
1194
|
-
declare interface
|
|
1195
|
-
content_type: string;
|
|
1196
|
-
file_id: string;
|
|
1197
|
-
name: string;
|
|
1198
|
-
size: number;
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
declare interface QBBlob {
|
|
1202
|
-
id: number;
|
|
1203
|
-
uid: string;
|
|
1204
|
-
content_type: string;
|
|
1205
|
-
name: string;
|
|
1206
|
-
size: number;
|
|
1207
|
-
created_at: string;
|
|
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;
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
declare interface QBCustomObject {
|
|
1329
|
-
/**
|
|
1330
|
-
* ID of the record
|
|
1331
|
-
* Generated automatically by the server after record creation
|
|
1332
|
-
*/
|
|
1333
|
-
_id: string;
|
|
1334
|
-
/** ID of the user who created the record */
|
|
1335
|
-
user_id: QBUser['id'];
|
|
1336
|
-
/** ID of parent object (Relations) */
|
|
1337
|
-
_parent_id: string | null;
|
|
1338
|
-
/** Date & time when a record was created, filled automatically */
|
|
1339
|
-
created_at: number;
|
|
1340
|
-
/** Date & time when record was updated, filled automatically */
|
|
1341
|
-
updated_at: number;
|
|
1342
|
-
// permissions?: Required<QBCustomObjectPermissions>;
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
declare interface QBDataDeletedResponse {
|
|
1346
|
-
deleted: Array<QBCustomObject['_id']>;
|
|
1347
|
-
deletedCount: number;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
interface QBDataModule {
|
|
1351
|
-
/**
|
|
1352
|
-
* Create new custom object
|
|
1353
|
-
* ([read more](https://docs.quickblox.com/docs/js-custom-objects#create-records)).
|
|
1354
|
-
*/
|
|
1355
|
-
create<T extends QBCustomObject>(
|
|
1356
|
-
className: string,
|
|
1357
|
-
data: { permissions?: QBCustomObjectPermissions } & Dictionary<any>,
|
|
1358
|
-
callback: QBCallback<T>,
|
|
1359
|
-
): void;
|
|
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(
|
|
1365
|
-
className: string,
|
|
1366
|
-
ids: QBCustomObject['_id'] | Array<QBCustomObject['_id']>,
|
|
1367
|
-
callback: QBCallback<QBDataDeletedResponse>,
|
|
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
|
-
*/
|
|
1405
|
-
list<T extends QBCustomObject>(
|
|
1406
|
-
className: string,
|
|
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
|
-
}>,
|
|
1421
|
-
): void;
|
|
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>(
|
|
1427
|
-
className: string,
|
|
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>,
|
|
1442
|
-
): void;
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
declare type ListUserParams = {
|
|
1446
|
-
page?: number;
|
|
1447
|
-
per_page?: number;
|
|
1448
|
-
filter?: Dictionary<any>;
|
|
1449
|
-
order?: string;
|
|
1450
|
-
};
|
|
1451
|
-
|
|
1452
|
-
declare type GetUserParams =
|
|
1453
|
-
| { login: string }
|
|
1454
|
-
| { full_name: string; page?: number; per_page?: number }
|
|
1455
|
-
| { facebook_id: string }
|
|
1456
|
-
| { phone: string }
|
|
1457
|
-
| { email: string }
|
|
1458
|
-
| { tags: string | string[]; page?: number; per_page?: number }
|
|
1459
|
-
| Omit<ListUserParams, 'filter'>
|
|
1460
|
-
| { external: string };
|
|
1461
|
-
|
|
1462
|
-
interface QBUsersModule {
|
|
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>,
|
|
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
|
-
*/
|
|
1501
|
-
listUsers(
|
|
1502
|
-
params: ListUserParams,
|
|
1503
|
-
callback: QBCallback<ListUserResponse>,
|
|
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
|
-
*/
|
|
1520
|
-
update(
|
|
1521
|
-
userId: number,
|
|
1522
|
-
user: QBUserUpdate,
|
|
1523
|
-
callback: QBCallback<QBUser>,
|
|
1524
|
-
): void;
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
declare interface QBMediaParams {
|
|
1528
|
-
audio: MediaStreamConstraints['audio'];
|
|
1529
|
-
video: MediaStreamConstraints['video'];
|
|
1530
|
-
/** Id attribute of HTMLVideoElement */
|
|
1531
|
-
elemId?: string;
|
|
1532
|
-
options?: {
|
|
1533
|
-
muted?: boolean;
|
|
1534
|
-
mirror?: boolean;
|
|
1535
|
-
};
|
|
1536
|
-
}
|
|
1537
|
-
|
|
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 {
|
|
1552
|
-
State: {
|
|
1553
|
-
NEW: 1;
|
|
1554
|
-
ACTIVE: 2;
|
|
1555
|
-
HUNGUP: 3;
|
|
1556
|
-
REJECTED: 4;
|
|
1557
|
-
CLOSED: 5;
|
|
1558
|
-
};
|
|
1559
|
-
ID: string;
|
|
1560
|
-
/**
|
|
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`)
|
|
1579
|
-
*/
|
|
1580
|
-
callType: QBWebRTCCallType;
|
|
1581
|
-
startCallTime?: Date;
|
|
1582
|
-
localStream?: MediaStream;
|
|
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
|
-
*/
|
|
1593
|
-
attachMediaStream(
|
|
1594
|
-
videoElemId: string,
|
|
1595
|
-
stream: MediaStream,
|
|
1596
|
-
options?: QBMediaParams['options'],
|
|
1597
|
-
): void;
|
|
1598
|
-
/** Detach media stream from audio/video element */
|
|
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
|
-
*/
|
|
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
|
-
*/
|
|
1609
|
-
unmute(type: 'audio' | 'video'): void;
|
|
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
|
-
*/
|
|
1636
|
-
switchMediaTracks(
|
|
1637
|
-
deviceIds: { audio?: { exact: string }; video?: { exact: string } },
|
|
1638
|
-
callback: QBCallback<MediaStream>,
|
|
1639
|
-
): void;
|
|
1640
|
-
/** Add tracks from provided stream to local stream (and replace in peers) */
|
|
1641
|
-
_replaceTracks(stream: MediaStream): void;
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
declare interface QBWebRTCModule {
|
|
1645
|
-
CallType: {
|
|
1646
|
-
VIDEO: 1;
|
|
1647
|
-
AUDIO: 2;
|
|
1648
|
-
};
|
|
1649
|
-
sessions: {
|
|
1650
|
-
[sessionId]: QBWebRTCSession;
|
|
1651
|
-
};
|
|
1652
|
-
/** Return data or all active devices. */
|
|
1653
|
-
getMediaDevices(kind?: MediaDeviceKind): Promise<MediaDeviceInfo[]>;
|
|
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
|
-
|
|
1671
|
-
onAcceptCallListener?: (
|
|
1672
|
-
session: QBWebRTCSession,
|
|
1673
|
-
userId: QBUser['id'],
|
|
1674
|
-
userInfo: Dictionary<any>,
|
|
1675
|
-
) => void;
|
|
1676
|
-
onCallListener?: (
|
|
1677
|
-
session: QBWebRTCSession,
|
|
1678
|
-
userInfo: Dictionary<any>,
|
|
1679
|
-
) => void;
|
|
1680
|
-
onCallStatsReport?: (
|
|
1681
|
-
session: QBWebRTCSession,
|
|
1682
|
-
userId: QBUser['id'],
|
|
1683
|
-
stats: string[],
|
|
1684
|
-
) => void;
|
|
1685
|
-
onRejectCallListener?: (
|
|
1686
|
-
session: QBWebRTCSession,
|
|
1687
|
-
userId: QBUser['id'],
|
|
1688
|
-
userInfo: Dictionary<any>,
|
|
1689
|
-
) => void;
|
|
1690
|
-
onRemoteStreamListener?: (
|
|
1691
|
-
sesion: QBWebRTCSession,
|
|
1692
|
-
userId: QBUser['id'],
|
|
1693
|
-
stream: MediaStream,
|
|
1694
|
-
) => void;
|
|
1695
|
-
onSessionCloseListener?: (session: QBWebRTCSession) => void;
|
|
1696
|
-
onSessionConnectionStateChangedListener?: (
|
|
1697
|
-
sesion: QBWebRTCSession,
|
|
1698
|
-
userId: QBUser['id'],
|
|
1699
|
-
state: any,
|
|
1700
|
-
) => void;
|
|
1701
|
-
onStopCallListener?: (
|
|
1702
|
-
session: QBWebRTCSession,
|
|
1703
|
-
userId: QBUser['id'],
|
|
1704
|
-
userInfo: Dictionary<any>,
|
|
1705
|
-
) => void;
|
|
1706
|
-
onUpdateCallListener?: (
|
|
1707
|
-
session: QBWebRTCSession,
|
|
1708
|
-
userId: number,
|
|
1709
|
-
userInfo: Dictionary<any>,
|
|
1710
|
-
) => void;
|
|
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;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
declare type QBLoginParams =
|
|
1913
|
-
| {
|
|
1914
|
-
login: string;
|
|
1915
|
-
password: string;
|
|
1916
|
-
}
|
|
1917
|
-
| {
|
|
1918
|
-
email: string;
|
|
1919
|
-
password: string;
|
|
1920
|
-
}
|
|
1921
|
-
| {
|
|
1922
|
-
provider: 'firebase_phone';
|
|
1923
|
-
firebase_phone: { access_token: string; project_id: string };
|
|
1924
|
-
}
|
|
1925
|
-
| {
|
|
1926
|
-
provider: 'facebook';
|
|
1927
|
-
keys: { token: string; secret: string | null };
|
|
1928
|
-
};
|
|
1929
|
-
|
|
1930
|
-
class QuickBlox {
|
|
1931
|
-
version: string;
|
|
1932
|
-
|
|
1933
|
-
buildNumber: string;
|
|
1934
|
-
|
|
1935
|
-
chat: QBChatModule;
|
|
1936
|
-
|
|
1937
|
-
content: QBContentModule;
|
|
1938
|
-
|
|
1939
|
-
data: QBDataModule;
|
|
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
|
-
*/
|
|
1979
|
-
init(
|
|
1980
|
-
appIdOrToken: string | number,
|
|
1981
|
-
authKeyOrAppId: string | number,
|
|
1982
|
-
authSecret: string | null | undefined,
|
|
1983
|
-
accountKey: string,
|
|
1984
|
-
config?: QBConfig,
|
|
1985
|
-
): void;
|
|
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
|
-
|
|
2005
|
-
service: {
|
|
2006
|
-
qbInst: {
|
|
2007
|
-
session: QBSession | null;
|
|
2008
|
-
config: {
|
|
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;
|
|
2022
|
-
};
|
|
2023
|
-
urls: {
|
|
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';
|
|
2036
|
-
};
|
|
2037
|
-
qbTokenExpirationDate: Date | null;
|
|
2038
|
-
};
|
|
2039
|
-
};
|
|
2040
|
-
};
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
interface QuickBloxConstructor {
|
|
2044
|
-
prototype: QuickBlox;
|
|
2045
|
-
new (): QuickBlox;
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
|
-
interface QB extends QuickBlox {
|
|
2049
|
-
QuickBlox: QuickBloxConstructor;
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
declare const SDK: QB;
|
|
2053
|
-
|
|
2054
|
-
//
|
|
2055
|
-
declare const QB: QB; // should leave for backward compatibility
|
|
2056
|
-
|
|
2057
|
-
/*
|
|
2058
|
-
* QuickBlox Types - end
|
|
2059
|
-
|
|
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 {
|
|
157
|
+
// declare interface QBChatNewMessage {
|
|
2186
158
|
// type: 'chat' | 'groupchat';
|
|
2187
159
|
// body: string;
|
|
2188
|
-
// notification_type?: string;
|
|
2189
|
-
// dialog_id
|
|
160
|
+
// notification_type?: string; // TODO: NED ADD TO TYPE
|
|
161
|
+
// dialog_id: QBChatDialog['_id']; // TODO: NED ADD TO TYPE
|
|
2190
162
|
// extension: {
|
|
2191
163
|
// attachments?: ChatMessageAttachment[];
|
|
2192
164
|
// save_to_history: 0 | 1;
|
|
2193
165
|
// 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;
|
|
166
|
+
// notification_type?: string; // TODO: NED ADD TO TYPE
|
|
167
|
+
// sender_id?: QBUser['id']; // TODO: NED ADD TO TYPE
|
|
168
|
+
// qb_message_action?: 'forward' | 'reply'; // TODO: NED ADD TO TYPE
|
|
169
|
+
// origin_sender_name?: string; // TODO: NED ADD TO TYPE
|
|
170
|
+
// qb_original_messages?: string; // TODO: NED ADD TO TYPE
|
|
2199
171
|
// };
|
|
2200
172
|
// markable: 0 | 1;
|
|
2201
173
|
// }
|
|
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
174
|
|
|
2251
|
-
//
|
|
2252
|
-
//
|
|
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 =
|
|
175
|
+
// TODO: add export to SDK
|
|
176
|
+
// type ChatConnectParams =
|
|
2690
177
|
// | {
|
|
2691
|
-
//
|
|
178
|
+
// /** Connect to the chat by user id */
|
|
179
|
+
// userId: QBUser['id'];
|
|
180
|
+
// /** The user's password or session token */
|
|
2692
181
|
// password: string;
|
|
2693
182
|
// }
|
|
2694
183
|
// | {
|
|
2695
|
-
//
|
|
184
|
+
// /** Connect to the chat by user jid */
|
|
185
|
+
// jid: string;
|
|
186
|
+
// /** The user's password or session token */
|
|
2696
187
|
// password: string;
|
|
2697
188
|
// }
|
|
2698
189
|
// | {
|
|
2699
|
-
//
|
|
2700
|
-
//
|
|
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
|
-
// };
|
|
190
|
+
// /** Connect to the chat by user's email */
|
|
191
|
+
// email: string;
|
|
192
|
+
// /** The user's password or session token */
|
|
193
|
+
// password: string;
|
|
2746
194
|
// };
|
|
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
195
|
//
|
|
2851
|
-
//
|
|
2852
|
-
//
|
|
2853
|
-
//
|
|
2854
|
-
//
|
|
2855
|
-
//
|
|
2856
|
-
//
|
|
2857
|
-
//
|
|
2858
|
-
//
|
|
2859
|
-
//
|
|
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
|
-
// };
|
|
196
|
+
// type QBCustomField =
|
|
197
|
+
// | string
|
|
198
|
+
// | string[]
|
|
199
|
+
// | number
|
|
200
|
+
// | number[]
|
|
201
|
+
// | boolean
|
|
202
|
+
// | boolean[]
|
|
203
|
+
// | null
|
|
204
|
+
// | undefined;
|