whio-api-sdk 1.0.193-bet-staging → 1.0.194-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.
Files changed (94) hide show
  1. package/dist/src/sdk/modules/agent.module.d.ts +17 -0
  2. package/dist/src/sdk/modules/agent.module.js +93 -0
  3. package/dist/src/sdk/modules/audio.module.d.ts +31 -0
  4. package/dist/src/sdk/modules/audio.module.js +147 -0
  5. package/dist/src/sdk/modules/auth.module.d.ts +9 -0
  6. package/dist/src/sdk/modules/auth.module.js +59 -0
  7. package/dist/src/sdk/modules/base-client.d.ts +25 -0
  8. package/dist/src/sdk/modules/base-client.js +183 -0
  9. package/dist/src/sdk/modules/debug.module.d.ts +20 -0
  10. package/dist/src/sdk/modules/debug.module.js +54 -0
  11. package/dist/src/sdk/modules/external-integration.module.d.ts +9 -0
  12. package/dist/src/sdk/modules/external-integration.module.js +38 -0
  13. package/dist/src/sdk/modules/log.module.d.ts +63 -0
  14. package/dist/src/sdk/modules/log.module.js +222 -0
  15. package/dist/src/sdk/modules/organization.module.d.ts +11 -0
  16. package/dist/src/sdk/modules/organization.module.js +50 -0
  17. package/dist/src/sdk/modules/session.module.d.ts +16 -0
  18. package/dist/src/sdk/modules/session.module.js +58 -0
  19. package/dist/src/sdk/modules/team.module.d.ts +13 -0
  20. package/dist/src/sdk/modules/team.module.js +72 -0
  21. package/dist/src/sdk/modules/template.module.d.ts +33 -0
  22. package/dist/src/sdk/modules/template.module.js +240 -0
  23. package/dist/src/sdk/modules/user.module.d.ts +17 -0
  24. package/dist/src/sdk/modules/user.module.js +104 -0
  25. package/dist/src/sdk/modules/workflow.module.d.ts +10 -0
  26. package/dist/src/sdk/modules/workflow.module.js +53 -0
  27. package/dist/src/sdk/sdk.d.ts +167 -211
  28. package/dist/src/sdk/sdk.js +375 -869
  29. package/dist/src/sdk/sdk.old.d.ts +222 -0
  30. package/dist/src/sdk/sdk.old.js +1238 -0
  31. package/dist/src/sdk/types/agent.types.d.ts +51 -0
  32. package/dist/src/sdk/types/agent.types.js +1 -0
  33. package/dist/src/sdk/types/audio.types.d.ts +72 -0
  34. package/dist/src/sdk/types/audio.types.js +8 -0
  35. package/dist/src/sdk/types/auth.types.d.ts +21 -0
  36. package/dist/src/sdk/types/auth.types.js +1 -0
  37. package/dist/src/sdk/types/common.types.d.ts +20 -0
  38. package/dist/src/sdk/types/common.types.js +9 -0
  39. package/dist/src/sdk/types/external-integration.types.d.ts +31 -0
  40. package/dist/src/sdk/types/external-integration.types.js +1 -0
  41. package/dist/src/sdk/types/index.d.ts +12 -0
  42. package/dist/src/sdk/types/index.js +13 -0
  43. package/dist/src/sdk/types/log.types.d.ts +61 -0
  44. package/dist/src/sdk/types/log.types.js +1 -0
  45. package/dist/src/sdk/types/organization.types.d.ts +42 -0
  46. package/dist/src/sdk/types/organization.types.js +6 -0
  47. package/dist/src/sdk/types/session.types.d.ts +54 -0
  48. package/dist/src/sdk/types/session.types.js +1 -0
  49. package/dist/src/sdk/types/team.types.d.ts +39 -0
  50. package/dist/src/sdk/types/team.types.js +1 -0
  51. package/dist/src/sdk/types/template.types.d.ts +118 -0
  52. package/dist/src/sdk/types/template.types.js +1 -0
  53. package/dist/src/sdk/types/user.types.d.ts +41 -0
  54. package/dist/src/sdk/types/user.types.js +1 -0
  55. package/dist/src/sdk/types/workflow.types.d.ts +19 -0
  56. package/dist/src/sdk/types/workflow.types.js +1 -0
  57. package/dist/src/sdk/types.d.ts +1 -517
  58. package/dist/src/sdk/types.js +2 -23
  59. package/dist/src/sdk/types.old.d.ts +517 -0
  60. package/dist/src/sdk/types.old.js +23 -0
  61. package/dist/src/sdk/urls.d.ts +1 -0
  62. package/dist/src/sdk/urls.js +2 -0
  63. package/package.json +1 -1
  64. package/src/sdk/modules/agent.module.ts +74 -0
  65. package/src/sdk/modules/audio.module.ts +131 -0
  66. package/src/sdk/modules/auth.module.ts +53 -0
  67. package/src/sdk/modules/base-client.ts +214 -0
  68. package/src/sdk/modules/debug.module.ts +44 -0
  69. package/src/sdk/modules/external-integration.module.ts +50 -0
  70. package/src/sdk/modules/log.module.ts +213 -0
  71. package/src/sdk/modules/organization.module.ts +35 -0
  72. package/src/sdk/modules/session.module.ts +41 -0
  73. package/src/sdk/modules/team.module.ts +55 -0
  74. package/src/sdk/modules/template.module.ts +242 -0
  75. package/src/sdk/modules/user.module.ts +89 -0
  76. package/src/sdk/modules/workflow.module.ts +39 -0
  77. package/src/sdk/sdk.old.ts +1312 -0
  78. package/src/sdk/sdk.ts +393 -1089
  79. package/src/sdk/types/agent.types.ts +65 -0
  80. package/src/sdk/types/audio.types.ts +89 -0
  81. package/src/sdk/types/auth.types.ts +29 -0
  82. package/src/sdk/types/common.types.ts +26 -0
  83. package/src/sdk/types/external-integration.types.ts +37 -0
  84. package/src/sdk/types/index.ts +13 -0
  85. package/src/sdk/types/log.types.ts +68 -0
  86. package/src/sdk/types/organization.types.ts +55 -0
  87. package/src/sdk/types/session.types.ts +63 -0
  88. package/src/sdk/types/team.types.ts +48 -0
  89. package/src/sdk/types/template.types.ts +142 -0
  90. package/src/sdk/types/user.types.ts +50 -0
  91. package/src/sdk/types/workflow.types.ts +26 -0
  92. package/src/sdk/types.old.ts +649 -0
  93. package/src/sdk/types.ts +2 -649
  94. package/src/sdk/urls.ts +3 -0
package/src/sdk/sdk.ts CHANGED
@@ -1,1312 +1,616 @@
1
- // sdk.ts
2
- import {
3
- LoginResponse,
4
- LoginCredentials,
5
- SDKConfig,
6
- User,
7
- AssignTeamRoleDto,
8
- CreateTeamDto,
9
- UpdateTeamDto,
10
- CreateTemplateDto,
11
- UpdateTemplateDto,
12
- GenerateTranscriptionSummaryDto,
13
- UpdateTranscriptionSummaryDto,
14
- CreateTranscriptionSummaryDto,
15
- AssignOrganizationRoleDto,
16
- CreateUserTemplateDto,
17
- UpdateUserTemplateDto,
18
- CreateUserDto,
19
- UpdateUserDto,
20
- CreateOrganizationDto,
21
- UpdateOrganizationDto,
22
- CreateTemplateCategoryDto,
23
- UpdateTemplateCategoryDto,
24
- AssignTeamTemplateDto,
25
- OrganizationRoleType,
26
- RoleType,
27
- Organization,
28
- TemplateCategory,
29
- Template,
30
- Team,
31
- UserTemplate,
32
- TranscriptionSummary,
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
- this.baseUrl = config.baseUrl || '/api';
77
- this.storage = config.storage;
78
- this.initialize();
79
- }
80
-
81
- public async fetchConfig(url: string): Promise<void> {
82
- const response = await fetch(url);
83
- if (!response.ok) {
84
- throw new Error(`Failed to fetch config from ${url}`);
85
- }
86
- const conf = await response.json();
87
- this.baseUrl = conf.baseUrl || this.baseUrl;
88
- }
89
-
90
- private async getToken() {
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
- public async createUser(
284
- firstName: string, lastName: string,
285
- email: string, password: string): Promise<User> {
52
+ // ======================
53
+ // BACKWARD COMPATIBILITY LAYER
54
+ // Delegate methods to appropriate modules to maintain existing API
55
+ // ======================
286
56
 
287
- const createUserDto: CreateUserDto = {
288
- firstName,
289
- lastName,
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
- // trANSCRIPTION SUMMARY METHODS
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
- // AUTH METHODS
550
- // ======================
66
+ public async getProfile(...args: Parameters<AuthModule['getProfile']>) {
67
+ return this.auth.getProfile(...args);
68
+ }
551
69
 
552
- public async getProfile(): Promise<User> {
553
- return this.request<User>(urls.profile, 'GET');
70
+ public async changePassword(...args: Parameters<AuthModule['changePassword']>) {
71
+ return this.auth.changePassword(...args);
554
72
  }
555
73
 
556
- public async changePassword(currentPassword: string, newPassword: string): Promise<PasswordChangeResponse> {
557
- const dto: ChangePasswordDto = {
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
- public async adminChangePassword(userId: string, newPassword: string): Promise<PasswordChangeResponse> {
565
- const dto: AdminChangePasswordDto = {
566
- userId,
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
- // ORGANIZATION METHODS
574
- // ======================
83
+ public async assignEditorToRoleToUser(...args: Parameters<UserModule['assignEditorToRoleToUser']>) {
84
+ return this.users.assignEditorToRoleToUser(...args);
85
+ }
575
86
 
576
- public async createOrganization(name: string, description?: string): Promise<Organization> {
577
- const dto: CreateOrganizationDto = { name, description };
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 getOrganizations(): Promise<Organization[]> {
582
- return this.request<Organization[]>(urls.organizations, 'GET');
91
+ public async assignDisabledToRoleToUser(...args: Parameters<UserModule['assignDisabledToRoleToUser']>) {
92
+ return this.users.assignDisabledToRoleToUser(...args);
583
93
  }
584
94
 
585
- public async getOrganization(id: string): Promise<Organization> {
586
- return this.request<Organization>(`${urls.organizations}/${id}`, 'GET');
95
+ public async createEditorUser(...args: Parameters<UserModule['createEditorUser']>) {
96
+ return this.users.createEditorUser(...args);
587
97
  }
588
98
 
589
- public async updateOrganization(id: string, name?: string, description?: string): Promise<Organization> {
590
- const dto: UpdateOrganizationDto = { name, description };
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 deleteOrganization(id: string): Promise<void> {
595
- await this.request(`${urls.organizations}/${id}`, 'DELETE');
103
+ public async createDisabledUser(...args: Parameters<UserModule['createDisabledUser']>) {
104
+ return this.users.createDisabledUser(...args);
596
105
  }
597
106
 
598
- public async addUserToOrganization(organizationId: string, userId: string): Promise<void> {
599
- await this.request(`${urls.organizations}/${organizationId}/users/${userId}`, 'POST');
107
+ public async getUsers(...args: Parameters<UserModule['getUsers']>) {
108
+ return this.users.getUsers(...args);
600
109
  }
601
110
 
602
- public async removeUserFromOrganization(organizationId: string, userId: string): Promise<void> {
603
- await this.request(`${urls.organizations}/${organizationId}/users/${userId}`, 'DELETE');
111
+ public async getUser(...args: Parameters<UserModule['getUser']>) {
112
+ return this.users.getUser(...args);
604
113
  }
605
114
 
606
- // ======================
607
- // USER METHODS
608
- // ======================
115
+ public async getUsersByOrganization(...args: Parameters<UserModule['getUsersByOrganization']>) {
116
+ return this.users.getUsersByOrganization(...args);
117
+ }
609
118
 
610
- public async getUsers(): Promise<User[]> {
611
- return this.request<User[]>(urls.users, 'GET');
119
+ public async updateUser(...args: Parameters<UserModule['updateUser']>) {
120
+ return this.users.updateUser(...args);
612
121
  }
613
122
 
614
- public async getUser(id: string): Promise<User> {
615
- return this.request<User>(`${urls.users}/${id}`, 'GET');
123
+ public async deleteUser(...args: Parameters<UserModule['deleteUser']>) {
124
+ return this.users.deleteUser(...args);
616
125
  }
617
126
 
618
- public async getUsersByOrganization(organizationId: string): Promise<User[]> {
619
- return this.request<User[]>(`${urls.users}/organization/${organizationId}`, 'GET');
127
+ // Organization methods
128
+ public async createOrganization(...args: Parameters<OrganizationModule['createOrganization']>) {
129
+ return this.organizations.createOrganization(...args);
620
130
  }
621
131
 
622
- public async updateUser(id: string, data: UpdateUserDto): Promise<User> {
623
- return this.request<User>(`${urls.users}/${id}`, 'PATCH', data);
132
+ public async getOrganizations(...args: Parameters<OrganizationModule['getOrganizations']>) {
133
+ return this.organizations.getOrganizations(...args);
624
134
  }
625
135
 
626
- public async deleteUser(id: string): Promise<void> {
627
- await this.request(`${urls.users}/${id}`, 'DELETE');
136
+ public async getOrganization(...args: Parameters<OrganizationModule['getOrganization']>) {
137
+ return this.organizations.getOrganization(...args);
628
138
  }
629
139
 
630
- // ======================
631
- // TEAM METHODS
632
- // ======================
140
+ public async updateOrganization(...args: Parameters<OrganizationModule['updateOrganization']>) {
141
+ return this.organizations.updateOrganization(...args);
142
+ }
633
143
 
634
- public async getTeams(): Promise<Team[]> {
635
- return this.request<Team[]>(urls.teams, 'GET');
144
+ public async deleteOrganization(...args: Parameters<OrganizationModule['deleteOrganization']>) {
145
+ return this.organizations.deleteOrganization(...args);
636
146
  }
637
147
 
638
- public async getTeam(id: string): Promise<Team> {
639
- return this.request<Team>(`${urls.teams}/${id}`, 'GET');
148
+ public async addUserToOrganization(...args: Parameters<OrganizationModule['addUserToOrganization']>) {
149
+ return this.organizations.addUserToOrganization(...args);
640
150
  }
641
151
 
642
- public async getTeamsByOrganization(organizationId: string): Promise<Team[]> {
643
- return this.request<Team[]>(`${urls.teams}/organization/${organizationId}`, 'GET');
152
+ public async removeUserFromOrganization(...args: Parameters<OrganizationModule['removeUserFromOrganization']>) {
153
+ return this.organizations.removeUserFromOrganization(...args);
644
154
  }
645
155
 
646
- public async deleteTeam(id: string): Promise<void> {
647
- await this.request(`${urls.teams}/${id}`, 'DELETE');
156
+ // Team methods
157
+ public async createTeam(...args: Parameters<TeamModule['createTeam']>) {
158
+ return this.teams.createTeam(...args);
648
159
  }
649
160
 
650
- // ======================
651
- // TEMPLATE CATEGORY METHODS
652
- // ======================
161
+ public async updateTeam(...args: Parameters<TeamModule['updateTeam']>) {
162
+ return this.teams.updateTeam(...args);
163
+ }
653
164
 
654
- public async getTemplateCategories(): Promise<TemplateCategory[]> {
655
- return this.request<TemplateCategory[]>(urls.templateCategories, 'GET');
165
+ public async addUserToTeam(...args: Parameters<TeamModule['addUserToTeam']>) {
166
+ return this.teams.addUserToTeam(...args);
656
167
  }
657
168
 
658
- public async getTemplateCategory(id: string): Promise<TemplateCategory> {
659
- return this.request<TemplateCategory>(`${urls.templateCategories}/${id}`, 'GET');
169
+ public async removeUserFromTeam(...args: Parameters<TeamModule['removeUserFromTeam']>) {
170
+ return this.teams.removeUserFromTeam(...args);
660
171
  }
661
172
 
662
- public async createTemplateCategory(name: string): Promise<TemplateCategory> {
663
- const dto: CreateTemplateCategoryDto = { name };
664
- return this.request<TemplateCategory>(urls.templateCategories, 'POST', dto);
173
+ public async getTeams(...args: Parameters<TeamModule['getTeams']>) {
174
+ return this.teams.getTeams(...args);
665
175
  }
666
176
 
667
- public async updateTemplateCategory(id: string, name: string): Promise<TemplateCategory> {
668
- const dto: UpdateTemplateCategoryDto = { name };
669
- return this.request<TemplateCategory>(`${urls.templateCategories}/${id}`, 'PATCH', dto);
177
+ public async getTeam(...args: Parameters<TeamModule['getTeam']>) {
178
+ return this.teams.getTeam(...args);
670
179
  }
671
180
 
672
- public async deleteTemplateCategory(id: string): Promise<void> {
673
- await this.request(`${urls.templateCategories}/${id}`, 'DELETE');
181
+ public async getTeamsByOrganization(...args: Parameters<TeamModule['getTeamsByOrganization']>) {
182
+ return this.teams.getTeamsByOrganization(...args);
674
183
  }
675
184
 
676
- // ======================
677
- // ENHANCED TEMPLATE METHODS
678
- // ======================
185
+ public async deleteTeam(...args: Parameters<TeamModule['deleteTeam']>) {
186
+ return this.teams.deleteTeam(...args);
187
+ }
679
188
 
680
- public async getTemplate(id: string): Promise<Template> {
681
- return this.request<Template>(`${urls.templates}/${id}`, 'GET');
189
+ public async removeUserFromTeamFixed(...args: Parameters<TeamModule['removeUserFromTeamFixed']>) {
190
+ return this.teams.removeUserFromTeamFixed(...args);
682
191
  }
683
192
 
684
- public async deleteTemplate(id: string): Promise<void> {
685
- await this.request(`${urls.templates}/${id}`, 'DELETE');
193
+ // Template methods
194
+ public async createTemplate(...args: Parameters<TemplateModule['createTemplate']>) {
195
+ return this.templates.createTemplate(...args);
686
196
  }
687
197
 
688
- public async getUserTemplate(id: string): Promise<UserTemplate> {
689
- return this.request<UserTemplate>(`${urls.userTemplates}/${id}`, 'GET');
198
+ public async updateTemplate(...args: Parameters<TemplateModule['updateTemplate']>) {
199
+ return this.templates.updateTemplate(...args);
690
200
  }
691
201
 
692
- public async deleteUserTemplate(id: string): Promise<void> {
693
- await this.request(`${urls.userTemplates}/${id}`, 'DELETE');
202
+ public async getTemplates(...args: Parameters<TemplateModule['getTemplates']>) {
203
+ return this.templates.getTemplates(...args);
694
204
  }
695
205
 
696
- // ======================
697
- // TEAM TEMPLATE METHODS
698
- // ======================
206
+ public async getTemplatesByOrganization(...args: Parameters<TemplateModule['getTemplatesByOrganization']>) {
207
+ return this.templates.getTemplatesByOrganization(...args);
208
+ }
699
209
 
700
- public async assignTemplateToTeam(teamId: string, templateId: string): Promise<void> {
701
- const dto: AssignTeamTemplateDto = { teamId, templateId };
702
- await this.request(urls.teamTemplates, 'POST', dto);
210
+ public async getTemplate(...args: Parameters<TemplateModule['getTemplate']>) {
211
+ return this.templates.getTemplate(...args);
703
212
  }
704
213
 
705
- public async removeTemplateFromTeam(teamId: string, templateId: string): Promise<void> {
706
- await this.request(`${urls.teamTemplates}/team/${teamId}/template/${templateId}`, 'DELETE');
214
+ public async deleteTemplate(...args: Parameters<TemplateModule['deleteTemplate']>) {
215
+ return this.templates.deleteTemplate(...args);
707
216
  }
708
217
 
709
- // ======================
710
- // TRANSCRIPTION SUMMARY METHODS
711
- // ======================
218
+ public async createUserTemplate(...args: Parameters<TemplateModule['createUserTemplate']>) {
219
+ return this.templates.createUserTemplate(...args);
220
+ }
712
221
 
713
- public async getTranscriptionSummaries(): Promise<TranscriptionSummary[]> {
714
- return this.request<TranscriptionSummary[]>(urls.transcriptionSummaries, 'GET');
222
+ public async updateUserTemplate(...args: Parameters<TemplateModule['updateUserTemplate']>) {
223
+ return this.templates.updateUserTemplate(...args);
715
224
  }
716
225
 
717
- public async getTranscriptionSummary(id: string): Promise<TranscriptionSummary> {
718
- return this.request<TranscriptionSummary>(`${urls.transcriptionSummaries}/${id}`, 'GET');
226
+ public async getUserTemplates(...args: Parameters<TemplateModule['getUserTemplates']>) {
227
+ return this.templates.getUserTemplates(...args);
719
228
  }
720
229
 
721
- public async getTranscriptionSummariesByUser(userId: string): Promise<TranscriptionSummary[]> {
722
- return this.request<TranscriptionSummary[]>(`${urls.transcriptionSummaries}/user/${userId}`, 'GET');
230
+ public async getUserTemplate(...args: Parameters<TemplateModule['getUserTemplate']>) {
231
+ return this.templates.getUserTemplate(...args);
723
232
  }
724
233
 
725
- public async deleteTranscriptionSummary(id: string): Promise<void> {
726
- await this.request(`${urls.transcriptionSummaries}/${id}`, 'DELETE');
234
+ public async deleteUserTemplate(...args: Parameters<TemplateModule['deleteUserTemplate']>) {
235
+ return this.templates.deleteUserTemplate(...args);
727
236
  }
728
237
 
729
- // ======================
730
- // ENHANCED TEAM ROLE METHODS
731
- // ======================
238
+ public async getTemplateCategories(...args: Parameters<TemplateModule['getTemplateCategories']>) {
239
+ return this.templates.getTemplateCategories(...args);
240
+ }
732
241
 
733
- public async removeUserFromTeamFixed(teamId: string, userId: string): Promise<void> {
734
- await this.request(`${urls.teamRoles}/user/${userId}/team/${teamId}`, 'DELETE');
242
+ public async getTemplateCategory(...args: Parameters<TemplateModule['getTemplateCategory']>) {
243
+ return this.templates.getTemplateCategory(...args);
735
244
  }
736
245
 
737
- // ======================
738
- // SESSION METHODS
739
- // ======================
246
+ public async createTemplateCategory(...args: Parameters<TemplateModule['createTemplateCategory']>) {
247
+ return this.templates.createTemplateCategory(...args);
248
+ }
740
249
 
741
- public async createSession(sessionData: CreateSessionDto): Promise<Session> {
742
- return this.request<Session>(urls.sessions, 'POST', sessionData);
250
+ public async updateTemplateCategory(...args: Parameters<TemplateModule['updateTemplateCategory']>) {
251
+ return this.templates.updateTemplateCategory(...args);
743
252
  }
744
253
 
745
- public async getSessions(): Promise<Session[]> {
746
- return this.request<Session[]>(`${urls.sessions}/my-sessions`, 'GET');
254
+ public async deleteTemplateCategory(...args: Parameters<TemplateModule['deleteTemplateCategory']>) {
255
+ return this.templates.deleteTemplateCategory(...args);
747
256
  }
748
257
 
749
- public async getSession(id: string): Promise<Session> {
750
- return this.request<Session>(`${urls.sessions}/${id}`, 'GET');
258
+ public async assignTemplateToTeam(...args: Parameters<TemplateModule['assignTemplateToTeam']>) {
259
+ return this.templates.assignTemplateToTeam(...args);
751
260
  }
752
261
 
753
- public async getSessionsByUser(userId: string): Promise<Session[]> {
754
- return this.request<Session[]>(`${urls.sessions}/user/${userId}`, 'GET');
262
+ public async removeTemplateFromTeam(...args: Parameters<TemplateModule['removeTemplateFromTeam']>) {
263
+ return this.templates.removeTemplateFromTeam(...args);
755
264
  }
756
265
 
757
- public async getSessionsByOrganization(): Promise<Session[]> {
758
- return this.request<Session[]>(`${urls.sessions}/organization`, 'GET');
266
+ public async generateTranscriptionSummary(...args: Parameters<TemplateModule['generateTranscriptionSummary']>) {
267
+ return this.templates.generateTranscriptionSummary(...args);
759
268
  }
760
269
 
761
- public async updateSession(id: string, sessionData: UpdateSessionDto): Promise<Session> {
762
- return this.request<Session>(`${urls.sessions}/${id}`, 'PATCH', sessionData);
270
+ public async generateTranscriptionSummaryFromUserTemplate(...args: Parameters<TemplateModule['generateTranscriptionSummaryFromUserTemplate']>) {
271
+ return this.templates.generateTranscriptionSummaryFromUserTemplate(...args);
763
272
  }
764
273
 
765
- public async deleteSession(id: string): Promise<void> {
766
- await this.request(`${urls.sessions}/${id}`, 'DELETE');
274
+ public async updateTranscriptionSummary(...args: Parameters<TemplateModule['updateTranscriptionSummary']>) {
275
+ return this.templates.updateTranscriptionSummary(...args);
767
276
  }
768
277
 
769
- public async setPrimaryTranscriptionSummary(sessionId: string, summaryId: string): Promise<Session> {
770
- return this.request<Session>(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
278
+ public async getTranscriptionSummaries(...args: Parameters<TemplateModule['getTranscriptionSummaries']>) {
279
+ return this.templates.getTranscriptionSummaries(...args);
771
280
  }
772
281
 
773
- public async rerunTranscription(sessionId: string): Promise<{ message: string; sessionId: string }> {
774
- return this.request<{ message: string; sessionId: string }>(`${urls.sessions}/${sessionId}/rerun-transcription`, 'POST');
282
+ public async getTranscriptionSummary(...args: Parameters<TemplateModule['getTranscriptionSummary']>) {
283
+ return this.templates.getTranscriptionSummary(...args);
775
284
  }
776
285
 
777
- // ======================
778
- // AGENT METHODS
779
- // ======================
286
+ public async getTranscriptionSummariesByUser(...args: Parameters<TemplateModule['getTranscriptionSummariesByUser']>) {
287
+ return this.templates.getTranscriptionSummariesByUser(...args);
288
+ }
780
289
 
781
- public async createAgent(name: string, templateTextReplacement?: string): Promise<Agent> {
782
- const dto: CreateAgentDto = { name, templateTextReplacement };
783
- return this.request<Agent>(urls.agents, 'POST', dto);
290
+ public async getByOrganizationTranscriptionSummaries(...args: Parameters<TemplateModule['getByOrganizationTranscriptionSummaries']>) {
291
+ return this.templates.getByOrganizationTranscriptionSummaries(...args);
784
292
  }
785
293
 
786
- public async getAgents(): Promise<Agent[]> {
787
- return this.request<Agent[]>(urls.agents, 'GET');
294
+ public async deleteTranscriptionSummary(...args: Parameters<TemplateModule['deleteTranscriptionSummary']>) {
295
+ return this.templates.deleteTranscriptionSummary(...args);
788
296
  }
789
297
 
790
- public async getAgent(id: string): Promise<Agent> {
791
- return this.request<Agent>(`${urls.agents}/${id}`, 'GET');
298
+ public async uploadLargeAudioFile(...args: Parameters<TemplateModule['uploadLargeAudioFile']>) {
299
+ return this.templates.uploadLargeAudioFile(...args);
792
300
  }
793
301
 
794
- public async updateAgent(id: string, name: string, templateTextReplacement?: string): Promise<Agent> {
795
- const dto: UpdateAgentDto = { name, templateTextReplacement };
796
- return this.request<Agent>(`${urls.agents}/${id}`, 'PATCH', dto);
302
+ public async uploadAudioFile(...args: Parameters<TemplateModule['uploadAudioFile']>) {
303
+ return this.templates.uploadAudioFile(...args);
797
304
  }
798
305
 
799
- public async deleteAgent(id: string): Promise<void> {
800
- await this.request(`${urls.agents}/${id}`, 'DELETE');
306
+ public async transcribeBase64Audio(...args: Parameters<TemplateModule['transcribeBase64Audio']>) {
307
+ return this.templates.transcribeBase64Audio(...args);
801
308
  }
802
309
 
803
- public async addAgentToOrganization(agentId: string, organizationId: string): Promise<void> {
804
- await this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'POST');
310
+ // Session methods
311
+ public async createSession(...args: Parameters<SessionModule['createSession']>) {
312
+ return this.sessions.createSession(...args);
805
313
  }
806
314
 
807
- public async removeAgentFromOrganization(agentId: string, organizationId: string): Promise<void> {
808
- await this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'DELETE');
315
+ public async getSessions(...args: Parameters<SessionModule['getSessions']>) {
316
+ return this.sessions.getSessions(...args);
809
317
  }
810
318
 
811
- // ======================
812
- // AGENT SETTINGS METHODS
813
- // ======================
319
+ public async getSession(...args: Parameters<SessionModule['getSession']>) {
320
+ return this.sessions.getSession(...args);
321
+ }
814
322
 
815
- public async createAgentSettings(settingsData: CreateAgentSettingsDto): Promise<AgentSettings> {
816
- return this.request<AgentSettings>(urls.agentSettings, 'POST', settingsData);
323
+ public async getSessionsByUser(...args: Parameters<SessionModule['getSessionsByUser']>) {
324
+ return this.sessions.getSessionsByUser(...args);
817
325
  }
818
326
 
819
- public async getAgentSettings(organizationId?: string, agentId?: string): Promise<AgentSettings[]> {
820
- const params = new URLSearchParams();
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 getSessionsByOrganization(...args: Parameters<SessionModule['getSessionsByOrganization']>) {
328
+ return this.sessions.getSessionsByOrganization(...args);
828
329
  }
829
330
 
830
- public async getAgentSettingsById(id: string): Promise<AgentSettings> {
831
- return this.request<AgentSettings>(`${urls.agentSettings}/${id}`, 'GET');
331
+ public async updateSession(...args: Parameters<SessionModule['updateSession']>) {
332
+ return this.sessions.updateSession(...args);
832
333
  }
833
334
 
834
- public async getAgentSettingsByAgentAndOrganization(agentId: string, organizationId: string): Promise<AgentSettings> {
835
- return this.request<AgentSettings>(`${urls.agentSettings}/agent/${agentId}/organization/${organizationId}`, 'GET');
335
+ public async deleteSession(...args: Parameters<SessionModule['deleteSession']>) {
336
+ return this.sessions.deleteSession(...args);
836
337
  }
837
338
 
838
- public async updateAgentSettings(id: string, settingsData: UpdateAgentSettingsDto): Promise<AgentSettings> {
839
- return this.request<AgentSettings>(`${urls.agentSettings}/${id}`, 'PATCH', settingsData);
339
+ public async setPrimaryTranscriptionSummary(...args: Parameters<SessionModule['setPrimaryTranscriptionSummary']>) {
340
+ return this.sessions.setPrimaryTranscriptionSummary(...args);
840
341
  }
841
342
 
842
- public async deleteAgentSettings(id: string): Promise<void> {
843
- await this.request(`${urls.agentSettings}/${id}`, 'DELETE');
343
+ public async rerunTranscription(...args: Parameters<SessionModule['rerunTranscription']>) {
344
+ return this.sessions.rerunTranscription(...args);
844
345
  }
845
346
 
846
- // ======================
847
- // AUDIO FILE METHODS
848
- // ======================
347
+ // Agent methods
348
+ public async createAgent(...args: Parameters<AgentModule['createAgent']>) {
349
+ return this.agents.createAgent(...args);
350
+ }
849
351
 
850
- public async uploadAudioFileToSession(sessionId: string, file: File | Blob, fileName?: string, culturalTranscription?: string): Promise<AudioFile> {
851
- const formData = new FormData();
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);
352
+ public async getAgents(...args: Parameters<AgentModule['getAgents']>) {
353
+ return this.agents.getAgents(...args);
859
354
  }
860
355
 
861
- public async uploadAudioFileWithTranscriptionQueue(sessionId: string, file: File | Blob, options?: { fileName?: string; culturalTranscription?: string }): Promise<AudioFile> {
862
- const formData = new FormData();
863
- formData.append('file', file, options?.fileName);
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);
356
+ public async getAgent(...args: Parameters<AgentModule['getAgent']>) {
357
+ return this.agents.getAgent(...args);
871
358
  }
872
359
 
873
- public async getMyAudioFiles(): Promise<AudioFile[]> {
874
- return this.request<AudioFile[]>(`${urls.audioFiles}/my-files`, 'GET');
360
+ public async updateAgent(...args: Parameters<AgentModule['updateAgent']>) {
361
+ return this.agents.updateAgent(...args);
875
362
  }
876
363
 
877
- public async getAllAudioFiles(): Promise<AudioFile[]> {
878
- return this.request<AudioFile[]>(`${urls.audioFiles}/all`, 'GET');
364
+ public async deleteAgent(...args: Parameters<AgentModule['deleteAgent']>) {
365
+ return this.agents.deleteAgent(...args);
879
366
  }
880
367
 
881
- public async getOrganizationAudioFiles(): Promise<AudioFile[]> {
882
- return this.request<AudioFile[]>(`${urls.audioFiles}/organization`, 'GET');
368
+ public async addAgentToOrganization(...args: Parameters<AgentModule['addAgentToOrganization']>) {
369
+ return this.agents.addAgentToOrganization(...args);
883
370
  }
884
371
 
885
- public async getAudioFilesBySession(sessionId: string): Promise<AudioFile[]> {
886
- return this.request<AudioFile[]>(`${urls.audioFiles}/session/${sessionId}`, 'GET');
372
+ public async removeAgentFromOrganization(...args: Parameters<AgentModule['removeAgentFromOrganization']>) {
373
+ return this.agents.removeAgentFromOrganization(...args);
887
374
  }
888
375
 
889
- public async getAudioFile(id: string): Promise<AudioFile> {
890
- return this.request<AudioFile>(`${urls.audioFiles}/${id}`, 'GET');
376
+ public async createAgentSettings(...args: Parameters<AgentModule['createAgentSettings']>) {
377
+ return this.agents.createAgentSettings(...args);
891
378
  }
892
379
 
893
- public async updateAudioFile(id: string, updates: UpdateAudioFileDto): Promise<AudioFile> {
894
- return this.request<AudioFile>(`${urls.audioFiles}/${id}`, 'PATCH', updates);
380
+ public async getAgentSettings(...args: Parameters<AgentModule['getAgentSettings']>) {
381
+ return this.agents.getAgentSettings(...args);
895
382
  }
896
383
 
897
- public async deleteAudioFile(id: string): Promise<void> {
898
- await this.request(`${urls.audioFiles}/${id}`, 'DELETE');
384
+ public async getAgentSettingsById(...args: Parameters<AgentModule['getAgentSettingsById']>) {
385
+ return this.agents.getAgentSettingsById(...args);
899
386
  }
900
387
 
901
- public async downloadAudioFile(id: string): Promise<Blob> {
902
- // For file downloads, we need a different approach than JSON requests
903
- const url = `${this.baseUrl}${urls.audioFiles}/${id}/download`;
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 getAgentSettingsByAgentAndOrganization(...args: Parameters<AgentModule['getAgentSettingsByAgentAndOrganization']>) {
389
+ return this.agents.getAgentSettingsByAgentAndOrganization(...args);
390
+ }
911
391
 
912
- if (this.accessToken) {
913
- defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
914
- }
392
+ public async updateAgentSettings(...args: Parameters<AgentModule['updateAgentSettings']>) {
393
+ return this.agents.updateAgentSettings(...args);
394
+ }
915
395
 
916
- const response = await fetch(url, {
917
- method: 'GET',
918
- headers: defaultHeaders,
919
- });
396
+ public async deleteAgentSettings(...args: Parameters<AgentModule['deleteAgentSettings']>) {
397
+ return this.agents.deleteAgentSettings(...args);
398
+ }
920
399
 
921
- if (!response.ok) {
922
- const errorData = await response.json().catch(() => ({}));
923
- throw new Error(
924
- errorData.message || `Download failed with status ${response.status}`
925
- );
926
- }
400
+ // Audio methods
401
+ public async uploadAudioFileToSession(...args: Parameters<AudioModule['uploadAudioFileToSession']>) {
402
+ return this.audio.uploadAudioFileToSession(...args);
403
+ }
927
404
 
928
- return response.blob();
405
+ public async uploadAudioFileWithTranscriptionQueue(...args: Parameters<AudioModule['uploadAudioFileWithTranscriptionQueue']>) {
406
+ return this.audio.uploadAudioFileWithTranscriptionQueue(...args);
929
407
  }
930
408
 
931
- public async downloadAudioFileAsUrl(id: string): Promise<string> {
932
- const blob = await this.downloadAudioFile(id);
933
- return URL.createObjectURL(blob);
409
+ public async getMyAudioFiles(...args: Parameters<AudioModule['getMyAudioFiles']>) {
410
+ return this.audio.getMyAudioFiles(...args);
934
411
  }
935
412
 
936
- // ======================
937
- // TRANSCRIPTION QUEUE HELPER METHODS
938
- // ======================
413
+ public async getAllAudioFiles(...args: Parameters<AudioModule['getAllAudioFiles']>) {
414
+ return this.audio.getAllAudioFiles(...args);
415
+ }
939
416
 
940
- public async getTranscribedAudioFiles(): Promise<AudioFile[]> {
941
- const audioFiles = await this.getMyAudioFiles();
942
- return audioFiles.filter(file => file.status === AudioFileStatus.TRANSCRIBED && file.transcription);
417
+ public async getOrganizationAudioFiles(...args: Parameters<AudioModule['getOrganizationAudioFiles']>) {
418
+ return this.audio.getOrganizationAudioFiles(...args);
943
419
  }
944
420
 
945
- public async getProcessingAudioFiles(): Promise<AudioFile[]> {
946
- const audioFiles = await this.getMyAudioFiles();
947
- return audioFiles.filter(file => file.status === AudioFileStatus.PROCESSING);
421
+ public async getAudioFilesBySession(...args: Parameters<AudioModule['getAudioFilesBySession']>) {
422
+ return this.audio.getAudioFilesBySession(...args);
948
423
  }
949
424
 
950
- public async getFailedAudioFiles(): Promise<AudioFile[]> {
951
- const audioFiles = await this.getMyAudioFiles();
952
- return audioFiles.filter(file => file.status === AudioFileStatus.FAILED);
425
+ public async getAudioFile(...args: Parameters<AudioModule['getAudioFile']>) {
426
+ return this.audio.getAudioFile(...args);
953
427
  }
954
428
 
955
- // ======================
956
- // BASE64 AUDIO FILE METHODS
957
- // ======================
429
+ public async updateAudioFile(...args: Parameters<AudioModule['updateAudioFile']>) {
430
+ return this.audio.updateAudioFile(...args);
431
+ }
958
432
 
959
- public async createBase64AudioFile(dto: CreateBase64AudioFileDto): Promise<Base64AudioFile> {
960
- return this.request<Base64AudioFile>(`${urls.audioFiles}/base64`, 'POST', dto);
433
+ public async deleteAudioFile(...args: Parameters<AudioModule['deleteAudioFile']>) {
434
+ return this.audio.deleteAudioFile(...args);
961
435
  }
962
436
 
963
- public async getAllBase64AudioFiles(): Promise<Base64AudioFile[]> {
964
- return this.request<Base64AudioFile[]>(`${urls.audioFiles}/base64/all`, 'GET');
437
+ public async downloadAudioFile(...args: Parameters<AudioModule['downloadAudioFile']>) {
438
+ return this.audio.downloadAudioFile(...args);
965
439
  }
966
440
 
967
- public async getBase64AudioFilesBySession(sessionId: string): Promise<Base64AudioFile[]> {
968
- return this.request<Base64AudioFile[]>(`${urls.audioFiles}/base64/session/${sessionId}`, 'GET');
441
+ public async downloadAudioFileAsUrl(...args: Parameters<AudioModule['downloadAudioFileAsUrl']>) {
442
+ return this.audio.downloadAudioFileAsUrl(...args);
969
443
  }
970
444
 
971
- public async getBase64AudioFile(id: string): Promise<Base64AudioFile> {
972
- return this.request<Base64AudioFile>(`${urls.audioFiles}/base64/${id}`, 'GET');
445
+ public async getTranscribedAudioFiles(...args: Parameters<AudioModule['getTranscribedAudioFiles']>) {
446
+ return this.audio.getTranscribedAudioFiles(...args);
973
447
  }
974
448
 
975
- public async updateBase64AudioFile(id: string, updates: UpdateBase64AudioFileDto): Promise<Base64AudioFile> {
976
- return this.request<Base64AudioFile>(`${urls.audioFiles}/base64/${id}`, 'PATCH', updates);
449
+ public async getProcessingAudioFiles(...args: Parameters<AudioModule['getProcessingAudioFiles']>) {
450
+ return this.audio.getProcessingAudioFiles(...args);
977
451
  }
978
452
 
979
- public async deleteBase64AudioFile(id: string): Promise<void> {
980
- await this.request(`${urls.audioFiles}/base64/${id}`, 'DELETE');
453
+ public async getFailedAudioFiles(...args: Parameters<AudioModule['getFailedAudioFiles']>) {
454
+ return this.audio.getFailedAudioFiles(...args);
981
455
  }
982
456
 
983
- public async addBase64Chunk(sessionId: string, base64Chunks: string[]): Promise<AddBase64ChunkResponse> {
984
- return this.request<AddBase64ChunkResponse>(`${urls.audioFiles}/base64/add-chunk/${sessionId}`, 'POST', { base64Chunks });
457
+ public async createBase64AudioFile(...args: Parameters<AudioModule['createBase64AudioFile']>) {
458
+ return this.audio.createBase64AudioFile(...args);
985
459
  }
986
460
 
987
- public async queueSessionBase64AudioForTranscription(sessionId: string): Promise<{ success: boolean }> {
988
- return this.request<{ success: boolean }>(`${urls.audioFiles}/session/${sessionId}/transcribe`, 'POST');
461
+ public async getAllBase64AudioFiles(...args: Parameters<AudioModule['getAllBase64AudioFiles']>) {
462
+ return this.audio.getAllBase64AudioFiles(...args);
989
463
  }
990
464
 
991
- // ======================
992
- // WORKFLOW METHODS
993
- // ======================
465
+ public async getBase64AudioFilesBySession(...args: Parameters<AudioModule['getBase64AudioFilesBySession']>) {
466
+ return this.audio.getBase64AudioFilesBySession(...args);
467
+ }
994
468
 
995
- public async createWorkflow(name: string, organizationId?: string): Promise<Workflow> {
996
- const dto: CreateWorkflowDto = {
997
- name,
998
- organizationId: organizationId || this.user!.organizationId,
999
- };
1000
- return this.request<Workflow>(urls.workflows, 'POST', dto);
469
+ public async getBase64AudioFile(...args: Parameters<AudioModule['getBase64AudioFile']>) {
470
+ return this.audio.getBase64AudioFile(...args);
1001
471
  }
1002
472
 
1003
- public async getWorkflows(organizationId?: string): Promise<Workflow[]> {
1004
- const params = organizationId ? `?organizationId=${organizationId}` : '';
1005
- return this.request<Workflow[]>(`${urls.workflows}${params}`, 'GET');
473
+ public async updateBase64AudioFile(...args: Parameters<AudioModule['updateBase64AudioFile']>) {
474
+ return this.audio.updateBase64AudioFile(...args);
1006
475
  }
1007
476
 
1008
- public async getWorkflow(id: string): Promise<Workflow> {
1009
- return this.request<Workflow>(`${urls.workflows}/${id}`, 'GET');
477
+ public async deleteBase64AudioFile(...args: Parameters<AudioModule['deleteBase64AudioFile']>) {
478
+ return this.audio.deleteBase64AudioFile(...args);
1010
479
  }
1011
480
 
1012
- public async getWorkflowsByOrganization(organizationId?: string): Promise<Workflow[]> {
1013
- const orgId = organizationId || this.user!.organizationId;
1014
- return this.request<Workflow[]>(`${urls.workflows}?organizationId=${orgId}`, 'GET');
481
+ public async addBase64Chunk(...args: Parameters<AudioModule['addBase64Chunk']>) {
482
+ return this.audio.addBase64Chunk(...args);
1015
483
  }
1016
484
 
1017
- public async updateWorkflow(id: string, name: string, organizationId?: string): Promise<Workflow> {
1018
- const dto: UpdateWorkflowDto = {
1019
- name,
1020
- organizationId: organizationId || this.user!.organizationId,
1021
- };
1022
- return this.request<Workflow>(`${urls.workflows}/${id}`, 'PATCH', dto);
485
+ public async queueSessionBase64AudioForTranscription(...args: Parameters<AudioModule['queueSessionBase64AudioForTranscription']>) {
486
+ return this.audio.queueSessionBase64AudioForTranscription(...args);
1023
487
  }
1024
488
 
1025
- public async deleteWorkflow(id: string): Promise<void> {
1026
- await this.request(`${urls.workflows}/${id}`, 'DELETE');
489
+ // Workflow methods
490
+ public async createWorkflow(...args: Parameters<WorkflowModule['createWorkflow']>) {
491
+ return this.workflows.createWorkflow(...args);
1027
492
  }
1028
493
 
1029
- // ===== LOGS METHODS =====
494
+ public async getWorkflows(...args: Parameters<WorkflowModule['getWorkflows']>) {
495
+ return this.workflows.getWorkflows(...args);
496
+ }
1030
497
 
1031
- /**
1032
- * Get logs with advanced filtering options
1033
- */
1034
- public async getLogs(filters?: FilterLogsDto): Promise<LogsResponse> {
1035
- const params = new URLSearchParams();
498
+ public async getWorkflow(...args: Parameters<WorkflowModule['getWorkflow']>) {
499
+ return this.workflows.getWorkflow(...args);
500
+ }
1036
501
 
1037
- if (filters) {
1038
- Object.entries(filters).forEach(([key, value]) => {
1039
- if (value !== undefined && value !== null) {
1040
- params.append(key, value.toString());
1041
- }
1042
- });
1043
- }
502
+ public async getWorkflowsByOrganization(...args: Parameters<WorkflowModule['getWorkflowsByOrganization']>) {
503
+ return this.workflows.getWorkflowsByOrganization(...args);
504
+ }
1044
505
 
1045
- const queryString = params.toString();
1046
- const url = queryString ? `${urls.logs}?${queryString}` : urls.logs;
506
+ public async updateWorkflow(...args: Parameters<WorkflowModule['updateWorkflow']>) {
507
+ return this.workflows.updateWorkflow(...args);
508
+ }
1047
509
 
1048
- return this.request<LogsResponse>(url, 'GET');
510
+ public async deleteWorkflow(...args: Parameters<WorkflowModule['deleteWorkflow']>) {
511
+ return this.workflows.deleteWorkflow(...args);
1049
512
  }
1050
513
 
1051
- /**
1052
- * Get logs for a specific user
1053
- */
1054
- public async getLogsByUser(userId: string, limit?: number, offset?: number): Promise<LogsResponse> {
1055
- const params = new URLSearchParams();
1056
- if (limit !== undefined) params.append('limit', limit.toString());
1057
- if (offset !== undefined) params.append('offset', offset.toString());
514
+ // Log methods
515
+ public async getLogs(...args: Parameters<LogModule['getLogs']>) {
516
+ return this.logs.getLogs(...args);
517
+ }
1058
518
 
1059
- const queryString = params.toString();
1060
- const url = queryString ? `${urls.logs}/user/${userId}?${queryString}` : `${urls.logs}/user/${userId}`;
519
+ public async getLogsByUser(...args: Parameters<LogModule['getLogsByUser']>) {
520
+ return this.logs.getLogsByUser(...args);
521
+ }
1061
522
 
1062
- return this.request<LogsResponse>(url, 'GET');
523
+ public async getLogsByController(...args: Parameters<LogModule['getLogsByController']>) {
524
+ return this.logs.getLogsByController(...args);
1063
525
  }
1064
526
 
1065
- /**
1066
- * Get logs for a specific controller
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());
527
+ public async getMyLogs(...args: Parameters<LogModule['getMyLogs']>) {
528
+ return this.logs.getMyLogs(...args);
529
+ }
1072
530
 
1073
- const queryString = params.toString();
1074
- const url = queryString ? `${urls.logs}/controller/${controller}?${queryString}` : `${urls.logs}/controller/${controller}`;
531
+ public async getLogsByDateRange(...args: Parameters<LogModule['getLogsByDateRange']>) {
532
+ return this.logs.getLogsByDateRange(...args);
533
+ }
1075
534
 
1076
- return this.request<LogsResponse>(url, 'GET');
535
+ public async getLogStats(...args: Parameters<LogModule['getLogStats']>) {
536
+ return this.logs.getLogStats(...args);
1077
537
  }
1078
538
 
1079
- /**
1080
- * Get logs for the current authenticated user
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());
539
+ public async createLog(...args: Parameters<LogModule['createLog']>) {
540
+ return this.logs.createLog(...args);
541
+ }
1086
542
 
1087
- const queryString = params.toString();
1088
- const url = queryString ? `${urls.logs}/my-logs?${queryString}` : `${urls.logs}/my-logs`;
543
+ public async logInfo(...args: Parameters<LogModule['logInfo']>) {
544
+ return this.logs.logInfo(...args);
545
+ }
1089
546
 
1090
- return this.request<LogsResponse>(url, 'GET');
547
+ public async logError(...args: Parameters<LogModule['logError']>) {
548
+ return this.logs.logError(...args);
1091
549
  }
1092
550
 
1093
- /**
1094
- * Get logs within a date range
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());
551
+ public async logWarn(...args: Parameters<LogModule['logWarn']>) {
552
+ return this.logs.logWarn(...args);
553
+ }
1107
554
 
1108
- return this.request<LogsResponse>(`${urls.logs}/date-range?${params.toString()}`, 'GET');
555
+ public async logDebug(...args: Parameters<LogModule['logDebug']>) {
556
+ return this.logs.logDebug(...args);
1109
557
  }
1110
558
 
1111
- /**
1112
- * Get logging statistics
1113
- */
1114
- public async getLogStats(): Promise<LogStats> {
1115
- return this.request<LogStats>(`${urls.logs}/stats`, 'GET');
559
+ public async getLogsByRole(...args: Parameters<LogModule['getLogsByRole']>) {
560
+ return this.logs.getLogsByRole(...args);
1116
561
  }
1117
-
1118
- /**
1119
- * Create a manual log entry (app logs)
1120
- */
1121
- public async createLog(logData: CreateLogDto): Promise<Log> {
1122
- return this.request<Log>(urls.logs, 'POST', logData);
562
+
563
+ public async getLogsByOrganizationRole(...args: Parameters<LogModule['getLogsByOrganizationRole']>) {
564
+ return this.logs.getLogsByOrganizationRole(...args);
1123
565
  }
1124
566
 
1125
- /**
1126
- * Convenience methods for different log levels
1127
- */
1128
- public async logInfo(message: string, context?: string, action?: string, data?: any): Promise<Log> {
1129
- return this.createLog({
1130
- level: 'info',
1131
- message,
1132
- context,
1133
- action,
1134
- data,
1135
- });
1136
- }
1137
-
1138
- public async logError(message: string, context?: string, action?: string, data?: any): Promise<Log> {
1139
- return this.createLog({
1140
- level: 'error',
1141
- message,
1142
- context,
1143
- action,
1144
- data,
1145
- });
1146
- }
1147
-
1148
- public async logWarn(message: string, context?: string, action?: string, data?: any): Promise<Log> {
1149
- return this.createLog({
1150
- level: 'warn',
1151
- message,
1152
- context,
1153
- action,
1154
- data,
1155
- });
1156
- }
1157
-
1158
- public async logDebug(message: string, context?: string, action?: string, data?: any): Promise<Log> {
1159
- return this.createLog({
1160
- level: 'debug',
1161
- message,
1162
- context,
1163
- action,
1164
- data,
1165
- });
1166
- }
1167
-
1168
- /**
1169
- * Get logs by role
1170
- */
1171
- public async getLogsByRole(role: string, limit?: number, offset?: number): Promise<LogsResponse> {
1172
- const params = new URLSearchParams();
1173
- if (limit !== undefined) params.append('limit', limit.toString());
1174
- if (offset !== undefined) params.append('offset', offset.toString());
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
- }
567
+ public async getLogsByTeamRole(...args: Parameters<LogModule['getLogsByTeamRole']>) {
568
+ return this.logs.getLogsByTeamRole(...args);
569
+ }
570
+
571
+ public async getAvailableRoles(...args: Parameters<LogModule['getAvailableRoles']>) {
572
+ return this.logs.getAvailableRoles(...args);
573
+ }
574
+
575
+ public async getSessionLogs(...args: Parameters<LogModule['getSessionLogs']>) {
576
+ return this.logs.getSessionLogs(...args);
577
+ }
578
+
579
+ // Debug methods
580
+ public async getSessionsWithoutMedicalTranscriptions(...args: Parameters<DebugModule['getSessionsWithoutMedicalTranscriptions']>) {
581
+ return this.debug.getSessionsWithoutMedicalTranscriptions(...args);
582
+ }
583
+
584
+ public async downloadSessionAsZip(...args: Parameters<DebugModule['downloadSessionAsZip']>) {
585
+ return this.debug.downloadSessionAsZip(...args);
586
+ }
587
+
588
+ public async downloadSessionAsZipUrl(...args: Parameters<DebugModule['downloadSessionAsZipUrl']>) {
589
+ return this.debug.downloadSessionAsZipUrl(...args);
590
+ }
591
+
592
+ public async downloadSessionAndTriggerDownload(...args: Parameters<DebugModule['downloadSessionAndTriggerDownload']>) {
593
+ return this.debug.downloadSessionAndTriggerDownload(...args);
594
+ }
595
+
596
+ // External Integration methods
597
+ public async createExternalIntegration(...args: Parameters<ExternalIntegrationModule['createExternalIntegration']>) {
598
+ return this.externalIntegrations.createExternalIntegration(...args);
599
+ }
600
+
601
+ public async getExternalIntegrations(...args: Parameters<ExternalIntegrationModule['getExternalIntegrations']>) {
602
+ return this.externalIntegrations.getExternalIntegrations(...args);
603
+ }
604
+
605
+ public async getExternalIntegration(...args: Parameters<ExternalIntegrationModule['getExternalIntegration']>) {
606
+ return this.externalIntegrations.getExternalIntegration(...args);
607
+ }
608
+
609
+ public async updateExternalIntegration(...args: Parameters<ExternalIntegrationModule['updateExternalIntegration']>) {
610
+ return this.externalIntegrations.updateExternalIntegration(...args);
611
+ }
612
+
613
+ public async deleteExternalIntegration(...args: Parameters<ExternalIntegrationModule['deleteExternalIntegration']>) {
614
+ return this.externalIntegrations.deleteExternalIntegration(...args);
615
+ }
616
+ }