whio-api-sdk 1.1.28 → 1.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/sdk/modules/agent.module.d.ts +90 -5
- package/dist/src/sdk/modules/agent.module.js +87 -2
- package/dist/src/sdk/modules/audio.module.d.ts +143 -2
- package/dist/src/sdk/modules/audio.module.js +144 -5
- package/dist/src/sdk/modules/auth.module.d.ts +67 -0
- package/dist/src/sdk/modules/auth.module.js +81 -0
- package/dist/src/sdk/modules/data-strategy.module.d.ts +45 -7
- package/dist/src/sdk/modules/data-strategy.module.js +39 -1
- package/dist/src/sdk/modules/external-integration.module.d.ts +30 -0
- package/dist/src/sdk/modules/external-integration.module.js +30 -0
- package/dist/src/sdk/modules/integration-action.module.d.ts +39 -0
- package/dist/src/sdk/modules/integration-action.module.js +39 -0
- package/dist/src/sdk/modules/log.module.d.ts +4 -4
- package/dist/src/sdk/modules/organization.module.d.ts +62 -3
- package/dist/src/sdk/modules/organization.module.js +61 -2
- package/dist/src/sdk/modules/patient.module.d.ts +5 -2
- package/dist/src/sdk/modules/patient.module.js +5 -2
- package/dist/src/sdk/modules/reports.module.d.ts +4 -4
- package/dist/src/sdk/modules/reports.module.js +6 -6
- package/dist/src/sdk/modules/session/orgadmin-session.module.d.ts +46 -1
- package/dist/src/sdk/modules/session/orgadmin-session.module.js +53 -6
- package/dist/src/sdk/modules/session/session.module.d.ts +62 -1
- package/dist/src/sdk/modules/session/session.module.js +64 -1
- package/dist/src/sdk/modules/session/superuser-session.module.d.ts +46 -1
- package/dist/src/sdk/modules/session/superuser-session.module.js +52 -5
- package/dist/src/sdk/modules/session.module.d.ts +142 -3
- package/dist/src/sdk/modules/session.module.js +153 -12
- package/dist/src/sdk/modules/team.module.d.ts +56 -4
- package/dist/src/sdk/modules/team.module.js +54 -6
- package/dist/src/sdk/modules/template.module.d.ts +96 -4
- package/dist/src/sdk/modules/template.module.js +95 -24
- package/dist/src/sdk/modules/transcription-summary.module.d.ts +60 -3
- package/dist/src/sdk/modules/transcription-summary.module.js +60 -7
- package/dist/src/sdk/modules/user.module.d.ts +127 -0
- package/dist/src/sdk/modules/user.module.js +136 -1
- package/dist/src/sdk/modules/websocket.module.d.ts +25 -8
- package/dist/src/sdk/modules/websocket.module.js +23 -6
- package/dist/src/sdk/modules/workflow.module.d.ts +39 -0
- package/dist/src/sdk/modules/workflow.module.js +39 -0
- package/dist/src/sdk/sdk.d.ts +23 -29
- package/dist/src/sdk/sdk.js +14 -44
- package/dist/src/sdk/types/agent.types.d.ts +3 -0
- package/dist/src/sdk/types/audio.types.d.ts +8 -9
- package/dist/src/sdk/types/data-strategy.types.d.ts +3 -0
- package/dist/src/sdk/types/external-integration.types.d.ts +6 -0
- package/dist/src/sdk/types/log.types.d.ts +2 -21
- package/dist/src/sdk/types/patient.types.d.ts +2 -3
- package/dist/src/sdk/types/reports.types.d.ts +1 -1
- package/dist/src/sdk/types/session.types.d.ts +8 -8
- package/dist/src/sdk/types/team.types.d.ts +4 -3
- package/dist/src/sdk/types/template.types.d.ts +15 -7
- package/dist/src/sdk/types/user.types.d.ts +6 -0
- package/dist/src/sdk/types/websocket.types.d.ts +4 -10
- package/dist/src/sdk/urls.d.ts +2 -4
- package/dist/src/sdk/urls.js +2 -5
- package/dist/src/sdk/whio-orgadmin-sdk.d.ts +9 -7
- package/dist/src/sdk/whio-orgadmin-sdk.js +10 -0
- package/dist/src/sdk/whio-sdk.d.ts +15 -8
- package/dist/src/sdk/whio-sdk.js +46 -18
- package/dist/src/sdk/whio-superuser-sdk.d.ts +14 -16
- package/dist/src/sdk/whio-superuser-sdk.js +11 -16
- package/dist/src/sdk/whio-teamadmin-sdk.d.ts +4 -8
- package/dist/src/sdk/whio-teamadmin-sdk.js +1 -18
- package/package.json +1 -1
- package/src/sdk/modules/agent.module.ts +94 -9
- package/src/sdk/modules/audio.module.ts +146 -8
- package/src/sdk/modules/auth.module.ts +88 -0
- package/src/sdk/modules/data-strategy.module.ts +51 -13
- package/src/sdk/modules/external-integration.module.ts +30 -0
- package/src/sdk/modules/integration-action.module.ts +39 -0
- package/src/sdk/modules/log.module.ts +4 -4
- package/src/sdk/modules/organization.module.ts +64 -5
- package/src/sdk/modules/patient.module.ts +5 -2
- package/src/sdk/modules/reports.module.ts +6 -6
- package/src/sdk/modules/session/orgadmin-session.module.ts +53 -7
- package/src/sdk/modules/session/session.module.ts +64 -2
- package/src/sdk/modules/session/superuser-session.module.ts +52 -6
- package/src/sdk/modules/session.module.ts +155 -15
- package/src/sdk/modules/team.module.ts +58 -9
- package/src/sdk/modules/template.module.ts +95 -32
- package/src/sdk/modules/transcription-summary.module.ts +62 -8
- package/src/sdk/modules/user.module.ts +135 -2
- package/src/sdk/modules/websocket.module.ts +26 -8
- package/src/sdk/modules/workflow.module.ts +39 -0
- package/src/sdk/sdk.ts +12 -37
- package/src/sdk/types/agent.types.ts +5 -0
- package/src/sdk/types/audio.types.ts +8 -10
- package/src/sdk/types/data-strategy.types.ts +3 -0
- package/src/sdk/types/external-integration.types.ts +6 -0
- package/src/sdk/types/log.types.ts +4 -23
- package/src/sdk/types/patient.types.ts +2 -3
- package/src/sdk/types/reports.types.ts +1 -1
- package/src/sdk/types/session.types.ts +8 -8
- package/src/sdk/types/team.types.ts +5 -3
- package/src/sdk/types/template.types.ts +18 -7
- package/src/sdk/types/user.types.ts +6 -0
- package/src/sdk/types/websocket.types.ts +8 -7
- package/src/sdk/urls.ts +3 -8
- package/src/sdk/whio-orgadmin-sdk.ts +8 -0
- package/src/sdk/whio-sdk.ts +39 -16
- package/src/sdk/whio-superuser-sdk.ts +9 -16
- package/src/sdk/whio-teamadmin-sdk.ts +1 -16
- package/tsconfig.json +1 -1
- package/src/sdk/modules/debug.module.ts +0 -44
|
@@ -2,6 +2,7 @@ import { BaseClient } from './base-client';
|
|
|
2
2
|
import {
|
|
3
3
|
TranscriptionSummary,
|
|
4
4
|
GenerateTranscriptionSummaryDto,
|
|
5
|
+
GenerateSummaryResponse,
|
|
5
6
|
CreateTranscriptionSummaryDto,
|
|
6
7
|
UpdateTranscriptionSummaryDto,
|
|
7
8
|
CloneTranscriptionSummaryDto,
|
|
@@ -13,48 +14,95 @@ export class TranscriptionSummaryModule extends BaseClient {
|
|
|
13
14
|
// TRANSCRIPTION SUMMARY METHODS
|
|
14
15
|
// ======================
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Queue a transcription summary for generation, or update the template if no transcription exists yet.
|
|
19
|
+
*
|
|
20
|
+
* @param templateId - UUID of the template to apply.
|
|
21
|
+
* @param sessionId - UUID of the session whose transcription is summarised.
|
|
22
|
+
* @returns Either a queued-job response (`{ message, jobId, sessionId }`) or a template-updated
|
|
23
|
+
* response (`{ message, sessionId }`).
|
|
24
|
+
*/
|
|
25
|
+
public async generateTranscriptionSummary(templateId: string, sessionId: string): Promise<GenerateSummaryResponse> {
|
|
17
26
|
const user = this.validateUser();
|
|
18
27
|
const generateSummaryDto: GenerateTranscriptionSummaryDto = {
|
|
19
28
|
templateId,
|
|
20
29
|
userId: user.id,
|
|
21
30
|
sessionId: sessionId,
|
|
22
31
|
};
|
|
23
|
-
|
|
32
|
+
return this.request<GenerateSummaryResponse>(
|
|
24
33
|
urls.transcriptionSummary,
|
|
25
34
|
'POST',
|
|
26
35
|
generateSummaryDto
|
|
27
36
|
);
|
|
28
|
-
return transcriptionSummary;
|
|
29
37
|
}
|
|
30
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Create a transcription summary record; the current user is supplied server-side.
|
|
41
|
+
*
|
|
42
|
+
* @param dto - Summary fields (template, content, optional session and anonymised transcript).
|
|
43
|
+
* @returns The created transcription summary.
|
|
44
|
+
*/
|
|
31
45
|
public async createTranscriptionSummary(dto: Omit<CreateTranscriptionSummaryDto, 'userId'>): Promise<TranscriptionSummary> {
|
|
32
46
|
return this.request<TranscriptionSummary>(urls.transcriptionSummaryCreate, 'POST', dto);
|
|
33
47
|
}
|
|
34
48
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Update a transcription summary.
|
|
51
|
+
*
|
|
52
|
+
* @param id - UUID of the transcription summary to update.
|
|
53
|
+
* @param dto - Fields to update (content, anonymised transcript, and/or template).
|
|
54
|
+
* @returns The updated transcription summary.
|
|
55
|
+
*/
|
|
56
|
+
public async updateTranscriptionSummary(id: string, dto: UpdateTranscriptionSummaryDto): Promise<TranscriptionSummary> {
|
|
57
|
+
return this.request<TranscriptionSummary>(`${urls.transcriptionSummaries}/${id}`, 'PATCH', dto);
|
|
40
58
|
}
|
|
41
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Retrieve all transcription summaries accessible to the current user.
|
|
62
|
+
*
|
|
63
|
+
* @returns An array of transcription summaries.
|
|
64
|
+
*/
|
|
42
65
|
public async getTranscriptionSummaries(): Promise<TranscriptionSummary[]> {
|
|
43
66
|
return this.request<TranscriptionSummary[]>(urls.transcriptionSummaries, 'GET');
|
|
44
67
|
}
|
|
45
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Retrieve a single transcription summary by id.
|
|
71
|
+
*
|
|
72
|
+
* @param id - UUID of the transcription summary.
|
|
73
|
+
* @returns The requested transcription summary.
|
|
74
|
+
*/
|
|
46
75
|
public async getTranscriptionSummary(id: string): Promise<TranscriptionSummary> {
|
|
47
76
|
return this.request<TranscriptionSummary>(`${urls.transcriptionSummaries}/${id}`, 'GET');
|
|
48
77
|
}
|
|
49
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Retrieve all transcription summaries belonging to a specific user.
|
|
81
|
+
*
|
|
82
|
+
* @param userId - UUID of the user whose summaries are returned.
|
|
83
|
+
* @returns An array of transcription summaries.
|
|
84
|
+
*/
|
|
50
85
|
public async getTranscriptionSummariesByUser(userId: string): Promise<TranscriptionSummary[]> {
|
|
51
86
|
return this.request<TranscriptionSummary[]>(`${urls.transcriptionSummaries}/user/${userId}`, 'GET');
|
|
52
87
|
}
|
|
53
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Retrieve all transcription summaries belonging to a specific organization.
|
|
91
|
+
*
|
|
92
|
+
* @param organizationId - UUID of the organization whose summaries are returned.
|
|
93
|
+
* @returns An array of transcription summaries.
|
|
94
|
+
*/
|
|
54
95
|
public async getByOrganizationTranscriptionSummaries(organizationId: string): Promise<TranscriptionSummary[]> {
|
|
55
96
|
return this.request<TranscriptionSummary[]>(`${urls.transcriptionSummaries}/organization/${organizationId}`, 'GET');
|
|
56
97
|
}
|
|
57
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Clone an existing transcription summary with new content.
|
|
101
|
+
*
|
|
102
|
+
* @param id - UUID of the transcription summary to clone.
|
|
103
|
+
* @param content - Content for the cloned summary.
|
|
104
|
+
* @returns The newly created clone.
|
|
105
|
+
*/
|
|
58
106
|
public async cloneTranscriptionSummary(id: string, content: string): Promise<TranscriptionSummary> {
|
|
59
107
|
const cloneDto: CloneTranscriptionSummaryDto = {
|
|
60
108
|
content,
|
|
@@ -62,6 +110,12 @@ export class TranscriptionSummaryModule extends BaseClient {
|
|
|
62
110
|
return this.request<TranscriptionSummary>(`${urls.transcriptionSummaries}/${id}/clone`, 'POST', cloneDto);
|
|
63
111
|
}
|
|
64
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Delete a transcription summary by id.
|
|
115
|
+
*
|
|
116
|
+
* @param id - UUID of the transcription summary to delete.
|
|
117
|
+
* @returns A promise that resolves once the summary is deleted.
|
|
118
|
+
*/
|
|
65
119
|
public async deleteTranscriptionSummary(id: string): Promise<void> {
|
|
66
120
|
await this.request(`${urls.transcriptionSummaries}/${id}`, 'DELETE');
|
|
67
121
|
}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { BaseClient } from './base-client';
|
|
2
|
-
import { User, CreateUserDto, UpdateUserDto, UpdateUserNamesDto, AddExpoPushTokenDto, Organization, AssignOrganizationRoleDto, OrganizationRoleType } from '../types';
|
|
2
|
+
import { User, CreateUserDto, UpdateUserDto, UpdateUserNamesDto, AddExpoPushTokenDto, Organization, AssignOrganizationRoleDto, OrganizationRoleType, UserOrganizationRole } from '../types';
|
|
3
3
|
import urls from '../urls';
|
|
4
4
|
|
|
5
5
|
export class UserModule extends BaseClient {
|
|
6
|
+
/**
|
|
7
|
+
* Create a user in the current user's organization.
|
|
8
|
+
*
|
|
9
|
+
* @param firstName - First name of the new user.
|
|
10
|
+
* @param lastName - Last name of the new user.
|
|
11
|
+
* @param email - Email address of the new user.
|
|
12
|
+
* @param password - Initial password for the new user.
|
|
13
|
+
* @returns The newly created user.
|
|
14
|
+
*/
|
|
6
15
|
public async createUser(
|
|
7
16
|
firstName: string,
|
|
8
17
|
lastName: string,
|
|
@@ -35,69 +44,193 @@ export class UserModule extends BaseClient {
|
|
|
35
44
|
userId: userId,
|
|
36
45
|
organizationRoleId: orgRoleEditor.id,
|
|
37
46
|
};
|
|
38
|
-
this.request(urls.userOrganizationRoles, 'POST', assignRoleDto);
|
|
47
|
+
await this.request<UserOrganizationRole>(urls.userOrganizationRoles, 'POST', assignRoleDto);
|
|
39
48
|
const userWithOrgRole = await this.request<User>(`${urls.user}/${userId}`, 'GET');
|
|
40
49
|
return userWithOrgRole;
|
|
41
50
|
}
|
|
42
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Assign the editor organization role to a user.
|
|
54
|
+
*
|
|
55
|
+
* @param userId - UUID of the user to assign the role to.
|
|
56
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
57
|
+
* @returns The user with the assigned organization role.
|
|
58
|
+
*/
|
|
43
59
|
public async assignEditorToRoleToUser(userId: string, organizationId?: string): Promise<User> {
|
|
44
60
|
return this.assignRoleToUser(userId, OrganizationRoleType.EDITOR, organizationId);
|
|
45
61
|
}
|
|
46
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Assign the admin organization role to a user.
|
|
65
|
+
*
|
|
66
|
+
* @param userId - UUID of the user to assign the role to.
|
|
67
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
68
|
+
* @returns The user with the assigned organization role.
|
|
69
|
+
*/
|
|
47
70
|
public async assignAdminToRoleToUser(userId: string, organizationId?: string): Promise<User> {
|
|
48
71
|
return this.assignRoleToUser(userId, OrganizationRoleType.ADMIN, organizationId);
|
|
49
72
|
}
|
|
50
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Assign the disabled organization role to a user.
|
|
76
|
+
*
|
|
77
|
+
* @param userId - UUID of the user to assign the role to.
|
|
78
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
79
|
+
* @returns The user with the assigned organization role.
|
|
80
|
+
*/
|
|
51
81
|
public async assignDisabledToRoleToUser(userId: string, organizationId?: string): Promise<User> {
|
|
52
82
|
return this.assignRoleToUser(userId, OrganizationRoleType.DISABLED, organizationId);
|
|
53
83
|
}
|
|
54
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Remove an organization role from a user.
|
|
87
|
+
*
|
|
88
|
+
* @param userId - UUID of the user.
|
|
89
|
+
* @param organizationRoleId - UUID of the organization role to remove.
|
|
90
|
+
* @returns A promise that resolves when the role is removed.
|
|
91
|
+
*/
|
|
55
92
|
public async removeRoleFromUser(userId: string, organizationRoleId: string): Promise<void> {
|
|
56
93
|
await this.request(`${urls.userOrganizationRoles}/${userId}/${organizationRoleId}`, 'DELETE');
|
|
57
94
|
}
|
|
58
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Create a user and assign them the editor organization role.
|
|
98
|
+
*
|
|
99
|
+
* @param firstName - First name of the new user.
|
|
100
|
+
* @param lastName - Last name of the new user.
|
|
101
|
+
* @param email - Email address of the new user.
|
|
102
|
+
* @param password - Initial password for the new user.
|
|
103
|
+
* @returns The newly created user with the editor role assigned.
|
|
104
|
+
*/
|
|
59
105
|
public async createEditorUser(firstName: string, lastName: string, email: string, password: string): Promise<User> {
|
|
60
106
|
const user = await this.createUser(firstName, lastName, email, password);
|
|
61
107
|
const userWithOrgRole = await this.assignEditorToRoleToUser(user.id);
|
|
62
108
|
return userWithOrgRole;
|
|
63
109
|
}
|
|
64
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Create a user and assign them the admin organization role.
|
|
113
|
+
*
|
|
114
|
+
* @param firstName - First name of the new user.
|
|
115
|
+
* @param lastName - Last name of the new user.
|
|
116
|
+
* @param email - Email address of the new user.
|
|
117
|
+
* @param password - Initial password for the new user.
|
|
118
|
+
* @returns The newly created user with the admin role assigned.
|
|
119
|
+
*/
|
|
65
120
|
public async createAdminUser(firstName: string, lastName: string, email: string, password: string): Promise<User> {
|
|
66
121
|
const user = await this.createUser(firstName, lastName, email, password);
|
|
67
122
|
const userWithOrgRole = await this.assignAdminToRoleToUser(user.id);
|
|
68
123
|
return userWithOrgRole;
|
|
69
124
|
}
|
|
70
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Create a user and assign them the disabled organization role.
|
|
128
|
+
*
|
|
129
|
+
* @param firstName - First name of the new user.
|
|
130
|
+
* @param lastName - Last name of the new user.
|
|
131
|
+
* @param email - Email address of the new user.
|
|
132
|
+
* @param password - Initial password for the new user.
|
|
133
|
+
* @returns The newly created user with the disabled role assigned.
|
|
134
|
+
*/
|
|
71
135
|
public async createDisabledUser(firstName: string, lastName: string, email: string, password: string): Promise<User> {
|
|
72
136
|
const user = await this.createUser(firstName, lastName, email, password);
|
|
73
137
|
const userWithOrgRole = await this.assignDisabledToRoleToUser(user.id);
|
|
74
138
|
return userWithOrgRole;
|
|
75
139
|
}
|
|
76
140
|
|
|
141
|
+
/**
|
|
142
|
+
* List all users the current user can access.
|
|
143
|
+
*
|
|
144
|
+
* @returns An array of users.
|
|
145
|
+
*/
|
|
77
146
|
public async getUsers(): Promise<User[]> {
|
|
78
147
|
return this.request<User[]>(urls.users, 'GET');
|
|
79
148
|
}
|
|
80
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Get a single user by ID.
|
|
152
|
+
*
|
|
153
|
+
* @param id - UUID of the user.
|
|
154
|
+
* @returns The requested user.
|
|
155
|
+
*/
|
|
81
156
|
public async getUser(id: string): Promise<User> {
|
|
82
157
|
return this.request<User>(`${urls.users}/${id}`, 'GET');
|
|
83
158
|
}
|
|
84
159
|
|
|
160
|
+
/**
|
|
161
|
+
* List all users belonging to an organization.
|
|
162
|
+
*
|
|
163
|
+
* @param organizationId - UUID of the organization.
|
|
164
|
+
* @returns An array of users in the organization.
|
|
165
|
+
*/
|
|
85
166
|
public async getUsersByOrganization(organizationId: string): Promise<User[]> {
|
|
86
167
|
return this.request<User[]>(`${urls.users}/organization/${organizationId}`, 'GET');
|
|
87
168
|
}
|
|
88
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Update a user by ID.
|
|
172
|
+
*
|
|
173
|
+
* @param id - UUID of the user to update.
|
|
174
|
+
* @param data - Fields to update on the user.
|
|
175
|
+
* @returns The updated user.
|
|
176
|
+
*/
|
|
89
177
|
public async updateUser(id: string, data: UpdateUserDto): Promise<User> {
|
|
90
178
|
return this.request<User>(`${urls.users}/${id}`, 'PATCH', data);
|
|
91
179
|
}
|
|
92
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Activate (enable) a user by ID.
|
|
183
|
+
*
|
|
184
|
+
* Requires superuser or organization-admin privileges; an organization admin
|
|
185
|
+
* may only activate users within their own organization.
|
|
186
|
+
*
|
|
187
|
+
* @param id - UUID of the user to activate.
|
|
188
|
+
* @returns The updated user with `isActive` set to `true`.
|
|
189
|
+
*/
|
|
190
|
+
public async activateUser(id: string): Promise<User> {
|
|
191
|
+
return this.request<User>(`${urls.users}/${id}/activate`, 'PATCH');
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Deactivate (disable) a user by ID.
|
|
196
|
+
*
|
|
197
|
+
* Requires superuser or organization-admin privileges; an organization admin
|
|
198
|
+
* may only deactivate users within their own organization. Deactivation takes
|
|
199
|
+
* effect immediately: the user can no longer authenticate.
|
|
200
|
+
*
|
|
201
|
+
* @param id - UUID of the user to deactivate.
|
|
202
|
+
* @returns The updated user with `isActive` set to `false`.
|
|
203
|
+
*/
|
|
204
|
+
public async deactivateUser(id: string): Promise<User> {
|
|
205
|
+
return this.request<User>(`${urls.users}/${id}/deactivate`, 'PATCH');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Delete a user by ID.
|
|
210
|
+
*
|
|
211
|
+
* @param id - UUID of the user to delete.
|
|
212
|
+
* @returns A promise that resolves when the user is deleted.
|
|
213
|
+
*/
|
|
93
214
|
public async deleteUser(id: string): Promise<void> {
|
|
94
215
|
await this.request(`${urls.users}/${id}`, 'DELETE');
|
|
95
216
|
}
|
|
96
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Update the current user's first and/or last name.
|
|
220
|
+
*
|
|
221
|
+
* @param data - The name fields to update.
|
|
222
|
+
* @returns The updated user.
|
|
223
|
+
*/
|
|
97
224
|
public async updateNames(data: UpdateUserNamesDto): Promise<User> {
|
|
98
225
|
return this.request<User>(`${urls.users}/names`, 'PATCH', data);
|
|
99
226
|
}
|
|
100
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Register an Expo push token for the current user.
|
|
230
|
+
*
|
|
231
|
+
* @param token - The Expo push token to add.
|
|
232
|
+
* @returns A confirmation message.
|
|
233
|
+
*/
|
|
101
234
|
public async addExpoPushToken(token: string): Promise<{ message: string }> {
|
|
102
235
|
const dto: AddExpoPushTokenDto = { token };
|
|
103
236
|
return this.request<{ message: string }>(`${urls.users}/expo-push-token`, 'POST', dto);
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
WebSocketEvents,
|
|
7
7
|
AudioChunkPayload,
|
|
8
8
|
AudioChunkOptions,
|
|
9
|
-
AudioStreamingOptions
|
|
9
|
+
AudioStreamingOptions,
|
|
10
|
+
SDKConfig
|
|
10
11
|
} from '../types';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -23,7 +24,7 @@ export class WebSocketModule extends BaseClient {
|
|
|
23
24
|
private connectionStats: WebSocketConnectionStats;
|
|
24
25
|
private eventHandlers: Map<keyof WebSocketEvents, Function[]> = new Map();
|
|
25
26
|
|
|
26
|
-
constructor(baseConfig:
|
|
27
|
+
constructor(baseConfig: SDKConfig) {
|
|
27
28
|
super(baseConfig);
|
|
28
29
|
|
|
29
30
|
const wsConfig = baseConfig.websocket || {};
|
|
@@ -136,14 +137,18 @@ export class WebSocketModule extends BaseClient {
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
/**
|
|
139
|
-
* Check if WebSocket is connected
|
|
140
|
+
* Check if the WebSocket is currently connected.
|
|
141
|
+
*
|
|
142
|
+
* @returns `true` when the underlying socket is connected, otherwise `false`.
|
|
140
143
|
*/
|
|
141
144
|
public isConnected(): boolean {
|
|
142
145
|
return this.socket?.connected || false;
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
/**
|
|
146
|
-
* Get connection statistics
|
|
149
|
+
* Get a snapshot of the current connection statistics.
|
|
150
|
+
*
|
|
151
|
+
* @returns A copy of the connection stats (connection state, reconnect count, last connect/disconnect times).
|
|
147
152
|
*/
|
|
148
153
|
public getConnectionStats(): WebSocketConnectionStats {
|
|
149
154
|
return { ...this.connectionStats };
|
|
@@ -185,7 +190,12 @@ export class WebSocketModule extends BaseClient {
|
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
/**
|
|
188
|
-
* Stream multiple audio chunks
|
|
193
|
+
* Stream multiple audio chunks sequentially, with an optional delay between each.
|
|
194
|
+
*
|
|
195
|
+
* @param sessionId - Session ID to associate the chunks with.
|
|
196
|
+
* @param audioChunks - Ordered array of Base64 encoded audio data.
|
|
197
|
+
* @param options - Streaming options (e.g. `delayBetweenChunks` in ms, default 100).
|
|
198
|
+
* @throws Error if the WebSocket is not connected after token validation.
|
|
189
199
|
*/
|
|
190
200
|
public async streamAudioChunks(
|
|
191
201
|
sessionId: string,
|
|
@@ -213,7 +223,10 @@ export class WebSocketModule extends BaseClient {
|
|
|
213
223
|
}
|
|
214
224
|
|
|
215
225
|
/**
|
|
216
|
-
*
|
|
226
|
+
* Register an event listener for a WebSocket event.
|
|
227
|
+
*
|
|
228
|
+
* @param event - The event name to listen for.
|
|
229
|
+
* @param handler - Callback invoked with the event payload.
|
|
217
230
|
*/
|
|
218
231
|
public on<K extends keyof WebSocketEvents>(
|
|
219
232
|
event: K,
|
|
@@ -226,7 +239,10 @@ export class WebSocketModule extends BaseClient {
|
|
|
226
239
|
}
|
|
227
240
|
|
|
228
241
|
/**
|
|
229
|
-
* Remove event listener
|
|
242
|
+
* Remove a previously registered event listener.
|
|
243
|
+
*
|
|
244
|
+
* @param event - The event name the handler was registered for.
|
|
245
|
+
* @param handler - The exact handler reference to remove.
|
|
230
246
|
*/
|
|
231
247
|
public off<K extends keyof WebSocketEvents>(
|
|
232
248
|
event: K,
|
|
@@ -384,7 +400,9 @@ export class WebSocketModule extends BaseClient {
|
|
|
384
400
|
}
|
|
385
401
|
|
|
386
402
|
/**
|
|
387
|
-
*
|
|
403
|
+
* Disconnect the socket and clear all registered event handlers.
|
|
404
|
+
*
|
|
405
|
+
* Call this when the client is no longer needed to release resources.
|
|
388
406
|
*/
|
|
389
407
|
public destroy(): void {
|
|
390
408
|
this.disconnect();
|
|
@@ -3,6 +3,13 @@ import { Workflow, CreateWorkflowDto, UpdateWorkflowDto } from '../types';
|
|
|
3
3
|
import urls from '../urls';
|
|
4
4
|
|
|
5
5
|
export class WorkflowModule extends BaseClient {
|
|
6
|
+
/**
|
|
7
|
+
* Create a workflow for an organization.
|
|
8
|
+
*
|
|
9
|
+
* @param name - Display name of the workflow.
|
|
10
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
11
|
+
* @returns The created workflow.
|
|
12
|
+
*/
|
|
6
13
|
public async createWorkflow(name: string, organizationId?: string): Promise<Workflow> {
|
|
7
14
|
const dto: CreateWorkflowDto = {
|
|
8
15
|
name,
|
|
@@ -11,20 +18,46 @@ export class WorkflowModule extends BaseClient {
|
|
|
11
18
|
return this.request<Workflow>(urls.workflows, 'POST', dto);
|
|
12
19
|
}
|
|
13
20
|
|
|
21
|
+
/**
|
|
22
|
+
* List workflows, optionally filtered by organization.
|
|
23
|
+
*
|
|
24
|
+
* @param organizationId - Optional organization UUID to filter by.
|
|
25
|
+
* @returns An array of workflows.
|
|
26
|
+
*/
|
|
14
27
|
public async getWorkflows(organizationId?: string): Promise<Workflow[]> {
|
|
15
28
|
const params = organizationId ? `?organizationId=${organizationId}` : '';
|
|
16
29
|
return this.request<Workflow[]>(`${urls.workflows}${params}`, 'GET');
|
|
17
30
|
}
|
|
18
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Get a single workflow by id.
|
|
34
|
+
*
|
|
35
|
+
* @param id - UUID of the workflow.
|
|
36
|
+
* @returns The workflow.
|
|
37
|
+
*/
|
|
19
38
|
public async getWorkflow(id: string): Promise<Workflow> {
|
|
20
39
|
return this.request<Workflow>(`${urls.workflows}/${id}`, 'GET');
|
|
21
40
|
}
|
|
22
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Get the workflows for a specific organization.
|
|
44
|
+
*
|
|
45
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
46
|
+
* @returns An array of workflows for the organization.
|
|
47
|
+
*/
|
|
23
48
|
public async getWorkflowsByOrganization(organizationId?: string): Promise<Workflow[]> {
|
|
24
49
|
const orgId = organizationId || this.user!.organizationId;
|
|
25
50
|
return this.request<Workflow[]>(`${urls.workflows}?organizationId=${orgId}`, 'GET');
|
|
26
51
|
}
|
|
27
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Update a workflow.
|
|
55
|
+
*
|
|
56
|
+
* @param id - UUID of the workflow to update.
|
|
57
|
+
* @param name - New display name of the workflow.
|
|
58
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
59
|
+
* @returns The updated workflow.
|
|
60
|
+
*/
|
|
28
61
|
public async updateWorkflow(id: string, name: string, organizationId?: string): Promise<Workflow> {
|
|
29
62
|
const dto: UpdateWorkflowDto = {
|
|
30
63
|
name,
|
|
@@ -33,6 +66,12 @@ export class WorkflowModule extends BaseClient {
|
|
|
33
66
|
return this.request<Workflow>(`${urls.workflows}/${id}`, 'PATCH', dto);
|
|
34
67
|
}
|
|
35
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Delete a workflow.
|
|
71
|
+
*
|
|
72
|
+
* @param id - UUID of the workflow to delete.
|
|
73
|
+
* @returns A promise that resolves when the workflow has been deleted.
|
|
74
|
+
*/
|
|
36
75
|
public async deleteWorkflow(id: string): Promise<void> {
|
|
37
76
|
await this.request(`${urls.workflows}/${id}`, 'DELETE');
|
|
38
77
|
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -13,7 +13,6 @@ import { AudioModule } from './modules/audio.module';
|
|
|
13
13
|
import { WorkflowModule } from './modules/workflow.module';
|
|
14
14
|
import { IntegrationActionModule } from './modules/integration-action.module';
|
|
15
15
|
import { LogModule } from './modules/log.module';
|
|
16
|
-
import { DebugModule } from './modules/debug.module';
|
|
17
16
|
import { ExternalIntegrationModule } from './modules/external-integration.module';
|
|
18
17
|
import { WebSocketModule } from './modules/websocket.module';
|
|
19
18
|
import { ReportsModule } from './modules/reports.module';
|
|
@@ -39,7 +38,6 @@ export class ApiSDK extends BaseClient {
|
|
|
39
38
|
public readonly workflows: WorkflowModule;
|
|
40
39
|
public readonly integrationActions: IntegrationActionModule;
|
|
41
40
|
public readonly logs: LogModule;
|
|
42
|
-
public readonly debug: DebugModule;
|
|
43
41
|
public readonly externalIntegrations: ExternalIntegrationModule;
|
|
44
42
|
public readonly websocket: WebSocketModule | null;
|
|
45
43
|
public readonly reports: ReportsModule;
|
|
@@ -68,7 +66,6 @@ export class ApiSDK extends BaseClient {
|
|
|
68
66
|
this.workflows = new WorkflowModule(config);
|
|
69
67
|
this.integrationActions = new IntegrationActionModule(config);
|
|
70
68
|
this.logs = new LogModule(config);
|
|
71
|
-
this.debug = new DebugModule(config);
|
|
72
69
|
this.externalIntegrations = new ExternalIntegrationModule(config);
|
|
73
70
|
this.websocket = config.skipWebsocket ? null : new WebSocketModule(config);
|
|
74
71
|
this.reports = new ReportsModule(config);
|
|
@@ -82,7 +79,7 @@ export class ApiSDK extends BaseClient {
|
|
|
82
79
|
this.modules = [
|
|
83
80
|
this.auth, this.users, this.organizations, this.teams, this.templates,
|
|
84
81
|
this.transcriptionSummaries, this.sessions, this.agents, this.audio,
|
|
85
|
-
this.workflows, this.integrationActions, this.logs, this.
|
|
82
|
+
this.workflows, this.integrationActions, this.logs, this.externalIntegrations,
|
|
86
83
|
this.reports, this.patients, this.dataStrategies, this.systemSnapshots, this.ratings,
|
|
87
84
|
this.tiaki,
|
|
88
85
|
...(this.websocket ? [this.websocket] : [])
|
|
@@ -183,6 +180,17 @@ export class ApiSDK extends BaseClient {
|
|
|
183
180
|
return result;
|
|
184
181
|
}
|
|
185
182
|
|
|
183
|
+
public async loginWithEntra(...args: Parameters<AuthModule['loginWithEntra']>) {
|
|
184
|
+
const result = await this.auth.loginWithEntra(...args);
|
|
185
|
+
// Sync user state across all modules after successful login
|
|
186
|
+
await this.syncUserState(result.user, result.access_token, result.refresh_token);
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
public async connectEntra(...args: Parameters<AuthModule['connectEntra']>) {
|
|
191
|
+
return this.auth.connectEntra(...args);
|
|
192
|
+
}
|
|
193
|
+
|
|
186
194
|
// User methods
|
|
187
195
|
public async createUser(...args: Parameters<UserModule['createUser']>) {
|
|
188
196
|
return this.users.createUser(...args);
|
|
@@ -310,10 +318,6 @@ export class ApiSDK extends BaseClient {
|
|
|
310
318
|
return this.teams.deleteTeam(...args);
|
|
311
319
|
}
|
|
312
320
|
|
|
313
|
-
public async removeUserFromTeamFixed(...args: Parameters<TeamModule['removeUserFromTeamFixed']>) {
|
|
314
|
-
return this.teams.removeUserFromTeamFixed(...args);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
321
|
// Template methods
|
|
318
322
|
public async createTemplate(...args: Parameters<TemplateModule['createTemplate']>) {
|
|
319
323
|
return this.templates.createTemplate(...args);
|
|
@@ -391,18 +395,6 @@ export class ApiSDK extends BaseClient {
|
|
|
391
395
|
return this.transcriptionSummaries.deleteTranscriptionSummary(...args);
|
|
392
396
|
}
|
|
393
397
|
|
|
394
|
-
public async uploadLargeAudioFile(...args: Parameters<TemplateModule['uploadLargeAudioFile']>) {
|
|
395
|
-
return this.templates.uploadLargeAudioFile(...args);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
public async uploadAudioFile(...args: Parameters<TemplateModule['uploadAudioFile']>) {
|
|
399
|
-
return this.templates.uploadAudioFile(...args);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
public async transcribeBase64Audio(...args: Parameters<TemplateModule['transcribeBase64Audio']>) {
|
|
403
|
-
return this.templates.transcribeBase64Audio(...args);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
398
|
// Session methods (user - own sessions only)
|
|
407
399
|
public async createSession(...args: Parameters<SessionModule['createSession']>) {
|
|
408
400
|
return this.sessions.createSession(...args);
|
|
@@ -734,23 +726,6 @@ export class ApiSDK extends BaseClient {
|
|
|
734
726
|
return this.logs.cleanupOldLogs(...args);
|
|
735
727
|
}
|
|
736
728
|
|
|
737
|
-
// Debug methods
|
|
738
|
-
public async getSessionsWithoutMedicalTranscriptions(...args: Parameters<DebugModule['getSessionsWithoutMedicalTranscriptions']>) {
|
|
739
|
-
return this.debug.getSessionsWithoutMedicalTranscriptions(...args);
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
public async downloadSessionAsZip(...args: Parameters<DebugModule['downloadSessionAsZip']>) {
|
|
743
|
-
return this.debug.downloadSessionAsZip(...args);
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
public async downloadSessionAsZipUrl(...args: Parameters<DebugModule['downloadSessionAsZipUrl']>) {
|
|
747
|
-
return this.debug.downloadSessionAsZipUrl(...args);
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
public async downloadSessionAndTriggerDownload(...args: Parameters<DebugModule['downloadSessionAndTriggerDownload']>) {
|
|
751
|
-
return this.debug.downloadSessionAndTriggerDownload(...args);
|
|
752
|
-
}
|
|
753
|
-
|
|
754
729
|
// External Integration methods
|
|
755
730
|
public async createExternalIntegration(...args: Parameters<ExternalIntegrationModule['createExternalIntegration']>) {
|
|
756
731
|
return this.externalIntegrations.createExternalIntegration(...args);
|
|
@@ -19,6 +19,11 @@ export interface AgentOrganization {
|
|
|
19
19
|
organization?: Organization;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// Agent with guaranteed organizations relation (list/detail responses)
|
|
23
|
+
export interface AgentWithOrganizations extends Agent {
|
|
24
|
+
organizations: AgentOrganization[];
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
// Agent DTOs
|
|
23
28
|
export interface CreateAgentDto {
|
|
24
29
|
name: string;
|
|
@@ -13,13 +13,17 @@ export interface AudioFile {
|
|
|
13
13
|
id: string;
|
|
14
14
|
originalName: string;
|
|
15
15
|
fileName: string;
|
|
16
|
-
filePath
|
|
17
|
-
fileSize
|
|
16
|
+
filePath?: string;
|
|
17
|
+
fileSize?: number;
|
|
18
18
|
mimeType: string;
|
|
19
19
|
uploadId?: string;
|
|
20
20
|
transcriptionUrl?: string;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
taskId?: string;
|
|
22
|
+
uploadStatus?: string;
|
|
23
|
+
statusLink?: string;
|
|
24
|
+
cancelLink?: string;
|
|
25
|
+
downloadLink?: string;
|
|
26
|
+
progressPercent?: number;
|
|
23
27
|
status: AudioFileStatus;
|
|
24
28
|
createdAt: string;
|
|
25
29
|
updatedAt: string;
|
|
@@ -44,15 +48,9 @@ export interface CreateAudioFileDto {
|
|
|
44
48
|
|
|
45
49
|
export interface UpdateAudioFileDto {
|
|
46
50
|
transcriptionUrl?: string;
|
|
47
|
-
transcription?: string;
|
|
48
|
-
cultural_transcription?: string;
|
|
49
51
|
status?: AudioFileStatus;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
export interface UploadAudioFileDto {
|
|
53
|
-
cultural_transcription?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
54
|
// Base64 Audio File types
|
|
57
55
|
export interface Base64AudioFile {
|
|
58
56
|
id: string;
|
|
@@ -15,6 +15,9 @@ export interface DataStrategy {
|
|
|
15
15
|
organization?: Organization;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// DataStrategy with guaranteed organization relation (API read responses always include it)
|
|
19
|
+
export type DataStrategyWithOrganization = DataStrategy & { organization: Organization };
|
|
20
|
+
|
|
18
21
|
// DataStrategy DTOs
|
|
19
22
|
export interface CreateDataStrategyDto {
|
|
20
23
|
organizationId: string;
|
|
@@ -7,6 +7,12 @@ export interface ExternalIntegration {
|
|
|
7
7
|
getUserEndpoint: string;
|
|
8
8
|
getPatientDataEndpoint: string;
|
|
9
9
|
saveSummaryEndpoint: string;
|
|
10
|
+
/**
|
|
11
|
+
* The integration's API key.
|
|
12
|
+
*
|
|
13
|
+
* Sent as plaintext on write (create/update), stored encrypted at rest by the API,
|
|
14
|
+
* and returned MASKED on read (e.g. `****abcd`) — never the full plaintext value.
|
|
15
|
+
*/
|
|
10
16
|
apiKey: string;
|
|
11
17
|
headerName: string;
|
|
12
18
|
createdAt: string;
|