whio-api-sdk 1.0.193-bet-staging → 1.0.195-beta-staging
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/src/sdk/modules/agent.module.d.ts +17 -0
- package/dist/src/sdk/modules/agent.module.js +93 -0
- package/dist/src/sdk/modules/audio.module.d.ts +31 -0
- package/dist/src/sdk/modules/audio.module.js +147 -0
- package/dist/src/sdk/modules/auth.module.d.ts +9 -0
- package/dist/src/sdk/modules/auth.module.js +59 -0
- package/dist/src/sdk/modules/base-client.d.ts +25 -0
- package/dist/src/sdk/modules/base-client.js +183 -0
- package/dist/src/sdk/modules/debug.module.d.ts +20 -0
- package/dist/src/sdk/modules/debug.module.js +54 -0
- package/dist/src/sdk/modules/external-integration.module.d.ts +9 -0
- package/dist/src/sdk/modules/external-integration.module.js +38 -0
- package/dist/src/sdk/modules/log.module.d.ts +63 -0
- package/dist/src/sdk/modules/log.module.js +222 -0
- package/dist/src/sdk/modules/organization.module.d.ts +13 -0
- package/dist/src/sdk/modules/organization.module.js +60 -0
- package/dist/src/sdk/modules/session.module.d.ts +16 -0
- package/dist/src/sdk/modules/session.module.js +58 -0
- package/dist/src/sdk/modules/team.module.d.ts +13 -0
- package/dist/src/sdk/modules/team.module.js +72 -0
- package/dist/src/sdk/modules/template.module.d.ts +33 -0
- package/dist/src/sdk/modules/template.module.js +240 -0
- package/dist/src/sdk/modules/user.module.d.ts +17 -0
- package/dist/src/sdk/modules/user.module.js +104 -0
- package/dist/src/sdk/modules/workflow.module.d.ts +10 -0
- package/dist/src/sdk/modules/workflow.module.js +53 -0
- package/dist/src/sdk/sdk.d.ts +169 -211
- package/dist/src/sdk/sdk.js +385 -869
- package/dist/src/sdk/sdk.old.d.ts +222 -0
- package/dist/src/sdk/sdk.old.js +1238 -0
- package/dist/src/sdk/types/agent.types.d.ts +51 -0
- package/dist/src/sdk/types/agent.types.js +1 -0
- package/dist/src/sdk/types/audio.types.d.ts +72 -0
- package/dist/src/sdk/types/audio.types.js +8 -0
- package/dist/src/sdk/types/auth.types.d.ts +21 -0
- package/dist/src/sdk/types/auth.types.js +1 -0
- package/dist/src/sdk/types/common.types.d.ts +20 -0
- package/dist/src/sdk/types/common.types.js +9 -0
- package/dist/src/sdk/types/external-integration.types.d.ts +31 -0
- package/dist/src/sdk/types/external-integration.types.js +1 -0
- package/dist/src/sdk/types/index.d.ts +12 -0
- package/dist/src/sdk/types/index.js +13 -0
- package/dist/src/sdk/types/log.types.d.ts +61 -0
- package/dist/src/sdk/types/log.types.js +1 -0
- package/dist/src/sdk/types/organization.types.d.ts +42 -0
- package/dist/src/sdk/types/organization.types.js +6 -0
- package/dist/src/sdk/types/session.types.d.ts +54 -0
- package/dist/src/sdk/types/session.types.js +1 -0
- package/dist/src/sdk/types/team.types.d.ts +39 -0
- package/dist/src/sdk/types/team.types.js +1 -0
- package/dist/src/sdk/types/template.types.d.ts +118 -0
- package/dist/src/sdk/types/template.types.js +1 -0
- package/dist/src/sdk/types/user.types.d.ts +41 -0
- package/dist/src/sdk/types/user.types.js +1 -0
- package/dist/src/sdk/types/workflow.types.d.ts +19 -0
- package/dist/src/sdk/types/workflow.types.js +1 -0
- package/dist/src/sdk/types.d.ts +1 -517
- package/dist/src/sdk/types.js +2 -23
- package/dist/src/sdk/types.old.d.ts +517 -0
- package/dist/src/sdk/types.old.js +23 -0
- package/dist/src/sdk/urls.d.ts +1 -0
- package/dist/src/sdk/urls.js +2 -0
- package/package.json +1 -1
- package/src/sdk/modules/agent.module.ts +74 -0
- package/src/sdk/modules/audio.module.ts +131 -0
- package/src/sdk/modules/auth.module.ts +53 -0
- package/src/sdk/modules/base-client.ts +214 -0
- package/src/sdk/modules/debug.module.ts +44 -0
- package/src/sdk/modules/external-integration.module.ts +50 -0
- package/src/sdk/modules/log.module.ts +213 -0
- package/src/sdk/modules/organization.module.ts +43 -0
- package/src/sdk/modules/session.module.ts +41 -0
- package/src/sdk/modules/team.module.ts +55 -0
- package/src/sdk/modules/template.module.ts +242 -0
- package/src/sdk/modules/user.module.ts +89 -0
- package/src/sdk/modules/workflow.module.ts +39 -0
- package/src/sdk/sdk.old.ts +1312 -0
- package/src/sdk/sdk.ts +401 -1089
- package/src/sdk/types/agent.types.ts +65 -0
- package/src/sdk/types/audio.types.ts +89 -0
- package/src/sdk/types/auth.types.ts +29 -0
- package/src/sdk/types/common.types.ts +26 -0
- package/src/sdk/types/external-integration.types.ts +37 -0
- package/src/sdk/types/index.ts +13 -0
- package/src/sdk/types/log.types.ts +68 -0
- package/src/sdk/types/organization.types.ts +55 -0
- package/src/sdk/types/session.types.ts +63 -0
- package/src/sdk/types/team.types.ts +48 -0
- package/src/sdk/types/template.types.ts +142 -0
- package/src/sdk/types/user.types.ts +50 -0
- package/src/sdk/types/workflow.types.ts +26 -0
- package/src/sdk/types.old.ts +649 -0
- package/src/sdk/types.ts +2 -649
- package/src/sdk/urls.ts +3 -0
package/src/sdk/sdk.ts
CHANGED
|
@@ -1,1312 +1,624 @@
|
|
|
1
|
-
//
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
TranscriptionAudioUploadResponse,
|
|
34
|
-
ChangePasswordDto,
|
|
35
|
-
AdminChangePasswordDto,
|
|
36
|
-
PasswordChangeResponse,
|
|
37
|
-
Session,
|
|
38
|
-
CreateSessionDto,
|
|
39
|
-
UpdateSessionDto,
|
|
40
|
-
Agent,
|
|
41
|
-
CreateAgentDto,
|
|
42
|
-
UpdateAgentDto,
|
|
43
|
-
AudioFile,
|
|
44
|
-
AudioFileStatus,
|
|
45
|
-
CreateAudioFileDto,
|
|
46
|
-
UpdateAudioFileDto,
|
|
47
|
-
UploadAudioFileDto,
|
|
48
|
-
AgentSettings,
|
|
49
|
-
CreateAgentSettingsDto,
|
|
50
|
-
UpdateAgentSettingsDto,
|
|
51
|
-
Workflow,
|
|
52
|
-
CreateWorkflowDto,
|
|
53
|
-
UpdateWorkflowDto,
|
|
54
|
-
Base64AudioFile,
|
|
55
|
-
CreateBase64AudioFileDto,
|
|
56
|
-
UpdateBase64AudioFileDto,
|
|
57
|
-
AddBase64ChunkResponse,
|
|
58
|
-
Log,
|
|
59
|
-
LogsResponse,
|
|
60
|
-
LogStats,
|
|
61
|
-
FilterLogsDto,
|
|
62
|
-
CreateLogDto,
|
|
63
|
-
DebugSessionSummary,
|
|
64
|
-
} from './types';
|
|
65
|
-
import urls from './urls';
|
|
66
|
-
import { jwtDecode } from 'jwt-decode';
|
|
67
|
-
|
|
68
|
-
export class ApiSDK {
|
|
69
|
-
private baseUrl: string;
|
|
70
|
-
private storage: SDKConfig['storage'];
|
|
71
|
-
private accessToken: string | null = null;
|
|
72
|
-
private refreshToken: string | null = null;
|
|
73
|
-
private user: User | null = null;
|
|
1
|
+
// Main SDK class that composes all domain modules
|
|
2
|
+
import { SDKConfig } from './types';
|
|
3
|
+
import { BaseClient } from './modules/base-client';
|
|
4
|
+
import { AuthModule } from './modules/auth.module';
|
|
5
|
+
import { UserModule } from './modules/user.module';
|
|
6
|
+
import { OrganizationModule } from './modules/organization.module';
|
|
7
|
+
import { TeamModule } from './modules/team.module';
|
|
8
|
+
import { TemplateModule } from './modules/template.module';
|
|
9
|
+
import { SessionModule } from './modules/session.module';
|
|
10
|
+
import { AgentModule } from './modules/agent.module';
|
|
11
|
+
import { AudioModule } from './modules/audio.module';
|
|
12
|
+
import { WorkflowModule } from './modules/workflow.module';
|
|
13
|
+
import { LogModule } from './modules/log.module';
|
|
14
|
+
import { DebugModule } from './modules/debug.module';
|
|
15
|
+
import { ExternalIntegrationModule } from './modules/external-integration.module';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Main SDK class that provides access to all domain-specific modules
|
|
19
|
+
*/
|
|
20
|
+
export class ApiSDK extends BaseClient {
|
|
21
|
+
public readonly auth: AuthModule;
|
|
22
|
+
public readonly users: UserModule;
|
|
23
|
+
public readonly organizations: OrganizationModule;
|
|
24
|
+
public readonly teams: TeamModule;
|
|
25
|
+
public readonly templates: TemplateModule;
|
|
26
|
+
public readonly sessions: SessionModule;
|
|
27
|
+
public readonly agents: AgentModule;
|
|
28
|
+
public readonly audio: AudioModule;
|
|
29
|
+
public readonly workflows: WorkflowModule;
|
|
30
|
+
public readonly logs: LogModule;
|
|
31
|
+
public readonly debug: DebugModule;
|
|
32
|
+
public readonly externalIntegrations: ExternalIntegrationModule;
|
|
74
33
|
|
|
75
34
|
constructor(config: SDKConfig = {}) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const accessToken = await this.storage!.getItem('access_token');
|
|
92
|
-
this.accessToken = accessToken ? JSON.parse(accessToken) : null;
|
|
93
|
-
if (!this.accessToken) {
|
|
94
|
-
throw new Error('Access token not found');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Check if token is expired or expiring soon
|
|
98
|
-
if (this.isTokenExpired(this.accessToken)) {
|
|
99
|
-
// Try to refresh the token
|
|
100
|
-
if (this.refreshToken) {
|
|
101
|
-
await this.refreshAccessToken();
|
|
102
|
-
} else {
|
|
103
|
-
throw new Error('Access token expired and no refresh token available');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
private async initialize() {
|
|
109
|
-
const accessToken = await this.storage!.getItem('access_token');
|
|
110
|
-
const refreshToken = await this.storage!.getItem('refresh_token');
|
|
111
|
-
const userString = await this.storage!.getItem('user');
|
|
112
|
-
this.user = userString ? JSON.parse(userString) : null;
|
|
113
|
-
this.accessToken = accessToken ? JSON.parse(accessToken) : null;
|
|
114
|
-
this.refreshToken = refreshToken ? JSON.parse(refreshToken) : null;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
private async request<T>(
|
|
118
|
-
endpoint: string,
|
|
119
|
-
method: string = 'GET',
|
|
120
|
-
body?: any,
|
|
121
|
-
headers: Record<string, string> = {},
|
|
122
|
-
noToken: boolean = false,
|
|
123
|
-
): Promise<T> {
|
|
124
|
-
const url = `${this.baseUrl}${endpoint}`;
|
|
125
|
-
const defaultHeaders: Record<string, string> = {
|
|
126
|
-
'Content-Type': 'application/json',
|
|
127
|
-
'ngrok-skip-browser-warning': 'true'
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
if (noToken) {
|
|
131
|
-
defaultHeaders['Authorization'] = '';
|
|
132
|
-
} else {
|
|
133
|
-
// If no token is available, try to get it
|
|
134
|
-
await this.getToken();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (this.accessToken) {
|
|
139
|
-
defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const response = await fetch(url, {
|
|
143
|
-
method,
|
|
144
|
-
headers: { ...defaultHeaders, ...headers },
|
|
145
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
if (!response.ok) {
|
|
149
|
-
const errorData = await response.json().catch(() => ({}));
|
|
150
|
-
throw new Error(
|
|
151
|
-
errorData.message || `Request failed with status ${response.status}`
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return response.json();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
private async fileUploadRequest<T>(
|
|
159
|
-
endpoint: string,
|
|
160
|
-
body?: FormData,
|
|
161
|
-
headers: Record<string, string> = {}
|
|
162
|
-
): Promise<T> {
|
|
163
|
-
const url = `${this.baseUrl}${endpoint}`;
|
|
164
|
-
const defaultHeaders: Record<string, string> = {
|
|
165
|
-
'ngrok-skip-browser-warning': 'true'
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
if (this.accessToken) {
|
|
169
|
-
defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Don't set Content-Type for FormData - let browser set it with boundary
|
|
173
|
-
const response = await fetch(url, {
|
|
174
|
-
method: 'POST',
|
|
175
|
-
headers: { ...defaultHeaders, ...headers },
|
|
176
|
-
body,
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
if (!response.ok) {
|
|
180
|
-
const errorData = await response.json().catch(() => ({}));
|
|
181
|
-
throw new Error(
|
|
182
|
-
errorData.message || `Request failed with status ${response.status}`
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return response.json();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
public async login(credentials: LoginCredentials): Promise<LoginResponse> {
|
|
190
|
-
try {
|
|
191
|
-
const response = await this.request<LoginResponse>(
|
|
192
|
-
'/auth/login',
|
|
193
|
-
'POST',
|
|
194
|
-
credentials,
|
|
195
|
-
{},
|
|
196
|
-
true
|
|
197
|
-
);
|
|
198
|
-
this.accessToken = response.access_token;
|
|
199
|
-
this.refreshToken = response.refresh_token;
|
|
200
|
-
|
|
201
|
-
this.user = response.user;
|
|
202
|
-
|
|
203
|
-
await this.storage!.setItem('access_token', JSON.stringify(response.access_token));
|
|
204
|
-
await this.storage!.setItem('refresh_token', JSON.stringify(response.refresh_token));
|
|
205
|
-
await this.storage!.setItem('user', JSON.stringify(response.user));
|
|
206
|
-
|
|
207
|
-
return response;
|
|
208
|
-
} catch (error) {
|
|
209
|
-
await this.clearAuth();
|
|
210
|
-
throw error;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
public async logout(): Promise<void> {
|
|
215
|
-
await this.clearAuth();
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
private async clearAuth(): Promise<void> {
|
|
219
|
-
this.accessToken = null;
|
|
220
|
-
this.refreshToken = null;
|
|
221
|
-
this.user = null;
|
|
222
|
-
await this.storage!.removeItem('access_token');
|
|
223
|
-
await this.storage!.removeItem('refresh_token');
|
|
224
|
-
await this.storage!.removeItem('user');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
private isTokenExpired(token: string, bufferMinutes: number = 5): boolean {
|
|
228
|
-
try {
|
|
229
|
-
const decoded: any = jwtDecode(token);
|
|
230
|
-
const currentTime = Date.now() / 1000;
|
|
231
|
-
const bufferTime = bufferMinutes * 60;
|
|
232
|
-
|
|
233
|
-
return decoded.exp <= (currentTime + bufferTime);
|
|
234
|
-
} catch (error) {
|
|
235
|
-
// If we can't decode the token, consider it expired
|
|
236
|
-
return true;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
private async refreshAccessToken(): Promise<void> {
|
|
241
|
-
if (!this.refreshToken) {
|
|
242
|
-
throw new Error('No refresh token available');
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
try {
|
|
246
|
-
const response = await this.request<LoginResponse>(
|
|
247
|
-
'/auth/refresh',
|
|
248
|
-
'POST',
|
|
249
|
-
{ refresh_token: this.refreshToken },
|
|
250
|
-
{},
|
|
251
|
-
true // Skip token validation for this request
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
this.accessToken = response.access_token;
|
|
255
|
-
this.refreshToken = response.refresh_token;
|
|
256
|
-
this.user = response.user;
|
|
257
|
-
|
|
258
|
-
await this.storage!.setItem('access_token', JSON.stringify(response.access_token));
|
|
259
|
-
await this.storage!.setItem('refresh_token', JSON.stringify(response.refresh_token));
|
|
260
|
-
await this.storage!.setItem('user', JSON.stringify(response.user));
|
|
261
|
-
} catch (error) {
|
|
262
|
-
await this.clearAuth();
|
|
263
|
-
throw new Error('Failed to refresh access token');
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
public isAuthenticated(): boolean {
|
|
268
|
-
return !!this.accessToken;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
public getCurrentUser(): User | null {
|
|
272
|
-
return this.user;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
public getAccessToken(): string | null {
|
|
276
|
-
return this.accessToken;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
public getRefreshToken(): string | null {
|
|
280
|
-
return this.refreshToken;
|
|
35
|
+
super(config);
|
|
36
|
+
|
|
37
|
+
// Initialize all domain modules with the same config
|
|
38
|
+
this.auth = new AuthModule(config);
|
|
39
|
+
this.users = new UserModule(config);
|
|
40
|
+
this.organizations = new OrganizationModule(config);
|
|
41
|
+
this.teams = new TeamModule(config);
|
|
42
|
+
this.templates = new TemplateModule(config);
|
|
43
|
+
this.sessions = new SessionModule(config);
|
|
44
|
+
this.agents = new AgentModule(config);
|
|
45
|
+
this.audio = new AudioModule(config);
|
|
46
|
+
this.workflows = new WorkflowModule(config);
|
|
47
|
+
this.logs = new LogModule(config);
|
|
48
|
+
this.debug = new DebugModule(config);
|
|
49
|
+
this.externalIntegrations = new ExternalIntegrationModule(config);
|
|
281
50
|
}
|
|
282
51
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
52
|
+
// ======================
|
|
53
|
+
// BACKWARD COMPATIBILITY LAYER
|
|
54
|
+
// Delegate methods to appropriate modules to maintain existing API
|
|
55
|
+
// ======================
|
|
286
56
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
email,
|
|
291
|
-
password,
|
|
292
|
-
organizationId: this.user?.organizationId,
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
const user = await this.request<User>(
|
|
296
|
-
urls.users,
|
|
297
|
-
'POST',
|
|
298
|
-
createUserDto
|
|
299
|
-
);
|
|
300
|
-
return user;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
private async assignRoleToUser(userId: string, roleName: OrganizationRoleType, organizationId?: string): Promise<User> {
|
|
304
|
-
const orgId = organizationId || this.user?.organizationId;
|
|
305
|
-
const organization = await this.request<Organization>(
|
|
306
|
-
`${urls.organizations}/${orgId}`,
|
|
307
|
-
'GET'
|
|
308
|
-
);
|
|
309
|
-
const orgRoleEditor = organization.roles!.find(
|
|
310
|
-
r => r.name === roleName);
|
|
311
|
-
const assignRoleDto:AssignOrganizationRoleDto = {
|
|
312
|
-
userId: userId,
|
|
313
|
-
organizationRoleId: orgRoleEditor!.id,
|
|
314
|
-
};
|
|
315
|
-
this.request(urls.userOrganizationRoles, 'POST', assignRoleDto);
|
|
316
|
-
const userWithOrgRole = await this.request<User>(
|
|
317
|
-
`${urls.user}/${userId}`,
|
|
318
|
-
'GET'
|
|
319
|
-
);
|
|
320
|
-
return userWithOrgRole;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
public async assignEditorToRoleToUser(userId: string, organizationId?: string): Promise<User> {
|
|
324
|
-
return this.assignRoleToUser(userId, OrganizationRoleType.EDITOR, organizationId);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
public async assignAdminToRoleToUser(userId: string, organizationId?: string): Promise<User> {
|
|
328
|
-
return this.assignRoleToUser(userId, OrganizationRoleType.ADMIN, organizationId);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
public async assignDisabledToRoleToUser(userId: string, organizationId?: string): Promise<User> {
|
|
332
|
-
return this.assignRoleToUser(userId, OrganizationRoleType.DISABLED, organizationId);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
public async createEditorUser(firstName: string, lastName: string,
|
|
336
|
-
email: string, password: string): Promise<User> {
|
|
337
|
-
const user = await this.createUser(firstName, lastName, email, password);
|
|
338
|
-
const userWithOrgRole = await this.assignEditorToRoleToUser(user.id);
|
|
339
|
-
return userWithOrgRole;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
public async createAdminUser(firstName: string, lastName: string,
|
|
343
|
-
email: string, password: string): Promise<User> {
|
|
344
|
-
const user = await this.createUser(firstName, lastName, email, password);
|
|
345
|
-
const userWithOrgRole = await this.assignAdminToRoleToUser(user.id);
|
|
346
|
-
return userWithOrgRole;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
public async createDisabledUser(firstName: string, lastName: string,
|
|
350
|
-
email: string, password: string): Promise<User> {
|
|
351
|
-
const user = await this.createUser(firstName, lastName, email, password);
|
|
352
|
-
const userWithOrgRole = await this.assignDisabledToRoleToUser(user.id);
|
|
353
|
-
return userWithOrgRole;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
public async createTeam(name: string, description: string): Promise<Team> {
|
|
357
|
-
const teamDto: CreateTeamDto = {
|
|
358
|
-
name,
|
|
359
|
-
description,
|
|
360
|
-
organizationId: this.user!.organizationId,
|
|
361
|
-
};
|
|
362
|
-
return this.request(urls.teams, 'POST', teamDto);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
public async updateTeam(id: string, name: string, description: string): Promise<Team> {
|
|
366
|
-
const teamDto: UpdateTeamDto = {
|
|
367
|
-
name,
|
|
368
|
-
description,
|
|
369
|
-
};
|
|
370
|
-
return this.request<Team>(`${urls.teams}/${id}`, 'PATCH', teamDto);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
public async addUserToTeam(teamId: string, userId: string, roleName: string): Promise<any> {
|
|
374
|
-
const assignRoleDto: AssignTeamRoleDto = {
|
|
375
|
-
teamId,
|
|
376
|
-
userId,
|
|
377
|
-
name: roleName,
|
|
378
|
-
};
|
|
379
|
-
return this.request(urls.teamRoles, 'POST', assignRoleDto);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
public async removeUserFromTeam(teamId: string, userId: string): Promise<void> {
|
|
383
|
-
await this.request(`${urls.teamRoles}/user/${userId}/team/${teamId}`, 'DELETE');
|
|
384
|
-
}
|
|
385
|
-
public async createTemplate(title: string, content: string, categoryId?: string, workflowId?: string, agentId?: string): Promise<Template> {
|
|
386
|
-
let finalCategoryId = categoryId;
|
|
387
|
-
if (!finalCategoryId) {
|
|
388
|
-
const templateCategories = await this.request<TemplateCategory[]>(
|
|
389
|
-
urls.templateCategories,
|
|
390
|
-
'GET'
|
|
391
|
-
);
|
|
392
|
-
finalCategoryId = templateCategories[0]?.id;
|
|
393
|
-
if (!finalCategoryId) {
|
|
394
|
-
throw new Error('No template categories available. Please create one first.');
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
const createTemplateDto: CreateTemplateDto = {
|
|
399
|
-
title,
|
|
400
|
-
content,
|
|
401
|
-
isGlobal: false,
|
|
402
|
-
categoryId: finalCategoryId,
|
|
403
|
-
createdById: this.user!.id,
|
|
404
|
-
organizationId: this.user!.organizationId,
|
|
405
|
-
workflowId,
|
|
406
|
-
agentId,
|
|
407
|
-
};
|
|
408
|
-
return this.request<Template>(urls.templates, 'POST', createTemplateDto);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
public async createUserTemplate(
|
|
412
|
-
title: string, content: string, originalTemplateId: string | undefined): Promise<UserTemplate> {
|
|
413
|
-
const createUserTemplateDto: CreateUserTemplateDto = {
|
|
414
|
-
title,
|
|
415
|
-
content,
|
|
416
|
-
originalTemplateId,
|
|
417
|
-
userId: this.user!.id,
|
|
418
|
-
};
|
|
419
|
-
return this.request(urls.userTemplates, 'POST', createUserTemplateDto);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
public async updateTemplate(
|
|
423
|
-
title: string, content: string, id: string, workflowId?: string, agentId?: string): Promise<Template> {
|
|
424
|
-
const templateDto: UpdateTemplateDto = {
|
|
425
|
-
title,
|
|
426
|
-
content,
|
|
427
|
-
isGlobal: false,
|
|
428
|
-
organizationId: this.user!.organizationId,
|
|
429
|
-
workflowId,
|
|
430
|
-
agentId,
|
|
431
|
-
};
|
|
432
|
-
return this.request<Template>(
|
|
433
|
-
`${urls.templates}/${id}`,
|
|
434
|
-
'PATCH',
|
|
435
|
-
templateDto,
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
public async updateUserTemplate(
|
|
440
|
-
title: string, content: string, id: string): Promise<UserTemplate> {
|
|
441
|
-
const userTemplateDto: UpdateUserTemplateDto = {
|
|
442
|
-
title,
|
|
443
|
-
content,
|
|
444
|
-
};
|
|
445
|
-
return this.request<UserTemplate>(
|
|
446
|
-
`${urls.userTemplates}/${id}`,
|
|
447
|
-
'PATCH',
|
|
448
|
-
userTemplateDto,
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
public async getTemplates(): Promise<Template[]> {
|
|
453
|
-
return this.request<Template[]>(urls.templates, 'GET');
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
public async getTemplatesByOrganization(): Promise<Template[]> {
|
|
457
|
-
return this.request<Template[]>(`${urls.templates}/organization`, 'GET');
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
public async getUserTemplates(): Promise<UserTemplate[]> {
|
|
461
|
-
const url = `${urls.userTemplates}/user/${this.user!.id}`;
|
|
462
|
-
return this.request<UserTemplate[]>(url, 'GET');
|
|
57
|
+
// Auth methods
|
|
58
|
+
public async login(...args: Parameters<AuthModule['login']>) {
|
|
59
|
+
return this.auth.login(...args);
|
|
463
60
|
}
|
|
464
61
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
// ======================
|
|
468
|
-
|
|
469
|
-
public async generateTranscriptionSummary(
|
|
470
|
-
templateId: string, sessionId: string): Promise<TranscriptionSummary> {
|
|
471
|
-
const generateSummaryDto: GenerateTranscriptionSummaryDto = {
|
|
472
|
-
templateId,
|
|
473
|
-
userId: this.user!.id,
|
|
474
|
-
fromUserTemplate: false,
|
|
475
|
-
sessionId: sessionId,
|
|
476
|
-
};
|
|
477
|
-
const transcriptionSummary:TranscriptionSummary = await this.request(
|
|
478
|
-
urls.transcriptionSummary,
|
|
479
|
-
'POST',
|
|
480
|
-
generateSummaryDto
|
|
481
|
-
);
|
|
482
|
-
return transcriptionSummary;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
public async getByOrganizationTranscriptionSummaries(
|
|
486
|
-
organizationId: string): Promise<TranscriptionSummary[]> {
|
|
487
|
-
return this.request<TranscriptionSummary[]>(
|
|
488
|
-
`${urls.transcriptionSummaries}/organization/${organizationId}`,
|
|
489
|
-
'GET'
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
public async generateTranscriptionSummaryFromUserTemplate(
|
|
494
|
-
userTemplateId: string, sessionId: string): Promise<TranscriptionSummary> {
|
|
495
|
-
const generateSummaryDto: GenerateTranscriptionSummaryDto = {
|
|
496
|
-
templateId: userTemplateId,
|
|
497
|
-
userId: this.user!.id,
|
|
498
|
-
fromUserTemplate: true,
|
|
499
|
-
sessionId: sessionId,
|
|
500
|
-
};
|
|
501
|
-
const transcriptionSummary: TranscriptionSummary = await this.request(
|
|
502
|
-
urls.transcriptionSummary,
|
|
503
|
-
'POST',
|
|
504
|
-
generateSummaryDto
|
|
505
|
-
);
|
|
506
|
-
return transcriptionSummary;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
public async updateTranscriptionSummary(
|
|
510
|
-
id: string, content: string): Promise<TranscriptionSummary> {
|
|
511
|
-
const updateSummaryDto: UpdateTranscriptionSummaryDto = {
|
|
512
|
-
content,
|
|
513
|
-
};
|
|
514
|
-
return this.request<TranscriptionSummary>(
|
|
515
|
-
`${urls.transcriptionSummary}/${id}`,
|
|
516
|
-
'PATCH',
|
|
517
|
-
updateSummaryDto,
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
public async uploadLargeAudioFile(formData: FormData): Promise<string> {
|
|
522
|
-
const uploadId: string = await this.fileUploadRequest(
|
|
523
|
-
urls.uploadAudioLarge,
|
|
524
|
-
formData
|
|
525
|
-
);
|
|
526
|
-
const uploadIds: string = await this.storage!.getItem('uploadIds') || '[]';
|
|
527
|
-
const uploadIdsArray = JSON.parse(uploadIds);
|
|
528
|
-
await this.storage!.setItem('uploadIds', JSON.stringify([...uploadIdsArray, uploadId]));
|
|
529
|
-
return uploadId;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
public async uploadAudioFile(formData: FormData): Promise<TranscriptionAudioUploadResponse | null> {
|
|
533
|
-
const data: TranscriptionAudioUploadResponse = await this.fileUploadRequest(
|
|
534
|
-
urls.uploadAudio,
|
|
535
|
-
formData,
|
|
536
|
-
);
|
|
537
|
-
return data;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
public async transcribeBase64Audio(base64String: string): Promise<string> {
|
|
541
|
-
const transcript = await this.request<any>(
|
|
542
|
-
urls.transcribeBase64Audio,
|
|
543
|
-
'POST',
|
|
544
|
-
{ base64Audio: base64String });
|
|
545
|
-
return transcript.transcript;
|
|
62
|
+
public async logout(...args: Parameters<AuthModule['logout']>) {
|
|
63
|
+
return this.auth.logout(...args);
|
|
546
64
|
}
|
|
547
65
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
66
|
+
public async getProfile(...args: Parameters<AuthModule['getProfile']>) {
|
|
67
|
+
return this.auth.getProfile(...args);
|
|
68
|
+
}
|
|
551
69
|
|
|
552
|
-
public async
|
|
553
|
-
return this.
|
|
70
|
+
public async changePassword(...args: Parameters<AuthModule['changePassword']>) {
|
|
71
|
+
return this.auth.changePassword(...args);
|
|
554
72
|
}
|
|
555
73
|
|
|
556
|
-
public async
|
|
557
|
-
|
|
558
|
-
currentPassword,
|
|
559
|
-
newPassword,
|
|
560
|
-
};
|
|
561
|
-
return this.request<PasswordChangeResponse>(urls.changePassword, 'PATCH', dto);
|
|
74
|
+
public async adminChangePassword(...args: Parameters<AuthModule['adminChangePassword']>) {
|
|
75
|
+
return this.auth.adminChangePassword(...args);
|
|
562
76
|
}
|
|
563
77
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
newPassword,
|
|
568
|
-
};
|
|
569
|
-
return this.request<PasswordChangeResponse>(urls.adminChangePassword, 'PATCH', dto);
|
|
78
|
+
// User methods
|
|
79
|
+
public async createUser(...args: Parameters<UserModule['createUser']>) {
|
|
80
|
+
return this.users.createUser(...args);
|
|
570
81
|
}
|
|
571
82
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
83
|
+
public async assignEditorToRoleToUser(...args: Parameters<UserModule['assignEditorToRoleToUser']>) {
|
|
84
|
+
return this.users.assignEditorToRoleToUser(...args);
|
|
85
|
+
}
|
|
575
86
|
|
|
576
|
-
public async
|
|
577
|
-
|
|
578
|
-
return this.request<Organization>(urls.organizations, 'POST', dto);
|
|
87
|
+
public async assignAdminToRoleToUser(...args: Parameters<UserModule['assignAdminToRoleToUser']>) {
|
|
88
|
+
return this.users.assignAdminToRoleToUser(...args);
|
|
579
89
|
}
|
|
580
90
|
|
|
581
|
-
public async
|
|
582
|
-
return this.
|
|
91
|
+
public async assignDisabledToRoleToUser(...args: Parameters<UserModule['assignDisabledToRoleToUser']>) {
|
|
92
|
+
return this.users.assignDisabledToRoleToUser(...args);
|
|
583
93
|
}
|
|
584
94
|
|
|
585
|
-
public async
|
|
586
|
-
return this.
|
|
95
|
+
public async createEditorUser(...args: Parameters<UserModule['createEditorUser']>) {
|
|
96
|
+
return this.users.createEditorUser(...args);
|
|
587
97
|
}
|
|
588
98
|
|
|
589
|
-
public async
|
|
590
|
-
|
|
591
|
-
return this.request<Organization>(`${urls.organizations}/${id}`, 'PATCH', dto);
|
|
99
|
+
public async createAdminUser(...args: Parameters<UserModule['createAdminUser']>) {
|
|
100
|
+
return this.users.createAdminUser(...args);
|
|
592
101
|
}
|
|
593
102
|
|
|
594
|
-
public async
|
|
595
|
-
|
|
103
|
+
public async createDisabledUser(...args: Parameters<UserModule['createDisabledUser']>) {
|
|
104
|
+
return this.users.createDisabledUser(...args);
|
|
596
105
|
}
|
|
597
106
|
|
|
598
|
-
public async
|
|
599
|
-
|
|
107
|
+
public async getUsers(...args: Parameters<UserModule['getUsers']>) {
|
|
108
|
+
return this.users.getUsers(...args);
|
|
600
109
|
}
|
|
601
110
|
|
|
602
|
-
public async
|
|
603
|
-
|
|
111
|
+
public async getUser(...args: Parameters<UserModule['getUser']>) {
|
|
112
|
+
return this.users.getUser(...args);
|
|
604
113
|
}
|
|
605
114
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
115
|
+
public async getUsersByOrganization(...args: Parameters<UserModule['getUsersByOrganization']>) {
|
|
116
|
+
return this.users.getUsersByOrganization(...args);
|
|
117
|
+
}
|
|
609
118
|
|
|
610
|
-
public async
|
|
611
|
-
return this.
|
|
119
|
+
public async updateUser(...args: Parameters<UserModule['updateUser']>) {
|
|
120
|
+
return this.users.updateUser(...args);
|
|
612
121
|
}
|
|
613
122
|
|
|
614
|
-
public async
|
|
615
|
-
return this.
|
|
123
|
+
public async deleteUser(...args: Parameters<UserModule['deleteUser']>) {
|
|
124
|
+
return this.users.deleteUser(...args);
|
|
616
125
|
}
|
|
617
126
|
|
|
618
|
-
|
|
619
|
-
|
|
127
|
+
// Organization methods
|
|
128
|
+
public async createOrganization(...args: Parameters<OrganizationModule['createOrganization']>) {
|
|
129
|
+
return this.organizations.createOrganization(...args);
|
|
620
130
|
}
|
|
621
131
|
|
|
622
|
-
public async
|
|
623
|
-
return this.
|
|
132
|
+
public async getOrganizations(...args: Parameters<OrganizationModule['getOrganizations']>) {
|
|
133
|
+
return this.organizations.getOrganizations(...args);
|
|
624
134
|
}
|
|
625
135
|
|
|
626
|
-
public async
|
|
627
|
-
|
|
136
|
+
public async getOrganization(...args: Parameters<OrganizationModule['getOrganization']>) {
|
|
137
|
+
return this.organizations.getOrganization(...args);
|
|
628
138
|
}
|
|
629
139
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
140
|
+
public async updateOrganization(...args: Parameters<OrganizationModule['updateOrganization']>) {
|
|
141
|
+
return this.organizations.updateOrganization(...args);
|
|
142
|
+
}
|
|
633
143
|
|
|
634
|
-
public async
|
|
635
|
-
return this.
|
|
144
|
+
public async deleteOrganization(...args: Parameters<OrganizationModule['deleteOrganization']>) {
|
|
145
|
+
return this.organizations.deleteOrganization(...args);
|
|
636
146
|
}
|
|
637
147
|
|
|
638
|
-
public async
|
|
639
|
-
return this.
|
|
148
|
+
public async addUserToOrganization(...args: Parameters<OrganizationModule['addUserToOrganization']>) {
|
|
149
|
+
return this.organizations.addUserToOrganization(...args);
|
|
640
150
|
}
|
|
641
151
|
|
|
642
|
-
public async
|
|
643
|
-
return this.
|
|
152
|
+
public async removeUserFromOrganization(...args: Parameters<OrganizationModule['removeUserFromOrganization']>) {
|
|
153
|
+
return this.organizations.removeUserFromOrganization(...args);
|
|
644
154
|
}
|
|
645
155
|
|
|
646
|
-
public async
|
|
647
|
-
|
|
156
|
+
public async linkExternalIntegration(...args: Parameters<OrganizationModule['linkExternalIntegration']>) {
|
|
157
|
+
return this.organizations.linkExternalIntegration(...args);
|
|
648
158
|
}
|
|
649
159
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
160
|
+
public async unlinkExternalIntegration(...args: Parameters<OrganizationModule['unlinkExternalIntegration']>) {
|
|
161
|
+
return this.organizations.unlinkExternalIntegration(...args);
|
|
162
|
+
}
|
|
653
163
|
|
|
654
|
-
|
|
655
|
-
|
|
164
|
+
// Team methods
|
|
165
|
+
public async createTeam(...args: Parameters<TeamModule['createTeam']>) {
|
|
166
|
+
return this.teams.createTeam(...args);
|
|
656
167
|
}
|
|
657
168
|
|
|
658
|
-
public async
|
|
659
|
-
return this.
|
|
169
|
+
public async updateTeam(...args: Parameters<TeamModule['updateTeam']>) {
|
|
170
|
+
return this.teams.updateTeam(...args);
|
|
660
171
|
}
|
|
661
172
|
|
|
662
|
-
public async
|
|
663
|
-
|
|
664
|
-
return this.request<TemplateCategory>(urls.templateCategories, 'POST', dto);
|
|
173
|
+
public async addUserToTeam(...args: Parameters<TeamModule['addUserToTeam']>) {
|
|
174
|
+
return this.teams.addUserToTeam(...args);
|
|
665
175
|
}
|
|
666
176
|
|
|
667
|
-
public async
|
|
668
|
-
|
|
669
|
-
return this.request<TemplateCategory>(`${urls.templateCategories}/${id}`, 'PATCH', dto);
|
|
177
|
+
public async removeUserFromTeam(...args: Parameters<TeamModule['removeUserFromTeam']>) {
|
|
178
|
+
return this.teams.removeUserFromTeam(...args);
|
|
670
179
|
}
|
|
671
180
|
|
|
672
|
-
public async
|
|
673
|
-
|
|
181
|
+
public async getTeams(...args: Parameters<TeamModule['getTeams']>) {
|
|
182
|
+
return this.teams.getTeams(...args);
|
|
674
183
|
}
|
|
675
184
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
185
|
+
public async getTeam(...args: Parameters<TeamModule['getTeam']>) {
|
|
186
|
+
return this.teams.getTeam(...args);
|
|
187
|
+
}
|
|
679
188
|
|
|
680
|
-
public async
|
|
681
|
-
return this.
|
|
189
|
+
public async getTeamsByOrganization(...args: Parameters<TeamModule['getTeamsByOrganization']>) {
|
|
190
|
+
return this.teams.getTeamsByOrganization(...args);
|
|
682
191
|
}
|
|
683
192
|
|
|
684
|
-
public async
|
|
685
|
-
|
|
193
|
+
public async deleteTeam(...args: Parameters<TeamModule['deleteTeam']>) {
|
|
194
|
+
return this.teams.deleteTeam(...args);
|
|
686
195
|
}
|
|
687
196
|
|
|
688
|
-
public async
|
|
689
|
-
return this.
|
|
197
|
+
public async removeUserFromTeamFixed(...args: Parameters<TeamModule['removeUserFromTeamFixed']>) {
|
|
198
|
+
return this.teams.removeUserFromTeamFixed(...args);
|
|
690
199
|
}
|
|
691
200
|
|
|
692
|
-
|
|
693
|
-
|
|
201
|
+
// Template methods
|
|
202
|
+
public async createTemplate(...args: Parameters<TemplateModule['createTemplate']>) {
|
|
203
|
+
return this.templates.createTemplate(...args);
|
|
694
204
|
}
|
|
695
205
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
206
|
+
public async updateTemplate(...args: Parameters<TemplateModule['updateTemplate']>) {
|
|
207
|
+
return this.templates.updateTemplate(...args);
|
|
208
|
+
}
|
|
699
209
|
|
|
700
|
-
public async
|
|
701
|
-
|
|
702
|
-
await this.request(urls.teamTemplates, 'POST', dto);
|
|
210
|
+
public async getTemplates(...args: Parameters<TemplateModule['getTemplates']>) {
|
|
211
|
+
return this.templates.getTemplates(...args);
|
|
703
212
|
}
|
|
704
213
|
|
|
705
|
-
public async
|
|
706
|
-
|
|
214
|
+
public async getTemplatesByOrganization(...args: Parameters<TemplateModule['getTemplatesByOrganization']>) {
|
|
215
|
+
return this.templates.getTemplatesByOrganization(...args);
|
|
707
216
|
}
|
|
708
217
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
218
|
+
public async getTemplate(...args: Parameters<TemplateModule['getTemplate']>) {
|
|
219
|
+
return this.templates.getTemplate(...args);
|
|
220
|
+
}
|
|
712
221
|
|
|
713
|
-
public async
|
|
714
|
-
return this.
|
|
222
|
+
public async deleteTemplate(...args: Parameters<TemplateModule['deleteTemplate']>) {
|
|
223
|
+
return this.templates.deleteTemplate(...args);
|
|
715
224
|
}
|
|
716
225
|
|
|
717
|
-
public async
|
|
718
|
-
return this.
|
|
226
|
+
public async createUserTemplate(...args: Parameters<TemplateModule['createUserTemplate']>) {
|
|
227
|
+
return this.templates.createUserTemplate(...args);
|
|
719
228
|
}
|
|
720
229
|
|
|
721
|
-
public async
|
|
722
|
-
return this.
|
|
230
|
+
public async updateUserTemplate(...args: Parameters<TemplateModule['updateUserTemplate']>) {
|
|
231
|
+
return this.templates.updateUserTemplate(...args);
|
|
723
232
|
}
|
|
724
233
|
|
|
725
|
-
public async
|
|
726
|
-
|
|
234
|
+
public async getUserTemplates(...args: Parameters<TemplateModule['getUserTemplates']>) {
|
|
235
|
+
return this.templates.getUserTemplates(...args);
|
|
727
236
|
}
|
|
728
237
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
238
|
+
public async getUserTemplate(...args: Parameters<TemplateModule['getUserTemplate']>) {
|
|
239
|
+
return this.templates.getUserTemplate(...args);
|
|
240
|
+
}
|
|
732
241
|
|
|
733
|
-
public async
|
|
734
|
-
|
|
242
|
+
public async deleteUserTemplate(...args: Parameters<TemplateModule['deleteUserTemplate']>) {
|
|
243
|
+
return this.templates.deleteUserTemplate(...args);
|
|
735
244
|
}
|
|
736
245
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
246
|
+
public async getTemplateCategories(...args: Parameters<TemplateModule['getTemplateCategories']>) {
|
|
247
|
+
return this.templates.getTemplateCategories(...args);
|
|
248
|
+
}
|
|
740
249
|
|
|
741
|
-
public async
|
|
742
|
-
return this.
|
|
250
|
+
public async getTemplateCategory(...args: Parameters<TemplateModule['getTemplateCategory']>) {
|
|
251
|
+
return this.templates.getTemplateCategory(...args);
|
|
743
252
|
}
|
|
744
253
|
|
|
745
|
-
public async
|
|
746
|
-
return this.
|
|
254
|
+
public async createTemplateCategory(...args: Parameters<TemplateModule['createTemplateCategory']>) {
|
|
255
|
+
return this.templates.createTemplateCategory(...args);
|
|
747
256
|
}
|
|
748
257
|
|
|
749
|
-
public async
|
|
750
|
-
return this.
|
|
258
|
+
public async updateTemplateCategory(...args: Parameters<TemplateModule['updateTemplateCategory']>) {
|
|
259
|
+
return this.templates.updateTemplateCategory(...args);
|
|
751
260
|
}
|
|
752
261
|
|
|
753
|
-
public async
|
|
754
|
-
return this.
|
|
262
|
+
public async deleteTemplateCategory(...args: Parameters<TemplateModule['deleteTemplateCategory']>) {
|
|
263
|
+
return this.templates.deleteTemplateCategory(...args);
|
|
755
264
|
}
|
|
756
265
|
|
|
757
|
-
public async
|
|
758
|
-
return this.
|
|
266
|
+
public async assignTemplateToTeam(...args: Parameters<TemplateModule['assignTemplateToTeam']>) {
|
|
267
|
+
return this.templates.assignTemplateToTeam(...args);
|
|
759
268
|
}
|
|
760
269
|
|
|
761
|
-
public async
|
|
762
|
-
return this.
|
|
270
|
+
public async removeTemplateFromTeam(...args: Parameters<TemplateModule['removeTemplateFromTeam']>) {
|
|
271
|
+
return this.templates.removeTemplateFromTeam(...args);
|
|
763
272
|
}
|
|
764
273
|
|
|
765
|
-
public async
|
|
766
|
-
|
|
274
|
+
public async generateTranscriptionSummary(...args: Parameters<TemplateModule['generateTranscriptionSummary']>) {
|
|
275
|
+
return this.templates.generateTranscriptionSummary(...args);
|
|
767
276
|
}
|
|
768
277
|
|
|
769
|
-
public async
|
|
770
|
-
return this.
|
|
278
|
+
public async generateTranscriptionSummaryFromUserTemplate(...args: Parameters<TemplateModule['generateTranscriptionSummaryFromUserTemplate']>) {
|
|
279
|
+
return this.templates.generateTranscriptionSummaryFromUserTemplate(...args);
|
|
771
280
|
}
|
|
772
281
|
|
|
773
|
-
public async
|
|
774
|
-
return this.
|
|
282
|
+
public async updateTranscriptionSummary(...args: Parameters<TemplateModule['updateTranscriptionSummary']>) {
|
|
283
|
+
return this.templates.updateTranscriptionSummary(...args);
|
|
775
284
|
}
|
|
776
285
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
286
|
+
public async getTranscriptionSummaries(...args: Parameters<TemplateModule['getTranscriptionSummaries']>) {
|
|
287
|
+
return this.templates.getTranscriptionSummaries(...args);
|
|
288
|
+
}
|
|
780
289
|
|
|
781
|
-
public async
|
|
782
|
-
|
|
783
|
-
return this.request<Agent>(urls.agents, 'POST', dto);
|
|
290
|
+
public async getTranscriptionSummary(...args: Parameters<TemplateModule['getTranscriptionSummary']>) {
|
|
291
|
+
return this.templates.getTranscriptionSummary(...args);
|
|
784
292
|
}
|
|
785
293
|
|
|
786
|
-
public async
|
|
787
|
-
return this.
|
|
294
|
+
public async getTranscriptionSummariesByUser(...args: Parameters<TemplateModule['getTranscriptionSummariesByUser']>) {
|
|
295
|
+
return this.templates.getTranscriptionSummariesByUser(...args);
|
|
788
296
|
}
|
|
789
297
|
|
|
790
|
-
public async
|
|
791
|
-
return this.
|
|
298
|
+
public async getByOrganizationTranscriptionSummaries(...args: Parameters<TemplateModule['getByOrganizationTranscriptionSummaries']>) {
|
|
299
|
+
return this.templates.getByOrganizationTranscriptionSummaries(...args);
|
|
792
300
|
}
|
|
793
301
|
|
|
794
|
-
public async
|
|
795
|
-
|
|
796
|
-
return this.request<Agent>(`${urls.agents}/${id}`, 'PATCH', dto);
|
|
302
|
+
public async deleteTranscriptionSummary(...args: Parameters<TemplateModule['deleteTranscriptionSummary']>) {
|
|
303
|
+
return this.templates.deleteTranscriptionSummary(...args);
|
|
797
304
|
}
|
|
798
305
|
|
|
799
|
-
public async
|
|
800
|
-
|
|
306
|
+
public async uploadLargeAudioFile(...args: Parameters<TemplateModule['uploadLargeAudioFile']>) {
|
|
307
|
+
return this.templates.uploadLargeAudioFile(...args);
|
|
801
308
|
}
|
|
802
309
|
|
|
803
|
-
public async
|
|
804
|
-
|
|
310
|
+
public async uploadAudioFile(...args: Parameters<TemplateModule['uploadAudioFile']>) {
|
|
311
|
+
return this.templates.uploadAudioFile(...args);
|
|
805
312
|
}
|
|
806
313
|
|
|
807
|
-
public async
|
|
808
|
-
|
|
314
|
+
public async transcribeBase64Audio(...args: Parameters<TemplateModule['transcribeBase64Audio']>) {
|
|
315
|
+
return this.templates.transcribeBase64Audio(...args);
|
|
809
316
|
}
|
|
810
317
|
|
|
811
|
-
//
|
|
812
|
-
|
|
813
|
-
|
|
318
|
+
// Session methods
|
|
319
|
+
public async createSession(...args: Parameters<SessionModule['createSession']>) {
|
|
320
|
+
return this.sessions.createSession(...args);
|
|
321
|
+
}
|
|
814
322
|
|
|
815
|
-
public async
|
|
816
|
-
return this.
|
|
323
|
+
public async getSessions(...args: Parameters<SessionModule['getSessions']>) {
|
|
324
|
+
return this.sessions.getSessions(...args);
|
|
817
325
|
}
|
|
818
326
|
|
|
819
|
-
public async
|
|
820
|
-
|
|
821
|
-
if (organizationId) params.append('organizationId', organizationId);
|
|
822
|
-
if (agentId) params.append('agentId', agentId);
|
|
823
|
-
|
|
824
|
-
const queryString = params.toString();
|
|
825
|
-
const endpoint = queryString ? `${urls.agentSettings}?${queryString}` : urls.agentSettings;
|
|
826
|
-
|
|
827
|
-
return this.request<AgentSettings[]>(endpoint, 'GET');
|
|
327
|
+
public async getSession(...args: Parameters<SessionModule['getSession']>) {
|
|
328
|
+
return this.sessions.getSession(...args);
|
|
828
329
|
}
|
|
829
330
|
|
|
830
|
-
public async
|
|
831
|
-
return this.
|
|
331
|
+
public async getSessionsByUser(...args: Parameters<SessionModule['getSessionsByUser']>) {
|
|
332
|
+
return this.sessions.getSessionsByUser(...args);
|
|
832
333
|
}
|
|
833
334
|
|
|
834
|
-
public async
|
|
835
|
-
return this.
|
|
335
|
+
public async getSessionsByOrganization(...args: Parameters<SessionModule['getSessionsByOrganization']>) {
|
|
336
|
+
return this.sessions.getSessionsByOrganization(...args);
|
|
836
337
|
}
|
|
837
338
|
|
|
838
|
-
public async
|
|
839
|
-
return this.
|
|
339
|
+
public async updateSession(...args: Parameters<SessionModule['updateSession']>) {
|
|
340
|
+
return this.sessions.updateSession(...args);
|
|
840
341
|
}
|
|
841
342
|
|
|
842
|
-
public async
|
|
843
|
-
|
|
343
|
+
public async deleteSession(...args: Parameters<SessionModule['deleteSession']>) {
|
|
344
|
+
return this.sessions.deleteSession(...args);
|
|
844
345
|
}
|
|
845
346
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
347
|
+
public async setPrimaryTranscriptionSummary(...args: Parameters<SessionModule['setPrimaryTranscriptionSummary']>) {
|
|
348
|
+
return this.sessions.setPrimaryTranscriptionSummary(...args);
|
|
349
|
+
}
|
|
849
350
|
|
|
850
|
-
public async
|
|
851
|
-
|
|
852
|
-
formData.append('file', file, fileName);
|
|
853
|
-
|
|
854
|
-
if (culturalTranscription) {
|
|
855
|
-
formData.append('cultural_transcription', culturalTranscription);
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
return this.fileUploadRequest<AudioFile>(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
351
|
+
public async rerunTranscription(...args: Parameters<SessionModule['rerunTranscription']>) {
|
|
352
|
+
return this.sessions.rerunTranscription(...args);
|
|
859
353
|
}
|
|
860
354
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
if (options?.culturalTranscription) {
|
|
866
|
-
formData.append('cultural_transcription', options.culturalTranscription);
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
// This will automatically trigger the transcription queue
|
|
870
|
-
return this.fileUploadRequest<AudioFile>(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
355
|
+
// Agent methods
|
|
356
|
+
public async createAgent(...args: Parameters<AgentModule['createAgent']>) {
|
|
357
|
+
return this.agents.createAgent(...args);
|
|
871
358
|
}
|
|
872
359
|
|
|
873
|
-
public async
|
|
874
|
-
return this.
|
|
360
|
+
public async getAgents(...args: Parameters<AgentModule['getAgents']>) {
|
|
361
|
+
return this.agents.getAgents(...args);
|
|
875
362
|
}
|
|
876
363
|
|
|
877
|
-
public async
|
|
878
|
-
return this.
|
|
364
|
+
public async getAgent(...args: Parameters<AgentModule['getAgent']>) {
|
|
365
|
+
return this.agents.getAgent(...args);
|
|
879
366
|
}
|
|
880
367
|
|
|
881
|
-
public async
|
|
882
|
-
return this.
|
|
368
|
+
public async updateAgent(...args: Parameters<AgentModule['updateAgent']>) {
|
|
369
|
+
return this.agents.updateAgent(...args);
|
|
883
370
|
}
|
|
884
371
|
|
|
885
|
-
public async
|
|
886
|
-
return this.
|
|
372
|
+
public async deleteAgent(...args: Parameters<AgentModule['deleteAgent']>) {
|
|
373
|
+
return this.agents.deleteAgent(...args);
|
|
887
374
|
}
|
|
888
375
|
|
|
889
|
-
public async
|
|
890
|
-
return this.
|
|
376
|
+
public async addAgentToOrganization(...args: Parameters<AgentModule['addAgentToOrganization']>) {
|
|
377
|
+
return this.agents.addAgentToOrganization(...args);
|
|
891
378
|
}
|
|
892
379
|
|
|
893
|
-
public async
|
|
894
|
-
return this.
|
|
380
|
+
public async removeAgentFromOrganization(...args: Parameters<AgentModule['removeAgentFromOrganization']>) {
|
|
381
|
+
return this.agents.removeAgentFromOrganization(...args);
|
|
895
382
|
}
|
|
896
383
|
|
|
897
|
-
public async
|
|
898
|
-
|
|
384
|
+
public async createAgentSettings(...args: Parameters<AgentModule['createAgentSettings']>) {
|
|
385
|
+
return this.agents.createAgentSettings(...args);
|
|
899
386
|
}
|
|
900
387
|
|
|
901
|
-
public async
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
// Get token first
|
|
906
|
-
await this.getToken();
|
|
907
|
-
|
|
908
|
-
const defaultHeaders: Record<string, string> = {
|
|
909
|
-
'ngrok-skip-browser-warning': 'true'
|
|
910
|
-
};
|
|
388
|
+
public async getAgentSettings(...args: Parameters<AgentModule['getAgentSettings']>) {
|
|
389
|
+
return this.agents.getAgentSettings(...args);
|
|
390
|
+
}
|
|
911
391
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
392
|
+
public async getAgentSettingsById(...args: Parameters<AgentModule['getAgentSettingsById']>) {
|
|
393
|
+
return this.agents.getAgentSettingsById(...args);
|
|
394
|
+
}
|
|
915
395
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
});
|
|
396
|
+
public async getAgentSettingsByAgentAndOrganization(...args: Parameters<AgentModule['getAgentSettingsByAgentAndOrganization']>) {
|
|
397
|
+
return this.agents.getAgentSettingsByAgentAndOrganization(...args);
|
|
398
|
+
}
|
|
920
399
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
errorData.message || `Download failed with status ${response.status}`
|
|
925
|
-
);
|
|
926
|
-
}
|
|
400
|
+
public async updateAgentSettings(...args: Parameters<AgentModule['updateAgentSettings']>) {
|
|
401
|
+
return this.agents.updateAgentSettings(...args);
|
|
402
|
+
}
|
|
927
403
|
|
|
928
|
-
|
|
404
|
+
public async deleteAgentSettings(...args: Parameters<AgentModule['deleteAgentSettings']>) {
|
|
405
|
+
return this.agents.deleteAgentSettings(...args);
|
|
929
406
|
}
|
|
930
407
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
return
|
|
408
|
+
// Audio methods
|
|
409
|
+
public async uploadAudioFileToSession(...args: Parameters<AudioModule['uploadAudioFileToSession']>) {
|
|
410
|
+
return this.audio.uploadAudioFileToSession(...args);
|
|
934
411
|
}
|
|
935
412
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
413
|
+
public async uploadAudioFileWithTranscriptionQueue(...args: Parameters<AudioModule['uploadAudioFileWithTranscriptionQueue']>) {
|
|
414
|
+
return this.audio.uploadAudioFileWithTranscriptionQueue(...args);
|
|
415
|
+
}
|
|
939
416
|
|
|
940
|
-
public async
|
|
941
|
-
|
|
942
|
-
return audioFiles.filter(file => file.status === AudioFileStatus.TRANSCRIBED && file.transcription);
|
|
417
|
+
public async getMyAudioFiles(...args: Parameters<AudioModule['getMyAudioFiles']>) {
|
|
418
|
+
return this.audio.getMyAudioFiles(...args);
|
|
943
419
|
}
|
|
944
420
|
|
|
945
|
-
public async
|
|
946
|
-
|
|
947
|
-
return audioFiles.filter(file => file.status === AudioFileStatus.PROCESSING);
|
|
421
|
+
public async getAllAudioFiles(...args: Parameters<AudioModule['getAllAudioFiles']>) {
|
|
422
|
+
return this.audio.getAllAudioFiles(...args);
|
|
948
423
|
}
|
|
949
424
|
|
|
950
|
-
public async
|
|
951
|
-
|
|
952
|
-
return audioFiles.filter(file => file.status === AudioFileStatus.FAILED);
|
|
425
|
+
public async getOrganizationAudioFiles(...args: Parameters<AudioModule['getOrganizationAudioFiles']>) {
|
|
426
|
+
return this.audio.getOrganizationAudioFiles(...args);
|
|
953
427
|
}
|
|
954
428
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
429
|
+
public async getAudioFilesBySession(...args: Parameters<AudioModule['getAudioFilesBySession']>) {
|
|
430
|
+
return this.audio.getAudioFilesBySession(...args);
|
|
431
|
+
}
|
|
958
432
|
|
|
959
|
-
public async
|
|
960
|
-
return this.
|
|
433
|
+
public async getAudioFile(...args: Parameters<AudioModule['getAudioFile']>) {
|
|
434
|
+
return this.audio.getAudioFile(...args);
|
|
961
435
|
}
|
|
962
436
|
|
|
963
|
-
public async
|
|
964
|
-
return this.
|
|
437
|
+
public async updateAudioFile(...args: Parameters<AudioModule['updateAudioFile']>) {
|
|
438
|
+
return this.audio.updateAudioFile(...args);
|
|
965
439
|
}
|
|
966
440
|
|
|
967
|
-
public async
|
|
968
|
-
return this.
|
|
441
|
+
public async deleteAudioFile(...args: Parameters<AudioModule['deleteAudioFile']>) {
|
|
442
|
+
return this.audio.deleteAudioFile(...args);
|
|
969
443
|
}
|
|
970
444
|
|
|
971
|
-
public async
|
|
972
|
-
return this.
|
|
445
|
+
public async downloadAudioFile(...args: Parameters<AudioModule['downloadAudioFile']>) {
|
|
446
|
+
return this.audio.downloadAudioFile(...args);
|
|
973
447
|
}
|
|
974
448
|
|
|
975
|
-
public async
|
|
976
|
-
return this.
|
|
449
|
+
public async downloadAudioFileAsUrl(...args: Parameters<AudioModule['downloadAudioFileAsUrl']>) {
|
|
450
|
+
return this.audio.downloadAudioFileAsUrl(...args);
|
|
977
451
|
}
|
|
978
452
|
|
|
979
|
-
public async
|
|
980
|
-
|
|
453
|
+
public async getTranscribedAudioFiles(...args: Parameters<AudioModule['getTranscribedAudioFiles']>) {
|
|
454
|
+
return this.audio.getTranscribedAudioFiles(...args);
|
|
981
455
|
}
|
|
982
456
|
|
|
983
|
-
public async
|
|
984
|
-
return this.
|
|
457
|
+
public async getProcessingAudioFiles(...args: Parameters<AudioModule['getProcessingAudioFiles']>) {
|
|
458
|
+
return this.audio.getProcessingAudioFiles(...args);
|
|
985
459
|
}
|
|
986
460
|
|
|
987
|
-
public async
|
|
988
|
-
return this.
|
|
461
|
+
public async getFailedAudioFiles(...args: Parameters<AudioModule['getFailedAudioFiles']>) {
|
|
462
|
+
return this.audio.getFailedAudioFiles(...args);
|
|
989
463
|
}
|
|
990
464
|
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
465
|
+
public async createBase64AudioFile(...args: Parameters<AudioModule['createBase64AudioFile']>) {
|
|
466
|
+
return this.audio.createBase64AudioFile(...args);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
public async getAllBase64AudioFiles(...args: Parameters<AudioModule['getAllBase64AudioFiles']>) {
|
|
470
|
+
return this.audio.getAllBase64AudioFiles(...args);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
public async getBase64AudioFilesBySession(...args: Parameters<AudioModule['getBase64AudioFilesBySession']>) {
|
|
474
|
+
return this.audio.getBase64AudioFilesBySession(...args);
|
|
475
|
+
}
|
|
994
476
|
|
|
995
|
-
public async
|
|
996
|
-
|
|
997
|
-
name,
|
|
998
|
-
organizationId: organizationId || this.user!.organizationId,
|
|
999
|
-
};
|
|
1000
|
-
return this.request<Workflow>(urls.workflows, 'POST', dto);
|
|
477
|
+
public async getBase64AudioFile(...args: Parameters<AudioModule['getBase64AudioFile']>) {
|
|
478
|
+
return this.audio.getBase64AudioFile(...args);
|
|
1001
479
|
}
|
|
1002
480
|
|
|
1003
|
-
public async
|
|
1004
|
-
|
|
1005
|
-
return this.request<Workflow[]>(`${urls.workflows}${params}`, 'GET');
|
|
481
|
+
public async updateBase64AudioFile(...args: Parameters<AudioModule['updateBase64AudioFile']>) {
|
|
482
|
+
return this.audio.updateBase64AudioFile(...args);
|
|
1006
483
|
}
|
|
1007
484
|
|
|
1008
|
-
public async
|
|
1009
|
-
return this.
|
|
485
|
+
public async deleteBase64AudioFile(...args: Parameters<AudioModule['deleteBase64AudioFile']>) {
|
|
486
|
+
return this.audio.deleteBase64AudioFile(...args);
|
|
1010
487
|
}
|
|
1011
488
|
|
|
1012
|
-
public async
|
|
1013
|
-
|
|
1014
|
-
return this.request<Workflow[]>(`${urls.workflows}?organizationId=${orgId}`, 'GET');
|
|
489
|
+
public async addBase64Chunk(...args: Parameters<AudioModule['addBase64Chunk']>) {
|
|
490
|
+
return this.audio.addBase64Chunk(...args);
|
|
1015
491
|
}
|
|
1016
492
|
|
|
1017
|
-
public async
|
|
1018
|
-
|
|
1019
|
-
name,
|
|
1020
|
-
organizationId: organizationId || this.user!.organizationId,
|
|
1021
|
-
};
|
|
1022
|
-
return this.request<Workflow>(`${urls.workflows}/${id}`, 'PATCH', dto);
|
|
493
|
+
public async queueSessionBase64AudioForTranscription(...args: Parameters<AudioModule['queueSessionBase64AudioForTranscription']>) {
|
|
494
|
+
return this.audio.queueSessionBase64AudioForTranscription(...args);
|
|
1023
495
|
}
|
|
1024
496
|
|
|
1025
|
-
|
|
1026
|
-
|
|
497
|
+
// Workflow methods
|
|
498
|
+
public async createWorkflow(...args: Parameters<WorkflowModule['createWorkflow']>) {
|
|
499
|
+
return this.workflows.createWorkflow(...args);
|
|
1027
500
|
}
|
|
1028
501
|
|
|
1029
|
-
|
|
502
|
+
public async getWorkflows(...args: Parameters<WorkflowModule['getWorkflows']>) {
|
|
503
|
+
return this.workflows.getWorkflows(...args);
|
|
504
|
+
}
|
|
1030
505
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
public async getLogs(filters?: FilterLogsDto): Promise<LogsResponse> {
|
|
1035
|
-
const params = new URLSearchParams();
|
|
506
|
+
public async getWorkflow(...args: Parameters<WorkflowModule['getWorkflow']>) {
|
|
507
|
+
return this.workflows.getWorkflow(...args);
|
|
508
|
+
}
|
|
1036
509
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
params.append(key, value.toString());
|
|
1041
|
-
}
|
|
1042
|
-
});
|
|
1043
|
-
}
|
|
510
|
+
public async getWorkflowsByOrganization(...args: Parameters<WorkflowModule['getWorkflowsByOrganization']>) {
|
|
511
|
+
return this.workflows.getWorkflowsByOrganization(...args);
|
|
512
|
+
}
|
|
1044
513
|
|
|
1045
|
-
|
|
1046
|
-
|
|
514
|
+
public async updateWorkflow(...args: Parameters<WorkflowModule['updateWorkflow']>) {
|
|
515
|
+
return this.workflows.updateWorkflow(...args);
|
|
516
|
+
}
|
|
1047
517
|
|
|
1048
|
-
|
|
518
|
+
public async deleteWorkflow(...args: Parameters<WorkflowModule['deleteWorkflow']>) {
|
|
519
|
+
return this.workflows.deleteWorkflow(...args);
|
|
1049
520
|
}
|
|
1050
521
|
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
const params = new URLSearchParams();
|
|
1056
|
-
if (limit !== undefined) params.append('limit', limit.toString());
|
|
1057
|
-
if (offset !== undefined) params.append('offset', offset.toString());
|
|
522
|
+
// Log methods
|
|
523
|
+
public async getLogs(...args: Parameters<LogModule['getLogs']>) {
|
|
524
|
+
return this.logs.getLogs(...args);
|
|
525
|
+
}
|
|
1058
526
|
|
|
1059
|
-
|
|
1060
|
-
|
|
527
|
+
public async getLogsByUser(...args: Parameters<LogModule['getLogsByUser']>) {
|
|
528
|
+
return this.logs.getLogsByUser(...args);
|
|
529
|
+
}
|
|
1061
530
|
|
|
1062
|
-
|
|
531
|
+
public async getLogsByController(...args: Parameters<LogModule['getLogsByController']>) {
|
|
532
|
+
return this.logs.getLogsByController(...args);
|
|
1063
533
|
}
|
|
1064
534
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
public async getLogsByController(controller: string, limit?: number, offset?: number): Promise<LogsResponse> {
|
|
1069
|
-
const params = new URLSearchParams();
|
|
1070
|
-
if (limit !== undefined) params.append('limit', limit.toString());
|
|
1071
|
-
if (offset !== undefined) params.append('offset', offset.toString());
|
|
535
|
+
public async getMyLogs(...args: Parameters<LogModule['getMyLogs']>) {
|
|
536
|
+
return this.logs.getMyLogs(...args);
|
|
537
|
+
}
|
|
1072
538
|
|
|
1073
|
-
|
|
1074
|
-
|
|
539
|
+
public async getLogsByDateRange(...args: Parameters<LogModule['getLogsByDateRange']>) {
|
|
540
|
+
return this.logs.getLogsByDateRange(...args);
|
|
541
|
+
}
|
|
1075
542
|
|
|
1076
|
-
|
|
543
|
+
public async getLogStats(...args: Parameters<LogModule['getLogStats']>) {
|
|
544
|
+
return this.logs.getLogStats(...args);
|
|
1077
545
|
}
|
|
1078
546
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
public async getMyLogs(limit?: number, offset?: number): Promise<LogsResponse> {
|
|
1083
|
-
const params = new URLSearchParams();
|
|
1084
|
-
if (limit !== undefined) params.append('limit', limit.toString());
|
|
1085
|
-
if (offset !== undefined) params.append('offset', offset.toString());
|
|
547
|
+
public async createLog(...args: Parameters<LogModule['createLog']>) {
|
|
548
|
+
return this.logs.createLog(...args);
|
|
549
|
+
}
|
|
1086
550
|
|
|
1087
|
-
|
|
1088
|
-
|
|
551
|
+
public async logInfo(...args: Parameters<LogModule['logInfo']>) {
|
|
552
|
+
return this.logs.logInfo(...args);
|
|
553
|
+
}
|
|
1089
554
|
|
|
1090
|
-
|
|
555
|
+
public async logError(...args: Parameters<LogModule['logError']>) {
|
|
556
|
+
return this.logs.logError(...args);
|
|
1091
557
|
}
|
|
1092
558
|
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
public async getLogsByDateRange(
|
|
1097
|
-
startDate: string,
|
|
1098
|
-
endDate: string,
|
|
1099
|
-
limit?: number,
|
|
1100
|
-
offset?: number
|
|
1101
|
-
): Promise<LogsResponse> {
|
|
1102
|
-
const params = new URLSearchParams();
|
|
1103
|
-
params.append('startDate', startDate);
|
|
1104
|
-
params.append('endDate', endDate);
|
|
1105
|
-
if (limit !== undefined) params.append('limit', limit.toString());
|
|
1106
|
-
if (offset !== undefined) params.append('offset', offset.toString());
|
|
559
|
+
public async logWarn(...args: Parameters<LogModule['logWarn']>) {
|
|
560
|
+
return this.logs.logWarn(...args);
|
|
561
|
+
}
|
|
1107
562
|
|
|
1108
|
-
|
|
563
|
+
public async logDebug(...args: Parameters<LogModule['logDebug']>) {
|
|
564
|
+
return this.logs.logDebug(...args);
|
|
1109
565
|
}
|
|
1110
566
|
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
*/
|
|
1114
|
-
public async getLogStats(): Promise<LogStats> {
|
|
1115
|
-
return this.request<LogStats>(`${urls.logs}/stats`, 'GET');
|
|
567
|
+
public async getLogsByRole(...args: Parameters<LogModule['getLogsByRole']>) {
|
|
568
|
+
return this.logs.getLogsByRole(...args);
|
|
1116
569
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
*/
|
|
1121
|
-
public async createLog(logData: CreateLogDto): Promise<Log> {
|
|
1122
|
-
return this.request<Log>(urls.logs, 'POST', logData);
|
|
570
|
+
|
|
571
|
+
public async getLogsByOrganizationRole(...args: Parameters<LogModule['getLogsByOrganizationRole']>) {
|
|
572
|
+
return this.logs.getLogsByOrganizationRole(...args);
|
|
1123
573
|
}
|
|
1124
574
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
public async
|
|
1139
|
-
return this.
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
public async
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
const queryString = params.toString();
|
|
1177
|
-
const url = queryString ? `${urls.logs}/role/${role}?${queryString}` : `${urls.logs}/role/${role}`;
|
|
1178
|
-
|
|
1179
|
-
return this.request<LogsResponse>(url, 'GET');
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
/**
|
|
1183
|
-
* Get logs by organization role
|
|
1184
|
-
*/
|
|
1185
|
-
public async getLogsByOrganizationRole(organizationRole: string, limit?: number, offset?: number): Promise<LogsResponse> {
|
|
1186
|
-
const params = new URLSearchParams();
|
|
1187
|
-
if (limit !== undefined) params.append('limit', limit.toString());
|
|
1188
|
-
if (offset !== undefined) params.append('offset', offset.toString());
|
|
1189
|
-
|
|
1190
|
-
const queryString = params.toString();
|
|
1191
|
-
const url = queryString ? `${urls.logs}/organization-role/${organizationRole}?${queryString}` : `${urls.logs}/organization-role/${organizationRole}`;
|
|
1192
|
-
|
|
1193
|
-
return this.request<LogsResponse>(url, 'GET');
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
/**
|
|
1197
|
-
* Get logs by team role
|
|
1198
|
-
*/
|
|
1199
|
-
public async getLogsByTeamRole(teamRole: string, limit?: number, offset?: number): Promise<LogsResponse> {
|
|
1200
|
-
const params = new URLSearchParams();
|
|
1201
|
-
if (limit !== undefined) params.append('limit', limit.toString());
|
|
1202
|
-
if (offset !== undefined) params.append('offset', offset.toString());
|
|
1203
|
-
|
|
1204
|
-
const queryString = params.toString();
|
|
1205
|
-
const url = queryString ? `${urls.logs}/team-role/${teamRole}?${queryString}` : `${urls.logs}/team-role/${teamRole}`;
|
|
1206
|
-
|
|
1207
|
-
return this.request<LogsResponse>(url, 'GET');
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
/**
|
|
1211
|
-
* Get available roles for filtering
|
|
1212
|
-
*/
|
|
1213
|
-
public async getAvailableRoles(): Promise<{
|
|
1214
|
-
roles: string[];
|
|
1215
|
-
organizationRoles: string[];
|
|
1216
|
-
teamRoles: string[];
|
|
1217
|
-
}> {
|
|
1218
|
-
return this.request<{
|
|
1219
|
-
roles: string[];
|
|
1220
|
-
organizationRoles: string[];
|
|
1221
|
-
teamRoles: string[];
|
|
1222
|
-
}>(`${urls.logs}/available-roles`, 'GET');
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
/**
|
|
1226
|
-
* Get logs for a specific session ID
|
|
1227
|
-
* Searches both log messages and meta data for the session ID
|
|
1228
|
-
*/
|
|
1229
|
-
public async getSessionLogs(sessionId: string, limit?: number, offset?: number): Promise<LogsResponse> {
|
|
1230
|
-
const params = new URLSearchParams();
|
|
1231
|
-
if (limit !== undefined) params.append('limit', limit.toString());
|
|
1232
|
-
if (offset !== undefined) params.append('offset', offset.toString());
|
|
1233
|
-
|
|
1234
|
-
const queryString = params.toString();
|
|
1235
|
-
const url = queryString ? `${urls.logs}/session/${sessionId}?${queryString}` : `${urls.logs}/session/${sessionId}`;
|
|
1236
|
-
|
|
1237
|
-
return this.request<LogsResponse>(url, 'GET');
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
// ===== DEBUG METHODS =====
|
|
1241
|
-
|
|
1242
|
-
/**
|
|
1243
|
-
* Get sessions that do not have medical transcriptions and primary transcription summaries
|
|
1244
|
-
* for the current user's organization
|
|
1245
|
-
*/
|
|
1246
|
-
public async getSessionsWithoutMedicalTranscriptions(): Promise<DebugSessionSummary[]> {
|
|
1247
|
-
return this.request<DebugSessionSummary[]>(`${urls.debug}/sessions/missing-medical-transcriptions`, 'GET');
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
/**
|
|
1251
|
-
* Download a session as a ZIP file containing all related data (decrypted)
|
|
1252
|
-
* Returns a Blob that can be used to create a download link
|
|
1253
|
-
*/
|
|
1254
|
-
public async downloadSessionAsZip(sessionId: string): Promise<Blob> {
|
|
1255
|
-
const url = `${this.baseUrl}${urls.debug}/sessions/${sessionId}/download`;
|
|
1256
|
-
|
|
1257
|
-
// Get token first
|
|
1258
|
-
await this.getToken();
|
|
1259
|
-
|
|
1260
|
-
const defaultHeaders: Record<string, string> = {
|
|
1261
|
-
'ngrok-skip-browser-warning': 'true'
|
|
1262
|
-
};
|
|
1263
|
-
|
|
1264
|
-
if (this.accessToken) {
|
|
1265
|
-
defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
const response = await fetch(url, {
|
|
1269
|
-
method: 'GET',
|
|
1270
|
-
headers: defaultHeaders,
|
|
1271
|
-
});
|
|
1272
|
-
|
|
1273
|
-
if (!response.ok) {
|
|
1274
|
-
const errorData = await response.json().catch(() => ({}));
|
|
1275
|
-
throw new Error(
|
|
1276
|
-
errorData.message || `Download failed with status ${response.status}`
|
|
1277
|
-
);
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
return response.blob();
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
/**
|
|
1284
|
-
* Download a session as a ZIP file and create a download URL
|
|
1285
|
-
* Returns a URL that can be used for direct download
|
|
1286
|
-
*/
|
|
1287
|
-
public async downloadSessionAsZipUrl(sessionId: string): Promise<string> {
|
|
1288
|
-
const blob = await this.downloadSessionAsZip(sessionId);
|
|
1289
|
-
return URL.createObjectURL(blob);
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
/**
|
|
1293
|
-
* Download a session as a ZIP file and trigger browser download
|
|
1294
|
-
* Optionally provide a custom filename
|
|
1295
|
-
*/
|
|
1296
|
-
public async downloadSessionAndTriggerDownload(sessionId: string, filename?: string): Promise<void> {
|
|
1297
|
-
const blob = await this.downloadSessionAsZip(sessionId);
|
|
1298
|
-
const url = URL.createObjectURL(blob);
|
|
1299
|
-
|
|
1300
|
-
// Create temporary download link and click it
|
|
1301
|
-
const link = document.createElement('a');
|
|
1302
|
-
link.href = url;
|
|
1303
|
-
link.download = filename || `session_${sessionId}_${new Date().toISOString().split('T')[0]}.zip`;
|
|
1304
|
-
document.body.appendChild(link);
|
|
1305
|
-
link.click();
|
|
1306
|
-
document.body.removeChild(link);
|
|
1307
|
-
|
|
1308
|
-
// Clean up the URL object
|
|
1309
|
-
URL.revokeObjectURL(url);
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
}
|
|
575
|
+
public async getLogsByTeamRole(...args: Parameters<LogModule['getLogsByTeamRole']>) {
|
|
576
|
+
return this.logs.getLogsByTeamRole(...args);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
public async getAvailableRoles(...args: Parameters<LogModule['getAvailableRoles']>) {
|
|
580
|
+
return this.logs.getAvailableRoles(...args);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
public async getSessionLogs(...args: Parameters<LogModule['getSessionLogs']>) {
|
|
584
|
+
return this.logs.getSessionLogs(...args);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// Debug methods
|
|
588
|
+
public async getSessionsWithoutMedicalTranscriptions(...args: Parameters<DebugModule['getSessionsWithoutMedicalTranscriptions']>) {
|
|
589
|
+
return this.debug.getSessionsWithoutMedicalTranscriptions(...args);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
public async downloadSessionAsZip(...args: Parameters<DebugModule['downloadSessionAsZip']>) {
|
|
593
|
+
return this.debug.downloadSessionAsZip(...args);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
public async downloadSessionAsZipUrl(...args: Parameters<DebugModule['downloadSessionAsZipUrl']>) {
|
|
597
|
+
return this.debug.downloadSessionAsZipUrl(...args);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
public async downloadSessionAndTriggerDownload(...args: Parameters<DebugModule['downloadSessionAndTriggerDownload']>) {
|
|
601
|
+
return this.debug.downloadSessionAndTriggerDownload(...args);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
// External Integration methods
|
|
605
|
+
public async createExternalIntegration(...args: Parameters<ExternalIntegrationModule['createExternalIntegration']>) {
|
|
606
|
+
return this.externalIntegrations.createExternalIntegration(...args);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
public async getExternalIntegrations(...args: Parameters<ExternalIntegrationModule['getExternalIntegrations']>) {
|
|
610
|
+
return this.externalIntegrations.getExternalIntegrations(...args);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
public async getExternalIntegration(...args: Parameters<ExternalIntegrationModule['getExternalIntegration']>) {
|
|
614
|
+
return this.externalIntegrations.getExternalIntegration(...args);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
public async updateExternalIntegration(...args: Parameters<ExternalIntegrationModule['updateExternalIntegration']>) {
|
|
618
|
+
return this.externalIntegrations.updateExternalIntegration(...args);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
public async deleteExternalIntegration(...args: Parameters<ExternalIntegrationModule['deleteExternalIntegration']>) {
|
|
622
|
+
return this.externalIntegrations.deleteExternalIntegration(...args);
|
|
623
|
+
}
|
|
624
|
+
}
|