whio-api-sdk 1.0.171 → 1.0.173
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/sdk/sdk.d.ts +2 -20
- package/dist/src/sdk/sdk.js +8 -121
- package/dist/src/sdk/types.d.ts +3 -82
- package/dist/src/sdk/types.js +0 -8
- package/dist/src/sdk/urls.d.ts +0 -3
- package/dist/src/sdk/urls.js +0 -5
- package/package.json +1 -1
- package/src/sdk/sdk.ts +7 -122
- package/src/sdk/types.ts +3 -100
- package/src/sdk/urls.ts +0 -7
- package/quick-test.mjs +0 -155
- package/test-audio-files.mjs +0 -92
- package/test-comprehensive.mjs +0 -276
- package/test-password-change.ts +0 -34
- package/test-sdk-findAllByOrganization.js +0 -64
- package/test-sdk.cjs +0 -190
- package/test-sdk.mjs +0 -228
- package/test-sdk.ts +0 -167
package/dist/src/sdk/sdk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoginResponse, LoginCredentials, SDKConfig, User, UpdateUserDto, Organization, TemplateCategory, Template, Team, UserTemplate, TranscriptionSummary, TranscriptionAudioUploadResponse, PasswordChangeResponse, Session, CreateSessionDto, UpdateSessionDto
|
|
1
|
+
import { LoginResponse, LoginCredentials, SDKConfig, User, UpdateUserDto, Organization, TemplateCategory, Template, Team, UserTemplate, TranscriptionSummary, TranscriptionAudioUploadResponse, PasswordChangeResponse, Session, CreateSessionDto, UpdateSessionDto } from './types';
|
|
2
2
|
export declare class ApiSDK {
|
|
3
3
|
private baseUrl;
|
|
4
4
|
private storage;
|
|
@@ -39,7 +39,7 @@ export declare class ApiSDK {
|
|
|
39
39
|
getTemplates(): Promise<Template[]>;
|
|
40
40
|
getTemplatesByOrganization(): Promise<Template[]>;
|
|
41
41
|
getUserTemplates(): Promise<UserTemplate[]>;
|
|
42
|
-
generateTranscriptionSummary(transcript: string, templateId: string): Promise<TranscriptionSummary>;
|
|
42
|
+
generateTranscriptionSummary(transcript: string, templateId: string, sessionId: string): Promise<TranscriptionSummary>;
|
|
43
43
|
getByOrganizationTranscriptionSummaries(organizationId: string): Promise<TranscriptionSummary[]>;
|
|
44
44
|
generateTranscriptionSummaryFromUserTemplate(transcript: string, userTemplateId: string): Promise<TranscriptionSummary>;
|
|
45
45
|
updateTranscriptionSummary(id: string, content: string): Promise<TranscriptionSummary>;
|
|
@@ -89,22 +89,4 @@ export declare class ApiSDK {
|
|
|
89
89
|
updateSession(id: string, sessionData: UpdateSessionDto): Promise<Session>;
|
|
90
90
|
deleteSession(id: string): Promise<void>;
|
|
91
91
|
setPrimaryTranscriptionSummary(sessionId: string, summaryId: string): Promise<Session>;
|
|
92
|
-
getPapareoTranscriptionStatus(sessionId: string): Promise<Session>;
|
|
93
|
-
createAgent(name: string): Promise<Agent>;
|
|
94
|
-
getAgents(): Promise<Agent[]>;
|
|
95
|
-
getAgent(id: string): Promise<Agent>;
|
|
96
|
-
updateAgent(id: string, name: string): Promise<Agent>;
|
|
97
|
-
deleteAgent(id: string): Promise<void>;
|
|
98
|
-
addAgentToOrganization(agentId: string, organizationId: string): Promise<void>;
|
|
99
|
-
removeAgentFromOrganization(agentId: string, organizationId: string): Promise<void>;
|
|
100
|
-
uploadAudioFileToSession(sessionId: string, file: File | Blob, fileName?: string): Promise<AudioFile>;
|
|
101
|
-
getMyAudioFiles(): Promise<AudioFile[]>;
|
|
102
|
-
getAllAudioFiles(): Promise<AudioFile[]>;
|
|
103
|
-
getOrganizationAudioFiles(): Promise<AudioFile[]>;
|
|
104
|
-
getAudioFilesBySession(sessionId: string): Promise<AudioFile[]>;
|
|
105
|
-
getAudioFile(id: string): Promise<AudioFile>;
|
|
106
|
-
updateAudioFile(id: string, updates: UpdateAudioFileDto): Promise<AudioFile>;
|
|
107
|
-
deleteAudioFile(id: string): Promise<void>;
|
|
108
|
-
downloadAudioFile(id: string): Promise<Blob>;
|
|
109
|
-
downloadAudioFileAsUrl(id: string): Promise<string>;
|
|
110
92
|
}
|
package/dist/src/sdk/sdk.js
CHANGED
|
@@ -132,7 +132,12 @@ export class ApiSDK {
|
|
|
132
132
|
}
|
|
133
133
|
logout() {
|
|
134
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
-
|
|
135
|
+
try {
|
|
136
|
+
yield this.request('/auth/logout', 'POST');
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
yield this.clearAuth();
|
|
140
|
+
}
|
|
136
141
|
});
|
|
137
142
|
}
|
|
138
143
|
clearAuth() {
|
|
@@ -361,13 +366,14 @@ export class ApiSDK {
|
|
|
361
366
|
// ======================
|
|
362
367
|
// trANSCRIPTION SUMMARY METHODS
|
|
363
368
|
// ======================
|
|
364
|
-
generateTranscriptionSummary(transcript, templateId) {
|
|
369
|
+
generateTranscriptionSummary(transcript, templateId, sessionId) {
|
|
365
370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
366
371
|
const generateSummaryDto = {
|
|
367
372
|
transcript,
|
|
368
373
|
templateId,
|
|
369
374
|
userId: this.user.id,
|
|
370
375
|
fromUserTemplate: false,
|
|
376
|
+
sessionId: sessionId,
|
|
371
377
|
};
|
|
372
378
|
const transcriptionSummary = yield this.request(urls.transcriptionSummary, 'POST', generateSummaryDto);
|
|
373
379
|
return transcriptionSummary;
|
|
@@ -678,123 +684,4 @@ export class ApiSDK {
|
|
|
678
684
|
return this.request(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
|
|
679
685
|
});
|
|
680
686
|
}
|
|
681
|
-
getPapareoTranscriptionStatus(sessionId) {
|
|
682
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
683
|
-
return this.request(`${urls.getPapareoTranscriptionStatus}/${sessionId}`, 'GET');
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
// ======================
|
|
687
|
-
// AGENT METHODS
|
|
688
|
-
// ======================
|
|
689
|
-
createAgent(name) {
|
|
690
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
691
|
-
const dto = { name };
|
|
692
|
-
return this.request(urls.agents, 'POST', dto);
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
getAgents() {
|
|
696
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
697
|
-
return this.request(urls.agents, 'GET');
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
getAgent(id) {
|
|
701
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
702
|
-
return this.request(`${urls.agents}/${id}`, 'GET');
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
updateAgent(id, name) {
|
|
706
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
707
|
-
const dto = { name };
|
|
708
|
-
return this.request(`${urls.agents}/${id}`, 'PATCH', dto);
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
deleteAgent(id) {
|
|
712
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
713
|
-
yield this.request(`${urls.agents}/${id}`, 'DELETE');
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
addAgentToOrganization(agentId, organizationId) {
|
|
717
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
718
|
-
yield this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'POST');
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
removeAgentFromOrganization(agentId, organizationId) {
|
|
722
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
723
|
-
yield this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'DELETE');
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
|
-
// ======================
|
|
727
|
-
// AUDIO FILE METHODS
|
|
728
|
-
// ======================
|
|
729
|
-
uploadAudioFileToSession(sessionId, file, fileName) {
|
|
730
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
731
|
-
const formData = new FormData();
|
|
732
|
-
formData.append('file', file, fileName);
|
|
733
|
-
return this.fileUploadRequest(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
getMyAudioFiles() {
|
|
737
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
738
|
-
return this.request(`${urls.audioFiles}/my-files`, 'GET');
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
getAllAudioFiles() {
|
|
742
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
743
|
-
return this.request(`${urls.audioFiles}/all`, 'GET');
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
getOrganizationAudioFiles() {
|
|
747
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
748
|
-
return this.request(`${urls.audioFiles}/organization`, 'GET');
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
getAudioFilesBySession(sessionId) {
|
|
752
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
753
|
-
return this.request(`${urls.audioFiles}/session/${sessionId}`, 'GET');
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
|
-
getAudioFile(id) {
|
|
757
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
758
|
-
return this.request(`${urls.audioFiles}/${id}`, 'GET');
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
updateAudioFile(id, updates) {
|
|
762
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
763
|
-
return this.request(`${urls.audioFiles}/${id}`, 'PATCH', updates);
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
deleteAudioFile(id) {
|
|
767
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
768
|
-
yield this.request(`${urls.audioFiles}/${id}`, 'DELETE');
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
downloadAudioFile(id) {
|
|
772
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
773
|
-
// For file downloads, we need a different approach than JSON requests
|
|
774
|
-
const url = `${this.baseUrl}${urls.audioFiles}/${id}/download`;
|
|
775
|
-
// Get token first
|
|
776
|
-
yield this.getToken();
|
|
777
|
-
const defaultHeaders = {
|
|
778
|
-
'ngrok-skip-browser-warning': 'true'
|
|
779
|
-
};
|
|
780
|
-
if (this.accessToken) {
|
|
781
|
-
defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
|
|
782
|
-
}
|
|
783
|
-
const response = yield fetch(url, {
|
|
784
|
-
method: 'GET',
|
|
785
|
-
headers: defaultHeaders,
|
|
786
|
-
});
|
|
787
|
-
if (!response.ok) {
|
|
788
|
-
const errorData = yield response.json().catch(() => ({}));
|
|
789
|
-
throw new Error(errorData.message || `Download failed with status ${response.status}`);
|
|
790
|
-
}
|
|
791
|
-
return response.blob();
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
downloadAudioFileAsUrl(id) {
|
|
795
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
796
|
-
const blob = yield this.downloadAudioFile(id);
|
|
797
|
-
return URL.createObjectURL(blob);
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
687
|
}
|
package/dist/src/sdk/types.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ export interface Organization {
|
|
|
31
31
|
updatedAt: string;
|
|
32
32
|
users?: User[];
|
|
33
33
|
roles?: OrganizationRole[];
|
|
34
|
-
agents?: AgentOrganization[];
|
|
35
34
|
}
|
|
36
35
|
export interface User {
|
|
37
36
|
id: string;
|
|
@@ -97,6 +96,7 @@ export interface GenerateTranscriptionSummaryDto {
|
|
|
97
96
|
templateId: string;
|
|
98
97
|
userId?: string;
|
|
99
98
|
fromUserTemplate?: boolean;
|
|
99
|
+
sessionId?: string;
|
|
100
100
|
}
|
|
101
101
|
export interface UpdateTranscriptionSummaryDto {
|
|
102
102
|
anonymisedTranscript?: string;
|
|
@@ -277,21 +277,20 @@ export interface Session {
|
|
|
277
277
|
sessionName?: string;
|
|
278
278
|
createdAt: string;
|
|
279
279
|
updatedAt: string;
|
|
280
|
-
templateId
|
|
280
|
+
templateId?: string;
|
|
281
281
|
userId: string;
|
|
282
282
|
primaryTranscriptionSummaryId?: string;
|
|
283
283
|
user?: User;
|
|
284
284
|
template?: Template;
|
|
285
285
|
transcriptionSummaries?: TranscriptionSummary[];
|
|
286
286
|
primaryTranscriptionSummary?: TranscriptionSummary;
|
|
287
|
-
audioFiles?: AudioFile[];
|
|
288
287
|
}
|
|
289
288
|
export interface CreateSessionDto {
|
|
290
289
|
transcript: string;
|
|
291
290
|
dateTime: string;
|
|
292
291
|
startDateTime?: string;
|
|
293
292
|
stopDateTime?: string;
|
|
294
|
-
templateId
|
|
293
|
+
templateId?: string;
|
|
295
294
|
templateName?: string;
|
|
296
295
|
summary?: string;
|
|
297
296
|
sessionName?: string;
|
|
@@ -308,81 +307,3 @@ export interface UpdateSessionDto {
|
|
|
308
307
|
sessionName?: string;
|
|
309
308
|
primaryTranscriptionSummaryId?: string;
|
|
310
309
|
}
|
|
311
|
-
export interface Agent {
|
|
312
|
-
id: string;
|
|
313
|
-
name: string;
|
|
314
|
-
createdAt: string;
|
|
315
|
-
updatedAt: string;
|
|
316
|
-
organizations?: AgentOrganization[];
|
|
317
|
-
}
|
|
318
|
-
export interface AgentOrganization {
|
|
319
|
-
agentId: string;
|
|
320
|
-
organizationId: string;
|
|
321
|
-
createdAt: string;
|
|
322
|
-
agent?: Agent;
|
|
323
|
-
organization?: Organization;
|
|
324
|
-
}
|
|
325
|
-
export interface CreateAgentDto {
|
|
326
|
-
name: string;
|
|
327
|
-
}
|
|
328
|
-
export interface UpdateAgentDto {
|
|
329
|
-
name?: string;
|
|
330
|
-
}
|
|
331
|
-
export declare enum AudioFileStatus {
|
|
332
|
-
UPLOADED = "UPLOADED",
|
|
333
|
-
PROCESSING = "PROCESSING",
|
|
334
|
-
TRANSCRIBED = "TRANSCRIBED",
|
|
335
|
-
FAILED = "FAILED"
|
|
336
|
-
}
|
|
337
|
-
export interface AudioFile {
|
|
338
|
-
id: string;
|
|
339
|
-
originalName: string;
|
|
340
|
-
fileName: string;
|
|
341
|
-
filePath: string;
|
|
342
|
-
fileSize: number;
|
|
343
|
-
mimeType: string;
|
|
344
|
-
uploadId?: string;
|
|
345
|
-
transcriptionUrl?: string;
|
|
346
|
-
status: AudioFileStatus;
|
|
347
|
-
taskId?: string;
|
|
348
|
-
uploadStatus?: string;
|
|
349
|
-
statusLink?: string;
|
|
350
|
-
cancelLink?: string;
|
|
351
|
-
downloadLink?: string;
|
|
352
|
-
progressPercent?: number;
|
|
353
|
-
createdAt: string;
|
|
354
|
-
updatedAt: string;
|
|
355
|
-
sessionId: string;
|
|
356
|
-
userId: string;
|
|
357
|
-
session?: Session;
|
|
358
|
-
user?: User;
|
|
359
|
-
}
|
|
360
|
-
export interface CreateAudioFileDto {
|
|
361
|
-
originalName: string;
|
|
362
|
-
fileName: string;
|
|
363
|
-
filePath: string;
|
|
364
|
-
fileSize: number;
|
|
365
|
-
mimeType: string;
|
|
366
|
-
uploadId?: string;
|
|
367
|
-
sessionId: string;
|
|
368
|
-
}
|
|
369
|
-
export interface UpdateAudioFileDto {
|
|
370
|
-
transcriptionUrl?: string;
|
|
371
|
-
status?: AudioFileStatus;
|
|
372
|
-
taskId?: string;
|
|
373
|
-
uploadStatus?: string;
|
|
374
|
-
statusLink?: string;
|
|
375
|
-
cancelLink?: string;
|
|
376
|
-
downloadLink?: string;
|
|
377
|
-
progressPercent?: number;
|
|
378
|
-
}
|
|
379
|
-
export interface UploadedFileData {
|
|
380
|
-
task_id: string;
|
|
381
|
-
status: string;
|
|
382
|
-
links: {
|
|
383
|
-
status: string;
|
|
384
|
-
cancel: string;
|
|
385
|
-
download: string;
|
|
386
|
-
};
|
|
387
|
-
progress_percent: number;
|
|
388
|
-
}
|
package/dist/src/sdk/types.js
CHANGED
|
@@ -13,11 +13,3 @@ export var RoleType;
|
|
|
13
13
|
RoleType["TRIAL"] = "TRIAL";
|
|
14
14
|
RoleType["PAID"] = "PAID";
|
|
15
15
|
})(RoleType || (RoleType = {}));
|
|
16
|
-
// Audio File types
|
|
17
|
-
export var AudioFileStatus;
|
|
18
|
-
(function (AudioFileStatus) {
|
|
19
|
-
AudioFileStatus["UPLOADED"] = "UPLOADED";
|
|
20
|
-
AudioFileStatus["PROCESSING"] = "PROCESSING";
|
|
21
|
-
AudioFileStatus["TRANSCRIBED"] = "TRANSCRIBED";
|
|
22
|
-
AudioFileStatus["FAILED"] = "FAILED";
|
|
23
|
-
})(AudioFileStatus || (AudioFileStatus = {}));
|
package/dist/src/sdk/urls.d.ts
CHANGED
package/dist/src/sdk/urls.js
CHANGED
|
@@ -33,10 +33,5 @@ const urls = {
|
|
|
33
33
|
userRoles: '/user-roles',
|
|
34
34
|
// Sessions
|
|
35
35
|
sessions: '/sessions',
|
|
36
|
-
getPapareoTranscriptionStatus: '/sessions/get-papareo-server-transcription-status',
|
|
37
|
-
// Agents
|
|
38
|
-
agents: '/agents',
|
|
39
|
-
// Audio Files
|
|
40
|
-
audioFiles: '/audio-files',
|
|
41
36
|
};
|
|
42
37
|
export default urls;
|
package/package.json
CHANGED
package/src/sdk/sdk.ts
CHANGED
|
@@ -37,14 +37,6 @@ import {
|
|
|
37
37
|
Session,
|
|
38
38
|
CreateSessionDto,
|
|
39
39
|
UpdateSessionDto,
|
|
40
|
-
Agent,
|
|
41
|
-
CreateAgentDto,
|
|
42
|
-
UpdateAgentDto,
|
|
43
|
-
AudioFile,
|
|
44
|
-
AudioFileStatus,
|
|
45
|
-
CreateAudioFileDto,
|
|
46
|
-
UpdateAudioFileDto,
|
|
47
|
-
UploadedFileData,
|
|
48
40
|
} from './types';
|
|
49
41
|
import urls from './urls';
|
|
50
42
|
import { jwtDecode } from 'jwt-decode';
|
|
@@ -200,7 +192,11 @@ export class ApiSDK {
|
|
|
200
192
|
}
|
|
201
193
|
|
|
202
194
|
public async logout(): Promise<void> {
|
|
203
|
-
|
|
195
|
+
try {
|
|
196
|
+
await this.request('/auth/logout', 'POST');
|
|
197
|
+
} finally {
|
|
198
|
+
await this.clearAuth();
|
|
199
|
+
}
|
|
204
200
|
}
|
|
205
201
|
|
|
206
202
|
private async clearAuth(): Promise<void> {
|
|
@@ -451,12 +447,13 @@ export class ApiSDK {
|
|
|
451
447
|
// ======================
|
|
452
448
|
|
|
453
449
|
public async generateTranscriptionSummary(
|
|
454
|
-
transcript: string, templateId: string): Promise<TranscriptionSummary> {
|
|
450
|
+
transcript: string, templateId: string, sessionId: string): Promise<TranscriptionSummary> {
|
|
455
451
|
const generateSummaryDto: GenerateTranscriptionSummaryDto = {
|
|
456
452
|
transcript,
|
|
457
453
|
templateId,
|
|
458
454
|
userId: this.user!.id,
|
|
459
455
|
fromUserTemplate: false,
|
|
456
|
+
sessionId: sessionId,
|
|
460
457
|
};
|
|
461
458
|
const transcriptionSummary:TranscriptionSummary = await this.request(
|
|
462
459
|
urls.transcriptionSummary,
|
|
@@ -755,116 +752,4 @@ export class ApiSDK {
|
|
|
755
752
|
return this.request<Session>(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
|
|
756
753
|
}
|
|
757
754
|
|
|
758
|
-
public async getPapareoTranscriptionStatus(sessionId: string): Promise<Session> {
|
|
759
|
-
return this.request<Session>(`${urls.getPapareoTranscriptionStatus}/${sessionId}`, 'GET');
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
// ======================
|
|
763
|
-
// AGENT METHODS
|
|
764
|
-
// ======================
|
|
765
|
-
|
|
766
|
-
public async createAgent(name: string): Promise<Agent> {
|
|
767
|
-
const dto: CreateAgentDto = { name };
|
|
768
|
-
return this.request<Agent>(urls.agents, 'POST', dto);
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
public async getAgents(): Promise<Agent[]> {
|
|
772
|
-
return this.request<Agent[]>(urls.agents, 'GET');
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
public async getAgent(id: string): Promise<Agent> {
|
|
776
|
-
return this.request<Agent>(`${urls.agents}/${id}`, 'GET');
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
public async updateAgent(id: string, name: string): Promise<Agent> {
|
|
780
|
-
const dto: UpdateAgentDto = { name };
|
|
781
|
-
return this.request<Agent>(`${urls.agents}/${id}`, 'PATCH', dto);
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
public async deleteAgent(id: string): Promise<void> {
|
|
785
|
-
await this.request(`${urls.agents}/${id}`, 'DELETE');
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
public async addAgentToOrganization(agentId: string, organizationId: string): Promise<void> {
|
|
789
|
-
await this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'POST');
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
public async removeAgentFromOrganization(agentId: string, organizationId: string): Promise<void> {
|
|
793
|
-
await this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'DELETE');
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
// ======================
|
|
797
|
-
// AUDIO FILE METHODS
|
|
798
|
-
// ======================
|
|
799
|
-
|
|
800
|
-
public async uploadAudioFileToSession(sessionId: string, file: File | Blob, fileName?: string): Promise<AudioFile> {
|
|
801
|
-
const formData = new FormData();
|
|
802
|
-
formData.append('file', file, fileName);
|
|
803
|
-
|
|
804
|
-
return this.fileUploadRequest<AudioFile>(`${urls.audioFiles}/upload/${sessionId}`, formData);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
public async getMyAudioFiles(): Promise<AudioFile[]> {
|
|
808
|
-
return this.request<AudioFile[]>(`${urls.audioFiles}/my-files`, 'GET');
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
public async getAllAudioFiles(): Promise<AudioFile[]> {
|
|
812
|
-
return this.request<AudioFile[]>(`${urls.audioFiles}/all`, 'GET');
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
public async getOrganizationAudioFiles(): Promise<AudioFile[]> {
|
|
816
|
-
return this.request<AudioFile[]>(`${urls.audioFiles}/organization`, 'GET');
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
public async getAudioFilesBySession(sessionId: string): Promise<AudioFile[]> {
|
|
820
|
-
return this.request<AudioFile[]>(`${urls.audioFiles}/session/${sessionId}`, 'GET');
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
public async getAudioFile(id: string): Promise<AudioFile> {
|
|
824
|
-
return this.request<AudioFile>(`${urls.audioFiles}/${id}`, 'GET');
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
public async updateAudioFile(id: string, updates: UpdateAudioFileDto): Promise<AudioFile> {
|
|
828
|
-
return this.request<AudioFile>(`${urls.audioFiles}/${id}`, 'PATCH', updates);
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
public async deleteAudioFile(id: string): Promise<void> {
|
|
832
|
-
await this.request(`${urls.audioFiles}/${id}`, 'DELETE');
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
public async downloadAudioFile(id: string): Promise<Blob> {
|
|
836
|
-
// For file downloads, we need a different approach than JSON requests
|
|
837
|
-
const url = `${this.baseUrl}${urls.audioFiles}/${id}/download`;
|
|
838
|
-
|
|
839
|
-
// Get token first
|
|
840
|
-
await this.getToken();
|
|
841
|
-
|
|
842
|
-
const defaultHeaders: Record<string, string> = {
|
|
843
|
-
'ngrok-skip-browser-warning': 'true'
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
if (this.accessToken) {
|
|
847
|
-
defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
const response = await fetch(url, {
|
|
851
|
-
method: 'GET',
|
|
852
|
-
headers: defaultHeaders,
|
|
853
|
-
});
|
|
854
|
-
|
|
855
|
-
if (!response.ok) {
|
|
856
|
-
const errorData = await response.json().catch(() => ({}));
|
|
857
|
-
throw new Error(
|
|
858
|
-
errorData.message || `Download failed with status ${response.status}`
|
|
859
|
-
);
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
return response.blob();
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
public async downloadAudioFileAsUrl(id: string): Promise<string> {
|
|
866
|
-
const blob = await this.downloadAudioFile(id);
|
|
867
|
-
return URL.createObjectURL(blob);
|
|
868
|
-
}
|
|
869
|
-
|
|
870
755
|
}
|
package/src/sdk/types.ts
CHANGED
|
@@ -43,7 +43,6 @@ export interface Organization {
|
|
|
43
43
|
|
|
44
44
|
users?: User[];
|
|
45
45
|
roles?: OrganizationRole[];
|
|
46
|
-
agents?: AgentOrganization[];
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
// User type
|
|
@@ -129,6 +128,7 @@ export interface GenerateTranscriptionSummaryDto {
|
|
|
129
128
|
templateId: string;
|
|
130
129
|
userId?: string;
|
|
131
130
|
fromUserTemplate?: boolean;
|
|
131
|
+
sessionId?: string; // Optional session ID for linking to a session
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
// Transcription summary update DTO
|
|
@@ -352,7 +352,7 @@ export interface Session {
|
|
|
352
352
|
sessionName?: string;
|
|
353
353
|
createdAt: string;
|
|
354
354
|
updatedAt: string;
|
|
355
|
-
templateId
|
|
355
|
+
templateId?: string;
|
|
356
356
|
userId: string;
|
|
357
357
|
primaryTranscriptionSummaryId?: string;
|
|
358
358
|
|
|
@@ -361,7 +361,6 @@ export interface Session {
|
|
|
361
361
|
template?: Template;
|
|
362
362
|
transcriptionSummaries?: TranscriptionSummary[];
|
|
363
363
|
primaryTranscriptionSummary?: TranscriptionSummary;
|
|
364
|
-
audioFiles?: AudioFile[];
|
|
365
364
|
}
|
|
366
365
|
|
|
367
366
|
// Session DTOs
|
|
@@ -370,7 +369,7 @@ export interface CreateSessionDto {
|
|
|
370
369
|
dateTime: string;
|
|
371
370
|
startDateTime?: string;
|
|
372
371
|
stopDateTime?: string;
|
|
373
|
-
templateId
|
|
372
|
+
templateId?: string;
|
|
374
373
|
templateName?: string;
|
|
375
374
|
summary?: string;
|
|
376
375
|
sessionName?: string;
|
|
@@ -389,99 +388,3 @@ export interface UpdateSessionDto {
|
|
|
389
388
|
sessionName?: string;
|
|
390
389
|
primaryTranscriptionSummaryId?: string;
|
|
391
390
|
}
|
|
392
|
-
|
|
393
|
-
// Agent types
|
|
394
|
-
export interface Agent {
|
|
395
|
-
id: string;
|
|
396
|
-
name: string;
|
|
397
|
-
createdAt: string;
|
|
398
|
-
updatedAt: string;
|
|
399
|
-
organizations?: AgentOrganization[];
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// Agent Organization association
|
|
403
|
-
export interface AgentOrganization {
|
|
404
|
-
agentId: string;
|
|
405
|
-
organizationId: string;
|
|
406
|
-
createdAt: string;
|
|
407
|
-
agent?: Agent;
|
|
408
|
-
organization?: Organization;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// Agent DTOs
|
|
412
|
-
export interface CreateAgentDto {
|
|
413
|
-
name: string;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
export interface UpdateAgentDto {
|
|
417
|
-
name?: string;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// Audio File types
|
|
421
|
-
export enum AudioFileStatus {
|
|
422
|
-
UPLOADED = 'UPLOADED',
|
|
423
|
-
PROCESSING = 'PROCESSING',
|
|
424
|
-
TRANSCRIBED = 'TRANSCRIBED',
|
|
425
|
-
FAILED = 'FAILED',
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
export interface AudioFile {
|
|
429
|
-
id: string;
|
|
430
|
-
originalName: string;
|
|
431
|
-
fileName: string;
|
|
432
|
-
filePath: string;
|
|
433
|
-
fileSize: number;
|
|
434
|
-
mimeType: string;
|
|
435
|
-
uploadId?: string;
|
|
436
|
-
transcriptionUrl?: string;
|
|
437
|
-
status: AudioFileStatus;
|
|
438
|
-
taskId?: string;
|
|
439
|
-
uploadStatus?: string;
|
|
440
|
-
statusLink?: string;
|
|
441
|
-
cancelLink?: string;
|
|
442
|
-
downloadLink?: string;
|
|
443
|
-
progressPercent?: number;
|
|
444
|
-
createdAt: string;
|
|
445
|
-
updatedAt: string;
|
|
446
|
-
sessionId: string;
|
|
447
|
-
userId: string;
|
|
448
|
-
|
|
449
|
-
// Relationships (populated by API)
|
|
450
|
-
session?: Session;
|
|
451
|
-
user?: User;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// Audio File DTOs
|
|
455
|
-
export interface CreateAudioFileDto {
|
|
456
|
-
originalName: string;
|
|
457
|
-
fileName: string;
|
|
458
|
-
filePath: string;
|
|
459
|
-
fileSize: number;
|
|
460
|
-
mimeType: string;
|
|
461
|
-
uploadId?: string;
|
|
462
|
-
sessionId: string;
|
|
463
|
-
// userId will be auto-injected by API
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
export interface UpdateAudioFileDto {
|
|
467
|
-
transcriptionUrl?: string;
|
|
468
|
-
status?: AudioFileStatus;
|
|
469
|
-
taskId?: string;
|
|
470
|
-
uploadStatus?: string;
|
|
471
|
-
statusLink?: string;
|
|
472
|
-
cancelLink?: string;
|
|
473
|
-
downloadLink?: string;
|
|
474
|
-
progressPercent?: number;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// UploadedFileData interface for the upload response
|
|
478
|
-
export interface UploadedFileData {
|
|
479
|
-
task_id: string;
|
|
480
|
-
status: string;
|
|
481
|
-
links: {
|
|
482
|
-
status: string;
|
|
483
|
-
cancel: string;
|
|
484
|
-
download: string;
|
|
485
|
-
};
|
|
486
|
-
progress_percent: number;
|
|
487
|
-
}
|
package/src/sdk/urls.ts
CHANGED
|
@@ -40,13 +40,6 @@ const urls = {
|
|
|
40
40
|
|
|
41
41
|
// Sessions
|
|
42
42
|
sessions: '/sessions',
|
|
43
|
-
getPapareoTranscriptionStatus: '/sessions/get-papareo-server-transcription-status',
|
|
44
|
-
|
|
45
|
-
// Agents
|
|
46
|
-
agents: '/agents',
|
|
47
|
-
|
|
48
|
-
// Audio Files
|
|
49
|
-
audioFiles: '/audio-files',
|
|
50
43
|
}
|
|
51
44
|
|
|
52
45
|
export default urls;
|