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