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.
Files changed (104) hide show
  1. package/dist/src/sdk/modules/agent.module.d.ts +90 -5
  2. package/dist/src/sdk/modules/agent.module.js +87 -2
  3. package/dist/src/sdk/modules/audio.module.d.ts +143 -2
  4. package/dist/src/sdk/modules/audio.module.js +144 -5
  5. package/dist/src/sdk/modules/auth.module.d.ts +67 -0
  6. package/dist/src/sdk/modules/auth.module.js +81 -0
  7. package/dist/src/sdk/modules/data-strategy.module.d.ts +45 -7
  8. package/dist/src/sdk/modules/data-strategy.module.js +39 -1
  9. package/dist/src/sdk/modules/external-integration.module.d.ts +30 -0
  10. package/dist/src/sdk/modules/external-integration.module.js +30 -0
  11. package/dist/src/sdk/modules/integration-action.module.d.ts +39 -0
  12. package/dist/src/sdk/modules/integration-action.module.js +39 -0
  13. package/dist/src/sdk/modules/log.module.d.ts +4 -4
  14. package/dist/src/sdk/modules/organization.module.d.ts +62 -3
  15. package/dist/src/sdk/modules/organization.module.js +61 -2
  16. package/dist/src/sdk/modules/patient.module.d.ts +5 -2
  17. package/dist/src/sdk/modules/patient.module.js +5 -2
  18. package/dist/src/sdk/modules/reports.module.d.ts +4 -4
  19. package/dist/src/sdk/modules/reports.module.js +6 -6
  20. package/dist/src/sdk/modules/session/orgadmin-session.module.d.ts +46 -1
  21. package/dist/src/sdk/modules/session/orgadmin-session.module.js +53 -6
  22. package/dist/src/sdk/modules/session/session.module.d.ts +62 -1
  23. package/dist/src/sdk/modules/session/session.module.js +64 -1
  24. package/dist/src/sdk/modules/session/superuser-session.module.d.ts +46 -1
  25. package/dist/src/sdk/modules/session/superuser-session.module.js +52 -5
  26. package/dist/src/sdk/modules/session.module.d.ts +142 -3
  27. package/dist/src/sdk/modules/session.module.js +153 -12
  28. package/dist/src/sdk/modules/team.module.d.ts +56 -4
  29. package/dist/src/sdk/modules/team.module.js +54 -6
  30. package/dist/src/sdk/modules/template.module.d.ts +96 -4
  31. package/dist/src/sdk/modules/template.module.js +95 -24
  32. package/dist/src/sdk/modules/transcription-summary.module.d.ts +60 -3
  33. package/dist/src/sdk/modules/transcription-summary.module.js +60 -7
  34. package/dist/src/sdk/modules/user.module.d.ts +127 -0
  35. package/dist/src/sdk/modules/user.module.js +136 -1
  36. package/dist/src/sdk/modules/websocket.module.d.ts +25 -8
  37. package/dist/src/sdk/modules/websocket.module.js +23 -6
  38. package/dist/src/sdk/modules/workflow.module.d.ts +39 -0
  39. package/dist/src/sdk/modules/workflow.module.js +39 -0
  40. package/dist/src/sdk/sdk.d.ts +23 -29
  41. package/dist/src/sdk/sdk.js +14 -44
  42. package/dist/src/sdk/types/agent.types.d.ts +3 -0
  43. package/dist/src/sdk/types/audio.types.d.ts +8 -9
  44. package/dist/src/sdk/types/data-strategy.types.d.ts +3 -0
  45. package/dist/src/sdk/types/external-integration.types.d.ts +6 -0
  46. package/dist/src/sdk/types/log.types.d.ts +2 -21
  47. package/dist/src/sdk/types/patient.types.d.ts +2 -3
  48. package/dist/src/sdk/types/reports.types.d.ts +1 -1
  49. package/dist/src/sdk/types/session.types.d.ts +8 -8
  50. package/dist/src/sdk/types/team.types.d.ts +4 -3
  51. package/dist/src/sdk/types/template.types.d.ts +15 -7
  52. package/dist/src/sdk/types/user.types.d.ts +6 -0
  53. package/dist/src/sdk/types/websocket.types.d.ts +4 -10
  54. package/dist/src/sdk/urls.d.ts +2 -4
  55. package/dist/src/sdk/urls.js +2 -5
  56. package/dist/src/sdk/whio-orgadmin-sdk.d.ts +9 -7
  57. package/dist/src/sdk/whio-orgadmin-sdk.js +10 -0
  58. package/dist/src/sdk/whio-sdk.d.ts +15 -8
  59. package/dist/src/sdk/whio-sdk.js +46 -18
  60. package/dist/src/sdk/whio-superuser-sdk.d.ts +14 -16
  61. package/dist/src/sdk/whio-superuser-sdk.js +11 -16
  62. package/dist/src/sdk/whio-teamadmin-sdk.d.ts +4 -8
  63. package/dist/src/sdk/whio-teamadmin-sdk.js +1 -18
  64. package/package.json +1 -1
  65. package/src/sdk/modules/agent.module.ts +94 -9
  66. package/src/sdk/modules/audio.module.ts +146 -8
  67. package/src/sdk/modules/auth.module.ts +88 -0
  68. package/src/sdk/modules/data-strategy.module.ts +51 -13
  69. package/src/sdk/modules/external-integration.module.ts +30 -0
  70. package/src/sdk/modules/integration-action.module.ts +39 -0
  71. package/src/sdk/modules/log.module.ts +4 -4
  72. package/src/sdk/modules/organization.module.ts +64 -5
  73. package/src/sdk/modules/patient.module.ts +5 -2
  74. package/src/sdk/modules/reports.module.ts +6 -6
  75. package/src/sdk/modules/session/orgadmin-session.module.ts +53 -7
  76. package/src/sdk/modules/session/session.module.ts +64 -2
  77. package/src/sdk/modules/session/superuser-session.module.ts +52 -6
  78. package/src/sdk/modules/session.module.ts +155 -15
  79. package/src/sdk/modules/team.module.ts +58 -9
  80. package/src/sdk/modules/template.module.ts +95 -32
  81. package/src/sdk/modules/transcription-summary.module.ts +62 -8
  82. package/src/sdk/modules/user.module.ts +135 -2
  83. package/src/sdk/modules/websocket.module.ts +26 -8
  84. package/src/sdk/modules/workflow.module.ts +39 -0
  85. package/src/sdk/sdk.ts +12 -37
  86. package/src/sdk/types/agent.types.ts +5 -0
  87. package/src/sdk/types/audio.types.ts +8 -10
  88. package/src/sdk/types/data-strategy.types.ts +3 -0
  89. package/src/sdk/types/external-integration.types.ts +6 -0
  90. package/src/sdk/types/log.types.ts +4 -23
  91. package/src/sdk/types/patient.types.ts +2 -3
  92. package/src/sdk/types/reports.types.ts +1 -1
  93. package/src/sdk/types/session.types.ts +8 -8
  94. package/src/sdk/types/team.types.ts +5 -3
  95. package/src/sdk/types/template.types.ts +18 -7
  96. package/src/sdk/types/user.types.ts +6 -0
  97. package/src/sdk/types/websocket.types.ts +8 -7
  98. package/src/sdk/urls.ts +3 -8
  99. package/src/sdk/whio-orgadmin-sdk.ts +8 -0
  100. package/src/sdk/whio-sdk.ts +39 -16
  101. package/src/sdk/whio-superuser-sdk.ts +9 -16
  102. package/src/sdk/whio-teamadmin-sdk.ts +1 -16
  103. package/tsconfig.json +1 -1
  104. package/src/sdk/modules/debug.module.ts +0 -44
@@ -1,42 +1,101 @@
1
1
  import { BaseClient } from './base-client';
2
- import { Organization, CreateOrganizationDto, UpdateOrganizationDto } from '../types';
2
+ import { Organization, CreateOrganizationDto, UpdateOrganizationDto, User } from '../types';
3
3
  import urls from '../urls';
4
4
 
5
5
  export class OrganizationModule extends BaseClient {
6
+ /**
7
+ * Create a new organization.
8
+ *
9
+ * @param name - Display name of the organization.
10
+ * @param description - Optional description of the organization.
11
+ * @returns The newly created organization.
12
+ */
6
13
  public async createOrganization(name: string, description?: string): Promise<Organization> {
7
14
  const dto: CreateOrganizationDto = { name, description };
8
15
  return this.request<Organization>(urls.organizations, 'POST', dto);
9
16
  }
10
17
 
18
+ /**
19
+ * List all organizations the current user can access.
20
+ *
21
+ * @returns An array of organizations.
22
+ */
11
23
  public async getOrganizations(): Promise<Organization[]> {
12
24
  return this.request<Organization[]>(urls.organizations, 'GET');
13
25
  }
14
26
 
27
+ /**
28
+ * Get a single organization by ID.
29
+ *
30
+ * @param id - UUID of the organization.
31
+ * @returns The requested organization.
32
+ */
15
33
  public async getOrganization(id: string): Promise<Organization> {
16
34
  return this.request<Organization>(`${urls.organizations}/${id}`, 'GET');
17
35
  }
18
36
 
37
+ /**
38
+ * Update an organization's name and/or description.
39
+ *
40
+ * @param id - UUID of the organization to update.
41
+ * @param name - New display name for the organization.
42
+ * @param description - New description for the organization.
43
+ * @returns The updated organization.
44
+ */
19
45
  public async updateOrganization(id: string, name?: string, description?: string): Promise<Organization> {
20
46
  const dto: UpdateOrganizationDto = { name, description };
21
47
  return this.request<Organization>(`${urls.organizations}/${id}`, 'PATCH', dto);
22
48
  }
23
49
 
50
+ /**
51
+ * Delete an organization by ID.
52
+ *
53
+ * @param id - UUID of the organization to delete.
54
+ * @returns A promise that resolves when the organization is deleted.
55
+ */
24
56
  public async deleteOrganization(id: string): Promise<void> {
25
57
  await this.request(`${urls.organizations}/${id}`, 'DELETE');
26
58
  }
27
59
 
28
- public async addUserToOrganization(organizationId: string, userId: string): Promise<void> {
29
- await this.request(`${urls.organizations}/${organizationId}/users/${userId}`, 'POST');
60
+ /**
61
+ * Add a user to an organization.
62
+ *
63
+ * @param organizationId - UUID of the organization.
64
+ * @param userId - UUID of the user to add.
65
+ * @returns The user as a member of the organization.
66
+ */
67
+ public async addUserToOrganization(organizationId: string, userId: string): Promise<User> {
68
+ return this.request<User>(`${urls.organizations}/${organizationId}/users/${userId}`, 'POST');
30
69
  }
31
70
 
32
- public async removeUserFromOrganization(organizationId: string, userId: string): Promise<void> {
33
- await this.request(`${urls.organizations}/${organizationId}/users/${userId}`, 'DELETE');
71
+ /**
72
+ * Remove a user from an organization.
73
+ *
74
+ * @param organizationId - UUID of the organization.
75
+ * @param userId - UUID of the user to remove.
76
+ * @returns The removed organization member.
77
+ */
78
+ public async removeUserFromOrganization(organizationId: string, userId: string): Promise<User> {
79
+ return this.request<User>(`${urls.organizations}/${organizationId}/users/${userId}`, 'DELETE');
34
80
  }
35
81
 
82
+ /**
83
+ * Link an external integration to an organization.
84
+ *
85
+ * @param organizationId - UUID of the organization.
86
+ * @param integrationId - UUID of the external integration to link.
87
+ * @returns The updated organization.
88
+ */
36
89
  public async linkExternalIntegration(organizationId: string, integrationId: string): Promise<Organization> {
37
90
  return this.request<Organization>(`${urls.organizations}/${organizationId}/external-integration/${integrationId}`, 'POST');
38
91
  }
39
92
 
93
+ /**
94
+ * Unlink the external integration from an organization.
95
+ *
96
+ * @param organizationId - UUID of the organization.
97
+ * @returns The updated organization.
98
+ */
40
99
  public async unlinkExternalIntegration(organizationId: string): Promise<Organization> {
41
100
  return this.request<Organization>(`${urls.organizations}/${organizationId}/external-integration`, 'DELETE');
42
101
  }
@@ -8,8 +8,11 @@ import urls from '../urls';
8
8
  export class PatientModule extends BaseClient {
9
9
 
10
10
  /**
11
- * Get patients from external integration (Tiaki)
12
- * Returns an empty array if no integration is configured
11
+ * Get patients from the external integration (Tiaki).
12
+ *
13
+ * The API strips sensitive fields (e.g. national id), so only safe fields are returned.
14
+ *
15
+ * @returns An array of safe patient records, or an empty array if no integration is configured.
13
16
  */
14
17
  async getPatientsFromIntegration(): Promise<PatientsFromIntegrationResponse> {
15
18
  return this.request<PatientsFromIntegrationResponse>(`${urls.patients}/from-integration`, 'GET');
@@ -4,19 +4,19 @@ import urls from '../urls';
4
4
  export class ReportsModule extends BaseClient {
5
5
  /**
6
6
  * Get company daily report as CSV
7
- * @param companyId - The organization/company ID to generate the report for
7
+ * @param organizationId - The organization/company ID to generate the report for
8
8
  * @returns Promise<string> - CSV content with daily user counts and session counts
9
9
  */
10
- public async getCompanyDailyReportCsv(companyId: string): Promise<string> {
11
- return this.textRequest(`${urls.reports}/company-daily?companyId=${companyId}`);
10
+ public async getCompanyDailyReportCsv(organizationId: string): Promise<string> {
11
+ return this.textRequest(`${urls.reports}/company-daily?organizationId=${organizationId}`);
12
12
  }
13
13
 
14
14
  /**
15
15
  * Download company daily report as CSV file
16
- * @param companyId - The organization/company ID to generate the report for
16
+ * @param organizationId - The organization/company ID to generate the report for
17
17
  * @returns Promise<Blob> - CSV file as blob for download
18
18
  */
19
- public async downloadCompanyDailyReport(companyId: string): Promise<Blob> {
20
- return this.downloadRequest(`${urls.reports}/company-daily?companyId=${companyId}`);
19
+ public async downloadCompanyDailyReport(organizationId: string): Promise<Blob> {
20
+ return this.downloadRequest(`${urls.reports}/company-daily?organizationId=${organizationId}`);
21
21
  }
22
22
  }
@@ -12,36 +12,81 @@ import urls from '../../urls';
12
12
  * Session module for organization admins - provides access to sessions within their organization
13
13
  */
14
14
  export class OrgAdminSessionModule 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}/orgadmin/user/${userId}`, 'GET');
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());
22
35
  params.append('offset', offset.toString());
23
- return this.request<SessionsResponse>(`${urls.sessions}/orgadmin/organization?${params.toString()}`, 'GET');
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}/orgadmin/search?${queryString}` : `${urls.sessions}/orgadmin/search`;
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}/orgadmin/${id}`, 'PATCH', sessionData);
60
+ return this.request<Session>(`${urls.sessions}/${id}`, 'PATCH', sessionData);
35
61
  }
36
62
 
37
- public async deleteSession(id: string): Promise<void> {
38
- await this.request(`${urls.sessions}/orgadmin/${id}`, 'DELETE');
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}/orgadmin/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
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 OrgAdminSessionModule 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;
@@ -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
- public async deleteSession(id: string): Promise<void> {
34
- await this.request(`${urls.sessions}/${id}`, 'DELETE');
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}/superuser/user/${userId}`, 'GET');
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}/superuser/search?${queryString}` : `${urls.sessions}/superuser/search`;
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}/superuser/${id}`, 'PATCH', sessionData);
60
+ return this.request<Session>(`${urls.sessions}/${id}`, 'PATCH', sessionData);
35
61
  }
36
62
 
37
- public async deleteSession(id: string): Promise<void> {
38
- await this.request(`${urls.sessions}/superuser/${id}`, 'DELETE');
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}/superuser/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
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;