retell-sdk 1.0.7 → 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 +1 -2
- package/dist/index.js +17 -5
- package/index.ts +16 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
export declare function hello(): void;
|
|
2
1
|
export default class Retell {
|
|
3
2
|
private apiKey;
|
|
4
3
|
private ip;
|
|
5
4
|
constructor(apiKey: string, ip?: string);
|
|
6
5
|
NewConversation: () => void;
|
|
7
|
-
CreatAgent: (options: any) => Promise<
|
|
6
|
+
CreatAgent: (options: any) => Promise<any>;
|
|
8
7
|
ListAgent: (options: any) => Promise<void>;
|
|
9
8
|
ListConversations: (options: any) => Promise<void>;
|
|
10
9
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hello = void 0;
|
|
4
3
|
var WebSocketClient = require("websocket").client;
|
|
5
4
|
const axios = require("axios");
|
|
6
|
-
function hello() {
|
|
7
|
-
console.log("hello");
|
|
8
|
-
}
|
|
9
|
-
exports.hello = hello;
|
|
10
5
|
class Retell {
|
|
11
6
|
constructor(apiKey, ip) {
|
|
12
7
|
this.NewConversation = () => {
|
|
@@ -46,6 +41,14 @@ class Retell {
|
|
|
46
41
|
"agentId=OHRGI1IspUS3Q9SFjaZrcwbN3PwEbC2N", "echo-protocol");
|
|
47
42
|
};
|
|
48
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
|
+
}
|
|
49
52
|
let response = await axios({
|
|
50
53
|
url: "http://" + this.ip + "/create-agent",
|
|
51
54
|
method: "POST",
|
|
@@ -59,8 +62,13 @@ class Retell {
|
|
|
59
62
|
},
|
|
60
63
|
});
|
|
61
64
|
console.log(response.data);
|
|
65
|
+
return response.data;
|
|
62
66
|
};
|
|
63
67
|
this.ListAgent = async (options) => {
|
|
68
|
+
if (!options || !options.agentId) {
|
|
69
|
+
console.error("no agentId");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
64
72
|
let response = await axios({
|
|
65
73
|
url: "http://" + this.ip + "/list-agents",
|
|
66
74
|
method: "POST",
|
|
@@ -75,6 +83,10 @@ class Retell {
|
|
|
75
83
|
console.log(response.data);
|
|
76
84
|
};
|
|
77
85
|
this.ListConversations = async (options) => {
|
|
86
|
+
if (!options || !options.agentId) {
|
|
87
|
+
console.error("no agentId");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
78
90
|
let response = await axios({
|
|
79
91
|
url: "http://" + this.ip + "/list-conversations",
|
|
80
92
|
method: "POST",
|
package/index.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
var WebSocketClient = require("websocket").client;
|
|
2
2
|
const axios = require("axios");
|
|
3
3
|
|
|
4
|
-
export function hello() {
|
|
5
|
-
console.log("hello");
|
|
6
|
-
}
|
|
7
|
-
|
|
8
4
|
export default class Retell {
|
|
9
5
|
private apiKey: string;
|
|
10
6
|
private ip: string;
|
|
@@ -57,6 +53,13 @@ export default class Retell {
|
|
|
57
53
|
};
|
|
58
54
|
|
|
59
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
|
+
}
|
|
60
63
|
let response = await axios({
|
|
61
64
|
url: "http://" + this.ip + "/create-agent",
|
|
62
65
|
method: "POST",
|
|
@@ -70,9 +73,14 @@ export default class Retell {
|
|
|
70
73
|
},
|
|
71
74
|
});
|
|
72
75
|
console.log(response.data);
|
|
76
|
+
return response.data;
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
ListAgent = async (options: any) => {
|
|
80
|
+
if (!options || !options.agentId) {
|
|
81
|
+
console.error("no agentId");
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
76
84
|
let response = await axios({
|
|
77
85
|
url: "http://" + this.ip + "/list-agents",
|
|
78
86
|
method: "POST",
|
|
@@ -88,6 +96,10 @@ export default class Retell {
|
|
|
88
96
|
};
|
|
89
97
|
|
|
90
98
|
ListConversations = async (options: any) => {
|
|
99
|
+
if (!options || !options.agentId) {
|
|
100
|
+
console.error("no agentId");
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
91
103
|
let response = await axios({
|
|
92
104
|
url: "http://" + this.ip + "/list-conversations",
|
|
93
105
|
method: "POST",
|