@talqing/sdk 0.1.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/LICENSE +21 -0
- package/README.md +193 -0
- package/dist/browser.d.ts +153 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +440 -0
- package/dist/browser.js.map +1 -0
- package/dist/client.d.ts +101 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +88 -0
- package/dist/client.js.map +1 -0
- package/dist/gen/apiVersion.d.ts +3 -0
- package/dist/gen/apiVersion.d.ts.map +1 -0
- package/dist/gen/apiVersion.js +4 -0
- package/dist/gen/apiVersion.js.map +1 -0
- package/dist/gen/client/client.gen.d.ts +3 -0
- package/dist/gen/client/client.gen.d.ts.map +1 -0
- package/dist/gen/client/client.gen.js +217 -0
- package/dist/gen/client/client.gen.js.map +1 -0
- package/dist/gen/client/index.d.ts +11 -0
- package/dist/gen/client/index.d.ts.map +1 -0
- package/dist/gen/client/index.js +7 -0
- package/dist/gen/client/index.js.map +1 -0
- package/dist/gen/client/types.gen.d.ts +121 -0
- package/dist/gen/client/types.gen.d.ts.map +1 -0
- package/dist/gen/client/types.gen.js +3 -0
- package/dist/gen/client/types.gen.js.map +1 -0
- package/dist/gen/client/utils.gen.d.ts +38 -0
- package/dist/gen/client/utils.gen.d.ts.map +1 -0
- package/dist/gen/client/utils.gen.js +231 -0
- package/dist/gen/client/utils.gen.js.map +1 -0
- package/dist/gen/client.gen.d.ts +13 -0
- package/dist/gen/client.gen.d.ts.map +1 -0
- package/dist/gen/client.gen.js +4 -0
- package/dist/gen/client.gen.js.map +1 -0
- package/dist/gen/core/auth.gen.d.ts +26 -0
- package/dist/gen/core/auth.gen.d.ts.map +1 -0
- package/dist/gen/core/auth.gen.js +15 -0
- package/dist/gen/core/auth.gen.js.map +1 -0
- package/dist/gen/core/bodySerializer.gen.d.ts +26 -0
- package/dist/gen/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/gen/core/bodySerializer.gen.js +58 -0
- package/dist/gen/core/bodySerializer.gen.js.map +1 -0
- package/dist/gen/core/params.gen.d.ts +44 -0
- package/dist/gen/core/params.gen.d.ts.map +1 -0
- package/dist/gen/core/params.gen.js +110 -0
- package/dist/gen/core/params.gen.js.map +1 -0
- package/dist/gen/core/pathSerializer.gen.d.ts +34 -0
- package/dist/gen/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/gen/core/pathSerializer.gen.js +107 -0
- package/dist/gen/core/pathSerializer.gen.js.map +1 -0
- package/dist/gen/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/gen/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/gen/core/queryKeySerializer.gen.js +93 -0
- package/dist/gen/core/queryKeySerializer.gen.js.map +1 -0
- package/dist/gen/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/gen/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/gen/core/serverSentEvents.gen.js +133 -0
- package/dist/gen/core/serverSentEvents.gen.js.map +1 -0
- package/dist/gen/core/types.gen.d.ts +84 -0
- package/dist/gen/core/types.gen.d.ts.map +1 -0
- package/dist/gen/core/types.gen.js +3 -0
- package/dist/gen/core/types.gen.js.map +1 -0
- package/dist/gen/core/utils.gen.d.ts +20 -0
- package/dist/gen/core/utils.gen.d.ts.map +1 -0
- package/dist/gen/core/utils.gen.js +88 -0
- package/dist/gen/core/utils.gen.js.map +1 -0
- package/dist/gen/index.d.ts +3 -0
- package/dist/gen/index.d.ts.map +1 -0
- package/dist/gen/index.js +3 -0
- package/dist/gen/index.js.map +1 -0
- package/dist/gen/sdk.gen.d.ts +2330 -0
- package/dist/gen/sdk.gen.d.ts.map +1 -0
- package/dist/gen/sdk.gen.js +4320 -0
- package/dist/gen/sdk.gen.js.map +1 -0
- package/dist/gen/types.gen.d.ts +17288 -0
- package/dist/gen/types.gen.d.ts.map +1 -0
- package/dist/gen/types.gen.js +3 -0
- package/dist/gen/types.gen.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/vocabulary.d.ts +67 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +12 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +67 -0
- package/src/browser.tsx +675 -0
- package/src/client.ts +189 -0
- package/src/gen/apiVersion.ts +4 -0
- package/src/gen/client/client.gen.ts +277 -0
- package/src/gen/client/index.ts +27 -0
- package/src/gen/client/types.gen.ts +218 -0
- package/src/gen/client/utils.gen.ts +316 -0
- package/src/gen/client.gen.ts +16 -0
- package/src/gen/core/auth.gen.ts +48 -0
- package/src/gen/core/bodySerializer.gen.ts +82 -0
- package/src/gen/core/params.gen.ts +178 -0
- package/src/gen/core/pathSerializer.gen.ts +171 -0
- package/src/gen/core/queryKeySerializer.gen.ts +117 -0
- package/src/gen/core/serverSentEvents.gen.ts +242 -0
- package/src/gen/core/types.gen.ts +110 -0
- package/src/gen/core/utils.gen.ts +140 -0
- package/src/gen/index.ts +4 -0
- package/src/gen/sdk.gen.ts +5008 -0
- package/src/gen/types.gen.ts +18418 -0
- package/src/index.ts +13 -0
- package/src/vocabulary.ts +134 -0
|
@@ -0,0 +1,4320 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import { client } from './client.gen.js';
|
|
3
|
+
import { buildClientParams } from './client/index.js';
|
|
4
|
+
class HeyApiClient {
|
|
5
|
+
constructor(args) {
|
|
6
|
+
this.client = args?.client ?? client;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
class HeyApiRegistry {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.defaultKey = 'default';
|
|
12
|
+
this.instances = new Map();
|
|
13
|
+
}
|
|
14
|
+
get(key) {
|
|
15
|
+
const instance = this.instances.get(key ?? this.defaultKey);
|
|
16
|
+
if (!instance) {
|
|
17
|
+
throw new Error(`No SDK client found. Create one with "new TalqingApi()" to fix this error.`);
|
|
18
|
+
}
|
|
19
|
+
return instance;
|
|
20
|
+
}
|
|
21
|
+
set(value, key) {
|
|
22
|
+
this.instances.set(key ?? this.defaultKey, value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class Versions extends HeyApiClient {
|
|
26
|
+
/**
|
|
27
|
+
* Get Agent Version
|
|
28
|
+
*
|
|
29
|
+
* Fetch what one published version of an agent actually contains.
|
|
30
|
+
*
|
|
31
|
+
* `get_agent` lists the versions and when each was published; this returns the
|
|
32
|
+
* frozen definition itself — prompt, models, turn handling and the tool
|
|
33
|
+
* versions it pinned, exactly as they were at that publish. Use it to see what
|
|
34
|
+
* changed between two versions, or between a version and the current draft.
|
|
35
|
+
*/
|
|
36
|
+
get(parameters, options) {
|
|
37
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }, { in: 'path', key: 'version' }] }]);
|
|
38
|
+
return (options?.client ?? this.client).get({
|
|
39
|
+
responseStyle: 'data',
|
|
40
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
41
|
+
in: 'cookie',
|
|
42
|
+
name: 'talqing_session',
|
|
43
|
+
type: 'apiKey'
|
|
44
|
+
}],
|
|
45
|
+
url: '/v1/agents/{agent_id}/versions/{version}',
|
|
46
|
+
...options,
|
|
47
|
+
...params
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Rollback Agent Version
|
|
52
|
+
*
|
|
53
|
+
* Put an earlier published version of an agent back into production.
|
|
54
|
+
*
|
|
55
|
+
* That version becomes live **immediately** and **replaces the current draft**,
|
|
56
|
+
* so any unpublished edits are lost. Calls already in progress finish on the
|
|
57
|
+
* version they started.
|
|
58
|
+
*
|
|
59
|
+
* No new version is created: `published_version` simply points at the older
|
|
60
|
+
* one. The restored draft tracks each tool's latest published version, not the
|
|
61
|
+
* ones this version pinned.
|
|
62
|
+
*/
|
|
63
|
+
rollback(parameters, options) {
|
|
64
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }, { in: 'path', key: 'version' }] }]);
|
|
65
|
+
return (options?.client ?? this.client).post({
|
|
66
|
+
responseStyle: 'data',
|
|
67
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
68
|
+
in: 'cookie',
|
|
69
|
+
name: 'talqing_session',
|
|
70
|
+
type: 'apiKey'
|
|
71
|
+
}],
|
|
72
|
+
url: '/v1/agents/{agent_id}/versions/{version}/rollback',
|
|
73
|
+
...options,
|
|
74
|
+
...params
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export class Agents extends HeyApiClient {
|
|
79
|
+
/**
|
|
80
|
+
* List Agents
|
|
81
|
+
*
|
|
82
|
+
* List the workspace's agents, newest edit first.
|
|
83
|
+
*
|
|
84
|
+
* Each item carries the full draft config and the published version number
|
|
85
|
+
* (null while the agent has never been published).
|
|
86
|
+
*/
|
|
87
|
+
list(parameters, options) {
|
|
88
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
89
|
+
return (options?.client ?? this.client).get({
|
|
90
|
+
responseStyle: 'data',
|
|
91
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
92
|
+
in: 'cookie',
|
|
93
|
+
name: 'talqing_session',
|
|
94
|
+
type: 'apiKey'
|
|
95
|
+
}],
|
|
96
|
+
url: '/v1/agents',
|
|
97
|
+
...options,
|
|
98
|
+
...params
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create Agent
|
|
103
|
+
*
|
|
104
|
+
* Create an agent from a complete config.
|
|
105
|
+
*
|
|
106
|
+
* The config is validated the same way an update is, so unknown models or
|
|
107
|
+
* unpublished tool references are rejected here. Names are unique per
|
|
108
|
+
* workspace. The agent starts unpublished.
|
|
109
|
+
*/
|
|
110
|
+
create(parameters, options) {
|
|
111
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createAgentRequest', map: 'body' }] }]);
|
|
112
|
+
return (options?.client ?? this.client).post({
|
|
113
|
+
responseStyle: 'data',
|
|
114
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
115
|
+
in: 'cookie',
|
|
116
|
+
name: 'talqing_session',
|
|
117
|
+
type: 'apiKey'
|
|
118
|
+
}],
|
|
119
|
+
url: '/v1/agents',
|
|
120
|
+
...options,
|
|
121
|
+
...params,
|
|
122
|
+
headers: {
|
|
123
|
+
'Content-Type': 'application/json',
|
|
124
|
+
...options?.headers,
|
|
125
|
+
...params.headers
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Delete Agent
|
|
131
|
+
*
|
|
132
|
+
* Delete an agent and its published versions permanently.
|
|
133
|
+
*/
|
|
134
|
+
delete(parameters, options) {
|
|
135
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }] }]);
|
|
136
|
+
return (options?.client ?? this.client).delete({
|
|
137
|
+
responseStyle: 'data',
|
|
138
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
139
|
+
in: 'cookie',
|
|
140
|
+
name: 'talqing_session',
|
|
141
|
+
type: 'apiKey'
|
|
142
|
+
}],
|
|
143
|
+
url: '/v1/agents/{agent_id}',
|
|
144
|
+
...options,
|
|
145
|
+
...params
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get Agent
|
|
150
|
+
*
|
|
151
|
+
* Fetch one agent's draft config, published version and publish history.
|
|
152
|
+
*/
|
|
153
|
+
get(parameters, options) {
|
|
154
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }] }]);
|
|
155
|
+
return (options?.client ?? this.client).get({
|
|
156
|
+
responseStyle: 'data',
|
|
157
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
158
|
+
in: 'cookie',
|
|
159
|
+
name: 'talqing_session',
|
|
160
|
+
type: 'apiKey'
|
|
161
|
+
}],
|
|
162
|
+
url: '/v1/agents/{agent_id}',
|
|
163
|
+
...options,
|
|
164
|
+
...params
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Update Agent
|
|
169
|
+
*
|
|
170
|
+
* Replace the agent's draft config with the one supplied.
|
|
171
|
+
*
|
|
172
|
+
* `config` is the complete definition, not a partial patch: whatever it omits
|
|
173
|
+
* reverts to that field's default. Writes land on the draft only — live
|
|
174
|
+
* traffic keeps running the published version until you publish again.
|
|
175
|
+
*
|
|
176
|
+
* Switching `channel` normalizes the media stack: text agents drop stt, tts,
|
|
177
|
+
* realtime, greeting, turn handling and avatar.
|
|
178
|
+
*
|
|
179
|
+
* Setting `realtime` to a speech-to-speech model makes it the whole pipeline —
|
|
180
|
+
* `stt`, `llm` and `tts` are cleared and it handles turn detection itself.
|
|
181
|
+
* Realtime agents have no fallback model, cannot use the 'after each user
|
|
182
|
+
* turn' hook, and only approximate a fixed greeting.
|
|
183
|
+
*/
|
|
184
|
+
update(parameters, options) {
|
|
185
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }, { key: 'updateAgentRequest', map: 'body' }] }]);
|
|
186
|
+
return (options?.client ?? this.client).patch({
|
|
187
|
+
responseStyle: 'data',
|
|
188
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
189
|
+
in: 'cookie',
|
|
190
|
+
name: 'talqing_session',
|
|
191
|
+
type: 'apiKey'
|
|
192
|
+
}],
|
|
193
|
+
url: '/v1/agents/{agent_id}',
|
|
194
|
+
...options,
|
|
195
|
+
...params,
|
|
196
|
+
headers: {
|
|
197
|
+
'Content-Type': 'application/json',
|
|
198
|
+
...options?.headers,
|
|
199
|
+
...params.headers
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Publish Agent
|
|
205
|
+
*
|
|
206
|
+
* Freeze the current draft as a new immutable version and make it live.
|
|
207
|
+
*
|
|
208
|
+
* Validation must pass. Publishing pins every attached tool (and lifecycle
|
|
209
|
+
* hook) to the tool version that is live right now, so republishing a tool does
|
|
210
|
+
* not change this agent's behaviour until the agent is published again.
|
|
211
|
+
*/
|
|
212
|
+
publish(parameters, options) {
|
|
213
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }] }]);
|
|
214
|
+
return (options?.client ?? this.client).post({
|
|
215
|
+
responseStyle: 'data',
|
|
216
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
217
|
+
in: 'cookie',
|
|
218
|
+
name: 'talqing_session',
|
|
219
|
+
type: 'apiKey'
|
|
220
|
+
}],
|
|
221
|
+
url: '/v1/agents/{agent_id}/publish',
|
|
222
|
+
...options,
|
|
223
|
+
...params
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Validate Agent
|
|
228
|
+
*
|
|
229
|
+
* Run publish-grade validation on the draft without publishing it.
|
|
230
|
+
*
|
|
231
|
+
* Covers everything a draft write checks plus the deeper checks publishing
|
|
232
|
+
* adds: a workspace API key for every provider the agent needs, and the
|
|
233
|
+
* operation trees of attached and hook tools. Returns errors (blocking) and
|
|
234
|
+
* warnings (advisory).
|
|
235
|
+
*/
|
|
236
|
+
validate(parameters, options) {
|
|
237
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }] }]);
|
|
238
|
+
return (options?.client ?? this.client).post({
|
|
239
|
+
responseStyle: 'data',
|
|
240
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
241
|
+
in: 'cookie',
|
|
242
|
+
name: 'talqing_session',
|
|
243
|
+
type: 'apiKey'
|
|
244
|
+
}],
|
|
245
|
+
url: '/v1/agents/{agent_id}/validate',
|
|
246
|
+
...options,
|
|
247
|
+
...params
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
get versions() {
|
|
251
|
+
return this._versions ?? (this._versions = new Versions({ client: this.client }));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
export class Auth extends HeyApiClient {
|
|
255
|
+
/**
|
|
256
|
+
* Logout
|
|
257
|
+
*/
|
|
258
|
+
logout(options) {
|
|
259
|
+
return (options?.client ?? this.client).post({
|
|
260
|
+
responseStyle: 'data',
|
|
261
|
+
url: '/v1/auth/logout',
|
|
262
|
+
...options
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Me
|
|
267
|
+
*
|
|
268
|
+
* Who this credential is: the signed-in user, their role, and the organization.
|
|
269
|
+
*
|
|
270
|
+
* Everything else you can reach is scoped to that organization, and `role`
|
|
271
|
+
* (`ADMIN`, `EDITOR` or `VIEWER`) decides whether writes will be accepted. A
|
|
272
|
+
* user may belong to several organizations with a different role in each; this
|
|
273
|
+
* reports the one this credential is for.
|
|
274
|
+
*/
|
|
275
|
+
me(options) {
|
|
276
|
+
return (options?.client ?? this.client).get({
|
|
277
|
+
responseStyle: 'data',
|
|
278
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
279
|
+
in: 'cookie',
|
|
280
|
+
name: 'talqing_session',
|
|
281
|
+
type: 'apiKey'
|
|
282
|
+
}],
|
|
283
|
+
url: '/v1/auth/me',
|
|
284
|
+
...options
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
export class ProviderKeys extends HeyApiClient {
|
|
289
|
+
/**
|
|
290
|
+
* List Provider Keys
|
|
291
|
+
*
|
|
292
|
+
* List every AI provider and whether this workspace has an API key for it.
|
|
293
|
+
*
|
|
294
|
+
* Talqing is strict BYOK: agents run on the workspace's own provider keys.
|
|
295
|
+
* Publishing fails if the agent needs a provider with no key configured.
|
|
296
|
+
* Every key listed here was accepted by its provider when it was saved.
|
|
297
|
+
*/
|
|
298
|
+
list(options) {
|
|
299
|
+
return (options?.client ?? this.client).get({
|
|
300
|
+
responseStyle: 'data',
|
|
301
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
302
|
+
in: 'cookie',
|
|
303
|
+
name: 'talqing_session',
|
|
304
|
+
type: 'apiKey'
|
|
305
|
+
}],
|
|
306
|
+
url: '/v1/byok',
|
|
307
|
+
...options
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Delete Provider Key
|
|
312
|
+
*
|
|
313
|
+
* Remove this organization's API key for one provider. Agents that need it
|
|
314
|
+
* will stop working and can no longer be published. Organization admins only.
|
|
315
|
+
*/
|
|
316
|
+
delete(parameters, options) {
|
|
317
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'provider' }] }]);
|
|
318
|
+
return (options?.client ?? this.client).delete({
|
|
319
|
+
responseStyle: 'data',
|
|
320
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
321
|
+
in: 'cookie',
|
|
322
|
+
name: 'talqing_session',
|
|
323
|
+
type: 'apiKey'
|
|
324
|
+
}],
|
|
325
|
+
url: '/v1/byok/{provider}',
|
|
326
|
+
...options,
|
|
327
|
+
...params
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Set Provider Key
|
|
332
|
+
*
|
|
333
|
+
* Store this workspace's API key for one provider, replacing any existing key.
|
|
334
|
+
*
|
|
335
|
+
* The key is called against the provider first and only stored if accepted: a
|
|
336
|
+
* rejected key is a 400 that leaves any existing key untouched, and a provider
|
|
337
|
+
* that cannot be reached is a 502. Encrypted at rest and never returned.
|
|
338
|
+
* Organization admins only.
|
|
339
|
+
*/
|
|
340
|
+
set(parameters, options) {
|
|
341
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'provider' }, { key: 'setProviderKeyRequest', map: 'body' }] }]);
|
|
342
|
+
return (options?.client ?? this.client).put({
|
|
343
|
+
responseStyle: 'data',
|
|
344
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
345
|
+
in: 'cookie',
|
|
346
|
+
name: 'talqing_session',
|
|
347
|
+
type: 'apiKey'
|
|
348
|
+
}],
|
|
349
|
+
url: '/v1/byok/{provider}',
|
|
350
|
+
...options,
|
|
351
|
+
...params,
|
|
352
|
+
headers: {
|
|
353
|
+
'Content-Type': 'application/json',
|
|
354
|
+
...options?.headers,
|
|
355
|
+
...params.headers
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
export class Analysis extends HeyApiClient {
|
|
361
|
+
/**
|
|
362
|
+
* Backfill Call Analysis
|
|
363
|
+
*
|
|
364
|
+
* Re-analyse past calls with each one's current agent definition.
|
|
365
|
+
*
|
|
366
|
+
* Use this after changing what an agent extracts, to fill in calls that ran
|
|
367
|
+
* under the old definition — and to retry calls whose analysis failed.
|
|
368
|
+
*
|
|
369
|
+
* Each call is analysed by a real model call and re-priced, so the tenant is
|
|
370
|
+
* charged again for every call in the list. Try the definition on one call
|
|
371
|
+
* with `preview_call_analysis` first.
|
|
372
|
+
*/
|
|
373
|
+
backfill(parameters, options) {
|
|
374
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'backfillAnalysisRequest', map: 'body' }] }]);
|
|
375
|
+
return (options?.client ?? this.client).post({
|
|
376
|
+
responseStyle: 'data',
|
|
377
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
378
|
+
in: 'cookie',
|
|
379
|
+
name: 'talqing_session',
|
|
380
|
+
type: 'apiKey'
|
|
381
|
+
}],
|
|
382
|
+
url: '/v1/calls/analysis/backfill',
|
|
383
|
+
...options,
|
|
384
|
+
...params,
|
|
385
|
+
headers: {
|
|
386
|
+
'Content-Type': 'application/json',
|
|
387
|
+
...options?.headers,
|
|
388
|
+
...params.headers
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Preview Call Analysis
|
|
394
|
+
*
|
|
395
|
+
* Try an analysis definition against one past call and see what it finds.
|
|
396
|
+
*
|
|
397
|
+
* Nothing is saved, which makes this the way to tune a summary prompt, a
|
|
398
|
+
* success definition or an extraction field before putting it on the agent.
|
|
399
|
+
* The call is analysed against the agent definition it actually ran. Costs one
|
|
400
|
+
* model call.
|
|
401
|
+
*/
|
|
402
|
+
preview(parameters, options) {
|
|
403
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'session_id' }, { key: 'previewAnalysisRequest', map: 'body' }] }]);
|
|
404
|
+
return (options?.client ?? this.client).post({
|
|
405
|
+
responseStyle: 'data',
|
|
406
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
407
|
+
in: 'cookie',
|
|
408
|
+
name: 'talqing_session',
|
|
409
|
+
type: 'apiKey'
|
|
410
|
+
}],
|
|
411
|
+
url: '/v1/calls/{session_id}/analysis/preview',
|
|
412
|
+
...options,
|
|
413
|
+
...params,
|
|
414
|
+
headers: {
|
|
415
|
+
'Content-Type': 'application/json',
|
|
416
|
+
...options?.headers,
|
|
417
|
+
...params.headers
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
export class Recipients extends HeyApiClient {
|
|
423
|
+
/**
|
|
424
|
+
* List Call Batch Recipients
|
|
425
|
+
*
|
|
426
|
+
* One batch's recipients and how each call went, in the uploaded order.
|
|
427
|
+
*
|
|
428
|
+
* `session_id` is that person's most recent call — pass it to `get_call` for
|
|
429
|
+
* the transcript, recording and cost, and `last_close_reason` says exactly how
|
|
430
|
+
* the attempt ended. A recipient of a cancelled batch reads as `canceled` even
|
|
431
|
+
* though their row was never touched.
|
|
432
|
+
*/
|
|
433
|
+
list(parameters, options) {
|
|
434
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
435
|
+
{ in: 'path', key: 'batch_id' },
|
|
436
|
+
{ in: 'query', key: 'limit' },
|
|
437
|
+
{ in: 'query', key: 'offset' },
|
|
438
|
+
{ in: 'query', key: 'status' }
|
|
439
|
+
] }]);
|
|
440
|
+
return (options?.client ?? this.client).get({
|
|
441
|
+
responseStyle: 'data',
|
|
442
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
443
|
+
in: 'cookie',
|
|
444
|
+
name: 'talqing_session',
|
|
445
|
+
type: 'apiKey'
|
|
446
|
+
}],
|
|
447
|
+
url: '/v1/calls/batches/{batch_id}/recipients',
|
|
448
|
+
...options,
|
|
449
|
+
...params
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Add Call Batch Recipients
|
|
454
|
+
*
|
|
455
|
+
* Append people to a batch, including one that is already running.
|
|
456
|
+
*
|
|
457
|
+
* Numbers the batch already holds are **skipped and reported**, not rejected —
|
|
458
|
+
* re-uploading a list exported from a CRM is the normal case, and nobody
|
|
459
|
+
* already called is called again. The new rows are dialled after the existing
|
|
460
|
+
* ones.
|
|
461
|
+
*/
|
|
462
|
+
add(parameters, options) {
|
|
463
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'addRecipientsRequest', map: 'body' }] }]);
|
|
464
|
+
return (options?.client ?? this.client).post({
|
|
465
|
+
responseStyle: 'data',
|
|
466
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
467
|
+
in: 'cookie',
|
|
468
|
+
name: 'talqing_session',
|
|
469
|
+
type: 'apiKey'
|
|
470
|
+
}],
|
|
471
|
+
url: '/v1/calls/batches/{batch_id}/recipients',
|
|
472
|
+
...options,
|
|
473
|
+
...params,
|
|
474
|
+
headers: {
|
|
475
|
+
'Content-Type': 'application/json',
|
|
476
|
+
...options?.headers,
|
|
477
|
+
...params.headers
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
export class Batches extends HeyApiClient {
|
|
483
|
+
/**
|
|
484
|
+
* List Call Batches
|
|
485
|
+
*
|
|
486
|
+
* List outbound calling batches, newest first, with live progress.
|
|
487
|
+
*
|
|
488
|
+
* `counts` breaks the recipient list down by outcome and `next_dial_at` says
|
|
489
|
+
* when a batch that is not dialling will start again — the clock, not a fault.
|
|
490
|
+
* A `failed` batch carries `failure_reason`: the circuit breaker stopped it
|
|
491
|
+
* after ten consecutive setup failures.
|
|
492
|
+
*/
|
|
493
|
+
list(parameters, options) {
|
|
494
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
495
|
+
{ in: 'query', key: 'limit' },
|
|
496
|
+
{ in: 'query', key: 'offset' },
|
|
497
|
+
{ in: 'query', key: 'status' }
|
|
498
|
+
] }]);
|
|
499
|
+
return (options?.client ?? this.client).get({
|
|
500
|
+
responseStyle: 'data',
|
|
501
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
502
|
+
in: 'cookie',
|
|
503
|
+
name: 'talqing_session',
|
|
504
|
+
type: 'apiKey'
|
|
505
|
+
}],
|
|
506
|
+
url: '/v1/calls/batches',
|
|
507
|
+
...options,
|
|
508
|
+
...params
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Create Call Batch
|
|
513
|
+
*
|
|
514
|
+
* Call a list of people with a published agent, now or on a schedule.
|
|
515
|
+
*
|
|
516
|
+
* **This places real, billable PSTN calls** — one per recipient, up to 10 000
|
|
517
|
+
* of them. Only call it when the user has asked for this specific list to be
|
|
518
|
+
* dialled.
|
|
519
|
+
*
|
|
520
|
+
* `recipients[]` carries `to` (any format, normalized to E.164) and
|
|
521
|
+
* `userdata`, the session state behind `{{userdata.field}}` in the prompt and
|
|
522
|
+
* greeting. A number that appears twice is refused with both row numbers.
|
|
523
|
+
*
|
|
524
|
+
* `start_at` and `calling_window` schedule it in the timezone you give;
|
|
525
|
+
* `max_concurrency` and `max_attempts` pace it. A number that was reached is
|
|
526
|
+
* never called twice.
|
|
527
|
+
*
|
|
528
|
+
* Two things you would otherwise learn from an invoice:
|
|
529
|
+
*
|
|
530
|
+
* - **Answering machines are not detected.** Voicemail is answered and billed.
|
|
531
|
+
* - **Calls run your agent's current published version.** Republishing changes
|
|
532
|
+
* every call placed after that moment.
|
|
533
|
+
*/
|
|
534
|
+
create(parameters, options) {
|
|
535
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createCallBatchRequest', map: 'body' }] }]);
|
|
536
|
+
return (options?.client ?? this.client).post({
|
|
537
|
+
responseStyle: 'data',
|
|
538
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
539
|
+
in: 'cookie',
|
|
540
|
+
name: 'talqing_session',
|
|
541
|
+
type: 'apiKey'
|
|
542
|
+
}],
|
|
543
|
+
url: '/v1/calls/batches',
|
|
544
|
+
...options,
|
|
545
|
+
...params,
|
|
546
|
+
headers: {
|
|
547
|
+
'Content-Type': 'application/json',
|
|
548
|
+
...options?.headers,
|
|
549
|
+
...params.headers
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Get Call Batch
|
|
555
|
+
*
|
|
556
|
+
* One batch: its policy, its progress, and why it is or is not dialling.
|
|
557
|
+
*
|
|
558
|
+
* `agent_name` and `from_e164` are read live, so a renamed agent shows its
|
|
559
|
+
* current name and a deleted one shows null.
|
|
560
|
+
*/
|
|
561
|
+
get(parameters, options) {
|
|
562
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
|
|
563
|
+
return (options?.client ?? this.client).get({
|
|
564
|
+
responseStyle: 'data',
|
|
565
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
566
|
+
in: 'cookie',
|
|
567
|
+
name: 'talqing_session',
|
|
568
|
+
type: 'apiKey'
|
|
569
|
+
}],
|
|
570
|
+
url: '/v1/calls/batches/{batch_id}',
|
|
571
|
+
...options,
|
|
572
|
+
...params
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Patch Call Batch
|
|
577
|
+
*
|
|
578
|
+
* Change a batch's policy while it runs. The next pass picks it up.
|
|
579
|
+
*
|
|
580
|
+
* Everything here is policy, so nothing revisits a recipient already called,
|
|
581
|
+
* and calls in flight finish under the policy they were dispatched with. You
|
|
582
|
+
* do not need this to pick up a republished prompt — every call already runs
|
|
583
|
+
* the current published version. `start_at` moves only while the batch is
|
|
584
|
+
* still `scheduled`.
|
|
585
|
+
*/
|
|
586
|
+
update(parameters, options) {
|
|
587
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'patchCallBatchRequest', map: 'body' }] }]);
|
|
588
|
+
return (options?.client ?? this.client).patch({
|
|
589
|
+
responseStyle: 'data',
|
|
590
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
591
|
+
in: 'cookie',
|
|
592
|
+
name: 'talqing_session',
|
|
593
|
+
type: 'apiKey'
|
|
594
|
+
}],
|
|
595
|
+
url: '/v1/calls/batches/{batch_id}',
|
|
596
|
+
...options,
|
|
597
|
+
...params,
|
|
598
|
+
headers: {
|
|
599
|
+
'Content-Type': 'application/json',
|
|
600
|
+
...options?.headers,
|
|
601
|
+
...params.headers
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Cancel Call Batch
|
|
607
|
+
*
|
|
608
|
+
* Stop a batch for good. There is no undo, and a batch cannot be deleted.
|
|
609
|
+
*
|
|
610
|
+
* Everyone not yet called immediately reads as `canceled`. Calls already
|
|
611
|
+
* ringing or in progress are **not** dropped — they run to their natural end,
|
|
612
|
+
* and the batch is only finished once they have.
|
|
613
|
+
*/
|
|
614
|
+
cancel(parameters, options) {
|
|
615
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
|
|
616
|
+
return (options?.client ?? this.client).post({
|
|
617
|
+
responseStyle: 'data',
|
|
618
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
619
|
+
in: 'cookie',
|
|
620
|
+
name: 'talqing_session',
|
|
621
|
+
type: 'apiKey'
|
|
622
|
+
}],
|
|
623
|
+
url: '/v1/calls/batches/{batch_id}/cancel',
|
|
624
|
+
...options,
|
|
625
|
+
...params
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Pause Call Batch
|
|
630
|
+
*
|
|
631
|
+
* Stop placing new calls. Calls already in progress run to their end.
|
|
632
|
+
*/
|
|
633
|
+
pause(parameters, options) {
|
|
634
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
|
|
635
|
+
return (options?.client ?? this.client).post({
|
|
636
|
+
responseStyle: 'data',
|
|
637
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
638
|
+
in: 'cookie',
|
|
639
|
+
name: 'talqing_session',
|
|
640
|
+
type: 'apiKey'
|
|
641
|
+
}],
|
|
642
|
+
url: '/v1/calls/batches/{batch_id}/pause',
|
|
643
|
+
...options,
|
|
644
|
+
...params
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Resume Call Batch
|
|
649
|
+
*
|
|
650
|
+
* Undo a pause and carry on from where the batch stopped.
|
|
651
|
+
*
|
|
652
|
+
* A batch whose `start_at` is still in the future goes back to `scheduled`
|
|
653
|
+
* rather than starting early.
|
|
654
|
+
*/
|
|
655
|
+
resume(parameters, options) {
|
|
656
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
|
|
657
|
+
return (options?.client ?? this.client).post({
|
|
658
|
+
responseStyle: 'data',
|
|
659
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
660
|
+
in: 'cookie',
|
|
661
|
+
name: 'talqing_session',
|
|
662
|
+
type: 'apiKey'
|
|
663
|
+
}],
|
|
664
|
+
url: '/v1/calls/batches/{batch_id}/resume',
|
|
665
|
+
...options,
|
|
666
|
+
...params
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
get recipients() {
|
|
670
|
+
return this._recipients ?? (this._recipients = new Recipients({ client: this.client }));
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
export class Recording extends HeyApiClient {
|
|
674
|
+
/**
|
|
675
|
+
* Delete Call Recording
|
|
676
|
+
*
|
|
677
|
+
* Delete the call's recorded media, keeping the call itself.
|
|
678
|
+
*
|
|
679
|
+
* Both the audio and, where the agent watched one, the screen video. The
|
|
680
|
+
* transcript, cost and everything else about the call stay exactly as they are.
|
|
681
|
+
* This is immediate and cannot be undone. Deleting a recording that is already
|
|
682
|
+
* gone succeeds quietly.
|
|
683
|
+
*
|
|
684
|
+
* Deliberately synchronous, unlike `delete_call`: this destroys one or two
|
|
685
|
+
* objects and returns, where deleting a call schedules a redaction across
|
|
686
|
+
* several tables.
|
|
687
|
+
*/
|
|
688
|
+
delete(parameters, options) {
|
|
689
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'session_id' }] }]);
|
|
690
|
+
return (options?.client ?? this.client).delete({
|
|
691
|
+
responseStyle: 'data',
|
|
692
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
693
|
+
in: 'cookie',
|
|
694
|
+
name: 'talqing_session',
|
|
695
|
+
type: 'apiKey'
|
|
696
|
+
}],
|
|
697
|
+
url: '/v1/calls/{session_id}/recording',
|
|
698
|
+
...options,
|
|
699
|
+
...params
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Get Call Recording
|
|
704
|
+
*
|
|
705
|
+
* Redirect to the call's audio: one stereo Ogg/Opus file.
|
|
706
|
+
*
|
|
707
|
+
* The redirect goes to object storage and expires within the hour, so follow
|
|
708
|
+
* it straight away rather than storing it. It supports `Range`, which is what
|
|
709
|
+
* lets a player seek without downloading the whole call first. Pass
|
|
710
|
+
* `download=true` for a link that saves as `call-{id}.ogg`.
|
|
711
|
+
*
|
|
712
|
+
* The caller is the left channel and the agent is the right, so you can listen
|
|
713
|
+
* to either side alone by splitting the channels — one `ffmpeg -map_channel`
|
|
714
|
+
* away, and what makes the file useful both for hearing the call and for
|
|
715
|
+
* building training data. It is what the agent heard after noise cancellation,
|
|
716
|
+
* not a capture of the phone line, and it does not include background audio,
|
|
717
|
+
* which the agent publishes as its own track.
|
|
718
|
+
*
|
|
719
|
+
* A `404` here means there is nothing to play, and its message says why — the
|
|
720
|
+
* agent had recording off, the call is still running, the recording was
|
|
721
|
+
* deleted by a person or by your retention policy, the caller asked not to be
|
|
722
|
+
* recorded, or it failed to save. Check `recording.state` on the call first to
|
|
723
|
+
* know which without a round trip; `get_call` also returns ready-made
|
|
724
|
+
* `recording.url` and `recording.download_url` links.
|
|
725
|
+
*/
|
|
726
|
+
get(parameters, options) {
|
|
727
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'session_id' }, { in: 'query', key: 'download' }] }]);
|
|
728
|
+
return (options?.client ?? this.client).get({
|
|
729
|
+
responseStyle: 'data',
|
|
730
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
731
|
+
in: 'cookie',
|
|
732
|
+
name: 'talqing_session',
|
|
733
|
+
type: 'apiKey'
|
|
734
|
+
}],
|
|
735
|
+
url: '/v1/calls/{session_id}/recording',
|
|
736
|
+
...options,
|
|
737
|
+
...params
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
export class ScreenRecording extends HeyApiClient {
|
|
742
|
+
/**
|
|
743
|
+
* Get Call Screen Recording
|
|
744
|
+
*
|
|
745
|
+
* Redirect to the screen the person shared: one 1 fps H.264 file.
|
|
746
|
+
*
|
|
747
|
+
* Only agents with `vision_input.screenshare.record` produce one. It covers the
|
|
748
|
+
* whole call rather than only the shared stretches — the parts where nobody was
|
|
749
|
+
* sharing are black — so its timeline lines up with the audio and the
|
|
750
|
+
* transcript second for second, and a turn's offset into it is the same
|
|
751
|
+
* arithmetic as into the recording.
|
|
752
|
+
*
|
|
753
|
+
* Like the audio, the redirect goes to object storage, expires within the hour
|
|
754
|
+
* and supports `Range`. A `404` says why there is nothing to play, and
|
|
755
|
+
* `screen_recording.state` on the call answers the same question without a
|
|
756
|
+
* round trip — including `not_shared`, which means screen recording was on and
|
|
757
|
+
* nobody ever shared, as opposed to `none`, which means it was off.
|
|
758
|
+
*/
|
|
759
|
+
get(parameters, options) {
|
|
760
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'session_id' }, { in: 'query', key: 'download' }] }]);
|
|
761
|
+
return (options?.client ?? this.client).get({
|
|
762
|
+
responseStyle: 'data',
|
|
763
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
764
|
+
in: 'cookie',
|
|
765
|
+
name: 'talqing_session',
|
|
766
|
+
type: 'apiKey'
|
|
767
|
+
}],
|
|
768
|
+
url: '/v1/calls/{session_id}/screen-recording',
|
|
769
|
+
...options,
|
|
770
|
+
...params
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
export class Calls extends HeyApiClient {
|
|
775
|
+
/**
|
|
776
|
+
* List Calls
|
|
777
|
+
*
|
|
778
|
+
* List voice and video calls, newest first, with status, duration and cost.
|
|
779
|
+
*
|
|
780
|
+
* The window defaults to the last 30 days. Filter by `agent_id`, by `type` to
|
|
781
|
+
* separate web calls from phone calls, by `contact_key` for one customer's
|
|
782
|
+
* whole history, or by `batch_id` for every call one outbound batch placed.
|
|
783
|
+
* Text conversations are not calls — those live under `list_conversations`.
|
|
784
|
+
*/
|
|
785
|
+
list(parameters, options) {
|
|
786
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
787
|
+
{ in: 'query', key: 'limit' },
|
|
788
|
+
{ in: 'query', key: 'offset' },
|
|
789
|
+
{ in: 'query', key: 'start' },
|
|
790
|
+
{ in: 'query', key: 'end' },
|
|
791
|
+
{ in: 'query', key: 'agent_id' },
|
|
792
|
+
{ in: 'query', key: 'type' },
|
|
793
|
+
{ in: 'query', key: 'status' },
|
|
794
|
+
{ in: 'query', key: 'outcome' },
|
|
795
|
+
{ in: 'query', key: 'contact_key' },
|
|
796
|
+
{ in: 'query', key: 'close_reason' },
|
|
797
|
+
{ in: 'query', key: 'batch_id' }
|
|
798
|
+
] }]);
|
|
799
|
+
return (options?.client ?? this.client).get({
|
|
800
|
+
responseStyle: 'data',
|
|
801
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
802
|
+
in: 'cookie',
|
|
803
|
+
name: 'talqing_session',
|
|
804
|
+
type: 'apiKey'
|
|
805
|
+
}],
|
|
806
|
+
url: '/v1/calls',
|
|
807
|
+
...options,
|
|
808
|
+
...params
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Create Outbound Call
|
|
813
|
+
*
|
|
814
|
+
* Dial a real phone number and have a published agent take the call.
|
|
815
|
+
*
|
|
816
|
+
* **This places a live, billable PSTN call** — only call it when the user has
|
|
817
|
+
* asked for this specific call to be made. The agent must be published and on
|
|
818
|
+
* the `voice` channel, and `from_phone_number_id` an active outbound-capable
|
|
819
|
+
* number on a ready carrier account.
|
|
820
|
+
*
|
|
821
|
+
* `userdata` seeds the session state read as `{{userdata.field}}`; keys
|
|
822
|
+
* beginning with `_talqing` are reserved. Prefer `agent_id`; reach for
|
|
823
|
+
* `agent_override`, `agent` or `agent_team` only when the definition is
|
|
824
|
+
* generated per request and would never be reused.
|
|
825
|
+
*
|
|
826
|
+
* It returns when the call is placed, not when it is answered.
|
|
827
|
+
*/
|
|
828
|
+
outbound(parameters, options) {
|
|
829
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'outboundCallRequest', map: 'body' }] }]);
|
|
830
|
+
return (options?.client ?? this.client).post({
|
|
831
|
+
responseStyle: 'data',
|
|
832
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
833
|
+
in: 'cookie',
|
|
834
|
+
name: 'talqing_session',
|
|
835
|
+
type: 'apiKey'
|
|
836
|
+
}],
|
|
837
|
+
url: '/v1/calls/outbound',
|
|
838
|
+
...options,
|
|
839
|
+
...params,
|
|
840
|
+
headers: {
|
|
841
|
+
'Content-Type': 'application/json',
|
|
842
|
+
...options?.headers,
|
|
843
|
+
...params.headers
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Call Stats
|
|
849
|
+
*
|
|
850
|
+
* Totals for a window: call count, minutes, spend and average cost.
|
|
851
|
+
*
|
|
852
|
+
* Spend and `avg_cost_per_call` count only priced calls (`priced_calls`), so
|
|
853
|
+
* a call still being priced does not drag the average down. The window
|
|
854
|
+
* defaults to the last 30 days.
|
|
855
|
+
*/
|
|
856
|
+
stats(parameters, options) {
|
|
857
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
858
|
+
{ in: 'query', key: 'start' },
|
|
859
|
+
{ in: 'query', key: 'end' },
|
|
860
|
+
{ in: 'query', key: 'agent_id' }
|
|
861
|
+
] }]);
|
|
862
|
+
return (options?.client ?? this.client).get({
|
|
863
|
+
responseStyle: 'data',
|
|
864
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
865
|
+
in: 'cookie',
|
|
866
|
+
name: 'talqing_session',
|
|
867
|
+
type: 'apiKey'
|
|
868
|
+
}],
|
|
869
|
+
url: '/v1/calls/stats',
|
|
870
|
+
...options,
|
|
871
|
+
...params
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Calls Token
|
|
876
|
+
*
|
|
877
|
+
* Mint a LiveKit token for a browser to open a web call with an agent.
|
|
878
|
+
*
|
|
879
|
+
* `userdata` seeds the session state read as `{{userdata.field}}`; keys
|
|
880
|
+
* beginning with `_talqing` are reserved. Prefer `agent_id`; reach for
|
|
881
|
+
* `agent_override`, `agent` or `agent_team` only when the definition is
|
|
882
|
+
* generated per request and would never be reused.
|
|
883
|
+
*
|
|
884
|
+
* Needs the editor role — these fields run an arbitrary prompt on an arbitrary
|
|
885
|
+
* model, paid for with the workspace's own provider keys.
|
|
886
|
+
*
|
|
887
|
+
* The token only lets a browser connect. To dial a phone, use
|
|
888
|
+
* `create_outbound_call`.
|
|
889
|
+
*/
|
|
890
|
+
token(parameters, options) {
|
|
891
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'tokenRequest', map: 'body' }] }]);
|
|
892
|
+
return (options?.client ?? this.client).post({
|
|
893
|
+
responseStyle: 'data',
|
|
894
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
895
|
+
in: 'cookie',
|
|
896
|
+
name: 'talqing_session',
|
|
897
|
+
type: 'apiKey'
|
|
898
|
+
}],
|
|
899
|
+
url: '/v1/calls/token',
|
|
900
|
+
...options,
|
|
901
|
+
...params,
|
|
902
|
+
headers: {
|
|
903
|
+
'Content-Type': 'application/json',
|
|
904
|
+
...options?.headers,
|
|
905
|
+
...params.headers
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Delete Call
|
|
911
|
+
*
|
|
912
|
+
* Erase this call's content. The call itself stays, with its cost.
|
|
913
|
+
*
|
|
914
|
+
* What goes: the recording, the transcript, every tool call and its output,
|
|
915
|
+
* the session's userdata, the summary, the extracted fields, and the phone
|
|
916
|
+
* numbers on the call. What stays: the call, its duration, status, outcome,
|
|
917
|
+
* per-turn timings and everything it was billed — so past invoices still
|
|
918
|
+
* resolve.
|
|
919
|
+
*
|
|
920
|
+
* Erasing a person's last remaining call also erases what your agents
|
|
921
|
+
* remember about them, so the next call from that number meets an agent that
|
|
922
|
+
* has never heard of them.
|
|
923
|
+
*
|
|
924
|
+
* Returns `202`: the work is scheduled rather than done, which is what stops a
|
|
925
|
+
* request to erase two hundred thousand calls arriving as two hundred thousand
|
|
926
|
+
* synchronous deletes. It normally completes within seconds. This cannot be
|
|
927
|
+
* undone.
|
|
928
|
+
*
|
|
929
|
+
* A call that is still in progress is refused with a `409` — it is still
|
|
930
|
+
* writing, and finalize would put the content back on a row already marked
|
|
931
|
+
* erased. Ask again once it has ended.
|
|
932
|
+
*
|
|
933
|
+
* To delete only the audio and keep the transcript, use
|
|
934
|
+
* `delete_call_recording` instead — that one is immediate.
|
|
935
|
+
*/
|
|
936
|
+
delete(parameters, options) {
|
|
937
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'session_id' }] }]);
|
|
938
|
+
return (options?.client ?? this.client).delete({
|
|
939
|
+
responseStyle: 'data',
|
|
940
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
941
|
+
in: 'cookie',
|
|
942
|
+
name: 'talqing_session',
|
|
943
|
+
type: 'apiKey'
|
|
944
|
+
}],
|
|
945
|
+
url: '/v1/calls/{session_id}',
|
|
946
|
+
...options,
|
|
947
|
+
...params
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Get Call
|
|
952
|
+
*
|
|
953
|
+
* Everything about one call: health, transcript, tool calls, usage, cost.
|
|
954
|
+
*
|
|
955
|
+
* Start with `snapshot`: it answers "did this call go well?" on its own —
|
|
956
|
+
* `snapshot.issues` names every problem found and `snapshot.ok` is true when
|
|
957
|
+
* there were none.
|
|
958
|
+
*
|
|
959
|
+
* `transcript` carries what was said with every function call and its output,
|
|
960
|
+
* and `session.userdata` is the state the call ended with. `tools`,
|
|
961
|
+
* `starting_prompt` and `greeting` are the frozen version this call actually
|
|
962
|
+
* ran, not the agent's current draft.
|
|
963
|
+
*/
|
|
964
|
+
get(parameters, options) {
|
|
965
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'session_id' }] }]);
|
|
966
|
+
return (options?.client ?? this.client).get({
|
|
967
|
+
responseStyle: 'data',
|
|
968
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
969
|
+
in: 'cookie',
|
|
970
|
+
name: 'talqing_session',
|
|
971
|
+
type: 'apiKey'
|
|
972
|
+
}],
|
|
973
|
+
url: '/v1/calls/{session_id}',
|
|
974
|
+
...options,
|
|
975
|
+
...params
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
get analysis() {
|
|
979
|
+
return this._analysis ?? (this._analysis = new Analysis({ client: this.client }));
|
|
980
|
+
}
|
|
981
|
+
get batches() {
|
|
982
|
+
return this._batches ?? (this._batches = new Batches({ client: this.client }));
|
|
983
|
+
}
|
|
984
|
+
get recording() {
|
|
985
|
+
return this._recording ?? (this._recording = new Recording({ client: this.client }));
|
|
986
|
+
}
|
|
987
|
+
get screenRecording() {
|
|
988
|
+
return this._screenRecording ?? (this._screenRecording = new ScreenRecording({ client: this.client }));
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
export class Avatars extends HeyApiClient {
|
|
992
|
+
/**
|
|
993
|
+
* Catalog Avatars
|
|
994
|
+
*
|
|
995
|
+
* The Anam avatar gallery — the faces a video agent can wear.
|
|
996
|
+
*
|
|
997
|
+
* An avatar's `id` is what a video agent's `avatar.avatar_id` refers to.
|
|
998
|
+
* `active_version` and `render_style` are gallery facets, not billing models —
|
|
999
|
+
* an agent's `avatar.model` always comes from the provider catalog.
|
|
1000
|
+
*
|
|
1001
|
+
* Shows your own Anam account when you have a key for it and Talqing's
|
|
1002
|
+
* otherwise; `workspace_key` says which.
|
|
1003
|
+
*/
|
|
1004
|
+
list(parameters, options) {
|
|
1005
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
1006
|
+
{ in: 'query', key: 'active_version' },
|
|
1007
|
+
{ in: 'query', key: 'render_style' },
|
|
1008
|
+
{ in: 'query', key: 'offset' },
|
|
1009
|
+
{ in: 'query', key: 'limit' }
|
|
1010
|
+
] }]);
|
|
1011
|
+
return (options?.client ?? this.client).get({
|
|
1012
|
+
responseStyle: 'data',
|
|
1013
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1014
|
+
in: 'cookie',
|
|
1015
|
+
name: 'talqing_session',
|
|
1016
|
+
type: 'apiKey'
|
|
1017
|
+
}],
|
|
1018
|
+
url: '/v1/catalog/avatars',
|
|
1019
|
+
...options,
|
|
1020
|
+
...params
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
export class Elevenlabs extends HeyApiClient {
|
|
1025
|
+
/**
|
|
1026
|
+
* Add Elevenlabs Voice
|
|
1027
|
+
*
|
|
1028
|
+
* Save a shared ElevenLabs library voice so agents can use it.
|
|
1029
|
+
*
|
|
1030
|
+
* Takes the `voice_id` and `owner_id` of a shared voice and returns the id to
|
|
1031
|
+
* set as an agent's `tts.voice`. Saved into your workspace's own ElevenLabs
|
|
1032
|
+
* account when you have a key for it. Voices already in that account come back
|
|
1033
|
+
* from `catalog_voices` with no `owner_id` and need no save at all.
|
|
1034
|
+
*/
|
|
1035
|
+
add(parameters, options) {
|
|
1036
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'addVoiceRequest', map: 'body' }] }]);
|
|
1037
|
+
return (options?.client ?? this.client).post({
|
|
1038
|
+
responseStyle: 'data',
|
|
1039
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1040
|
+
in: 'cookie',
|
|
1041
|
+
name: 'talqing_session',
|
|
1042
|
+
type: 'apiKey'
|
|
1043
|
+
}],
|
|
1044
|
+
url: '/v1/catalog/voices/elevenlabs/add',
|
|
1045
|
+
...options,
|
|
1046
|
+
...params,
|
|
1047
|
+
headers: {
|
|
1048
|
+
'Content-Type': 'application/json',
|
|
1049
|
+
...options?.headers,
|
|
1050
|
+
...params.headers
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Elevenlabs Voice Settings
|
|
1056
|
+
*
|
|
1057
|
+
* The `stability` and `similarity_boost` an ElevenLabs voice was tuned with.
|
|
1058
|
+
*
|
|
1059
|
+
* Copy these onto an agent's `tts` when you set its `voice`: ElevenLabs
|
|
1060
|
+
* applies a voice's own settings only when a request carries no overrides at
|
|
1061
|
+
* all, and Talqing always sends a speed — so an agent without these numbers
|
|
1062
|
+
* speaks in the generic default rather than the voice its author shipped.
|
|
1063
|
+
*
|
|
1064
|
+
* A shared-library voice must be saved by `add_elevenlabs_voice` first; call
|
|
1065
|
+
* this with the id THAT returned.
|
|
1066
|
+
*/
|
|
1067
|
+
settings(parameters, options) {
|
|
1068
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'voice_id' }] }]);
|
|
1069
|
+
return (options?.client ?? this.client).get({
|
|
1070
|
+
responseStyle: 'data',
|
|
1071
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1072
|
+
in: 'cookie',
|
|
1073
|
+
name: 'talqing_session',
|
|
1074
|
+
type: 'apiKey'
|
|
1075
|
+
}],
|
|
1076
|
+
url: '/v1/catalog/voices/elevenlabs/{voice_id}/settings',
|
|
1077
|
+
...options,
|
|
1078
|
+
...params
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
export class Voices extends HeyApiClient {
|
|
1083
|
+
/**
|
|
1084
|
+
* Catalog Voices
|
|
1085
|
+
*
|
|
1086
|
+
* Browse and filter the voices available for one provider.
|
|
1087
|
+
*
|
|
1088
|
+
* A voice's `id` is what an agent's `tts.voice` refers to, or `realtime.voice`
|
|
1089
|
+
* when `kind` is `realtime` — speech-to-speech models pick from their own
|
|
1090
|
+
* roster. Use this before choosing a voice by style, accent or gender rather
|
|
1091
|
+
* than assuming an id exists.
|
|
1092
|
+
*
|
|
1093
|
+
* With a workspace key saved for the provider the listing runs on that key and
|
|
1094
|
+
* leads with your own account's voices; `workspace_key` says whether it did.
|
|
1095
|
+
*/
|
|
1096
|
+
list(parameters, options) {
|
|
1097
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
1098
|
+
{ in: 'query', key: 'provider' },
|
|
1099
|
+
{ in: 'query', key: 'model' },
|
|
1100
|
+
{ in: 'query', key: 'kind' },
|
|
1101
|
+
{ in: 'query', key: 'search' },
|
|
1102
|
+
{ in: 'query', key: 'language' },
|
|
1103
|
+
{ in: 'query', key: 'accent' },
|
|
1104
|
+
{ in: 'query', key: 'gender' },
|
|
1105
|
+
{ in: 'query', key: 'page' }
|
|
1106
|
+
] }]);
|
|
1107
|
+
return (options?.client ?? this.client).get({
|
|
1108
|
+
responseStyle: 'data',
|
|
1109
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1110
|
+
in: 'cookie',
|
|
1111
|
+
name: 'talqing_session',
|
|
1112
|
+
type: 'apiKey'
|
|
1113
|
+
}],
|
|
1114
|
+
url: '/v1/catalog/voices',
|
|
1115
|
+
...options,
|
|
1116
|
+
...params
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
get elevenlabs() {
|
|
1120
|
+
return this._elevenlabs ?? (this._elevenlabs = new Elevenlabs({ client: this.client }));
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
export class Catalog extends HeyApiClient {
|
|
1124
|
+
/**
|
|
1125
|
+
* Get Catalog
|
|
1126
|
+
*
|
|
1127
|
+
* The provider catalog: every LLM, STT, TTS, realtime and avatar model that
|
|
1128
|
+
* agents may use.
|
|
1129
|
+
*
|
|
1130
|
+
* The authoritative source for `provider`/`model` pairs and for what each
|
|
1131
|
+
* entry supports — channels, language codes, speed range, default voice. A
|
|
1132
|
+
* config naming anything not listed here is rejected.
|
|
1133
|
+
*
|
|
1134
|
+
* `realtime` lists the speech-to-speech models. One of those replaces `stt`,
|
|
1135
|
+
* `llm` and `tts` together, so an agent sets either `realtime` or the three
|
|
1136
|
+
* cascade slots, never both.
|
|
1137
|
+
*/
|
|
1138
|
+
get(options) {
|
|
1139
|
+
return (options?.client ?? this.client).get({
|
|
1140
|
+
responseStyle: 'data',
|
|
1141
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1142
|
+
in: 'cookie',
|
|
1143
|
+
name: 'talqing_session',
|
|
1144
|
+
type: 'apiKey'
|
|
1145
|
+
}],
|
|
1146
|
+
url: '/v1/catalog',
|
|
1147
|
+
...options
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
get avatars() {
|
|
1151
|
+
return this._avatars ?? (this._avatars = new Avatars({ client: this.client }));
|
|
1152
|
+
}
|
|
1153
|
+
get voices() {
|
|
1154
|
+
return this._voices ?? (this._voices = new Voices({ client: this.client }));
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
export class Messages extends HeyApiClient {
|
|
1158
|
+
/**
|
|
1159
|
+
* Create Text Message
|
|
1160
|
+
*
|
|
1161
|
+
* Send a message to a text agent — the way to actually talk to one.
|
|
1162
|
+
*
|
|
1163
|
+
* Addressed by `contact_key`, not by id, so the same key always reaches the
|
|
1164
|
+
* same thread. `client_message_id` is a UUID you generate; re-sending with the
|
|
1165
|
+
* same one is ignored rather than duplicated.
|
|
1166
|
+
*
|
|
1167
|
+
* Returns as soon as the message is accepted, carrying only the user's own
|
|
1168
|
+
* item — poll `list_conversation_items` for the agent's reply.
|
|
1169
|
+
*/
|
|
1170
|
+
create(parameters, options) {
|
|
1171
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'textMessageRequest', map: 'body' }] }]);
|
|
1172
|
+
return (options?.client ?? this.client).post({
|
|
1173
|
+
responseStyle: 'data',
|
|
1174
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1175
|
+
in: 'cookie',
|
|
1176
|
+
name: 'talqing_session',
|
|
1177
|
+
type: 'apiKey'
|
|
1178
|
+
}],
|
|
1179
|
+
url: '/v1/conversations/messages',
|
|
1180
|
+
...options,
|
|
1181
|
+
...params,
|
|
1182
|
+
headers: {
|
|
1183
|
+
'Content-Type': 'application/json',
|
|
1184
|
+
...options?.headers,
|
|
1185
|
+
...params.headers
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
export class Items extends HeyApiClient {
|
|
1191
|
+
/**
|
|
1192
|
+
* List Conversation Items
|
|
1193
|
+
*
|
|
1194
|
+
* The messages in a conversation — the transcript of what was said.
|
|
1195
|
+
*
|
|
1196
|
+
* `order=asc` reads from the beginning; `order=desc` returns the newest
|
|
1197
|
+
* window, still chronological within the page, which is what you want to see
|
|
1198
|
+
* an agent's latest reply. `direction` distinguishes inbound from outbound
|
|
1199
|
+
* and `delivery_status` says whether an outbound message actually landed.
|
|
1200
|
+
*/
|
|
1201
|
+
list(parameters, options) {
|
|
1202
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
1203
|
+
{ in: 'path', key: 'conversation_id' },
|
|
1204
|
+
{ in: 'query', key: 'limit' },
|
|
1205
|
+
{ in: 'query', key: 'offset' },
|
|
1206
|
+
{ in: 'query', key: 'order' }
|
|
1207
|
+
] }]);
|
|
1208
|
+
return (options?.client ?? this.client).get({
|
|
1209
|
+
responseStyle: 'data',
|
|
1210
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1211
|
+
in: 'cookie',
|
|
1212
|
+
name: 'talqing_session',
|
|
1213
|
+
type: 'apiKey'
|
|
1214
|
+
}],
|
|
1215
|
+
url: '/v1/conversations/{conversation_id}/items',
|
|
1216
|
+
...options,
|
|
1217
|
+
...params
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
export class Sessions extends HeyApiClient {
|
|
1222
|
+
/**
|
|
1223
|
+
* List Conversation Sessions
|
|
1224
|
+
*
|
|
1225
|
+
* The agent sessions behind a conversation, newest first.
|
|
1226
|
+
*
|
|
1227
|
+
* A thread can be handled many times — each phone call, each text window,
|
|
1228
|
+
* each trigger firing is one session, recording which agent version ran and
|
|
1229
|
+
* how it finished. Use it to find out *which* version answered, and to reach
|
|
1230
|
+
* the matching `session_id` for `get_call`.
|
|
1231
|
+
*/
|
|
1232
|
+
list(parameters, options) {
|
|
1233
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
1234
|
+
{ in: 'path', key: 'conversation_id' },
|
|
1235
|
+
{ in: 'query', key: 'limit' },
|
|
1236
|
+
{ in: 'query', key: 'offset' }
|
|
1237
|
+
] }]);
|
|
1238
|
+
return (options?.client ?? this.client).get({
|
|
1239
|
+
responseStyle: 'data',
|
|
1240
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1241
|
+
in: 'cookie',
|
|
1242
|
+
name: 'talqing_session',
|
|
1243
|
+
type: 'apiKey'
|
|
1244
|
+
}],
|
|
1245
|
+
url: '/v1/conversations/{conversation_id}/sessions',
|
|
1246
|
+
...options,
|
|
1247
|
+
...params
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
export class Conversations extends HeyApiClient {
|
|
1252
|
+
/**
|
|
1253
|
+
* List Conversations
|
|
1254
|
+
*
|
|
1255
|
+
* List conversations across every channel, most recently active first.
|
|
1256
|
+
*
|
|
1257
|
+
* One conversation is one bounded stretch of talking — a web chat, a Telegram
|
|
1258
|
+
* thread, or a single phone call — with `surface` saying which. Several of them
|
|
1259
|
+
* can belong to the same person: pass `contact_key` to list only theirs.
|
|
1260
|
+
*/
|
|
1261
|
+
list(parameters, options) {
|
|
1262
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
1263
|
+
{ in: 'query', key: 'limit' },
|
|
1264
|
+
{ in: 'query', key: 'offset' },
|
|
1265
|
+
{ in: 'query', key: 'agent_id' },
|
|
1266
|
+
{ in: 'query', key: 'contact_key' }
|
|
1267
|
+
] }]);
|
|
1268
|
+
return (options?.client ?? this.client).get({
|
|
1269
|
+
responseStyle: 'data',
|
|
1270
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1271
|
+
in: 'cookie',
|
|
1272
|
+
name: 'talqing_session',
|
|
1273
|
+
type: 'apiKey'
|
|
1274
|
+
}],
|
|
1275
|
+
url: '/v1/conversations',
|
|
1276
|
+
...options,
|
|
1277
|
+
...params
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Create Text Conversation
|
|
1282
|
+
*
|
|
1283
|
+
* Open a text conversation with a published text agent.
|
|
1284
|
+
*
|
|
1285
|
+
* `contact_key` is your own stable id for the person you are talking to —
|
|
1286
|
+
* unique in the workspace, and how you reach them again. `userdata` seeds what
|
|
1287
|
+
* the agent knows about them, readable as `{{userdata.field}}` from the
|
|
1288
|
+
* agent's tools.
|
|
1289
|
+
*
|
|
1290
|
+
* Creating the conversation does not send anything; call `create_text_message`
|
|
1291
|
+
* to say something.
|
|
1292
|
+
*/
|
|
1293
|
+
create(parameters, options) {
|
|
1294
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createTextConversationRequest', map: 'body' }] }]);
|
|
1295
|
+
return (options?.client ?? this.client).post({
|
|
1296
|
+
responseStyle: 'data',
|
|
1297
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1298
|
+
in: 'cookie',
|
|
1299
|
+
name: 'talqing_session',
|
|
1300
|
+
type: 'apiKey'
|
|
1301
|
+
}],
|
|
1302
|
+
url: '/v1/conversations',
|
|
1303
|
+
...options,
|
|
1304
|
+
...params,
|
|
1305
|
+
headers: {
|
|
1306
|
+
'Content-Type': 'application/json',
|
|
1307
|
+
...options?.headers,
|
|
1308
|
+
...params.headers
|
|
1309
|
+
}
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Get Conversation
|
|
1314
|
+
*
|
|
1315
|
+
* Read one conversation's header: agent, surface, summary and userdata.
|
|
1316
|
+
*
|
|
1317
|
+
* `userdata` is what the agent knows about the *contact* — what its tools
|
|
1318
|
+
* published to the `userdata` store, across every conversation with them. For
|
|
1319
|
+
* what one call ended up knowing, read a session's own `userdata` from
|
|
1320
|
+
* `list_conversation_sessions`. The messages are in `list_conversation_items`.
|
|
1321
|
+
*/
|
|
1322
|
+
get(parameters, options) {
|
|
1323
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'conversation_id' }] }]);
|
|
1324
|
+
return (options?.client ?? this.client).get({
|
|
1325
|
+
responseStyle: 'data',
|
|
1326
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1327
|
+
in: 'cookie',
|
|
1328
|
+
name: 'talqing_session',
|
|
1329
|
+
type: 'apiKey'
|
|
1330
|
+
}],
|
|
1331
|
+
url: '/v1/conversations/{conversation_id}',
|
|
1332
|
+
...options,
|
|
1333
|
+
...params
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Patch Conversation
|
|
1338
|
+
*
|
|
1339
|
+
* Edit a conversation's summary, userdata or metadata.
|
|
1340
|
+
*
|
|
1341
|
+
* Writing `userdata` changes what the agent sees as `{{userdata.field}}` on the
|
|
1342
|
+
* next turn — the way to correct or preload what it knows from outside a call.
|
|
1343
|
+
* It belongs to the *contact*, so it reaches every conversation with them, not
|
|
1344
|
+
* just this one. Each field you send replaces that whole object; omitted fields
|
|
1345
|
+
* are left alone.
|
|
1346
|
+
*/
|
|
1347
|
+
update(parameters, options) {
|
|
1348
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'conversation_id' }, { key: 'patchConversationRequest', map: 'body' }] }]);
|
|
1349
|
+
return (options?.client ?? this.client).patch({
|
|
1350
|
+
responseStyle: 'data',
|
|
1351
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1352
|
+
in: 'cookie',
|
|
1353
|
+
name: 'talqing_session',
|
|
1354
|
+
type: 'apiKey'
|
|
1355
|
+
}],
|
|
1356
|
+
url: '/v1/conversations/{conversation_id}',
|
|
1357
|
+
...options,
|
|
1358
|
+
...params,
|
|
1359
|
+
headers: {
|
|
1360
|
+
'Content-Type': 'application/json',
|
|
1361
|
+
...options?.headers,
|
|
1362
|
+
...params.headers
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Conversation Event Stream
|
|
1368
|
+
*
|
|
1369
|
+
* Watch one conversation happen: a snapshot, then every item and turn live.
|
|
1370
|
+
*
|
|
1371
|
+
* Frames: `conversation.snapshot` (the conversation and its items, sent first
|
|
1372
|
+
* and on every reconnect), `item.created`, `item.delivery_updated`, `turn` and
|
|
1373
|
+
* `turn.failed` (turn lifecycle), and `assistant.started` / `assistant.delta`
|
|
1374
|
+
* / `assistant.completed` for the reply as it is generated.
|
|
1375
|
+
*
|
|
1376
|
+
* Nothing here is canonical — a dropped frame is recovered by reconnecting
|
|
1377
|
+
* (the snapshot re-syncs) or by `list_conversation_items`.
|
|
1378
|
+
*/
|
|
1379
|
+
events(parameters, options) {
|
|
1380
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'conversation_id' }] }]);
|
|
1381
|
+
return (options?.client ?? this.client).sse.get({
|
|
1382
|
+
responseStyle: 'data',
|
|
1383
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1384
|
+
in: 'cookie',
|
|
1385
|
+
name: 'talqing_session',
|
|
1386
|
+
type: 'apiKey'
|
|
1387
|
+
}],
|
|
1388
|
+
url: '/v1/conversations/{conversation_id}/events',
|
|
1389
|
+
...options,
|
|
1390
|
+
...params
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Get Conversation Snapshot
|
|
1395
|
+
*
|
|
1396
|
+
* Did this conversation go well? One verdict over the whole thread.
|
|
1397
|
+
*
|
|
1398
|
+
* `issues` names every problem found across every session in the thread —
|
|
1399
|
+
* errors, failed tools, slow responses, a bad connection — and `ok` is true
|
|
1400
|
+
* when there were none. Cost and duration sum across sessions; latency and
|
|
1401
|
+
* tooling come from the merged timeline.
|
|
1402
|
+
*/
|
|
1403
|
+
snapshot(parameters, options) {
|
|
1404
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'conversation_id' }] }]);
|
|
1405
|
+
return (options?.client ?? this.client).get({
|
|
1406
|
+
responseStyle: 'data',
|
|
1407
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1408
|
+
in: 'cookie',
|
|
1409
|
+
name: 'talqing_session',
|
|
1410
|
+
type: 'apiKey'
|
|
1411
|
+
}],
|
|
1412
|
+
url: '/v1/conversations/{conversation_id}/snapshot',
|
|
1413
|
+
...options,
|
|
1414
|
+
...params
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
get messages() {
|
|
1418
|
+
return this._messages ?? (this._messages = new Messages({ client: this.client }));
|
|
1419
|
+
}
|
|
1420
|
+
get items() {
|
|
1421
|
+
return this._items ?? (this._items = new Items({ client: this.client }));
|
|
1422
|
+
}
|
|
1423
|
+
get sessions() {
|
|
1424
|
+
return this._sessions ?? (this._sessions = new Sessions({ client: this.client }));
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
export class Agents2 extends HeyApiClient {
|
|
1428
|
+
/**
|
|
1429
|
+
* Agent Copilot Send Message
|
|
1430
|
+
*
|
|
1431
|
+
* Say something to AgentCoPilot. The reply arrives on the stream, not here.
|
|
1432
|
+
*
|
|
1433
|
+
* Returns as soon as the turn is queued; watch `turn` and `message` frames
|
|
1434
|
+
* on the matching `/stream` for what it does.
|
|
1435
|
+
*/
|
|
1436
|
+
send(parameters, options) {
|
|
1437
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }, { key: 'sendMessageRequest', map: 'body' }] }]);
|
|
1438
|
+
return (options?.client ?? this.client).post({
|
|
1439
|
+
responseStyle: 'data',
|
|
1440
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1441
|
+
in: 'cookie',
|
|
1442
|
+
name: 'talqing_session',
|
|
1443
|
+
type: 'apiKey'
|
|
1444
|
+
}],
|
|
1445
|
+
url: '/v1/copilot/agents/{agent_id}/messages',
|
|
1446
|
+
...options,
|
|
1447
|
+
...params,
|
|
1448
|
+
headers: {
|
|
1449
|
+
'Content-Type': 'application/json',
|
|
1450
|
+
...options?.headers,
|
|
1451
|
+
...params.headers
|
|
1452
|
+
}
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Agent Copilot Stream
|
|
1457
|
+
*
|
|
1458
|
+
* AgentCoPilot's conversation for one agent, as its editor rail shows it.
|
|
1459
|
+
*
|
|
1460
|
+
* Frames: `snapshot` (the whole conversation, sent first and on every
|
|
1461
|
+
* reconnect), `message` (one new message), `turn` (that turn's lifecycle —
|
|
1462
|
+
* `running`, `done`, `error`, `canceled`).
|
|
1463
|
+
*/
|
|
1464
|
+
stream(parameters, options) {
|
|
1465
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'agent_id' }] }]);
|
|
1466
|
+
return (options?.client ?? this.client).sse.get({
|
|
1467
|
+
responseStyle: 'data',
|
|
1468
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1469
|
+
in: 'cookie',
|
|
1470
|
+
name: 'talqing_session',
|
|
1471
|
+
type: 'apiKey'
|
|
1472
|
+
}],
|
|
1473
|
+
url: '/v1/copilot/agents/{agent_id}/stream',
|
|
1474
|
+
...options,
|
|
1475
|
+
...params
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
export class Knowledge extends HeyApiClient {
|
|
1480
|
+
/**
|
|
1481
|
+
* Knowledge Copilot Send Message
|
|
1482
|
+
*
|
|
1483
|
+
* Say something to KnowledgeCoPilot. The reply arrives on the stream, not here.
|
|
1484
|
+
*
|
|
1485
|
+
* Returns as soon as the turn is queued; watch `turn` and `message` frames
|
|
1486
|
+
* on the matching `/stream` for what it does.
|
|
1487
|
+
*/
|
|
1488
|
+
send(parameters, options) {
|
|
1489
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }, { key: 'sendMessageRequest', map: 'body' }] }]);
|
|
1490
|
+
return (options?.client ?? this.client).post({
|
|
1491
|
+
responseStyle: 'data',
|
|
1492
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1493
|
+
in: 'cookie',
|
|
1494
|
+
name: 'talqing_session',
|
|
1495
|
+
type: 'apiKey'
|
|
1496
|
+
}],
|
|
1497
|
+
url: '/v1/copilot/knowledge/{kb_id}/messages',
|
|
1498
|
+
...options,
|
|
1499
|
+
...params,
|
|
1500
|
+
headers: {
|
|
1501
|
+
'Content-Type': 'application/json',
|
|
1502
|
+
...options?.headers,
|
|
1503
|
+
...params.headers
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* Knowledge Copilot Stream
|
|
1509
|
+
*
|
|
1510
|
+
* KnowledgeCoPilot's curation chat for one knowledge base.
|
|
1511
|
+
*
|
|
1512
|
+
* Frames: `snapshot` (the whole conversation, sent first and on every
|
|
1513
|
+
* reconnect), `message` (one new message), `turn` (that turn's lifecycle —
|
|
1514
|
+
* `running`, `done`, `error`, `canceled`).
|
|
1515
|
+
*/
|
|
1516
|
+
stream(parameters, options) {
|
|
1517
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }] }]);
|
|
1518
|
+
return (options?.client ?? this.client).sse.get({
|
|
1519
|
+
responseStyle: 'data',
|
|
1520
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1521
|
+
in: 'cookie',
|
|
1522
|
+
name: 'talqing_session',
|
|
1523
|
+
type: 'apiKey'
|
|
1524
|
+
}],
|
|
1525
|
+
url: '/v1/copilot/knowledge/{kb_id}/stream',
|
|
1526
|
+
...options,
|
|
1527
|
+
...params
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
export class Tasks extends HeyApiClient {
|
|
1532
|
+
/**
|
|
1533
|
+
* Task Copilot Send Message
|
|
1534
|
+
*
|
|
1535
|
+
* Say something to TaskCoPilot. The reply arrives on the stream, not here.
|
|
1536
|
+
*
|
|
1537
|
+
* Returns as soon as the turn is queued; watch `turn` and `message` frames
|
|
1538
|
+
* on the matching `/stream` for what it does.
|
|
1539
|
+
*/
|
|
1540
|
+
send(parameters, options) {
|
|
1541
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'sendMessageRequest', map: 'body' }] }]);
|
|
1542
|
+
return (options?.client ?? this.client).post({
|
|
1543
|
+
responseStyle: 'data',
|
|
1544
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1545
|
+
in: 'cookie',
|
|
1546
|
+
name: 'talqing_session',
|
|
1547
|
+
type: 'apiKey'
|
|
1548
|
+
}],
|
|
1549
|
+
url: '/v1/copilot/tasks/{task_id}/messages',
|
|
1550
|
+
...options,
|
|
1551
|
+
...params,
|
|
1552
|
+
headers: {
|
|
1553
|
+
'Content-Type': 'application/json',
|
|
1554
|
+
...options?.headers,
|
|
1555
|
+
...params.headers
|
|
1556
|
+
}
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Task Copilot Stream
|
|
1561
|
+
*
|
|
1562
|
+
* TaskCoPilot's conversation for one agent task, as its editor rail shows it.
|
|
1563
|
+
*
|
|
1564
|
+
* Frames: `snapshot` (the whole conversation, sent first and on every
|
|
1565
|
+
* reconnect), `message` (one new message), `turn` (that turn's lifecycle —
|
|
1566
|
+
* `running`, `done`, `error`, `canceled`).
|
|
1567
|
+
*/
|
|
1568
|
+
stream(parameters, options) {
|
|
1569
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
|
|
1570
|
+
return (options?.client ?? this.client).sse.get({
|
|
1571
|
+
responseStyle: 'data',
|
|
1572
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1573
|
+
in: 'cookie',
|
|
1574
|
+
name: 'talqing_session',
|
|
1575
|
+
type: 'apiKey'
|
|
1576
|
+
}],
|
|
1577
|
+
url: '/v1/copilot/tasks/{task_id}/stream',
|
|
1578
|
+
...options,
|
|
1579
|
+
...params
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
export class Tools extends HeyApiClient {
|
|
1584
|
+
/**
|
|
1585
|
+
* Tool Copilot Send Message
|
|
1586
|
+
*
|
|
1587
|
+
* Say something to ToolCoPilot. The reply arrives on the stream, not here.
|
|
1588
|
+
*
|
|
1589
|
+
* Returns as soon as the turn is queued; watch `turn` and `message` frames
|
|
1590
|
+
* on the matching `/stream` for what it does.
|
|
1591
|
+
*/
|
|
1592
|
+
send(parameters, options) {
|
|
1593
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }, { key: 'sendMessageRequest', map: 'body' }] }]);
|
|
1594
|
+
return (options?.client ?? this.client).post({
|
|
1595
|
+
responseStyle: 'data',
|
|
1596
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1597
|
+
in: 'cookie',
|
|
1598
|
+
name: 'talqing_session',
|
|
1599
|
+
type: 'apiKey'
|
|
1600
|
+
}],
|
|
1601
|
+
url: '/v1/copilot/tools/{tool_id}/messages',
|
|
1602
|
+
...options,
|
|
1603
|
+
...params,
|
|
1604
|
+
headers: {
|
|
1605
|
+
'Content-Type': 'application/json',
|
|
1606
|
+
...options?.headers,
|
|
1607
|
+
...params.headers
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Tool Copilot Stream
|
|
1613
|
+
*
|
|
1614
|
+
* ToolCoPilot's conversation for one tool, as its editor rail shows it.
|
|
1615
|
+
*
|
|
1616
|
+
* Frames: `snapshot` (the whole conversation, sent first and on every
|
|
1617
|
+
* reconnect), `message` (one new message), `turn` (that turn's lifecycle —
|
|
1618
|
+
* `running`, `done`, `error`, `canceled`).
|
|
1619
|
+
*/
|
|
1620
|
+
stream(parameters, options) {
|
|
1621
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }] }]);
|
|
1622
|
+
return (options?.client ?? this.client).sse.get({
|
|
1623
|
+
responseStyle: 'data',
|
|
1624
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1625
|
+
in: 'cookie',
|
|
1626
|
+
name: 'talqing_session',
|
|
1627
|
+
type: 'apiKey'
|
|
1628
|
+
}],
|
|
1629
|
+
url: '/v1/copilot/tools/{tool_id}/stream',
|
|
1630
|
+
...options,
|
|
1631
|
+
...params
|
|
1632
|
+
});
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
export class Copilot extends HeyApiClient {
|
|
1636
|
+
get agents() {
|
|
1637
|
+
return this._agents ?? (this._agents = new Agents2({ client: this.client }));
|
|
1638
|
+
}
|
|
1639
|
+
get knowledge() {
|
|
1640
|
+
return this._knowledge ?? (this._knowledge = new Knowledge({ client: this.client }));
|
|
1641
|
+
}
|
|
1642
|
+
get tasks() {
|
|
1643
|
+
return this._tasks ?? (this._tasks = new Tasks({ client: this.client }));
|
|
1644
|
+
}
|
|
1645
|
+
get tools() {
|
|
1646
|
+
return this._tools ?? (this._tools = new Tools({ client: this.client }));
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
export class Recipients2 extends HeyApiClient {
|
|
1650
|
+
/**
|
|
1651
|
+
* List Email Batch Recipients
|
|
1652
|
+
*
|
|
1653
|
+
* One batch's rows, in the order they were uploaded.
|
|
1654
|
+
*
|
|
1655
|
+
* Each row carries `columns` — the merged space of what you uploaded, what the
|
|
1656
|
+
* task produced and what a person edited, in that precedence — plus the three
|
|
1657
|
+
* halves separately, so an edited cell can be told from the model's own value.
|
|
1658
|
+
* `not_ready_reason` is why this row cannot be sent yet, and is null when it
|
|
1659
|
+
* can be.
|
|
1660
|
+
*/
|
|
1661
|
+
list(parameters, options) {
|
|
1662
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
1663
|
+
{ in: 'path', key: 'batch_id' },
|
|
1664
|
+
{ in: 'query', key: 'limit' },
|
|
1665
|
+
{ in: 'query', key: 'offset' },
|
|
1666
|
+
{ in: 'query', key: 'status' }
|
|
1667
|
+
] }]);
|
|
1668
|
+
return (options?.client ?? this.client).get({
|
|
1669
|
+
responseStyle: 'data',
|
|
1670
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1671
|
+
in: 'cookie',
|
|
1672
|
+
name: 'talqing_session',
|
|
1673
|
+
type: 'apiKey'
|
|
1674
|
+
}],
|
|
1675
|
+
url: '/v1/email/batches/{batch_id}/recipients',
|
|
1676
|
+
...options,
|
|
1677
|
+
...params
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Patch Email Batch Recipient
|
|
1682
|
+
*
|
|
1683
|
+
* Edit cells on one row before it is sent.
|
|
1684
|
+
*
|
|
1685
|
+
* `overrides` is merged over the uploaded and generated values at send time and
|
|
1686
|
+
* stored apart from both, so what the model wrote stays readable underneath.
|
|
1687
|
+
* Sending an empty value clears that edit rather than sending an empty field —
|
|
1688
|
+
* the way to send nothing is to skip the row. A row that has already been
|
|
1689
|
+
* queued or sent can no longer be edited.
|
|
1690
|
+
*/
|
|
1691
|
+
update(parameters, options) {
|
|
1692
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
1693
|
+
{ in: 'path', key: 'batch_id' },
|
|
1694
|
+
{ in: 'path', key: 'recipient_id' },
|
|
1695
|
+
{ key: 'patchEmailRecipientRequest', map: 'body' }
|
|
1696
|
+
] }]);
|
|
1697
|
+
return (options?.client ?? this.client).patch({
|
|
1698
|
+
responseStyle: 'data',
|
|
1699
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1700
|
+
in: 'cookie',
|
|
1701
|
+
name: 'talqing_session',
|
|
1702
|
+
type: 'apiKey'
|
|
1703
|
+
}],
|
|
1704
|
+
url: '/v1/email/batches/{batch_id}/recipients/{recipient_id}',
|
|
1705
|
+
...options,
|
|
1706
|
+
...params,
|
|
1707
|
+
headers: {
|
|
1708
|
+
'Content-Type': 'application/json',
|
|
1709
|
+
...options?.headers,
|
|
1710
|
+
...params.headers
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* Restore Email Batch Recipients
|
|
1716
|
+
*
|
|
1717
|
+
* Put skipped rows back. `selection: "all_eligible"` means every skipped row.
|
|
1718
|
+
*/
|
|
1719
|
+
restore(parameters, options) {
|
|
1720
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
|
|
1721
|
+
return (options?.client ?? this.client).post({
|
|
1722
|
+
responseStyle: 'data',
|
|
1723
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1724
|
+
in: 'cookie',
|
|
1725
|
+
name: 'talqing_session',
|
|
1726
|
+
type: 'apiKey'
|
|
1727
|
+
}],
|
|
1728
|
+
url: '/v1/email/batches/{batch_id}/restore',
|
|
1729
|
+
...options,
|
|
1730
|
+
...params,
|
|
1731
|
+
headers: {
|
|
1732
|
+
'Content-Type': 'application/json',
|
|
1733
|
+
...options?.headers,
|
|
1734
|
+
...params.headers
|
|
1735
|
+
}
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Retry Email Batch Recipients
|
|
1740
|
+
*
|
|
1741
|
+
* Draft rows whose first attempt failed, again.
|
|
1742
|
+
*
|
|
1743
|
+
* `selection: "all_eligible"` means every row whose drafting failed. This is
|
|
1744
|
+
* the one action that revives a batch that has already finished drafting: it
|
|
1745
|
+
* goes back to `drafting` and picks up exactly the rows you retried — the
|
|
1746
|
+
* alternative would be telling you that twelve failed rows are unrecoverable
|
|
1747
|
+
* because the other 4 988 finished first.
|
|
1748
|
+
*/
|
|
1749
|
+
retry(parameters, options) {
|
|
1750
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
|
|
1751
|
+
return (options?.client ?? this.client).post({
|
|
1752
|
+
responseStyle: 'data',
|
|
1753
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1754
|
+
in: 'cookie',
|
|
1755
|
+
name: 'talqing_session',
|
|
1756
|
+
type: 'apiKey'
|
|
1757
|
+
}],
|
|
1758
|
+
url: '/v1/email/batches/{batch_id}/retry',
|
|
1759
|
+
...options,
|
|
1760
|
+
...params,
|
|
1761
|
+
headers: {
|
|
1762
|
+
'Content-Type': 'application/json',
|
|
1763
|
+
...options?.headers,
|
|
1764
|
+
...params.headers
|
|
1765
|
+
}
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Send Email Batch Recipients
|
|
1770
|
+
*
|
|
1771
|
+
* Send the rows you name. **This mails real people and cannot be undone.**
|
|
1772
|
+
*
|
|
1773
|
+
* At most 50 rows per call, named one by one — there is no "select all" and no
|
|
1774
|
+
* bulk form of this. A row whose `to`, `subject` or `body` does not resolve
|
|
1775
|
+
* comes back in `rejected` and stays a draft; fix it with
|
|
1776
|
+
* `patch_email_batch_recipient` and try again.
|
|
1777
|
+
*
|
|
1778
|
+
* `from_email`, `from_name` and `reply_to` override the sender for this call
|
|
1779
|
+
* only, and must be on a domain verified on the same Resend account.
|
|
1780
|
+
*/
|
|
1781
|
+
send(parameters, options) {
|
|
1782
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'sendEmailBatchRequest', map: 'body' }] }]);
|
|
1783
|
+
return (options?.client ?? this.client).post({
|
|
1784
|
+
responseStyle: 'data',
|
|
1785
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1786
|
+
in: 'cookie',
|
|
1787
|
+
name: 'talqing_session',
|
|
1788
|
+
type: 'apiKey'
|
|
1789
|
+
}],
|
|
1790
|
+
url: '/v1/email/batches/{batch_id}/send',
|
|
1791
|
+
...options,
|
|
1792
|
+
...params,
|
|
1793
|
+
headers: {
|
|
1794
|
+
'Content-Type': 'application/json',
|
|
1795
|
+
...options?.headers,
|
|
1796
|
+
...params.headers
|
|
1797
|
+
}
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Skip Email Batch Recipients
|
|
1802
|
+
*
|
|
1803
|
+
* Take drafted rows out of consideration. Reversible with `restore`.
|
|
1804
|
+
*
|
|
1805
|
+
* Takes either `recipient_ids` or `selection: "all_eligible"`, which here means
|
|
1806
|
+
* every row that has a draft. The reversible verbs keep that shorthand while
|
|
1807
|
+
* `send` does not, because the rule is about irreversibility rather than bulk.
|
|
1808
|
+
*/
|
|
1809
|
+
skip(parameters, options) {
|
|
1810
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
|
|
1811
|
+
return (options?.client ?? this.client).post({
|
|
1812
|
+
responseStyle: 'data',
|
|
1813
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1814
|
+
in: 'cookie',
|
|
1815
|
+
name: 'talqing_session',
|
|
1816
|
+
type: 'apiKey'
|
|
1817
|
+
}],
|
|
1818
|
+
url: '/v1/email/batches/{batch_id}/skip',
|
|
1819
|
+
...options,
|
|
1820
|
+
...params,
|
|
1821
|
+
headers: {
|
|
1822
|
+
'Content-Type': 'application/json',
|
|
1823
|
+
...options?.headers,
|
|
1824
|
+
...params.headers
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
export class Batches2 extends HeyApiClient {
|
|
1830
|
+
/**
|
|
1831
|
+
* List Email Batches
|
|
1832
|
+
*
|
|
1833
|
+
* List email batches, newest first.
|
|
1834
|
+
*
|
|
1835
|
+
* `status` is about **drafting** and nothing else: `scheduled`, `drafting`,
|
|
1836
|
+
* `paused`, `drafted`, `canceled`, `failed`. A `drafted` batch is one whose
|
|
1837
|
+
* drafts are ready to review — it says nothing about how many have been sent,
|
|
1838
|
+
* which is what `counts` is for.
|
|
1839
|
+
*/
|
|
1840
|
+
list(parameters, options) {
|
|
1841
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
1842
|
+
{ in: 'query', key: 'limit' },
|
|
1843
|
+
{ in: 'query', key: 'offset' },
|
|
1844
|
+
{ in: 'query', key: 'status' }
|
|
1845
|
+
] }]);
|
|
1846
|
+
return (options?.client ?? this.client).get({
|
|
1847
|
+
responseStyle: 'data',
|
|
1848
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1849
|
+
in: 'cookie',
|
|
1850
|
+
name: 'talqing_session',
|
|
1851
|
+
type: 'apiKey'
|
|
1852
|
+
}],
|
|
1853
|
+
url: '/v1/email/batches',
|
|
1854
|
+
...options,
|
|
1855
|
+
...params
|
|
1856
|
+
});
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* Create Email Batch
|
|
1860
|
+
*
|
|
1861
|
+
* Create an email batch: a list, an agent task that drafts each row, and a
|
|
1862
|
+
* connected Resend account to send from.
|
|
1863
|
+
*
|
|
1864
|
+
* **Read your provider's terms first.** Resend's Acceptable Use Policy
|
|
1865
|
+
* prohibits unsolicited mail of any kind — cold outreach, purchased lists,
|
|
1866
|
+
* scraped contacts — and this runs on your account under your agreement.
|
|
1867
|
+
*
|
|
1868
|
+
* **Nothing is sent that a person has not selected.** Creating a batch only
|
|
1869
|
+
* starts drafting; sending is a separate call over at most 50 named rows.
|
|
1870
|
+
*
|
|
1871
|
+
* **Every row runs your task as it stands right now** — a task has no
|
|
1872
|
+
* versions, so editing it mid-batch changes every row drafted after that.
|
|
1873
|
+
*
|
|
1874
|
+
* `field_map` points `to`, `subject` and `body` at a column of your list or at
|
|
1875
|
+
* a field the task produces. An invalid batch is a 400 listing every problem.
|
|
1876
|
+
*
|
|
1877
|
+
* There is no spend cap: every row runs the task and is billed, so a 5 000-row
|
|
1878
|
+
* batch doing research costs 5 000 task runs whether or not anything is sent.
|
|
1879
|
+
*/
|
|
1880
|
+
create(parameters, options) {
|
|
1881
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createEmailBatchRequest', map: 'body' }] }]);
|
|
1882
|
+
return (options?.client ?? this.client).post({
|
|
1883
|
+
responseStyle: 'data',
|
|
1884
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1885
|
+
in: 'cookie',
|
|
1886
|
+
name: 'talqing_session',
|
|
1887
|
+
type: 'apiKey'
|
|
1888
|
+
}],
|
|
1889
|
+
url: '/v1/email/batches',
|
|
1890
|
+
...options,
|
|
1891
|
+
...params,
|
|
1892
|
+
headers: {
|
|
1893
|
+
'Content-Type': 'application/json',
|
|
1894
|
+
...options?.headers,
|
|
1895
|
+
...params.headers
|
|
1896
|
+
}
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Get Email Batch
|
|
1901
|
+
*
|
|
1902
|
+
* One batch: its policy, its per-status counts, what drafting has cost so
|
|
1903
|
+
* far, and — while it is waiting on a start time or a closed window —
|
|
1904
|
+
* `next_draft_at`.
|
|
1905
|
+
*/
|
|
1906
|
+
get(parameters, options) {
|
|
1907
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
|
|
1908
|
+
return (options?.client ?? this.client).get({
|
|
1909
|
+
responseStyle: 'data',
|
|
1910
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1911
|
+
in: 'cookie',
|
|
1912
|
+
name: 'talqing_session',
|
|
1913
|
+
type: 'apiKey'
|
|
1914
|
+
}],
|
|
1915
|
+
url: '/v1/email/batches/{batch_id}',
|
|
1916
|
+
...options,
|
|
1917
|
+
...params
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
/**
|
|
1921
|
+
* Patch Email Batch
|
|
1922
|
+
*
|
|
1923
|
+
* Edit a batch's policy. The next drafting pass reads the new row.
|
|
1924
|
+
*
|
|
1925
|
+
* Pacing and the calling window are editable at any time. The sender, the body
|
|
1926
|
+
* format and the field map freeze once the batch has sent anything — changing
|
|
1927
|
+
* them then would make the rows already delivered no longer describe what they
|
|
1928
|
+
* were sent as. `start_at` moves only while the batch is still scheduled.
|
|
1929
|
+
*/
|
|
1930
|
+
update(parameters, options) {
|
|
1931
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'patchEmailBatchRequest', map: 'body' }] }]);
|
|
1932
|
+
return (options?.client ?? this.client).patch({
|
|
1933
|
+
responseStyle: 'data',
|
|
1934
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1935
|
+
in: 'cookie',
|
|
1936
|
+
name: 'talqing_session',
|
|
1937
|
+
type: 'apiKey'
|
|
1938
|
+
}],
|
|
1939
|
+
url: '/v1/email/batches/{batch_id}',
|
|
1940
|
+
...options,
|
|
1941
|
+
...params,
|
|
1942
|
+
headers: {
|
|
1943
|
+
'Content-Type': 'application/json',
|
|
1944
|
+
...options?.headers,
|
|
1945
|
+
...params.headers
|
|
1946
|
+
}
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
/**
|
|
1950
|
+
* Cancel Email Batch
|
|
1951
|
+
*
|
|
1952
|
+
* Stop drafting for good. This is the only terminal action — a batch cannot
|
|
1953
|
+
* be deleted, because it is the record of what was sent to whom.
|
|
1954
|
+
*
|
|
1955
|
+
* Rows already drafted are **not** touched: cancelling stops drafting, and
|
|
1956
|
+
* drafts already produced are still worth reviewing and sending. Rows never
|
|
1957
|
+
* reached report as `canceled`.
|
|
1958
|
+
*/
|
|
1959
|
+
cancel(parameters, options) {
|
|
1960
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
|
|
1961
|
+
return (options?.client ?? this.client).post({
|
|
1962
|
+
responseStyle: 'data',
|
|
1963
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1964
|
+
in: 'cookie',
|
|
1965
|
+
name: 'talqing_session',
|
|
1966
|
+
type: 'apiKey'
|
|
1967
|
+
}],
|
|
1968
|
+
url: '/v1/email/batches/{batch_id}/cancel',
|
|
1969
|
+
...options,
|
|
1970
|
+
...params
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Pause Email Batch
|
|
1975
|
+
*
|
|
1976
|
+
* Stop drafting new rows. Runs already in flight finish.
|
|
1977
|
+
*
|
|
1978
|
+
* A paused batch has nothing scheduled at all until you resume it. Drafts
|
|
1979
|
+
* already produced stay reviewable and sendable.
|
|
1980
|
+
*/
|
|
1981
|
+
pause(parameters, options) {
|
|
1982
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
|
|
1983
|
+
return (options?.client ?? this.client).post({
|
|
1984
|
+
responseStyle: 'data',
|
|
1985
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
1986
|
+
in: 'cookie',
|
|
1987
|
+
name: 'talqing_session',
|
|
1988
|
+
type: 'apiKey'
|
|
1989
|
+
}],
|
|
1990
|
+
url: '/v1/email/batches/{batch_id}/pause',
|
|
1991
|
+
...options,
|
|
1992
|
+
...params
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
/**
|
|
1996
|
+
* Resume Email Batch
|
|
1997
|
+
*
|
|
1998
|
+
* Undo a pause and start drafting again from where it stopped.
|
|
1999
|
+
*/
|
|
2000
|
+
resume(parameters, options) {
|
|
2001
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
|
|
2002
|
+
return (options?.client ?? this.client).post({
|
|
2003
|
+
responseStyle: 'data',
|
|
2004
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2005
|
+
in: 'cookie',
|
|
2006
|
+
name: 'talqing_session',
|
|
2007
|
+
type: 'apiKey'
|
|
2008
|
+
}],
|
|
2009
|
+
url: '/v1/email/batches/{batch_id}/resume',
|
|
2010
|
+
...options,
|
|
2011
|
+
...params
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
get recipients() {
|
|
2015
|
+
return this._recipients ?? (this._recipients = new Recipients2({ client: this.client }));
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
export class Senders extends HeyApiClient {
|
|
2019
|
+
/**
|
|
2020
|
+
* List Email Senders
|
|
2021
|
+
*
|
|
2022
|
+
* The domains a connected email account may send from, right now.
|
|
2023
|
+
*
|
|
2024
|
+
* Domains rather than addresses, because that is what Resend verifies: any
|
|
2025
|
+
* local part on a verified domain sends. Read live off the account, and this
|
|
2026
|
+
* is what a `from_email` is checked against — both the batch's default and a
|
|
2027
|
+
* per-send override.
|
|
2028
|
+
*/
|
|
2029
|
+
list(parameters, options) {
|
|
2030
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'integration_id' }] }]);
|
|
2031
|
+
return (options?.client ?? this.client).get({
|
|
2032
|
+
responseStyle: 'data',
|
|
2033
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2034
|
+
in: 'cookie',
|
|
2035
|
+
name: 'talqing_session',
|
|
2036
|
+
type: 'apiKey'
|
|
2037
|
+
}],
|
|
2038
|
+
url: '/v1/email/senders',
|
|
2039
|
+
...options,
|
|
2040
|
+
...params
|
|
2041
|
+
});
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
export class Email extends HeyApiClient {
|
|
2045
|
+
get batches() {
|
|
2046
|
+
return this._batches ?? (this._batches = new Batches2({ client: this.client }));
|
|
2047
|
+
}
|
|
2048
|
+
get senders() {
|
|
2049
|
+
return this._senders ?? (this._senders = new Senders({ client: this.client }));
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
export class McpTools extends HeyApiClient {
|
|
2053
|
+
/**
|
|
2054
|
+
* List Integration Mcp Tools
|
|
2055
|
+
*
|
|
2056
|
+
* Connect to the integration's MCP server and list every tool it offers.
|
|
2057
|
+
*
|
|
2058
|
+
* A live call to the provider, so it also proves the connection works. The
|
|
2059
|
+
* list is unfiltered — it is what tool approval is chosen from. Which of these
|
|
2060
|
+
* an attached agent can actually call is the integration's `allowed_tools`
|
|
2061
|
+
* (null there means all of them). Fails if the integration is not active or
|
|
2062
|
+
* the server is unreachable.
|
|
2063
|
+
*/
|
|
2064
|
+
list(parameters, options) {
|
|
2065
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'integration_id' }] }]);
|
|
2066
|
+
return (options?.client ?? this.client).get({
|
|
2067
|
+
responseStyle: 'data',
|
|
2068
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2069
|
+
in: 'cookie',
|
|
2070
|
+
name: 'talqing_session',
|
|
2071
|
+
type: 'apiKey'
|
|
2072
|
+
}],
|
|
2073
|
+
url: '/v1/integrations/{integration_id}/mcp-tools',
|
|
2074
|
+
...options,
|
|
2075
|
+
...params
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
export class Triggers extends HeyApiClient {
|
|
2080
|
+
/**
|
|
2081
|
+
* List Integration Triggers
|
|
2082
|
+
*
|
|
2083
|
+
* List the trigger deployments under an integration.
|
|
2084
|
+
*
|
|
2085
|
+
* A trigger binds an inbound provider event — a Telegram message — to a
|
|
2086
|
+
* published agent version.
|
|
2087
|
+
*/
|
|
2088
|
+
list(parameters, options) {
|
|
2089
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
2090
|
+
{ in: 'path', key: 'integration_id' },
|
|
2091
|
+
{ in: 'query', key: 'limit' },
|
|
2092
|
+
{ in: 'query', key: 'offset' }
|
|
2093
|
+
] }]);
|
|
2094
|
+
return (options?.client ?? this.client).get({
|
|
2095
|
+
responseStyle: 'data',
|
|
2096
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2097
|
+
in: 'cookie',
|
|
2098
|
+
name: 'talqing_session',
|
|
2099
|
+
type: 'apiKey'
|
|
2100
|
+
}],
|
|
2101
|
+
url: '/v1/integrations/{integration_id}/triggers',
|
|
2102
|
+
...options,
|
|
2103
|
+
...params
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
/**
|
|
2107
|
+
* Create Integration Trigger
|
|
2108
|
+
*
|
|
2109
|
+
* Deploy an agent to an inbound provider event.
|
|
2110
|
+
*
|
|
2111
|
+
* `reply_mode` decides what happens with the agent's answer: `public_reply`
|
|
2112
|
+
* sends it to the customer, `internal_note` posts it privately where the
|
|
2113
|
+
* provider supports that, `none` generates without sending.
|
|
2114
|
+
*
|
|
2115
|
+
* Enabling validates that the integration is active and the assigned agent is
|
|
2116
|
+
* a published text agent, so create disabled while still wiring things up.
|
|
2117
|
+
*/
|
|
2118
|
+
create(parameters, options) {
|
|
2119
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'integration_id' }, { key: 'createIntegrationTriggerRequest', map: 'body' }] }]);
|
|
2120
|
+
return (options?.client ?? this.client).post({
|
|
2121
|
+
responseStyle: 'data',
|
|
2122
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2123
|
+
in: 'cookie',
|
|
2124
|
+
name: 'talqing_session',
|
|
2125
|
+
type: 'apiKey'
|
|
2126
|
+
}],
|
|
2127
|
+
url: '/v1/integrations/{integration_id}/triggers',
|
|
2128
|
+
...options,
|
|
2129
|
+
...params,
|
|
2130
|
+
headers: {
|
|
2131
|
+
'Content-Type': 'application/json',
|
|
2132
|
+
...options?.headers,
|
|
2133
|
+
...params.headers
|
|
2134
|
+
}
|
|
2135
|
+
});
|
|
2136
|
+
}
|
|
2137
|
+
/**
|
|
2138
|
+
* Delete Integration Trigger
|
|
2139
|
+
*
|
|
2140
|
+
* Delete a trigger permanently. The agent stops receiving that event.
|
|
2141
|
+
*/
|
|
2142
|
+
delete(parameters, options) {
|
|
2143
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'integration_id' }, { in: 'path', key: 'trigger_id' }] }]);
|
|
2144
|
+
return (options?.client ?? this.client).delete({
|
|
2145
|
+
responseStyle: 'data',
|
|
2146
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2147
|
+
in: 'cookie',
|
|
2148
|
+
name: 'talqing_session',
|
|
2149
|
+
type: 'apiKey'
|
|
2150
|
+
}],
|
|
2151
|
+
url: '/v1/integrations/{integration_id}/triggers/{trigger_id}',
|
|
2152
|
+
...options,
|
|
2153
|
+
...params
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2156
|
+
/**
|
|
2157
|
+
* Patch Integration Trigger
|
|
2158
|
+
*
|
|
2159
|
+
* Update a trigger: reassign the agent, change reply mode, enable or
|
|
2160
|
+
* disable it. Omitted fields are left unchanged. The same checks as creation
|
|
2161
|
+
* run when enabling.
|
|
2162
|
+
*/
|
|
2163
|
+
update(parameters, options) {
|
|
2164
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
2165
|
+
{ in: 'path', key: 'integration_id' },
|
|
2166
|
+
{ in: 'path', key: 'trigger_id' },
|
|
2167
|
+
{ key: 'patchIntegrationTriggerRequest', map: 'body' }
|
|
2168
|
+
] }]);
|
|
2169
|
+
return (options?.client ?? this.client).patch({
|
|
2170
|
+
responseStyle: 'data',
|
|
2171
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2172
|
+
in: 'cookie',
|
|
2173
|
+
name: 'talqing_session',
|
|
2174
|
+
type: 'apiKey'
|
|
2175
|
+
}],
|
|
2176
|
+
url: '/v1/integrations/{integration_id}/triggers/{trigger_id}',
|
|
2177
|
+
...options,
|
|
2178
|
+
...params,
|
|
2179
|
+
headers: {
|
|
2180
|
+
'Content-Type': 'application/json',
|
|
2181
|
+
...options?.headers,
|
|
2182
|
+
...params.headers
|
|
2183
|
+
}
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
export class Integrations extends HeyApiClient {
|
|
2188
|
+
/**
|
|
2189
|
+
* List Integrations
|
|
2190
|
+
*
|
|
2191
|
+
* List the workspace's integrations with their provider, status and config.
|
|
2192
|
+
*
|
|
2193
|
+
* Secret values are never returned — credential fields come back as
|
|
2194
|
+
* `{{secrets.NAME}}` references.
|
|
2195
|
+
*/
|
|
2196
|
+
list(parameters, options) {
|
|
2197
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
2198
|
+
return (options?.client ?? this.client).get({
|
|
2199
|
+
responseStyle: 'data',
|
|
2200
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2201
|
+
in: 'cookie',
|
|
2202
|
+
name: 'talqing_session',
|
|
2203
|
+
type: 'apiKey'
|
|
2204
|
+
}],
|
|
2205
|
+
url: '/v1/integrations',
|
|
2206
|
+
...options,
|
|
2207
|
+
...params
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Create Integration
|
|
2212
|
+
*
|
|
2213
|
+
* Create a manual integration, fully configured.
|
|
2214
|
+
*
|
|
2215
|
+
* Which of `credentials_ref`, `provider_account_info`, `mcp_config` and
|
|
2216
|
+
* `webhook_config` a provider needs is described by its `setup_fields` in the
|
|
2217
|
+
* integration catalog. Secret-bearing fields take a plaintext value — stored
|
|
2218
|
+
* as a workspace secret — or an existing `{{secrets.NAME}}` reference.
|
|
2219
|
+
*
|
|
2220
|
+
* Leave `allowed_tools` unset to expose every tool the server lists. OAuth
|
|
2221
|
+
* providers are connected from the dashboard instead.
|
|
2222
|
+
*/
|
|
2223
|
+
create(parameters, options) {
|
|
2224
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createIntegrationRequest', map: 'body' }] }]);
|
|
2225
|
+
return (options?.client ?? this.client).post({
|
|
2226
|
+
responseStyle: 'data',
|
|
2227
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2228
|
+
in: 'cookie',
|
|
2229
|
+
name: 'talqing_session',
|
|
2230
|
+
type: 'apiKey'
|
|
2231
|
+
}],
|
|
2232
|
+
url: '/v1/integrations',
|
|
2233
|
+
...options,
|
|
2234
|
+
...params,
|
|
2235
|
+
headers: {
|
|
2236
|
+
'Content-Type': 'application/json',
|
|
2237
|
+
...options?.headers,
|
|
2238
|
+
...params.headers
|
|
2239
|
+
}
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
/**
|
|
2243
|
+
* Integration Catalog
|
|
2244
|
+
*
|
|
2245
|
+
* List the providers that can be integrated, and how to connect each one.
|
|
2246
|
+
*
|
|
2247
|
+
* `auth_type` says which path a provider takes: `manual` through this API,
|
|
2248
|
+
* `oauth` from the dashboard. `setup_fields` is the authoritative list of what
|
|
2249
|
+
* each manual provider requires — read it rather than guessing. `capabilities`
|
|
2250
|
+
* says whether it serves tools (MCP) or a messaging channel (triggers).
|
|
2251
|
+
*/
|
|
2252
|
+
catalog(parameters, options) {
|
|
2253
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
2254
|
+
return (options?.client ?? this.client).get({
|
|
2255
|
+
responseStyle: 'data',
|
|
2256
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2257
|
+
in: 'cookie',
|
|
2258
|
+
name: 'talqing_session',
|
|
2259
|
+
type: 'apiKey'
|
|
2260
|
+
}],
|
|
2261
|
+
url: '/v1/integrations/catalog',
|
|
2262
|
+
...options,
|
|
2263
|
+
...params
|
|
2264
|
+
});
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Delete Integration
|
|
2268
|
+
*
|
|
2269
|
+
* Delete an integration and its triggers permanently.
|
|
2270
|
+
*/
|
|
2271
|
+
delete(parameters, options) {
|
|
2272
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'integration_id' }] }]);
|
|
2273
|
+
return (options?.client ?? this.client).delete({
|
|
2274
|
+
responseStyle: 'data',
|
|
2275
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2276
|
+
in: 'cookie',
|
|
2277
|
+
name: 'talqing_session',
|
|
2278
|
+
type: 'apiKey'
|
|
2279
|
+
}],
|
|
2280
|
+
url: '/v1/integrations/{integration_id}',
|
|
2281
|
+
...options,
|
|
2282
|
+
...params
|
|
2283
|
+
});
|
|
2284
|
+
}
|
|
2285
|
+
/**
|
|
2286
|
+
* Get Integration
|
|
2287
|
+
*
|
|
2288
|
+
* Fetch one integration: provider, status, structured config, trigger
|
|
2289
|
+
* capabilities and inbound webhook setup state.
|
|
2290
|
+
*/
|
|
2291
|
+
get(parameters, options) {
|
|
2292
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'integration_id' }] }]);
|
|
2293
|
+
return (options?.client ?? this.client).get({
|
|
2294
|
+
responseStyle: 'data',
|
|
2295
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2296
|
+
in: 'cookie',
|
|
2297
|
+
name: 'talqing_session',
|
|
2298
|
+
type: 'apiKey'
|
|
2299
|
+
}],
|
|
2300
|
+
url: '/v1/integrations/{integration_id}',
|
|
2301
|
+
...options,
|
|
2302
|
+
...params
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Patch Integration
|
|
2307
|
+
*
|
|
2308
|
+
* Update an integration. Omitted fields are left unchanged.
|
|
2309
|
+
*
|
|
2310
|
+
* Sending `credentials_ref` rotates the credential. Only `active` integrations
|
|
2311
|
+
* can be attached to agents or serve triggers.
|
|
2312
|
+
*
|
|
2313
|
+
* `allowed_tools` replaces the approved list wholesale: exactly those tools
|
|
2314
|
+
* become callable by every agent this integration is attached to. It cannot be
|
|
2315
|
+
* emptied — an agent that should call nothing is an integration that should be
|
|
2316
|
+
* disabled.
|
|
2317
|
+
*/
|
|
2318
|
+
update(parameters, options) {
|
|
2319
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'integration_id' }, { key: 'patchIntegrationRequest', map: 'body' }] }]);
|
|
2320
|
+
return (options?.client ?? this.client).patch({
|
|
2321
|
+
responseStyle: 'data',
|
|
2322
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2323
|
+
in: 'cookie',
|
|
2324
|
+
name: 'talqing_session',
|
|
2325
|
+
type: 'apiKey'
|
|
2326
|
+
}],
|
|
2327
|
+
url: '/v1/integrations/{integration_id}',
|
|
2328
|
+
...options,
|
|
2329
|
+
...params,
|
|
2330
|
+
headers: {
|
|
2331
|
+
'Content-Type': 'application/json',
|
|
2332
|
+
...options?.headers,
|
|
2333
|
+
...params.headers
|
|
2334
|
+
}
|
|
2335
|
+
});
|
|
2336
|
+
}
|
|
2337
|
+
get mcpTools() {
|
|
2338
|
+
return this._mcpTools ?? (this._mcpTools = new McpTools({ client: this.client }));
|
|
2339
|
+
}
|
|
2340
|
+
get triggers() {
|
|
2341
|
+
return this._triggers ?? (this._triggers = new Triggers({ client: this.client }));
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
export class Nodes extends HeyApiClient {
|
|
2345
|
+
/**
|
|
2346
|
+
* Delete Node
|
|
2347
|
+
*
|
|
2348
|
+
* Drop one entry from the table of contents, permanently.
|
|
2349
|
+
*
|
|
2350
|
+
* Its children go with it, and agents can no longer retrieve any of it.
|
|
2351
|
+
*/
|
|
2352
|
+
delete(parameters, options) {
|
|
2353
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }, { in: 'path', key: 'node_id' }] }]);
|
|
2354
|
+
return (options?.client ?? this.client).delete({
|
|
2355
|
+
responseStyle: 'data',
|
|
2356
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2357
|
+
in: 'cookie',
|
|
2358
|
+
name: 'talqing_session',
|
|
2359
|
+
type: 'apiKey'
|
|
2360
|
+
}],
|
|
2361
|
+
url: '/v1/knowledge/{kb_id}/nodes/{node_id}',
|
|
2362
|
+
...options,
|
|
2363
|
+
...params
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
/**
|
|
2367
|
+
* Get Node
|
|
2368
|
+
*
|
|
2369
|
+
* Read one entry of the table of contents, with its full content.
|
|
2370
|
+
*
|
|
2371
|
+
* This is the text an agent retrieves when it fetches this node. `version` is
|
|
2372
|
+
* what `patch_node` needs for a safe edit.
|
|
2373
|
+
*/
|
|
2374
|
+
get(parameters, options) {
|
|
2375
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }, { in: 'path', key: 'node_id' }] }]);
|
|
2376
|
+
return (options?.client ?? this.client).get({
|
|
2377
|
+
responseStyle: 'data',
|
|
2378
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2379
|
+
in: 'cookie',
|
|
2380
|
+
name: 'talqing_session',
|
|
2381
|
+
type: 'apiKey'
|
|
2382
|
+
}],
|
|
2383
|
+
url: '/v1/knowledge/{kb_id}/nodes/{node_id}',
|
|
2384
|
+
...options,
|
|
2385
|
+
...params
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
/**
|
|
2389
|
+
* Patch Node
|
|
2390
|
+
*
|
|
2391
|
+
* Correct one entry's title, summary or content by hand — the way to fix a
|
|
2392
|
+
* fact the crawl got wrong without rebuilding.
|
|
2393
|
+
*
|
|
2394
|
+
* `title` and `summary` are what the agent sees in the table of contents and
|
|
2395
|
+
* decide whether it ever fetches this node, so keep them accurate.
|
|
2396
|
+
*
|
|
2397
|
+
* Send the `version` you read from `get_node`; a mismatch is rejected rather
|
|
2398
|
+
* than overwriting someone else's edit.
|
|
2399
|
+
*/
|
|
2400
|
+
update(parameters, options) {
|
|
2401
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
2402
|
+
{ in: 'path', key: 'kb_id' },
|
|
2403
|
+
{ in: 'path', key: 'node_id' },
|
|
2404
|
+
{ key: 'patchNodeRequest', map: 'body' }
|
|
2405
|
+
] }]);
|
|
2406
|
+
return (options?.client ?? this.client).patch({
|
|
2407
|
+
responseStyle: 'data',
|
|
2408
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2409
|
+
in: 'cookie',
|
|
2410
|
+
name: 'talqing_session',
|
|
2411
|
+
type: 'apiKey'
|
|
2412
|
+
}],
|
|
2413
|
+
url: '/v1/knowledge/{kb_id}/nodes/{node_id}',
|
|
2414
|
+
...options,
|
|
2415
|
+
...params,
|
|
2416
|
+
headers: {
|
|
2417
|
+
'Content-Type': 'application/json',
|
|
2418
|
+
...options?.headers,
|
|
2419
|
+
...params.headers
|
|
2420
|
+
}
|
|
2421
|
+
});
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
export class Pages extends HeyApiClient {
|
|
2425
|
+
/**
|
|
2426
|
+
* List Pages
|
|
2427
|
+
*
|
|
2428
|
+
* List the crawled pages and how each one transcribed.
|
|
2429
|
+
*
|
|
2430
|
+
* Where you look when a knowledge base is missing something: a page with a
|
|
2431
|
+
* non-`done` status and an `error` never made it in, and `content_len` of 0
|
|
2432
|
+
* means the URL yielded nothing worth indexing.
|
|
2433
|
+
*/
|
|
2434
|
+
list(parameters, options) {
|
|
2435
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
2436
|
+
{ in: 'path', key: 'kb_id' },
|
|
2437
|
+
{ in: 'query', key: 'limit' },
|
|
2438
|
+
{ in: 'query', key: 'offset' }
|
|
2439
|
+
] }]);
|
|
2440
|
+
return (options?.client ?? this.client).get({
|
|
2441
|
+
responseStyle: 'data',
|
|
2442
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2443
|
+
in: 'cookie',
|
|
2444
|
+
name: 'talqing_session',
|
|
2445
|
+
type: 'apiKey'
|
|
2446
|
+
}],
|
|
2447
|
+
url: '/v1/knowledge/{kb_id}/pages',
|
|
2448
|
+
...options,
|
|
2449
|
+
...params
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
export class Knowledge2 extends HeyApiClient {
|
|
2454
|
+
/**
|
|
2455
|
+
* List Kbs
|
|
2456
|
+
*
|
|
2457
|
+
* List the workspace's knowledge bases with their build status.
|
|
2458
|
+
*
|
|
2459
|
+
* A knowledge base gives an agent grounded answers over crawled content. Only
|
|
2460
|
+
* one with status `ready` can be attached to an agent, through the agent
|
|
2461
|
+
* config's `kb_ids`.
|
|
2462
|
+
*/
|
|
2463
|
+
list(parameters, options) {
|
|
2464
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
2465
|
+
return (options?.client ?? this.client).get({
|
|
2466
|
+
responseStyle: 'data',
|
|
2467
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2468
|
+
in: 'cookie',
|
|
2469
|
+
name: 'talqing_session',
|
|
2470
|
+
type: 'apiKey'
|
|
2471
|
+
}],
|
|
2472
|
+
url: '/v1/knowledge',
|
|
2473
|
+
...options,
|
|
2474
|
+
...params
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Create Kb
|
|
2479
|
+
*
|
|
2480
|
+
* Start a knowledge base by crawling one or more websites.
|
|
2481
|
+
*
|
|
2482
|
+
* Returns immediately with `status: discovering` — crawling takes minutes.
|
|
2483
|
+
* Poll `get_kb` until `review`, then pass the URLs worth indexing to
|
|
2484
|
+
* `build_kb`. `max_pages` caps how many discovery may find (default 1000) and
|
|
2485
|
+
* `notes` guides how the content is transcribed and organized.
|
|
2486
|
+
*/
|
|
2487
|
+
create(parameters, options) {
|
|
2488
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createKbRequest', map: 'body' }] }]);
|
|
2489
|
+
return (options?.client ?? this.client).post({
|
|
2490
|
+
responseStyle: 'data',
|
|
2491
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2492
|
+
in: 'cookie',
|
|
2493
|
+
name: 'talqing_session',
|
|
2494
|
+
type: 'apiKey'
|
|
2495
|
+
}],
|
|
2496
|
+
url: '/v1/knowledge',
|
|
2497
|
+
...options,
|
|
2498
|
+
...params,
|
|
2499
|
+
headers: {
|
|
2500
|
+
'Content-Type': 'application/json',
|
|
2501
|
+
...options?.headers,
|
|
2502
|
+
...params.headers
|
|
2503
|
+
}
|
|
2504
|
+
});
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* Delete Kb
|
|
2508
|
+
*
|
|
2509
|
+
* Delete a knowledge base and everything crawled into it, permanently.
|
|
2510
|
+
*
|
|
2511
|
+
* Rebuilding means crawling the site again. Agents that list it in `kb_ids`
|
|
2512
|
+
* lose those grounded answers, so detach it there first.
|
|
2513
|
+
*/
|
|
2514
|
+
delete(parameters, options) {
|
|
2515
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }] }]);
|
|
2516
|
+
return (options?.client ?? this.client).delete({
|
|
2517
|
+
responseStyle: 'data',
|
|
2518
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2519
|
+
in: 'cookie',
|
|
2520
|
+
name: 'talqing_session',
|
|
2521
|
+
type: 'apiKey'
|
|
2522
|
+
}],
|
|
2523
|
+
url: '/v1/knowledge/{kb_id}',
|
|
2524
|
+
...options,
|
|
2525
|
+
...params
|
|
2526
|
+
});
|
|
2527
|
+
}
|
|
2528
|
+
/**
|
|
2529
|
+
* Get Kb
|
|
2530
|
+
*
|
|
2531
|
+
* Read one knowledge base: build status, progress and content tree.
|
|
2532
|
+
*
|
|
2533
|
+
* `status` walks `discovering` -> `review` -> `transcribing` -> `generating`
|
|
2534
|
+
* -> `ready`, with `error` set if it stopped. At `review`, `discovered` holds
|
|
2535
|
+
* the crawled URLs awaiting your selection; once ready, `tree` is the table of
|
|
2536
|
+
* contents. This is the endpoint to poll while a build runs.
|
|
2537
|
+
*/
|
|
2538
|
+
get(parameters, options) {
|
|
2539
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }] }]);
|
|
2540
|
+
return (options?.client ?? this.client).get({
|
|
2541
|
+
responseStyle: 'data',
|
|
2542
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2543
|
+
in: 'cookie',
|
|
2544
|
+
name: 'talqing_session',
|
|
2545
|
+
type: 'apiKey'
|
|
2546
|
+
}],
|
|
2547
|
+
url: '/v1/knowledge/{kb_id}',
|
|
2548
|
+
...options,
|
|
2549
|
+
...params
|
|
2550
|
+
});
|
|
2551
|
+
}
|
|
2552
|
+
/**
|
|
2553
|
+
* Build Kb
|
|
2554
|
+
*
|
|
2555
|
+
* Index the chosen pages, then write the table of contents.
|
|
2556
|
+
*
|
|
2557
|
+
* Call this once the knowledge base reaches `review`, passing the subset of
|
|
2558
|
+
* `discovered` URLs worth indexing — the KB is only as good as that choice.
|
|
2559
|
+
* Returns as soon as the work is queued; poll `get_kb` until `ready`, which is
|
|
2560
|
+
* when it can be attached to an agent.
|
|
2561
|
+
*/
|
|
2562
|
+
build(parameters, options) {
|
|
2563
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }, { key: 'buildKbRequest', map: 'body' }] }]);
|
|
2564
|
+
return (options?.client ?? this.client).post({
|
|
2565
|
+
responseStyle: 'data',
|
|
2566
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2567
|
+
in: 'cookie',
|
|
2568
|
+
name: 'talqing_session',
|
|
2569
|
+
type: 'apiKey'
|
|
2570
|
+
}],
|
|
2571
|
+
url: '/v1/knowledge/{kb_id}/build',
|
|
2572
|
+
...options,
|
|
2573
|
+
...params,
|
|
2574
|
+
headers: {
|
|
2575
|
+
'Content-Type': 'application/json',
|
|
2576
|
+
...options?.headers,
|
|
2577
|
+
...params.headers
|
|
2578
|
+
}
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Events
|
|
2583
|
+
*
|
|
2584
|
+
* Watch one knowledge base build: `snapshot` first, then `progress` and `status`.
|
|
2585
|
+
*
|
|
2586
|
+
* `progress` carries the per-stage counts, `status` the terminal verdict
|
|
2587
|
+
* (`ready`, or an `error`). The same state is readable at any time with
|
|
2588
|
+
* `get_kb`; this is the live view of it.
|
|
2589
|
+
*/
|
|
2590
|
+
events(parameters, options) {
|
|
2591
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }] }]);
|
|
2592
|
+
return (options?.client ?? this.client).sse.get({
|
|
2593
|
+
responseStyle: 'data',
|
|
2594
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2595
|
+
in: 'cookie',
|
|
2596
|
+
name: 'talqing_session',
|
|
2597
|
+
type: 'apiKey'
|
|
2598
|
+
}],
|
|
2599
|
+
url: '/v1/knowledge/{kb_id}/events',
|
|
2600
|
+
...options,
|
|
2601
|
+
...params
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2604
|
+
/**
|
|
2605
|
+
* Get Kb Prompt
|
|
2606
|
+
*
|
|
2607
|
+
* The table of contents exactly as an agent using this KB is given it.
|
|
2608
|
+
*
|
|
2609
|
+
* Read it to judge what the agent can actually find — if a topic reads
|
|
2610
|
+
* vaguely here, the agent will not know to fetch it. `chars` is how much of
|
|
2611
|
+
* the agent's context this KB occupies.
|
|
2612
|
+
*/
|
|
2613
|
+
prompt(parameters, options) {
|
|
2614
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }] }]);
|
|
2615
|
+
return (options?.client ?? this.client).get({
|
|
2616
|
+
responseStyle: 'data',
|
|
2617
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2618
|
+
in: 'cookie',
|
|
2619
|
+
name: 'talqing_session',
|
|
2620
|
+
type: 'apiKey'
|
|
2621
|
+
}],
|
|
2622
|
+
url: '/v1/knowledge/{kb_id}/prompt',
|
|
2623
|
+
...options,
|
|
2624
|
+
...params
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
/**
|
|
2628
|
+
* Regenerate Toc
|
|
2629
|
+
*
|
|
2630
|
+
* Rewrite the table of contents from the pages already indexed.
|
|
2631
|
+
*
|
|
2632
|
+
* The repair for a knowledge base whose structure came out wrong, or whose
|
|
2633
|
+
* build failed at the last stage: it re-runs only that stage, so the site is
|
|
2634
|
+
* not crawled or transcribed again.
|
|
2635
|
+
*/
|
|
2636
|
+
regenerateToc(parameters, options) {
|
|
2637
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'kb_id' }] }]);
|
|
2638
|
+
return (options?.client ?? this.client).post({
|
|
2639
|
+
responseStyle: 'data',
|
|
2640
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2641
|
+
in: 'cookie',
|
|
2642
|
+
name: 'talqing_session',
|
|
2643
|
+
type: 'apiKey'
|
|
2644
|
+
}],
|
|
2645
|
+
url: '/v1/knowledge/{kb_id}/toc',
|
|
2646
|
+
...options,
|
|
2647
|
+
...params
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
get nodes() {
|
|
2651
|
+
return this._nodes ?? (this._nodes = new Nodes({ client: this.client }));
|
|
2652
|
+
}
|
|
2653
|
+
get pages() {
|
|
2654
|
+
return this._pages ?? (this._pages = new Pages({ client: this.client }));
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
export class Tokens extends HeyApiClient {
|
|
2658
|
+
/**
|
|
2659
|
+
* Mcp Token
|
|
2660
|
+
*
|
|
2661
|
+
* This user's MCP token, in plaintext, with the API URL to pair it with.
|
|
2662
|
+
*
|
|
2663
|
+
* Unlike a token created by hand, this one can be read whenever it is needed:
|
|
2664
|
+
* the dashboard renders it into ready-to-paste MCP configuration for Claude
|
|
2665
|
+
* Code, Codex and Grok. The value is re-derived from the token's row, not
|
|
2666
|
+
* stored, and is the same string every time — so a configuration a user
|
|
2667
|
+
* already saved keeps working.
|
|
2668
|
+
*
|
|
2669
|
+
* It is always the caller's own token, never anyone else's, and is created on
|
|
2670
|
+
* the spot for a user who somehow has none. Delete it from the tokens list to
|
|
2671
|
+
* revoke it; the next call issues a new one, which rotates the credential.
|
|
2672
|
+
*/
|
|
2673
|
+
mcp(options) {
|
|
2674
|
+
return (options?.client ?? this.client).get({
|
|
2675
|
+
responseStyle: 'data',
|
|
2676
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2677
|
+
in: 'cookie',
|
|
2678
|
+
name: 'talqing_session',
|
|
2679
|
+
type: 'apiKey'
|
|
2680
|
+
}],
|
|
2681
|
+
url: '/v1/mcp-token',
|
|
2682
|
+
...options
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2685
|
+
/**
|
|
2686
|
+
* List Tokens
|
|
2687
|
+
*
|
|
2688
|
+
* List personal access tokens: your own, or every one in the organization
|
|
2689
|
+
* if you are an admin.
|
|
2690
|
+
*
|
|
2691
|
+
* Who holds which credential is organization-admin information, so an EDITOR
|
|
2692
|
+
* or VIEWER sees only what they created. Plaintext token values are never
|
|
2693
|
+
* returned. A token with `kind: mcp` was issued automatically for the
|
|
2694
|
+
* dashboard's MCP setup; the rest were created by hand.
|
|
2695
|
+
*/
|
|
2696
|
+
list(parameters, options) {
|
|
2697
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
2698
|
+
return (options?.client ?? this.client).get({
|
|
2699
|
+
responseStyle: 'data',
|
|
2700
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2701
|
+
in: 'cookie',
|
|
2702
|
+
name: 'talqing_session',
|
|
2703
|
+
type: 'apiKey'
|
|
2704
|
+
}],
|
|
2705
|
+
url: '/v1/tokens',
|
|
2706
|
+
...options,
|
|
2707
|
+
...params
|
|
2708
|
+
});
|
|
2709
|
+
}
|
|
2710
|
+
/**
|
|
2711
|
+
* Create Token
|
|
2712
|
+
*
|
|
2713
|
+
* Create a personal access token for driving this API without the dashboard.
|
|
2714
|
+
*
|
|
2715
|
+
* The token authenticates as its creator and acts with that user's live role,
|
|
2716
|
+
* so it can never do more than they can. It does not expire; deleting it is
|
|
2717
|
+
* the revocation. The plaintext value is returned once here and never again —
|
|
2718
|
+
* treat it like a password and do not echo it back into a conversation.
|
|
2719
|
+
*/
|
|
2720
|
+
create(parameters, options) {
|
|
2721
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createTokenRequest', map: 'body' }] }]);
|
|
2722
|
+
return (options?.client ?? this.client).post({
|
|
2723
|
+
responseStyle: 'data',
|
|
2724
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2725
|
+
in: 'cookie',
|
|
2726
|
+
name: 'talqing_session',
|
|
2727
|
+
type: 'apiKey'
|
|
2728
|
+
}],
|
|
2729
|
+
url: '/v1/tokens',
|
|
2730
|
+
...options,
|
|
2731
|
+
...params,
|
|
2732
|
+
headers: {
|
|
2733
|
+
'Content-Type': 'application/json',
|
|
2734
|
+
...options?.headers,
|
|
2735
|
+
...params.headers
|
|
2736
|
+
}
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
/**
|
|
2740
|
+
* Delete Token
|
|
2741
|
+
*
|
|
2742
|
+
* Revoke a token immediately and permanently.
|
|
2743
|
+
*
|
|
2744
|
+
* Owners can delete their own; organization admins can delete any in the
|
|
2745
|
+
* organization. Deleting an `mcp` token rotates it: the owner's next dashboard
|
|
2746
|
+
* visit issues a replacement, and anything still configured with the old one
|
|
2747
|
+
* stops working.
|
|
2748
|
+
*/
|
|
2749
|
+
delete(parameters, options) {
|
|
2750
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'token_id' }] }]);
|
|
2751
|
+
return (options?.client ?? this.client).delete({
|
|
2752
|
+
responseStyle: 'data',
|
|
2753
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2754
|
+
in: 'cookie',
|
|
2755
|
+
name: 'talqing_session',
|
|
2756
|
+
type: 'apiKey'
|
|
2757
|
+
}],
|
|
2758
|
+
url: '/v1/tokens/{token_id}',
|
|
2759
|
+
...options,
|
|
2760
|
+
...params
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
export class Observability extends HeyApiClient {
|
|
2765
|
+
/**
|
|
2766
|
+
* Get Observability
|
|
2767
|
+
*
|
|
2768
|
+
* Workspace analytics: volume, endings, recordings, response time and spend.
|
|
2769
|
+
* One snapshot of a date range, up to 7 days.
|
|
2770
|
+
*
|
|
2771
|
+
* `summary` is the range total, `daily` one row per day, and `volume` the same
|
|
2772
|
+
* days cut by dimension (agent, phone number, type, status, close reason,
|
|
2773
|
+
* recording, analysis, transfer) — each capped at eight series with the tail
|
|
2774
|
+
* rolled into `Other`. `latency` reports response time per model stage and
|
|
2775
|
+
* `cost` breaks the bill down by stage, provider and model.
|
|
2776
|
+
*
|
|
2777
|
+
* Narrow it with `agent_id` and `channel`; `timezone` decides day boundaries.
|
|
2778
|
+
*
|
|
2779
|
+
* Two traps. `latency.basis` is `per_turn` for voice and video and `per_call`
|
|
2780
|
+
* for text, so the two are never averaged into one number. And every rate is
|
|
2781
|
+
* over a subset — `success_rate` over `judged_sessions`, `cost` over
|
|
2782
|
+
* `priced_sessions`, latency over `measured_sessions`.
|
|
2783
|
+
*/
|
|
2784
|
+
get(parameters, options) {
|
|
2785
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
2786
|
+
{ in: 'query', key: 'start_date' },
|
|
2787
|
+
{ in: 'query', key: 'end_date' },
|
|
2788
|
+
{ in: 'query', key: 'timezone' },
|
|
2789
|
+
{ in: 'query', key: 'agent_id' },
|
|
2790
|
+
{ in: 'query', key: 'channel' }
|
|
2791
|
+
] }]);
|
|
2792
|
+
return (options?.client ?? this.client).get({
|
|
2793
|
+
responseStyle: 'data',
|
|
2794
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2795
|
+
in: 'cookie',
|
|
2796
|
+
name: 'talqing_session',
|
|
2797
|
+
type: 'apiKey'
|
|
2798
|
+
}],
|
|
2799
|
+
url: '/v1/observability',
|
|
2800
|
+
...options,
|
|
2801
|
+
...params
|
|
2802
|
+
});
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
export class Invites extends HeyApiClient {
|
|
2806
|
+
/**
|
|
2807
|
+
* List Invites
|
|
2808
|
+
*
|
|
2809
|
+
* Invites waiting on a first login. Accepted and revoked ones drop off the
|
|
2810
|
+
* list — an accepted invite is a member, and belongs on the roster instead.
|
|
2811
|
+
*/
|
|
2812
|
+
list(parameters, options) {
|
|
2813
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
2814
|
+
return (options?.client ?? this.client).get({
|
|
2815
|
+
responseStyle: 'data',
|
|
2816
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2817
|
+
in: 'cookie',
|
|
2818
|
+
name: 'talqing_session',
|
|
2819
|
+
type: 'apiKey'
|
|
2820
|
+
}],
|
|
2821
|
+
url: '/v1/org/invites',
|
|
2822
|
+
...options,
|
|
2823
|
+
...params
|
|
2824
|
+
});
|
|
2825
|
+
}
|
|
2826
|
+
/**
|
|
2827
|
+
* Create Invite
|
|
2828
|
+
*
|
|
2829
|
+
* Invite an email address into this organization with a role.
|
|
2830
|
+
*
|
|
2831
|
+
* There is no invite link and no accept step: the invite is keyed to a Google
|
|
2832
|
+
* identity, so signing in with that address *is* the check. Someone who
|
|
2833
|
+
* already has an account joins immediately; anyone else joins the first time
|
|
2834
|
+
* they sign in.
|
|
2835
|
+
*
|
|
2836
|
+
* No email is sent at MVP, so an existing user finds out by seeing the
|
|
2837
|
+
* organization appear in their switcher — tell them yourself.
|
|
2838
|
+
*/
|
|
2839
|
+
create(parameters, options) {
|
|
2840
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'inviteRequest', map: 'body' }] }]);
|
|
2841
|
+
return (options?.client ?? this.client).post({
|
|
2842
|
+
responseStyle: 'data',
|
|
2843
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2844
|
+
in: 'cookie',
|
|
2845
|
+
name: 'talqing_session',
|
|
2846
|
+
type: 'apiKey'
|
|
2847
|
+
}],
|
|
2848
|
+
url: '/v1/org/invites',
|
|
2849
|
+
...options,
|
|
2850
|
+
...params,
|
|
2851
|
+
headers: {
|
|
2852
|
+
'Content-Type': 'application/json',
|
|
2853
|
+
...options?.headers,
|
|
2854
|
+
...params.headers
|
|
2855
|
+
}
|
|
2856
|
+
});
|
|
2857
|
+
}
|
|
2858
|
+
/**
|
|
2859
|
+
* Revoke Invite
|
|
2860
|
+
*
|
|
2861
|
+
* Withdraw a pending invite, so signing in with that address no longer
|
|
2862
|
+
* joins this organization.
|
|
2863
|
+
*/
|
|
2864
|
+
revoke(parameters, options) {
|
|
2865
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'invite_id' }] }]);
|
|
2866
|
+
return (options?.client ?? this.client).delete({
|
|
2867
|
+
responseStyle: 'data',
|
|
2868
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2869
|
+
in: 'cookie',
|
|
2870
|
+
name: 'talqing_session',
|
|
2871
|
+
type: 'apiKey'
|
|
2872
|
+
}],
|
|
2873
|
+
url: '/v1/org/invites/{invite_id}',
|
|
2874
|
+
...options,
|
|
2875
|
+
...params
|
|
2876
|
+
});
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
export class Members extends HeyApiClient {
|
|
2880
|
+
/**
|
|
2881
|
+
* List Members
|
|
2882
|
+
*
|
|
2883
|
+
* Every member sees the roster; only an ADMIN can change it.
|
|
2884
|
+
*/
|
|
2885
|
+
list(parameters, options) {
|
|
2886
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
2887
|
+
return (options?.client ?? this.client).get({
|
|
2888
|
+
responseStyle: 'data',
|
|
2889
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2890
|
+
in: 'cookie',
|
|
2891
|
+
name: 'talqing_session',
|
|
2892
|
+
type: 'apiKey'
|
|
2893
|
+
}],
|
|
2894
|
+
url: '/v1/org/members',
|
|
2895
|
+
...options,
|
|
2896
|
+
...params
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
2899
|
+
/**
|
|
2900
|
+
* Remove Member
|
|
2901
|
+
*
|
|
2902
|
+
* Remove someone from this organization.
|
|
2903
|
+
*
|
|
2904
|
+
* They lose access on their next request, and their access tokens for this
|
|
2905
|
+
* organization stop working with them. Nothing they created is deleted.
|
|
2906
|
+
*
|
|
2907
|
+
* Allowed even when this is the only organization they belong to — whether
|
|
2908
|
+
* they have somewhere else to go is not this organization's problem, and their
|
|
2909
|
+
* next sign-in gives them one of their own.
|
|
2910
|
+
*/
|
|
2911
|
+
remove(parameters, options) {
|
|
2912
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'user_id' }] }]);
|
|
2913
|
+
return (options?.client ?? this.client).delete({
|
|
2914
|
+
responseStyle: 'data',
|
|
2915
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2916
|
+
in: 'cookie',
|
|
2917
|
+
name: 'talqing_session',
|
|
2918
|
+
type: 'apiKey'
|
|
2919
|
+
}],
|
|
2920
|
+
url: '/v1/org/members/{user_id}',
|
|
2921
|
+
...options,
|
|
2922
|
+
...params
|
|
2923
|
+
});
|
|
2924
|
+
}
|
|
2925
|
+
/**
|
|
2926
|
+
* Set Member Role
|
|
2927
|
+
*
|
|
2928
|
+
* Change a member's role. Takes effect on their very next request.
|
|
2929
|
+
*/
|
|
2930
|
+
setRole(parameters, options) {
|
|
2931
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'user_id' }, { key: 'roleRequest', map: 'body' }] }]);
|
|
2932
|
+
return (options?.client ?? this.client).patch({
|
|
2933
|
+
responseStyle: 'data',
|
|
2934
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2935
|
+
in: 'cookie',
|
|
2936
|
+
name: 'talqing_session',
|
|
2937
|
+
type: 'apiKey'
|
|
2938
|
+
}],
|
|
2939
|
+
url: '/v1/org/members/{user_id}',
|
|
2940
|
+
...options,
|
|
2941
|
+
...params,
|
|
2942
|
+
headers: {
|
|
2943
|
+
'Content-Type': 'application/json',
|
|
2944
|
+
...options?.headers,
|
|
2945
|
+
...params.headers
|
|
2946
|
+
}
|
|
2947
|
+
});
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
export class Orgs extends HeyApiClient {
|
|
2951
|
+
/**
|
|
2952
|
+
* Patch Org
|
|
2953
|
+
*
|
|
2954
|
+
* Change this organization's name or its data retention policy.
|
|
2955
|
+
*
|
|
2956
|
+
* The name is display only — nothing keys on it.
|
|
2957
|
+
*
|
|
2958
|
+
* `retention_days` is how long call and conversation *content* is kept:
|
|
2959
|
+
* recordings, transcripts, summaries, extracted fields and the phone numbers
|
|
2960
|
+
* on a call. When it passes, all of that is deleted and the call itself
|
|
2961
|
+
* remains, with its duration, outcome and cost, so past invoices still
|
|
2962
|
+
* resolve. `null` keeps everything forever, which is the default.
|
|
2963
|
+
*
|
|
2964
|
+
* It applies to calls from now on: a call already in the system keeps the
|
|
2965
|
+
* deadline it was given when it ended, so shortening the policy never
|
|
2966
|
+
* retroactively destroys anything. Erasing a contact's last call also resets
|
|
2967
|
+
* what your agents remember about that person.
|
|
2968
|
+
*/
|
|
2969
|
+
update(parameters, options) {
|
|
2970
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'patchOrgRequest', map: 'body' }] }]);
|
|
2971
|
+
return (options?.client ?? this.client).patch({
|
|
2972
|
+
responseStyle: 'data',
|
|
2973
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2974
|
+
in: 'cookie',
|
|
2975
|
+
name: 'talqing_session',
|
|
2976
|
+
type: 'apiKey'
|
|
2977
|
+
}],
|
|
2978
|
+
url: '/v1/org',
|
|
2979
|
+
...options,
|
|
2980
|
+
...params,
|
|
2981
|
+
headers: {
|
|
2982
|
+
'Content-Type': 'application/json',
|
|
2983
|
+
...options?.headers,
|
|
2984
|
+
...params.headers
|
|
2985
|
+
}
|
|
2986
|
+
});
|
|
2987
|
+
}
|
|
2988
|
+
/**
|
|
2989
|
+
* Leave Org
|
|
2990
|
+
*
|
|
2991
|
+
* Leave this organization. Any member may, including an admin who has
|
|
2992
|
+
* promoted a successor. Nothing they created is deleted.
|
|
2993
|
+
*/
|
|
2994
|
+
leave(options) {
|
|
2995
|
+
return (options?.client ?? this.client).post({
|
|
2996
|
+
responseStyle: 'data',
|
|
2997
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
2998
|
+
in: 'cookie',
|
|
2999
|
+
name: 'talqing_session',
|
|
3000
|
+
type: 'apiKey'
|
|
3001
|
+
}],
|
|
3002
|
+
url: '/v1/org/leave',
|
|
3003
|
+
...options
|
|
3004
|
+
});
|
|
3005
|
+
}
|
|
3006
|
+
/**
|
|
3007
|
+
* List Orgs
|
|
3008
|
+
*
|
|
3009
|
+
* Every organization the signed-in user belongs to, with their role in each.
|
|
3010
|
+
*
|
|
3011
|
+
* Newest membership first, deliberately: an admin can add you to their
|
|
3012
|
+
* organization without you being asked or emailed, so the one you did not know
|
|
3013
|
+
* about is the one that needs to be visible.
|
|
3014
|
+
*/
|
|
3015
|
+
list(parameters, options) {
|
|
3016
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
3017
|
+
return (options?.client ?? this.client).get({
|
|
3018
|
+
responseStyle: 'data',
|
|
3019
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3020
|
+
in: 'cookie',
|
|
3021
|
+
name: 'talqing_session',
|
|
3022
|
+
type: 'apiKey'
|
|
3023
|
+
}],
|
|
3024
|
+
url: '/v1/orgs',
|
|
3025
|
+
...options,
|
|
3026
|
+
...params
|
|
3027
|
+
});
|
|
3028
|
+
}
|
|
3029
|
+
/**
|
|
3030
|
+
* Create Org
|
|
3031
|
+
*
|
|
3032
|
+
* Create a new, empty organization with the caller as its ADMIN.
|
|
3033
|
+
*
|
|
3034
|
+
* Any member can do this — it grants nothing in the organization they are
|
|
3035
|
+
* currently in. Switch into it to start working there.
|
|
3036
|
+
*/
|
|
3037
|
+
create(parameters, options) {
|
|
3038
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'orgNameRequest', map: 'body' }] }]);
|
|
3039
|
+
return (options?.client ?? this.client).post({
|
|
3040
|
+
responseStyle: 'data',
|
|
3041
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3042
|
+
in: 'cookie',
|
|
3043
|
+
name: 'talqing_session',
|
|
3044
|
+
type: 'apiKey'
|
|
3045
|
+
}],
|
|
3046
|
+
url: '/v1/orgs',
|
|
3047
|
+
...options,
|
|
3048
|
+
...params,
|
|
3049
|
+
headers: {
|
|
3050
|
+
'Content-Type': 'application/json',
|
|
3051
|
+
...options?.headers,
|
|
3052
|
+
...params.headers
|
|
3053
|
+
}
|
|
3054
|
+
});
|
|
3055
|
+
}
|
|
3056
|
+
/**
|
|
3057
|
+
* Switch Org
|
|
3058
|
+
*
|
|
3059
|
+
* Point the dashboard session at another of the caller's organizations.
|
|
3060
|
+
*
|
|
3061
|
+
* The session cookie carries the organization, so switching re-issues it — the
|
|
3062
|
+
* caller's role, resources and billing all move with it. Reload after this.
|
|
3063
|
+
*/
|
|
3064
|
+
switch(parameters, options) {
|
|
3065
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'org_id' }] }]);
|
|
3066
|
+
return (options?.client ?? this.client).post({
|
|
3067
|
+
responseStyle: 'data',
|
|
3068
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3069
|
+
in: 'cookie',
|
|
3070
|
+
name: 'talqing_session',
|
|
3071
|
+
type: 'apiKey'
|
|
3072
|
+
}],
|
|
3073
|
+
url: '/v1/orgs/{org_id}/switch',
|
|
3074
|
+
...options,
|
|
3075
|
+
...params
|
|
3076
|
+
});
|
|
3077
|
+
}
|
|
3078
|
+
get invites() {
|
|
3079
|
+
return this._invites ?? (this._invites = new Invites({ client: this.client }));
|
|
3080
|
+
}
|
|
3081
|
+
get members() {
|
|
3082
|
+
return this._members ?? (this._members = new Members({ client: this.client }));
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
export class Schemas extends HeyApiClient {
|
|
3086
|
+
/**
|
|
3087
|
+
* Describe Schema
|
|
3088
|
+
*
|
|
3089
|
+
* The full JSON Schema of one of the five large request types.
|
|
3090
|
+
*
|
|
3091
|
+
* An argument whose description ends in `describe_schema('X')` carries only a
|
|
3092
|
+
* placeholder for its shape — fetch the real one here before writing it.
|
|
3093
|
+
*
|
|
3094
|
+
* - `AgentConfig` — a whole agent definition; what `create_agent` takes.
|
|
3095
|
+
* - `AgentOverride` — the same tree, every field optional, for one call.
|
|
3096
|
+
* - `AgentTeam` — several agents on one call, handing off to each other.
|
|
3097
|
+
* - `TaskConfig` — an agent task: inputs, output shape, model stack.
|
|
3098
|
+
* - `ToolOperations` — the operation tree a custom tool runs.
|
|
3099
|
+
*
|
|
3100
|
+
* These compose, so a document you fetch may itself defer to another.
|
|
3101
|
+
*/
|
|
3102
|
+
get(parameters, options) {
|
|
3103
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }] }]);
|
|
3104
|
+
return (options?.client ?? this.client).get({
|
|
3105
|
+
responseStyle: 'data',
|
|
3106
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3107
|
+
in: 'cookie',
|
|
3108
|
+
name: 'talqing_session',
|
|
3109
|
+
type: 'apiKey'
|
|
3110
|
+
}],
|
|
3111
|
+
url: '/v1/schemas/{name}',
|
|
3112
|
+
...options,
|
|
3113
|
+
...params
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
export class Secrets extends HeyApiClient {
|
|
3118
|
+
/**
|
|
3119
|
+
* List Secrets
|
|
3120
|
+
*
|
|
3121
|
+
* List the workspace's secrets by name, with a masked hint of each value.
|
|
3122
|
+
*
|
|
3123
|
+
* Values are write-only: once stored, a secret can only be read by the runtime
|
|
3124
|
+
* through a `{{secrets.NAME}}` reference.
|
|
3125
|
+
*/
|
|
3126
|
+
list(parameters, options) {
|
|
3127
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
3128
|
+
return (options?.client ?? this.client).get({
|
|
3129
|
+
responseStyle: 'data',
|
|
3130
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3131
|
+
in: 'cookie',
|
|
3132
|
+
name: 'talqing_session',
|
|
3133
|
+
type: 'apiKey'
|
|
3134
|
+
}],
|
|
3135
|
+
url: '/v1/secrets',
|
|
3136
|
+
...options,
|
|
3137
|
+
...params
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
/**
|
|
3141
|
+
* Create Secret
|
|
3142
|
+
*
|
|
3143
|
+
* Store a secret, replacing any existing one with the same name.
|
|
3144
|
+
*
|
|
3145
|
+
* `name` must be a valid identifier and is how tool operations and integration
|
|
3146
|
+
* config refer to the value, as `{{secrets.NAME}}`. Organization admins only.
|
|
3147
|
+
*/
|
|
3148
|
+
create(parameters, options) {
|
|
3149
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createSecretRequest', map: 'body' }] }]);
|
|
3150
|
+
return (options?.client ?? this.client).post({
|
|
3151
|
+
responseStyle: 'data',
|
|
3152
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3153
|
+
in: 'cookie',
|
|
3154
|
+
name: 'talqing_session',
|
|
3155
|
+
type: 'apiKey'
|
|
3156
|
+
}],
|
|
3157
|
+
url: '/v1/secrets',
|
|
3158
|
+
...options,
|
|
3159
|
+
...params,
|
|
3160
|
+
headers: {
|
|
3161
|
+
'Content-Type': 'application/json',
|
|
3162
|
+
...options?.headers,
|
|
3163
|
+
...params.headers
|
|
3164
|
+
}
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3167
|
+
/**
|
|
3168
|
+
* Delete Secret
|
|
3169
|
+
*
|
|
3170
|
+
* Delete a secret permanently. Anything still referencing it will fail to
|
|
3171
|
+
* resolve at runtime. Organization admins only.
|
|
3172
|
+
*/
|
|
3173
|
+
delete(parameters, options) {
|
|
3174
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'secret_id' }] }]);
|
|
3175
|
+
return (options?.client ?? this.client).delete({
|
|
3176
|
+
responseStyle: 'data',
|
|
3177
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3178
|
+
in: 'cookie',
|
|
3179
|
+
name: 'talqing_session',
|
|
3180
|
+
type: 'apiKey'
|
|
3181
|
+
}],
|
|
3182
|
+
url: '/v1/secrets/{secret_id}',
|
|
3183
|
+
...options,
|
|
3184
|
+
...params
|
|
3185
|
+
});
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
export class Runs extends HeyApiClient {
|
|
3189
|
+
/**
|
|
3190
|
+
* List Task Runs
|
|
3191
|
+
*
|
|
3192
|
+
* This task's runs, newest first, each with its output, trace and cost.
|
|
3193
|
+
*
|
|
3194
|
+
* A run records the task's *name* and nothing else about the definition it ran
|
|
3195
|
+
* under, so two runs either side of an edit are indistinguishable here.
|
|
3196
|
+
*/
|
|
3197
|
+
list(parameters, options) {
|
|
3198
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
3199
|
+
{ in: 'path', key: 'task_id' },
|
|
3200
|
+
{ in: 'query', key: 'limit' },
|
|
3201
|
+
{ in: 'query', key: 'offset' }
|
|
3202
|
+
] }]);
|
|
3203
|
+
return (options?.client ?? this.client).get({
|
|
3204
|
+
responseStyle: 'data',
|
|
3205
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3206
|
+
in: 'cookie',
|
|
3207
|
+
name: 'talqing_session',
|
|
3208
|
+
type: 'apiKey'
|
|
3209
|
+
}],
|
|
3210
|
+
url: '/v1/tasks/{task_id}/runs',
|
|
3211
|
+
...options,
|
|
3212
|
+
...params
|
|
3213
|
+
});
|
|
3214
|
+
}
|
|
3215
|
+
/**
|
|
3216
|
+
* Run Task
|
|
3217
|
+
*
|
|
3218
|
+
* Run the task once with the variables you supply, and wait for the result.
|
|
3219
|
+
*
|
|
3220
|
+
* **This executes for real**: the tools call your endpoints with your secrets,
|
|
3221
|
+
* the MCP servers spend your credits, and the model spends your tokens. A task
|
|
3222
|
+
* that books a slot, charges a card or sends a message will do so.
|
|
3223
|
+
*
|
|
3224
|
+
* `vars` must match what the task declares — an unknown name is refused rather
|
|
3225
|
+
* than dropped. The response is the whole run: the structured `output`, a
|
|
3226
|
+
* `trace` of every tool call, the steps used and what the tokens cost. On
|
|
3227
|
+
* failure `error.type` says whose problem it is. Secrets are redacted.
|
|
3228
|
+
*/
|
|
3229
|
+
create(parameters, options) {
|
|
3230
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'runTaskRequest', map: 'body' }] }]);
|
|
3231
|
+
return (options?.client ?? this.client).post({
|
|
3232
|
+
responseStyle: 'data',
|
|
3233
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3234
|
+
in: 'cookie',
|
|
3235
|
+
name: 'talqing_session',
|
|
3236
|
+
type: 'apiKey'
|
|
3237
|
+
}],
|
|
3238
|
+
url: '/v1/tasks/{task_id}/runs',
|
|
3239
|
+
...options,
|
|
3240
|
+
...params,
|
|
3241
|
+
headers: {
|
|
3242
|
+
'Content-Type': 'application/json',
|
|
3243
|
+
...options?.headers,
|
|
3244
|
+
...params.headers
|
|
3245
|
+
}
|
|
3246
|
+
});
|
|
3247
|
+
}
|
|
3248
|
+
/**
|
|
3249
|
+
* Get Task Run
|
|
3250
|
+
*
|
|
3251
|
+
* One run in full: what it produced, every tool it called on the way, and
|
|
3252
|
+
* what it cost.
|
|
3253
|
+
*
|
|
3254
|
+
* This is what answers "why did it write that" for a caller holding one run id
|
|
3255
|
+
* — an email batch's review table links each drafted row here. Secret values
|
|
3256
|
+
* are redacted from the trace, and a trace that was cut reports it.
|
|
3257
|
+
*/
|
|
3258
|
+
get(parameters, options) {
|
|
3259
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'run_id' }] }]);
|
|
3260
|
+
return (options?.client ?? this.client).get({
|
|
3261
|
+
responseStyle: 'data',
|
|
3262
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3263
|
+
in: 'cookie',
|
|
3264
|
+
name: 'talqing_session',
|
|
3265
|
+
type: 'apiKey'
|
|
3266
|
+
}],
|
|
3267
|
+
url: '/v1/tasks/{task_id}/runs/{run_id}',
|
|
3268
|
+
...options,
|
|
3269
|
+
...params
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
export class Tasks2 extends HeyApiClient {
|
|
3274
|
+
/**
|
|
3275
|
+
* List Tasks
|
|
3276
|
+
*
|
|
3277
|
+
* List the workspace's agent tasks.
|
|
3278
|
+
*
|
|
3279
|
+
* A task is an agent nobody talks to: a prompt, one LLM, tools and MCP
|
|
3280
|
+
* servers, the variables it takes as input, and the typed result it must
|
|
3281
|
+
* produce. `last_run` says how the most recent run of each one went, so a
|
|
3282
|
+
* task whose prompt stopped calling `submit_result` is visible here rather
|
|
3283
|
+
* than only in its own history.
|
|
3284
|
+
*/
|
|
3285
|
+
list(parameters, options) {
|
|
3286
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
3287
|
+
return (options?.client ?? this.client).get({
|
|
3288
|
+
responseStyle: 'data',
|
|
3289
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3290
|
+
in: 'cookie',
|
|
3291
|
+
name: 'talqing_session',
|
|
3292
|
+
type: 'apiKey'
|
|
3293
|
+
}],
|
|
3294
|
+
url: '/v1/tasks',
|
|
3295
|
+
...options,
|
|
3296
|
+
...params
|
|
3297
|
+
});
|
|
3298
|
+
}
|
|
3299
|
+
/**
|
|
3300
|
+
* Create Task
|
|
3301
|
+
*
|
|
3302
|
+
* Create an agent task.
|
|
3303
|
+
*
|
|
3304
|
+
* A task has no draft and no publish step: it is valid the moment it saves and
|
|
3305
|
+
* callable immediately. An invalid config is a 400 listing every problem and
|
|
3306
|
+
* nothing is stored.
|
|
3307
|
+
*
|
|
3308
|
+
* `output` is what makes this a task rather than a chat agent — declare the
|
|
3309
|
+
* fields the model must produce and it is given a `submit_result` tool built
|
|
3310
|
+
* from them. `vars` are its inputs, read as `{{vars.name}}`.
|
|
3311
|
+
*
|
|
3312
|
+
* `warnings` reports the non-fatal problems. There is no publish screen to
|
|
3313
|
+
* show them on, so read them here.
|
|
3314
|
+
*/
|
|
3315
|
+
create(parameters, options) {
|
|
3316
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createTaskRequest', map: 'body' }] }]);
|
|
3317
|
+
return (options?.client ?? this.client).post({
|
|
3318
|
+
responseStyle: 'data',
|
|
3319
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3320
|
+
in: 'cookie',
|
|
3321
|
+
name: 'talqing_session',
|
|
3322
|
+
type: 'apiKey'
|
|
3323
|
+
}],
|
|
3324
|
+
url: '/v1/tasks',
|
|
3325
|
+
...options,
|
|
3326
|
+
...params,
|
|
3327
|
+
headers: {
|
|
3328
|
+
'Content-Type': 'application/json',
|
|
3329
|
+
...options?.headers,
|
|
3330
|
+
...params.headers
|
|
3331
|
+
}
|
|
3332
|
+
});
|
|
3333
|
+
}
|
|
3334
|
+
/**
|
|
3335
|
+
* Delete Task
|
|
3336
|
+
*
|
|
3337
|
+
* Delete a task. Its run history survives, still named after it.
|
|
3338
|
+
*/
|
|
3339
|
+
delete(parameters, options) {
|
|
3340
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
|
|
3341
|
+
return (options?.client ?? this.client).delete({
|
|
3342
|
+
responseStyle: 'data',
|
|
3343
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3344
|
+
in: 'cookie',
|
|
3345
|
+
name: 'talqing_session',
|
|
3346
|
+
type: 'apiKey'
|
|
3347
|
+
}],
|
|
3348
|
+
url: '/v1/tasks/{task_id}',
|
|
3349
|
+
...options,
|
|
3350
|
+
...params
|
|
3351
|
+
});
|
|
3352
|
+
}
|
|
3353
|
+
/**
|
|
3354
|
+
* Get Task
|
|
3355
|
+
*
|
|
3356
|
+
* Fetch one task's config and how its last run went.
|
|
3357
|
+
*/
|
|
3358
|
+
get(parameters, options) {
|
|
3359
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
|
|
3360
|
+
return (options?.client ?? this.client).get({
|
|
3361
|
+
responseStyle: 'data',
|
|
3362
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3363
|
+
in: 'cookie',
|
|
3364
|
+
name: 'talqing_session',
|
|
3365
|
+
type: 'apiKey'
|
|
3366
|
+
}],
|
|
3367
|
+
url: '/v1/tasks/{task_id}',
|
|
3368
|
+
...options,
|
|
3369
|
+
...params
|
|
3370
|
+
});
|
|
3371
|
+
}
|
|
3372
|
+
/**
|
|
3373
|
+
* Update Task
|
|
3374
|
+
*
|
|
3375
|
+
* Replace a task's config.
|
|
3376
|
+
*
|
|
3377
|
+
* The whole config is sent, so include every field you mean to keep, and it is
|
|
3378
|
+
* validated exactly as `create_task` is. The edit takes effect on the next run
|
|
3379
|
+
* — a task has no versions, so there is no old wording to go back to and no
|
|
3380
|
+
* record of which definition produced an earlier run.
|
|
3381
|
+
*/
|
|
3382
|
+
update(parameters, options) {
|
|
3383
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'patchTaskRequest', map: 'body' }] }]);
|
|
3384
|
+
return (options?.client ?? this.client).patch({
|
|
3385
|
+
responseStyle: 'data',
|
|
3386
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3387
|
+
in: 'cookie',
|
|
3388
|
+
name: 'talqing_session',
|
|
3389
|
+
type: 'apiKey'
|
|
3390
|
+
}],
|
|
3391
|
+
url: '/v1/tasks/{task_id}',
|
|
3392
|
+
...options,
|
|
3393
|
+
...params,
|
|
3394
|
+
headers: {
|
|
3395
|
+
'Content-Type': 'application/json',
|
|
3396
|
+
...options?.headers,
|
|
3397
|
+
...params.headers
|
|
3398
|
+
}
|
|
3399
|
+
});
|
|
3400
|
+
}
|
|
3401
|
+
get runs() {
|
|
3402
|
+
return this._runs ?? (this._runs = new Runs({ client: this.client }));
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
export class Accounts extends HeyApiClient {
|
|
3406
|
+
/**
|
|
3407
|
+
* List Telephony Accounts
|
|
3408
|
+
*
|
|
3409
|
+
* List the workspace's connected carrier accounts.
|
|
3410
|
+
*
|
|
3411
|
+
* A carrier account is the credential Talqing uses to reach a phone network;
|
|
3412
|
+
* phone numbers hang off one. `setup_complete` and `setup_steps` say whether
|
|
3413
|
+
* it is finished — including the steps that can only be done in the carrier's
|
|
3414
|
+
* own console.
|
|
3415
|
+
*/
|
|
3416
|
+
list(parameters, options) {
|
|
3417
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
3418
|
+
return (options?.client ?? this.client).get({
|
|
3419
|
+
responseStyle: 'data',
|
|
3420
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3421
|
+
in: 'cookie',
|
|
3422
|
+
name: 'talqing_session',
|
|
3423
|
+
type: 'apiKey'
|
|
3424
|
+
}],
|
|
3425
|
+
url: '/v1/telephony/accounts',
|
|
3426
|
+
...options,
|
|
3427
|
+
...params
|
|
3428
|
+
});
|
|
3429
|
+
}
|
|
3430
|
+
/**
|
|
3431
|
+
* Create Telephony Account
|
|
3432
|
+
*
|
|
3433
|
+
* Connect a carrier account so the workspace can own phone numbers.
|
|
3434
|
+
*
|
|
3435
|
+
* `account_info` and `credentials` must carry exactly the keys that carrier's
|
|
3436
|
+
* `list_telephony_providers` entry declares. A credential may be plaintext —
|
|
3437
|
+
* stored as a workspace secret — or an existing reference.
|
|
3438
|
+
*
|
|
3439
|
+
* Creating only records the credential; call `provision_telephony_account`
|
|
3440
|
+
* next to build the SIP trunk.
|
|
3441
|
+
*/
|
|
3442
|
+
create(parameters, options) {
|
|
3443
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createTelephonyAccountRequest', map: 'body' }] }]);
|
|
3444
|
+
return (options?.client ?? this.client).post({
|
|
3445
|
+
responseStyle: 'data',
|
|
3446
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3447
|
+
in: 'cookie',
|
|
3448
|
+
name: 'talqing_session',
|
|
3449
|
+
type: 'apiKey'
|
|
3450
|
+
}],
|
|
3451
|
+
url: '/v1/telephony/accounts',
|
|
3452
|
+
...options,
|
|
3453
|
+
...params,
|
|
3454
|
+
headers: {
|
|
3455
|
+
'Content-Type': 'application/json',
|
|
3456
|
+
...options?.headers,
|
|
3457
|
+
...params.headers
|
|
3458
|
+
}
|
|
3459
|
+
});
|
|
3460
|
+
}
|
|
3461
|
+
/**
|
|
3462
|
+
* Delete Telephony Account
|
|
3463
|
+
*
|
|
3464
|
+
* Disconnect a carrier account permanently.
|
|
3465
|
+
*
|
|
3466
|
+
* Every phone number on it must be disabled first, so this can never silently
|
|
3467
|
+
* take live numbers off the air. Deleting also tears down the SIP trunk.
|
|
3468
|
+
*/
|
|
3469
|
+
delete(parameters, options) {
|
|
3470
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'account_id' }] }]);
|
|
3471
|
+
return (options?.client ?? this.client).delete({
|
|
3472
|
+
responseStyle: 'data',
|
|
3473
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3474
|
+
in: 'cookie',
|
|
3475
|
+
name: 'talqing_session',
|
|
3476
|
+
type: 'apiKey'
|
|
3477
|
+
}],
|
|
3478
|
+
url: '/v1/telephony/accounts/{account_id}',
|
|
3479
|
+
...options,
|
|
3480
|
+
...params
|
|
3481
|
+
});
|
|
3482
|
+
}
|
|
3483
|
+
/**
|
|
3484
|
+
* Get Telephony Account
|
|
3485
|
+
*
|
|
3486
|
+
* Read one carrier account, including what its setup still needs.
|
|
3487
|
+
*
|
|
3488
|
+
* `setup_steps` is the authoritative checklist — read it rather than trying
|
|
3489
|
+
* to re-derive setup state from `provider_state`. A step marked
|
|
3490
|
+
* `user_confirmable` cannot be checked over any API; it is done in the
|
|
3491
|
+
* carrier's console and confirmed with `patch_telephony_account`.
|
|
3492
|
+
*/
|
|
3493
|
+
get(parameters, options) {
|
|
3494
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'account_id' }] }]);
|
|
3495
|
+
return (options?.client ?? this.client).get({
|
|
3496
|
+
responseStyle: 'data',
|
|
3497
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3498
|
+
in: 'cookie',
|
|
3499
|
+
name: 'talqing_session',
|
|
3500
|
+
type: 'apiKey'
|
|
3501
|
+
}],
|
|
3502
|
+
url: '/v1/telephony/accounts/{account_id}',
|
|
3503
|
+
...options,
|
|
3504
|
+
...params
|
|
3505
|
+
});
|
|
3506
|
+
}
|
|
3507
|
+
/**
|
|
3508
|
+
* Patch Telephony Account
|
|
3509
|
+
*
|
|
3510
|
+
* Update a carrier account: rename it, replace credentials, or disable it.
|
|
3511
|
+
*
|
|
3512
|
+
* Only the fields you send change. `status` accepts `disabled` to stop the
|
|
3513
|
+
* account and `connected` to re-enable it. Set `console_setup_confirmed` when
|
|
3514
|
+
* the user says they have finished the carrier-console steps — no API can
|
|
3515
|
+
* verify that work, and inbound calling on this account's numbers stays
|
|
3516
|
+
* blocked until they confirm.
|
|
3517
|
+
*/
|
|
3518
|
+
update(parameters, options) {
|
|
3519
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'account_id' }, { key: 'patchTelephonyAccountRequest', map: 'body' }] }]);
|
|
3520
|
+
return (options?.client ?? this.client).patch({
|
|
3521
|
+
responseStyle: 'data',
|
|
3522
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3523
|
+
in: 'cookie',
|
|
3524
|
+
name: 'talqing_session',
|
|
3525
|
+
type: 'apiKey'
|
|
3526
|
+
}],
|
|
3527
|
+
url: '/v1/telephony/accounts/{account_id}',
|
|
3528
|
+
...options,
|
|
3529
|
+
...params,
|
|
3530
|
+
headers: {
|
|
3531
|
+
'Content-Type': 'application/json',
|
|
3532
|
+
...options?.headers,
|
|
3533
|
+
...params.headers
|
|
3534
|
+
}
|
|
3535
|
+
});
|
|
3536
|
+
}
|
|
3537
|
+
/**
|
|
3538
|
+
* Provision Telephony Account
|
|
3539
|
+
*
|
|
3540
|
+
* Build (or repair) the SIP trunk between Talqing and the carrier.
|
|
3541
|
+
*
|
|
3542
|
+
* Run this after connecting an account, and again after replacing its
|
|
3543
|
+
* credentials. It is safe to repeat: it converges the carrier side to what
|
|
3544
|
+
* the account should have rather than creating a second trunk. The response's
|
|
3545
|
+
* `status` and `setup_steps` say what is working and what is left.
|
|
3546
|
+
*/
|
|
3547
|
+
provision(parameters, options) {
|
|
3548
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'account_id' }] }]);
|
|
3549
|
+
return (options?.client ?? this.client).post({
|
|
3550
|
+
responseStyle: 'data',
|
|
3551
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3552
|
+
in: 'cookie',
|
|
3553
|
+
name: 'talqing_session',
|
|
3554
|
+
type: 'apiKey'
|
|
3555
|
+
}],
|
|
3556
|
+
url: '/v1/telephony/accounts/{account_id}/provision',
|
|
3557
|
+
...options,
|
|
3558
|
+
...params
|
|
3559
|
+
});
|
|
3560
|
+
}
|
|
3561
|
+
/**
|
|
3562
|
+
* List Remote Numbers
|
|
3563
|
+
*
|
|
3564
|
+
* List the numbers this account owns at the carrier, ready to import.
|
|
3565
|
+
*
|
|
3566
|
+
* Read live from the carrier, so it also proves the credentials work.
|
|
3567
|
+
* `already_imported` marks the ones Talqing already has — pass the rest to
|
|
3568
|
+
* `import_phone_numbers`. Buying a number is done at the carrier, not here.
|
|
3569
|
+
*/
|
|
3570
|
+
remoteNumbers(parameters, options) {
|
|
3571
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
3572
|
+
{ in: 'path', key: 'account_id' },
|
|
3573
|
+
{ in: 'query', key: 'limit' },
|
|
3574
|
+
{ in: 'query', key: 'offset' }
|
|
3575
|
+
] }]);
|
|
3576
|
+
return (options?.client ?? this.client).get({
|
|
3577
|
+
responseStyle: 'data',
|
|
3578
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3579
|
+
in: 'cookie',
|
|
3580
|
+
name: 'talqing_session',
|
|
3581
|
+
type: 'apiKey'
|
|
3582
|
+
}],
|
|
3583
|
+
url: '/v1/telephony/accounts/{account_id}/remote-numbers',
|
|
3584
|
+
...options,
|
|
3585
|
+
...params
|
|
3586
|
+
});
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
export class PhoneNumbers extends HeyApiClient {
|
|
3590
|
+
/**
|
|
3591
|
+
* List Phone Numbers
|
|
3592
|
+
*
|
|
3593
|
+
* List the workspace's phone numbers, optionally for one carrier account.
|
|
3594
|
+
*
|
|
3595
|
+
* `readiness` is the field to report to a user — it collapses status,
|
|
3596
|
+
* capability and routing into the one answer they want: `live` (answering
|
|
3597
|
+
* inbound), `needs_agent`, `needs_carrier_setup`, `setting_up`, `error` or
|
|
3598
|
+
* `disabled`.
|
|
3599
|
+
*/
|
|
3600
|
+
list(parameters, options) {
|
|
3601
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
3602
|
+
{ in: 'query', key: 'account_id' },
|
|
3603
|
+
{ in: 'query', key: 'limit' },
|
|
3604
|
+
{ in: 'query', key: 'offset' }
|
|
3605
|
+
] }]);
|
|
3606
|
+
return (options?.client ?? this.client).get({
|
|
3607
|
+
responseStyle: 'data',
|
|
3608
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3609
|
+
in: 'cookie',
|
|
3610
|
+
name: 'talqing_session',
|
|
3611
|
+
type: 'apiKey'
|
|
3612
|
+
}],
|
|
3613
|
+
url: '/v1/telephony/phone-numbers',
|
|
3614
|
+
...options,
|
|
3615
|
+
...params
|
|
3616
|
+
});
|
|
3617
|
+
}
|
|
3618
|
+
/**
|
|
3619
|
+
* Import Phone Numbers
|
|
3620
|
+
*
|
|
3621
|
+
* Bring carrier-owned numbers into the workspace, provisioning each one.
|
|
3622
|
+
*
|
|
3623
|
+
* Per number, not all-or-nothing: `items` carries one result per requested
|
|
3624
|
+
* E.164, so check every `ok` rather than assuming a 200 means all of them
|
|
3625
|
+
* landed. `provision` defaults to true, which is what makes a number usable.
|
|
3626
|
+
*/
|
|
3627
|
+
import(parameters, options) {
|
|
3628
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'importPhoneNumbersRequest', map: 'body' }] }]);
|
|
3629
|
+
return (options?.client ?? this.client).post({
|
|
3630
|
+
responseStyle: 'data',
|
|
3631
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3632
|
+
in: 'cookie',
|
|
3633
|
+
name: 'talqing_session',
|
|
3634
|
+
type: 'apiKey'
|
|
3635
|
+
}],
|
|
3636
|
+
url: '/v1/telephony/phone-numbers/import',
|
|
3637
|
+
...options,
|
|
3638
|
+
...params,
|
|
3639
|
+
headers: {
|
|
3640
|
+
'Content-Type': 'application/json',
|
|
3641
|
+
...options?.headers,
|
|
3642
|
+
...params.headers
|
|
3643
|
+
}
|
|
3644
|
+
});
|
|
3645
|
+
}
|
|
3646
|
+
/**
|
|
3647
|
+
* Get Phone Number
|
|
3648
|
+
*
|
|
3649
|
+
* Read one phone number: its carrier, capabilities, agent and readiness.
|
|
3650
|
+
*/
|
|
3651
|
+
get(parameters, options) {
|
|
3652
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'number_id' }] }]);
|
|
3653
|
+
return (options?.client ?? this.client).get({
|
|
3654
|
+
responseStyle: 'data',
|
|
3655
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3656
|
+
in: 'cookie',
|
|
3657
|
+
name: 'talqing_session',
|
|
3658
|
+
type: 'apiKey'
|
|
3659
|
+
}],
|
|
3660
|
+
url: '/v1/telephony/phone-numbers/{number_id}',
|
|
3661
|
+
...options,
|
|
3662
|
+
...params
|
|
3663
|
+
});
|
|
3664
|
+
}
|
|
3665
|
+
/**
|
|
3666
|
+
* Patch Phone Number
|
|
3667
|
+
*
|
|
3668
|
+
* Relabel a number, change what it may do, or take it out of service.
|
|
3669
|
+
*
|
|
3670
|
+
* `can_inbound` and `can_outbound` gate the directions it will carry.
|
|
3671
|
+
* `status` accepts `disabled`, which tears down its LiveKit routing, and
|
|
3672
|
+
* `pending`, which re-opens a disabled number so it can be provisioned again.
|
|
3673
|
+
*/
|
|
3674
|
+
update(parameters, options) {
|
|
3675
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'number_id' }, { key: 'patchPhoneNumberRequest', map: 'body' }] }]);
|
|
3676
|
+
return (options?.client ?? this.client).patch({
|
|
3677
|
+
responseStyle: 'data',
|
|
3678
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3679
|
+
in: 'cookie',
|
|
3680
|
+
name: 'talqing_session',
|
|
3681
|
+
type: 'apiKey'
|
|
3682
|
+
}],
|
|
3683
|
+
url: '/v1/telephony/phone-numbers/{number_id}',
|
|
3684
|
+
...options,
|
|
3685
|
+
...params,
|
|
3686
|
+
headers: {
|
|
3687
|
+
'Content-Type': 'application/json',
|
|
3688
|
+
...options?.headers,
|
|
3689
|
+
...params.headers
|
|
3690
|
+
}
|
|
3691
|
+
});
|
|
3692
|
+
}
|
|
3693
|
+
/**
|
|
3694
|
+
* Assign Phone Number
|
|
3695
|
+
*
|
|
3696
|
+
* Put an agent on a number so it answers incoming calls.
|
|
3697
|
+
*
|
|
3698
|
+
* The agent must be **published** and on the `voice` or `video` channel, and
|
|
3699
|
+
* the number active, inbound-capable and on a ready carrier account — each is
|
|
3700
|
+
* refused with the reason. One agent per number; assigning again replaces the
|
|
3701
|
+
* previous one. Republishing the agent later needs no reassignment.
|
|
3702
|
+
*/
|
|
3703
|
+
assign(parameters, options) {
|
|
3704
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'number_id' }, { key: 'assignPhoneNumberRequest', map: 'body' }] }]);
|
|
3705
|
+
return (options?.client ?? this.client).post({
|
|
3706
|
+
responseStyle: 'data',
|
|
3707
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3708
|
+
in: 'cookie',
|
|
3709
|
+
name: 'talqing_session',
|
|
3710
|
+
type: 'apiKey'
|
|
3711
|
+
}],
|
|
3712
|
+
url: '/v1/telephony/phone-numbers/{number_id}/assign',
|
|
3713
|
+
...options,
|
|
3714
|
+
...params,
|
|
3715
|
+
headers: {
|
|
3716
|
+
'Content-Type': 'application/json',
|
|
3717
|
+
...options?.headers,
|
|
3718
|
+
...params.headers
|
|
3719
|
+
}
|
|
3720
|
+
});
|
|
3721
|
+
}
|
|
3722
|
+
/**
|
|
3723
|
+
* Provision Phone Number
|
|
3724
|
+
*
|
|
3725
|
+
* Wire a number up at the carrier and in LiveKit so it can carry calls.
|
|
3726
|
+
*
|
|
3727
|
+
* `import_phone_numbers` already does this unless it was called with
|
|
3728
|
+
* `provision: false`; use this to retry a number left in `error`, or to bring
|
|
3729
|
+
* one back after re-enabling it.
|
|
3730
|
+
*/
|
|
3731
|
+
provision(parameters, options) {
|
|
3732
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'number_id' }] }]);
|
|
3733
|
+
return (options?.client ?? this.client).post({
|
|
3734
|
+
responseStyle: 'data',
|
|
3735
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3736
|
+
in: 'cookie',
|
|
3737
|
+
name: 'talqing_session',
|
|
3738
|
+
type: 'apiKey'
|
|
3739
|
+
}],
|
|
3740
|
+
url: '/v1/telephony/phone-numbers/{number_id}/provision',
|
|
3741
|
+
...options,
|
|
3742
|
+
...params
|
|
3743
|
+
});
|
|
3744
|
+
}
|
|
3745
|
+
/**
|
|
3746
|
+
* Unassign Phone Number
|
|
3747
|
+
*
|
|
3748
|
+
* Take the agent off a number, so incoming calls are no longer answered.
|
|
3749
|
+
*
|
|
3750
|
+
* The number stays provisioned and can still place outbound calls; its
|
|
3751
|
+
* readiness drops to `needs_agent`.
|
|
3752
|
+
*/
|
|
3753
|
+
unassign(parameters, options) {
|
|
3754
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'number_id' }] }]);
|
|
3755
|
+
return (options?.client ?? this.client).post({
|
|
3756
|
+
responseStyle: 'data',
|
|
3757
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3758
|
+
in: 'cookie',
|
|
3759
|
+
name: 'talqing_session',
|
|
3760
|
+
type: 'apiKey'
|
|
3761
|
+
}],
|
|
3762
|
+
url: '/v1/telephony/phone-numbers/{number_id}/unassign',
|
|
3763
|
+
...options,
|
|
3764
|
+
...params
|
|
3765
|
+
});
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
export class Providers extends HeyApiClient {
|
|
3769
|
+
/**
|
|
3770
|
+
* List Telephony Providers
|
|
3771
|
+
*
|
|
3772
|
+
* List the telephony carriers an account can be connected to.
|
|
3773
|
+
*
|
|
3774
|
+
* `account_info_keys`, `credential_keys` and `setup_fields` state exactly what
|
|
3775
|
+
* connecting each carrier needs — read this before `create_telephony_account`
|
|
3776
|
+
* rather than guessing field names. Entries with `implemented: false` have no
|
|
3777
|
+
* adapter yet and cannot be used.
|
|
3778
|
+
*/
|
|
3779
|
+
list(parameters, options) {
|
|
3780
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
3781
|
+
return (options?.client ?? this.client).get({
|
|
3782
|
+
responseStyle: 'data',
|
|
3783
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3784
|
+
in: 'cookie',
|
|
3785
|
+
name: 'talqing_session',
|
|
3786
|
+
type: 'apiKey'
|
|
3787
|
+
}],
|
|
3788
|
+
url: '/v1/telephony/providers',
|
|
3789
|
+
...options,
|
|
3790
|
+
...params
|
|
3791
|
+
});
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
export class Telephony extends HeyApiClient {
|
|
3795
|
+
get accounts() {
|
|
3796
|
+
return this._accounts ?? (this._accounts = new Accounts({ client: this.client }));
|
|
3797
|
+
}
|
|
3798
|
+
get phoneNumbers() {
|
|
3799
|
+
return this._phoneNumbers ?? (this._phoneNumbers = new PhoneNumbers({ client: this.client }));
|
|
3800
|
+
}
|
|
3801
|
+
get providers() {
|
|
3802
|
+
return this._providers ?? (this._providers = new Providers({ client: this.client }));
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
export class Versions2 extends HeyApiClient {
|
|
3806
|
+
/**
|
|
3807
|
+
* Get Tool Version
|
|
3808
|
+
*
|
|
3809
|
+
* Fetch what one published version of a tool actually contains.
|
|
3810
|
+
*
|
|
3811
|
+
* `get_tool` lists the versions and when each was published; this returns the
|
|
3812
|
+
* frozen definition itself — the arguments, behaviour flags and operation tree
|
|
3813
|
+
* exactly as they were at that publish. Use it to see what changed between two
|
|
3814
|
+
* versions, or between a version and the current draft.
|
|
3815
|
+
*/
|
|
3816
|
+
get(parameters, options) {
|
|
3817
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }, { in: 'path', key: 'version' }] }]);
|
|
3818
|
+
return (options?.client ?? this.client).get({
|
|
3819
|
+
responseStyle: 'data',
|
|
3820
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3821
|
+
in: 'cookie',
|
|
3822
|
+
name: 'talqing_session',
|
|
3823
|
+
type: 'apiKey'
|
|
3824
|
+
}],
|
|
3825
|
+
url: '/v1/tools/{tool_id}/versions/{version}',
|
|
3826
|
+
...options,
|
|
3827
|
+
...params
|
|
3828
|
+
});
|
|
3829
|
+
}
|
|
3830
|
+
/**
|
|
3831
|
+
* Rollback Tool Version
|
|
3832
|
+
*
|
|
3833
|
+
* Put an earlier published version of a tool back into production.
|
|
3834
|
+
*
|
|
3835
|
+
* That version becomes live immediately and **replaces the current draft**, so
|
|
3836
|
+
* any unpublished edits are lost. No new version is created.
|
|
3837
|
+
*
|
|
3838
|
+
* Agents already published keep the tool definition they were published with,
|
|
3839
|
+
* so republish them for the rollback to reach live calls.
|
|
3840
|
+
*/
|
|
3841
|
+
rollback(parameters, options) {
|
|
3842
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }, { in: 'path', key: 'version' }] }]);
|
|
3843
|
+
return (options?.client ?? this.client).post({
|
|
3844
|
+
responseStyle: 'data',
|
|
3845
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3846
|
+
in: 'cookie',
|
|
3847
|
+
name: 'talqing_session',
|
|
3848
|
+
type: 'apiKey'
|
|
3849
|
+
}],
|
|
3850
|
+
url: '/v1/tools/{tool_id}/versions/{version}/rollback',
|
|
3851
|
+
...options,
|
|
3852
|
+
...params
|
|
3853
|
+
});
|
|
3854
|
+
}
|
|
3855
|
+
}
|
|
3856
|
+
export class Tools2 extends HeyApiClient {
|
|
3857
|
+
/**
|
|
3858
|
+
* List Tools
|
|
3859
|
+
*
|
|
3860
|
+
* List the workspace's tools with their draft operation trees.
|
|
3861
|
+
*
|
|
3862
|
+
* `published_version` is null for a tool that has never been published; only
|
|
3863
|
+
* published tools can be attached to an agent or used as a lifecycle hook.
|
|
3864
|
+
*/
|
|
3865
|
+
list(parameters, options) {
|
|
3866
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
3867
|
+
return (options?.client ?? this.client).get({
|
|
3868
|
+
responseStyle: 'data',
|
|
3869
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3870
|
+
in: 'cookie',
|
|
3871
|
+
name: 'talqing_session',
|
|
3872
|
+
type: 'apiKey'
|
|
3873
|
+
}],
|
|
3874
|
+
url: '/v1/tools',
|
|
3875
|
+
...options,
|
|
3876
|
+
...params
|
|
3877
|
+
});
|
|
3878
|
+
}
|
|
3879
|
+
/**
|
|
3880
|
+
* Create Tool
|
|
3881
|
+
*
|
|
3882
|
+
* Create a draft tool.
|
|
3883
|
+
*
|
|
3884
|
+
* `name` is the function name the agent's LLM sees, so it must be a valid
|
|
3885
|
+
* identifier and describe the capability. `json_schema` declares the arguments
|
|
3886
|
+
* that LLM supplies. `operations` may be sent here or added later with a
|
|
3887
|
+
* patch. The tool is a draft until published.
|
|
3888
|
+
*/
|
|
3889
|
+
create(parameters, options) {
|
|
3890
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createToolRequest', map: 'body' }] }]);
|
|
3891
|
+
return (options?.client ?? this.client).post({
|
|
3892
|
+
responseStyle: 'data',
|
|
3893
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3894
|
+
in: 'cookie',
|
|
3895
|
+
name: 'talqing_session',
|
|
3896
|
+
type: 'apiKey'
|
|
3897
|
+
}],
|
|
3898
|
+
url: '/v1/tools',
|
|
3899
|
+
...options,
|
|
3900
|
+
...params,
|
|
3901
|
+
headers: {
|
|
3902
|
+
'Content-Type': 'application/json',
|
|
3903
|
+
...options?.headers,
|
|
3904
|
+
...params.headers
|
|
3905
|
+
}
|
|
3906
|
+
});
|
|
3907
|
+
}
|
|
3908
|
+
/**
|
|
3909
|
+
* Delete Tool
|
|
3910
|
+
*
|
|
3911
|
+
* Delete a tool and its published versions permanently.
|
|
3912
|
+
*/
|
|
3913
|
+
delete(parameters, options) {
|
|
3914
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }] }]);
|
|
3915
|
+
return (options?.client ?? this.client).delete({
|
|
3916
|
+
responseStyle: 'data',
|
|
3917
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3918
|
+
in: 'cookie',
|
|
3919
|
+
name: 'talqing_session',
|
|
3920
|
+
type: 'apiKey'
|
|
3921
|
+
}],
|
|
3922
|
+
url: '/v1/tools/{tool_id}',
|
|
3923
|
+
...options,
|
|
3924
|
+
...params
|
|
3925
|
+
});
|
|
3926
|
+
}
|
|
3927
|
+
/**
|
|
3928
|
+
* Get Tool
|
|
3929
|
+
*
|
|
3930
|
+
* Fetch one tool: behaviour flags, argument schema, draft operation tree
|
|
3931
|
+
* and the list of published versions.
|
|
3932
|
+
*/
|
|
3933
|
+
get(parameters, options) {
|
|
3934
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }] }]);
|
|
3935
|
+
return (options?.client ?? this.client).get({
|
|
3936
|
+
responseStyle: 'data',
|
|
3937
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3938
|
+
in: 'cookie',
|
|
3939
|
+
name: 'talqing_session',
|
|
3940
|
+
type: 'apiKey'
|
|
3941
|
+
}],
|
|
3942
|
+
url: '/v1/tools/{tool_id}',
|
|
3943
|
+
...options,
|
|
3944
|
+
...params
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3947
|
+
/**
|
|
3948
|
+
* Patch Tool
|
|
3949
|
+
*
|
|
3950
|
+
* Update a draft tool. Omitted fields are left unchanged.
|
|
3951
|
+
*
|
|
3952
|
+
* `operations` is the one exception: sending it replaces the entire tree, so
|
|
3953
|
+
* include every node you want to keep. Changes land on the draft; publish to
|
|
3954
|
+
* make them live.
|
|
3955
|
+
*/
|
|
3956
|
+
update(parameters, options) {
|
|
3957
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }, { key: 'patchToolRequest', map: 'body' }] }]);
|
|
3958
|
+
return (options?.client ?? this.client).patch({
|
|
3959
|
+
responseStyle: 'data',
|
|
3960
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3961
|
+
in: 'cookie',
|
|
3962
|
+
name: 'talqing_session',
|
|
3963
|
+
type: 'apiKey'
|
|
3964
|
+
}],
|
|
3965
|
+
url: '/v1/tools/{tool_id}',
|
|
3966
|
+
...options,
|
|
3967
|
+
...params,
|
|
3968
|
+
headers: {
|
|
3969
|
+
'Content-Type': 'application/json',
|
|
3970
|
+
...options?.headers,
|
|
3971
|
+
...params.headers
|
|
3972
|
+
}
|
|
3973
|
+
});
|
|
3974
|
+
}
|
|
3975
|
+
/**
|
|
3976
|
+
* Publish Tool
|
|
3977
|
+
*
|
|
3978
|
+
* Validate the draft and freeze it as a new immutable tool version.
|
|
3979
|
+
*
|
|
3980
|
+
* Required before the tool can be attached to an agent or used as a lifecycle
|
|
3981
|
+
* hook. Agents already published keep the definition they were published with
|
|
3982
|
+
* until they are republished.
|
|
3983
|
+
*/
|
|
3984
|
+
publish(parameters, options) {
|
|
3985
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }, { key: 'publishToolRequest', map: 'body' }] }]);
|
|
3986
|
+
return (options?.client ?? this.client).post({
|
|
3987
|
+
responseStyle: 'data',
|
|
3988
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
3989
|
+
in: 'cookie',
|
|
3990
|
+
name: 'talqing_session',
|
|
3991
|
+
type: 'apiKey'
|
|
3992
|
+
}],
|
|
3993
|
+
url: '/v1/tools/{tool_id}/publish',
|
|
3994
|
+
...options,
|
|
3995
|
+
...params,
|
|
3996
|
+
headers: {
|
|
3997
|
+
'Content-Type': 'application/json',
|
|
3998
|
+
...options?.headers,
|
|
3999
|
+
...params.headers
|
|
4000
|
+
}
|
|
4001
|
+
});
|
|
4002
|
+
}
|
|
4003
|
+
/**
|
|
4004
|
+
* Run Tool
|
|
4005
|
+
*
|
|
4006
|
+
* Run the draft tool once with arguments you supply and see every step.
|
|
4007
|
+
*
|
|
4008
|
+
* This executes for real: HTTP operations call your endpoints with your
|
|
4009
|
+
* secrets, so a tool that books a slot or charges a card will do so.
|
|
4010
|
+
* Conversational operations (`say`, `generate_reply`, `add_message`,
|
|
4011
|
+
* `handoff`, `end_call`, `frontend_rpc`) are recorded with their resolved text
|
|
4012
|
+
* rather than performed.
|
|
4013
|
+
*
|
|
4014
|
+
* Each step reports the resolved request and response, the branch an `if`
|
|
4015
|
+
* took, and everything published into `tooldata` or `userdata`. Secrets are
|
|
4016
|
+
* redacted. Nothing is saved, so there is no need to publish first.
|
|
4017
|
+
*/
|
|
4018
|
+
run(parameters, options) {
|
|
4019
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }, { key: 'runToolRequest', map: 'body' }] }]);
|
|
4020
|
+
return (options?.client ?? this.client).post({
|
|
4021
|
+
responseStyle: 'data',
|
|
4022
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4023
|
+
in: 'cookie',
|
|
4024
|
+
name: 'talqing_session',
|
|
4025
|
+
type: 'apiKey'
|
|
4026
|
+
}],
|
|
4027
|
+
url: '/v1/tools/{tool_id}/run',
|
|
4028
|
+
...options,
|
|
4029
|
+
...params,
|
|
4030
|
+
headers: {
|
|
4031
|
+
'Content-Type': 'application/json',
|
|
4032
|
+
...options?.headers,
|
|
4033
|
+
...params.headers
|
|
4034
|
+
}
|
|
4035
|
+
});
|
|
4036
|
+
}
|
|
4037
|
+
/**
|
|
4038
|
+
* Validate Tool
|
|
4039
|
+
*
|
|
4040
|
+
* Check the draft operation tree without publishing it.
|
|
4041
|
+
*
|
|
4042
|
+
* Reports unknown argument and secret references, unreachable published
|
|
4043
|
+
* fields, handoff targets that are not published, code that fails to
|
|
4044
|
+
* transpile, and userdata read before it is written.
|
|
4045
|
+
*/
|
|
4046
|
+
validate(parameters, options) {
|
|
4047
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'tool_id' }] }]);
|
|
4048
|
+
return (options?.client ?? this.client).post({
|
|
4049
|
+
responseStyle: 'data',
|
|
4050
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4051
|
+
in: 'cookie',
|
|
4052
|
+
name: 'talqing_session',
|
|
4053
|
+
type: 'apiKey'
|
|
4054
|
+
}],
|
|
4055
|
+
url: '/v1/tools/{tool_id}/validate',
|
|
4056
|
+
...options,
|
|
4057
|
+
...params
|
|
4058
|
+
});
|
|
4059
|
+
}
|
|
4060
|
+
get versions() {
|
|
4061
|
+
return this._versions ?? (this._versions = new Versions2({ client: this.client }));
|
|
4062
|
+
}
|
|
4063
|
+
}
|
|
4064
|
+
export class Webhooks extends HeyApiClient {
|
|
4065
|
+
/**
|
|
4066
|
+
* List Webhooks
|
|
4067
|
+
*
|
|
4068
|
+
* List the workspace's webhooks with their subscriptions and last delivery
|
|
4069
|
+
* result. Signing secrets are returned only as a masked hint.
|
|
4070
|
+
*/
|
|
4071
|
+
list(parameters, options) {
|
|
4072
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
|
|
4073
|
+
return (options?.client ?? this.client).get({
|
|
4074
|
+
responseStyle: 'data',
|
|
4075
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4076
|
+
in: 'cookie',
|
|
4077
|
+
name: 'talqing_session',
|
|
4078
|
+
type: 'apiKey'
|
|
4079
|
+
}],
|
|
4080
|
+
url: '/v1/webhooks',
|
|
4081
|
+
...options,
|
|
4082
|
+
...params
|
|
4083
|
+
});
|
|
4084
|
+
}
|
|
4085
|
+
/**
|
|
4086
|
+
* Create Webhook
|
|
4087
|
+
*
|
|
4088
|
+
* Create a webhook. Webhooks are workspace-wide — they fire for every agent.
|
|
4089
|
+
*
|
|
4090
|
+
* An empty `subscribed_events` subscribes to all events. A signing secret is
|
|
4091
|
+
* generated when none is supplied; either way the plaintext secret is returned
|
|
4092
|
+
* once here and never again.
|
|
4093
|
+
*/
|
|
4094
|
+
create(parameters, options) {
|
|
4095
|
+
const params = buildClientParams([parameters], [{ args: [{ key: 'createWebhookRequest', map: 'body' }] }]);
|
|
4096
|
+
return (options?.client ?? this.client).post({
|
|
4097
|
+
responseStyle: 'data',
|
|
4098
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4099
|
+
in: 'cookie',
|
|
4100
|
+
name: 'talqing_session',
|
|
4101
|
+
type: 'apiKey'
|
|
4102
|
+
}],
|
|
4103
|
+
url: '/v1/webhooks',
|
|
4104
|
+
...options,
|
|
4105
|
+
...params,
|
|
4106
|
+
headers: {
|
|
4107
|
+
'Content-Type': 'application/json',
|
|
4108
|
+
...options?.headers,
|
|
4109
|
+
...params.headers
|
|
4110
|
+
}
|
|
4111
|
+
});
|
|
4112
|
+
}
|
|
4113
|
+
/**
|
|
4114
|
+
* Event Types
|
|
4115
|
+
*
|
|
4116
|
+
* List every event a webhook can subscribe to, and which are emitted today.
|
|
4117
|
+
*/
|
|
4118
|
+
eventTypes(options) {
|
|
4119
|
+
return (options?.client ?? this.client).get({
|
|
4120
|
+
responseStyle: 'data',
|
|
4121
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4122
|
+
in: 'cookie',
|
|
4123
|
+
name: 'talqing_session',
|
|
4124
|
+
type: 'apiKey'
|
|
4125
|
+
}],
|
|
4126
|
+
url: '/v1/webhooks/event-types',
|
|
4127
|
+
...options
|
|
4128
|
+
});
|
|
4129
|
+
}
|
|
4130
|
+
/**
|
|
4131
|
+
* Delete Webhook
|
|
4132
|
+
*
|
|
4133
|
+
* Delete a webhook permanently.
|
|
4134
|
+
*/
|
|
4135
|
+
delete(parameters, options) {
|
|
4136
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'webhook_id' }] }]);
|
|
4137
|
+
return (options?.client ?? this.client).delete({
|
|
4138
|
+
responseStyle: 'data',
|
|
4139
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4140
|
+
in: 'cookie',
|
|
4141
|
+
name: 'talqing_session',
|
|
4142
|
+
type: 'apiKey'
|
|
4143
|
+
}],
|
|
4144
|
+
url: '/v1/webhooks/{webhook_id}',
|
|
4145
|
+
...options,
|
|
4146
|
+
...params
|
|
4147
|
+
});
|
|
4148
|
+
}
|
|
4149
|
+
/**
|
|
4150
|
+
* Patch Webhook
|
|
4151
|
+
*
|
|
4152
|
+
* Update a webhook's URL, subscriptions or status. Omitted fields are left
|
|
4153
|
+
* unchanged; a disabled webhook stops receiving deliveries.
|
|
4154
|
+
*/
|
|
4155
|
+
update(parameters, options) {
|
|
4156
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'webhook_id' }, { key: 'patchWebhookRequest', map: 'body' }] }]);
|
|
4157
|
+
return (options?.client ?? this.client).patch({
|
|
4158
|
+
responseStyle: 'data',
|
|
4159
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4160
|
+
in: 'cookie',
|
|
4161
|
+
name: 'talqing_session',
|
|
4162
|
+
type: 'apiKey'
|
|
4163
|
+
}],
|
|
4164
|
+
url: '/v1/webhooks/{webhook_id}',
|
|
4165
|
+
...options,
|
|
4166
|
+
...params,
|
|
4167
|
+
headers: {
|
|
4168
|
+
'Content-Type': 'application/json',
|
|
4169
|
+
...options?.headers,
|
|
4170
|
+
...params.headers
|
|
4171
|
+
}
|
|
4172
|
+
});
|
|
4173
|
+
}
|
|
4174
|
+
/**
|
|
4175
|
+
* Webhook Deliveries
|
|
4176
|
+
*
|
|
4177
|
+
* List recent delivery attempts for one webhook — event, response status
|
|
4178
|
+
* and error — newest first. The place to look when a webhook seems silent.
|
|
4179
|
+
*/
|
|
4180
|
+
deliveries(parameters, options) {
|
|
4181
|
+
const params = buildClientParams([parameters], [{ args: [
|
|
4182
|
+
{ in: 'path', key: 'webhook_id' },
|
|
4183
|
+
{ in: 'query', key: 'limit' },
|
|
4184
|
+
{ in: 'query', key: 'offset' }
|
|
4185
|
+
] }]);
|
|
4186
|
+
return (options?.client ?? this.client).get({
|
|
4187
|
+
responseStyle: 'data',
|
|
4188
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4189
|
+
in: 'cookie',
|
|
4190
|
+
name: 'talqing_session',
|
|
4191
|
+
type: 'apiKey'
|
|
4192
|
+
}],
|
|
4193
|
+
url: '/v1/webhooks/{webhook_id}/deliveries',
|
|
4194
|
+
...options,
|
|
4195
|
+
...params
|
|
4196
|
+
});
|
|
4197
|
+
}
|
|
4198
|
+
/**
|
|
4199
|
+
* Rotate Webhook Secret
|
|
4200
|
+
*
|
|
4201
|
+
* Issue a new signing secret, invalidating the old one immediately.
|
|
4202
|
+
*
|
|
4203
|
+
* The new plaintext secret is returned once here; the receiver must be updated
|
|
4204
|
+
* or signature checks will start failing.
|
|
4205
|
+
*/
|
|
4206
|
+
rotateSecret(parameters, options) {
|
|
4207
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'webhook_id' }] }]);
|
|
4208
|
+
return (options?.client ?? this.client).post({
|
|
4209
|
+
responseStyle: 'data',
|
|
4210
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4211
|
+
in: 'cookie',
|
|
4212
|
+
name: 'talqing_session',
|
|
4213
|
+
type: 'apiKey'
|
|
4214
|
+
}],
|
|
4215
|
+
url: '/v1/webhooks/{webhook_id}/rotate-secret',
|
|
4216
|
+
...options,
|
|
4217
|
+
...params
|
|
4218
|
+
});
|
|
4219
|
+
}
|
|
4220
|
+
/**
|
|
4221
|
+
* Test Webhook
|
|
4222
|
+
*
|
|
4223
|
+
* Send a signed test event and return the endpoint's response, so delivery
|
|
4224
|
+
* and signature verification can be checked end to end.
|
|
4225
|
+
*/
|
|
4226
|
+
test(parameters, options) {
|
|
4227
|
+
const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'webhook_id' }] }]);
|
|
4228
|
+
return (options?.client ?? this.client).post({
|
|
4229
|
+
responseStyle: 'data',
|
|
4230
|
+
security: [{ scheme: 'bearer', type: 'http' }, {
|
|
4231
|
+
in: 'cookie',
|
|
4232
|
+
name: 'talqing_session',
|
|
4233
|
+
type: 'apiKey'
|
|
4234
|
+
}],
|
|
4235
|
+
url: '/v1/webhooks/{webhook_id}/test',
|
|
4236
|
+
...options,
|
|
4237
|
+
...params
|
|
4238
|
+
});
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
export class TalqingApi extends HeyApiClient {
|
|
4242
|
+
constructor(args) {
|
|
4243
|
+
super(args);
|
|
4244
|
+
TalqingApi.__registry.set(this, args?.key);
|
|
4245
|
+
}
|
|
4246
|
+
/**
|
|
4247
|
+
* Health
|
|
4248
|
+
*
|
|
4249
|
+
* Liveness probe: `200` once this process is serving. Unauthenticated.
|
|
4250
|
+
*
|
|
4251
|
+
* It answers for the API process, not its dependencies — a `200` here does not
|
|
4252
|
+
* promise Postgres, Redis or LiveKit are reachable.
|
|
4253
|
+
*/
|
|
4254
|
+
health(options) {
|
|
4255
|
+
return (options?.client ?? this.client).get({
|
|
4256
|
+
responseStyle: 'data',
|
|
4257
|
+
url: '/health',
|
|
4258
|
+
...options
|
|
4259
|
+
});
|
|
4260
|
+
}
|
|
4261
|
+
get agents() {
|
|
4262
|
+
return this._agents ?? (this._agents = new Agents({ client: this.client }));
|
|
4263
|
+
}
|
|
4264
|
+
get auth() {
|
|
4265
|
+
return this._auth ?? (this._auth = new Auth({ client: this.client }));
|
|
4266
|
+
}
|
|
4267
|
+
get providerKeys() {
|
|
4268
|
+
return this._providerKeys ?? (this._providerKeys = new ProviderKeys({ client: this.client }));
|
|
4269
|
+
}
|
|
4270
|
+
get calls() {
|
|
4271
|
+
return this._calls ?? (this._calls = new Calls({ client: this.client }));
|
|
4272
|
+
}
|
|
4273
|
+
get catalog() {
|
|
4274
|
+
return this._catalog ?? (this._catalog = new Catalog({ client: this.client }));
|
|
4275
|
+
}
|
|
4276
|
+
get conversations() {
|
|
4277
|
+
return this._conversations ?? (this._conversations = new Conversations({ client: this.client }));
|
|
4278
|
+
}
|
|
4279
|
+
get copilot() {
|
|
4280
|
+
return this._copilot ?? (this._copilot = new Copilot({ client: this.client }));
|
|
4281
|
+
}
|
|
4282
|
+
get email() {
|
|
4283
|
+
return this._email ?? (this._email = new Email({ client: this.client }));
|
|
4284
|
+
}
|
|
4285
|
+
get integrations() {
|
|
4286
|
+
return this._integrations ?? (this._integrations = new Integrations({ client: this.client }));
|
|
4287
|
+
}
|
|
4288
|
+
get knowledge() {
|
|
4289
|
+
return this._knowledge ?? (this._knowledge = new Knowledge2({ client: this.client }));
|
|
4290
|
+
}
|
|
4291
|
+
get tokens() {
|
|
4292
|
+
return this._tokens ?? (this._tokens = new Tokens({ client: this.client }));
|
|
4293
|
+
}
|
|
4294
|
+
get observability() {
|
|
4295
|
+
return this._observability ?? (this._observability = new Observability({ client: this.client }));
|
|
4296
|
+
}
|
|
4297
|
+
get orgs() {
|
|
4298
|
+
return this._orgs ?? (this._orgs = new Orgs({ client: this.client }));
|
|
4299
|
+
}
|
|
4300
|
+
get schemas() {
|
|
4301
|
+
return this._schemas ?? (this._schemas = new Schemas({ client: this.client }));
|
|
4302
|
+
}
|
|
4303
|
+
get secrets() {
|
|
4304
|
+
return this._secrets ?? (this._secrets = new Secrets({ client: this.client }));
|
|
4305
|
+
}
|
|
4306
|
+
get tasks() {
|
|
4307
|
+
return this._tasks ?? (this._tasks = new Tasks2({ client: this.client }));
|
|
4308
|
+
}
|
|
4309
|
+
get telephony() {
|
|
4310
|
+
return this._telephony ?? (this._telephony = new Telephony({ client: this.client }));
|
|
4311
|
+
}
|
|
4312
|
+
get tools() {
|
|
4313
|
+
return this._tools ?? (this._tools = new Tools2({ client: this.client }));
|
|
4314
|
+
}
|
|
4315
|
+
get webhooks() {
|
|
4316
|
+
return this._webhooks ?? (this._webhooks = new Webhooks({ client: this.client }));
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
4319
|
+
TalqingApi.__registry = new HeyApiRegistry();
|
|
4320
|
+
//# sourceMappingURL=sdk.gen.js.map
|