@equos/node-sdk 1.2.1 → 2.0.0

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/README.md CHANGED
@@ -37,13 +37,12 @@ const data: CreateEquosAvatarRequest = {
37
37
  // Create an avatar.
38
38
  const avatar: EquosAvatar = await client.avatars.create(data);
39
39
 
40
+ console.log(avatar);
40
41
  ```
41
42
 
42
43
  ### Create Agent
43
44
 
44
45
  ```ts
45
- console.log(avatar);
46
-
47
46
  import {
48
47
  EquosAgent,
49
48
  CreateEquosAgentRequest,
@@ -63,6 +62,7 @@ const data: CreateEquosAgentRequest = {
63
62
  }
64
63
 
65
64
  const agent: EquosAgent = await client.agents.create(data);
65
+ console.log(agent);
66
66
  ```
67
67
 
68
68
 
@@ -1,9 +1,11 @@
1
1
  import { HttpUtils } from '../utils/http.utils';
2
- import { CreateEquosAgentRequest, EquosAgent, ListEquosAgentsResponse } from '../types/agent.type';
2
+ import { CreateEquosAgentRequest, EquosAgent, ListEquosAgentsResponse, UpdateEquosAgentRequest } from '../types/agent.type';
3
3
  export declare class EquosAgentApi {
4
4
  private readonly http;
5
5
  constructor(http: HttpUtils);
6
6
  create(data: CreateEquosAgentRequest): Promise<EquosAgent>;
7
7
  list(skip?: number, take?: number, client?: string): Promise<ListEquosAgentsResponse>;
8
8
  get(agentId: string): Promise<EquosAgent | null>;
9
+ delete(agentId: string): Promise<EquosAgent | null>;
10
+ update(agentId: string, data: UpdateEquosAgentRequest): Promise<EquosAgent>;
9
11
  }
@@ -26,5 +26,15 @@ class EquosAgentApi {
26
26
  .get(`/agents/${agentId}`)
27
27
  .catch(error_utils_1.ErrorUtils.convertToEquosError);
28
28
  }
29
+ async delete(agentId) {
30
+ return this.http
31
+ .delete(`/agents/${agentId}`)
32
+ .catch(error_utils_1.ErrorUtils.convertToEquosError);
33
+ }
34
+ async update(agentId, data) {
35
+ return this.http
36
+ .put(`/agents/${agentId}`, data)
37
+ .catch(error_utils_1.ErrorUtils.convertToEquosError);
38
+ }
29
39
  }
30
40
  exports.EquosAgentApi = EquosAgentApi;
@@ -1,9 +1,11 @@
1
1
  import { HttpUtils } from '../utils/http.utils';
2
- import { CreateEquosAvatarRequest, EquosAvatar, ListEquosAvatarsResponse } from '../types/avatar.type';
2
+ import { CreateEquosAvatarRequest, EquosAvatar, ListEquosAvatarsResponse, UpdateEquosAvatarRequest } from '../types/avatar.type';
3
3
  export declare class EquosAvatarApi {
4
4
  private readonly http;
5
5
  constructor(http: HttpUtils);
6
6
  create(data: CreateEquosAvatarRequest): Promise<EquosAvatar>;
7
7
  list(skip?: number, take?: number, client?: string): Promise<ListEquosAvatarsResponse>;
8
8
  get(avatarId: string): Promise<EquosAvatar | null>;
9
+ delete(agentId: string): Promise<EquosAvatar | null>;
10
+ update(agentId: string, data: UpdateEquosAvatarRequest): Promise<EquosAvatar>;
9
11
  }
@@ -26,5 +26,15 @@ class EquosAvatarApi {
26
26
  .get(`/avatars/${avatarId}`)
27
27
  .catch(error_utils_1.ErrorUtils.convertToEquosError);
28
28
  }
29
+ async delete(agentId) {
30
+ return this.http
31
+ .delete(`/avatars/${agentId}`)
32
+ .catch(error_utils_1.ErrorUtils.convertToEquosError);
33
+ }
34
+ async update(agentId, data) {
35
+ return this.http
36
+ .put(`/avatars/${agentId}`, data)
37
+ .catch(error_utils_1.ErrorUtils.convertToEquosError);
38
+ }
29
39
  }
30
40
  exports.EquosAvatarApi = EquosAvatarApi;
@@ -34,26 +34,29 @@ export declare enum AgentProvider {
34
34
  elevenlabs = "elevenlabs"
35
35
  }
36
36
  export interface OpenaiAgentConfig {
37
+ instructions: string;
37
38
  model: OpenaiRealtimeModels;
38
39
  voice: OpenaiRealtimeVoices;
39
40
  }
40
41
  export interface GeminiAgentConfig {
42
+ instructions: string;
41
43
  model: GoogleRealtimeModels;
42
44
  voice: GoogleRealtimeVoices;
43
45
  }
46
+ export interface ElevenlabsAgentConfig {
47
+ elevenlabsAgentId: string;
48
+ }
44
49
  export interface CreateEquosAgentRequest {
45
- instructions: string;
46
50
  provider: AgentProvider;
47
51
  client?: string | null;
48
- config: OpenaiAgentConfig | GeminiAgentConfig;
52
+ config: OpenaiAgentConfig | GeminiAgentConfig | ElevenlabsAgentConfig;
49
53
  }
50
54
  export interface EquosAgent {
51
55
  id: string;
52
56
  organizationId: string;
53
- instructions: string;
54
57
  provider: AgentProvider;
55
58
  client?: string;
56
- config: OpenaiAgentConfig | GeminiAgentConfig;
59
+ config: OpenaiAgentConfig | GeminiAgentConfig | ElevenlabsAgentConfig;
57
60
  createdAt: Date;
58
61
  updatedAt: Date;
59
62
  }
@@ -63,3 +66,7 @@ export interface ListEquosAgentsResponse {
63
66
  total: number;
64
67
  agents: EquosAgent[];
65
68
  }
69
+ export interface UpdateEquosAgentRequest extends CreateEquosAgentRequest {
70
+ id: string;
71
+ organizationId: string;
72
+ }
@@ -1,11 +1,8 @@
1
- import { CreateEquosAgentRequest, EquosAgent } from './agent.type';
2
1
  export interface CreateEquosAvatarRequest {
3
2
  identity: string;
4
3
  name: string;
5
4
  refImage: string;
6
5
  client?: string | null;
7
- agentId?: string;
8
- agent?: CreateEquosAgentRequest;
9
6
  }
10
7
  export interface EquosAvatar {
11
8
  id: string;
@@ -16,8 +13,6 @@ export interface EquosAvatar {
16
13
  thumbnailUrl: string;
17
14
  createdAt: Date;
18
15
  updatedAt: Date;
19
- agentId?: string;
20
- agent?: EquosAgent;
21
16
  }
22
17
  export interface ListEquosAvatarsResponse {
23
18
  skip: number;
@@ -25,3 +20,7 @@ export interface ListEquosAvatarsResponse {
25
20
  total: number;
26
21
  avatars: EquosAvatar[];
27
22
  }
23
+ export interface UpdateEquosAvatarRequest extends CreateEquosAvatarRequest {
24
+ id: string;
25
+ organizationId: string;
26
+ }
@@ -7,4 +7,6 @@ export declare class HttpUtils {
7
7
  get<T>(path: string): Promise<T>;
8
8
  post<T, U>(path: string, data: T): Promise<U>;
9
9
  patch<T, U>(path: string, data: T): Promise<U>;
10
+ put<T, U>(path: string, data: T): Promise<U>;
11
+ delete<U>(path: string): Promise<U>;
10
12
  }
@@ -92,5 +92,35 @@ class HttpUtils {
92
92
  throw e;
93
93
  });
94
94
  }
95
+ async put(path, data) {
96
+ return axios_1.default
97
+ .put(this.getPath(path), data, {
98
+ headers: {
99
+ 'x-api-key': this.apiKey,
100
+ },
101
+ })
102
+ .then((response) => response.data)
103
+ .catch((e) => {
104
+ if (e instanceof axios_1.AxiosError) {
105
+ throw e.response?.data || { message: e?.message, code: e?.code };
106
+ }
107
+ throw e;
108
+ });
109
+ }
110
+ async delete(path) {
111
+ return axios_1.default
112
+ .delete(this.getPath(path), {
113
+ headers: {
114
+ 'x-api-key': this.apiKey,
115
+ },
116
+ })
117
+ .then((response) => response.data)
118
+ .catch((e) => {
119
+ if (e instanceof axios_1.AxiosError) {
120
+ throw e.response?.data || { message: e?.message, code: e?.code };
121
+ }
122
+ throw e;
123
+ });
124
+ }
95
125
  }
96
126
  exports.HttpUtils = HttpUtils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equos/node-sdk",
3
- "version": "1.2.1",
3
+ "version": "2.0.0",
4
4
  "description": "Equos.ai node.js official SDK.",
5
5
  "keywords": [
6
6
  "ai",