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
|
@@ -3,6 +3,12 @@ import { LoginCredentials, LoginResponse, PasswordChangeResponse, ChangePassword
|
|
|
3
3
|
import urls from '../urls';
|
|
4
4
|
|
|
5
5
|
export class AuthModule extends BaseClient {
|
|
6
|
+
/**
|
|
7
|
+
* Authenticate with email and password and persist the resulting session.
|
|
8
|
+
*
|
|
9
|
+
* @param credentials - The login credentials (email and password).
|
|
10
|
+
* @returns The login response including access/refresh tokens and the user.
|
|
11
|
+
*/
|
|
6
12
|
public async login(credentials: LoginCredentials): Promise<LoginResponse> {
|
|
7
13
|
try {
|
|
8
14
|
const response = await this.request<LoginResponse>(
|
|
@@ -20,6 +26,12 @@ export class AuthModule extends BaseClient {
|
|
|
20
26
|
}
|
|
21
27
|
}
|
|
22
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Request a one-time login code be sent to the given email address.
|
|
31
|
+
*
|
|
32
|
+
* @param email - The email address to send the login code to.
|
|
33
|
+
* @returns A confirmation message.
|
|
34
|
+
*/
|
|
23
35
|
public async requestLoginCode(email: string): Promise<{ message: string }> {
|
|
24
36
|
return this.request<{ message: string }>(
|
|
25
37
|
'/auth/request-login-code',
|
|
@@ -30,6 +42,13 @@ export class AuthModule extends BaseClient {
|
|
|
30
42
|
);
|
|
31
43
|
}
|
|
32
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Authenticate with an email and one-time login code and persist the session.
|
|
47
|
+
*
|
|
48
|
+
* @param email - The email address the code was sent to.
|
|
49
|
+
* @param code - The one-time login code.
|
|
50
|
+
* @returns The login response including access/refresh tokens and the user.
|
|
51
|
+
*/
|
|
33
52
|
public async loginWithCode(email: string, code: string): Promise<LoginResponse> {
|
|
34
53
|
try {
|
|
35
54
|
const response = await this.request<LoginResponse>(
|
|
@@ -47,14 +66,31 @@ export class AuthModule extends BaseClient {
|
|
|
47
66
|
}
|
|
48
67
|
}
|
|
49
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Clear the current session and any persisted authentication state.
|
|
71
|
+
*
|
|
72
|
+
* @returns A promise that resolves when the session is cleared.
|
|
73
|
+
*/
|
|
50
74
|
public async logout(): Promise<void> {
|
|
51
75
|
await this.clearAuth();
|
|
52
76
|
}
|
|
53
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Fetch the authenticated user's profile.
|
|
80
|
+
*
|
|
81
|
+
* @returns The current user.
|
|
82
|
+
*/
|
|
54
83
|
public async getProfile(): Promise<User> {
|
|
55
84
|
return this.request<User>(urls.profile, 'GET');
|
|
56
85
|
}
|
|
57
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Change the authenticated user's password.
|
|
89
|
+
*
|
|
90
|
+
* @param currentPassword - The user's current password.
|
|
91
|
+
* @param newPassword - The new password to set.
|
|
92
|
+
* @returns The password change response.
|
|
93
|
+
*/
|
|
58
94
|
public async changePassword(currentPassword: string, newPassword: string): Promise<PasswordChangeResponse> {
|
|
59
95
|
const dto: ChangePasswordDto = {
|
|
60
96
|
currentPassword,
|
|
@@ -63,6 +99,13 @@ export class AuthModule extends BaseClient {
|
|
|
63
99
|
return this.request<PasswordChangeResponse>(urls.changePassword, 'PATCH', dto);
|
|
64
100
|
}
|
|
65
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Change another user's password as an administrator.
|
|
104
|
+
*
|
|
105
|
+
* @param userId - UUID of the user whose password is being changed.
|
|
106
|
+
* @param newPassword - The new password to set.
|
|
107
|
+
* @returns The password change response.
|
|
108
|
+
*/
|
|
66
109
|
public async adminChangePassword(userId: string, newPassword: string): Promise<PasswordChangeResponse> {
|
|
67
110
|
const dto: AdminChangePasswordDto = {
|
|
68
111
|
userId,
|
|
@@ -1,38 +1,76 @@
|
|
|
1
1
|
import { BaseClient } from './base-client';
|
|
2
|
-
import { DataStrategy, CreateDataStrategyDto, UpdateDataStrategyDto } from '../types';
|
|
2
|
+
import { DataStrategy, DataStrategyWithOrganization, CreateDataStrategyDto, UpdateDataStrategyDto } from '../types';
|
|
3
3
|
import urls from '../urls';
|
|
4
4
|
|
|
5
5
|
export class DataStrategyModule extends BaseClient {
|
|
6
|
+
/**
|
|
7
|
+
* Create a data strategy for an organization.
|
|
8
|
+
*
|
|
9
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
10
|
+
* @param options - Optional retention settings for the data strategy.
|
|
11
|
+
* @returns The created data strategy with its organization populated.
|
|
12
|
+
*/
|
|
6
13
|
public async createDataStrategy(
|
|
7
14
|
organizationId?: string,
|
|
8
15
|
options?: Omit<CreateDataStrategyDto, 'organizationId'>,
|
|
9
|
-
): Promise<
|
|
16
|
+
): Promise<DataStrategyWithOrganization> {
|
|
10
17
|
const dto: CreateDataStrategyDto = {
|
|
11
18
|
organizationId: organizationId || this.user!.organizationId,
|
|
12
19
|
...options,
|
|
13
20
|
};
|
|
14
|
-
return this.request<
|
|
21
|
+
return this.request<DataStrategyWithOrganization>(urls.dataStrategies, 'POST', dto);
|
|
15
22
|
}
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
/**
|
|
25
|
+
* List data strategies, optionally filtered by organization.
|
|
26
|
+
*
|
|
27
|
+
* @param organizationId - Optional organization UUID to filter by.
|
|
28
|
+
* @returns An array of data strategies, each with its organization populated.
|
|
29
|
+
*/
|
|
30
|
+
public async getDataStrategies(organizationId?: string): Promise<DataStrategyWithOrganization[]> {
|
|
18
31
|
const params = organizationId ? `?organizationId=${organizationId}` : '';
|
|
19
|
-
return this.request<
|
|
32
|
+
return this.request<DataStrategyWithOrganization[]>(`${urls.dataStrategies}${params}`, 'GET');
|
|
20
33
|
}
|
|
21
34
|
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Get a single data strategy by id.
|
|
37
|
+
*
|
|
38
|
+
* @param id - UUID of the data strategy.
|
|
39
|
+
* @returns The data strategy with its organization populated.
|
|
40
|
+
*/
|
|
41
|
+
public async getDataStrategy(id: string): Promise<DataStrategyWithOrganization> {
|
|
42
|
+
return this.request<DataStrategyWithOrganization>(`${urls.dataStrategies}/${id}`, 'GET');
|
|
24
43
|
}
|
|
25
44
|
|
|
26
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Get the data strategy for a specific organization.
|
|
47
|
+
*
|
|
48
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
49
|
+
* @returns The data strategy with its organization populated.
|
|
50
|
+
*/
|
|
51
|
+
public async getDataStrategyByOrganization(organizationId?: string): Promise<DataStrategyWithOrganization> {
|
|
27
52
|
const orgId = organizationId || this.user!.organizationId;
|
|
28
|
-
return this.request<
|
|
53
|
+
return this.request<DataStrategyWithOrganization>(`${urls.dataStrategies}?organizationId=${orgId}`, 'GET');
|
|
29
54
|
}
|
|
30
55
|
|
|
31
|
-
|
|
32
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Update a data strategy.
|
|
58
|
+
*
|
|
59
|
+
* @param id - UUID of the data strategy to update.
|
|
60
|
+
* @param data - The retention settings to update.
|
|
61
|
+
* @returns The updated data strategy with its organization populated.
|
|
62
|
+
*/
|
|
63
|
+
public async updateDataStrategy(id: string, data: UpdateDataStrategyDto): Promise<DataStrategyWithOrganization> {
|
|
64
|
+
return this.request<DataStrategyWithOrganization>(`${urls.dataStrategies}/${id}`, 'PATCH', data);
|
|
33
65
|
}
|
|
34
66
|
|
|
35
|
-
|
|
36
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Delete a data strategy.
|
|
69
|
+
*
|
|
70
|
+
* @param id - UUID of the data strategy to delete.
|
|
71
|
+
* @returns The deleted data strategy entity.
|
|
72
|
+
*/
|
|
73
|
+
public async deleteDataStrategy(id: string): Promise<DataStrategy> {
|
|
74
|
+
return this.request<DataStrategy>(`${urls.dataStrategies}/${id}`, 'DELETE');
|
|
37
75
|
}
|
|
38
76
|
}
|
|
@@ -7,6 +7,12 @@ import {
|
|
|
7
7
|
import urls from '../urls';
|
|
8
8
|
|
|
9
9
|
export class ExternalIntegrationModule extends BaseClient {
|
|
10
|
+
/**
|
|
11
|
+
* Create an external integration. The `apiKey` is sent as plaintext and stored encrypted at rest.
|
|
12
|
+
*
|
|
13
|
+
* @param data - The external integration payload (endpoints, apiKey, headerName, etc.).
|
|
14
|
+
* @returns The created external integration (its `apiKey` is returned masked).
|
|
15
|
+
*/
|
|
10
16
|
public async createExternalIntegration(
|
|
11
17
|
data: CreateExternalIntegrationDto,
|
|
12
18
|
): Promise<ExternalIntegration> {
|
|
@@ -17,6 +23,11 @@ export class ExternalIntegrationModule extends BaseClient {
|
|
|
17
23
|
);
|
|
18
24
|
}
|
|
19
25
|
|
|
26
|
+
/**
|
|
27
|
+
* List all external integrations.
|
|
28
|
+
*
|
|
29
|
+
* @returns An array of external integrations (each `apiKey` is returned masked).
|
|
30
|
+
*/
|
|
20
31
|
public async getExternalIntegrations(): Promise<ExternalIntegration[]> {
|
|
21
32
|
return this.request<ExternalIntegration[]>(
|
|
22
33
|
urls.externalIntegrations,
|
|
@@ -24,6 +35,12 @@ export class ExternalIntegrationModule extends BaseClient {
|
|
|
24
35
|
);
|
|
25
36
|
}
|
|
26
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Get a single external integration by id.
|
|
40
|
+
*
|
|
41
|
+
* @param id - UUID of the external integration.
|
|
42
|
+
* @returns The external integration (its `apiKey` is returned masked).
|
|
43
|
+
*/
|
|
27
44
|
public async getExternalIntegration(
|
|
28
45
|
id: string,
|
|
29
46
|
): Promise<ExternalIntegration> {
|
|
@@ -33,6 +50,13 @@ export class ExternalIntegrationModule extends BaseClient {
|
|
|
33
50
|
);
|
|
34
51
|
}
|
|
35
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Update an external integration. A supplied `apiKey` is sent as plaintext and stored encrypted at rest.
|
|
55
|
+
*
|
|
56
|
+
* @param id - UUID of the external integration to update.
|
|
57
|
+
* @param data - The fields to update.
|
|
58
|
+
* @returns The updated external integration (its `apiKey` is returned masked).
|
|
59
|
+
*/
|
|
36
60
|
public async updateExternalIntegration(
|
|
37
61
|
id: string,
|
|
38
62
|
data: UpdateExternalIntegrationDto,
|
|
@@ -44,6 +68,12 @@ export class ExternalIntegrationModule extends BaseClient {
|
|
|
44
68
|
);
|
|
45
69
|
}
|
|
46
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Delete an external integration.
|
|
73
|
+
*
|
|
74
|
+
* @param id - UUID of the external integration to delete.
|
|
75
|
+
* @returns A promise that resolves when the integration has been deleted.
|
|
76
|
+
*/
|
|
47
77
|
public async deleteExternalIntegration(id: string): Promise<void> {
|
|
48
78
|
await this.request(`${urls.externalIntegrations}/${id}`, 'DELETE');
|
|
49
79
|
}
|
|
@@ -3,6 +3,13 @@ import { IntegrationAction, CreateIntegrationActionDto, UpdateIntegrationActionD
|
|
|
3
3
|
import urls from '../urls';
|
|
4
4
|
|
|
5
5
|
export class IntegrationActionModule extends BaseClient {
|
|
6
|
+
/**
|
|
7
|
+
* Create an integration action for an organization.
|
|
8
|
+
*
|
|
9
|
+
* @param name - Display name of the integration action.
|
|
10
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
11
|
+
* @returns The created integration action.
|
|
12
|
+
*/
|
|
6
13
|
public async createIntegrationAction(name: string, organizationId?: string): Promise<IntegrationAction> {
|
|
7
14
|
const dto: CreateIntegrationActionDto = {
|
|
8
15
|
name,
|
|
@@ -11,20 +18,46 @@ export class IntegrationActionModule extends BaseClient {
|
|
|
11
18
|
return this.request<IntegrationAction>(urls.integrationActions, 'POST', dto);
|
|
12
19
|
}
|
|
13
20
|
|
|
21
|
+
/**
|
|
22
|
+
* List integration actions, optionally filtered by organization.
|
|
23
|
+
*
|
|
24
|
+
* @param organizationId - Optional organization UUID to filter by.
|
|
25
|
+
* @returns An array of integration actions.
|
|
26
|
+
*/
|
|
14
27
|
public async getIntegrationActions(organizationId?: string): Promise<IntegrationAction[]> {
|
|
15
28
|
const params = organizationId ? `?organizationId=${organizationId}` : '';
|
|
16
29
|
return this.request<IntegrationAction[]>(`${urls.integrationActions}${params}`, 'GET');
|
|
17
30
|
}
|
|
18
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Get a single integration action by id.
|
|
34
|
+
*
|
|
35
|
+
* @param id - UUID of the integration action.
|
|
36
|
+
* @returns The integration action.
|
|
37
|
+
*/
|
|
19
38
|
public async getIntegrationAction(id: string): Promise<IntegrationAction> {
|
|
20
39
|
return this.request<IntegrationAction>(`${urls.integrationActions}/${id}`, 'GET');
|
|
21
40
|
}
|
|
22
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Get the integration actions for a specific organization.
|
|
44
|
+
*
|
|
45
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
46
|
+
* @returns An array of integration actions for the organization.
|
|
47
|
+
*/
|
|
23
48
|
public async getIntegrationActionsByOrganization(organizationId?: string): Promise<IntegrationAction[]> {
|
|
24
49
|
const orgId = organizationId || this.user!.organizationId;
|
|
25
50
|
return this.request<IntegrationAction[]>(`${urls.integrationActions}?organizationId=${orgId}`, 'GET');
|
|
26
51
|
}
|
|
27
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Update an integration action.
|
|
55
|
+
*
|
|
56
|
+
* @param id - UUID of the integration action to update.
|
|
57
|
+
* @param name - New display name of the integration action.
|
|
58
|
+
* @param organizationId - Optional organization UUID; defaults to the current user's organization.
|
|
59
|
+
* @returns The updated integration action.
|
|
60
|
+
*/
|
|
28
61
|
public async updateIntegrationAction(id: string, name: string, organizationId?: string): Promise<IntegrationAction> {
|
|
29
62
|
const dto: UpdateIntegrationActionDto = {
|
|
30
63
|
name,
|
|
@@ -33,6 +66,12 @@ export class IntegrationActionModule extends BaseClient {
|
|
|
33
66
|
return this.request<IntegrationAction>(`${urls.integrationActions}/${id}`, 'PATCH', dto);
|
|
34
67
|
}
|
|
35
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Delete an integration action.
|
|
71
|
+
*
|
|
72
|
+
* @param id - UUID of the integration action to delete.
|
|
73
|
+
* @returns A promise that resolves when the integration action has been deleted.
|
|
74
|
+
*/
|
|
36
75
|
public async deleteIntegrationAction(id: string): Promise<void> {
|
|
37
76
|
await this.request(`${urls.integrationActions}/${id}`, 'DELETE');
|
|
38
77
|
}
|
|
@@ -100,7 +100,7 @@ export class LogModule extends BaseClient {
|
|
|
100
100
|
/**
|
|
101
101
|
* Convenience methods for different log levels
|
|
102
102
|
*/
|
|
103
|
-
public async logInfo(message: string, context?: string, action?: string, data?:
|
|
103
|
+
public async logInfo(message: string, context?: string, action?: string, data?: Record<string, unknown>): Promise<Log> {
|
|
104
104
|
return this.createLog({
|
|
105
105
|
level: 'info',
|
|
106
106
|
message,
|
|
@@ -110,7 +110,7 @@ export class LogModule extends BaseClient {
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
public async logError(message: string, context?: string, action?: string, data?:
|
|
113
|
+
public async logError(message: string, context?: string, action?: string, data?: Record<string, unknown>): Promise<Log> {
|
|
114
114
|
return this.createLog({
|
|
115
115
|
level: 'error',
|
|
116
116
|
message,
|
|
@@ -120,7 +120,7 @@ export class LogModule extends BaseClient {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
public async logWarn(message: string, context?: string, action?: string, data?:
|
|
123
|
+
public async logWarn(message: string, context?: string, action?: string, data?: Record<string, unknown>): Promise<Log> {
|
|
124
124
|
return this.createLog({
|
|
125
125
|
level: 'warn',
|
|
126
126
|
message,
|
|
@@ -130,7 +130,7 @@ export class LogModule extends BaseClient {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
public async logDebug(message: string, context?: string, action?: string, data?:
|
|
133
|
+
public async logDebug(message: string, context?: string, action?: string, data?: Record<string, unknown>): Promise<Log> {
|
|
134
134
|
return this.createLog({
|
|
135
135
|
level: 'debug',
|
|
136
136
|
message,
|
|
@@ -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
|
-
|
|
29
|
-
|
|
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
|
-
|
|
33
|
-
|
|
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
|
-
*
|
|
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
|
|
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(
|
|
11
|
-
return this.textRequest(`${urls.reports}/company-daily?
|
|
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
|
|
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(
|
|
20
|
-
return this.downloadRequest(`${urls.reports}/company-daily?
|
|
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}/
|
|
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}/
|
|
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 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;
|