retell-sdk 1.0.6 → 1.0.8

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
@@ -3,7 +3,7 @@ export default class Retell {
3
3
  private ip;
4
4
  constructor(apiKey: string, ip?: string);
5
5
  NewConversation: () => void;
6
- CreatAgent: (options: any) => Promise<void>;
6
+ CreatAgent: (options: any) => Promise<any>;
7
7
  ListAgent: (options: any) => Promise<void>;
8
8
  ListConversations: (options: any) => Promise<void>;
9
9
  }
package/dist/index.js CHANGED
@@ -41,6 +41,14 @@ class Retell {
41
41
  "agentId=OHRGI1IspUS3Q9SFjaZrcwbN3PwEbC2N", "echo-protocol");
42
42
  };
43
43
  this.CreatAgent = async (options) => {
44
+ if (!options || !options.voiceId) {
45
+ console.error("no voice id");
46
+ return;
47
+ }
48
+ else if (!options.prompt) {
49
+ console.error("no agent prompt");
50
+ return;
51
+ }
44
52
  let response = await axios({
45
53
  url: "http://" + this.ip + "/create-agent",
46
54
  method: "POST",
@@ -54,8 +62,13 @@ class Retell {
54
62
  },
55
63
  });
56
64
  console.log(response.data);
65
+ return response.data;
57
66
  };
58
67
  this.ListAgent = async (options) => {
68
+ if (!options || !options.agentId) {
69
+ console.error("no agentId");
70
+ return;
71
+ }
59
72
  let response = await axios({
60
73
  url: "http://" + this.ip + "/list-agents",
61
74
  method: "POST",
@@ -70,6 +83,10 @@ class Retell {
70
83
  console.log(response.data);
71
84
  };
72
85
  this.ListConversations = async (options) => {
86
+ if (!options || !options.agentId) {
87
+ console.error("no agentId");
88
+ return;
89
+ }
73
90
  let response = await axios({
74
91
  url: "http://" + this.ip + "/list-conversations",
75
92
  method: "POST",
package/index.ts CHANGED
@@ -53,6 +53,13 @@ export default class Retell {
53
53
  };
54
54
 
55
55
  CreatAgent = async (options: any) => {
56
+ if (!options || !options.voiceId) {
57
+ console.error("no voice id");
58
+ return;
59
+ } else if (!options.prompt) {
60
+ console.error("no agent prompt");
61
+ return;
62
+ }
56
63
  let response = await axios({
57
64
  url: "http://" + this.ip + "/create-agent",
58
65
  method: "POST",
@@ -66,9 +73,14 @@ export default class Retell {
66
73
  },
67
74
  });
68
75
  console.log(response.data);
76
+ return response.data;
69
77
  };
70
78
 
71
79
  ListAgent = async (options: any) => {
80
+ if (!options || !options.agentId) {
81
+ console.error("no agentId");
82
+ return;
83
+ }
72
84
  let response = await axios({
73
85
  url: "http://" + this.ip + "/list-agents",
74
86
  method: "POST",
@@ -84,6 +96,10 @@ export default class Retell {
84
96
  };
85
97
 
86
98
  ListConversations = async (options: any) => {
99
+ if (!options || !options.agentId) {
100
+ console.error("no agentId");
101
+ return;
102
+ }
87
103
  let response = await axios({
88
104
  url: "http://" + this.ip + "/list-conversations",
89
105
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "retell-sdk",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "retell sdk",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {