whio-api-sdk 1.1.28 → 1.1.29
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 +43 -0
- package/dist/src/sdk/modules/auth.module.js +43 -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 +106 -0
- package/dist/src/sdk/modules/user.module.js +107 -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 +19 -29
- package/dist/src/sdk/sdk.js +1 -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 +0 -4
- package/dist/src/sdk/urls.js +0 -5
- package/dist/src/sdk/whio-orgadmin-sdk.d.ts +7 -7
- package/dist/src/sdk/whio-sdk.d.ts +11 -8
- package/dist/src/sdk/whio-sdk.js +34 -18
- package/dist/src/sdk/whio-superuser-sdk.d.ts +12 -16
- package/dist/src/sdk/whio-superuser-sdk.js +1 -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 +43 -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 +108 -2
- package/src/sdk/modules/websocket.module.ts +26 -8
- package/src/sdk/modules/workflow.module.ts +39 -0
- package/src/sdk/sdk.ts +1 -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 +0 -7
- package/src/sdk/whio-sdk.ts +29 -16
- package/src/sdk/whio-superuser-sdk.ts +1 -16
- package/src/sdk/whio-teamadmin-sdk.ts +1 -16
- package/tsconfig.json +1 -1
- package/src/sdk/modules/debug.module.ts +0 -44
|
@@ -14,42 +14,103 @@ import urls from '../../urls';
|
|
|
14
14
|
* Session module for regular users - provides access to own sessions only
|
|
15
15
|
*/
|
|
16
16
|
export class SessionModule extends BaseClient {
|
|
17
|
+
/**
|
|
18
|
+
* Create a new session.
|
|
19
|
+
*
|
|
20
|
+
* @param sessionData - The session payload to create.
|
|
21
|
+
* @returns The created session.
|
|
22
|
+
*/
|
|
17
23
|
public async createSession(sessionData: CreateSessionDto): Promise<Session> {
|
|
18
24
|
return this.request<Session>(urls.sessions, 'POST', sessionData);
|
|
19
25
|
}
|
|
20
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve the authenticated user's own sessions.
|
|
29
|
+
*
|
|
30
|
+
* @returns The current user's sessions.
|
|
31
|
+
*/
|
|
21
32
|
public async getSessions(): Promise<Session[]> {
|
|
22
33
|
return this.request<Session[]>(`${urls.sessions}/my-sessions`, 'GET');
|
|
23
34
|
}
|
|
24
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Retrieve a single session by its id.
|
|
38
|
+
*
|
|
39
|
+
* @param id - UUID of the session to fetch.
|
|
40
|
+
* @returns The requested session.
|
|
41
|
+
*/
|
|
25
42
|
public async getSession(id: string): Promise<Session> {
|
|
26
43
|
return this.request<Session>(`${urls.sessions}/${id}`, 'GET');
|
|
27
44
|
}
|
|
28
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Update a session.
|
|
48
|
+
*
|
|
49
|
+
* @param id - UUID of the session to update.
|
|
50
|
+
* @param sessionData - Fields to update on the session.
|
|
51
|
+
* @returns The updated session.
|
|
52
|
+
*/
|
|
29
53
|
public async updateSession(id: string, sessionData: UpdateSessionDto): Promise<Session> {
|
|
30
54
|
return this.request<Session>(`${urls.sessions}/${id}`, 'PATCH', sessionData);
|
|
31
55
|
}
|
|
32
56
|
|
|
33
|
-
|
|
34
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Delete a session.
|
|
59
|
+
*
|
|
60
|
+
* @param id - UUID of the session to delete.
|
|
61
|
+
* @returns The deleted session.
|
|
62
|
+
*/
|
|
63
|
+
public async deleteSession(id: string): Promise<Session> {
|
|
64
|
+
return this.request<Session>(`${urls.sessions}/${id}`, 'DELETE');
|
|
35
65
|
}
|
|
36
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Set the primary transcription summary for a session.
|
|
69
|
+
*
|
|
70
|
+
* @param sessionId - UUID of the session.
|
|
71
|
+
* @param summaryId - UUID of the transcription summary to mark as primary.
|
|
72
|
+
* @returns The updated session.
|
|
73
|
+
*/
|
|
37
74
|
public async setPrimaryTranscriptionSummary(sessionId: string, summaryId: string): Promise<Session> {
|
|
38
75
|
return this.request<Session>(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
|
|
39
76
|
}
|
|
40
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Re-run transcription for a session.
|
|
80
|
+
*
|
|
81
|
+
* @param sessionId - UUID of the session to re-transcribe.
|
|
82
|
+
* @returns A confirmation message with the session id.
|
|
83
|
+
*/
|
|
41
84
|
public async rerunTranscription(sessionId: string): Promise<{ message: string; sessionId: string }> {
|
|
42
85
|
return this.request<{ message: string; sessionId: string }>(`${urls.sessions}/${sessionId}/rerun-transcription`, 'POST');
|
|
43
86
|
}
|
|
44
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Update the audio stream status of a session.
|
|
90
|
+
*
|
|
91
|
+
* @param data - The session id and the new audio stream status.
|
|
92
|
+
* @returns The updated session.
|
|
93
|
+
*/
|
|
45
94
|
public async setAudioStreamStatus(data: SetAudioStreamStatusDto): Promise<Session> {
|
|
46
95
|
return this.request<Session>(`${urls.sessions}/set-audio-stream-status`, 'PATCH', data);
|
|
47
96
|
}
|
|
48
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Forward a session to Tiaki.
|
|
100
|
+
*
|
|
101
|
+
* @param sessionId - UUID of the session to forward.
|
|
102
|
+
* @returns A response containing a status message.
|
|
103
|
+
*/
|
|
49
104
|
public async forwardToTiaki(sessionId: string): Promise<ForwardToTiakiResponse> {
|
|
50
105
|
return this.request<ForwardToTiakiResponse>(`${urls.sessions}/forward-to-tiaki/${sessionId}`, 'POST');
|
|
51
106
|
}
|
|
52
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Search the authenticated user's sessions using the provided filters.
|
|
110
|
+
*
|
|
111
|
+
* @param filters - Optional search filters (date range, user, template, pagination, etc.).
|
|
112
|
+
* @returns A paginated search response of matching sessions.
|
|
113
|
+
*/
|
|
53
114
|
public async searchSessions(filters: SearchSessionsDto = {}): Promise<SearchSessionsResponse> {
|
|
54
115
|
const params = this.buildSearchParams(filters);
|
|
55
116
|
const queryString = params.toString();
|
|
@@ -68,6 +129,7 @@ export class SessionModule extends BaseClient {
|
|
|
68
129
|
if (filters.templateId) params.append('templateId', filters.templateId);
|
|
69
130
|
if (filters.hasSummary !== undefined) params.append('hasSummary', filters.hasSummary.toString());
|
|
70
131
|
if (filters.includeTranscriptions !== undefined) params.append('includeTranscriptions', filters.includeTranscriptions.toString());
|
|
132
|
+
if (filters.includeArchived !== undefined) params.append('includeArchived', filters.includeArchived.toString());
|
|
71
133
|
if (filters.limit !== undefined) params.append('limit', filters.limit.toString());
|
|
72
134
|
if (filters.offset !== undefined) params.append('offset', filters.offset.toString());
|
|
73
135
|
return params;
|
|
@@ -12,10 +12,23 @@ import urls from '../../urls';
|
|
|
12
12
|
* Session module for superusers - provides access to all sessions across the system
|
|
13
13
|
*/
|
|
14
14
|
export class SuperuserSessionModule extends BaseClient {
|
|
15
|
+
/**
|
|
16
|
+
* Retrieve all sessions belonging to a specific user.
|
|
17
|
+
*
|
|
18
|
+
* @param userId - UUID of the user whose sessions to fetch.
|
|
19
|
+
* @returns The user's sessions.
|
|
20
|
+
*/
|
|
15
21
|
public async getSessionsByUser(userId: string): Promise<Session[]> {
|
|
16
|
-
return this.request<Session[]>(`${urls.sessions}/
|
|
22
|
+
return this.request<Session[]>(`${urls.sessions}/user/${userId}`, 'GET');
|
|
17
23
|
}
|
|
18
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Retrieve a paginated list of sessions for the organization.
|
|
27
|
+
*
|
|
28
|
+
* @param limit - Maximum number of sessions to return (default 100).
|
|
29
|
+
* @param offset - Number of sessions to skip for pagination (default 0).
|
|
30
|
+
* @returns A paginated sessions response.
|
|
31
|
+
*/
|
|
19
32
|
public async getSessionsByOrganization(limit = 100, offset = 0): Promise<SessionsResponse> {
|
|
20
33
|
const params = new URLSearchParams();
|
|
21
34
|
params.append('limit', limit.toString());
|
|
@@ -23,25 +36,57 @@ export class SuperuserSessionModule extends BaseClient {
|
|
|
23
36
|
return this.request<SessionsResponse>(`${urls.sessions}/organization?${params.toString()}`, 'GET');
|
|
24
37
|
}
|
|
25
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Search sessions using the provided filters.
|
|
41
|
+
*
|
|
42
|
+
* @param filters - Optional search filters (date range, user, template, pagination, etc.).
|
|
43
|
+
* @returns A paginated search response of matching sessions.
|
|
44
|
+
*/
|
|
26
45
|
public async searchSessions(filters: SearchSessionsDto = {}): Promise<SearchSessionsResponse> {
|
|
27
46
|
const params = this.buildSearchParams(filters);
|
|
28
47
|
const queryString = params.toString();
|
|
29
|
-
const url = queryString ? `${urls.sessions}/
|
|
48
|
+
const url = queryString ? `${urls.sessions}/search?${queryString}` : `${urls.sessions}/search`;
|
|
30
49
|
return this.request<SearchSessionsResponse>(url, 'GET');
|
|
31
50
|
}
|
|
32
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Update a session.
|
|
54
|
+
*
|
|
55
|
+
* @param id - UUID of the session to update.
|
|
56
|
+
* @param sessionData - Fields to update on the session.
|
|
57
|
+
* @returns The updated session.
|
|
58
|
+
*/
|
|
33
59
|
public async updateSession(id: string, sessionData: UpdateSessionDto): Promise<Session> {
|
|
34
|
-
return this.request<Session>(`${urls.sessions}
|
|
60
|
+
return this.request<Session>(`${urls.sessions}/${id}`, 'PATCH', sessionData);
|
|
35
61
|
}
|
|
36
62
|
|
|
37
|
-
|
|
38
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Delete a session.
|
|
65
|
+
*
|
|
66
|
+
* @param id - UUID of the session to delete.
|
|
67
|
+
* @returns The deleted session.
|
|
68
|
+
*/
|
|
69
|
+
public async deleteSession(id: string): Promise<Session> {
|
|
70
|
+
return this.request<Session>(`${urls.sessions}/${id}`, 'DELETE');
|
|
39
71
|
}
|
|
40
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Set the primary transcription summary for a session.
|
|
75
|
+
*
|
|
76
|
+
* @param sessionId - UUID of the session.
|
|
77
|
+
* @param summaryId - UUID of the transcription summary to mark as primary.
|
|
78
|
+
* @returns The updated session.
|
|
79
|
+
*/
|
|
41
80
|
public async setPrimaryTranscriptionSummary(sessionId: string, summaryId: string): Promise<Session> {
|
|
42
|
-
return this.request<Session>(`${urls.sessions}
|
|
81
|
+
return this.request<Session>(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
|
|
43
82
|
}
|
|
44
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Retrieve a single session by its id.
|
|
86
|
+
*
|
|
87
|
+
* @param id - UUID of the session to fetch.
|
|
88
|
+
* @returns The requested session.
|
|
89
|
+
*/
|
|
45
90
|
public async getSession(id: string): Promise<Session> {
|
|
46
91
|
return this.request<Session>(`${urls.sessions}/${id}`, 'GET');
|
|
47
92
|
}
|
|
@@ -57,6 +102,7 @@ export class SuperuserSessionModule extends BaseClient {
|
|
|
57
102
|
if (filters.templateId) params.append('templateId', filters.templateId);
|
|
58
103
|
if (filters.hasSummary !== undefined) params.append('hasSummary', filters.hasSummary.toString());
|
|
59
104
|
if (filters.includeTranscriptions !== undefined) params.append('includeTranscriptions', filters.includeTranscriptions.toString());
|
|
105
|
+
if (filters.includeArchived !== undefined) params.append('includeArchived', filters.includeArchived.toString());
|
|
60
106
|
if (filters.limit !== undefined) params.append('limit', filters.limit.toString());
|
|
61
107
|
if (filters.offset !== undefined) params.append('offset', filters.offset.toString());
|
|
62
108
|
return params;
|
|
@@ -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
|
}
|