whio-api-sdk 1.0.166 → 1.0.168

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.
@@ -1,4 +1,4 @@
1
- import { LoginResponse, LoginCredentials, SDKConfig, User, UpdateUserDto, Organization, TemplateCategory, Template, Team, UserTemplate, TranscriptionSummary, TranscriptionAudioUploadResponse, PasswordChangeResponse, Session, CreateSessionDto, UpdateSessionDto } from './types';
1
+ import { LoginResponse, LoginCredentials, SDKConfig, User, UpdateUserDto, Organization, TemplateCategory, Template, Team, UserTemplate, TranscriptionSummary, TranscriptionAudioUploadResponse, PasswordChangeResponse, Session, CreateSessionDto, UpdateSessionDto, Agent } from './types';
2
2
  export declare class ApiSDK {
3
3
  private baseUrl;
4
4
  private storage;
@@ -89,4 +89,11 @@ export declare class ApiSDK {
89
89
  updateSession(id: string, sessionData: UpdateSessionDto): Promise<Session>;
90
90
  deleteSession(id: string): Promise<void>;
91
91
  setPrimaryTranscriptionSummary(sessionId: string, summaryId: string): Promise<Session>;
92
+ createAgent(name: string): Promise<Agent>;
93
+ getAgents(): Promise<Agent[]>;
94
+ getAgent(id: string): Promise<Agent>;
95
+ updateAgent(id: string, name: string): Promise<Agent>;
96
+ deleteAgent(id: string): Promise<void>;
97
+ addAgentToOrganization(agentId: string, organizationId: string): Promise<void>;
98
+ removeAgentFromOrganization(agentId: string, organizationId: string): Promise<void>;
92
99
  }
@@ -132,12 +132,7 @@ export class ApiSDK {
132
132
  }
133
133
  logout() {
134
134
  return __awaiter(this, void 0, void 0, function* () {
135
- try {
136
- yield this.request('/auth/logout', 'POST');
137
- }
138
- finally {
139
- yield this.clearAuth();
140
- }
135
+ yield this.clearAuth();
141
136
  });
142
137
  }
143
138
  clearAuth() {
@@ -683,4 +678,44 @@ export class ApiSDK {
683
678
  return this.request(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
684
679
  });
685
680
  }
681
+ // ======================
682
+ // AGENT METHODS
683
+ // ======================
684
+ createAgent(name) {
685
+ return __awaiter(this, void 0, void 0, function* () {
686
+ const dto = { name };
687
+ return this.request(urls.agents, 'POST', dto);
688
+ });
689
+ }
690
+ getAgents() {
691
+ return __awaiter(this, void 0, void 0, function* () {
692
+ return this.request(urls.agents, 'GET');
693
+ });
694
+ }
695
+ getAgent(id) {
696
+ return __awaiter(this, void 0, void 0, function* () {
697
+ return this.request(`${urls.agents}/${id}`, 'GET');
698
+ });
699
+ }
700
+ updateAgent(id, name) {
701
+ return __awaiter(this, void 0, void 0, function* () {
702
+ const dto = { name };
703
+ return this.request(`${urls.agents}/${id}`, 'PATCH', dto);
704
+ });
705
+ }
706
+ deleteAgent(id) {
707
+ return __awaiter(this, void 0, void 0, function* () {
708
+ yield this.request(`${urls.agents}/${id}`, 'DELETE');
709
+ });
710
+ }
711
+ addAgentToOrganization(agentId, organizationId) {
712
+ return __awaiter(this, void 0, void 0, function* () {
713
+ yield this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'POST');
714
+ });
715
+ }
716
+ removeAgentFromOrganization(agentId, organizationId) {
717
+ return __awaiter(this, void 0, void 0, function* () {
718
+ yield this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'DELETE');
719
+ });
720
+ }
686
721
  }
@@ -31,6 +31,7 @@ export interface Organization {
31
31
  updatedAt: string;
32
32
  users?: User[];
33
33
  roles?: OrganizationRole[];
34
+ agents?: AgentOrganization[];
34
35
  }
35
36
  export interface User {
36
37
  id: string;
@@ -306,3 +307,23 @@ export interface UpdateSessionDto {
306
307
  sessionName?: string;
307
308
  primaryTranscriptionSummaryId?: string;
308
309
  }
310
+ export interface Agent {
311
+ id: string;
312
+ name: string;
313
+ createdAt: string;
314
+ updatedAt: string;
315
+ organizations?: AgentOrganization[];
316
+ }
317
+ export interface AgentOrganization {
318
+ agentId: string;
319
+ organizationId: string;
320
+ createdAt: string;
321
+ agent?: Agent;
322
+ organization?: Organization;
323
+ }
324
+ export interface CreateAgentDto {
325
+ name: string;
326
+ }
327
+ export interface UpdateAgentDto {
328
+ name?: string;
329
+ }
@@ -25,5 +25,6 @@ declare const urls: {
25
25
  roles: string;
26
26
  userRoles: string;
27
27
  sessions: string;
28
+ agents: string;
28
29
  };
29
30
  export default urls;
@@ -33,5 +33,7 @@ const urls = {
33
33
  userRoles: '/user-roles',
34
34
  // Sessions
35
35
  sessions: '/sessions',
36
+ // Agents
37
+ agents: '/agents',
36
38
  };
37
39
  export default urls;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whio-api-sdk",
3
- "version": "1.0.166",
3
+ "version": "1.0.168",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
package/src/sdk/sdk.ts CHANGED
@@ -37,6 +37,9 @@ import {
37
37
  Session,
38
38
  CreateSessionDto,
39
39
  UpdateSessionDto,
40
+ Agent,
41
+ CreateAgentDto,
42
+ UpdateAgentDto,
40
43
  } from './types';
41
44
  import urls from './urls';
42
45
  import { jwtDecode } from 'jwt-decode';
@@ -192,11 +195,7 @@ export class ApiSDK {
192
195
  }
193
196
 
194
197
  public async logout(): Promise<void> {
195
- try {
196
- await this.request('/auth/logout', 'POST');
197
- } finally {
198
- await this.clearAuth();
199
- }
198
+ await this.clearAuth();
200
199
  }
201
200
 
202
201
  private async clearAuth(): Promise<void> {
@@ -751,4 +750,38 @@ export class ApiSDK {
751
750
  return this.request<Session>(`${urls.sessions}/${sessionId}/primary-summary/${summaryId}`, 'PATCH');
752
751
  }
753
752
 
753
+ // ======================
754
+ // AGENT METHODS
755
+ // ======================
756
+
757
+ public async createAgent(name: string): Promise<Agent> {
758
+ const dto: CreateAgentDto = { name };
759
+ return this.request<Agent>(urls.agents, 'POST', dto);
760
+ }
761
+
762
+ public async getAgents(): Promise<Agent[]> {
763
+ return this.request<Agent[]>(urls.agents, 'GET');
764
+ }
765
+
766
+ public async getAgent(id: string): Promise<Agent> {
767
+ return this.request<Agent>(`${urls.agents}/${id}`, 'GET');
768
+ }
769
+
770
+ public async updateAgent(id: string, name: string): Promise<Agent> {
771
+ const dto: UpdateAgentDto = { name };
772
+ return this.request<Agent>(`${urls.agents}/${id}`, 'PATCH', dto);
773
+ }
774
+
775
+ public async deleteAgent(id: string): Promise<void> {
776
+ await this.request(`${urls.agents}/${id}`, 'DELETE');
777
+ }
778
+
779
+ public async addAgentToOrganization(agentId: string, organizationId: string): Promise<void> {
780
+ await this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'POST');
781
+ }
782
+
783
+ public async removeAgentFromOrganization(agentId: string, organizationId: string): Promise<void> {
784
+ await this.request(`${urls.agents}/${agentId}/organizations/${organizationId}`, 'DELETE');
785
+ }
786
+
754
787
  }
package/src/sdk/types.ts CHANGED
@@ -43,6 +43,7 @@ export interface Organization {
43
43
 
44
44
  users?: User[];
45
45
  roles?: OrganizationRole[];
46
+ agents?: AgentOrganization[];
46
47
  }
47
48
 
48
49
  // User type
@@ -387,3 +388,30 @@ export interface UpdateSessionDto {
387
388
  sessionName?: string;
388
389
  primaryTranscriptionSummaryId?: string;
389
390
  }
391
+
392
+ // Agent types
393
+ export interface Agent {
394
+ id: string;
395
+ name: string;
396
+ createdAt: string;
397
+ updatedAt: string;
398
+ organizations?: AgentOrganization[];
399
+ }
400
+
401
+ // Agent Organization association
402
+ export interface AgentOrganization {
403
+ agentId: string;
404
+ organizationId: string;
405
+ createdAt: string;
406
+ agent?: Agent;
407
+ organization?: Organization;
408
+ }
409
+
410
+ // Agent DTOs
411
+ export interface CreateAgentDto {
412
+ name: string;
413
+ }
414
+
415
+ export interface UpdateAgentDto {
416
+ name?: string;
417
+ }
package/src/sdk/urls.ts CHANGED
@@ -40,6 +40,9 @@ const urls = {
40
40
 
41
41
  // Sessions
42
42
  sessions: '/sessions',
43
+
44
+ // Agents
45
+ agents: '/agents',
43
46
  }
44
47
 
45
48
  export default urls;