whio-api-sdk 1.0.2 → 1.0.3

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/index.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export { ApiSDK } from "./src/sdk";
package/dist/index.js CHANGED
@@ -1,59 +1 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const sdk_1 = require("./sdk");
13
- const keepAlive = setInterval(() => { }, 1000);
14
- class storage {
15
- constructor() {
16
- this.items = {};
17
- console.log("Storage initialized");
18
- }
19
- getItem(key) {
20
- return this.items[key] || null;
21
- }
22
- setItem(key, value) {
23
- this.items[key] = value;
24
- }
25
- removeItem(key) {
26
- delete this.items[key];
27
- }
28
- }
29
- const config = {
30
- baseUrl: 'http://localhost:3000',
31
- storage: new storage(),
32
- };
33
- const loginCredentials = {
34
- email: "rimu.boddy@make.nz",
35
- password: "cbr400rr",
36
- };
37
- const sdk = new sdk_1.ApiSDK(config);
38
- function main() {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- yield sdk.login(loginCredentials);
41
- const user = sdk.getCurrentUser();
42
- const newUser = yield sdk.createEditorUser("Rimu", "Rimu", "chiscs2snw2@bread.com", "cbr400rr");
43
- const team = yield sdk.createTeam("best team ever", "this is the best team ever");
44
- console.log(team);
45
- const assignRes = yield sdk.addUserToTeam(team.id, newUser.id, "admin");
46
- const template = yield sdk.createTemplate("Test Template", "This is a test template");
47
- const updatedTemplate = yield sdk.updateTemplate("Updated Template", "This is an updated test template", template.id);
48
- const userTemplate = yield sdk.createUserTemplate("User Template", "This is a user template", template.id);
49
- const updatedUserTemplate = yield sdk.updateUserTemplate("User templated updated", "This is an updated user template", userTemplate.id);
50
- //console.log("Usertemplate", userTemplate);
51
- //console.log("Updated User Template", updatedUserTemplate);
52
- const templates = yield sdk.getTemplates();
53
- const userTemplates = yield sdk.getUserTemplates();
54
- });
55
- }
56
- main().catch((error) => {
57
- console.error("Error:", error);
58
- });
59
- //make sure no exit
1
+ export { ApiSDK } from "./src/sdk";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,57 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { ApiSDK } from './sdk';
11
+ const keepAlive = setInterval(() => { }, 1000);
12
+ class storage {
13
+ constructor() {
14
+ this.items = {};
15
+ console.log("Storage initialized");
16
+ }
17
+ getItem(key) {
18
+ return this.items[key] || null;
19
+ }
20
+ setItem(key, value) {
21
+ this.items[key] = value;
22
+ }
23
+ removeItem(key) {
24
+ delete this.items[key];
25
+ }
26
+ }
27
+ const config = {
28
+ baseUrl: 'http://localhost:3000',
29
+ storage: new storage(),
30
+ };
31
+ const loginCredentials = {
32
+ email: "rimu.boddy@make.nz",
33
+ password: "cbr400rr",
34
+ };
35
+ const sdk = new ApiSDK(config);
36
+ function main() {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ yield sdk.login(loginCredentials);
39
+ const user = sdk.getCurrentUser();
40
+ const newUser = yield sdk.createEditorUser("Rimu", "Rimu", "chiscs2snw2@bread.com", "cbr400rr");
41
+ const team = yield sdk.createTeam("best team ever", "this is the best team ever");
42
+ console.log(team);
43
+ const assignRes = yield sdk.addUserToTeam(team.id, newUser.id, "admin");
44
+ const template = yield sdk.createTemplate("Test Template", "This is a test template");
45
+ const updatedTemplate = yield sdk.updateTemplate("Updated Template", "This is an updated test template", template.id);
46
+ const userTemplate = yield sdk.createUserTemplate("User Template", "This is a user template", template.id);
47
+ const updatedUserTemplate = yield sdk.updateUserTemplate("User templated updated", "This is an updated user template", userTemplate.id);
48
+ //console.log("Usertemplate", userTemplate);
49
+ //console.log("Updated User Template", updatedUserTemplate);
50
+ const templates = yield sdk.getTemplates();
51
+ const userTemplates = yield sdk.getUserTemplates();
52
+ });
53
+ }
54
+ main().catch((error) => {
55
+ console.error("Error:", error);
56
+ });
57
+ //make sure no exit
@@ -0,0 +1 @@
1
+ export { ApiSDK } from "./sdk";
@@ -0,0 +1 @@
1
+ export { ApiSDK } from "./sdk";
@@ -0,0 +1,39 @@
1
+ import { LoginResponse, LoginCredentials, SDKConfig, User, Template, Team, UserTemplate, TranscriptionSummary } from './types';
2
+ export declare class ApiSDK {
3
+ private baseUrl;
4
+ private storage;
5
+ private accessToken;
6
+ private refreshToken;
7
+ private user;
8
+ constructor(config?: SDKConfig);
9
+ private initialize;
10
+ private request;
11
+ login(credentials: LoginCredentials): Promise<LoginResponse>;
12
+ logout(): Promise<void>;
13
+ private clearAuth;
14
+ isAuthenticated(): boolean;
15
+ getCurrentUser(): User | null;
16
+ getAccessToken(): string | null;
17
+ getRefreshToken(): string | null;
18
+ private createUser;
19
+ private assignRoleToUser;
20
+ assignEditorToRoleToUser(userId: string): Promise<User>;
21
+ assignAdminToRoleToUser(userId: string): Promise<User>;
22
+ assignDisabledToRoleToUser(userId: string): Promise<User>;
23
+ createEditorUser(firstName: string, lastName: string, email: string, password: string): Promise<User>;
24
+ createAdminUser(firstName: string, lastName: string, email: string, password: string): Promise<User>;
25
+ createDisabledUser(firstName: string, lastName: string, email: string, password: string): Promise<User>;
26
+ createTeam(name: string, description: string): Promise<Team>;
27
+ updateTeam(id: string, name: string, description: string): Promise<any>;
28
+ addUserToTeam(teamId: string, userId: string, roleName: string): Promise<any>;
29
+ removeUserFromTeam(teamId: string, userId: string): Promise<any>;
30
+ createTemplate(title: string, content: string): Promise<any>;
31
+ createUserTemplate(title: string, content: string, originalTemplateId: string | undefined): Promise<UserTemplate>;
32
+ updateTemplate(title: string, content: string, id: string): Promise<Template>;
33
+ updateUserTemplate(title: string, content: string, id: string): Promise<UserTemplate>;
34
+ getTemplates(): Promise<Template[]>;
35
+ getUserTemplates(): Promise<UserTemplate[]>;
36
+ generateTranscriptionSummary(transcript: string, templateId: string): Promise<TranscriptionSummary>;
37
+ generateTranscriptionSummaryFromUserTemplate(transcript: string, userTemplateId: string): Promise<TranscriptionSummary>;
38
+ updateTranscriptionSummary(id: string, content: string): Promise<TranscriptionSummary>;
39
+ }
@@ -0,0 +1,290 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ // sdk.ts
11
+ import { OrganizationRoleType, } from './types';
12
+ import urls from './urls';
13
+ export class ApiSDK {
14
+ constructor(config = {}) {
15
+ this.accessToken = null;
16
+ this.refreshToken = null;
17
+ this.user = null;
18
+ this.baseUrl = config.baseUrl || '/api';
19
+ this.storage = config.storage || {
20
+ getItem: (key) => localStorage.getItem(key),
21
+ setItem: (key, value) => localStorage.setItem(key, value),
22
+ removeItem: (key) => localStorage.removeItem(key),
23
+ };
24
+ this.initialize();
25
+ }
26
+ initialize() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ this.accessToken = yield this.storage.getItem('access_token');
29
+ const userString = yield this.storage.getItem('user');
30
+ this.user = userString ? JSON.parse(userString) : null;
31
+ });
32
+ }
33
+ request(endpoint, method = 'GET', body, headers = {}) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const url = `${this.baseUrl}${endpoint}`;
36
+ const defaultHeaders = {
37
+ 'Content-Type': 'application/json',
38
+ 'ngrok-skip-browser-warning': 'true'
39
+ };
40
+ if (this.accessToken) {
41
+ defaultHeaders['Authorization'] = `Bearer ${this.accessToken}`;
42
+ }
43
+ const response = yield fetch(url, {
44
+ method,
45
+ headers: Object.assign(Object.assign({}, defaultHeaders), headers),
46
+ body: body ? JSON.stringify(body) : undefined,
47
+ });
48
+ if (!response.ok) {
49
+ const errorData = yield response.json().catch(() => ({}));
50
+ throw new Error(errorData.message || `Request failed with status ${response.status}`);
51
+ }
52
+ return response.json();
53
+ });
54
+ }
55
+ login(credentials) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ try {
58
+ const response = yield this.request('/auth/login', 'POST', credentials);
59
+ this.accessToken = response.access_token;
60
+ this.refreshToken = response.referesh_token;
61
+ this.user = response.user;
62
+ yield this.storage.setItem('access_token', response.access_token);
63
+ yield this.storage.setItem('user', JSON.stringify(response.user));
64
+ return response;
65
+ }
66
+ catch (error) {
67
+ yield this.clearAuth();
68
+ throw error;
69
+ }
70
+ });
71
+ }
72
+ logout() {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ try {
75
+ yield this.request('/auth/logout', 'POST');
76
+ }
77
+ finally {
78
+ yield this.clearAuth();
79
+ }
80
+ });
81
+ }
82
+ clearAuth() {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ this.accessToken = null;
85
+ this.user = null;
86
+ yield this.storage.removeItem('access_token');
87
+ yield this.storage.removeItem('user');
88
+ });
89
+ }
90
+ isAuthenticated() {
91
+ return !!this.accessToken;
92
+ }
93
+ getCurrentUser() {
94
+ return this.user;
95
+ }
96
+ getAccessToken() {
97
+ return this.accessToken;
98
+ }
99
+ getRefreshToken() {
100
+ return this.refreshToken;
101
+ }
102
+ createUser(firstName, lastName, email, password) {
103
+ var _a;
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ const createUserDto = {
106
+ firstName,
107
+ lastName,
108
+ email,
109
+ password,
110
+ organizationId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.organizationId,
111
+ };
112
+ const user = yield this.request(urls.users, 'POST', createUserDto);
113
+ return user;
114
+ });
115
+ }
116
+ assignRoleToUser(userId, roleName) {
117
+ var _a;
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ const organization = yield this.request(`${urls.organizations}/${(_a = this.user) === null || _a === void 0 ? void 0 : _a.organizationId}`, 'GET');
120
+ const orgRoleEditor = organization.roles.find(r => r.name === roleName);
121
+ const assignRoleDto = {
122
+ userId: userId,
123
+ organizationRoleId: orgRoleEditor.id,
124
+ };
125
+ this.request(urls.userOrganizationRoles, 'POST', assignRoleDto);
126
+ const userWithOrgRole = yield this.request(`${urls.user}/${userId}`, 'GET');
127
+ return userWithOrgRole;
128
+ });
129
+ }
130
+ assignEditorToRoleToUser(userId) {
131
+ return __awaiter(this, void 0, void 0, function* () {
132
+ return this.assignRoleToUser(userId, OrganizationRoleType.EDITOR);
133
+ });
134
+ }
135
+ assignAdminToRoleToUser(userId) {
136
+ return __awaiter(this, void 0, void 0, function* () {
137
+ return this.assignRoleToUser(userId, OrganizationRoleType.ADMIN);
138
+ });
139
+ }
140
+ assignDisabledToRoleToUser(userId) {
141
+ return __awaiter(this, void 0, void 0, function* () {
142
+ return this.assignRoleToUser(userId, OrganizationRoleType.DISABLED);
143
+ });
144
+ }
145
+ createEditorUser(firstName, lastName, email, password) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ const user = yield this.createUser(firstName, lastName, email, password);
148
+ const userWithOrgRole = yield this.assignEditorToRoleToUser(user.id);
149
+ return userWithOrgRole;
150
+ });
151
+ }
152
+ createAdminUser(firstName, lastName, email, password) {
153
+ return __awaiter(this, void 0, void 0, function* () {
154
+ const user = yield this.createUser(firstName, lastName, email, password);
155
+ const userWithOrgRole = yield this.assignAdminToRoleToUser(user.id);
156
+ return userWithOrgRole;
157
+ });
158
+ }
159
+ createDisabledUser(firstName, lastName, email, password) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ const user = yield this.createUser(firstName, lastName, email, password);
162
+ const userWithOrgRole = yield this.assignDisabledToRoleToUser(user.id);
163
+ return userWithOrgRole;
164
+ });
165
+ }
166
+ createTeam(name, description) {
167
+ return __awaiter(this, void 0, void 0, function* () {
168
+ const teamDto = {
169
+ name,
170
+ description,
171
+ organizationId: this.user.organizationId,
172
+ };
173
+ return this.request(urls.teams, 'POST', teamDto);
174
+ });
175
+ }
176
+ updateTeam(id, name, description) {
177
+ return __awaiter(this, void 0, void 0, function* () {
178
+ const teamDto = {
179
+ name,
180
+ description,
181
+ };
182
+ return this.request(`${urls.teams}/${id}`, 'PUT', teamDto);
183
+ });
184
+ }
185
+ addUserToTeam(teamId, userId, roleName) {
186
+ return __awaiter(this, void 0, void 0, function* () {
187
+ const assignRoleDto = {
188
+ teamId,
189
+ userId,
190
+ name: roleName,
191
+ };
192
+ return this.request(urls.teamRoles, 'POST', assignRoleDto);
193
+ });
194
+ }
195
+ removeUserFromTeam(teamId, userId) {
196
+ return __awaiter(this, void 0, void 0, function* () {
197
+ const url = `${urls.teamRoles}/user/${userId}/team/${teamId}`;
198
+ return this.request(urls.teamRoles, 'DELETE');
199
+ });
200
+ }
201
+ //unsure how we are going to deal with template categories just yet
202
+ createTemplate(title, content) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ const templateCategories = yield this.request(urls.templateCatedories, 'GET');
205
+ const createTemplateDto = {
206
+ title,
207
+ content,
208
+ isGlobal: false,
209
+ categoryId: templateCategories[0].id,
210
+ createdById: this.user.id,
211
+ organizationId: this.user.organizationId,
212
+ };
213
+ return this.request(urls.templates, 'POST', createTemplateDto);
214
+ });
215
+ }
216
+ createUserTemplate(title, content, originalTemplateId) {
217
+ return __awaiter(this, void 0, void 0, function* () {
218
+ const createUserTemplateDto = {
219
+ title,
220
+ content,
221
+ originalTemplateId,
222
+ userId: this.user.id,
223
+ };
224
+ return this.request(urls.userTemplates, 'POST', createUserTemplateDto);
225
+ });
226
+ }
227
+ updateTemplate(title, content, id) {
228
+ return __awaiter(this, void 0, void 0, function* () {
229
+ const templateDto = {
230
+ title,
231
+ content,
232
+ isGlobal: false,
233
+ organizationId: this.user.organizationId,
234
+ };
235
+ return this.request(`${urls.templates}/${id}`, 'PATCH', templateDto);
236
+ });
237
+ }
238
+ updateUserTemplate(title, content, id) {
239
+ return __awaiter(this, void 0, void 0, function* () {
240
+ const userTemplateDto = {
241
+ title,
242
+ content,
243
+ };
244
+ return this.request(`${urls.userTemplates}/${id}`, 'PATCH', userTemplateDto);
245
+ });
246
+ }
247
+ getTemplates() {
248
+ return __awaiter(this, void 0, void 0, function* () {
249
+ return this.request(urls.templates, 'GET');
250
+ });
251
+ }
252
+ getUserTemplates() {
253
+ return __awaiter(this, void 0, void 0, function* () {
254
+ const url = `${urls.userTemplates}/user/${this.user.id}`;
255
+ return this.request(url, 'GET');
256
+ });
257
+ }
258
+ generateTranscriptionSummary(transcript, templateId) {
259
+ return __awaiter(this, void 0, void 0, function* () {
260
+ const generateSummaryDto = {
261
+ transcript,
262
+ templateId,
263
+ userId: this.user.id,
264
+ fromUserTemplate: false,
265
+ };
266
+ const transcriptionSummary = yield this.request(urls.transcriptionSummary, 'POST', generateSummaryDto);
267
+ return transcriptionSummary;
268
+ });
269
+ }
270
+ generateTranscriptionSummaryFromUserTemplate(transcript, userTemplateId) {
271
+ return __awaiter(this, void 0, void 0, function* () {
272
+ const generateSummaryDto = {
273
+ transcript,
274
+ templateId: userTemplateId,
275
+ userId: this.user.id,
276
+ fromUserTemplate: true,
277
+ };
278
+ const transcriptionSummary = yield this.request(urls.transcriptionSummary, 'POST', generateSummaryDto);
279
+ return transcriptionSummary;
280
+ });
281
+ }
282
+ updateTranscriptionSummary(id, content) {
283
+ return __awaiter(this, void 0, void 0, function* () {
284
+ const updateSummaryDto = {
285
+ content,
286
+ };
287
+ return this.request(`${urls.transcriptionSummary}/${id}`, 'PATCH', updateSummaryDto);
288
+ });
289
+ }
290
+ }
@@ -0,0 +1,217 @@
1
+ export interface Role {
2
+ id: string;
3
+ name: string;
4
+ createdAt: string;
5
+ updatedAt: string;
6
+ }
7
+ export interface OrganizationRole {
8
+ id: string;
9
+ name: string;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ organizationId: string;
13
+ }
14
+ export interface UserRole {
15
+ userId: string;
16
+ roleId: string;
17
+ createdAt: string;
18
+ role: Role;
19
+ }
20
+ export interface UserOrganizationRole {
21
+ userId: string;
22
+ organizationRoleId: string;
23
+ createdAt: string;
24
+ organizationRole: OrganizationRole;
25
+ }
26
+ export interface Organization {
27
+ id: string;
28
+ name: string;
29
+ description: string;
30
+ createdAt: string;
31
+ updatedAt: string;
32
+ users?: User[];
33
+ roles?: OrganizationRole[];
34
+ }
35
+ export interface User {
36
+ id: string;
37
+ email: string;
38
+ firstName: string;
39
+ lastName: string;
40
+ createdAt: string;
41
+ updatedAt: string;
42
+ organizationId: string;
43
+ organization: Organization;
44
+ roles: UserRole[];
45
+ organizationRoles: UserOrganizationRole[];
46
+ }
47
+ export interface LoginResponse {
48
+ access_token: string;
49
+ referesh_token: string;
50
+ user: User;
51
+ }
52
+ export interface LoginCredentials {
53
+ email: string;
54
+ password: string;
55
+ }
56
+ export interface SDKConfig {
57
+ baseUrl?: string;
58
+ storage?: {
59
+ getItem: (key: string) => string | null | Promise<string | null>;
60
+ setItem: (key: string, value: string) => void | Promise<void>;
61
+ removeItem: (key: string) => void | Promise<void>;
62
+ };
63
+ }
64
+ export interface AssignTeamRoleDto {
65
+ userId: string;
66
+ teamId: string;
67
+ name: string;
68
+ }
69
+ export interface CreateTeamDto {
70
+ name: string;
71
+ description?: string;
72
+ organizationId: string;
73
+ }
74
+ export interface UpdateTeamDto {
75
+ name?: string;
76
+ description?: string;
77
+ organizationId?: string;
78
+ }
79
+ export interface CreateTemplateDto {
80
+ title: string;
81
+ content: string;
82
+ isGlobal?: boolean;
83
+ organizationId: string;
84
+ categoryId: string;
85
+ createdById: string;
86
+ }
87
+ export interface UpdateTemplateDto {
88
+ title?: string;
89
+ content?: string;
90
+ isGlobal?: boolean;
91
+ organizationId: string;
92
+ categoryId?: string;
93
+ }
94
+ export interface GenerateTranscriptionSummaryDto {
95
+ transcript?: string;
96
+ templateId: string;
97
+ userId?: string;
98
+ fromUserTemplate?: boolean;
99
+ }
100
+ export interface UpdateTranscriptionSummaryDto {
101
+ anonymisedTranscript?: string;
102
+ content?: string;
103
+ metadata?: Record<string, any>;
104
+ templateId?: string;
105
+ }
106
+ export interface AssignOrganizationRoleDto {
107
+ userId: string;
108
+ organizationRoleId: string;
109
+ }
110
+ export interface CreateUserTemplateDto {
111
+ title: string;
112
+ content: string;
113
+ userId: string;
114
+ originalTemplateId?: string;
115
+ }
116
+ export interface UpdateUserTemplateDto {
117
+ title?: string;
118
+ content?: string;
119
+ }
120
+ export interface CreateUserDto {
121
+ email: string;
122
+ password: string;
123
+ firstName?: string;
124
+ lastName?: string;
125
+ organizationId?: string;
126
+ }
127
+ export interface UpdateUserDto {
128
+ email?: string;
129
+ password?: string;
130
+ firstName?: string;
131
+ lastName?: string;
132
+ organizationId?: string;
133
+ }
134
+ export declare enum OrganizationRoleType {
135
+ ADMIN = "ADMIN",
136
+ EDITOR = "EDITOR",
137
+ DISABLED = "DISABLED"
138
+ }
139
+ export interface AdminUser {
140
+ id: string;
141
+ email: string;
142
+ password_hash: string;
143
+ role: string;
144
+ created_at: Date;
145
+ }
146
+ export interface TemplateCategory {
147
+ id: string;
148
+ name: string;
149
+ }
150
+ export interface Template {
151
+ id: string;
152
+ title: string;
153
+ content: string;
154
+ createdAt: string;
155
+ updatesAt: string;
156
+ isGlobal: boolean;
157
+ organizationId?: string;
158
+ categoryId: string;
159
+ createdById: string;
160
+ organization?: Organization;
161
+ category?: TemplateCategory;
162
+ createdBy?: User;
163
+ userTemplates?: UserTemplate[];
164
+ transcriptionSummaries?: TranscriptionSummary[];
165
+ teamTemplates?: TeamTemplate[];
166
+ }
167
+ export interface UserTemplate {
168
+ id: string;
169
+ title: string;
170
+ content: string;
171
+ createdAt: string;
172
+ updatesAt: string;
173
+ userId: string;
174
+ originalTemplateId?: string;
175
+ user?: User;
176
+ originalTemplate?: Template;
177
+ }
178
+ export interface TranscriptionSummary {
179
+ id: string;
180
+ anonymisedTranscript?: string;
181
+ content: string;
182
+ metadata?: any;
183
+ createdAt: string;
184
+ updatesAt: string;
185
+ templateId: string;
186
+ userId: string;
187
+ template?: Template;
188
+ user?: User;
189
+ }
190
+ export interface TeamTemplate {
191
+ teamId: string;
192
+ templateId: string;
193
+ createdAt: string;
194
+ team?: Team;
195
+ template?: Template;
196
+ }
197
+ export interface TeamRole {
198
+ id: string;
199
+ name: string;
200
+ createdAt: string;
201
+ updatesAt: string;
202
+ userId: string;
203
+ teamId: string;
204
+ user?: User;
205
+ team?: Team;
206
+ }
207
+ export interface Team {
208
+ id: string;
209
+ name: string;
210
+ description?: string;
211
+ createdAt: string;
212
+ updatesAt: string;
213
+ organizationId: string;
214
+ organization?: Organization;
215
+ teamRoles?: TeamRole[];
216
+ teamTemplates?: TeamTemplate[];
217
+ }
@@ -0,0 +1,7 @@
1
+ // types.ts
2
+ export var OrganizationRoleType;
3
+ (function (OrganizationRoleType) {
4
+ OrganizationRoleType["ADMIN"] = "ADMIN";
5
+ OrganizationRoleType["EDITOR"] = "EDITOR";
6
+ OrganizationRoleType["DISABLED"] = "DISABLED";
7
+ })(OrganizationRoleType || (OrganizationRoleType = {}));
@@ -0,0 +1,20 @@
1
+ declare const urls: {
2
+ login: string;
3
+ register: string;
4
+ refreshToken: string;
5
+ logout: string;
6
+ user: string;
7
+ users: string;
8
+ roles: string;
9
+ teams: string;
10
+ organizations: string;
11
+ organizationRoles: string;
12
+ userRoles: string;
13
+ teamRoles: string;
14
+ templates: string;
15
+ templateCatedories: string;
16
+ userTemplates: string;
17
+ userOrganizationRoles: string;
18
+ transcriptionSummary: string;
19
+ };
20
+ export default urls;
@@ -0,0 +1,20 @@
1
+ const urls = {
2
+ login: '/auth/login',
3
+ register: '/auth/register',
4
+ refreshToken: '/auth/refresh-token',
5
+ logout: '/auth/logout',
6
+ user: '/users',
7
+ users: '/users',
8
+ roles: '/roles',
9
+ teams: '/teams',
10
+ organizations: '/organizations',
11
+ organizationRoles: '/organization-roles',
12
+ userRoles: '/user-roles',
13
+ teamRoles: '/team-roles',
14
+ templates: '/templates',
15
+ templateCatedories: '/template-categories',
16
+ userTemplates: '/user-templates',
17
+ userOrganizationRoles: '/user-organization-roles',
18
+ transcriptionSummary: '/transcription-summary',
19
+ };
20
+ export default urls;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whio-api-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
package/tsconfig.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "module": "ES2020",
5
5
  "declaration": true,
6
6
  "outDir": "./dist",
7
- "rootDir": "./src",
7
+ "rootDir": "./",
8
8
  "strict": true,
9
9
  "esModuleInterop": true,
10
10
  "skipLibCheck": true,
@@ -12,6 +12,6 @@
12
12
  "moduleResolution": "node",
13
13
  "lib": ["es6", "dom"]
14
14
  },
15
- "include": ["src/**/*"],
15
+ "include": ["src/**/*", "index.ts"],
16
16
  "exclude": ["node_modules", "**/*.spec.ts"]
17
17
  }