retell-sdk 2.2.1 → 2.2.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.
Files changed (71) hide show
  1. package/README.md +3 -433
  2. package/example.d.ts +2 -0
  3. package/example.d.ts.map +1 -0
  4. package/example.js +96 -0
  5. package/example.js.map +1 -0
  6. package/models/components/agent.d.ts +193 -24
  7. package/models/components/agent.d.ts.map +1 -1
  8. package/models/components/agent.js +189 -27
  9. package/models/components/agent.js.map +1 -1
  10. package/models/components/index.d.ts +0 -1
  11. package/models/components/index.d.ts.map +1 -1
  12. package/models/components/index.js +0 -1
  13. package/models/components/index.js.map +1 -1
  14. package/models/operations/createagent.d.ts +14 -34
  15. package/models/operations/createagent.d.ts.map +1 -1
  16. package/models/operations/createagent.js +12 -32
  17. package/models/operations/createagent.js.map +1 -1
  18. package/models/operations/createphonecall.d.ts +12 -6
  19. package/models/operations/createphonecall.d.ts.map +1 -1
  20. package/models/operations/createphonecall.js +8 -8
  21. package/models/operations/createphonecall.js.map +1 -1
  22. package/models/operations/createphonenumber.d.ts +1 -1
  23. package/models/operations/createwebcall.d.ts +16 -0
  24. package/models/operations/createwebcall.d.ts.map +1 -0
  25. package/models/operations/createwebcall.js +3 -0
  26. package/models/operations/createwebcall.js.map +1 -0
  27. package/models/operations/index.d.ts +1 -0
  28. package/models/operations/index.d.ts.map +1 -1
  29. package/models/operations/index.js +1 -0
  30. package/models/operations/index.js.map +1 -1
  31. package/models/operations/listagents.d.ts +3 -3
  32. package/models/operations/listagents.d.ts.map +1 -1
  33. package/models/operations/listagents.js +4 -4
  34. package/models/operations/listagents.js.map +1 -1
  35. package/models/operations/listcalls.d.ts +3 -3
  36. package/models/operations/listcalls.d.ts.map +1 -1
  37. package/models/operations/listcalls.js +4 -4
  38. package/models/operations/listcalls.js.map +1 -1
  39. package/models/operations/listphonenumbers.d.ts +3 -3
  40. package/models/operations/listphonenumbers.d.ts.map +1 -1
  41. package/models/operations/listphonenumbers.js +4 -4
  42. package/models/operations/listphonenumbers.js.map +1 -1
  43. package/models/operations/updateagent.d.ts +42 -3
  44. package/models/operations/updateagent.d.ts.map +1 -1
  45. package/models/operations/updateagent.js +43 -5
  46. package/models/operations/updateagent.js.map +1 -1
  47. package/package.json +1 -1
  48. package/sdk/liveClient.d.ts +2 -4
  49. package/sdk/liveClient.d.ts.map +1 -1
  50. package/sdk/liveClient.js +9 -5
  51. package/sdk/liveClient.js.map +1 -1
  52. package/sdk/sdk.d.ts +2 -6
  53. package/sdk/sdk.d.ts.map +1 -1
  54. package/sdk/sdk.js +10 -10
  55. package/sdk/sdk.js.map +1 -1
  56. package/src/example.ts +102 -0
  57. package/src/models/components/agent.ts +382 -52
  58. package/src/models/components/index.ts +0 -1
  59. package/src/models/operations/createagent.ts +30 -66
  60. package/src/models/operations/createphonecall.ts +20 -14
  61. package/src/models/operations/createphonenumber.ts +1 -1
  62. package/src/models/operations/createwebcall.ts +16 -0
  63. package/src/models/operations/index.ts +1 -0
  64. package/src/models/operations/listagents.ts +7 -7
  65. package/src/models/operations/listcalls.ts +7 -7
  66. package/src/models/operations/listphonenumbers.ts +7 -7
  67. package/src/models/operations/updateagent.ts +87 -7
  68. package/src/sdk/liveClient.ts +11 -8
  69. package/src/sdk/sdk.ts +10 -17
  70. package/docs/sdks/retellclient/README.md +0 -713
  71. package/src/models/components/agentnodefaultnorequired.ts +0 -121
@@ -12,7 +12,7 @@ export type PhoneNumber = {
12
12
  /**
13
13
  * Phone number you purchased in E.164 format. It would have an agent id associated with it.
14
14
  */
15
- from?: any | undefined;
15
+ from: string;
16
16
  /**
17
17
  * Callee phone number in E.164 format.
18
18
  */
@@ -21,9 +21,12 @@ export type PhoneNumber = {
21
21
 
22
22
  export type CreatePhoneCallRequestBody = {
23
23
  /**
24
- * Supply values to your agent prompt parameters. If the given key value cannot match any param in prompt, it would have have any effect. Learn more about [Agent Prompt Parameters](/features/agent-prompt-parameter).
24
+ * Supply values to your agent prompt parameters. If the given key value cannot match any param in prompt, it would have have any effect.
25
25
  */
26
26
  agentPromptParams?: Array<components.AgentPromptParams> | undefined;
27
+ /**
28
+ * Phone number associated with the call.
29
+ */
27
30
  phoneNumber: PhoneNumber;
28
31
  };
29
32
 
@@ -69,6 +72,9 @@ export type CreatePhoneCallResponseBody = {
69
72
  * Web call or phone call.
70
73
  */
71
74
  callType: CreatePhoneCallCallType;
75
+ /**
76
+ * Phone number associated with the call.
77
+ */
72
78
  phoneNumber: components.CallPhoneNumber;
73
79
  /**
74
80
  * Begin timestamp (milliseconds since epoch) of the call.
@@ -98,35 +104,35 @@ export type CreatePhoneCallResponse = {
98
104
  /** @internal */
99
105
  export namespace PhoneNumber$ {
100
106
  export type Inbound = {
101
- from?: any | undefined;
107
+ from: string;
102
108
  to: string;
103
109
  };
104
110
 
105
111
  export const inboundSchema: z.ZodType<PhoneNumber, z.ZodTypeDef, Inbound> = z
106
112
  .object({
107
- from: z.any().optional(),
113
+ from: z.string(),
108
114
  to: z.string(),
109
115
  })
110
116
  .transform((v) => {
111
117
  return {
112
- ...(v.from === undefined ? null : { from: v.from }),
118
+ from: v.from,
113
119
  to: v.to,
114
120
  };
115
121
  });
116
122
 
117
123
  export type Outbound = {
118
- from?: any | undefined;
124
+ from: string;
119
125
  to: string;
120
126
  };
121
127
 
122
128
  export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, PhoneNumber> = z
123
129
  .object({
124
- from: z.any().optional(),
130
+ from: z.string(),
125
131
  to: z.string(),
126
132
  })
127
133
  .transform((v) => {
128
134
  return {
129
- ...(v.from === undefined ? null : { from: v.from }),
135
+ from: v.from,
130
136
  to: v.to,
131
137
  };
132
138
  });
@@ -256,7 +262,7 @@ export namespace CreatePhoneCallResponse$ {
256
262
  ContentType: string;
257
263
  StatusCode: number;
258
264
  RawResponse: Response;
259
- object?: CreatePhoneCallResponseBody$.Inbound | undefined;
265
+ callDetail?: CreatePhoneCallResponseBody$.Inbound | undefined;
260
266
  };
261
267
 
262
268
  export const inboundSchema: z.ZodType<CreatePhoneCallResponse, z.ZodTypeDef, Inbound> = z
@@ -264,14 +270,14 @@ export namespace CreatePhoneCallResponse$ {
264
270
  ContentType: z.string(),
265
271
  StatusCode: z.number().int(),
266
272
  RawResponse: z.instanceof(Response),
267
- object: z.lazy(() => CreatePhoneCallResponseBody$.inboundSchema).optional(),
273
+ callDetail: z.lazy(() => CreatePhoneCallResponseBody$.inboundSchema).optional(),
268
274
  })
269
275
  .transform((v) => {
270
276
  return {
271
277
  contentType: v.ContentType,
272
278
  statusCode: v.StatusCode,
273
279
  rawResponse: v.RawResponse,
274
- ...(v.object === undefined ? null : { object: v.object }),
280
+ ...(v.callDetail === undefined ? null : { callDetail: v.callDetail }),
275
281
  };
276
282
  });
277
283
 
@@ -279,7 +285,7 @@ export namespace CreatePhoneCallResponse$ {
279
285
  ContentType: string;
280
286
  StatusCode: number;
281
287
  RawResponse: never;
282
- object?: CreatePhoneCallResponseBody$.Outbound | undefined;
288
+ callDetail?: CreatePhoneCallResponseBody$.Outbound | undefined;
283
289
  };
284
290
 
285
291
  export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, CreatePhoneCallResponse> = z
@@ -289,14 +295,14 @@ export namespace CreatePhoneCallResponse$ {
289
295
  rawResponse: z.instanceof(Response).transform(() => {
290
296
  throw new Error("Response cannot be serialized");
291
297
  }),
292
- object: z.lazy(() => CreatePhoneCallResponseBody$.outboundSchema).optional(),
298
+ callDetail: z.lazy(() => CreatePhoneCallResponseBody$.outboundSchema).optional(),
293
299
  })
294
300
  .transform((v) => {
295
301
  return {
296
302
  ContentType: v.contentType,
297
303
  StatusCode: v.statusCode,
298
304
  RawResponse: v.rawResponse,
299
- ...(v.object === undefined ? null : { object: v.object }),
305
+ ...(v.callDetail === undefined ? null : { callDetail: v.callDetail }),
300
306
  };
301
307
  });
302
308
  }
@@ -7,7 +7,7 @@ import { z } from "zod";
7
7
 
8
8
  export type CreatePhoneNumberRequestBody = {
9
9
  /**
10
- * Unique agent id to associate with this phone number. Can be updated with [Update Phone Agent](/api/update-phone-agent).
10
+ * Unique agent id to associate with this phone number. Can be updated.
11
11
  */
12
12
  agentId: string;
13
13
  /**
@@ -0,0 +1,16 @@
1
+ import * as components from "../../models/components";
2
+
3
+ export type CreateWebCallRequestBody = {
4
+ /**
5
+ * Unique agent id to associate with this phone number. Can be updated.
6
+ */
7
+ agentId: string;
8
+ /**
9
+ * Supply values to your agent prompt parameters. If the given key value cannot match any param in prompt, it would have have any effect.
10
+ */
11
+ agentPromptParams?: Array<components.AgentPromptParams> | undefined;
12
+ /**
13
+ * Sample rate for the call.
14
+ */
15
+ sampleRate?: number | undefined;
16
+ };
@@ -4,6 +4,7 @@
4
4
 
5
5
  export * from "./createagent";
6
6
  export * from "./createphonecall";
7
+ export * from "./createwebcall";
7
8
  export * from "./createphonenumber";
8
9
  export * from "./deleteagent";
9
10
  export * from "./deletephonenumber";
@@ -21,7 +21,7 @@ export type ListAgentsResponse = {
21
21
  /**
22
22
  * Successfully retrieved all agents.
23
23
  */
24
- classes?: Array<components.Agent> | undefined;
24
+ agents?: Array<components.Agent> | undefined;
25
25
  };
26
26
 
27
27
  /** @internal */
@@ -30,7 +30,7 @@ export namespace ListAgentsResponse$ {
30
30
  ContentType: string;
31
31
  StatusCode: number;
32
32
  RawResponse: Response;
33
- classes?: Array<components.Agent$.Inbound> | undefined;
33
+ agents?: Array<components.Agent$.Inbound> | undefined;
34
34
  };
35
35
 
36
36
  export const inboundSchema: z.ZodType<ListAgentsResponse, z.ZodTypeDef, Inbound> = z
@@ -38,14 +38,14 @@ export namespace ListAgentsResponse$ {
38
38
  ContentType: z.string(),
39
39
  StatusCode: z.number().int(),
40
40
  RawResponse: z.instanceof(Response),
41
- classes: z.array(components.Agent$.inboundSchema).optional(),
41
+ agents: z.array(components.Agent$.inboundSchema).optional(),
42
42
  })
43
43
  .transform((v) => {
44
44
  return {
45
45
  contentType: v.ContentType,
46
46
  statusCode: v.StatusCode,
47
47
  rawResponse: v.RawResponse,
48
- ...(v.classes === undefined ? null : { classes: v.classes }),
48
+ ...(v.agents === undefined ? null : { agents: v.agents }),
49
49
  };
50
50
  });
51
51
 
@@ -53,7 +53,7 @@ export namespace ListAgentsResponse$ {
53
53
  ContentType: string;
54
54
  StatusCode: number;
55
55
  RawResponse: never;
56
- classes?: Array<components.Agent$.Outbound> | undefined;
56
+ agents?: Array<components.Agent$.Outbound> | undefined;
57
57
  };
58
58
 
59
59
  export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, ListAgentsResponse> = z
@@ -63,14 +63,14 @@ export namespace ListAgentsResponse$ {
63
63
  rawResponse: z.instanceof(Response).transform(() => {
64
64
  throw new Error("Response cannot be serialized");
65
65
  }),
66
- classes: z.array(components.Agent$.outboundSchema).optional(),
66
+ agents: z.array(components.Agent$.outboundSchema).optional(),
67
67
  })
68
68
  .transform((v) => {
69
69
  return {
70
70
  ContentType: v.contentType,
71
71
  StatusCode: v.statusCode,
72
72
  RawResponse: v.rawResponse,
73
- ...(v.classes === undefined ? null : { classes: v.classes }),
73
+ ...(v.agents === undefined ? null : { agents: v.agents }),
74
74
  };
75
75
  });
76
76
  }
@@ -74,7 +74,7 @@ export type ListCallsResponse = {
74
74
  /**
75
75
  * Successfully retrieved all agents.
76
76
  */
77
- classes?: Array<components.CallDetail> | undefined;
77
+ calls?: Array<components.CallDetail> | undefined;
78
78
  };
79
79
 
80
80
  /** @internal */
@@ -209,7 +209,7 @@ export namespace ListCallsResponse$ {
209
209
  ContentType: string;
210
210
  StatusCode: number;
211
211
  RawResponse: Response;
212
- classes?: Array<components.CallDetail$.Inbound> | undefined;
212
+ calls?: Array<components.CallDetail$.Inbound> | undefined;
213
213
  };
214
214
 
215
215
  export const inboundSchema: z.ZodType<ListCallsResponse, z.ZodTypeDef, Inbound> = z
@@ -217,14 +217,14 @@ export namespace ListCallsResponse$ {
217
217
  ContentType: z.string(),
218
218
  StatusCode: z.number().int(),
219
219
  RawResponse: z.instanceof(Response),
220
- classes: z.array(components.CallDetail$.inboundSchema).optional(),
220
+ calls: z.array(components.CallDetail$.inboundSchema).optional(),
221
221
  })
222
222
  .transform((v) => {
223
223
  return {
224
224
  contentType: v.ContentType,
225
225
  statusCode: v.StatusCode,
226
226
  rawResponse: v.RawResponse,
227
- ...(v.classes === undefined ? null : { classes: v.classes }),
227
+ ...(v.calls === undefined ? null : { calls: v.calls }),
228
228
  };
229
229
  });
230
230
 
@@ -232,7 +232,7 @@ export namespace ListCallsResponse$ {
232
232
  ContentType: string;
233
233
  StatusCode: number;
234
234
  RawResponse: never;
235
- classes?: Array<components.CallDetail$.Outbound> | undefined;
235
+ calls?: Array<components.CallDetail$.Outbound> | undefined;
236
236
  };
237
237
 
238
238
  export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, ListCallsResponse> = z
@@ -242,14 +242,14 @@ export namespace ListCallsResponse$ {
242
242
  rawResponse: z.instanceof(Response).transform(() => {
243
243
  throw new Error("Response cannot be serialized");
244
244
  }),
245
- classes: z.array(components.CallDetail$.outboundSchema).optional(),
245
+ calls: z.array(components.CallDetail$.outboundSchema).optional(),
246
246
  })
247
247
  .transform((v) => {
248
248
  return {
249
249
  ContentType: v.contentType,
250
250
  StatusCode: v.statusCode,
251
251
  RawResponse: v.rawResponse,
252
- ...(v.classes === undefined ? null : { classes: v.classes }),
252
+ ...(v.calls === undefined ? null : { calls: v.calls }),
253
253
  };
254
254
  });
255
255
  }
@@ -21,7 +21,7 @@ export type ListPhoneNumbersResponse = {
21
21
  /**
22
22
  * Successfully retrieved all phone number objects.
23
23
  */
24
- classes?: Array<components.PhoneNumber> | undefined;
24
+ phoneNumbers?: Array<components.PhoneNumber> | undefined;
25
25
  };
26
26
 
27
27
  /** @internal */
@@ -30,7 +30,7 @@ export namespace ListPhoneNumbersResponse$ {
30
30
  ContentType: string;
31
31
  StatusCode: number;
32
32
  RawResponse: Response;
33
- classes?: Array<components.PhoneNumber$.Inbound> | undefined;
33
+ phoneNumbers?: Array<components.PhoneNumber$.Inbound> | undefined;
34
34
  };
35
35
 
36
36
  export const inboundSchema: z.ZodType<ListPhoneNumbersResponse, z.ZodTypeDef, Inbound> = z
@@ -38,14 +38,14 @@ export namespace ListPhoneNumbersResponse$ {
38
38
  ContentType: z.string(),
39
39
  StatusCode: z.number().int(),
40
40
  RawResponse: z.instanceof(Response),
41
- classes: z.array(components.PhoneNumber$.inboundSchema).optional(),
41
+ phoneNumbers: z.array(components.PhoneNumber$.inboundSchema).optional(),
42
42
  })
43
43
  .transform((v) => {
44
44
  return {
45
45
  contentType: v.ContentType,
46
46
  statusCode: v.StatusCode,
47
47
  rawResponse: v.RawResponse,
48
- ...(v.classes === undefined ? null : { classes: v.classes }),
48
+ ...(v.phoneNumbers === undefined ? null : { phoneNumbers: v.phoneNumbers }),
49
49
  };
50
50
  });
51
51
 
@@ -53,7 +53,7 @@ export namespace ListPhoneNumbersResponse$ {
53
53
  ContentType: string;
54
54
  StatusCode: number;
55
55
  RawResponse: never;
56
- classes?: Array<components.PhoneNumber$.Outbound> | undefined;
56
+ phoneNumbers?: Array<components.PhoneNumber$.Outbound> | undefined;
57
57
  };
58
58
 
59
59
  export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, ListPhoneNumbersResponse> = z
@@ -63,14 +63,14 @@ export namespace ListPhoneNumbersResponse$ {
63
63
  rawResponse: z.instanceof(Response).transform(() => {
64
64
  throw new Error("Response cannot be serialized");
65
65
  }),
66
- classes: z.array(components.PhoneNumber$.outboundSchema).optional(),
66
+ phoneNumbers: z.array(components.PhoneNumber$.outboundSchema).optional(),
67
67
  })
68
68
  .transform((v) => {
69
69
  return {
70
70
  ContentType: v.contentType,
71
71
  StatusCode: v.statusCode,
72
72
  RawResponse: v.rawResponse,
73
- ...(v.classes === undefined ? null : { classes: v.classes }),
73
+ ...(v.phoneNumbers === undefined ? null : { phoneNumbers: v.phoneNumbers }),
74
74
  };
75
75
  });
76
76
  }
@@ -3,10 +3,90 @@
3
3
  */
4
4
 
5
5
  import * as components from "../../models/components";
6
+ import { Function } from "../../models/components";
6
7
  import { z } from "zod";
7
8
 
9
+ export type UpdateAgentRequestBody = {
10
+ /**
11
+ * The name of the agent. Only used for your own reference.
12
+ */
13
+ agentName?: string | undefined;
14
+ /*
15
+ * Determines how to generate the response in the call. Currently supports using our in-house LLM response system or your own custom
16
+ * response generation system.
17
+ */
18
+ llmSetting?: components.RetellLlmSetting | components.CustomLlmSetting | undefined;
19
+ /**
20
+ * Setting combination that controls interaction flow, like begin and end logic.
21
+ */
22
+ interactionSetting?: components.InteractionSettingRequest | undefined;
23
+ /**
24
+ * Unique voice id used for the agent. Find list of available voices in documentation.
25
+ */
26
+ voiceId?: string | undefined;
27
+ /**
28
+ * Functions are the actions that the agent can perform, like booking appointments, retriving information, etc. By setting this field, either OpenAI's function calling feature or your own custom LLM's logic would determine when the function shall get called, and our server would make the call.
29
+ */
30
+ functions?: Function[] | undefined;
31
+ };
32
+
33
+ /** @internal */
34
+ export namespace UpdateAgentRequestBody$ {
35
+ export type Inbound = {
36
+ agent_name?: string | undefined;
37
+ llm_setting?: components.RetellLlmSetting$.Inbound | components.CustomLlmSetting$.Inbound | undefined;
38
+ interaction_setting?: components.InteractionSettingRequest$.Inbound | undefined;
39
+ voice_id?: string | undefined;
40
+ functions?: Function[] | undefined;
41
+ };
42
+
43
+ export const inboundSchema: z.ZodType<UpdateAgentRequestBody, z.ZodTypeDef, Inbound> = z
44
+ .object({
45
+ agent_name: z.string().optional(),
46
+ llm_setting: z.union([components.RetellLlmSetting$.inboundSchema, components.CustomLlmSetting$.inboundSchema]).optional(),
47
+ interaction_setting: components.InteractionSettingRequest$.inboundSchema.optional(),
48
+ voice_id: z.string().optional(),
49
+ functions: z.array(components.Function$.inboundSchema).optional(),
50
+ })
51
+ .transform((v) => {
52
+ return {
53
+ ...(v.agent_name === undefined ? null : { agentName: v.agent_name }),
54
+ ...(v.llm_setting === undefined ? null : { llmSetting: v.llm_setting }),
55
+ ...(v.interaction_setting === undefined ? null : { interactionSetting: v.interaction_setting }),
56
+ ...(v.voice_id === undefined ? null : { voiceId: v.voice_id }),
57
+ ...(v.functions === undefined ? null : { functions: v.functions }),
58
+ };
59
+ });
60
+
61
+ export type Outbound = {
62
+ agent_name?: string | undefined;
63
+ llm_setting?: components.RetellLlmSetting$.Outbound | components.CustomLlmSetting$.Outbound | undefined;
64
+ interaction_setting?: components.InteractionSettingRequest$.Outbound | undefined;
65
+ voice_id?: string | undefined;
66
+ functions?: Function[] | undefined;
67
+ };
68
+
69
+ export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, UpdateAgentRequestBody> = z
70
+ .object({
71
+ agentName: z.string().optional(),
72
+ llmSetting: z.union([components.RetellLlmSetting$.outboundSchema, components.CustomLlmSetting$.outboundSchema]).optional(),
73
+ interactionSetting: components.InteractionSettingRequest$.outboundSchema.optional(),
74
+ voiceId: z.string().optional(),
75
+ functions: z.array(components.Function$.inboundSchema).optional(),
76
+ })
77
+ .transform((v) => {
78
+ return {
79
+ ...(v.agentName === undefined ? null : { agent_name: v.agentName }),
80
+ ...(v.llmSetting === undefined ? null : { llm_setting: v.llmSetting }),
81
+ ...(v.interactionSetting === undefined ? null : { interaction_setting: v.interactionSetting }),
82
+ ...(v.voiceId === undefined ? null : { voice_id: v.voiceId }),
83
+ ...(v.functions === undefined ? null : { functions: v.functions }),
84
+ };
85
+ });
86
+ }
87
+
8
88
  export type UpdateAgentRequest = {
9
- agentNoDefaultNoRequired: components.AgentNoDefaultNoRequired;
89
+ requestBody: UpdateAgentRequestBody;
10
90
  /**
11
91
  * Unique id of the agent to be updated.
12
92
  */
@@ -35,35 +115,35 @@ export type UpdateAgentResponse = {
35
115
  /** @internal */
36
116
  export namespace UpdateAgentRequest$ {
37
117
  export type Inbound = {
38
- AgentNoDefaultNoRequired: components.AgentNoDefaultNoRequired$.Inbound;
118
+ RequestBody: UpdateAgentRequestBody$.Inbound;
39
119
  agent_id: string;
40
120
  };
41
121
 
42
122
  export const inboundSchema: z.ZodType<UpdateAgentRequest, z.ZodTypeDef, Inbound> = z
43
123
  .object({
44
- AgentNoDefaultNoRequired: components.AgentNoDefaultNoRequired$.inboundSchema,
124
+ RequestBody: UpdateAgentRequestBody$.inboundSchema,
45
125
  agent_id: z.string(),
46
126
  })
47
127
  .transform((v) => {
48
128
  return {
49
- agentNoDefaultNoRequired: v.AgentNoDefaultNoRequired,
129
+ requestBody: v.RequestBody,
50
130
  agentId: v.agent_id,
51
131
  };
52
132
  });
53
133
 
54
134
  export type Outbound = {
55
- AgentNoDefaultNoRequired: components.AgentNoDefaultNoRequired$.Outbound;
135
+ RequestBody: UpdateAgentRequestBody$.Outbound;
56
136
  agent_id: string;
57
137
  };
58
138
 
59
139
  export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, UpdateAgentRequest> = z
60
140
  .object({
61
- agentNoDefaultNoRequired: components.AgentNoDefaultNoRequired$.outboundSchema,
141
+ requestBody: UpdateAgentRequestBody$.outboundSchema,
62
142
  agentId: z.string(),
63
143
  })
64
144
  .transform((v) => {
65
145
  return {
66
- AgentNoDefaultNoRequired: v.agentNoDefaultNoRequired,
146
+ RequestBody: v.requestBody,
67
147
  agent_id: v.agentId,
68
148
  };
69
149
  });
@@ -1,5 +1,8 @@
1
1
  import { EventEmitter } from "eventemitter3";
2
2
  import WebSocket, { MessageEvent } from "isomorphic-ws";
3
+ import * as operations from "../models/operations";
4
+
5
+ const baseEndpoint = "wss://api.re-tell.ai";
3
6
 
4
7
  export class LiveClient extends EventEmitter {
5
8
  private ws: WebSocket;
@@ -7,10 +10,7 @@ export class LiveClient extends EventEmitter {
7
10
 
8
11
  constructor(
9
12
  apiKey: string,
10
- agentId: string,
11
- sampleRate: number,
12
- agentPromptParams: { name: string; value: string }[],
13
- baseEndpoint: string
13
+ input: operations.CreateWebCallRequestBody
14
14
  ) {
15
15
  super();
16
16
 
@@ -19,10 +19,13 @@ export class LiveClient extends EventEmitter {
19
19
  "/create-web-call?api_key=" +
20
20
  apiKey +
21
21
  "&agent_id=" +
22
- agentId +
23
- "&sample_rate=" +
24
- sampleRate;
25
- endpoint += "&agent_prompt_params=" + encodeURIComponent(JSON.stringify(agentPromptParams));
22
+ input.agentId;
23
+ if (input.sampleRate != null) {
24
+ endpoint += "&sample_rate=" + input.sampleRate;
25
+ }
26
+ if (input.agentPromptParams != null) {
27
+ endpoint += "&agent_prompt_params=" + encodeURIComponent(JSON.stringify(input.agentPromptParams));
28
+ }
26
29
  this.ws = new WebSocket(endpoint);
27
30
  this.ws.binaryType = "arraybuffer";
28
31
  }
package/src/sdk/sdk.ts CHANGED
@@ -6,7 +6,6 @@ import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "../lib/config";
6
6
  import * as enc$ from "../lib/encodings";
7
7
  import { HTTPClient } from "../lib/http";
8
8
  import { ClientSDK, RequestOptions } from "../lib/sdks";
9
- import * as components from "../models/components";
10
9
  import * as errors from "../models/errors";
11
10
  import * as operations from "../models/operations";
12
11
  import { LiveClient } from "./liveClient";
@@ -25,17 +24,11 @@ export class RetellClient extends ClientSDK {
25
24
  }
26
25
 
27
26
  async createWebCall(
28
- agentId: string,
29
- sampleRate = 16000,
30
- agentPromptParams: { name: string; value: string }[] = [],
31
- websocketEndpoint: string = "wss://api.re-tell.ai"
27
+ input: operations.CreateWebCallRequestBody
32
28
  ): Promise<LiveClient> {
33
29
  const liveClient = new LiveClient(
34
30
  this.options$.apiKey as unknown as string,
35
- agentId,
36
- sampleRate,
37
- agentPromptParams,
38
- websocketEndpoint
31
+ input
39
32
  );
40
33
  await liveClient.waitForReady();
41
34
  return liveClient;
@@ -174,7 +167,7 @@ export class RetellClient extends ClientSDK {
174
167
  const responseBody = await response.json();
175
168
  const result = operations.CreatePhoneCallResponse$.inboundSchema.parse({
176
169
  ...responseFields$,
177
- object: responseBody,
170
+ callDetail: responseBody,
178
171
  });
179
172
  return result;
180
173
  } else if (this.matchResponse(response, 400, "application/json")) {
@@ -813,7 +806,7 @@ export class RetellClient extends ClientSDK {
813
806
  const responseBody = await response.json();
814
807
  const result = operations.ListAgentsResponse$.inboundSchema.parse({
815
808
  ...responseFields$,
816
- classes: responseBody,
809
+ agents: responseBody,
817
810
  });
818
811
  return result;
819
812
  } else if (this.matchResponse(response, 401, "application/json")) {
@@ -860,7 +853,7 @@ export class RetellClient extends ClientSDK {
860
853
  const path$ = this.templateURLComponent("/list-calls")();
861
854
 
862
855
  const query$ = [
863
- enc$.encodeForm("filter_criteria", payload$.filter_criteria, {
856
+ enc$.encodeForm("filter_criteria", JSON.stringify(payload$.filter_criteria), {
864
857
  explode: true,
865
858
  charEncoding: "percent",
866
859
  }),
@@ -905,7 +898,7 @@ export class RetellClient extends ClientSDK {
905
898
  const responseBody = await response.json();
906
899
  const result = operations.ListCallsResponse$.inboundSchema.parse({
907
900
  ...responseFields$,
908
- classes: responseBody,
901
+ calls: responseBody,
909
902
  });
910
903
  return result;
911
904
  } else if (this.matchResponse(response, 400, "application/json")) {
@@ -970,7 +963,7 @@ export class RetellClient extends ClientSDK {
970
963
  const responseBody = await response.json();
971
964
  const result = operations.ListPhoneNumbersResponse$.inboundSchema.parse({
972
965
  ...responseFields$,
973
- classes: responseBody,
966
+ phoneNumbers: responseBody,
974
967
  });
975
968
  return result;
976
969
  } else if (this.matchResponse(response, 400, "application/json")) {
@@ -1004,12 +997,12 @@ export class RetellClient extends ClientSDK {
1004
997
  * Update an existing agent
1005
998
  */
1006
999
  async updateAgent(
1007
- agentNoDefaultNoRequired: components.AgentNoDefaultNoRequired,
1000
+ requestBody: operations.UpdateAgentRequestBody,
1008
1001
  agentId: string,
1009
1002
  options?: RequestOptions
1010
1003
  ): Promise<operations.UpdateAgentResponse> {
1011
1004
  const input$: operations.UpdateAgentRequest = {
1012
- agentNoDefaultNoRequired: agentNoDefaultNoRequired,
1005
+ requestBody: requestBody,
1013
1006
  agentId: agentId,
1014
1007
  };
1015
1008
  const headers$ = new Headers();
@@ -1019,7 +1012,7 @@ export class RetellClient extends ClientSDK {
1019
1012
 
1020
1013
  const payload$ = operations.UpdateAgentRequest$.outboundSchema.parse(input$);
1021
1014
 
1022
- const body$ = enc$.encodeJSON("body", payload$.AgentNoDefaultNoRequired, { explode: true });
1015
+ const body$ = enc$.encodeJSON("body", payload$.RequestBody, { explode: true });
1023
1016
 
1024
1017
  const pathParams$ = {
1025
1018
  agent_id: enc$.encodeSimple("agent_id", payload$.agent_id, {