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
|
@@ -7,42 +7,103 @@ export class SessionModule extends BaseClient {
|
|
|
7
7
|
// USER METHODS (own sessions only)
|
|
8
8
|
// ======================
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Create a new session.
|
|
12
|
+
*
|
|
13
|
+
* @param sessionData - The session payload to create.
|
|
14
|
+
* @returns The created session.
|
|
15
|
+
*/
|
|
10
16
|
public async createSession(sessionData: CreateSessionDto): Promise<Session> {
|
|
11
17
|
return this.request<Session>(urls.sessions, 'POST', sessionData);
|
|
12
18
|
}
|
|
13
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Retrieve the authenticated user's own sessions.
|
|
22
|
+
*
|
|
23
|
+
* @returns The current user's sessions.
|
|
24
|
+
*/
|
|
14
25
|
public async getSessions(): Promise<Session[]> {
|
|
15
26
|
return this.request<Session[]>(`${urls.sessions}/my-sessions`, 'GET');
|
|
16
27
|
}
|
|
17
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Retrieve a single session by its id.
|
|
31
|
+
*
|
|
32
|
+
* @param id - UUID of the session to fetch.
|
|
33
|
+
* @returns The requested session.
|
|
34
|
+
*/
|
|
18
35
|
public async getSession(id: string): Promise<Session> {
|
|
19
36
|
return this.request<Session>(`${urls.sessions}/${id}`, 'GET');
|
|
20
37
|
}
|
|
21
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Update a session.
|
|
41
|
+
*
|
|
42
|
+
* @param id - UUID of the session to update.
|
|
43
|
+
* @param sessionData - Fields to update on the session.
|
|
44
|
+
* @returns The updated session.
|
|
45
|
+
*/
|
|
22
46
|
public async updateSession(id: string, sessionData: UpdateSessionDto): Promise<Session> {
|
|
23
47
|
return this.request<Session>(`${urls.sessions}/${id}`, 'PATCH', sessionData);
|
|
24
48
|
}
|
|
25
49
|
|
|
26
|
-
|
|
27
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Delete a session.
|
|
52
|
+
*
|
|
53
|
+
* @param id - UUID of the session to delete.
|
|
54
|
+
* @returns The deleted session.
|
|
55
|
+
*/
|
|
56
|
+
public async deleteSession(id: string): Promise<Session> {
|
|
57
|
+
return this.request<Session>(`${urls.sessions}/${id}`, 'DELETE');
|
|
28
58
|
}
|
|
29
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Set the primary transcription summary for a session.
|
|
62
|
+
*
|
|
63
|
+
* @param sessionId - UUID of the session.
|
|
64
|
+
* @param summaryId - UUID of the transcription summary to mark as primary.
|
|
65
|
+
* @returns The updated session.
|
|
66
|
+
*/
|
|
30
67
|
public async setPrimaryTranscriptionSummary(sessionId: string, summaryId: string): Promise<Session> {
|
|
31
68
|
return this.request<Session>(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
|
|
32
69
|
}
|
|
33
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Re-run transcription for a session.
|
|
73
|
+
*
|
|
74
|
+
* @param sessionId - UUID of the session to re-transcribe.
|
|
75
|
+
* @returns A confirmation message with the session id.
|
|
76
|
+
*/
|
|
34
77
|
public async rerunTranscription(sessionId: string): Promise<{ message: string; sessionId: string }> {
|
|
35
78
|
return this.request<{ message: string; sessionId: string }>(`${urls.sessions}/${sessionId}/rerun-transcription`, 'POST');
|
|
36
79
|
}
|
|
37
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Update the audio stream status of a session.
|
|
83
|
+
*
|
|
84
|
+
* @param data - The session id and the new audio stream status.
|
|
85
|
+
* @returns The updated session.
|
|
86
|
+
*/
|
|
38
87
|
public async setAudioStreamStatus(data: SetAudioStreamStatusDto): Promise<Session> {
|
|
39
88
|
return this.request<Session>(`${urls.sessions}/set-audio-stream-status`, 'PATCH', data);
|
|
40
89
|
}
|
|
41
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Forward a session to Tiaki.
|
|
93
|
+
*
|
|
94
|
+
* @param sessionId - UUID of the session to forward.
|
|
95
|
+
* @returns A response containing a status message.
|
|
96
|
+
*/
|
|
42
97
|
public async forwardToTiaki(sessionId: string): Promise<ForwardToTiakiResponse> {
|
|
43
98
|
return this.request<ForwardToTiakiResponse>(`${urls.sessions}/forward-to-tiaki/${sessionId}`, 'POST');
|
|
44
99
|
}
|
|
45
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Search the authenticated user's sessions using the provided filters.
|
|
103
|
+
*
|
|
104
|
+
* @param filters - Optional search filters (date range, user, template, pagination, etc.).
|
|
105
|
+
* @returns A paginated search response of matching sessions.
|
|
106
|
+
*/
|
|
46
107
|
public async searchSessions(filters: SearchSessionsDto = {}): Promise<SearchSessionsResponse> {
|
|
47
108
|
const params = this.buildSearchParams(filters);
|
|
48
109
|
const queryString = params.toString();
|
|
@@ -54,10 +115,23 @@ export class SessionModule extends BaseClient {
|
|
|
54
115
|
// SUPERUSER METHODS
|
|
55
116
|
// ======================
|
|
56
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Retrieve all sessions belonging to a specific user (superuser scope).
|
|
120
|
+
*
|
|
121
|
+
* @param userId - UUID of the user whose sessions to fetch.
|
|
122
|
+
* @returns The user's sessions.
|
|
123
|
+
*/
|
|
57
124
|
public async superuserGetSessionsByUser(userId: string): Promise<Session[]> {
|
|
58
|
-
return this.request<Session[]>(`${urls.sessions}/
|
|
125
|
+
return this.request<Session[]>(`${urls.sessions}/user/${userId}`, 'GET');
|
|
59
126
|
}
|
|
60
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Retrieve a paginated list of sessions for the organization (superuser scope).
|
|
130
|
+
*
|
|
131
|
+
* @param limit - Maximum number of sessions to return (default 100).
|
|
132
|
+
* @param offset - Number of sessions to skip for pagination (default 0).
|
|
133
|
+
* @returns A paginated sessions response.
|
|
134
|
+
*/
|
|
61
135
|
public async superuserGetSessionsByOrganization(limit = 100, offset = 0): Promise<SessionsResponse> {
|
|
62
136
|
const params = new URLSearchParams();
|
|
63
137
|
params.append('limit', limit.toString());
|
|
@@ -65,57 +139,122 @@ export class SessionModule extends BaseClient {
|
|
|
65
139
|
return this.request<SessionsResponse>(`${urls.sessions}/organization?${params.toString()}`, 'GET');
|
|
66
140
|
}
|
|
67
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Search sessions using the provided filters (superuser scope).
|
|
144
|
+
*
|
|
145
|
+
* @param filters - Optional search filters (date range, user, template, pagination, etc.).
|
|
146
|
+
* @returns A paginated search response of matching sessions.
|
|
147
|
+
*/
|
|
68
148
|
public async superuserSearchSessions(filters: SearchSessionsDto = {}): Promise<SearchSessionsResponse> {
|
|
69
149
|
const params = this.buildSearchParams(filters);
|
|
70
150
|
const queryString = params.toString();
|
|
71
|
-
const url = queryString ? `${urls.sessions}/
|
|
151
|
+
const url = queryString ? `${urls.sessions}/search?${queryString}` : `${urls.sessions}/search`;
|
|
72
152
|
return this.request<SearchSessionsResponse>(url, 'GET');
|
|
73
153
|
}
|
|
74
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Update a session (superuser scope).
|
|
157
|
+
*
|
|
158
|
+
* @param id - UUID of the session to update.
|
|
159
|
+
* @param sessionData - Fields to update on the session.
|
|
160
|
+
* @returns The updated session.
|
|
161
|
+
*/
|
|
75
162
|
public async superuserUpdateSession(id: string, sessionData: UpdateSessionDto): Promise<Session> {
|
|
76
|
-
return this.request<Session>(`${urls.sessions}
|
|
163
|
+
return this.request<Session>(`${urls.sessions}/${id}`, 'PATCH', sessionData);
|
|
77
164
|
}
|
|
78
165
|
|
|
79
|
-
|
|
80
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Delete a session (superuser scope).
|
|
168
|
+
*
|
|
169
|
+
* @param id - UUID of the session to delete.
|
|
170
|
+
* @returns The deleted session.
|
|
171
|
+
*/
|
|
172
|
+
public async superuserDeleteSession(id: string): Promise<Session> {
|
|
173
|
+
return this.request<Session>(`${urls.sessions}/${id}`, 'DELETE');
|
|
81
174
|
}
|
|
82
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Set the primary transcription summary for a session (superuser scope).
|
|
178
|
+
*
|
|
179
|
+
* @param sessionId - UUID of the session.
|
|
180
|
+
* @param summaryId - UUID of the transcription summary to mark as primary.
|
|
181
|
+
* @returns The updated session.
|
|
182
|
+
*/
|
|
83
183
|
public async superuserSetPrimaryTranscriptionSummary(sessionId: string, summaryId: string): Promise<Session> {
|
|
84
|
-
return this.request<Session>(`${urls.sessions}
|
|
184
|
+
return this.request<Session>(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
|
|
85
185
|
}
|
|
86
186
|
|
|
87
187
|
// ======================
|
|
88
188
|
// ORG ADMIN METHODS
|
|
89
189
|
// ======================
|
|
90
190
|
|
|
191
|
+
/**
|
|
192
|
+
* Retrieve all sessions belonging to a specific user (org admin scope).
|
|
193
|
+
*
|
|
194
|
+
* @param userId - UUID of the user whose sessions to fetch.
|
|
195
|
+
* @returns The user's sessions.
|
|
196
|
+
*/
|
|
91
197
|
public async orgAdminGetSessionsByUser(userId: string): Promise<Session[]> {
|
|
92
|
-
return this.request<Session[]>(`${urls.sessions}/
|
|
198
|
+
return this.request<Session[]>(`${urls.sessions}/user/${userId}`, 'GET');
|
|
93
199
|
}
|
|
94
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Retrieve a paginated list of sessions for the organization (org admin scope).
|
|
203
|
+
*
|
|
204
|
+
* @param limit - Maximum number of sessions to return (default 100).
|
|
205
|
+
* @param offset - Number of sessions to skip for pagination (default 0).
|
|
206
|
+
* @returns A paginated sessions response.
|
|
207
|
+
*/
|
|
95
208
|
public async orgAdminGetSessionsByOrganization(limit = 100, offset = 0): Promise<SessionsResponse> {
|
|
96
209
|
const params = new URLSearchParams();
|
|
97
210
|
params.append('limit', limit.toString());
|
|
98
211
|
params.append('offset', offset.toString());
|
|
99
|
-
return this.request<SessionsResponse>(`${urls.sessions}/
|
|
212
|
+
return this.request<SessionsResponse>(`${urls.sessions}/organization?${params.toString()}`, 'GET');
|
|
100
213
|
}
|
|
101
214
|
|
|
215
|
+
/**
|
|
216
|
+
* Search sessions using the provided filters (org admin scope).
|
|
217
|
+
*
|
|
218
|
+
* @param filters - Optional search filters (date range, user, template, pagination, etc.).
|
|
219
|
+
* @returns A paginated search response of matching sessions.
|
|
220
|
+
*/
|
|
102
221
|
public async orgAdminSearchSessions(filters: SearchSessionsDto = {}): Promise<SearchSessionsResponse> {
|
|
103
222
|
const params = this.buildSearchParams(filters);
|
|
104
223
|
const queryString = params.toString();
|
|
105
|
-
const url = queryString ? `${urls.sessions}/
|
|
224
|
+
const url = queryString ? `${urls.sessions}/search?${queryString}` : `${urls.sessions}/search`;
|
|
106
225
|
return this.request<SearchSessionsResponse>(url, 'GET');
|
|
107
226
|
}
|
|
108
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Update a session (org admin scope).
|
|
230
|
+
*
|
|
231
|
+
* @param id - UUID of the session to update.
|
|
232
|
+
* @param sessionData - Fields to update on the session.
|
|
233
|
+
* @returns The updated session.
|
|
234
|
+
*/
|
|
109
235
|
public async orgAdminUpdateSession(id: string, sessionData: UpdateSessionDto): Promise<Session> {
|
|
110
|
-
return this.request<Session>(`${urls.sessions}
|
|
236
|
+
return this.request<Session>(`${urls.sessions}/${id}`, 'PATCH', sessionData);
|
|
111
237
|
}
|
|
112
238
|
|
|
113
|
-
|
|
114
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Delete a session (org admin scope).
|
|
241
|
+
*
|
|
242
|
+
* @param id - UUID of the session to delete.
|
|
243
|
+
* @returns The deleted session.
|
|
244
|
+
*/
|
|
245
|
+
public async orgAdminDeleteSession(id: string): Promise<Session> {
|
|
246
|
+
return this.request<Session>(`${urls.sessions}/${id}`, 'DELETE');
|
|
115
247
|
}
|
|
116
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Set the primary transcription summary for a session (org admin scope).
|
|
251
|
+
*
|
|
252
|
+
* @param sessionId - UUID of the session.
|
|
253
|
+
* @param summaryId - UUID of the transcription summary to mark as primary.
|
|
254
|
+
* @returns The updated session.
|
|
255
|
+
*/
|
|
117
256
|
public async orgAdminSetPrimaryTranscriptionSummary(sessionId: string, summaryId: string): Promise<Session> {
|
|
118
|
-
return this.request<Session>(`${urls.sessions}
|
|
257
|
+
return this.request<Session>(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
|
|
119
258
|
}
|
|
120
259
|
|
|
121
260
|
// ======================
|
|
@@ -133,6 +272,7 @@ export class SessionModule extends BaseClient {
|
|
|
133
272
|
if (filters.templateId) params.append('templateId', filters.templateId);
|
|
134
273
|
if (filters.hasSummary !== undefined) params.append('hasSummary', filters.hasSummary.toString());
|
|
135
274
|
if (filters.includeTranscriptions !== undefined) params.append('includeTranscriptions', filters.includeTranscriptions.toString());
|
|
275
|
+
if (filters.includeArchived !== undefined) params.append('includeArchived', filters.includeArchived.toString());
|
|
136
276
|
if (filters.limit !== undefined) params.append('limit', filters.limit.toString());
|
|
137
277
|
if (filters.offset !== undefined) params.append('offset', filters.offset.toString());
|
|
138
278
|
return params;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { BaseClient } from './base-client';
|
|
2
|
-
import { Team, CreateTeamDto, UpdateTeamDto, AssignTeamRoleDto } from '../types';
|
|
2
|
+
import { Team, CreateTeamDto, UpdateTeamDto, AssignTeamRoleDto, TeamRole, TeamRoleName } from '../types';
|
|
3
3
|
import urls from '../urls';
|
|
4
4
|
|
|
5
5
|
export class TeamModule extends BaseClient {
|
|
6
|
+
/**
|
|
7
|
+
* Create a team within the current user's organization.
|
|
8
|
+
*
|
|
9
|
+
* @param name - Display name of the team.
|
|
10
|
+
* @param description - Description of the team.
|
|
11
|
+
* @returns The newly created team.
|
|
12
|
+
*/
|
|
6
13
|
public async createTeam(name: string, description: string): Promise<Team> {
|
|
7
14
|
const teamDto: CreateTeamDto = {
|
|
8
15
|
name,
|
|
@@ -12,6 +19,14 @@ export class TeamModule extends BaseClient {
|
|
|
12
19
|
return this.request(urls.teams, 'POST', teamDto);
|
|
13
20
|
}
|
|
14
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Update a team's name and description.
|
|
24
|
+
*
|
|
25
|
+
* @param id - UUID of the team to update.
|
|
26
|
+
* @param name - New display name for the team.
|
|
27
|
+
* @param description - New description for the team.
|
|
28
|
+
* @returns The updated team.
|
|
29
|
+
*/
|
|
15
30
|
public async updateTeam(id: string, name: string, description: string): Promise<Team> {
|
|
16
31
|
const teamDto: UpdateTeamDto = {
|
|
17
32
|
name,
|
|
@@ -20,36 +35,70 @@ export class TeamModule extends BaseClient {
|
|
|
20
35
|
return this.request<Team>(`${urls.teams}/${id}`, 'PATCH', teamDto);
|
|
21
36
|
}
|
|
22
37
|
|
|
23
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Add a user to a team with the given role.
|
|
40
|
+
*
|
|
41
|
+
* @param teamId - UUID of the team.
|
|
42
|
+
* @param userId - UUID of the user to add.
|
|
43
|
+
* @param roleName - Role to assign within the team.
|
|
44
|
+
* @returns The created team role.
|
|
45
|
+
*/
|
|
46
|
+
public async addUserToTeam(teamId: string, userId: string, roleName: TeamRoleName): Promise<TeamRole> {
|
|
24
47
|
const assignRoleDto: AssignTeamRoleDto = {
|
|
25
48
|
teamId,
|
|
26
49
|
userId,
|
|
27
50
|
name: roleName,
|
|
28
51
|
};
|
|
29
|
-
return this.request(urls.teamRoles, 'POST', assignRoleDto);
|
|
52
|
+
return this.request<TeamRole>(urls.teamRoles, 'POST', assignRoleDto);
|
|
30
53
|
}
|
|
31
54
|
|
|
32
|
-
|
|
33
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Remove a user from a team.
|
|
57
|
+
*
|
|
58
|
+
* @param teamId - UUID of the team.
|
|
59
|
+
* @param userId - UUID of the user to remove.
|
|
60
|
+
* @returns The removed team role.
|
|
61
|
+
*/
|
|
62
|
+
public async removeUserFromTeam(teamId: string, userId: string): Promise<TeamRole> {
|
|
63
|
+
return this.request<TeamRole>(`${urls.teamRoles}/user/${userId}/team/${teamId}`, 'DELETE');
|
|
34
64
|
}
|
|
35
65
|
|
|
66
|
+
/**
|
|
67
|
+
* List all teams the current user can access.
|
|
68
|
+
*
|
|
69
|
+
* @returns An array of teams.
|
|
70
|
+
*/
|
|
36
71
|
public async getTeams(): Promise<Team[]> {
|
|
37
72
|
return this.request<Team[]>(urls.teams, 'GET');
|
|
38
73
|
}
|
|
39
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Get a single team by ID.
|
|
77
|
+
*
|
|
78
|
+
* @param id - UUID of the team.
|
|
79
|
+
* @returns The requested team.
|
|
80
|
+
*/
|
|
40
81
|
public async getTeam(id: string): Promise<Team> {
|
|
41
82
|
return this.request<Team>(`${urls.teams}/${id}`, 'GET');
|
|
42
83
|
}
|
|
43
84
|
|
|
85
|
+
/**
|
|
86
|
+
* List all teams belonging to an organization.
|
|
87
|
+
*
|
|
88
|
+
* @param organizationId - UUID of the organization.
|
|
89
|
+
* @returns An array of teams in the organization.
|
|
90
|
+
*/
|
|
44
91
|
public async getTeamsByOrganization(organizationId: string): Promise<Team[]> {
|
|
45
92
|
return this.request<Team[]>(`${urls.teams}/organization/${organizationId}`, 'GET');
|
|
46
93
|
}
|
|
47
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Delete a team by ID.
|
|
97
|
+
*
|
|
98
|
+
* @param id - UUID of the team to delete.
|
|
99
|
+
* @returns A promise that resolves when the team is deleted.
|
|
100
|
+
*/
|
|
48
101
|
public async deleteTeam(id: string): Promise<void> {
|
|
49
102
|
await this.request(`${urls.teams}/${id}`, 'DELETE');
|
|
50
103
|
}
|
|
51
|
-
|
|
52
|
-
public async removeUserFromTeamFixed(teamId: string, userId: string): Promise<void> {
|
|
53
|
-
await this.request(`${urls.teamRoles}/user/${userId}/team/${teamId}`, 'DELETE');
|
|
54
|
-
}
|
|
55
104
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
UpdateTemplateDto,
|
|
7
7
|
CreateTemplateCategoryDto,
|
|
8
8
|
UpdateTemplateCategoryDto,
|
|
9
|
-
TranscriptionAudioUploadResponse,
|
|
10
9
|
SummaryQueueType,
|
|
11
10
|
} from '../types';
|
|
12
11
|
import urls from '../urls';
|
|
@@ -16,6 +15,17 @@ export class TemplateModule extends BaseClient {
|
|
|
16
15
|
// TEMPLATE METHODS
|
|
17
16
|
// ======================
|
|
18
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Create a template for the current user's organization, defaulting to the first category if none is given.
|
|
20
|
+
*
|
|
21
|
+
* @param title - Title of the template.
|
|
22
|
+
* @param content - Body content of the template.
|
|
23
|
+
* @param categoryId - Optional category UUID; the first available category is used when omitted.
|
|
24
|
+
* @param workflowId - Optional workflow UUID to associate with the template.
|
|
25
|
+
* @param agentId - Optional agent UUID to associate with the template.
|
|
26
|
+
* @param summaryQueueType - Optional queue type (PRIMARY or SECONDARY) for generated summaries.
|
|
27
|
+
* @returns The created template.
|
|
28
|
+
*/
|
|
19
29
|
public async createTemplate(title: string, content: string, categoryId?: string, workflowId?: string, agentId?: string, summaryQueueType?: SummaryQueueType): Promise<Template> {
|
|
20
30
|
let finalCategoryId = categoryId;
|
|
21
31
|
if (!finalCategoryId) {
|
|
@@ -43,6 +53,17 @@ export class TemplateModule extends BaseClient {
|
|
|
43
53
|
return this.request<Template>(urls.templates, 'POST', createTemplateDto);
|
|
44
54
|
}
|
|
45
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Update an existing template.
|
|
58
|
+
*
|
|
59
|
+
* @param title - New title of the template.
|
|
60
|
+
* @param content - New body content of the template.
|
|
61
|
+
* @param id - UUID of the template to update.
|
|
62
|
+
* @param workflowId - Optional workflow UUID to associate with the template.
|
|
63
|
+
* @param agentId - Optional agent UUID to associate with the template.
|
|
64
|
+
* @param summaryQueueType - Optional queue type (PRIMARY or SECONDARY), or null to clear it.
|
|
65
|
+
* @returns The updated template.
|
|
66
|
+
*/
|
|
46
67
|
public async updateTemplate(title: string, content: string, id: string, workflowId?: string, agentId?: string, summaryQueueType?: SummaryQueueType | null): Promise<Template> {
|
|
47
68
|
const templateDto: UpdateTemplateDto = {
|
|
48
69
|
title,
|
|
@@ -56,18 +77,40 @@ export class TemplateModule extends BaseClient {
|
|
|
56
77
|
return this.request<Template>(`${urls.templates}/${id}`, 'PATCH', templateDto);
|
|
57
78
|
}
|
|
58
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Retrieve all templates accessible to the current user.
|
|
82
|
+
*
|
|
83
|
+
* @returns An array of templates.
|
|
84
|
+
*/
|
|
59
85
|
public async getTemplates(): Promise<Template[]> {
|
|
60
86
|
return this.request<Template[]>(urls.templates, 'GET');
|
|
61
87
|
}
|
|
62
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Retrieve all templates belonging to the current user's organization.
|
|
91
|
+
*
|
|
92
|
+
* @returns An array of templates.
|
|
93
|
+
*/
|
|
63
94
|
public async getTemplatesByOrganization(): Promise<Template[]> {
|
|
64
95
|
return this.request<Template[]>(`${urls.templates}/organization`, 'GET');
|
|
65
96
|
}
|
|
66
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Retrieve a single template by id.
|
|
100
|
+
*
|
|
101
|
+
* @param id - UUID of the template.
|
|
102
|
+
* @returns The requested template.
|
|
103
|
+
*/
|
|
67
104
|
public async getTemplate(id: string): Promise<Template> {
|
|
68
105
|
return this.request<Template>(`${urls.templates}/${id}`, 'GET');
|
|
69
106
|
}
|
|
70
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Delete a template by id.
|
|
110
|
+
*
|
|
111
|
+
* @param id - UUID of the template to delete.
|
|
112
|
+
* @returns A promise that resolves once the template is deleted.
|
|
113
|
+
*/
|
|
71
114
|
public async deleteTemplate(id: string): Promise<void> {
|
|
72
115
|
await this.request(`${urls.templates}/${id}`, 'DELETE');
|
|
73
116
|
}
|
|
@@ -76,6 +119,13 @@ export class TemplateModule extends BaseClient {
|
|
|
76
119
|
// TEMPLATE INTEGRATION ACTION METHODS
|
|
77
120
|
// ======================
|
|
78
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Replace the full set of integration actions linked to a template.
|
|
124
|
+
*
|
|
125
|
+
* @param templateId - UUID of the template.
|
|
126
|
+
* @param integrationActionIds - The complete list of integration action UUIDs to set.
|
|
127
|
+
* @returns The updated template.
|
|
128
|
+
*/
|
|
79
129
|
public async setTemplateIntegrationActions(templateId: string, integrationActionIds: string[]): Promise<Template> {
|
|
80
130
|
return this.request<Template>(
|
|
81
131
|
`${urls.templates}/${templateId}/integration-actions`,
|
|
@@ -84,6 +134,13 @@ export class TemplateModule extends BaseClient {
|
|
|
84
134
|
);
|
|
85
135
|
}
|
|
86
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Add integration actions to a template without removing existing ones.
|
|
139
|
+
*
|
|
140
|
+
* @param templateId - UUID of the template.
|
|
141
|
+
* @param integrationActionIds - The integration action UUIDs to add.
|
|
142
|
+
* @returns The updated template.
|
|
143
|
+
*/
|
|
87
144
|
public async addTemplateIntegrationActions(templateId: string, integrationActionIds: string[]): Promise<Template> {
|
|
88
145
|
return this.request<Template>(
|
|
89
146
|
`${urls.templates}/${templateId}/integration-actions`,
|
|
@@ -92,6 +149,13 @@ export class TemplateModule extends BaseClient {
|
|
|
92
149
|
);
|
|
93
150
|
}
|
|
94
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Remove integration actions from a template.
|
|
154
|
+
*
|
|
155
|
+
* @param templateId - UUID of the template.
|
|
156
|
+
* @param integrationActionIds - The integration action UUIDs to remove.
|
|
157
|
+
* @returns The updated template.
|
|
158
|
+
*/
|
|
95
159
|
public async removeTemplateIntegrationActions(templateId: string, integrationActionIds: string[]): Promise<Template> {
|
|
96
160
|
return this.request<Template>(
|
|
97
161
|
`${urls.templates}/${templateId}/integration-actions`,
|
|
@@ -104,56 +168,55 @@ export class TemplateModule extends BaseClient {
|
|
|
104
168
|
// TEMPLATE CATEGORY METHODS
|
|
105
169
|
// ======================
|
|
106
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Retrieve all template categories.
|
|
173
|
+
*
|
|
174
|
+
* @returns An array of template categories.
|
|
175
|
+
*/
|
|
107
176
|
public async getTemplateCategories(): Promise<TemplateCategory[]> {
|
|
108
177
|
return this.request<TemplateCategory[]>(urls.templateCategories, 'GET');
|
|
109
178
|
}
|
|
110
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Retrieve a single template category by id.
|
|
182
|
+
*
|
|
183
|
+
* @param id - UUID of the template category.
|
|
184
|
+
* @returns The requested template category.
|
|
185
|
+
*/
|
|
111
186
|
public async getTemplateCategory(id: string): Promise<TemplateCategory> {
|
|
112
187
|
return this.request<TemplateCategory>(`${urls.templateCategories}/${id}`, 'GET');
|
|
113
188
|
}
|
|
114
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Create a template category.
|
|
192
|
+
*
|
|
193
|
+
* @param name - Name of the new category.
|
|
194
|
+
* @returns The created template category.
|
|
195
|
+
*/
|
|
115
196
|
public async createTemplateCategory(name: string): Promise<TemplateCategory> {
|
|
116
197
|
const dto: CreateTemplateCategoryDto = { name };
|
|
117
198
|
return this.request<TemplateCategory>(urls.templateCategories, 'POST', dto);
|
|
118
199
|
}
|
|
119
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Update a template category's name.
|
|
203
|
+
*
|
|
204
|
+
* @param id - UUID of the template category to update.
|
|
205
|
+
* @param name - New name for the category.
|
|
206
|
+
* @returns The updated template category.
|
|
207
|
+
*/
|
|
120
208
|
public async updateTemplateCategory(id: string, name: string): Promise<TemplateCategory> {
|
|
121
209
|
const dto: UpdateTemplateCategoryDto = { name };
|
|
122
210
|
return this.request<TemplateCategory>(`${urls.templateCategories}/${id}`, 'PATCH', dto);
|
|
123
211
|
}
|
|
124
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Delete a template category by id.
|
|
215
|
+
*
|
|
216
|
+
* @param id - UUID of the template category to delete.
|
|
217
|
+
* @returns A promise that resolves once the category is deleted.
|
|
218
|
+
*/
|
|
125
219
|
public async deleteTemplateCategory(id: string): Promise<void> {
|
|
126
220
|
await this.request(`${urls.templateCategories}/${id}`, 'DELETE');
|
|
127
221
|
}
|
|
128
|
-
|
|
129
|
-
// ======================
|
|
130
|
-
// AUDIO UPLOAD METHODS (for transcription)
|
|
131
|
-
// ======================
|
|
132
|
-
|
|
133
|
-
public async uploadLargeAudioFile(formData: FormData, onProgress?: (percentage: number) => void): Promise<string> {
|
|
134
|
-
const uploadId: string = await this.fileUploadRequest(urls.uploadAudioLarge, formData, {}, onProgress);
|
|
135
|
-
const uploadIds: string = await this.storage!.getItem('uploadIds') || '[]';
|
|
136
|
-
const uploadIdsArray = JSON.parse(uploadIds);
|
|
137
|
-
await this.storage!.setItem('uploadIds', JSON.stringify([...uploadIdsArray, uploadId]));
|
|
138
|
-
return uploadId;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
public async uploadAudioFile(formData: FormData, onProgress?: (percentage: number) => void): Promise<TranscriptionAudioUploadResponse | null> {
|
|
142
|
-
const data: TranscriptionAudioUploadResponse = await this.fileUploadRequest(
|
|
143
|
-
urls.uploadAudio,
|
|
144
|
-
formData,
|
|
145
|
-
{},
|
|
146
|
-
onProgress
|
|
147
|
-
);
|
|
148
|
-
return data;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public async transcribeBase64Audio(base64String: string): Promise<string> {
|
|
152
|
-
const transcript = await this.request<any>(
|
|
153
|
-
urls.transcribeBase64Audio,
|
|
154
|
-
'POST',
|
|
155
|
-
{ base64Audio: base64String }
|
|
156
|
-
);
|
|
157
|
-
return transcript.transcript;
|
|
158
|
-
}
|
|
159
222
|
}
|